text
stringlengths
2.85k
2.55M
label
class label
11 classes
Efficient molecular dynamics simulations with many-body potentials on graphics processing units Zheyong Fan 1,2∗, Wei Chen3 ∗, Ville Vierimaa 2 , Ari Harju 2 1 School 2 COMP 3 Computer arXiv:1610.03343v2 [physics.comp-ph] 25 Jun 2017 of Mathematics and Physics, Bohai University, Jinzhou, China Centre of Excellence and Helsinki Institute of Physics, Department of Applied Physics, Aalto University, Helsinki, Finland Network Information Center, Chinese Academy of Sciences, P.O. Box 349, 100190 Beijing, China Abstract Graphics processing units have been extensively used to accelerate classical molecular dynamics simulations. However, there is much less progress on the acceleration of force evaluations for many-body potentials compared to pairwise ones. In the conventional force evaluation algorithm for many-body potentials, the force, virial stress, and heat current for a given atom are accumulated within different loops, which could result in write conflict between different threads in a CUDA kernel. In this work, we provide a new force evaluation algorithm, which is based on an explicit pairwise force expression for many-body potentials derived recently [Phys. Rev. B 92 (2015) 094301]. In our algorithm, the force, virial stress, and heat current for a given atom can be accumulated within a single thread and is free of write conflicts. We discuss the formulations and algorithms and evaluate their performance. A new open-source code, GPUMD, is developed based on the proposed formulations. For the Tersoff many-body potential, the double precision performance of GPUMD using a Tesla K40 card is equivalent to that of the LAMMPS (Large-scale Atomic/Molecular Massively Parallel Simulator) molecular dynamics code running with about 100 CPU cores (Intel Xeon CPU X5670 @ 2.93 GHz). Keywords: Molecular dynamics simulation, Many-body potential, Tersoff potential, Stillinger-Weber potential, Graphics processing units, Virial stress, Heat current 1. Introduction Molecular dynamics (MD) simulation is one of the most important numerical tools in investigating various physical properties of materials. Many applications using MD simulation demand high performance computing. In the past decade, the computational power of general-purpose graphics processing units (GPUs) has been exploited to accelerate many MD simulations. Not only existing MD codes and libraries, such as AMBER [1], Gromacs [2, 3], LAMMPS [4–6], NAMD [7], and OpenMM [8] have been benefited from utilizing GPUs as accelerators, but also new codes, such as HOOMD-blue [9– 11], HALMD [12], and RUMD [13], have been built from the ground up to achieve high performance using one or more GPUs. Most of the previous relevant works have only considered pairwise potentials, or a special many-body potential, namely, the embedded atom method [14–16], which are relatively simple to implement on GPUs. GPU-acceleration of many-body potentials such as the Tersoff [17], Stillinger-Weber [18], and Brenner [19] potentials, which play an important role in modelling various materials, is more challenging and has only attracted some attention recently [20–25]. Taking three-body in∗ Corresponding authors Email addresses: [email protected] (Zheyong Fan 1,2 ), [email protected] (Wei Chen3 ) Preprint submitted to Computer Physics Communications teraction as an example, a naive implementation of the force evaluation function, as usually done in a serial CPU code, requires accumulating the forces on three different atoms within a single thread. In a GPU kernel with many threads, each atom is usually associated with one thread and the force accumulation for an atom from the thread it belongs to will conflict with the force accumulation for the same atom from another thread. This causes a problem called write conflict where two threads try to write data simultaneously into the same global memory [26]. One way to avoid write conflict is to use atomic operations, which are usually quite slow and can also introduce randomness in the computation, which is undesirable for debugging. There have been some proposals to avoid using atomic operations. Hou et al. [20] proposed an algorithm for implementing the Tersoff potential on a GPU, which has achieved impressive performance, but requires using a special fixed neighbour list and is thus not quite flexible. Brown and Yamada [21] proposed a flexible GPU-implementation of the Stillinger-Weber potential within LAMMPS, which is free of write conflicts. A similar proposal was given by Knizhnik et al. [22]. Recently, Höhnerbach et al. [23] developed a vectorization scheme to achieve performance portability across various parallel computing platforms for the Tersoff potential within LAMMPS. GPUacceleration of the more complicated second-generation REBO potential [19] has also been studied by Tredak et al. [24]. In a recently published work [25] (after we submitted this paper), June 27, 2017 Nguyen reported significant speedups for MD simulations with Tersoff-type potentials using one or more high-end GPUs. Here, we propose a general algorithm of force evaluation for many-body potentials and present details of its GPUimplementation and performance. The new force evaluation algorithm is based on an explicit pairwise force expression for many-body potentials derived recently [27]. In this approach, the force, virial stress, and heat current for a given atom are well defined and can be accumulated within a single thread. Therefore, write conflict is absent by construction. To be specific, we discuss the algorithm explicitly in terms of the Tersoff potential, but performance evaluation is made for both the Tersoff potential and the Stillinger-Weber potential. The implementation is done based on a previous work [28], and the resulting code, which we call GPUMD (Graphics Processing Units Molecular Dynamics), will be made public soon. Using silicon crystal as a test system, we measure the performance of GPUMD and compare it with LAMMPS. The function fC (ri j ) is a cutoff function, which is only nonzero when ri j is less than a cutoff distance. Therefore, a Verlet neighbour list can be used to speed up the force evaluation. For uniform cutoff, the standard cell list method is very efficient, although more sophisticated methods perform better for systems with large size disparities [29]. For simplicity, we have presented the original Tersoff potential formulation in a form suitable for single-element systems. Our algorithm and implementation are more general, which can treat systems with more than one type of atom or systems described by a modified formulation of the Tersoff potential. 2.2. The conventional method of implementing the Tersoff potential Due to the three-body nature of the Tersoff potential, the conventional method for evaluating the interatomic forces is significantly different from that in the case of a simple two-body potential. Algorithm 1 presents a pseudo code for the conventional method as implemented in most existing MD codes such as LAMMPS [4]. The following symbols are used: 2. Formulations and algorithms 2.1. The Tersoff many-body potential Although the method to be introduced is applicable to any many-body potential, it is beneficial to start with an explicit example, which is taken as the widely used Tersoff potential. Generalizations to other many-body potentials will be discussed later. The total potential energy for a system of N atoms described by the Tersoff potential can be written as [17] U= 1 XX 2 i Ui j , • N: number of atoms • Ui : potential energy of atom i • Fi : total force on atom i • Wi : per-atom virial stress of atom i • NNi : number of neighbour atoms of atom i • NLim : index of the mth neighbour atom of atom i (1) j,i • J i : per-atom heat current of atom i where   Ui j = fC (ri j ) fR (ri j ) − bi j fA (ri j ) , − 1  bi j = 1 + βn ζinj 2n , X ζi j = fC (rik )gi jk , P In Algorithm 1, the potential energy Ui ≡ j,i Ui j /2 is accumulated in line 7, the two-body parts of the force and per-atom virial stress are accumulated in lines 8-9 and 10, respectively, and the many-body parts of the force and per-atom virial stress are accumulated in lines 16-18 and 19-21, respectively. Last, in line 26, the per-atom heat current is calculated from the peratom virial stress and velocity. The forces defined in the pseudo code can be explicitly written as (2) (3) (4) k,i, j gi jk = 1 + c2 c2 − 2 . 2 d d + (h − cos θi jk )2 (5) Here, β, n, c, d, and h are material-specific parameters and θi jk is the angle formed by ri j and rik , which implies that cos θi jk = cos θik j = ri j · rik . ri j rik =−  1  ∂  1 ∂  fC (ri j ) fR (ri j ) + bi j fC (ri j ) fA (ri j ) , (7) 2 ∂ri 2 ∂ri F(ij j) = −  1  ∂  1 ∂  fC (ri j ) fR (ri j ) + bi j fC (ri j ) fA (ri j ) , (8) 2 ∂r j 2 ∂r j (i j) Fi (6) Our convention is that ri j ≡ r j − ri represents the position difference pointing from atom i to atom j. The magnitude of ri j is denoted as ri j . As in many empirical potentials, the energy Ui j consists of a repulsive part fR (ri j ) and an attractive part −bi j fA (ri j ). The many-body nature of the Tersoff potential is embodied in the bond order function bi j appearing in the attractive part, the value of which depends not only on ri and r j , but also on the positions of other atoms near atom i. 2 F(ii jk) =  ∂bi j ∂  1 fC (ri j ) fA (ri j ) fC (rik )gi jk , 2 ∂ζi j ∂ri (9) F(ij jk) =  ∂bi j ∂  1 fC (ri j ) fA (ri j ) fC (rik )gi jk , 2 ∂ζi j ∂r j (10) F(ik jk) =  ∂bi j ∂  1 fC (ri j ) fA (ri j ) fC (rik )gi jk . 2 ∂ζi j ∂rk (11) Algorithm 1 Pseudo code for the conventional method of evaluating many-body force and related quantities. 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: tal force on atom i would not be correctly accumulated. One may try to use atomic operations to solve this problem, but this would hardly result in a gain of performance. for i = 0 to N − 1 do Initialise Ui , Fi , and Wi to zero end for for i = 0 to N − 1 do for m = 0 to NNi − 1 do j ← NLim Ui ← Ui + 21 Ui j (i j) Fi ← Fi + Fi F j ← F j + F(ij j) In view of the above discussion, one would immediately realise the difficulty of implementing Algorithm 1 on the GPU: the partial accumulations of the forces and stresses on atoms j and k by the thread associated with atom i (cf. lines 9, 1718, 20-21 in Algorithm 1) would conflict with those by the threads associated with atoms j and k. Therefore, Algorithm 1 is not suitable for GPU-implementation. This difficulty has also been realised previously and some strategies are proposed to circumvent it [20, 21]. Below, we present a general algorithm for many-body potentials which can lead to efficient GPU-implementation. (i j) Wi ← Wi − 12 ri j ⊗ Fi for n = 0 to NNi − 1 do k ← NLin if k = j then Continue end if Fi ← Fi + F(ii jk) F j ← F j + F(ij jk) 2.3. A new method of implementing the Tersoff potential Fk ← Fk + F(ik jk)   Wi ← Wi + 13 ri j ⊗ F(ij jk) + rik ⊗ F(ik jk)   W j ← W j + 31 ri j ⊗ F(ij jk) + rik ⊗ F(ik jk)   Wk ← Wk + 13 ri j ⊗ F(ij jk) + rik ⊗ F(ik jk) end for end for end for for i = 0 to N − 1 do J i ← Wi · vi end for Despite the many-body nature of the Tersoff potential, a pairwise force expression that complies with Newton’s third law has been derived recently [27]: Fi = X FTersoff , ij (12) j,i = −FTersoff FTersoff ji ij Here, only the repulsive part of F(ii j) [the first term on the right hand side of Eq. (7)] is pairwise; all the other force expressions are not. Newton’s third law could be exploited to reduce calculations regarding the pairwise part, but this would not result in a noticeable improvement of the overall performance, because the pairwise part only takes up a tiny fraction of the whole force evaluation. Therefore, Newton’s third law has not been used in Algorithm 1. Regardless of using Newton’s third law for the pairwise part or not, the above conventional method can be straightforwardly implemented on the CPU. 1 ∂ = 2 ∂ri j   X   Ui j + U ji + Uik + U jk  ,  k,i, j (13) which can be simplified in terms of the per-atom potential to be = FTersoff ij ∂Ui ∂U j − . ∂ri j ∂r ji (14) An explicit expression for ∂Ui /∂ri j can be found in Ref. [27]. One may wonder whether the new pairwise force expression produces per-atom forces Fi that are equivalent to those FTersoff ij obtained by the conventional method. The answer should be definitely yes; otherwise, either the conventional or our new method of force evaluation is wrong. To show this equivalence, let us note that according to Algorithm 1, the total force acting on atom i can be written as: Newton’s third law has also not been used on the GPU implementation [9] of two-body potentials due to the problem of concurrent writes (write conflict) to the same location in global memory. When two or more threads in the same warp write to the same location in global memory, only one thread performs the write and it is not defined which thread does it [26]. To understand why this feature of CUDA restricts the use of Newton’s third law on the GPU, we recall that in the commonly used force-evaluation kernel [9] for two-body potentials, which we call the thread-scheme [28], one thread is devoted to the calculation of the total force on one atom. Using Newton’s third law would require accumulating the total force on atom i by two threads. If these two threads are in the same warp, the to- Fi = X j,i   X X  (i jk) Fi + F(i jik) + F(i jki) . (15) F(ii j) + F(i ji) + j,i k,i, j Plugging in Eqs. (7)-(11), and changing the absolute positions 3 ri to relative ones ri j using the chain rule, we get MD packages such as LAMMPS is not implemented in this way. Referring to Algorithm 1, the per-atom virial stress tensor as implemented in LAMMPS takes a rather complicated form:  1X  ∂  1X ∂  fC (ri j ) fR (ri j ) − fC (ri j ) fA (ri j ) bi j 2 j,i ∂ri j 2 j,i ∂ri j X X  1  1 ∂  ∂  + fC (r ji ) fR (r ji ) − fC (r ji ) fA (r ji ) b ji 2 j,i ∂ri j 2 j,i ∂ri j Fi = −  ∂bi j ∂  1 XX fC (rik )gi jk fC (ri j ) fA (ri j ) 2 j,i k,i, j ∂ζi j ∂ri j −  ∂bi j ∂  1 XX fC (rik )gi jk fC (ri j ) fA (ri j ) 2 j,i k,i, j ∂ζi j ∂rik −  ∂b ji ∂  1 XX fC (r jk )g jik fC (r ji ) fA (r ji ) 2 j,i k,i, j ∂ζ ji ∂ri j −  ∂b jk ∂  1 XX fC (r ji )g jki . fC (r jk ) fA (r jk ) 2 j,i k,i, j ∂ζ jk ∂ri j 1X ri j ⊗ F(ii j) 2 j,i  1XX + ri j ⊗ F(ij jk) + rik ⊗ F(ik jk) 3 j,i k,i, j  1XX r ji ⊗ F(i jik) + r jk ⊗ F(kjik) + 3 j,i k,i, j  1XX ji) + . rk j ⊗ F(kj ji) + rki ⊗ F(k i 3 j,i k,i, j Wi = − This expression is not likely equivalent to Eq. (21). For example, the first line in this equation suggests that the force component F(ii j) has been taken to be pairwise, which is not true because bi j , b ji . A related quantity is the potential part of the heat current J. For two-body potentials, it can be written as (16) In this equation, the sum of the 1st and 4th lines is P 1/2 j,i ∂Ui j /∂ri j , the sum of the 2nd and 5th lines is P 1/2 j,i ∂U ji /∂ri j , the 3rd line, with the dummy indices j and P P k interchanged, is 1/2 j,i k,i, j ∂Uik /∂ri j , and the 6th line is P P 1/2 j,i k,i, j ∂U jk /∂ri j . Therefore, the conventional expression Eq. (16) is equivalent to Eqs. (12) and (13). While there is no difference between the force calculations based on the conventional and the new methods, the same cannot be said for some other quantities such as the virial stress and heat current. The total virial stress tensor is defined as X W= ri ⊗ Fi . (17) J=− This is the heat current expression implemented in LAMMPS. However, as pointed out in Ref. [27], this stress-based formula does not apply to many-body potentials. The correct potential part of the heat current formula for many-body potentials reads ! XX ∂U j J= ri j (25) · vi . ∂r ji i j,i (18) Similar to the case of virial stress, one can also decompose the total heat current into per-atom ones: X J= J i, (26) Here, Fi j = −F ji is the pairwise force acting on atom i by atom j. One can also decompose the total virial stress into per-atom ones: X W= Wi , (19) i Ji = i Wi = − 1X ri j ⊗ Fi j . 2 j,i 1X . ri j ⊗ FTersoff ij 2 j,i X j,i (20) ri j ! ∂U j · vi . ∂r ji (27) From the above discussion, we see that all the relevant quantities have a simple per-atom expression. This is exactly what one needs for an efficient GPU-implementation: the per-atom quantities (Ui , Fi , W i , and J i ) can be accumulated solely by the thread associated with atom i and no write conflict would occur. In Algorithm 2, we present a pseudo code for the force evaluation kernel on the GPU. This algorithm is much simpler than Algorithm 1 and can be straightforwardly implemented using CUDA or OpenCL. There is a subtle technical point for Tersoff-type potentials. As can be seen from Eq. (13), the bond-order function bi j and also exist for the Tersoff potential, Since pairwise forces FTersoff ij the per-atom virial stress tensor for the Tersoff potential takes the same simple form as in the case of two-body potentials: =− WTersoff i (23) i In MD simulations with periodic boundary conditions in one or more directions, the absolute positions cause problems and in the case of two-body potentials, one can change them to relative positions using Newton’s third law. The resulting virial stress tensor takes a simple form: 1 XX ri j ⊗ Fi j . 2 i j,i 1 XX ri j (Fi j · vi ). 2 i j,i Since ri j (Fi j · vi ) = (ri j ⊗ Fi j ) · vi , we can also express J in terms of the per-atom virial stress tensor: X J= Wi · vi . (24) i W=− (22) (21) However, the existence of a pairwise force expression has not been widely recognised and the virial stress tensor in standard 4 their derivatives ∂bi j /∂ζi j will be frequently used in the force evaluation kernel. We can reduce the amount of redundant calculations by using a two-kernel approach, where the first kernel is used to precompute bi j and ∂bi j /∂ζi j , and the second kernel is used to perform the force evaluation as in Algorithm 2. The pseudo code for the first kernel is presented in Algorithm 3. This kernel only takes up about 20% of the computation time for the whole force evaluation, but using the two-kernel approach reduces the amount of calculations for bi j and ∂bi j /∂ζi j by a factor of about M, where M is the maximum number of neighbours per atom. In contrast, there is no need of precomputing for the SW potential, and only a single kernel is needed for the force evaluation. Algorithm 2 Pseudo code for the force evaluation kernel for many-body potentials in GPUMD. Require: b is the block index Require: t is the thread index Require: S b is the block size Require: i = S b × b + t 1: Initialize U i , Fi , Wi , and J i to zero 2: if i < N then 3: Read in ri from global memory 4: Read in vi from global memory 5: for m = 0 to NNi − 1 do 6: j ← NLim 7: Read in r j from global memory and calculate ri j 8: ri j ← minimum image of ri j 9: Calculate Ui j ∂Ui 10: Calculate ∂r (with a for-loop over neighbours of i) ij ∂U j ∂r ji (with a for-loop over neighbours of Ui + 21 Ui j   ∂U j i Fi + ∂U ∂ri j − ∂r ji 11: Calculate 12: Ui ← 13: Fi ← 14: 15: 16: 17: 18:  i Wi ← W i − 21 ri j ⊗ ∂U ∂ri j −   ∂U J i ← J i + ri j ∂r jij · vi ∂U j ∂r ji 2.4. Generalization to other many-body potentials The above formalism for the Tersoff potential also applies to other many-body potentials. In Ref. [27], it has been shown that for any many-body potential, the force, virial stress tensor, and heat current have the following per-atom forms: X ∂Ui ∂U j ! many-body Fi , (28) = − ∂ri j ∂r ji j j)  ! 1X ∂Ui ∂U j , − ri j ⊗ 2 j,i ∂ri j ∂r ji ! X ∂U j many-body · vi . Ji = ri j ∂r ji j,i many-body Wi end for Save the per-atom quantities Ui , Fi , Wi , and J i to global memory end if =− (29) (30) Thanks to these per-atom expressions, one can construct a force evaluation CUDA kernel for any many-body potential without worrying about write conflicts. 2.5. Comparison with previous works Our force evaluation algorithm should be largely equivalent to that proposed by Brown and Yamada [21] for the SW potential, which was recently generalized to Tersoff-type potentials by Nguyen [25]. For example, the first and last two attractive functions in Listing 1 of Ref. [25] should be equivalent to lines 10 and 11, respectively, in our Algorithm 2. However, we stress that (1) Our algorithm is original and general, which is based on the formalisms developed in Ref. [27]; (2) Useful quantities such as per-atom virial stress and heat current can also be unambiguously and efficiently calculated along with the force evaluation in our algorithm; (3) We only need a single kernel (except for Tersoff-type potentials where we intentionally precompute the bond order functions) for force evaluation, while more kernels are used in previous works [21, 25]. Algorithm 3 Pseudo code for precomputing the bond-order functions and their derivatives for Tersoff-type potentials in GPUMD. Require: b is the block index Require: t is the thread index Require: S b is the block size Require: i = S b × b + t 1: if i < N then 2: Read in ri from global memory 3: for m = 0 to NNi − 1 do 4: j ← NLim 5: Read in r j from global memory and calculate ri j 6: ri j ← minimum image of ri j 7: Calculate ζi j (with a for-loop over neighbours of i) 8: Calculate bi j and ∂bi j /∂ζi j 9: Save bi j and ∂bi j /∂ζi j to global memory 10: end for 11: end if 3. Performance evaluation We have implemented the force evaluation kernels for the Tersoff and Stillinger-Weber potentials into our GPUMD code using CUDA, and the code has already been used to study various problems in large-scale (up to a few million atoms) graphene-based materials [30–33]. Systematic applications on 5 10 2 10 7 10 6 Speedup factor Speed (atom*step/second) 10 8 Tersoff-double SW-double Tersoff-single SW-single 10 3 10 4 10 5 10 0 10 6 Tersoff-double SW-double Tersoff-single SW-single 10 1 10 3 10 4 10 5 10 6 Number of atoms Number of atoms Figure 1: (color online) Computational speed of GPUMD as a function of number of atoms for Tersoff and Stillinger-Weber potentials using double- or single-precision. The test system is silicon crystal at 300 K and zero pressure. A Tesla K40 card is used to run the code. Figure 2: (color online) Speedup factor of GPUMD (running on a Tesla K40 GPU) as a function of the number of atoms with respect to the serial version of LAMMPS running on Intel Xeon CPU X5670 @ 2.93 GHz. The test system is silicon crystal at 300 K and zero pressure. thermal transport calculations have been presented in Ref. [27]. Here, we measure the performance of GPUMD and compare it with that of LAMMPS, which is the standard production code for simulations with many-body potentials. Simulations with LAMMPS (version 9 Dec 2014) are performed using the “TianHe-1A” supercomputer. Each compute node has two CPUs, which are Intel Xeon X5670 @ 2.93GHz released in 2010. Each CPU has 6 cores, 16 GB memory, a peak performance of 70 GFLOPS, and a maximum power consumption of 95 W. Simulations with GPUMD are performed using a workstation equipped with a Tesla K40 GPU released in 2013, which has 12 GB device memory, a peak performance of 1.4 TFLOPS in double-precision arithmetic and 4.3 TFLOPS in single-precision arithmetic, and a maximum power consumption of 235 W. The test system is silicon crystal of cubic domain with the number of atoms varying from N = 5 × 5 × 5 × 8 = 1000 to N = 70 × 70 × 70 × 8 = 2 744 000. For each domain size, we run a simulation in the NPT ensemble (300 K and 0 Pa, using the Berendsen weak-coupling thermostat and barostat, and the velocity-Verlet integration approach) for 1000 steps and record the computation time tcomp (in unit of second). The computational speed is then calculated as N × 1000/tcomp, which has a unit of atom × step / second. A Verlet neighbour list (each atom has 4 neighbours) is constructed in the beginning and is not rebuilt during the time evolution (there is one exception, though, which will be stated later). The time-integration and the force-evaluation parts take up about 10% and 90% of the whole computation time, respectively. Figure 1 shows the scaling of the computational speed of GPUMD with respect to the number of atoms for the Tersoff and Stillinger-Weber potentials, with either double- or singleprecision, using a Tesla K40 GPU. For all the cases, the speed increases quickly with increasing N and almost saturates when N exceeds 105 . The single-precision version for each poten- tial is about 3-4 times as fast as the double-precision version. This is partly due to the faster single-precision floating point arithmetic, and partly due to the fact that the double-precision version uses more registers in the force-evaluation kernel and has lower GPU occupancy. Detailed profiling shows that the occupancy is about 50% for the single-precision version and about 25% for the double-precision version. Despite these relatively low occupancies, the computational speeds shown in Fig. 1 are impressive. For example, the single-precision version of the Stillinger-Weber potential can achieve a speed of 25 ns per day (with a time step of 2 fs) for a system with 106 atoms. To better appreciate the high performance achieved by GPUMD, we compare its performance against that obtained by LAMMPS running on a single CPU core, which is Intel Xeon CPU X5670 @ 2.93 GHz. The single-core speed of LAMMPS on this CPU model is 2.7 × 105 atom × step / second for the Tersoff potential and 9.3 × 105 atom × step / second for the SW potential. The speedup factors for GPUMD running on a Tesla K40 GPU are presented in Fig. 2. For relatively large systems, the speedup factors range from a few tens to a few hundred, depending on the types of potential and floating point arithmetic. We note that the CPU available to us is about 3 years older than the GPU used and using a CPU released at the same year as the GPU would roughly double the LAMMPS speeds and halve the speedup factors achieved by GPUMD. To give a more realistic comparison between the performance of GPUMD and the CPU version of LAMMPS, we consider a system of 512 000 atoms and run the LAMMPS code with varying number (from 1 to 256) of CPU cores of the same specification as above using MPI parallelism. It can be seen from Fig. 3 that the MPI version of LAMMPS scales quite well up to about 100 CPU cores, but starts to scale less ideally afterwards. Taking the Tersoff potential as an example, the computational speeds for the double- and single-precision versions of GPUMD are equivalent to those of LAMMPS with about 100 6 (a) Speed (atom*step/second) 10 8 Speedup factor Tersoff, 512 000 atoms 10 2 10 1 GPU-double GPU-single CPU-MPI ideal CPU scaling 10 0 10 0 10 1 10 2 Tersoff, 256 000 atoms GPUMD-S GPUMD-D 10 7 Opt-KK-D LAMMPS-S LAMMPS-D 10 6 Number of CPU cores Speedup factor (b) 10 2 SW, 512 000 atoms 10 1 10 0 Figure 4: (color online) A comparison between the performances of GPUMD (labelled as GPUMD-D and GPUMD-S for singleand double-precision), a GPU version of LAMMPS (labelled as LAMMPS-D and LAMMPS-S for single- and double-precision), and an optimized version by Höhnerbach et al. [23] based on LAMMPS (labelled as Opt-KK-D for double-precision). The test system is silicon crystal with 256 000 atoms and the Tersoff potential is used. The data for LAMMPS-S, LAMMPS-D, and Opt-KK-D are taken from Ref. [34] provided by Höhnerbach et al.. All the codes run on a Tesla K40 GPU. GPU-double GPU-single CPU-MPI ideal CPU scaling 10 0 10 1 10 2 Number of CPU cores ing units and presented an efficient algorithm based on an explicit pairwise force expression for many-body potentials. In this algorithm, the virial stress tensor and the heat current also have well-defined per-atom expressions. Therefore, the force, virial stress, and heat current for a given atom can be accumulated within in a single thread and the algorithm is free of write conflict by construction. This crucial property allows for a simple, flexible, and efficient implementation of any many-body potential on the GPU. We have implemented the algorithm for the Tersoff and Stillinger-Weber potentials in our GPUMD code, which has excellent performance. GPUMD running on a single Tesla K40 GPU can be as fast as LAMMPS running with tens to hundreds of CPU cores. Our code is available upon request and will be made public later. Figure 3: (color online) The markers show the scaling of the performance (relative to a single CPU core) of the MPI version of LAMMPS with respect to the number of CPU cores (Intel Xeon CPU X5670 @ 2.93 GHz). The dashed lines show the performance of GPUMD running on a Tesla K40 GPU. Panel (a) refers to the Tersoff potential and panel (b) the Stillinger-Weber potential. The solid line in each panel indicates the ideal scaling that can be achieved by MPI parallelism. The test system is silicon crystal with 512 000 atoms. and 500 CPU cores, respectively. Finally, Fig. 4 also gives a comparison between the performance of GPUMD and those of some available GPU versions of LAMMPS (taken from Ref. [34]) using the Tersoff potential. Here, to be consistent with the simulations by Höhnerbach et al. [23], we update the neighbour list every 5 time steps, which reduces the performance by about 20% compared to the case without rebuilding the neighbour list. For both double- and single-precision, GPUMD is more than one order of magnitude faster than the original version of LAMMPS. The optimized version by Höhnerbach et al. [23] is a few times faster than the original version of LAMMPS, but is still a few times slower than GPUMD. Acknowledgements This work was supported by the Academy of Finland through its Centres of Excellence Programme (2015-2017) under project number 284621 and National Natural Science Foundation of China under Grants No. 11404033 and 11504384. We acknowledge the computational resources provided by Aalto Science-IT project, Finland’s IT Center for Science (CSC), and China Scientific Computing Grid (ScGrid). We thank the great help from the GPU experts from CSC and NVIDIA during the GPU hackathon organized by Sebastian von Alfthan. 4. Conclusions In summary, we analysed the difficulty in implementing many-body potentials in MD simulations on graphics process7 References [23] M. Höhnerhach, A. E. Ismail, P. Bientinesi, The vectorization of the Tersoff multi-body potential: An exercise in performance portability, arXiv:1607.02904v1. [24] P. Tredak, W. R. Rudnicki, and J. A. Majewski Efficient implementation of the many-body Reactive Bond Order (REBO) potential on GPU, J. Comput. Phys. 321, (2016) 556570. [25] T. D. Nguyen, GPU-accelerated Tersoff potentials for massively parallel molecular dynamics simulations, Comput. Phys. Comm. 212, (2017) 113122. [26] http://docs.nvidia.com/cuda/cuda-c-programming-guide/ [27] Z. Fan, L. F. C. Pereira, H.-Q. Wang, J.-C. Zheng, D. Donadio, A. Harju, Force and heat current formulas for many-body potentials in molecular dynamics simulation with applications to thermal conductivity calculations, Phys. Rev. B 92 (2015) 094301. [28] Z. Fan, T. Siro, A. Harju, Accelerated molecular dynamics force evaluation on graphics processing units for thermal conductivity calculations, Comput. Phys. Comm. 184 (2013) 1414-1425. [29] M. P. Howard, J. A. Anderson, A. Nikoubashman, S. C. Glotzer, A. Z. Panagiotopoulos, Efficient neighbour list calculation for molecular simulation of colloidal systems using graphics processing units, Comput. Phys. Comm. 203 (2016) 45-52. [30] P. Hirvonen, M. M. Ervasti, Z. Fan, M. Jalalvand, M. Seymour, S. M. V. Allaei, N. Provatas, A. Harju, K. R. Elder, T. Ala-Nissila, Multiscale modeling of polycrystalline graphene: A comparison of structure and defect energies of realistic samples from phase field crystal models, Phys. Rev. B 94 (2016) 035414. [31] B. Mortazavi, Z. Fan, L. F. C. Pereira, A. Harju, T. Rabczuk, Amorphized graphene: A stiff material with low thermal conductivity, Carbon 103 (2016) 318-326. [32] Z. Fan, A. Uppstu, A. Harju, Dominant source of disorder in graphene: Charged impurities or ripples? 2D Mater. 4 (2017) 025004. [33] Z. Fan, L. F. C. Pereira, P. Hirvonen, M. M. Ervasti, K. R. Elder, D. Donadio, T. Ala-Nissila, and A. Harju, Thermal conductivity decomposition in two-dimensional materials: Application to graphene, Phys. Rev. B 95 (2017), 144309. [34] http://github.com/HPAC/lammps-tersoff-vector . [1] A. W. Götz, M. J. Williamson, D. Xu, D. Poole, S. Le Grand, R. C. Walker, Routine Microsecond Molecular Dynamics Simulations with AMBER on GPUs. 1. Generalized Born, J. Chem. Theory Comput. 8 (2012) 1542-1555. [2] S. Páll, B. Hess, A flexible algorithm for calculating pair interactions on SIMD architectures, Comput. Phys. Comm. 184 (2013) 2641-2650. [3] C. Kutzner, S. Páll, M. Fechner, A. Esztermann, B. L. de Groot, H. Grubmüller, Best bang for your buck: GPU nodes for GROMACS biomolecular simulations, J. Comput. Chem. 36 (2015) 1990-2008. [4] S. Plimpton, Fast Parallel Algorithms for Short-Range Molecular Dynamics, J. Comput. Phys. 117 (1995) 1-19. [5] W. M. Brown, P. Wang, S. J. Plimpton, A. N. Tharrington, Implementing Molecular Dynamics on Hybrid High Performance Computers - Short Range Forces, Comput. Phys. Comm. 182 (2011) 898-911. [6] W. M. Brown, A. Kohlmeyer, S. J. Plimpton, A. N. Tharrington, Implementing Molecular Dynamics on Hybrid High Performance Computers Particle-Particle Particle-Mesh. Comput. Phys. Comm. 183 (2012) 449459. [7] J. E. Stone, J. C. Phillips, P. L. Freddolino, D. J. Hardy, L. G. Trabuco, K. Schulten, Accelerating molecular modeling applications with graphics processors, J. Comput. Chem. 28 (2007) 2618-2640. [8] P. Eastman, V. S. Pande, Efficient Nonbonded Interactions for Molecular Dynamics on a Graphics Processing Unit, J. Comput. Chem. 31 (2010) 1268-1272. [9] J. A. Anderson, C. D. Lorenz, A. Travesset, General purpose molecular dynamics simulations fully implemented on graphics processing units, J. Comput. Phys. 227 (2008) 5342-5359. [10] J. A. Anderson, S. C. Clotzer, The development and expansion of HOOMD-blue through six years of GPU proliferation, arXiv:1308.5587v1. [11] J. Glaser, T. D. Nguyen, J. A. Anderson, P. Lui, F. Spiga, J. A. Millan, D. C. Morse, S. C. Glotzer, Strong scaling of general-purpose molecular dynamics simulations on GPUs, Comput. Phys. Comm. 192 (2015) 97107. [12] P. H. Colberg, F. Höfling, Highly accelerated simulations of glassy dynamics using GPUs: Caveats on limited floating-point precision, Comput. Phys. Comm. 182 (2011) 1120-1129. [13] N. P. Bailey et al., RUMD: A general purpose molecular dynamics package optimized to utilize GPU hardware down to a few thousand particles, arXiv:1506.05094v2. [14] I. V. Morozov, A. M. Kazennov, R. G. Bystryi, G. E. Norman, V. V. Pisarev, V. V. Stegailov, Molecular dynamics simulations of the relaxation processes in the condensed matter on GPUs, Comput. Phys. Comm. 182 (2011) 1974-1978. [15] W. M. Brown, T. D. Nguyen, M. Fuentes-Cabrera, J. D. Fowlkes, P. D. Rack, M. Berger, A. S. Bland, An evaluation of Molecular Dynamics performance on the hybrid Cray XK6 supercomputer, Procedia Computer Science 9 (2012) 186-195. [16] Q. Hou, M. Li, Y. Zhou, J. Cui, Z. Cui, J. Wang, Molecular dynamics simulations with many-body potentials on multiple GPUs - The implementation, package and performance, Comput. Phys. Comm. 184 (2013) 2091-2101. [17] J. Tersoff, Modeling solid-state chemistry: Interatomic potentials for mnlticomponent systems, Phys. Rev. B 39 (1989) 5566-5568. [18] F. H. Stillinger and T. A. Weber, Computer simulation of local order in condensed phases of silicon, Phys Rev B, 31 (1985) 5262-5271. [19] D. W. Brenner, O. A. Shenderova, J. A. Harrison, S. J. Stuart, B. Ni, and S. B. Sinnott, A second-generation reactive empirical bond order (REBO) potential energy expression for hydrocarbons, J. Phys.: Condens. Matter 14 (2002) 783802. [20] C. Hou, J. Xu, P. Wang, W. Huang, and X. Wang, Efficient GPUaccelerated molecular dynamics simulation of solid covalent crystals, Comput. Phys. Comm. 184 (2013) 1364-1371. [21] W. M. Brown, M. Yamada, Implementing Molecular Dynamics on Hybrid High Performance Computers - Three-Body Potentials, Comput. Phys. Comm. 184 (2013) 2785-2793. [22] A. A. Knizhnik, A. S. Minkin, B. V. Potapkin, OpenCL realization of some many-body potentials, Computer Research and Modeling 7 (2015) 549-558. 8
5cs.CE
arXiv:1510.02969v3 [cs.CV] 16 Mar 2017 Do Deep Neural Networks Learn Facial Action Units When Doing Expression Recognition? Pooya Khorrami Tom Le Paine Thomas S. Huang Beckman Institute for Advanced Science and Technology University of Illinois at Urbana-Champaign {pkhorra2,paine1,t-huang1}@illinois.edu Abstract Despite being the appearance-based classifier of choice in recent years, relatively few works have examined how much convolutional neural networks (CNNs) can improve performance on accepted expression recognition benchmarks and, more importantly, examine what it is they actually learn. In this work, not only do we show that CNNs can achieve strong performance, but we also introduce an approach to decipher which portions of the face influence the CNN’s predictions. First, we train a zero-bias CNN on facial expression data and achieve, to our knowledge, state-of-the-art performance on two expression recognition benchmarks: the extended Cohn-Kanade (CK+) dataset and the Toronto Face Dataset (TFD). We then qualitatively analyze the network by visualizing the spatial patterns that maximally excite different neurons in the convolutional layers and show how they resemble Facial Action Units (FAUs). Finally, we use the FAU labels provided in the CK+ dataset to verify that the FAUs observed in our filter visualizations indeed align with the subject’s facial movements. Figure 1. Visualization of facial regions that activate five selected filters in the 3rd convolutional layer of a network trained on the Extended Cohn-Kanade (CK+) dataset. Each row corresponds to one filter in the conv3 layer and we display the spatial patterns from the top 5 images. 1. Introduction Facial expressions provide a natural and compact way for humans to convey their emotional state to another party. Therefore, designing accurate facial expression recognition algorithms is crucial to the development of interactive computer systems in artificial intelligence. Extensive work in this area has found that only a small number of regions change as a human changes their expression and are located around the subject’s eyes, nose and mouth. In [7], Paul Ekman proposed the Facial Action Coding System (FACS) which enumerated these regions and described how every facial expression can be described as the combination of multiple action units (AUs), each corresponding to a particular muscle group in the face. However, having a computer accurately learn the parts of the face that convey emotion has proven to be a non-trivial task. Previous work in facial expression recognition can be split into two broad categories: AU-based/rule-based methods and appearance-based methods. AU-based methods [29, 30] would detect the presence of individual AUs explicitly and then classify a person’s emotion based on the combinations originally proposed by Friesen and Ekman in [8]. Unfortunately, each AU detector required careful hand-engineering to ensure good performance. On the other hand, appearance-based methods [1, 2, 31, 33] modeled a person’s expression from their general facial shape and texture. In the last few years, many well-established problems in computer vision have greatly benefited from the rise of convolutional neural networks (CNNs) as an appearance-based classifier. Tasks such as object recognition [14], object detection [9], and face recognition [28] have seen huge boosts in performance on several accepted benchmarks. Unfortunately, other tasks such as facial expression recognition have not experienced performance gains of the same magnitude. Little work has been done to see how much deep CNNs can help on accepted expression recognition benchmarks. In this paper, we seek the answer to the following questions: Can CNNs improve performance on emotion recognition datasets/baselines and what do they learn? We propose to do this by training a CNN on established facial expression datasets and then analyzing what they learn by visualizing the individual filters in the network. In this work, we apply the visualization techniques proposed by Zeiler and Fergus [32] and Springenberg et al. [25] where individual neurons in the network are excited and their corresponding spatial patterns are displayed in pixel space using a deconvolutional network. When visualizing these discriminative spatial patterns, we find that many of the filters are excited by regions in the face that corresponded to Facial Action Units (FAUs). A subset of these spatial patterns is shown in Figure 1. Thus, the main contributions of this paper are as follows: 1. We show that CNNs trained for the emotion recognition task learn features that correspond strongly with the FAUs proposed by Ekman [7]. We demonstrate this result by first visualizing the spatial patterns that maximally excite different filters in the convolutional layers of our networks, and then using the ground truth FAU labels to verify that the FAUs observed in the filter visualizations align with the subject’s facial movements. 2. We also show that our CNN model, based on works originally proposed by [20, 21], can achieve, to our knowledge, state-of-the-art performance on the extended Cohn-Kanade (CK+) dataset and the Toronto Face Dataset (TFD). 2. Related Work In most facial expression recognition systems, the main machinery matches quite nicely with the traditional machine learning pipeline. More specifically, a face image is passed to a classifier that tries to categorize it as one of several (typically 7) expression classes: 1. anger, 2. disgust, 3. fear, 4. neutral, 5. happy, 6. sad, and 7. surprise. In most cases, prior to being passed to the classifier, the face image is pre-processed and given to a feature extractor. Up until rather recently, most appearance-based expression recognition techniques relied on hand-crafted features, specifically Gabor wavelets [1, 2], Haar features [31] and LBP features [33], in order to make representations of different expression classes more discriminative. For some time, systems based on hand-crafted features were able to achieve impressive results on accepted expression recognition benchmarks such as the Japanese Female Facial Expression (JAFFE) database [19], the extended Cohn-Kanade (CK+) dataset [18], and the Multi-PIE dataset [10]. However, the recent success of deep neural networks has caused many researchers to explore feature representations that are learned from data. Not surprisingly, almost all of the methods used some form of unsupervised pre-training/learning to initialize their models. We hypothesize this may be because the scarcity of labeled data prevented the authors from training a completely supervised model that did not experience heavy overfitting. In [17], the authors trained a multi-layer boosted deep belief network (BDBN) and achieved state-of-the-art accuracy on the CK+ and JAFFE datasets. Meanwhile in [23], the authors used a convolutional contractive auto-encoder (CAE) as their underlying unsupervised model. They then performed a semi-supervised encoding function called Contractive Discriminant Analysis (CDA) to separate discriminative expression features from the unsupervised representation. A few works based on unsupervised deep learning have also tried to analyze the relationship between FAUs and the learned feature representations. In [15, 16], the authors learned a patch-based filter bank using K-means as their low-level feature. These features were then used to select receptive fields corresponding to specific FAU receptive fields which were subsequently passed to multi-layer restricted Boltzmann machines (RBMs) for classification. The FAU receptive fields were selected using a mutual information criterion between the image feature and the expression label. An earlier work by Susskind et al. [27], showed that the first layer features a deep belief network trained to generate facial expression images appeared to learn filters that were sensitive to face parts. We conduct a similar analysis except we use a CNN as our underlying model and we visualize the spatial patterns that excite higher-level neurons in the network. To the authors’ knowledge, the only works that previously applied CNNs to expression data were that of Kahou et al. [13, 12] and Jung et al. [11]. In [13, 12], the authors developed a system for doing audio/visual emotion recognition for the Emotion Recognition in the Wild Challenge (EmotiW) [6, 5] while in [11], the authors trained a network that incorporated both appearance and geometric features when doing recognition. However, one key point is that these works dealt with emotion recognition of video / image sequence data and therefore, actively incorporated temporal data when computing their predictions. Input 96 x 96 x 1 Conv layer 1 Conv layer 2 5 x 5 x 1 x 64 Conv layer 3 5 x 5 x 1 x 128 Max pooling FC Somax 5 x 5 x 1 x 256 Max pooling Quadrant pooling Figure 2. Network Architecture - Our network consists of three convolutional layers containing 64, 128, and 256 filters, respectively, each of size 5x5 followed by ReLU (Rectified Linear Unit) activation functions. We add 2x2 max pooling layers after the first two convolutional layers and quadrant pooling after the third. The three convolutional layers are followed by a fully-connected layer containing 300 hidden units and a softmax layer. 5 In contrast, our work deals with emotion recognition from a single image, and will focus on analyzing the features learned by the network. Thus, not only will we demonstrate the effectiveness of CNNs on existing emotion classification baselines but we will also qualitatively show that the network is able to learn patterns in the face images that correspond to Facial Action Units (FAUs). 3. Our Approach 3.1. Network Architecture For all of the experiments we present in this paper, we use a classic feed-forward convolutional neural network. The networks we use, shown visually in Figure 2 consist of three convolutional layers with 64, 128, and 256 filters, respectively, and with filter sizes of 5x5 followed by ReLU (Rectified Linear Unit) activation functions. Max pooling layers are placed after the first two convolutional layers while quadrant pooling [3] is applied after the third. The quadrant pooling layer is then followed by a full-connected layer with 300 hidden units and, finally, a softmax layer for classification. The softmax layer contains anywhere between 6-8 outputs corresponding to the number of expressions present in the training set. One modification that we introduce to the classical configuration is that we ignore the biases of the convolutional layers. This idea was introduced first by Memisevic et al. in [20] for fully-connected networks and later extended by Paine et al. in [21] to convolutional layers. In our experiments, we found that ignoring the bias allowed our network to train very quickly while simultaneously reducing the number of parameters to learn. 3.2. Network Training When training our network, we train from scratch using stochastic gradient descent with a batch size of 64, mo- mentum set to 0.9, and a weight decay parameter of 1e-5. We use a constant learning rate of 0.01 and do not use any form of annealing. The parameters of each layer are randomly initialized by drawing from a Gaussian distribution k with zero mean and standard deviation σ = NFAN where IN NFAN IN is the number of input connections to each layer and k is drawn uniformly from the range: [0.2, 1.2]. We also use dropout and various forms of data augmentation to regularize our network and combat overfitting. We apply dropout to the fully-connected layer with a probability of 0.5 (i.e. each neuron’s output is set to zero with probability 0.5). For data augmentation, we apply a random transformation to each input image consisting of: translations, horizontal flips, rotations, scaling, and pixel intensity augmentation. All of our models were trained using the anna software library 1 . 4. Experiments and Analysis We use two facial expression datasets in our experiments: the extended Cohn-Kanade database (CK+) [18] and the Toronto Face Dataset (TFD) [26]. The CK+ database contains 327 image sequences, each of which is assigned one of 7 expression labels: anger, contempt, disgust, fear, happy, sad, and surprise. For fair comparison, we follow the protocol used by previous works [15, 17], and use the first frame of each sequence as a neutral frame in addition to the last three expressive frames to form our dataset. This leads to a total of 1308 images and 8 classes total. We then split the frames into 10 subject independent subsets in the manner presented by [15] and perform 10-fold cross-validation. TFD is an amalgamation of several facial expression datasets. It contains 4178 images annotated with one of 7 expression labels: anger, disgust, fear, happy, neutral, sad, and surprise. The labeled samples are divided into 5 folds, 1 https://github.com/ifp-uiuc/anna Table 1. Recognition accuracy on the Toronto Face Dataset (TFD) - 7 classes - A: Data Augmentation, D: Dropout Method Gabor+PCA [4] Deep mPoT [22] CDA [23] Zero-bias CNN Zero-bias CNN+D Zero-bias CNN+A Zero-bias CNN+AD Accuracy 80.2% 82.4% 85.0% 79.0% ± 1.1% 81.8% ± 2.1% 88.4% ± 1.7% 88.6% ± 1.5% Table 2. Recognition accuracy on the Extended Cohn-Kanade (CK+) Dataset - 8 classes - A: Data Augmentation, D: Dropout Method AURF [15] AUDN [16] Zero-bias CNN Zero-bias CNN+D Zero-bias CNN+A Zero-bias CNN+AD Accuracy 92.22% 93.70% 78.2% ± 5.7% 82.3% ± 4.0% 94.6% ± 3.3% 95.1% ± 3.1% Table 3. Recognition accuracy on the Extended Cohn-Kanade (CK+) Dataset - 6 classes - A: Data Augmentation, D: Dropout each containing a train, validation, and test set. We train all of our models using just the training set of each fold, pick the best performing model using each split’s validation set, then we evaluate on each split’s test set and average the results over all 5 folds. In both datasets, the images are grayscale and are of size 96x96 pixels. In the case of TFD, the faces have already been detected and normalized such that all of the subjects’ eyes are the same distance apart and have the same vertical coordinates. Meanwhile for the CK+ dataset, we simply detect the face in the 640x480 image and resize it to 96x96. The only other pre-processing we employ is patchwise mean subtraction and scaling to unit variance. 4.1. Performance on Toronto Face Database (TFD) First, we analyze the discriminative ability of the CNN by assessing its performance on the TFD dataset. Table 1 shows the recognition accuracy obtained when training a zero-bias CNN from a random initialization with no other regularization as well as CNNs that have dropout (D), data augmentation (A) or both (AD). We also include recognition accuracies from previous methods. From the results in Table 1, there are two main observations: (i) not surprisingly, regularization significantly boosts performance (ii) data augmentation improves performance over the regular CNN more than dropout (9.4% vs. 2.8%). Furthermore, when both dropout and data augmentation are used, our model is able to exceed the previous state-of-the-art performance on TFD by 3.6%. 4.2. Performance on the Extended Cohn-Kanade Dataset (CK+) We now present our results on the CK+ dataset. The CK+ dataset usually contains eight labels (anger, contempt, disgust, fear, happy, neutral, sad, and surprise). However, many works [34, 24, 17] ignore the samples labeled as neutral or contempt, and only evaluate on the six basic emotions. Therefore, to ensure fair comparison, we trained two separate models. We present the eight class model results in Table 2 and the six class model results in Table 3. For Method CSPL [34] LBPSVM [24] BDBN [17] Zero-bias CNN+AD Accuracy 89.89% 95.10% 96.70% 95.7% ± 2.5% the eight class model, we conduct the same study we did on the TFD and we observe rather similar results. Once again, regularization appears to play a significant role in obtaining good performance. Data augmentation gives a significant boost in performance (16.4%) and when combined with dropout, leads to a 16.9% increase. For the eight class and six class models, we achieve state-of-the-art and near state-of-the-art accuracy respectively on the CK+ dataset. 4.3. Visualization of higher-level neurons Now, with a strong discriminative model in hand, we will analyze which facial regions the neural network identifies as the most discriminative when performing classification. To do this, we employ the visualization technique presented by Zeiler and Fergus in [32]. For each dataset, we consider the third convolutional layer and for each filter, we find the N images in the chosen split’s training set that generated the strongest magnitude response. We then leave the strongest neuron high and set all other activations to zero and use the deconvolutional network to reconstruct the region in pixel space. For our experiments, we chose N=10 training images. We further refine our reconstructions by employing a technique called ”Guided Backpropagation” proposed by Springenberg et al. in [25]. ”Guided Backpropogation” aims to improve the reconstructed spatial patterns by not solely relying on the masked activations given by the toplevel signal during deconvolution but by also incorporating knowledge of which activations were suppressed during the forward pass. Therefore, each layer’s output during the deconvolution stage is masked twice: (i) once by the ReLU of Table 4. Correspondences between CK+ visualization plots shown in Figure 4 and the FAU whose activation distribution had the highest KL divergence value. The KL divergence values of all the FAUs computed for each filter are shown in Figure 5. Filter Number 1 2 3 4 5 6 7 8 9 10 FAU with the Largest KL Divergence Value AU25: Lips Part AU12: Lip Corner Puller AU9: Nose Wrinkler AU5: Upper Lid Raiser AU17: Chin Raiser AU12: Lip Corner Puller AU24: Lip Pressor AU27: Mouth Stretch AU12: Lip Corner Puller AU1: Inner Brow Raiser the deconvotional layer and (ii) again by the mask generated by the ReLU of the layer’s matching convolutional layer in the forward pass. First, we will analyze patterns discovered in the Toronto Face Dataset (TFD). In Figure 3, we select 10 of the 256 filters in the third convolutional layer and for each filter, we present the spatial patterns of the top-10 images in the training set. From these images, the reader can see that several of the filters appear to be sensitive to regions that align with several of the Facial Actions Units such as: AU12: Lip Corner Puller (row 1), AU4: Brow Lowerer (row 4), and AU15: Lip Corner Depressor (row 9). Next, we display the patterns discovered in the CK+ dataset. In Figure 4, we, once again, select 10 of the 256 filters in the third convolutional layer and for each filter, we present the spatial patterns of the top-10 images in the training set. The reader will notice that the CK+ discriminative spatial patterns are very clearly defined and correspond nicely with Facial Action Units such as: AU12: Lip Corner Puller (rows 2, 6, and 9), AU9: Nose Wrinkler (row 3) and AU27: Mouth Stretch (row 8). 4.4. Finding Correspondences Between Filter Activations and the Ground Truth Facial Action Units (FAUs) In addition to categorical labels (anger, disgust, etc.), the CK+ dataset also contains labels that denote which FAUs are present in each image sequence. Using these labels, we now present a preliminary experiment to verify that the filter activations/spatial patterns learned by the CNN indeed match with the actual FAUs shown by the subject in the image. Our experiment aims to answer the following question: For a particular filter i, which FAU j has samples whose activation values most strongly differ from the activations of samples that do not contain FAU j, and does that FAU accurately correspond with the visual spatial patterns that maximally excite filter i? Given a training set of M images (X) and their corresponding FAU labels (Y ), let F`i (x) be the activations of sample x at layer ` for filter i. Since we are examining the 3rd convolutional layer in the network, we set ` = 3. Then, for each of the 10 filters visualized in Figure 4, we do the following: (i) We consider a particular FAU j and place the samples X that contain j in set S where: S = {xm | j ∈ ym }, ∀m ∈ {1, ..., M } (ii) We then build a histogram of the maximum activations of the samples that contained FAU j: Qij (x) = P (F3i (x) | S), ∀(x, y) ∈ (X, Y ) (iii) We then, similarly, build a distribution over maximum activations of the samples that do not contain FAU j: Rij (x) = P (F3i (x) | S c ), ∀(x, y) ∈ (X, Y ) (iv) We compute the KL divergence between Qij (x) and Rij (x), DKL (Qij k Rij ), and repeat the process for all of the other FAUs. Figure 5 shows the bar charts of the KL divergences computed for all of the FAUs for each of the 10 filters displayed in Figure 4. The FAU with the largest KL divergence value is denoted in red and its corresponding name is documented in Table 4 for each filter. From these results, we see that in the majority of the cases, the FAUs listed in Table 4 match the facial regions visualized in Figure 4. This means that the samples that appear to strongly influence the activations of these particular filters are indeed those that possess the AU shown in the corresponding filter visualizations. Thus, we show that certain neurons in the neural network implicitly learn to detect specific FAUs in face images when given a relatively ”loose” supervisory signal (i.e. emotion type: anger, happy, sad, etc.). What is most encouraging is that these results appear to confirm our intuitions about how CNNs work as appearance-based classifiers. For instance, filter 2, 6, and 9 appear to be very sensitive to patterns that correspond to AU 12. This is not surprising as AU 12 (Lip Corner Puller) is almost always associated with smiles and from the visualizations in Figure 4, a subject often shows their teeth when smiling, a highly distinctive appearance cue. Similarly, for filter 8, it is not surprising that FAU 25 (Lips Part) and FAU 27 (Mouth Stretch) had the most different activation distributions given that the filter’s spatial patterns corresponded to the ”O” shape made by the mouth region in surprised faces, another visually salient cue. Figure 3. Visualization of spatial patterns that activate 10 selected filters in the conv3 layer of our network trained on the Toronto Face Dataset (TFD). Each row corresponds to one filter in the conv3 layer. We display the top 10 images that elicited the maximum magnitude response. Notice that the spatial patterns appear to correspond with some of the Facial Action Units. 5. Conclusions In this work, we showed both qualitatively and quantitatively that CNNs trained to do emotion recognition are indeed able to model high-level features that strongly correspond to FAUs. Qualitatively, we showed which portions of the face yielded the most discriminative information by visualizing the spatial patterns that maximally excited dif- ferent filters in the convolutional layers of our learned networks. Meanwhile, quantitatively, we correlated the numerical activations of the visualized filters with the subject’s actual facial movements using the FAU labels given in the CK+ dataset. Finally, we demonstrated how a zero-bias CNN can achieve state-of-the-art recognition accuracy on the extended Cohn-Kanade (CK+) dataset and the Toronto Face Dataset (TFD). Figure 4. Visualization of spatial patterns that activate 10 selected filters in the conv3 layer of our network trained on the Cohn-Kanade (CK+) dataset. Each row corresponds to one filter in the conv3 layer. Once again, we display the top 10 images that elicited the maximum magnitude response. Notice that the spatial patterns appear to have very clear correspondences with some of the Facial Action Units. Acknowledgments This work was supported in part by MIT Lincoln Laboratory. The Tesla K40 GPU used for this research was donated by the NVIDIA Corporation. The authors would also like to thank Dr. Kevin Brady, Dr. Charlie Dagli, Professor Yun Fu, and Professor Usman Tariq for their insightful comments and suggestions with regards to this work. References [1] M. S. Bartlett, G. Littlewort, M. Frank, C. Lainscsek, I. Fasel, and J. Movellan. Recognizing facial expression: machine learning and application to spontaneous behavior. In CVPR, pages 568–573, 2005. 1, 2 [2] M. S. Bartlett, G. Littlewort, M. Frank, C. Lainscsek, I. Fasel, and J. Movellan. Fully automatic facial action recognition in spontaneous behavior. In FGR, pages 223–230, 0.2 3 2.5 KL Divergence KL Divergence 0.15 0.1 0.05 2 1.5 1 0.5 0 1 2 4 5 6 7 9 12 14 15 17 23 24 25 0 27 1 2 4 5 6 7 9 FAU Filter 1 KL Divergence KL Divergence 0.4 0.3 0.2 1 2 4 5 6 7 9 12 14 15 17 23 24 25 1 2 4 5 6 7 27 9 12 14 15 17 23 24 25 27 14 15 17 23 24 25 27 14 15 17 23 24 25 27 14 15 17 23 24 25 27 FAU Filter 3 Filter 4 0.35 0.3 KL Divergence 0.2 KL Divergence 25 0.4 0 27 0.25 0.15 0.1 0.05 0.25 0.2 0.15 0.1 0.05 1 2 4 5 6 7 9 12 14 15 17 23 24 25 0 27 1 2 4 5 6 7 9 FAU 12 FAU Filter 5 Filter 6 0.35 0.5 0.3 0.4 0.25 KL Divergence KL Divergence 24 0.6 FAU 0.2 0.15 0.1 0.3 0.2 0.1 0.05 1 2 4 5 6 7 9 12 14 15 17 23 24 25 0 27 1 2 4 5 6 7 9 FAU 12 FAU Filter 7 Filter 8 0.7 0.7 0.6 0.6 0.5 0.5 KL Divergence KL Divergence 23 0.2 0.1 0.4 0.3 0.2 0.1 0 17 0.8 0.5 0 15 1 0.6 0 14 Filter 2 0.7 0 12 FAU 0.4 0.3 0.2 0.1 1 2 4 5 6 7 9 12 FAU Filter 9 14 15 17 23 24 25 27 0 1 2 4 5 6 7 9 12 FAU Filter 10 Figure 5. Bar charts showing which FAUs lead to the strongest shifts in the activation distributions of particular filters in the CNN. For each of the 10 filters visualized in Figure 4, we build histograms over the activations of training samples that contain a specific FAU j, and the activations of samples that do not contain FAU j. We then compute the KL divergence between the two distributions and plot them for each FAU above. The FAU with the largest KL divergence is displayed in red and its corresponding name is given in Table 4. (Best viewed in color). 2006. 1, 2 [3] A. Coates, A. Y. Ng, and H. Lee. An analysis of singlelayer networks in unsupervised feature learning. In International conference on artificial intelligence and statistics, pages 215–223, 2011. 3 [4] M. N. Dailey, G. W. Cottrell, C. Padgett, and R. Adolphs. Empath: A neural network that categorizes facial expressions. Journal of cognitive neuroscience, 14(8):1158–1173, 2002. 4 [5] A. Dhall, R. Goecke, J. Joshi, K. Sikka, and T. Gedeon. Emotion recognition in the wild challenge 2014: Baseline, data and protocol. In 16th ACM International Conference on Multimodal Interaction. ACM, 2014. 2 [6] A. Dhall, R. Goecke, J. Joshi, M. Wagner, and T. Gedeon. Emotion recognition in the wild challenge 2013. In Proceedings of the 15th ACM on International conference on multimodal interaction, pages 509–516. ACM, 2013. 2 [7] P. Ekman and W. V. Friesen. Facial action coding system. 1977. 1, 2 [8] W. V. Friesen and P. Ekman. Emfacs-7: Emotional facial action coding system. Unpublished manuscript, University of California at San Francisco, 2:36, 1983. 1 [9] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, pages 580–587, 2014. 2 [10] R. Gross, I. Matthews, J. Cohn, T. Kanade, and S. Baker. Multi-pie. Image and Vision Computing, 28(5):807–813, 2010. 2 [11] H. Jung, S. Lee, S. Park, I. Lee, C. Ahn, and J. Kim. Deep temporal appearance-geometry network for facial expression recognition. arXiv preprint arXiv:1503.01532, 2015. 2 [12] S. E. Kahou, X. Bouthillier, P. Lamblin, C. Gulcehre, V. Michalski, K. Konda, S. Jean, P. Froumenty, A. Courville, P. Vincent, et al. Emonets: Multimodal deep learning approaches for emotion recognition in video. arXiv preprint arXiv:1503.01800, 2015. 2 [13] S. E. Kahou, C. Pal, X. Bouthillier, P. Froumenty, Ç. Gülçehre, R. Memisevic, P. Vincent, A. Courville, Y. Bengio, R. C. Ferrari, et al. Combining modality specific deep neural networks for emotion recognition in video. In ICMI, pages 543–550, 2013. 2 [14] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pages 1097–1105, 2012. 2 [15] M. Liu, S. Li, S. Shan, and X. Chen. Au-aware deep networks for facial expression recognition. In FG, pages 1–6, 2013. 2, 3, 4 [16] M. Liu, S. Li, S. Shan, and X. Chen. Au-inspired deep networks for facial expression feature learning. Neurocomputing, 159:126–136, 2015. 2, 4 [17] P. Liu, S. Han, Z. Meng, and Y. Tong. Facial expression recognition via a boosted deep belief network. In CVPR, pages 1805–1812, 2014. 2, 3, 4 [18] P. Lucey, J. F. Cohn, T. Kanade, J. Saragih, Z. Ambadar, and I. Matthews. The extended cohn-kanade dataset (ck+): A complete dataset for action unit and emotion-specified expression. In CVPRW, pages 94–101, 2010. 2, 3 [19] M. J. Lyons, J. Budynek, and S. Akamatsu. Automatic classification of single facial images. PAMI, 21(12):1357–1362, 1999. 2 [20] R. Memisevic, K. Konda, and D. Krueger. Zero-bias autoencoders and the benefits of co-adapting features. stat, 1050:10, 2014. 2, 3 [21] T. L. Paine, P. Khorrami, W. Han, and T. S. Huang. An analysis of unsupervised pre-training in light of recent advances. arXiv preprint arXiv:1412.6597, 2014. 2, 3 [22] M. Ranzato, J. Susskind, V. Mnih, and G. Hinton. On deep generative models with applications to recognition. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pages 2857–2864. IEEE, 2011. 4 [23] S. Rifai, Y. Bengio, A. Courville, P. Vincent, and M. Mirza. Disentangling factors of variation for facial expression recognition. ECCV 2012, pages 808–822, 2012. 2, 4 [24] C. Shan, S. Gong, and P. W. McOwan. Facial expression recognition based on local binary patterns: A comprehensive study. Image and Vision Computing, 27(6):803–816, 2009. 4 [25] J. T. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014. 2, 4 [26] J. M. Susskind, A. K. Anderson, and G. E. Hinton. The toronto face database. Department of Computer Science, University of Toronto, Toronto, ON, Canada, Tech. Rep, 2010. 3 [27] J. M. Susskind, A. K. Anderson, G. E. Hinton, and J. R. Movellan. Generating facial expressions with deep belief nets. 2008. 2 [28] Y. Taigman, M. Yang, M. Ranzato, and L. Wolf. Deepface: Closing the gap to human-level performance in face verification. In CVPR, pages 1701–1708, 2014. 2 [29] Y.-l. Tian, T. Kanada, and J. F. Cohn. Recognizing upper face action units for facial expression analysis. In Computer Vision and Pattern Recognition, 2000. Proceedings. IEEE Conference on, volume 1, pages 294–301. IEEE, 2000. 1 [30] Y. Tong, W. Liao, and Q. Ji. Facial action unit recognition by exploiting their dynamic and semantic relationships. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 29(10):1683–1699, 2007. 1 [31] J. Whitehill and C. W. Omlin. Haar features for facs au recognition. In FGR, 2006. 1, 2 [32] M. D. Zeiler and R. Fergus. Visualizing and understanding convolutional networks. In Computer Vision–ECCV 2014, pages 818–833. Springer, 2014. 2, 4 [33] G. Zhao and M. Pietikainen. Dynamic texture recognition using local binary patterns with an application to facial expressions. PAMI, 29(6):915–928, 2007. 1, 2 [34] L. Zhong, Q. Liu, P. Yang, B. Liu, J. Huang, and D. N. Metaxas. Learning active facial patches for expression analysis. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 2562–2569. IEEE, 2012. 4
9cs.NE
Chance-Constrained ADMM Approach for Decentralized Control of Distributed Energy Resources Ali Hassan ∗ , Yury Dvorkin ∗ , Deepjyoti Deka arXiv:1710.09738v2 [cs.SY] 9 Mar 2018 ∗ † and Michael Chertkov †‡ Department of Electrical and Computer Engineering, Tandon School of Engineering, New York University, New York, NY, USA, (ah3909,dvorkin)@nyu.edu † Theory Division, Los Alamos National Laboratory, Los Alamos, NM, USA, (deepjyoti, chertkov)@lanl.gov ‡ Skolkovo Institute of Science and Technology, 143026 Moscow, Russia Abstract—Distribution systems are undergoing a dramatic transition from a passive circuit that routinely disseminates electric power among downstream nodes to the system with distributed energy resources. The distributed energy resources come in a variety of technologies and typically include photovoltaic (PV) arrays, thermostatically controlled loads, energy storage units. Often these resources are interfaced with the system via inverters that can adjust active and reactive power injections, thus supporting the operational performance of the system. This paper designs a control policy for such inverters using the local power flow measurements. The control actuates active and reactive power injections of the inverter-based distributed energy resources. This strategy is then incorporated into a chanceconstrained, decentralized optimal power flow formulation to maintain voltage levels and power flows within their limits and to mitigate the volatility of (PV) resources. Our method is shown to improve voltage regulation compliance and reduce power losses. Index Terms—Chance constraints, distribution systems optimal power flow, PV generation, uncertainty, voltage regulation. I. I NTRODUCTION The continuing proliferation of distributed energy resources (e.g., PV arrays, thermostatically controlled loads, energy storage units) is transforming the nature of distribution systems. Instead of the passive role of a mediator between highvoltage transmission systems and low-voltage electricity endusers, distribution systems are in a unique position to leverage distributed energy resources to reduce their operating cost and unlock new revenue streams by providing service to the transmission system and enabling fine-grain power delivery, [1], [2]. The success of this transformation depends on a coinfluence of such factors as the ability to efficiently deal with high variability of photovoltaic (PV) resources and to maintain power flows and voltage magnitudes in distribution systems within an acceptable range. This paper studies if enhanced control policies on inverter-tied distribution energy resources (e.g., PV arrays, thermostatically controlled loads, energy storage units) can provide a sufficient degree of dispatch The work of AH and YD was supported in part by the New York State Energy Research and Development Agency under the project “DER-centric operating and planning tools for power systems”. The work of DD and MC was supported by funding from the U.S. DOE/OE as part of the DOE Grid Modernization Initiative. flexibility to comply with power flow and voltage limits in distribution systems. Distributed energy resources are technically capable of providing services to both distribution and transmission systems, see [3]. However, there are a few noticeable differences. First, the provision of grid support services in the transmission system is typically organized in a centralized manner and requires that eligible resources meet a certain nameplate capacity threshold. This requirement disqualifies individual grid-scale distributed energy resources, let alone small-scale resources such as residential PV arrays. On the other hand, distribution system are operated in a less hierarchical manner, which allows for small-scale resources to engage in the provision of grid support services. To enable the provision of these services on a massive scale, i.e. with high penetrations of distributed energy resources, there is a pressing need to devise decentralized control policies. The decentralized framework assumes that distributed energy resources can react to changing operating conditions in the distribution system based on local measurements and without the intervention of the centralized operator. We refer interested readers to [4] for a comprehensive literature review of voltage control methods in distribution systems using distributed energy resources and limit the literature review below to the studies most relevant to our work. Turitsyn et al. [5] describe and compare a set of decentralized control policies of distributed inverters for voltage control and power flow loss minimization purposes. The numerical experiments in [5] suggests that a hybrid control policy that trade-offs voltage and loss minimization objectives is more effective that either of single-objective control policies. Furthermore, reference [5] demonstrates that the performance of any control policy improves as the number of input measurements (active power, reactive power, voltage magnitude) increases. In [6] and [7], the authors integrate the control policies similar to [5] in the distribution power flow optimization and compare the centralized and decentralized operating frameworks. Even though the centralized framework yields a slightly less expensive operating cost, it requires ubiquitous communication channels, which is impractical and can be seen as an undesirable vulnerability. On the other hand, the decentralized framework requires no communication and is capable of meeting operating limits on power flows and volt- ages within their respective ranges at an acceptable cost, [7]. Šulc et al. [8] attempt to bridge the gap between the centralized and decentralized frameworks by enabling communication between neighboring distributed energy resources with the control policy from [5]. Limited communications between the neighboring distributed energy resources improves the cost performance of the decentralized framework at expense of solving an iterative algorithm based on the alternating direction method of multipliers (ADMM) [9]. This paper continues the work in [5] and [8]. We extend the control policy from [5] to react to changes in the power flow at the connection point of distributed inverters. Next, we integrate this policy in the distribution power flow optimization with the limited communication as in [8] and extend the optimization to account for the uncertainty of PV injections using chance constraints. The chance-constrained framework has previously been applied in the context of power flow optimization under uncertainty in both transmission [10]–[12] and distribution systems [13]. In this work, the use of chance constraints is motivated by the need to accommodate stochasticity of PV resources in a convex form that is computationally tractable and allows for ADMM-like solution techniques. The proposed distribution power flow optimization with chance constraints is solved in a decentralized manner using an iterative ADMMlike algorithm inspired by [8]. Our case study is performed on the IEEE 33-bus distribution test system and compares the centralized and decentralized framework under the proposed power-flow-based control policy. The remainder of this paper is organized as follows. Section II describes existing control policies for distributed inverters and the proposed control policy. Section III describes how the proposed control policy and the ADMM-like algorithm are integrated in the distribution power flow optimization with chance constraints. Section IV concludes the paper. II. D ECENTRALIZED C ONTROL P OLICIES D ISTRIBUTED I NVERTERS FOR A. Preliminaries We consider a radial distribution system represented by graph G = (E, N ), where E and N are the sets of edges (lines) and nodes (buses), see Fig. 1. The set of nodes where PV resources are located is denoted as N P V ∈ N . Each node is characterized by its active and reactive load (Pi and Qi , i ∈ N ), its active and reactive PV generation (pi and qi , i ∈ N ), and its voltage magnitude vi ∈ [V i , V i ], i ∈ N , where V i and V i are the nodal voltage limits. It is assumed that PV resources are connected via an inverter with the rated power of Si . The active and reactive power flows from node i to node j are denoted as pij and qij , (ij) ∈ E, and the resistance and reactance of edge (ij) are Rij and Xij . Additionally, set Ci denotes all children nodes of node i. Neglecting line losses, power flows in a radial distribution system can be modeled using the LinDistFlow approximation, [18]: pij = Pj − pj + X pjk , ∀(ij) ∈ E (1) qjk , ∀(ij) ∈ E (2) uj = ui − 2(Rij pij + Xij qij ), ∀(ij) ∈ E (3) qij = Qj − qj + k∈Cj X k∈Cj where (1) and (2) govern the reactive and active power flows and (3) accounts for the nodal voltages squared, i.e. ui = vi2 and uj = vj2 . The active and reactive power injection of PV resources are constrained by the rated power of the inverter: p2i + qi2 ≤ Si2 , ∀i ∈ N P V . (4) If the active power output is fixed at p̂i , the reactive power out of the inverter can vary as: q (5) |qi | ≤ Si2 − p̂2i , ∀i ∈ N P V . The ability to control the reactive power output of distributed inverters within the range given by (5) enables various control policies for voltage support and loss minimization. These policies are reviewed in Section II-B. B. Existing Control Policies This section reviews existing control policies that are grouped below based on their intended purpose. 1) Constant power factor: This policy aims to maintain a constant power factor of net power injections at a given node of the distribution system, i.e. cos φi = const, ∀i ∈ N . This policy is based on local reactive and active power measurements and adjust the output of the inverter to compensate for the power factor fluctuations. Assuming that active power produced by PV resources cannot be curtailed or stored for later use, i.e. pi = p̂i , the inverter at node i adjusts its reactive power output as:  qi = (p̂i − Pi )2 + Q2i / cos φ2i − (p̂i − Pi )2 , ∀i ∈ N P V . (6) where qi and p̂i are subject to (4). Note that in some cases, the constant power factor policy can be relaxed such that the power factors needs to be maintained within a given range, rather than at a given constant value [14]. In practice, the constant power factor policy has been proven to be efficient to keep nodal voltages within an acceptable range [5]. However, the overall performance of this policy significantly reduces as the number of inverters increases. Set Ci pij , qij pi , qi j i Pi , Q i Pj , Q j Figure 1. A radial distribution system with two nodes and main notations. 2) Voltage control: On the other hand, nodal voltages can be explicitly factored in the control policy for distributed inverters [15]. References [5], [15], [16] study variations of such policies based on a so-called sigmoid function, where the control law is given by: q   qi = FiV = min Qi , Si2 − p̂2i · sgn(vi , δ) , ∀i ∈ N P V (7) where sgn(·) denotes the sigmoid operator and δ is an exogenous parameter that can be tuned in each specific case. Relative to the control policy in (6), the control policy in (7) is more effective as it directly targets nodal voltages. However, it tends to increase power losses in some cases and, thus, is commonly perceived as less cost effective, see [5]. 3) Power loss minimization: Turitsyn et al. [17] also propose the control policy to minimize power losses: ( p Qi , |qi | ≤ Si2 − p̂2i L p , ∀i ∈ N P V . (8) qi = Fi = ± Si2 − p̂2i , otherwise In contrast with the policy in (7), the power loss minimization policy may impair the compliance with voltage limits. 4) Hybrid policy: The drawbacks of the control policies in (7) and (8) can be overcome, if the two policies are combined in a hybrid policy, i.e. Hi = KiL FiL + KiV FiV , where KiV and KiL are appropriately chosen droop parameters. As shown in [5], the hybrid policy outperforms FiL and FiV , when they are enforced individually. C. Proposed Control Policy The common thread of the control policies reviewed in Section II-B is that they are based on local voltage and power injection measurements, i.e. the response of these policies is limited to the operating conditions at node i. In addition to these measurements, it is also possible to measure downstream active and reactive power flows from node i to its children nodes. Since the distribution system is assumed to be radial, the downstream power flow measurements can be to respond to operating conditions downstream of the node where the measurements are taken. For example, if qij increases, it indicates that more reactive power is needed downstream of node i and that the inverter at node i can increase its reactive power output qi to compensate for the increase in qij . As a result, less reactive power would be sourced from the upstream of node i, naturally leading to lower power flows and voltage sags across the upstream edges. This observation suggests that under the fixed active power injection of the inverter, i.e. pi = p̂i , local measurements of qij can be used to design the following control policy: ( P q̂i + Kiq j∈Ci (qij − q̂ij ), if q̂ij − qij ≥ 0 qi = , (9) q̂i , if q̂ij − qij < 0 q (10) |qi | ≤ Si2 − p̂2i , ∀i ∈ N P V where Kiq > 0 is a droop coefficient of the inverter at node i, q̂i and q̂ij are the reference reactive power output of the inverter at node i and power flow in edge (ij). The control enabled by (9) proportionally increases the reactive power output of inverter at node i, qij , if the measured reactive power flow in edge (ij), qij , is greater than its reference value q̂ij , i.e. qij ≥ q̂ij . On the other hand, if qij < q̂ij , the control in (9) maintains the reference reactive power output q̂i . The feasibility of the control policy is ensured in (10). Remark 1: The control in (9) is based on reactive power flow measurements and is also extensible to active power measurements. In this case, the active and reactive power outputs of the inverter are governed by: Eq. (9) ( pi = (11) p̂i + p̂i , Kip p2i + qi2 ≤ Si2 , Kip P j∈Ci (pij − p̂ij ), ∀i ∈ N P V , if p̂ij − pij ≥ 0 , (12) if p̂ij − pij < 0 (13) where > 0 is a droop coefficient and p̂ij is a reference power output of the inverter. Eq. (12) changes the active power output of the inverter at node i similarly to (9). Eq. (13) enforces the limit on the feasible range of pi and qi . Since the active power output of PV resources is uncertain and there is no guarantee that it can be increased on demand, enabling the control policy in (12) will require a coordination with storage resources at the same node i. Remark 2: Unlike the control policies reviewed in Section II-B, the control in (9) and in (12) require reference values of p̂i , q̂i , p̂ij , q̂ij . In case if there is no communication infrastructure between the distribution system operator and distributed inverters, these reference values can be set to some ad-hoc values that can be related to power flow limits for q̂ij or representative power outputs of the inverter for p̂i and q̂i . On the other hand, if there is a communication mechanism between the system operator and distributed inverters, the reference values can be routinely updated to follow the operating settings of the distribution system operator. If these settings are obtained from solving the distribution optimal power flow problem, the controls in (9) and in (12) can be interpreted as the minimizers of real-time deviations from the optimal power flow solution. Remark 3: As with the reference values discussed in Remark 2, droops Kip and Kiq can be set to fixed parameters that account for average operating conditions at node i or be routinely updated by the distribution system operator, if there is necessary communication infrastructure. D. Numerical Experiments The policies (9)-(10) and (11)-(12) are tested using a modification of the IEEE 33-bus distribution system [18] available in Matpower as ‘case33bw’ [19], see Fig. 2. The input data from [19] is modified as follows. One PV generator is connected to the distribution grid at node 5 via the inverter with the rated power S = 0.5 MVA. The power output of the PV generator is fixed at the reference value of p̂i = 0.3 MW, thus |qi | ≤ 0.4 MVAr. The PV resource is coupled with one storage unit that can provide up to 0.1 MW. The reference values of 1 2 19 20 21 22 30 31 32 25 24 23 3 29 11 10 9 4 28 12 8 5 27 13 7 6 26 16 17 18 14 15 33 Figure 2. The 33-bus distribution system described in [18] and available in Matpower as ‘case33bw’ [19]. Node 5 features one inverter-tied PV resource. Cases I and II consider a 50% load increase at nodes 5 and 33 (both nodes are in yellow), respectively. is enabled. In both cases, the comparative performance of the proposed policies relative to (8) is sensitive to the value of droop K and the proposed policies become more advantageous as the value of K increases. With respect to the value of droop K, the proposed policies linearly reduce the losses for higher values of K until the output of the inverter achieves S, leading to a breakpoint. Following the breakpoint, increasing the value of K does not result in any additional power loss reduction. The control policy in Eq. (11)-(13), which regulates both the active and reactive power output of the inverter, saturates at higher values of droop K than the control policy in (9)-(10) and thus leads to larger power loss reductions. III. C ONTROL P OLICIES IN C HANCE -C ONSTRAINED D ECENTRALIZED O PTIMIZATION This section describes how the proposed control policies in (9)-(10) and (11)-(12) can be enforced in the distribution optimal power flow problem. The resulting problem is then solved using the ADMM-like algorithm inspired by [8] in a distribution fashion that mirrors the distributed nature of the proposed control policies. Finally, we extend the problem to accommodate the uncertainty of PV resources using the chance-constrained framework. A. Formulation The distribution optimal power flow problem is formulated as: X (pij )2 + (qij )2 (14) Rij min p,q Vi2 (ij)∈E Eq. (1) − (5) Figure 3. Comparison of the total active power losses in the distribution system: a) no control, b) control policy in (11)-(13), c) control policy in (9)(10) , d) FiL in (8). where the objective function is to minimize the power losses and Vi is the nominal voltage at node i. Since LinDistFlow neglects second-order terms of power flow equations, (14) computes approximate power losses based on approximate values of power flows pij and qij . To solve this problem in a decentralized manner, we reformulate it using the ADMM consensus approach as elaborated in [8]: min q̂ij and p̂ij are obtained from the AC OPF solution obtained with Matpower. For the sake of simplicity, it is assumed that K = Kip = Kiq . The active and reactive power loads are fixed at all nodes, except for two cases. In Case I the load at node 5 is increased by 50%, while in Case II the load at node 33 (the most electrically remote node from the root bus of the distribution system) is increased by 50%. The motivation behind these two cases is to compare how different control policies perform under local and remote deviations. Fig. 3 shows how the proposed policy changes the total active power losses in the distribution system for different values of droop K and compares it to the case without any control from the inverter and with the power loss minimization policy in (8). As expected, using any control policy reduces the losses relative to the case when no inverter-based control (15) q X Rij (q − )2 i Vi2 (ij)∈E qi+ − qi− + Qi − |qi | ≤ 0, − qi+ + qi− − Qi − |qi | ≤ V 2i ≤ u+ i ≤ V i , ∀i ∈ N u+ i u+ i qi+ = u− i − 2(Rij pij + = ui , u− i = uj , = qi , qi− = qj , Eq. (11) − (13) (16) ∀i ∈ N 0, ∀i ∈ N (17) (18) (19) Xij qi− ), ∀(i, j) ∈ E ∀i ∈ N ∀(i, j) ∈ E (20) (21) (22) (23) − where qi+ , qi− , u+ i and ui are the local copies of the global variables qi , qij , ui and uj for each node j, i.e. only communication between neighboring nodes is required. Eqs. (21) and (22) represent consensus or coupling constraints ensuring that all the local copies of the variables are equal to the global variables. Eq. (23) enforces the proposed control policies. 1 B. Solution Technique 2 19 20 21 22 30 31 32 Following [8], we implement the consensus ADMM-like algorithm by relaxing the consensus constraints (22) and (21). Each iteration of the algorithm is detailed below: 1) Minimization step: This step solves the local optimization problem for every PV node, where the objective function minimizes the augmented Lagrangian of the consensus problem: X Rij (q − )2 i min 2 + V qi− ,qi+ ,u− ,u i i i 25 24 23 3 29 11 10 9 4 28 12 8 5 27 13 7 6 26 16 17 18 33 (ij)∈E ρ ρ + (qi+ − qi )2 + (qi− − qij )2 2 2 ρ ρ + 2 − uj )2 + (ui − ui ) + (u− 2 2 i + − + λqi (qi+ − qij ) + λqi (qi− − qij ) + − u + λui (u+ i − ui ) + λi (ui − uj ) ρ 2 (24) − Eq. (17) − (20), (23) (25) where represent penalties for the difference between + − + the local and global variables and λqi , λqi , λui and − λui are the dual variables associated with (21) and − (22). The minimization step yield qi+ (k + 1), qi+1 (k + + − 1), [ui (k + 1), ui+1 (k + 1) at iteration k. 2) Global variables update step: Communicating between the neighbouring nodes only, the global variables are updated as:  1 (26) qi (k + 1) = qi+ (k + 1) + qj− (k + 1) 2  1 (k + 1) + u− (27) ui (k + 1) = u+ j (k + 1) . 2 i 3) Update step: This step updates the dual variables for every node as:   + + λqi (k + 1) = λqi (k)+ρ qi+(k + 1)−qi(k + 1) (28)  −  q− q− λi (k + 1) = λi (k)+ρ qi (k + 1)−qij(k + 1) (29)   + + λui (k + 1) = λui (k)+ρ u+ (30) i (k + 1)−ui(k + 1)  −  u− u− λi (k + 1) = λi (k)+ρ ui (k + 1)−uij(k + 1) . (31) Finally, the net reactive power injected or consumed by the inverters for each node is recovered from the obtained solution: qi = qi+ − qi− + Qi . (32) C. Modeling PV Uncertainty The PV uncertainty can be considered in the proposed distribution optimal power flow problem using the chanceconstrained framework. Following the chance-constrained approach in [10], [11], we obtain: P(pi ≤ P i ) ≥ 1 − ǫ, P(pi ≥ P i ) ≥ 1 − ǫ, ∀i ∈ N P V ∀i ∈ N PV (33) (34) 14 15 Figure 4. The modified 33-bus distribution system where the nodes with the PV resources installed at nodes #2,3,6,18,21,25 and 32 (in yellow).   where P i , P i is a given forecast range and ǫ is a given tolerance to a violation of that range. Accordingly, (17) and (18) are modified as: P(qi+ − qi− + Qi − cos φi pi ≤ 0) ≥ 1 − ǫ, P(−qi+ + qi− ∀i ∈ N P V − Qi − cos φi pi ≤ 0) ≥ 1 − ǫ, ∀i ∈ N (35) PV (36) where cos φi represents a constant power factor. We can also introduce the chance constraints on voltage limits in (19): P(u+ i ≤ V i ) ≥ 1 − ǫ, P(u+ i ≥ V i ≥ 1 − ǫ, ∀i ∈ N P V ∀i ∈ N PV (37) (38) Note that chance constraints in (33)-(38) can be reformulated as second order cone (SOC) constraints as explained in [10], [11]. However, in our implementation we treat (37)-(38) deterministically to avoid complexity. Interested readers are referred to Appendix for our description of this transformation. Distributed implementation of (37)-(38) will be a focus of our future work. D. Numerical Experiments We evaluate the proposed decentralized chance-constrained distribution optimal power optimization on the IEEE 33-bus distribution system, where the PV resources are installed at nodes #2 (1.9 MW), 3 (3.77MW),6 (7.54 MW), 18 (1.88 MW), 21 (4.71 MW), 25 (4.24 MW) and 32 (5.94 MW), see Fig. 4. The forecast error at every PV resources is zero-mean with the forecast varies of 10% of the forecast output. We assume that parameter ρ = 1/V12 , where V1 is the nominal voltage at the root bus. In the following experiments, the value of ǫ is uniformly set for all chance constraints. The proposed decentralized optimization is compared to the deterministic centralized (global) optimization. 1.5 = 0.015 = 0.02 = 0.05 = 0.1 Deterministic, centralized 120 = 0.015 = 0.02 = 0.05 = 0.1 Deterministic, centralized 100 1 Losses (MW) Reactive power injection (MVAR) 140 80 60 0.5 40 20 0 0 20 40 60 80 100 120 140 20 40 60 Iteration number 1) Power Losses: Fig. 5 and 6 display the ADMM convergence in terms of the total reactive power injection of distributed inverters and system-wide active power losses. Even though the algorithm takes no more than 120 iterations to converge among all instances considered, there are distinguished spikes in both plots. These spikes are characterized by the breakpoints, similar to Fig 3, when the inverter is operated at its rated capacity and can no longer provide the reactive power support to the system. As the value of parameter ǫ increases, i.e. the chance constraints become tighter, the total reactive power injection of distributed inverters increases monotonically. This indicates that the proposed control policy and decentralized optimization are of greater value for stricter operating standards. On the other hand, the system-wide active power losses remains roughly the same for all chance constrained instances solved. The effect of the proposed decentralized optimization is particularly noticeable for the systemwide active power losses, which drastically reduce relatively to the deterministic centralized case, regardless of the ǫ value chosen. 2) Nodal voltages: This section studies the impact of the proposed decentralized optimization on the nodal voltages across the distribution system. We set the value of parameter ǫ to 0.05 and track the voltage profile across branches as illustrated in Fig. 4. Fig. 7 and 8 detail the voltage profiles for each branch for the decentralized and centralized cases, respectively, while Fig. 9 itemizes the nodal reactive power injections of distributed inverters for both cases. In the centralized case, the voltage profiles monotonically reduce in all branches. On the other hand, the effect of the decentralized optimization is two-fold. First, it reduces the gap between the voltage magnitudes at the starting and end points of each branch, as compared to the centralized case. Second, the voltage profile across some branches is not monotonic. As it can be seen in Fig. 7 branches C, E, G, F has voltage spikes that are caused 100 120 140 Figure 6. Comparison of the ADMM algorithm convergence in terms of the system-wide active power losses for different values of ǫ. The straight green line indicates the deterministic centralized case. 1.003 A (branch 1-2) B (branch 2-3) C (branch 2,19-22) D (branch 3,23-25) E (branch 3,4-6) F (branch 6,26-33) G (branch 6,7-18) 1.0025 Voltage (pu) Figure 5. Comparison of the ADMM algorithm convergence in terms of the total reactive power injection of distributed PV inverters for different values of ǫ. The straight green line indicates the deterministic centralized case. 80 Iteration number 1.002 1.0015 1.001 1.0005 1 2 3 4 5 6 7 8 9 10 11 12 13 node number in branch Figure 7. Voltage profile along different branches of the distribution system for the decentralized optimization, parameter ǫ = 0.05. The branches are numbered based on Fig. 4. by the reactive power injections of distributed inverters. These spikes are caused by different reactive power injections in the decentralized and centralized cases as in Fig. 9. IV. C ONCLUSION This paper proposes a power-flow-based control policy for distributed energy resources located in the distribution systems. Our numerical experiments demonstrate that the proposed policy outperforms existing policies in terms of active power loss minimization. The proposed policy is integrated with the decentralized, chance-constrained distribution optimal power flow optimization. As compared to the centralized, deterministic optimization, our method reduces voltage sags across nearly all edges, thus improving compliance with voltage regulation, and reduces power flow losses. Modeling the PV uncertainty using chance constraints makes it possible to distribution. Eq. (40) can the equivalently be replaced by the following SOC constraints: 1.03 A (branch 1-2) B (branch 2-3) C (branch 2,19-22) D (branch 3,23-25) E (branch 3,4-6) F (branch 6,26-33) G (branch 6,7-18) 1.025 Voltage (pu) 1.02 1 t ≥ Σ2 x µT x + Φ 2 −1 (1 − ǫ)t ≤ b (41) (42) In our implementation, this transformation was automatically performed by JumpChance, a Julia package, see [20]. 1.015 R EFERENCES 1.01 1.005 1 1 2 3 4 5 6 7 8 9 10 11 12 13 node number in branch Figure 8. Voltage profile along different branches of the distribution system for the centralized optimization. The branches are numbered based on Fig. 4. 30 20 q i (MVAR) 10 0 -10 -20 = 0.05 Deterministic, centralized -30 2 3 6 18 21 Node number 25 32 Figure 9. Comparison of the reactive power injected or absorbed by every inverter for the centralized problem and the decentralized problem with the value of ǫ set as 0.05 adjust the conservatism of our method and does not increase its computational complexity. The proposed method is extensible to accommodate other control policies and various distribution energy resources. A PPENDIX Let ξ∼N (µ, Σ) be the vector of random variable with the means and variances given by the vectors µ and variances σ, respectively, and let b and x be the vectors of parameters and decision variables, respectively. The chance constraint of the form: P(ξ T x ≤ b) ≥ 1 − ǫ can be represented in the following form: √ µT x + Φ−1 (1 − ǫ) xT Σx ≤ b (39) (40) where ǫ ∈ [0, 1] is tolerance to violations and Φ−1 is the inverse cumulative distribution function of the standard normal [1] U.S. Department of Energy, “Smart grid research & development multi-year program plan(MYPP) 2010-2014:2012 update,” 2012. [Online]. Available: http://energy.gov/oe/downloads/smart-grid-rd-multi-year-program-plan-2010-2014-Septe [2] M. Bragin and Y. Dvorkin, “Toward Coordinated Transmission and Distribution Operations,” in Proc. of the 2018 IEEE PES General Meeting (accepted for publication), Portland, Oregon, 2018. Available at: https://arxiv.org/abs/1803.02681. [3] G. Joos, B. T. Ooi, D. McGillis, F. D. Galiana and R. Marceau, “The potential of distributed generation to provide ancillary services,” 2000 Power Engineering Society Summer Meeting, Seattle, WA, 2000. [4] J. Tengku, A. Mohamed and H. Shareef, “ A review on voltage control methods for active distribution networks,” Prz.Elektr.. 88. 304-312, 2012. [5] K. Turitsyn, P. Sulc, S. Backhaus and M. Chertkov, “Options for Control of Reactive Power by Distributed Photovoltaic Generators,” Proceedings of the IEEE, vol. 99, no. 6, pp. 1063-1073, June 2011. [6] K. Turitsyn and P. Šulc and S. Backhaus and M. Chertkov, “Distributed control of reactive power flow in a radial distribution circuit with high photovoltaic penetration,” 2010 IEEE PES General Meeting, July 2010. [7] S. Kundu and I. A. Hiskens, “Distributed control of reactive power from photovoltaic inverters,” EEE Int. Symp. Circ. Syst., Beijing, 2013. [8] P. Šulc, S. Backhaus and M. Chertkov, “Optimal Distributed Control of Reactive Power Via the Alternating Direction Method of Multipliers,” IEEE Transactions on Energy Conversion, Dec, 2013. [9] S. Boyd et al, “Distributed optimization and statistical learning via the alternating direction method of multipliers,” Found. & Tr.®in Mach. Learn.,vol.3, no.1, pp.1– 122, 2011. [10] D. Bienstock, M. Chertkov, and S. Harnett, “Chance-constrained optimal power flow: Risk-aware network control under uncertainty,” SIAM Rev., vol. 56, no. 3, pp. 461–495, 2014. [11] M. Lubin, Y. Dvorkin and S. Backhaus, “A Robust Approach to Chance Constrained Optimal Power Flow With Renewable Generation,” in IEEE Transactions on Power Systems, vol. 31, no. 5, pp. 3840-3849, Sept. 2016. [12] Y. Dvorkin et al, “Uncertainty Sets for Wind Power Generation,” IEEE Trans. Pwr. Syst., vol. 31, no. 4, pp. 3326-3327, July 2016. [13] E. Dall’Anese, K. Baker and T. Summers, “Chance-Constrained AC Optimal Power Flow for Distribution Systems With Renewables,” IEEE Transactions on Power Systems, vol. 32, no. 5, pp. 3427-3438, Sept. 2017. [14] P. N. Vovos et al, “Centralized and Distributed Voltage Control: Impact on Distributed Generation Penetration,” IEEE Trans.Pwr. Syst., vol. 22, no. 1, pp. 476-483, Feb. 2007. [15] B. Seal, “Standard language protocols for photovoltaics and storage grid integration,” Tech. Rep. EPRI 1020906. [Online]. Available: http://my.epri.com/portal/server. pt?Abstractid=000000000001020906 [16] H. G. Yeh, D. F. Gayme and S. H. Low, “Adaptive VAR Control for Distribution Circuits With Photovoltaic Generators” in IEEE Transactions on Power Systems, vol. 27, no. 3, pp. 1656-1663, Aug. 2012. [17] K. Turitsyn, P. Sulc, S. Backhaus and M. Chertkov, “Local Control of Reactive Power by Distributed Photovoltaic Generators,” First IEEE International Conference on Smart Grid Communications, Gaithersburg, MD, 2010, pp. 79-84. [18] M. E. Baran and F. F. Wu, “Network Reconfiguration in Distribution Systems for Loss Reduction and Load Balancing,” IEEE Power Engineering Review, vol. 9, no. 4, pp. 101-102, April 1989. [19] R. D. Zimmerman, C. E. Murillo-Sanchez and R. J. Thomas, “MATPOWER: Steady-State Operations, Planning, and Analysis Tools for Power Systems Research and Education,” IEEE Transactions on Power Systems, vol. 26, no. 1, pp. 12-19, Feb. 2011. [20] JumpChance, 2017. Available at: https://github.com/mlubin/JuMPChance.jl
3cs.SY
Speeding-up the decision making of a learning agent using an ion trap quantum processor Theeraphot Sriarunothai,1 Sabine Wölk,2, 1 Gouri Shankar Giri,1 Nicolai Friis,3, 2 Vedran Dunjko,2, 4 Hans J. Briegel,2, 5 and Christof Wunderlich1, ∗ 1 arXiv:1709.01366v2 [quant-ph] 23 Oct 2017 Department Physik, Naturwissenschaftlich-Technische Fakultät, Universität Siegen, Walter-Flex-Str. 3, 57068 Siegen, Germany 2 Institute for Theoretical Physics, University of Innsbruck, Technikerstraße 21a, 6020 Innsbruck, Austria 3 Institute for Quantum Optics and Quantum Information, Austrian Academy of Sciences, Boltzmanngasse 3, 1090 Vienna, Austria 4 Max Planck Institute of Quantum Optics Garching 85748, Germany 5 Department of Philosophy, University of Konstanz, 78457 Konstanz, Germany We report a proof-of-principle experimental demonstration of the quantum speed-up for learning agents utilizing a small-scale quantum information processor based on radiofrequency-driven trapped ions. The decision-making process of a quantum learning agent within the projective simulation paradigm for machine learning is implemented in a system of two qubits. The latter are realized using hyperfine states of two frequency-addressed atomic ions exposed to a static magnetic field gradient. We show that the deliberation time of this quantum learning agent is quadratically improved with respect to comparable classical learning agents. The performance of this quantumenhanced learning agent highlights the potential of scalable quantum processors taking advantage of machine learning. INTRODUCTION The past decade has seen the parallel advance of two research areas — quantum computation[1] and artificial intelligence[2] — from abstract theory to practical applications and commercial use. Quantum computers, operating on the basis of information coherently encoded in superpositions of states that could be considered classical bit values, hold the promise of exploiting quantum advantages to outperform classical algorithms, e.g., for searching databases[3], factoring numbers[4], or even for precise parameter estimation[5, 6]. At the same time, artificial intelligence and machine learning have become integral parts of modern automated devices using classical processors[7–10]. Despite this seemingly simultaneous emergence and promise to shape future technological developments, the overlap between these areas still offers a number of unexplored problems[11]. It is hence of fundamental and practical interest to determine how quantum information processing and autonomously learning machines can mutually benefit from each other. Within the area of artificial intelligence, a central component of modern applications is the learning paradigm of an agent interacting with an environment[2, 12, 13] illustrated in Fig. 1 (a), which is usually formalized as so-called reinforcement learning. This entails receiving perceptual input and being able to react to it in different ways. The learning aspect is manifest in the reinforcement of the connections between the inputs and actions, where the correct association is (often implicitly) specified by a reward mechanism, which may be external to the agent. In this very general context, an approach to explore the intersection of quantum computing and artificial intelligence is to equip autonomous learning agents with quantum processors for their deliberation procedure1 . That is, an agent chooses its reactions to perceptual input by way of quantum algorithms or quantum random walks. The agent’s learning speed can then be quantified in terms of the average number of interactions with the environment until targeted behavior (reactions triggering a reward) is reproduced by the agent with a desired efficiency. This learning speed cannot generically be improved by incorporating quantum technologies into the agent’s design[14]. However, a recent model[15] for learning agents based on projective simulation (PS)[13] allows for a generic speed-up in the agent’s deliberation time during each individual interaction. This quantum improvement in the reaction speed has been established within the reflecting projective simulation (RPS) variant of PS[15]. There, the desired actions of the agent are chosen according to a specific probability distribution that can be modified during the learning process. This is of particular relevance to adapt to rapidly changing environments[15], as we shall elaborate on in the next section. For this task, the deliberation time of classical RPS agents is proportional to the quantities 1/δ and 1/. These characterize the time needed to generate the specified distribution in the agent’s internal memory and the time to sample a suitable (e.g., rewarded rather than an unrewarded) action from it, respectively. A quantum RPS (Q-RPS) agent, in contrast, is able to obtain such an action quadrati- 1 ∗ [email protected] Other approaches that we will not further discuss here concern models where the environment, and the agent’s interaction with it may be of quantum mechanical nature as well[14]. 2 Sensors Percepts Environment Agent Memory Projective Simulation Actuators Actions (a) Q-RPS we are able to empirically√confirm both the quadratically improved scaling of O(1/ ), and the correct output according to the tail of the stationary distribution. Here,  denotes the initial probability of finding a flagged action within the stationary distribution α = {ai }) for the average number of calls of the diffusion operator before sampling one of the desired actions (see Methods). The tail is defined as the first n components of α . The latter means that aj /ak = bj /bk ∀j, k ∈ {1, . . . , n}, where bj denotes the final probability that the agent obtains the flagged action labeled j. Note that the Q-RPS algorithm enhances the overall probability of obtaining a flagged action such that ˜ ≡ (b) n X i=1 FIG. 1. Learning agent & quantum reflecting projective simulation (Q-RPS). (a) Learning agents receive perceptual input (“percepts”) from and act on the environment. The projective simulation (PS) decision-making process draws from the agent’s memory and can be modeled as a random walk in a clip network, which, in turn, is represented by a stochastic matrix P . (b) Q-RPS agents enhance the relative probability of (desired) actions (green columns) compared to other clips (grey) that may include undesired actions or percepts (blue) within the stationary distribution of P before sampling, achieving a quadratic speed-up w.r.t. to classical RPS agents. √ cally faster, i.e., within a time of the order 1/ δ (see Methods). Here, we report on the first proof-of-principle experimental demonstration of a quantum-enhanced reinforcement learning system, complementing recent experimental work in the context of (un)supervised learning [16– 18]. We implement the deliberation process of an RPS learning agent in a system of two qubits that are encoded in the energy levels of one trapped atomic ion each. Within experimental uncertainties, our results confirm the agent’s action output according to the desired distributions and within deliberation times that are quadratically improved with respect to comparable classical agents. This laboratory demonstration of speeding up a learning agent’s deliberation process can be seen as the first experiment combining novel concepts from machine learning with the potential of ion trap quantum computers where complete quantum algorithms have been demonstrated [19–22] and feasible concepts for scaling up [23–25] are vigorously pursued. bi > n X aj = , (1) i=1 whilst maintaining the relative probabilities of the flagged actions according to the tail of α , as illustrated in Fig. 1 (b). For the implementation we hence need at least a threedimensional Hilbert space that we realize in our experiment using two qubits encoded in the energy levels of two trapped ions (see the experimental setup section): Two states to represent two different flagged actions (represented in our experiment by |00i and |01i), and at least one additional state for all non-flagged actions (|10i and |11i in our experiment). The preparation of the stationary state is implemented by |αi = UP (θ1 , θ2 ) |0i = R1 (θ1 , π2 )R2 (θ2 , π2 ) |0i , (2) where Rj (θ, φ) is a single-qubit rotation on qubit j, i.e.,   (3) Rj (θ, φ) = exp i θ2 (Xj cos φ − Yj sin φ) . Here, Xj , Yj , and Zj denote the usual Pauli operators of qubit j. The total probability  = a00 + a01 for a flagged action within the stationary distribution is then determined by θ1 via  = cos2 (θ1 /2), (4) whereas θ2 determines the relative probabilities of obtaining one of the flagged actions via a00 / = cos2 (θ2 /2). (5) The reflection over the flagged actions ref A is here given by a Z rotation, defined by Rj,z (θ) = exp[−i θ2 Zj ], with rotation angle −π for the first qubit, ref A = R1,z (−π) = exp[i π2 Z1 ]. (6) EXPERIMENTAL IMPLEMENTATION OF RANK-ONE RPS The reflection over the stationary distribution can be performed by a combination of single-qubit rotations determined by θ1 and θ2 and a CNOT gate given by The proof-of-principle experiment that we report in this paper experimentally demonstrates the quantum speed-up of quantum-enhanced learning agents. That is, ref α = R1 (θ1 − π, π2 )R2 (θ2 + π2 , π2 )UCNOT × R1 (−θ1 − π, π2 )R2 (−θ2 − π2 , π2 ), (7) 3 FIG. 2. Quantum circuit for Q-RPS. A rank-one Q-RPS is implemented using two qubits. The diffusion step consisting of reflections over the flagged actions and the stationary distribution (shown once each) is repeated k times, where k is given by Eq. (11). The specific pulse sequence implementing this circuit is explained in the Supplementary Material. which can be understood as two calls to UP (once in terms of UP† ) supplemented by fixed single-qubit operations[26]. The total gate sequence for a single diffusion step (consisting of a reflection over the flagged actions followed by a reflection over the stationary distribution) can hence be decomposed into single-qubit rotations and CNOT gates and is shown in Fig. 2. The speed-up of the rank-one Q-RPS algorithm w.r.t. a classical RPS agent manifests in terms of a quadratically smaller average number of calls to UP (or, equivalently, to the diffusion operator D = ref α ref A ) until a flagged action is sampled. Since the P final probability of obtaining a desired action is ˜ ≡ i=1,...,n bi , we require 1/˜  samples on average, each of which is preceded by the initial preparation of |αi and k diffusion steps. The average numberof uses of UP to sample correctly is hence C = 2k() + 1 /˜ , which we refer to as ’cost’ in this paper. In the following, it is this functional relationship between C and  that we put to the test, along with the predicted ratio a00 /a01 of occurrence of the two flagged actions. The experimental setup Two 171 Yb+ ions are confined in a linear Paul trap with axial and radial trap frequencies of 2π × 117 kHz and 2π × 590 kHz, respectively. After Doppler cooling, the two ions form a linear Coulomb crystal, which is exposed to a static magnetic field gradient of 19 T/m, generated by a pair of permanent magnets. The ion-ion spacing in this configuration is approximately 10 µm. Magnetic gradient induced coupling (MAGIC) between ions results in an adjustable qubit interaction mediated by the common vibrational modes of the Coulomb crystal[27]. In addition, qubit resonances are individually shifted as a result of this gradient and become position dependent. This makes the qubits distinguishable and addressable by their frequency of resonant excitation. The addressing frequency separation for this two-ion system is about 3.7 MHz. All coherent operations are performed using radio frequency (RF) radiation near 12.6 GHz, matching the respective qubit resonances[28]. A more detailed description of the experimental setup can be found in Refs.[21, 27, 29]. The qubits are encoded in the hyperfine manifold of each ion’s ground state, representing an effective spin 1/2 system. The qubit states |0i and |1i are represented by the energy levels |2 S1/2 , F = 0 i and |2 S1/2 , F = 1, mF = +1 i, respectively. The ions are Doppler cooled on the resonance |2 S1/2 , F = 1 i ↔ |2 P1/2 , F = 0 i with laser light near 369 nm. Optical pumping into long-lived meta-stable states is prevented using laser light near 935 nm and 638 nm. The vibrational excitation of the Doppler cooled ions is further reduced by employing RF sideband cooling for both the center of mass mode and the stretch mode. This leads to a mean vibrational quantum number of hni ≤ 5 for both modes. The ions are then initialized in the qubit state |0i by state selective optical pumping with a 2.1 GHz red-shifted Doppler-cooling laser on the |2 S1/2 , F = 1 i ↔ |2 P1/2 , F = 1 i resonance. The desired qubit states are prepared by applying an RF pulse resulting in a coherent qubit rotation with precisely defined rotation angle and phase (Eq. (3)). The required number of diffusion steps is then applied to both qubits, using appropriate single-qubit rotations and a two-qubit ZZ-interaction given by UZZ (θ) = exp [i θ2 Z1 Z2 ], (8) which is directly realizable with MAGIC[27]. A CNOT gate (UCNOT ) can then be performed via π π π π π UCNOT = e−i 4 R2 ( π2 , 3π 2 )UZZ ( 2 )R2 ( 2 , 0)R2,z ( 2 )R1,z (− 2 ). The required number of single qubit gates is optimized by combining appropriate single qubit rotations together from ref A and ref α (see Fig. 2). Thus, we can simplify the algorithm to D =R2 (θ2 , π2 )R1 (θ1 , π2 )R2,z (− π2 )R1,z ( π2 ) UZZ ( π2 )R2 (−θ2 , π2 )R1 (θ1 , π2 ), (9) as shown in Fig. 5 of Methods. During the evolution time of 4.24 ms for each diffusion step both qubits are protected from decoherence by applying universally robust (UR) dynamical decoupling (DD) pulses[30]. The complete pulse sequence for the experiment reported here can be found in Fig. 5 of Methods. Finally, projective measurements on both qubits are performed in the computational basis {|0i , |1i} by scattering laser light near 369 nm on the |2 S1/2 , F = 1 i 4 ↔ |2 P1/2 , F = 0 i transition, and detecting spatially resolved resonance fluorescence using an electron multiplying charge coupled device (EMCCD) to determine the relative frequencies b00 , b01 , b10 , b11 for obtaining the states |00i, |01i, |10i, and |11i, respectively. Results As discussed above, our goal is to test the two characteristic features of rank-one Q-RPS: (i) the scaling of the average cost C with , and (ii) the sampling ratio for the different √ flagged actions. For the former, we expect a scaling of 1/ , while we expect the ratio of the number of occurrences of the two actions to be maintained with respect to the relative probabilities given by the stationary distribution. Therefore, our first set of measurements studies the behavior of the cost C as a function of the 25 Ideal Q-RPS Ideal RPS Experiment Fit 20 total initial probability . The second set of measurements studies the behavior of the output probability ratio rf = b00 /b01 as a function of input probability ratio ri = a00 /a01 . For the former, a series of measurements is performed for different values of  corresponding to k = 1 to k = 7 diffusion steps after the initialstate preparation. To obtain the cost C = 2k() + 1 /˜ , where ˜ = b00 + b01 , we measure the probabilities b00 and b01 after k diffusion steps and repeat the experiment 1600 times for fixed . The average cost is then plotted against  as shown in Fig. 3. The experimental data shows that the cost de√ creases with  as 1/ , as desired. This is in good agreement with the behavior expected for the ideal Q-RPS algorithm. In the range of chosen probabilities , the experimental result of Q-RPS outperforms the classical RPS, as shown in Fig. 3. Therefore, we demonstrate that the experimental efficiency is already good enough not only to obtain improved scaling, but also to outperform the classical algorithm, despite the offset in the cost function and the finite precision of the quantum algorithm. The deviation from the ideal behavior is attributed to a small detuning of the RF pulses implementing coherent operations, as we discuss in the Supplementary Materials. 15 2 10 1.5 5 1 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.5 FIG. 3. Scaling behavior of the learning agent’s cost employing Q-RPS and RPS. After the preparation of |αi, k diffusion steps are applied before an action is sampled. This procedure is repeated until a flagged action is obtained, accumulating a certain cost C, whose average is shown on the vertical axis. Measurements are performed for different values of  corresponding to k = 1 to k = 7 diffusion steps. The dashed black line and the solid blue √ line represent the behavior expected for ideal Q-RPS (1/ ) and ideal classical RPS (1/), respectively. The fit to the experimental data confirms √ that the scaling behavior follows a 1/  behavior, and thus is consistent with Q-RPS. The data show that the experimental Q-RPS outperforms the classical RPS within the range of  chosen in the experiment. The error bars on the x-axis represent the uncertainties in preparing the quantum states. The error bars on the y-axis represent the statistical errors. 0 0 0.5 1 1.5 2 FIG. 4. Output distribution. A comparison of the output ratio of two flagged actions at the end of the algorithm with the corresponding input ratio is shown. Measurements are performed with k = 1 (red square) and k = 3 (blue circle) diffusion steps. The black dashed line shows the behavior of the ideal Q-RPS. The red and blue dashed lines, each representing a linear fit to the corresponding set of data, confirm that the initial probability ratio is maintained. Error bars represent statistical errors. 5 For the second set of measurements, we select a few calculated probabilities a00 and a01 in order to obtain different values of the input ratio ri = a00 /a01 between 0 and 2, whilst keeping k() in a range between k = 1 and k = 3. For these probabilities a00 and a01 , the corresponding rotation angles θ1 and θ2 of RF pulses intended for preparation are extracted using Eq. (4) and Eq. (5). We then perform the Q-RPS algorithm for the specific choices of k and repeat it 1600 times to estimate the probabilities b00 and b01 . We finally obtain the output ratio rf = b00 /b01 , which is plotted against the input ratio in Fig. 4. The experimental data follows a straight line with an offset from the behavior rf /ri = 1 expected for an ideal Q-RPS agent. The slopes of the two fitted linear functions agree within their respective error showing that the deviation of the output ratio from the ideal result is independent of the number of diffusion steps. In addition, this indicates that this deviation is not caused by the quantum algorithm itself, but by the initial state preparation and/or by the final measurement process where such a deviation can be caused by an asymmetry in the detection fidelity. Indeed, the observed deviation is well explained by a typical asymmetry in the detection fidelity of 3% as encountered in the measurements presented here. This implies reliability of the quantum algorithm also for a larger number of diffusion steps. A detailed discussion of experimental sources of error is given in the Supplementary Materials. CONCLUSION We have investigated a quantum-enhanced deliberation process of a learning agent implemented in an ion trap quantum processor. Our approach is centered on the projective simulation[13] model for reinforcement learning. Within this paradigm, the decision-making procedure is cast as a stochastic diffusion process, that is, a (classical or quantum) random walk in a representation of the agent’s memory. The classical PS framework can be used to solve standard textbook problems in reinforcement learning[31–33], and has recently been applied in advanced robotics[34], adaptive quantum computation[35], as well as in the machine-generated design of quantum experiments[36]. We have focused on reflecting projective simulation[15], an advanced variant of the PS model based on ”mixing” (see Methods), where the deliberation process allows for a quantum speed-up of Q-RPS agents w.r.t. to [1] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information (Cambridge University Press, Cambridge, U.K., 2000). [2] S. J. Russell and P. Norvig, Artificial Intelligence: A Modern Approach, 2nd ed. (Pearson Education, 2003). their classical counterparts. In particular, we have considered the interesting special case of rank-one Q-RPS. This provides the advantage of the speed-up offered by the mixing-based approach, but is also in one-to-one correspondence with the hitting-based basic PS using twolayered networks, which has been applied in classical task environments[31–36]. In a proof-of-principle experimental demonstration, we verify that the deliberation process of the quantum learning agent is quadratically faster compared to that of a classical learning agent. The experimental uncertainties in the reported results, which are in excellent agreement with a detailed model, do not interfere with this genuine quantum advantage in the agent’s deliberation time. We achieve results for the cost C for up to 7 diffusion steps corresponding to an initial probability  = 0.01 to choose a flagged action. The systematic variation of the the ratio ri between the input probabilities, a00 and a01 for flagged actions and the measurement of the ratio rf between the learning agent’s output probabilities, b00 and b01 as a function of ri shows that the quantum algorithm is reliable independent of the number of diffusion steps. This experiment highlights the potential of a quantum computer in the field of quantum enhanced learning and artificial intelligence. A practical advantage, of course, will become evident once larger percept spaces and general rank-N Q-RPS are employed. Such extensions are, from the theory side, unproblematic given that the modularized nature of the algorithm makes it scalable. An experimental realization of such large-scale quantum enhanced learning will be feasible with the implementation of scalable quantum computer architectures. Meanwhile, all essential elements of Q-RPS have been successfully demonstrated in the proof-of-principle experiment reported here. ACKNOWLEDGMENTS T. S., S. W., G. S. G. and C. W. acknowledge funding from Deutsche Forschungsgemeinschaft and from Bundesministerium für Bildung und Forschung (FK 16KIS0128). G. S. G. also acknowledges support from the European Commission’s Horizon 2020 research and innovation program under the Marie Sklodowska-Curie grant agreement number 657261. H. J. B. and N. F. acknowledge support from the Austrian Science Fund (FWF) through Grants No. SFB FoQuS F4012 and the START project Y879-N27, respectively. [3] L. K. Grover, in Proceedings of the Twenty-eighth Annual ACM Symposium on Theory of Computing, STOC ’96 (ACM, New York, NY, USA, 1996) pp. 212–219. [4] P. W. Shor, in Proceedings 35th Annual Symposium on Foundations of Computer Science (1994) pp. 124–134. 6 [5] V. Giovannetti, S. Lloyd, and L. Maccone, Science 306, 1330 (2004). [6] N. Friis, D. Orsucci, M. Skotiniotis, P. Sekatski, V. Dunjko, H. J. Briegel, and W. Dür, New J. Phys. 19, 063044 (2017). [7] K. Lim, Y. Hong, Y. Choi, and H. Byun, PLOS ONE 12, e0173317 (2017). [8] D. Silver, A. Huang, C. J. Maddison, A. Guez, L. Sifre, G. van den Driessche, J. Schrittwieser, I. Antonoglou, V. Panneershelvam, M. Lanctot, S. Dieleman, D. Grewe, J. Nham, N. Kalchbrenner, I. Sutskever, T. Lillicrap, M. Leach, K. Kavukcuoglu, T. Graepel, and D. Hassabis, Nature 529, 484 (2016). [9] V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, S. Petersen, C. Beattie, A. Sadik, I. Antonoglou, H. King, D. Kumaran, D. Wierstra, S. Legg, and D. Hassabis, Nature 518, 529 (2015). [10] J. Schaeffer, N. Burch, Y. Björnsson, A. Kishimoto, M. Müller, R. Lake, P. Lu, and S. Sutphen, Science 317, 1518 (2007). [11] J. Biamonte, P. Wittek, N. Pancotti, P. Rebentrost, N. Wiebe, and S. Lloyd, “Quantum machine learning,” (2016), arXiv:1611.09347. [12] R. Sutton and A. Barto, Reinforcement learning (The MIT Press, 1998). [13] H. J. Briegel and G. De las Cuevas, Sci. Rep. 2, 400 (2012). [14] V. Dunjko, J. M. Taylor, and H. J. Briegel, Phys. Rev. Lett. 117, 130501 (2016). [15] G. D. Paparo, V. Dunjko, A. Makmal, M. A. MartinDelgado, and H. J. Briegel, Phys. Rev. X 4, 031002 (2014). [16] D. Ristè, M. P. da Silva, C. A. Ryan, A. W. Cross, A. D. Córcoles, J. A. Smolin, J. M. Gambetta, J. M. Chow, and B. R. Johnson, npj Quantum Information 3, 16 (2017). [17] Z. Li, X. Liu, N. Xu, and J. Du, Phys. Rev. Lett. 114, 140504 (2015). [18] X.-D. Cai, D. Wu, Z.-E. Su, M.-C. Chen, X.-L. Wang, L. Li, N.-L. Liu, C.-Y. Lu, and J.-W. Pan, Phys. Rev. Lett. 114, 110504 (2015). [19] D. Hanneke, J. P. Home, J. D. Jost, J. M. Amini, D. Leibfried, and D. J. Wineland, Nat. Phys. 6, 13 (2010). [20] T. Monz, D. Nigg, E. A. Martinez, M. F. Brandl, P. Schindler, R. Rines, S. X. Wang, I. L. Chuang, and R. Blatt, Science 351, 1068 (2016). [21] C. Piltz, T. Sriarunothai, S. S. Ivanov, S. Wölk, and C. Wunderlich, Sci. Adv. 2, e1600093 (2016). [22] S. Debnath, N. M. Linke, C. Figgatt, K. A. Landsman, K. Wright, and C. Monroe, Nature 536, 63 (2016). [23] D. Kielpinski, C. Monroe, and D. J. Wineland, Nature 417, 709 (2002). [24] C. Monroe, R. Raussendorf, A. Ruthven, K. R. Brown, P. Maunz, L.-M. Duan, and J. Kim, Phys. Rev. A 89, 022317 (2014). [25] B. Lekitsch, S. Weidt, A. G. Fowler, K. Mølmer, S. J. Devitt, C. Wunderlich, and W. K. Hensinger, Sci. Adv. 3, e1601540 (2017). [26] V. Dunjko, N. Friis, and H. J. Briegel, New J. Phys. 17, 023006 (2015). [27] A. Khromova, C. Piltz, B. Scharfenberger, T. F. Gloger, M. Johanning, A. F. Varón, and C. Wunderlich, Phys. Rev. Lett. 108, 220502 (2012). [28] C. Piltz, T. Sriarunothai, A. Varón, and C. Wunderlich, Nat. Commun. 5, 4679 (2014). [29] S. Wölk, C. Piltz, T. Sriarunothai, and C. Wunderlich, J. Phys. B: At. Mol. Opt. Phys. 48, 075101 (2015). [30] G. T. Genov, D. Schraft, N. V. Vitanov, and T. Halfmann, Phys. Rev. Lett. 118, 133202 (2017). [31] J. Mautner, A. Makmal, D. Manzano, M. Tiersch, and H. J. Briegel, New Generation Computing 33, 69 (2015). [32] A. A. Melnikov, A. Makmal, and H. J. Briegel, “Projective simulation applied to the grid-world and the mountain-car problem,” (2014), arXiv:1405.5459. [33] A. Makmal, A. A. Melnikov, V. Dunjko, and H. J. Briegel, IEEE Access 4, 2110 (2016). [34] S. Hangl, E. Ugur, S. Szedmak, and J. Piater, in Proceedings 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (IEEE, 2016) p. 2799. [35] M. Tiersch, E. J. Ganahl, and H. J. Briegel, Sci. Rep. 5, 12874 (2015). [36] A. A. Melnikov, H. Poulsen Nautrup, M. Krenn, V. Dunjko, M. Tiersch, A. Zeilinger, and H. J. Briegel, “Active learning machine learns to create new quantum experiments,” (2017), arXiv: 1706.00868. [37] M. Szegedy, in 45th Annual IEEE Symposium on Foundations of Computer Science (IEEE, 2004). [38] F. Magniez, A. Nayak, J. Roland, and M. Santha, SIAM Journal on Computing 40, 142 (2011). [39] N. Friis, V. Dunjko, W. Dür, and H. J. Briegel, Phys. Rev. A 89, 030303 (2014). [40] N. Friis, A. A. Melnikov, G. Kirchmair, and H. J. Briegel, Sci. Rep. 5, 18036 (2015). [41] N. V. Vitanov, T. F. Gloger, P. Kaufmann, D. Kaufmann, T. Collath, M. Tanveer Baig, M. Johanning, and C. Wunderlich, Phys. Rev. A 91, 033406 (2015). METHODS Theoretical Framework of RPS A generic picture for modeling autonomous learning scenarios is that of repeated rounds of interaction between an agent and its environment. In each round the agent receives perceptual input (“percepts”) from the environment, processes the input using an internal deliberation mechanism, and finally acts upon (or reacts to) the environment, i.e., performs an “action”[13]. Depending on the reward system in place and the given percept, such actions may be rewarded or not, which leads the agent to update its deliberation process, the agent learns. Within the projective simulation (PS)[13] paradigm for learning agents, the decision-making procedure is cast as a (physically motivated) stochastic diffusion process within an episodic compositional memory (ECM), i.e., a (classical or quantum) random walk in a representation of the agent’s memory containing the interaction history. One may think of the ECM as a network of clips that can correspond to remembered percepts, remembered actions, or combinations thereof. Mathematically, this clip network is described by a stochastic matrix (defining a Markov P chain) P = (pij ), where the pij with 0 ≤ pij ≤ 1 and i pij = 1 represent transition probabilities between 7 the clips labeled i and j with i, j ∈ {1, 2, . . . , N }. The learning process is implemented through an update of the N × N matrix P , which, in turn, serves as a basis for the random walks in the clip network. Different types of PS agents vary in their deliberation mechanisms, update rules, and other specifications. In particular, one may distinguish between PS agents based on “hitting” and “mixing”. For the former type of PS agent, a random walk could, for instance, start from a clip c1 called by the initially received percept. The first “step” of the random walk then corresponds to a transition to clips cj with probabilities p1j . The agent then samples from the resulting distribution {p1j }j . If such a sample provides an action, e.g., if the clip ck is “hit”, this action is selected as output, otherwise the walk continues on from the clip ck . An advanced variant of the PS model based on “mixing” is reflecting projective simulation (RPS)[15]. There, the Markov chain is first “mixed”, i.e., an appropriate number2 of steps are applied until the stationary distribution is attained (approximately), before a sample is taken. This, or other implementations of random walks in the clip network provide the basis for the PS framework for learning. The classical PS framework can be used to solve standard textbook problems in reinforcement learning[31–33], and has recently been applied in advanced robotics[34], adaptive quantum computation[35], as well as in the machine-generated design of quantum experiments[36]. Here, we focus on RPS agents, where the deliberation process based on mixing allows for a speed-up of Q-RPS agents w.r.t. to their classical counterparts[15]. In contrast to basic hitting-based PS agents, the clip network of RPS agents is structured into several sub-networks, one for each percept clip, and each with its own stochastic matrix P . In addition to being stochastic, these matrices specify Markov chains which are ergodic[15], which ensures that the Markov chain in question has a unique stationary distribution, i.e., a unique eigenvector α with α = α . Starting from any initial state, eigenvalue +1, Pα continued application of P (or its equivalent in the quantized version) mixes the Markov chain, leaving the system in the stationary state. As part of their deliberation process, RPS agents generate stationary distributions over their clip space, as specified by P , which is updated as the agent learns. These distributions have support over the whole subnetwork clip space, and additional specifiers – flags – are used to ensure an output from a desired sub-set of clips. For instance, standard agents are presumed to output actions only, in which case only the actions are “flagged”3 . This ensures that an action will be output, while maintaining the relative probabilities of the actions. 2 3 The mixing time depends on the spectral gap δ of the Markov chain P , i.e., the difference between the two largest eigenvalues of P [15]. Such flags are rudimentary emoticons defined in[13] The same mechanism of flags, which can be thought of as short-term memory, is also used to eliminate iterated attempts of actions which did not yield rewards in recent time-steps. This leads to a more efficient exploration of correct behavior. In the quantum version of RPS, each clip ci is represented by a basis vector |ii in a Hilbert space H. The mixing process is then realized by a diffusion process on two copies of the original Hilbert space. On the doubled space H⊗H a unitary operator W (P ) (called the Szegedy walk operator[37, 38]) and a quantum state |α0 i with W (P ) |α0 i = |α0 i take the roles of the classical objects P and α . Both W (P ) and |α0 i depend P √on a set of unitaries Ui on H that act as Ui |0i = j pij |ji for some P √ reference state |0i ∈ H, i.e., |α0 i = i ai |ii ⊗ Ui |0i. The more intricate construction of W (P ) is given in detail in[26]. The feature of the quantum implementation of RPS that is crucial for us here is an amplitude amplification similar to Grover’s algorithm[3], which incorporates the mixing of the Markov chain and allows √ outputting flagged actions after an average of O(1/ ) calls to W (P ), where  is the probability of sampling an action from the stationary distribution. The algorithm achieving this is structured as follows. After an initialization stage where |α0 i is prepared, a number of diffusion steps are carried out. Each such step consists of two parts. The first part is a reflection over the states corresponding to actions in the first copy of H, i.e., an operation ref A = 2 n X |iihi| ⊗ 1 − 1 ⊗ 1, (10) i=1 where A = span{|1i , . . . , |ni} denotes the subspace of the clip network corresponding to actions. In the second part, an approximate reflection over the state |α0 i, the mixing, is carried out, i.e., an operation designed to 0 0 approximate ref √ α0 = 2 |α ihα | − 1[15]. This second step involves O(1/ δ) calls to W √(P ). The two-part diffusion steps are repeated O(1/ ) times before a sample is taken from the resulting state by measuring in the basis {|ii}i=1,...,N . If an action is sampled, the algorithm concludes and that action is chosen as output. Otherwise, all steps are repeated. Since the algorithm amplifies the probability of sampling an action (almost) to unity, carrying out the deliberation procedure with the help of √ such a Szegedy walk hence requires an average of O(1/ δ) calls to W (P ). In comparison, a classical RPS agent would require an average of O(1/δ) applications of P to mix the Markov chain, and an average of O(1/) samples to find an action. Q-RPS agents can hence achieve a quadratic speed-up in their reaction time. Here, it should be noted that, its elegance not withstanding, the construction of the approximate reflection for general RPS networks is extremely demanding for current quantum computational architectures. Most notably, this is due to the requirement of two copies of H, on which frequently updated coherent conditional operations need to be carried out[26, 39, 40]. However, 8 as we shall explain now, these requirements can be circumvented for the interesting class of rank-one Markov chains. In this special case, the entire Markov chain P can be represented on one copy of H by a single unitary UP = Ui ∀i, since all columns of P are identical. Conceptually, this simplification corresponds to a situation where each percept-specific clip network contains only actions and the Markov chain is mixed in one step (δ = 1). In such a case one uses flags to mark desired actions. Interestingly, these minor alterations also allow to establish a one-to-one correspondence with the hittingbased basic PS using two-layered networks, which has been applied in classical task environments[31–36]. Let us now discuss how the algorithm above is modified for the rank-one case with the flagging mechanism in place. First, we restrict A to be the subspace of the flagged actions only, assuming that there are n  N of these, and we denote the corresponding probabilities within the stationary distribution by an . In P a1 , . . . , √ the initialization stage, the state |αi = i=1,...,N ai |ii is prepared. Then, an optimal number of k diffusion steps[3] is carried out, where Experimental Details We discuss some details of the experimental implementation. The detailed pulse sequence for the reported experiments is shown in Fig. 5. Radio frequency (RF) pulses tuned to the respective qubit resonance frequencies near 12.6 GHz are applied for all coherent manipulations. The RF power is carefully adjusted for each ion in order to achieve an equal Rabi frequency of 20.92(3) kHz. For each single-qubit rotation, Rj (θ, φ) during the preparation and diffusion steps, θ1 and θ2 represent the rotation angle according to Eq. (3 - 5) (main text). We reπ place Rz ( π2 ) by R( π2 , π2 )R( π2 , 0)R( π2 , 3π 2 ) and Rz (− 2 ) by π π π π 3π R( 2 , 2 )R( 2 , π)R( 2 , 2 ). During the conditional evolution time, a set of ten UR14 RF π-pulses (equaling a total of 140 pulses) is applied[30] to protect the qubits from decoherence by dynamical decoupling (DD). Each set is comprised of 14 error correcting pulses (Fig. 5) with appropriately chosen phase φ:  0, k = round  π √ 4  − 1 2  , (11) P and  = i=1,...,n ai is the probability to sample a flagged action from the stationary distribution. Within the diffusion steps, the reflections over all actions of Eq. (10) are replaced by reflections over flagged actions, i.e., ref A = 2 n X |iihi| − 1. (12) i=1 In the rank-one case, the reflections over the stationary distribution α becomes an exact reflection ref α over the state |αi and can be carried out on one copy of H[26]. After the diffusion steps, a sample is taken and the agent checks if the obtained action is marked with a flag. If this is the case, the action is chosen as output, otherwise the algorithm starts anew. While a classical RPS agents requires an average of O(1/) samples until obtaining a flagged action, this √ number reduces to O(1/ ) for Q-RPS agents. This quantum advantage is particularly pronounced when the overall number of actions is very large compared to n and the environment is unfamiliar to the agent or has recently changed its rewarding pattern, in which case  may be very small. Given some time, both agents learn to associate rewarded actions with a given percept, suitably add or remove flags, and adapt P (and by extension α ). In the short run, however, classical agents may be slow to respond and the advantage of a Q-RPS agent becomes apparent. Despite the remarkable simplification of the algorithm for the rank-one case with flags, the quadratic speed-up is hence preserved.  6π 4π 8π 4π 6π 6π 4π 8π 4π 6π , , , , , 0, 0, , , , , ,0 . 7 7 7 7 7 7 7 7 7 7 Since the phases of the π-pulses are symmetrically arranged in time, only the first seven pulses are shown in Fig. 5. The last pulse is also shown to visualize the spacing of these pulses with respect to the start and end of evolution time, compared to the intermediate pulses. The maximum interaction time of 30 ms required to realize the deliberation algorithm (corresponding to 7 diffusion steps) presented in the main text is 60 times longer than the qubit coherence time. Such a long coherent interaction time is accomplished by the DD pulses applied to each qubit simultaneously. Laser light near 369 nm is applied to the ions for cooling, state preparation, and state selective read-out as described in the main text. The durations are: 30 ms for Doppler cooling, 100 ms for sideband cooling on the center-of-mass mode, 100 ms for sideband cooling on the stretch mode, 0.25 ms for initialization in state |0i of the ions, and 2 ms for detection. Projective measurements on both qubits are performed to determine the states |00i, |01i, |10i, and |11i. Two thresholds are used to distinguish between dark and bright states of the ions, thus discarding 10% of all measurements as ambiguous events with a photon count that lies in the region of two partially overlapping Poissonian distributions representing the dark and bright states of the ions[29, 41]. SUPPLEMENTARY MATERIALS In this section, we discuss deviations of the experimental data from idealized theory predictions. In particular, for the chosen values of  and the corresponding 9 FIG. 5. Experimental sequence for Q-RPS. RF1 and RF2 each indicate a time axis for a qubit. The qubits are prepared in the desired input states using single-qubit rotations implemented by applying RF pulses. For each RF pulse, the two parameters within the parentheses represent the specific rotation angle and phase according to Eq. (3 - 5) in the main text. Also, dynamical decoupling (DD) during conditional evolution, (Uzz (π/2)) (indicated by a green box) is implemented using RF pulses (indicated in yellow). Ten sets of 14 pulses each (UR14) are applied[30] during the evolution time τ = 4.24 ms with a J-coupling between the two ions of 2π × 59 Hz. The diffusion step is repeated k times according to Eq. (11) in Methods. Laser light near 369 nm is used for cooling and to initialize the ions in the qubit state |0i ≡ |2 S1/2 , F = 0 i. At the end of the coherent manipulation, laser light is used again for state selective detection and also for Doppler cooling. optimal k(), it is expected that the probability of obtaining a flagged action is close to 100%. However, the success probability in our experiment lies between 66% (for k = 7) and 88% (for k = 1). In what follows, we discuss several reasons for this. for k = 6, the ideal success probability is larger than 98% independently of the exact value of . Throughout this π paper, we have chosen  in such a way, that ( 4√ − 12 )  is always close to an integer (see Tab. I), such that the deviation from a 100% success probability due to the theoretically chosen  is negligible compared to other error sources. Scaling error However, in a real experiment, the initial state, and therefore , can only be prepared with a certain accuracy. This can lead to an inaccurate estimation of the optimal number of diffusion steps. As opposed to the ideal case, an assumed accuracy of  ± 1% for the preparation only has a small effect on the success probability ˜ (drop of less than 5%) for   0.01, corresponding to k ≤ 3. However, when ε does not fulfil the aforementioned condition and approaches ≈ 0.01 from above, corresponding to k = 6, then the success probability drops down to ˜ = 70% due to a non-optimal choice of k. Even in an ideal scenario without noise or experimental imperfections the success probability ε̃, as defined in Eq.(4) of the main text, after k diffusion steps is usually not equal to unity, and depends on the specific value of . This behavior originates from the step-wise increase of π − 12 ) in the the number of diffusion steps k = round( 4√  algorithm. The success probability is hence only 100% if k is an integer without rounding. The change of the ideal success probability with deviations of  from such specific values is largest for small numbers of diffusion steps (e.g., k = 1) and can drop down to 82% (neglecting the cases where it is not advantageous to use a quantum algorithm at all). For larger numbers of diffusion steps, the exact value of  does not play an important role any more for the ideal success probability provided that the correct number of diffusion steps is chosen. For example, The preparation accuracy depends on the detuning ∆ω of the RF pulses for single-qubit rotations as well as on the uncertainty ∆Ω in the determination of the Rabi frequency Ω. The calibration of our experiment revealed ∆ω/Ω < 0.05 and ∆Ω/Ω = 0.0015 leading to an error in  of ±2.5·10−3 and a decrease of the success probability ˜ of less than 0.04. The detuning ∆ω and the uncertainty 10 TABLE I. Experimentally realized success probabilities. Initial theoretical probabilities, , of finding a flagged action within the stationary distribution for various diffusion steps are shown. Success probabilities (˜ ), that are theoretically calculated and experimentally measured, for diffusion steps k = 1-7 are also shown. Theory Theory a00 a01  b00 b01 ˜ k 1 0.1371 0.1371 0.2742 0.4966 0.4966 0.9932 0.0493 0.0493 0.0987 0.4996 0.4996 0.9993 2 3 0.0252 0.0252 0.0504 0.4999 0.4999 0.9998 4 0.0152 0.0152 0.0305 0.5000 0.5000 1.0000 0.0102 0.0102 0.0204 0.5000 0.5000 1.0000 5 6 0.0073 0.0073 0.0146 0.5000 0.5000 1.0000 0.0055 0.0055 0.0110 0.5000 0.5000 1.0000 7 Experiment k b00 b01 ˜ 1 0.449(15) 0.440(15) 0.89(2) 2 0.347(15) 0.353(15) 0.70(2) 0.438(16) 0.334(15) 0.77(2) 3 4 0.422(15) 0.336(15) 0.76(2) 5 0.407(17) 0.331(16) 0.74(2) 0.431(17) 0.324(16) 0.76(2) 6 7 0.365(15) 0.299(14) 0.66(2) 25 20 15 10 5 0 0 0.05 0.1 0.15 0.2 0.25 0.3 FIG. 6. Detuning errors. The influence of the detuning of the RF pulses on the fidelity of the Q-RPS algorithm is shown for three different values of the relative detuning ∆ω/Ω. Black lines indicate the results of numerical simulations of the complete Q-RPS algorithm taking different values of the relative detuning ∆ω/Ω into account. Most of the experimental data (red circles) lie close to the ∆ω/Ω = 0.03 line. of the Rabi frequency ∆Ω not only influence the state preparation at the beginning of the quantum algorithm, but also its fidelity, as is detailed in the next paragraph. To prevent decoherence during conditional evolution, we use 140 MW π-pulses per diffusion step and ion. Therefore, already a small detuning influences the fidelity of the algorithm. Consequently, the error induced by de- tuning is identified as the main error source leading, for example, to ε̃ ≈ 0.70 for k = 6 and ∆ω/Ω = 0.03. This error is much larger than the error caused by dephasing (that is still present after DD is applied), or the detection error. To estimate the error by dephasing, we assume an exponential decay with γτ ≈ 1/14 for a single diffusion step of duration τ ≈ 4 ms which would lead to ε̃ ≈ 0.90 for k = 6. Here, γ indicates the experimentally diagnosed rate of dephasing, and τ is the time of coherent evolution. The influence of the detuning on the cost of our algorithm is shown in Fig. 6 for different detunings. Here, we simulated the complete quantum algorithm including the experimentally determined dephasing and detection errors for ∆ω/Ω ∈ {0.01, 0.03, 0.05}. The experimental data is consistent with an average relative detuning of ∆ω/Ω = 0.03. Note that the detuning not only influences the single-qubit rotations that are an integral part of the quantum algorithm, but also leads to errors during the conditional evolution when dynamical decoupling pulses are applied. Ratio error In the ideal algorithm, the output ratio rf = b00 /b01 of the two flagged actions represented by the states |00i and |01i at the end of the algorithm equals the input ratio ri . However, in the experiment we have observed deviations from rf /ri = 1. During the measurements for the investigation of the scaling behavior (Fig. 3 in the main text), we fixed ri = 1. The observed output ratios are varying by 0.98 ≤ rf /ri ≤ 1.33. That is, the probability b00 to obtain the state |00i is increased w.r.t. b01 . Also during the measurement testing the output ratio, we observe that the output ratios are larger than the input ratios. 11 TABLE II. Input and output distributions. Input and output ratios, ri and rf respectively, of the two flagged actions represented by the states |00i and |01i for diffusion steps k = 1 and k = 3 are shown. Theory Experiment k a00 a01 ri b00 b01 rf 1 0.00271 0.27144 0.01 0.061(7) 0.809(12) 0.075(9) 1 0.07257 0.20159 0.36 0.290(14) 0.583(15) 0.50(3) 1 0.11383 0.16032 0.71 0.415(15) 0.466(15) 0.89(4) 1 0.14107 0.13309 1.06 0.488(15) 0.389(15) 1.25(6) 1 0.16040 0.11376 1.41 0.519(13) 0.351(12) 1.48(6) 0.17482 0.09933 1.76 0.566(15) 0.305(14) 1.85(10) 1 1 0.13708 0.13708 1.00 0.468(16) 0.401(16) 1.17(6) 3 0.00458 0.04578 0.10 0.127(10) 0.718(14) 0.176(14) 3 0.01633 0.03402 0.48 0.301(15) 0.518(16) 0.58(3) 3 0.02328 0.02707 0.86 0.442(16) 0.451(16) 0.98(5) 0.02788 0.02248 1.24 0.510(16) 0.354(15) 1.44(8) 3 3 0.03114 0.01922 1.62 0.551(16) 0.305(14) 1.81(10) 0.03357 0.01679 2.00 0.586(15) 0.268(13) 2.19(12) 3 An asymmetric detection error could be the cause for this observation. Typical errors in our experiment are given by the probability to detect a bright ion (|1i) with a probability of dB = 0.06 as dark, and a dark ion (|0i) with a probability of dD = 0.02 as bright. In Fig. 7 we compare the measured output ratios with the calculated output ratios assuming the above mentioned detection errors only. 2 1.5 1 0.5 0 0 0.5 1 1.5 2 FIG. 7. Ratio errors. The measured values (red and blue circles) of the input and output ratios are compared to a simulation (solid black line) of the Q-RPS algorithm taking into account the experimentally determined detection error. The solid line corresponds to an output ratio expected taking into account an unbalanced detection error where dB = 0.06 for bright ions and dD = 0.02 for dark ions. Fig. 7 shows that the experimental data, both for one step and for three steps, are well approximated by the simulation when the experimentally determined detection error is taken into account. Thus, the deviation of the measured ratios from the ideal result can be traced back mainly to the unbalanced detection error. In addition, also errors in the preparation of the input states play a role, especially when preparing very large or very small ratios leading to either a00 or a01 being close the the preparation accuracy of ≤ 2.5 · 10−3 . At the same time, the detuning plays a less prominent role in these measurements because fewer dynamical decoupling pulses where required due to the small number of diffusion steps. Moreover, the detuning during these measurements could be kept below ∆ω/Ω = 0.03 leading to an average success probability of ˜ = 0.85% also for k = 3 diffusion steps compared to ˜ = 0.77% for k = 3 during the measurements investigating the scaling (see Tab. I).
2cs.AI
Symmetric groups and checker triangulated surfaces arXiv:1710.11565v1 [math.RT] 31 Oct 2017 Yury A. Neretin1 We consider triangulations of surfaces with edges painted three colors so that edges of each triangle have different colors. Such structures arise as Belyi data (or Grothendieck dessins d’enfant), on the other hand they enumerate pairs of permutations determined up to a common conjugation. The topic of these notes is links of such combinatorial structures with infinite symmetric groups and their representations. 1. 2. 3. 4. 5. 6. 7. 1 Checker triangulations and Belyi data. Correspondence with symmetric groups. Category of checker cobordisms. The infinite tri-symmetric group. Spherical functions. Convolution algebras and their limits. A pre-limit convolution algebra. Checker triangulations and Belyi data 1.1. Checker triangulations. Consider an oriented compact closed twodimensional surface P (we do not require that a surface be connected). Consider a finite graph γ on P separating P into triangles. Let edges of the graph be colored blue, red, or yellow and let each triangle have edges of all 3 types. We say that a triangle is white if the order of blue, red, yellow edges is clockwise and black in the opposite case, see Fig. 1. We call such structures (P, γ) checker surfaces. Two checker surfaces (P, γ) and (P, γ ′ ) are equivalent if there is an orientation preserving homeomorphism P → P ′ identifying colored graphs γ and γ ′ . Therefore checker surfaces are purely combinatorial objects, we also can regard them as simplicial cell complexes with colorings of triangles and edges. We denote the set of all checker surfaces having 2n triangles by Ξn , Example. Consider a sphere with a cycle composed of blue, red, and yellow edges, see Fig. 2a. We call such checker surface a double triangle. Remarks. a) Under our conditions orders of all vertices are even. Edges adjacent to a given vertex have two colors, and these colors are interlacing, see Fig. 1. Therefore we can split vertices into 3 classes, blue, red, yellow: we say that a vertex is blue, if opposite edges are blue, etc. (colors of vertices are not shown on Fig. 1). b) An intersection of two white (or two black) triangles is the empty set or a vertex. An intersection of a black and a white triangles can be the empty 1 Supported by the grant FWF, P28421. 1 Figure 1: A piece of a checker surface. We draw full lines, dashed-lines, dottedlines instead of colors a) b) c) Figure 2: a) A double triangle. b) A double triangle drawn as a sphere. c) This position of two triangles is admissible. set, a vertex, an edge, two edges, three edges, see Fig. 2c, 2a. We avoid a term triangulation since the most common definition of triangulations forbids the last two possibilities. Formally, our objects satisfy a definition of a simplicial cell complex, see, e.g., [12]. ⊠ c) We admit empty surfaces. Remark. Apparently, such colored structures firstly appeared in combinatorial topology in [34], see also [5], [6]. ⊠ 1.2. Dessins d’enfant. There is the following equivalent language for description of the same objects. We can remove red and yellow edges and blue vertices. After this we get a graph with blue edges on the surface, vertices are painted red and yellow, and colors of the ends of each edge are different. Therefore we get a bipartite graph on the surface, a coloring of vertices is determined by the graph modulo a reversion of colors of all vertices. Such a graph separates the surface into polygonal domains. To reconstruct a checker structure, we put a point to interior of each domain, connect it by non-intersecting arcs with vertices of the polygon, and paint these arcs in a unique admissible way, see Fig. 3. b the Riemann sphere, by Q the algebraic 1.3. Belyi data. Denote by C closure of Q, by Gal(Q/Q) the Galois group of Q over Q. Recall the famous Belyi theorem [1], [2], see expositions in [17], [8]. Theorem 1.1 Let P be a nonsingular complex algebraic (projective) curve. A covering holomorphic map π : P → C whose critical values are contained in the 2 Figure 3: A reconstruction of checker structure from a dessin d’enfant. set {0, 1, ∞} exists if and only if P is defined over Q. For a curve defined over Q a map π can be chosen defined over Q. Words a a curve P is defined over Q mean that P can be determined by a system of algebraic equations in a complex projective space CPN with coefficients in Q. Such functions are called Belyi functions, a pair (P, π) is called Belyi data. The Galois group Gal(Q/Q) acts on Belyi data changing coefficients of equations determining curves. 1.4. Correspondence between Belyi data and checker surfaces. The b into two half-planes. Let us paint the segment [∞, 0] blue, real line R splits C b the segment [0, 1] red, and the segment [1, ∞] yellow. The upper half-plane of C becomes white and the low half-plane becomes black. Thus we get a structure b see Fig. 2b. of a double triangle on C, b we take the preimage of R. It is a colored graph For a Belyi map P → C on R splitting P into white and black triangles. Thus we get a structure of a checker surface on P . Conversely, let us for a checker surface (P, γ) define a complex structure b Consider an equilateral triangle on P and a holomorphic function P → C. white T whose sides are colored blue, red, yellow clockwise and an equilateral triangle T black whose sides are colored blue, red, yellow anti-clockwise. We b sending vertices to identify T white conformally with the white half-plane of C 0, 1, ∞ and edges to segments [−∞, 0], [0, 1], [1, ∞] according colors (such a map exists and is unique). We also identify T black with the black half-plane in a similar way. We can think that a surface (P, γ) is glued from copies of T white and T black . This defines a complex structure on P outside vertices. If we have 2k triangles adjacent to a vertex v, then a punctured neighborhood of v has a structure of k-covering of a punctured circle Ḋ : 0 < |z| < ε. This covering is itself holomorphically equivalent to Ḋ, and this gives us a chart on P in a neighborhood of v. Thus we get a complex structure on P . b sending white triangles to the white halfNext, we take a map from P to C plane and black triangles to the black half-plane. By the Riemann–Schwarz 3 1 2 3 4 1 2 3 4 ... ... Figure 4: The collection of triangles Tjwhite , Tjblack. reflection principle the map is holomorphic at interior points of edges. By the theorem on removable singularities the map is also holomorphic at vertices. Thus we get Belyi data. It is known, that combinatorial data determine a Belyi map up to a natural equivalence (upto an automorphism of P ). Notice, that in our case P can be disconnected, so we have Belyi functions on all components of the curve. In particular the group Gal(Q/Q) acts on the space of checker surfaces. In 1984 Grothendieck [10] initiated a program of investigation of Gal(Q/Q) based on dessins d’enfant, see e.g., [35], [36], [39], [17], [8], [37], [38]. 2 Correspondence with symmetric groups 2.1. The basic construction. Consider the product Gn = Sn × Sn × Sn of 3 copies of the symmetric group Sn . An element of this group is a triple of permutations, we denote such triples as  (2.1) p = pblue , pred , pyellow . Denote by Kn the diagonal subgroup in Gn , it consists of triples of the form h = (h, h, h). (2.2) Take a triangle T white , paint its sides blue, red, yellow clockwise. Consider n copies of the triangle T white , paint them white and attribute to the triangles labels 1, 2, . . . , n. Thus we get triangles T1white , . . . , Tnwhite . Consider another triangle T black obtained from T white by a reflection. Its sides are colored blue, red, yellow anti-clockwise. Take n copies of this triangle T1black, . . . , Tnblack , see Fig. 4. Fix an element p ∈ Gn , For each j = 1,. . . , n we glue the triangle Tjwhite with the triangle Tpblack Repeat the blue j along blue sides according orientations. same operation for pred and pyellow . We get a two-dimensional surface equipped with a checker structure. We also have an additional structure, namely we have a bijective map (labeling) from the set {1, . . . , n} to the set of white triangles and the bijective map from the same set to the set of black triangles. 4 We call the object P obtained in this way a completely labeled checker surface. e n the set of all such surfaces. Denote by Ξ en → 2.2. The inverse construction. Let us describe the inverse map Ξ Gn . Consider a completely labeled surface P. Take a blue edge v. Let iv be the label on the white side of v, and jv the label on the black side. Then we set pblue : iv 7→ jv . and get pblue . In the same way we reconstruct pred and pyellow . 2.3. Remarks. a) Thus for any element of Gn we get a surface with 2n triangles and 3n edges. b) Blue vertices of P are in one-to-one correspondence with independent cycles of the permutation (pyellow )−1 pred . The order of a vertex is the duplicated length of a cycle. A similar statement holds for red and yellow vertices. c) Take the subgroup Up ⊂ Sn generated by (pyellow )−1 pblue and (pyellow )−1 pred . Components Pj of P are in one-to-one correspondence with orbits Oj of Up on {1, . . . , n}. A given orbit splits into independent cycles of (pyellow )−1 pred , this gives us an enumeration of blue vertices of the component. So we have an expression for the Euler characteristic of a component in group-theoretical terms:  number of cycles of + χ(Pj ) = −#(Oj ) + (pyellow )−1 pblue on Oj     number of cycles of number of cycles of . + + (g red )−1 g blue on Oj of (pyellow )−1 pred on Oj  d) The pass p 7→ p−1 is a reversion of colors of triangles black⇆white and a reversion of orientations of all components. e) For any element h ∈ Kn the corresponding surface is a disjoint union of double triangles. 2.4. Concatenations. Now let us describe the product in the group Gn on the geometric language. e n . For each Let p, q ∈ Gn . Consider the corresponding elements P, Q ∈ Ξ j = 1, 2, . . . , n we identify j-th black triangles of Q and j-th white triangle of P according colors of edges. In this way we get a 2-dimensional simplicial cell complex R◦◦ having 3n two-dimensional cells, namely: — n labeled images of white triangles of Q; — n labeled images of black triangles of P; — n (labeled) triangles that are results of gluing (let us call such cells grey). Each edge has a color (blue, red, or yellow) and is contained in 3 triangles (white, black, and grey). Next, we remove interiors of all grey triangles from the simplicial cell complex R◦◦ (and forget their labels). We get a complex R◦ having n white triangles and n black triangles. These cells inherit labelings. Moreover, each edge is contained in precisely two triangles. 5 Figure 5: A normalization. In fact, we get a surface, but some vertices of the surface are glued one with another, see Fig. 5.a. Cutting such gluings2 we get a surface R corresponding to the product r = pq ∈ Gn . Remark. Of course we can transpose an order of the gluing and the making holes. Namely, let P and Q be completely labeled checker surfaces. We remove interiors of black triangles from P and interiors of white triangles from Q and get new cell complexes P and Q . For each j 6 n we identify the boundary of former j-th black triangle of Q and the boundary of former j-th white triangle of P according colors of edges. We get a two-dimensional cell complex and normalize it as above. ⊠ 2.5. Notation. Conjugacy classes and double cosets. Let H be a group, L, M ⊂ H subgroups. We denote by L \ H/M the space of double cosets of H with respect to L, M , i.e., the quotient of H with respect to the equivalence h ∼ lhm, where l ∈ L, m ∈ M . An element of this space is a subset in H of the form L · h · M . Denote by H//L the space of conjugacy classes of a group H with respect to a subgroup L, i.e., the quotient of H with respect to the equivalence h ∼ l−1 hl, where l ∈ L. Remark. Conjugacy classes can be regarded as a special case of double cosets for the following reason. Consider the group H × L and the embedding ι : L → H × L given by ι(l) = (l, l). Obviously, H//L ≃ ι(L) \ (H × L)/ι(L). 2.6. Relabeling. Let us multiply an element p ∈ Gn by an element h ∈ Kn , see (2.1) and (2.2). Clearly the operation p 7→ hp is equivalent to a permutation 2 Let us describe this cutting (a normalization) formally (this is a special case of procedure of normalization of pseudomanifolds from [9]). Let us equip the space R◦ by some natural metric (for instance we assume that all triangles are equilateral triangles with side 1, this determines a ’geodesic’ distance on the whole complex. Let us remove all vertices, consider the geodesic distance on this space, and complete our space with respect to the new distance. 6 of labels on black triangles of the corresponding surface. A right multiplication p 7→ ph−1 is equivalent to a permutation of labels on white triangles. Consider the space of double cosets of Kn \ Gn /Kn of Gn with respect to e n up to a permutation of labels. Kn . This means that we consider elements of Ξ In other words, we forget labels. Thus we get a bijection Kn \ Gn /Kn ←→ Ξn . This also gives a geometrical description of pairs of permutations determined up to a common conjugation, i.e., upto the equivalence (g1 , g2 ) ∼ (h−1 g1 h, h−1 g2 h). Indeed, we have the space of conjugacy classes of Sn × Sn with respect to the diagonal subgroup diag(Sn ). According the remark in previous subsection, (Sn × Sn )//diag(Sn ) ≃ diag(Sn ) \ (Sn × Sn × Sn )/diag(Sn ) = Kn \ Gn /Kn . 3 Category of checker cobordisms 3.1. Infinite symmetric group. Denote by S∞ the group of finitely supported permutations of N, by S ∞ the group of all permutations. The group S∞ is a countable discrete group, the group S ∞ has cardinality continuum and is equipped with a natural topology discussed in the next section. As usual, we can represent elements of these groups by 0-1-matrices having precisely one 1 in each column and each row. Consider the group G := S∞ × S∞ × S∞ and its diagonal K ≃ S∞ . We repeat the construction of the previous section for n = ∞. For any g ∈ G we get a countable disjoint union of compact checker surfaces, all but a finite number of components are double triangles, moreover for all but a finite number of components labels on the black and white sides of a double triangles coincide. As above, we get a correspondence between the group and the set of completely labeled checker surfaces. 3.2. Multiplication of double cosets. Denote by Z+ the set of nonnegative integers. For α ∈ Z+ denote by K[α] ⊂ K the subgroup in K = S∞ consisting of permutations fixing points 1, . . . , α ∈ N; for α = 0 we set K[0] := K. The subgroups K[α] are isomorphic to S∞ . Consider double cosets spaces M(α, β) := K[α] \ G/K[β]. It turns out to be that for any α, β, γ ∈ Z+ there is a natural multiplication M(α, β) × M(β, γ) → M(α, γ) 7 defined in the following way. Consider  1β 0  θj [β] :=  0 0 a sequence θj [β] in S∞ given by  0 0 0 0 1j 0  . 1j 0 0  0 0 1∞ By Θj [β] denote the corresponding element of K:  Θj [β] = θj [β], θj [β], θj [β] ∈ K[β]. Let p ∈ M(α, β), q ∈ M(β, γ). Choose their representatives p ∈ p, q ∈ q. The following statements are semi-obvious if to look to them for a sufficiently long time (see formal proofs in [7]). Lemma 3.1 The following sequence of double cosets K[α] · p · Θj [β] · q · K[γ] ∈ M(α, γ) (3.1) is eventually constant. Its limit3 does not depend on a choice of representatives p ∈ p, q ∈ q. Denote by p ⊛ q the limit of the sequence (3.1). The multiplication ⊛ is associative in the following sense: Lemma 3.2 For any α, β, γ, δ ∈ Z+ and any p ∈ M(α, β), q ∈ M(β, γ), r ∈ M(γ, δ), we have (p ⊛ q) ⊛ r = p ⊛ (q ⊛ r). Thus we can define the following category K. The set of its objects is Z+ and the set of morphisms from β to α is M(α, β). This operation is a representative of huge zoo of train constructions for infinite dimensional groups, see end of the present section. The main property of ⊛-multiplication is Theorem 3.3 below. 3.3. The involution on K. The map p 7→ p−1 induces maps M(α, β) → M(β, α), we denote these maps by p 7→ p∗ . Obviously, ∗ satisfies the usual properties of involutions (p ⊛ q)∗ = q∗ ⊛ p∗ , p∗∗ = p. 3.4. Explicit description of the product of double cosets. We say that a labeled checker surface is the following collection of combinatorial data: 3 I.e., a stable value. However, M(α, γ) is a quotient of a discrete topological space, so it has a discrete topology, and we have a limit in the sense of the formal definition of a limit. 8 — a finite disjoint union P of checker surfaces; — an injective map from the set {1, . . . , α} to the set of black triangles of P and an injective map from the set {1, . . . , β} to the set of white triangles (we call these maps by labelings). — additionally, we require that any double-triangle component of P keeps at least one label. e β] the set of such objects. Denote by Ξ[α, Clearly, there is a canonical one-to-one correspondence e β]. M(α, β) ←→ Ξ[α, Namely, we take a representative of a double coset p and draw the corresponding completely labeled checker surface. A pass to the double coset means forgetting white labels with numbers > β and black labels > α. Finally, we remove all double triangles without labels and get a finite object4 . The product of double cosets corresponds to the concatenation (as in Subsect. 2.4). Namely, let P, Q be labeled checker surfaces corresponding to p and q. For each j = 1, . . . , β we remove interiors of labeled black triangles of Q and labeled white triangles of P (so we get β ’holes’ on each surface). For each j 6 β we identify boundary of the former black triangle of Q and the former white triangle of P according colors of edges. We get a new 2-dimensional simplicial cell complex and normalize it as above. This surface inherits α labels on white triangles and γ labels on black triangles. Finally, we remove label-less double triangles. Thus we get an operation similar to a concatenation of cobordisms, we glue cell complexes with additional structure instead of manifolds with boundaries, also our operation includes a normalization. Remark. The operation of normalization does not arise if labeled black triangles of Q (or labeled white triangles of P) have no common vertices. ⊠ e 0] is a disjoint union of label-less checker Remark. The ⊛-product on Ξ[0, surfaces, a P⊛Q=P Q. In particular, this operation is commutative. ⊠ 3.5. Multiplicativity theorem. Let ρ be a unitary representation of the group G = S∞ × S∞ × S∞ in a Hilbert space5 V . For each α ∈ Z+ denote by 4 After the previous operation we have a countable collection of label-less double triangles, which do not keep any information. It is more convenient to remove them. 5 For many classes of groups (as finite groups, compact groups, semisimple Lie groups, nilpotent Lie groups, semisimple p-adic groups) any irreducible representation of G1 × G2 is a tensor product of an irreducible representation ρ1 of G1 and an irreducible representation ρ2 of G2 . In fact, this holds if at least one of groups has type I, see, e.g., [18], §5, §13.1. For the group S∞ this implication does not valid. Also, in the next section we observe that actually we work with a certain completion of the group G and this completion is not a product of groups. 9 V [α] the space of all K[α]-fixed vectors v ∈ V , ρ(h)v = v for all h ∈ K[α]. Remark. Obviously, V [0] ⊂ V [1] ⊂ V [2] ⊂ · · · ⊂ V. In this moment we do not require ∪α V [α] be dense in V . However, below we will observe that this requirement is natural. ⊠ Denote by P [α] the orthogonal projection operator V → V [α]. For α, β ∈ Z+ , and p ∈ G consider the operator ρ(p) : V [β] → V [α] given by ρα,β (p) := P [α]ρ(p) V [β] . In other words, we write ρ(p) as a block operator   R11 R12 : V [β] ⊕ V [β]⊥ → V [α] ⊕ V [α]⊥ ρα,β (p) = R21 R22 and set ρ(p) := R11 . Then ρ(p) depends only on a double coset containing p (this is a standard fact), so actually we get a function ρα,β (p) on M(α, β). Theorem 3.3 The operators ρ·,· (·) determine a representation of the category K of double cosets, i.e., for any α, β, γ ∈ Z+ for any p ∈ M(α, β), q ∈ M(β, γ),  ρα,β (p) ρβ,γ (q) = ρα,γ p ⊛ q . Moreover, this is a ∗-representation of the category K, i.e., ρα,β (p)∗ = ρβ,α (p∗ ). See [23], [27]. Thus any unitary representation ρ of G generates a ∗-representation ρ of the category K. However, generally speaking ρ can not be reconstructed from ρ. In the next section we describe a more perfect version of this correspondence. 3.6. Zoo. Apparently, a first example of a multiplication on double cosets spaces K \ G/K and a multiplicativity theorem was discovered by R. S. Ismagilov [13] for a pair G ⊃ K, where G = SL2 over a non-locally compact non-Archimedean field and K is SL2 over integer elements of the field. Later many cases of multiplication were examined by G. I. Olshanski, see [33]. In particular, he considered the case G = S∞ × S∞ and K = K[α], see 10 [31]; there is a well-developed theory of representations of this group, see [16], [3] and further references in this book. In [19], Sect. VIII.5, it was observed that multiplicativity theorems are a quite general phenomenon, the main obstacle for a further progress was a problem of explicit descriptions of double coset spaces. The construction of this section was obtained in [23]. It has numerous variations with different pairs of groups G ⊃ K related to infinite symmetric groups, see [27], [7] as G = (S∞ )n , K = diag(S∞ ); G = Sn∞ , G = Sn∞ , K = S∞ ⋉ (Zn )∞ ; K = S∞ ⋉ (Sn )∞ ; G = Sn∞ , K = (S∞ )n . For the last case Nessonov (see [29], [27]) obtained a classification of all Kspherical representations of G. On the other hand, there is parallel picture for infinite dimensional real classical groups, [32], [19] (Sect. IX.3), [21], [22]. There is a poorly studied mass construction of the same type for infinite-dimensional groups over p-adic field [26] and an example over finite fields [25]. On the other hand, this story has a counterpart for groups of transformations of measure spaces [19], Chapter X, [24]. 4 The infinite tri-symmetric group Here we describe a natural completion G of G = S∞ × S∞ × S∞ , S∞ × S∞ × S∞ ⊂ G ⊂ S ∞ × S ∞ × S ∞ and discuss representations of this completion. 4.1. Representations of a full symmetric group S ∞ . We say that a sequence gj ∈ S ∞ converges to g if for each k ∈ N we have gj k = gk for sufficiently large j. This determines a structure of a complete separable topological group on S ∞ (and this topology is unique in any reasonable sense, see [15]). Denote by S ∞ [α] ⊂ S ∞ the subgroup consisting of elements fixing points 1, 2, . . . , α ∈ N. These subgroups form a base of neighborhoods of unit in S∞ (and this can be regarded as another definition of topology in S∞ ). A classification of unitary representations of S ∞ was obtained by A. Lieberman [18] (see also expositions in [30], [19], Sect. VIII.1-2), the classification is relatively simple but it is not necessary for us in the sequel6 . Representations of S∞ that can be extended to S ∞ can be described in the following form without explicit reference to the topology. 6 Any irreducible unitary representation of S ∞ has the following form. Fix α ∈ Z+ and an irreducible representation ρ of Sα . Consider a subgroup Sα × S ∞ [α] and its representation that is trivial on S ∞ [α] and equal ρ on Sα . The induced representation of S ∞ is irreducible, and all irreducible representations of S ∞ have this form. Any unitary representation is a direct sum of irreducible representations. A decomposition of a unitary representation into a direct sum of irreducible representations is unique. 11 Proposition 4.1 Let ρ be a unitary representation of S∞ in a Hilbert space V . As above, denote by V [α] the space of S∞ [α]-fixed vectors. a) A representation ρ admits a continuous extension to S ∞ if and only if ∪α V [α] is dense in V . b) An irreducible representation ρ admits a continuous extension to S ∞ if and only if ∪α V [α] is non-zero. 4.2. Tri-symmetric group. Consider the group S ∞ × S ∞ × S ∞ and its diagonal subgroup K ≃ S ∞ . We define the tri-symmetric group G as the subgroup in S ∞ × S ∞ × S ∞ generated by K and G = S∞ × S∞ × S∞ . In other words (pblue , pred , pyellow ) ∈ G pblue (pred )−1 , pred (pyellow )−1 ∈ S∞ . ⇐⇒ The coset space G/K is countable. We define a topology on G assuming that K has the natural topology and the space G/K is discrete. For the group G we repeat the considerations of Subsections 3.2–3.4. In fact, we have7 K[α] \ G/K[β] = K[α] \ G/K[β], therefore we get the same category K of double cosets. For any unitary representation ρ of G we have a ∗-representation of the category K (since a representation of G is also a representation of G). 4.3. The equivalence theorem. See [27], Sect.3. Theorem 4.2 The map ρ 7→ ρ establishes a bijection between the set of unitary representations of G and the set of ∗-representations of the category K. 5 Spherical functions 5.1. Sphericity. Theorem 5.1 The pair G ⊃ K is spherical, i.e., for any irreducible unitary representation of G the space of K-fixed vectors has dimension 6 1. Remark. This is a trivial corollary of multiplicativity Theorem 3.3 and the commutativity of the semigroup K \ G/K. It is worth noting that for the pair Gn = Sn × Sn × Sn , the sphericity does not hold. Kn = diag(Sn ) ⊠ 7 It is worth noting that applying the same construction to an element of S ∞ × S∞ × S∞ we generally get a non-locally finite cell complex, which seems to be pathological. In our case we get a disjoint union of finite complexes and all but a finite number of components are double triangles with coinciding labels on white and black sides. 12 Consider a K-fixed vector v (a spherical vector) for an irreducible representation ρ. Consider the following matrix element (a spherical function) Φ(p) := hρ(p)v, vi. It is easy to see that for any r1 , r2 ∈ K we have Φ(r1 pr2 ) = Φ(p), i.e., Φ actually is a function on the double coset space K \ G/K, i.e., on the space e 0] of checker surfaces. Ξ[0, 5.2. Example. Here we present a construction of a family of representations of G, for more constructions and a discussion of a classification problem, see [27], Sect.3. Consider three Hilbert spaces H blue , H red , H yellow (they can be finite or infinite-dimensional). Consider the tensor product X := H blue ⊗ H red ⊗ H yellow , and fix a unit vector ξ ∈ X. Consider an infinite tensor product8 V := (X, ξ) ⊗ (X, ξ) ⊗ (X, ξ) ⊗ . . . (5.1) Now let the first copy of S∞ acts by permutations of factors9 H blue , the second copy by permutations of H red , and the third by permutations of Y yellow . The subgroup K acts by permutations of factors X. 5.3. An expression for spherical function. Consider a representation ρ of G constructed in the previous subsection. Consider the vector v := ξ ⊗ ξ ⊗ ξ ⊗ · · · ∈ V, it is a unique K-invariant vector in V . We present a formula for the corresponding spherical function10 Φ(p) := hρ(p)v, vi. 8 Let (Yj , υj ) be a sequence of Hilbert spaces with distinguished unit vectors υj ∈ Yj . To define their tensor product W , we consider a system of formal vectors y1 ⊗ y2 ⊗ . . . (decomposable vectors) such that yj = υj starting some place. We assign for such vectors the following inner products Q hy1 ⊗ y2 ⊗ . . . , y1′ ⊗ y2′ ⊗ . . .i = j hyj , yj′ iYj . and assume that linear combinations of such vectors are dense in a Hilbert space W . This uniquely determines a Hilbert space W . See [40], Section 4.1, or Addendum to [11]. 9 We emphasize that a finitely supported permutation of factors H blue send decomposable vectors to decomposable vectors, for a permutation that is not finitely supported an image of a decomposable vector generally makes no sense. 10 Generally speaking, ρ(p) is reducible. However, the cyclic span V ′ ⊂ V of v is an irreducible representation of G. Otherwise, we decompose V ′ = W1 ⊕ W2 . Indeed, projections of v to the both summands must be K-invariant, but a K-invariant vector is unique. Therefore Φ(p) is the spherical function of the restriction of the representation ρ(p) to V ′ . Assume that there are no proper subspaces Z blue ⊂ H blue , Z red ⊂ H red , Z yellow ⊂ H yellow such that ξ ∈ Z blue ⊗ Z red ⊗ Z yellow . Denote by U the group consisting of all triples of unitary operators (Ablue , Ared , Ayellow ) acting in the corresponding spaces such that Ablue ⊗ Ared ⊗ Ayellow ξ = ξ. It is easy to show, that U is a product of compact Lie groups and all but a finite number of factors are Abelian. For v being in a general position (and dim H blue , H red , H yellow > 2) the group U is trivial. The group U acts in each factor of the tensor product (5.1) preserving distinguished vector and therefore acts in the whole space V . There arises a natural conjecture: U and G are dual in the Schur–Weyl sense (for the spherical pair S∞ × S∞ ⊃ S∞ this property was obtained in [31], Subsect 5.5). If this is correct, then ρ is irreducible for ξ being in a general position. 13 Let us choose orthonormal bases eblue ∈ H blue , ered ∈ H red , eyellow ∈ H yellow , i j k this defines a basis in the tensor product X. We decompose ξ ∈ X in this basis X ξ= ξi,j,k eblue ⊗ ered ⊗ eyellow . i j k i,j,k Fix a checker surface. Assign to each blue edge a vector eblue , to each i yellow red red edge a vector ej , to each yellow edge a vector ek . Let us call such data assignments. For a triangle A denote by iblue (A), j red (A), k yellow (A) the numbers of basis vectors on its sides. Proposition 5.2 (see [23]) The spherical function Φ(Ξ) is given by Φ(Ξ) = X Y ξiblue (A), j red (A), kyellow (A) × assignments white A × Y ξiblue (B), j red (B), kyellow (B) . white B 6 Convolution algebras and their limit Here we explain how the multiplication of double cosets arises as a limit of convolution algebras on finite groups Gn . 6.1. Convolution algebras. Let H be a finite group, S its subgroup. Denote by C[H] the group algebra of H equipped with convolution ∗. Set δS := 1 X δh , #(S) s∈S where #(·) denotes the number of elements in a finite set and δh is the deltafunction on H supported by h. Denote by C[S \ H/S] ⊂ C[H] the space of S-biinvariant functions, i.e., functions satisfying the condition f (s1 hs2 ) = f (h), where s1 , s2 ∈ S. Equivalently, f ∗ δS = δS ∗ f = f. (6.1) Clearly, C[S \ H/S] is a subalgebra in C[H]. Let ρ be a unitary finite-dimensional representation of H in the space V , denote by the same letter ρ(·) the corresponding representation of the group algebra. Denote by V S the space of S-fixed vectors in V . Obviously, ρ(δS ) is the operator of orthogonal projection to V S . For f ∈ C[S \H/S] let us represent ρ(f ) as a block operator ρ(f ) : V S ⊕ (V S )⊥ → V S ⊕ (V S )⊥ . 14 By (6.1), it has the form  ρ(f ) ρ(f ) = 0  0 . 0 Moreover operators ρ(f ) determine a representation of the algebra C[S \ H/S] in V S . Standard arguments show that if ρ is irreducible and V S 6= 0, then an initial representation ρ is uniquely determined by representation ρ. There is a natural basis in C[S \ H/S]. Namely, for each double coset p, we consider the element of C[H] given by δp := 1 X δg . #p g∈p We have δp ∗ δq = X crpq δr , (6.2) where crpq ∈ Q are certain structure constants, X crpq = 1, crpq > 0. r Remark. These considerations with minor variations can be repeated for a locally compact group H and a compact subgroup S. ⊠ Remark. An algebra of biinvariant functions (if we are able to understand it) is an important tool of an investigation of representations of H. However, such algebras are difficult objects and there few families of such objects that actually are explored. The most important examples are: — the Hecke–Iwahori algebras (as H = GL over a finite field and S is the group of all upper triangular matrices); — the affine Hecke algebras (as H = GL over a p-adic field and S is the Iwahori subgroup); — algebras of functions on a semisimple Lie groups biinvariant with respect to its maximal compact subgroup (as H = GL(n, R) and S is the orthogonal group O(n); or (a dual version) H is a unitary group U(n) and S = Ø(n)). Also recall that the Hecke and the affine Hecke algebras live by their own life independently on the initial groups. There is a huge literature on this topics. ⊠ 6.2. Concentration of convolutions. Now consider a group H = Gn = Sn × Sn × Sn and  the subgroup Kn [α] in the diagonal fixing 1, 2,. . . , α. Consider algebras C Kn [α] \ Gn /Kn [α] for fixed α and n → ∞. We assign a checker surface to an element of Kn [α] \ Gn /Kn [α] as above. Thus we get an embedding e α] ≃ K[α] \ G/K[α]. θn : Kn [α] \ Gn /Kn [α] −→ Ξ[α, 15 The image consists of all surfaces having 6 2n triangles. Let p ∈ K[α] \ G/K[α]  contain 2l triangles. For each n ∈ N we define δp(n) ∈ C Kn [α] \ Gn /Kn [α] by ( 0, if n < l; δp(n) = −1 θn p, if n > l. Theorem 6.1 Let p, q be contained in the image of θm , i.e., they define elements of Km [α] \ Gm /Km [α]. Let n > m. Decompose the following convolution as X r(n) δp(n) ∗ δq(n) = σn δ(p⊛q)(n) + bp(n)q(n) δr(n) . r6=p⊛q Then the coefficient σn tends to 1 as n → ∞. Thus the sum of remaining coefficients tends to 0. See a formal proof in [20], [7], it is based on arguments from [33]. Multiplicativity Theorem 3.3 can be derived from the concentration of convolutions in a straightforward way, see [7]. 7 A pre-limit convolution algebra 7.1. Algebras of conjugacy classes. Consider the group Qn := Sn × Sn , its diagonal Ln ≃ Sn and the space of conjugacy classes Qn //Sn . As we noticed above, (Sn × Sn )//Ln ≃ Kn \ (Sn × Sn × Sn )/Kn ≃ Ξn . Consider the space C[Qn //Ln ] of all f ∈ C[Qn ] satisfying f (hgh−1 ) = f (g), where g ∈ Qn , h ∈ Ln . Obviously, this space is closed with respect to convolutions. We intend to present a quasi-description of this algebra. 7.2. The Ivanov-Kerov algebra. Consider a disjoint union of all sets Qm //Lm ∞ ∞ a a b Qm //Lm , Ξn ≃ Ξ := m=0 m=0 (below use the same notation for a conjugacy class and the corresponding checker surface). b 6= Ξ[0, 0]. Indeed, an element of Ξ b is an Remark. Emphasize that Ξ arbitrary finite checker surface, and an element of Ξ[0, 0] is a checker surface b→ without double triangles. A removing double triangles determines a map Ξ Ξ[0, 0]. A preimage of any point is countable. ⊠ n,n For any n and p ∈ Qn //Ln we define an element ∆p of the group algebra C[Qn ] by X ∆n,n := δg . p g∈p 16 Let m > n and p ∈ Qn //Ln . Consider the corresponding element p(m) ∈ Qm //Lm , i.e., we take the corresponding checker surface and add m − n double triangles. We set (N − n)! n,n ∆m,n := ∆p . p (N − m)! Theorem 7.1 There exists an associative algebra A with a basis up , where p b and a product ranges in Ξ, up ◦ uq = X arpq ur b q∈Ξ such that • arpq ∈ Z+ . • Consider the linear map Πn : A → C[Qn //Ln ] defined on up , u ∈ Qk //Lk by ( ∆n,k if k 6 n p , Πn up := 0, if k > n. Then Πn is a homomorphism from A to C[Qn //Ln ]. • Let p ∈ Qn //Ln , q ∈ Qm //Lm , r ∈ Ql //Ll . Then arpq are zero if l > m + n or if l < min(m, n). A similar statement for C[Sn //Sn ] was obtained by Ivanov and Kerov in [14], it was extended to more general objects including C[Qn //Ln ] in [28]. 7.3. A description of the algebra A. See [28]. Let X, Y be finite sets. We say that a partial bijection s : X → Y is a bijection of a subset B ⊂ X to a subset B ⊂ Y , we say dom(s) := A, im(s) := B. b Consider a partial bijection s from the set of black triangles of Let p, q ∈ Ξ. p to the set of white triangles of q. For each A ∈ dom s we remove the interior of the black triangle A ⊂ p and the interior of the white triangle s(A) ∈ q and identify their boundaries according colors of edges. We normalize the resulting cell complex and come to a new checker surface p ⊙s q. The formula for the product in A is X up ◦ uq = up⊙s q , s where the summation is taken over all partial bijection. 7.4. The Poisson algebra. Denote by An the subspace in A generated by `n all up , where p ranges in i=0 Qn //Kn . The get a filtration, v ∈ An , w ∈ Am ⇒ v ◦ w ∈ Am+n . The corresponding graded associative algebra ⊕∞ j=0 An /An−1 is commutative, a product of basis elements is given by up · uq = up ` q , 17 ` where p q is a disjoint union of checker surfaces. Also, we have a structure of a graded Poisson Lie algebra on ⊕∞ n=0 An /An−1 , namely, for any x ∈ Am , y ∈ An we define their bracket {x, y} as the image of x ∗ y − y ∗ x in Am+n−1 /Am+n−2 . Let us describe the bracket. Consider set M (p, q) of all pairs ϕ = (B, C), where B is a black triangle of p and C is a white triangle of q. For any ψ we define a surface p ⊚ϕ q, it is obtained by removing the interior of B from p and the interior of C from q and identification of boundaries of these triangles. In this notation, X X uq⊚ψ p . up⊚ϕ q − {up , uq } = ψ∈M(q,p) ϕ∈M(p,q) References [1] Belyi, G. V. Galois extensions of a maximal cyclotomic field. Math. USSRIzvestiya, 1980, 14:2, 247–256. [2] Belyi, G. V. A new proof of the three-point theorem. Sbornik: Math., 2002, 193:3, 329-332. [3] Borodin, A., Olshanski, G. Representations of the infinite symmetric group. Cambridge University Press, 2016. [4] Dixmier, J. Les C ∗ -algébres et leurs représentations. Gauthier Villars, 1964. [5] Ferri, M., Gagliardi, C., Grasselli, L. A graph-theoretical representation of P L-manifolds: a survey on crystallization. Aequationes Math. 31 (1986), no. 2-3, 121-141. [6] Gaifullin, A. A. The manifold of isospectral symmetric tridiagonal matrices and the realization of cycles by aspherical manifolds. Proc. Steklov Inst. Math. 263 (2008), no. 1, 38-56. [7] Gaifullin, A.A., Neretin Yu.A. Infinite symmetric group and bordisms of pseudomanifolds. J. of Topology and Analysis, 2017. [8] Girondo, E., González-Diez, G. Introduction to compact Riemann surfaces and dessins d’enfants. Cambridge University Press, Cambridge, 2012. [9] M. Goresky, R. MacPherson, Intersection homology theory, Topology, 19:2 (1980), 135-162. [10] Grothendieck A. Sketch of a programme (1984) in Schneps L., Lochak P. eds. V. 1. Around Grothendieck’s Esquisse d’un Programme. Cambridge Univ. Press, 1997, p. 243-284. [11] Guichardet, A. Symmetric Hilbert spaces and related topics. Infinitely divisible positive definite functions. Continuous products and tensor products. Gaussian and Poissonian stochastic processes. Lect. Notes Math., Vol. 261. Springer, Berlin-New York, 1972. 18 [12] Hatcher, A. Algebraic topology. Cambridge University Press, Cambridge, 2002. [13] Ismagilov R. S. Elementary spherical functions on the group SL(2, P ) over a field P , which is not locally compact, with respect to the subgroup of matrices with integral elements, Math. USSR-Izv. 1:2 (1967), 349-380. [14] Ivanov, V., Kerov, S. The algebra of conjugacy classes in symmetric groups, and partial permutations. (Russian) Zap. Nauchn. Sem. S.-Peterburg. Otdel. Mat. Inst. Steklov. (POMI) 256 (1999), 95–120, 265; translation in J. Math. Sci. (New York) 107 (2001), no. 5, 4212-4230. [15] Kechris, A., Rosendal, Ch., Turbulence, amalgamation, and generic automorphisms of homogeneous structures. Proc. Lond. Math. Soc. (3) 94 (2007), no. 2, 302–350. [16] Kerov, S., Olshanski, G., Vershik, A. Harmonic analysis on the infinite symmetric group. Invent. Math. 158 (2004), no. 3, 551-642. [17] Lando, S. K., Zvonkin, A. K. Graphs on surfaces and their applications. Springer-Verlag, Berlin, 2004. [18] A. Lieberman, The structure of certain unitary representations of infinite symmetric groups, Trans. Amer. Math. Soc., 164 (1972), 189-198. [19] Neretin, Yu. A. Categories of symmetries and infinite-dimensional groups. The Clarendon Press, Oxford University Press, New York, 1996. [20] Neretin Yu.A. On concentration of convolutions of double cosets at infinitedimensional limit. Preprint, arXiv:1211.6149. [21] Neretin, Yu. A. Multi-operator colligations and multivariate characteristic functions. Anal. Math. Phys. 1 (2011), no. 2-3, 121-138. [22] Neretin, Yu. A. Sphericity and multiplication of double cosets for infinitedimensional classical groups. Funct. Anal. Appl. 45 (2011), no. 3, 225-239. [23] Neretin, Yu. Infinite tri-symmetric group, multiplication of double cosets, and checker topological field theories. Int. Math. Res. Not. IMRN 2012, no. 3, 501-523. [24] Neretin, Yu. Symmetries of Gaussian measures and operator colligations. J. Funct. Anal. 263 (2012), no. 3, 782-802. [25] Neretin, Yu. A. The space L2 on semi-infinite Grassmannian over finite field. Adv. Math. 250 (2014), 320-350. [26] Neretin, Yu. A. Infinite-dimensional p-adic groups, semigroups of double cosets, and inner functions on Bruhat-Tits buildings. Izv. Math. 79 (2015), no. 3, 512-553. 19 [27] Neretin Yu. A. Infinite symmetric groups and combinatorial constructions of topological field theory type., Russian Math. Surveys, 70:4 (2015), 715773. [28] Neretin Yu. A. Algebras of conjugacy classes in symmetric groups. Preprint arXiv:1604.05755. [29] Nessonov N.I. Representations of S∞ admissible with respect to Young subgroups. Sbornik Math. 203 (2012), no. 3-4, 424-458. [30] Olshansky G.I., Unitary representations of the infinite symmetric group: a semigroup approach, in Representations of Lie groups and Lie algebras, Pt. 2 (Budapest, 1971), Akad. Kiadó, Budapest, 1985, 181-197. [31] Olshanski, G. I. Unitary representations of (G, K)-pairs that are connected with the infinite symmetric group S(∞). Leningrad Math. J., 1 (1990), no. 4, 983-1014. [32] Olshanski, G. I. Unitary representations of infinite-dimensional pairs (G, K) and the formalism of R. Howe. in Representation of Lie groups and related topics, 269-463, Gordon and Breach, New York, 1990. [33] Olshanski, G. I. On semigroups related to infinite-dimensional groups. in Topics in representation theory, 67-101, Amer. Math. Soc., Providence, RI, 1991. [34] Pezzana, M. Diagrammi di Heegaard e triangolazione contratta. Collection in memory of Enrico Bompiani. Boll. Un. Mat. Ital. (4) 12 (1975), no. 3, suppl., 98-105. [35] Schneps L. (ed.), The Grothendieck theory of dessins d’enfants. Cambridge University Press, Cambridge, 1994. [36] Schneps L., Lochak L. (eds.) Geometric Galois actions. V. 1, 2. Cambridge University Press, Cambridge, 1997. [37] Sijsling, J., Voight, J. On computing Belyi maps. in Méthodes arithmétiques et applications, automne 2013, 73-131, Publ. Math. Besançon Algébre Théorie Nr., 2014/1, Presses Univ. Franche-Comté, Besan¸on, 2014. [38] Shabat G. , Calculating and drawing Belyi pairs , Zapiski nauchn. semin. POMI RAN 446, 2016, 182-220. [39] Shabat, G. B., Voevodsky, V. A. Drawing curves over number fields. The Grothendieck Festschrift, Vol. III, 199-227, Birkhäuser Boston, Boston, MA, 1990. [40] von Neumann, J. On infinite direct products. Compositio Math. 6 (1939), 1-77; reprinted in: Collected works, v. 3, Rings of operators, Pergamon Press, 1961, 323-399. 20 Math.Dept., University of Vienna, Oskar-Morgenstern-Platz 1, 1090 Wien; & Institute for Theoretical and Experimental Physics (Moscow); & Mech.Math.Dept., Moscow State University; & Institute for information transmission problems (Moscow); e-mail: yurii.neretin(at) univie.ac.at URL:www.mat.univie.ac.at/∼neretin 21
4math.GR
Leveraging Microgrids for Capturing Uncertain Distribution Network Net Load Ramping Alireza Majzoobi, Amin Khodaei Dept. of Electrical and Computer Engineering University of Denver Denver, CO, USA [email protected], [email protected] Abstract— In this paper, a flexibility-oriented microgrid optimal scheduling model is proposed to mitigate distribution network net load variability caused by large penetration distributed solar generation. The distributed solar generation variability, which is caused by increasing adoption of this technology by end-use consumers, is mainly addressed by electric utilities using grid reinforcement. Microgrids, however, provide viable and local solutions to this pressing challenge. The proposed model, which is developed using mixed-integer programming and employs robust optimization, not only can efficiently capture distribution network net load variations, mainly in terms of ramping, but also accounts for possible uncertainties in forecasting. Numerical simulations on a test distribution feeder with one microgrid and several consumers/prosumers indicate the effectiveness of the proposed model. Keywords—Microgrid, optimal scheduling, ramping, renewable energy, uncertainty, utility grid support NOMENCLATURE Indices: c Superscript for distribution network consumers and prosumers. ch/dch Superscript for energy storage charging/discharging mode. d Index for loads. i Index for DERs. j Index for consumers/prosumers at the distribution network. t Index for time periods (hour). u Superscript for the utility grid. Sets: D G N P S U Set of adjustable loads. Set of dispatchable units. Set of consumers/prosumers. Set of primal variables. Set of energy storage systems. Set of uncertain parameters. Parameters: DR/UR Ramp down/up rate. DT/UT Minimum down/up time. E Load total required energy. F(.) Generation cost. MC/MD Minimum charging/discharging time. MU Minimum operating time. α, β Specified start and end times of adjustable loads. ρM Market price. η Energy storage efficiency. τ Time period. Variables: C Energy storage available (stored) energy. D Load demand. I Commitment state of dispatchable units. P DER output power. PM Utility grid power exchange with the microgrid. SD/SU Shut down/startup cost. Tch/Tdch Number of successive charging/discharging hours. Ton/Toff Number of successive ON/OFF hours. u Energy storage discharging state (1 when discharging, 0 otherwise). v Energy storage charging state (1 when charging, 0 otherwise). z Adjustable load state (1 when operating, 0 otherwise). I. T INTRODUCTION HE evolution of renewable energy over the past few decades has surpassed all expectations and the renewable energy technologies are rapidly growing throughout the world. Environmental concerns about climate change, especially in recent years, have been one of the key factors for the significant increase in renewable energy investment. The global investment in renewable energy in 2015 reached $285.9 billion, surpassing its 2011 record of $278.5 billion. In 2015, 53.6% of all installed and commissioned generation capacity was renewable energy (about 134 GW) [1]. In addition to air pollution reduction, reduced operation cost has been another reason for growth of renewable energy in recent years. In the last five years, the cost of energy from renewable sources such as solar and wind has dramatically dropped by 78% and 58%, respectively [2]. Today, even without subsidies and supports of governments, these sources of energy are cost competitive with conventional generation resources in many parts of the world [2]. Despite all advantages of renewable energy resources, there are some drawbacks which should be carefully taken into account. For instance, growing solar energy deployment as a favorable distributed energy resource and participation of consumers in decarbonized clean energy production, has changed the typical daily demand curves. Considering that the solar generation is highest around the noontime, the daily net load curve, i.e. the difference of load and solar generation, drops significantly at noon and increases in early evening hours due to sunset and residential load increase. Therefore, the utility companies encounter a sharp ramping in daily demand curves. The California Independent System Operator’s report on this changing demand profile, published in 2013, predicted as high as 4.3 GW/h required ramping in daily demand curve by 2020 [3]. Furthermore, unlike the conventional energy resources, renewable generation is inherently variable (generation constantly varies) and uncertain (generation cannot be forecasted with perfect accuracy) [4]. The studies by the North American Electric Reliability Corporation (NERC) show that the power generation of solar panels can change by ±70%, in a timeframe of 2–10 minutes, several times per day [4], in addition to the typical ±1% to ±7% deviation between predicted demand and actual demand in the system [5]. The high penetration of renewable generation has significantly increased the system uncertainty which further challenges traditional methods in cost-effective and reliable control, operation, and planning of power systems [6], [7]. Several methods are proposed to address this challenge [8][10]. The traditional solution of utility companies for maintaining system supply-demand balance is to utilize fast ramping units that can be quickly dispatched and ramped up/down. With high penetration of renewable energy resources, the spinning reserve of these units should be increased which imposes higher operation cost to the utility companies and decreases the efficiency of the system. Energy storage can also be used to capture the renewable generation uncertainty [11]-[13]. Energy storage, however, is still an expensive technology and its large-scale deployments are limited. Demand response, as a way to modify electricity consumption to increase power system efficiency and reliability, is another proposed solution. The successful implementation of the demand response, however, needs extensive infrastructures as well as considerable participation of consumers [14]-[17]. Sun tracking and rotating solar panels can be considered as other existing methods which are usually more applicable in solar farms than distributed applications [18]. Leveraging potential flexibility of existing microgrids in distribution networks as a local, novel, and viable method has been proposed in [19] and extended in this paper to address aforementioned challenges and to alleviate the negative impacts of increasing renewable penetration. Microgrids, as small-scale power system with the ability of operating in both grid-connected and islanding modes [20], have attracted considerable attention in recent years, primarily due their promising features in enhancing reliability, resilience, and power quality, reducing environmental impact, relieving network congestion, and improving energy efficiency [21][29]. Between 2011 and 2014, more than $213 million has been invested on microgrid projects in the United States [30]. Microgrids’ deployment of dispatchable generation units, energy storage, and adjustable loads, provides significant controllable fast-response generation that can be used for flexibility and ramping purposes, as will be discussed and modeled in this paper. In addition, the existing uncertainty in distributed load, distributed solar generation, and price will be captured by the microgrid. The remaining parts of the paper are organized as follows. The outline of the proposed model is explained in Section II. Section II further presents model formulations including maxmin objective function and microgrid operation and flexibility constraints. The effectiveness of the proposed model is proved in Section III, via numerical simulations. Discussion on the results and features of the proposed model are also presented in this section. The conclusions are provided in Section IV. II. PROBLEM MODELING AND FORMULATION A. Problem Statement The power (Pu) that the electric utility should supply to a certain distribution feeder is equal to the microgrid net load (PM) plus the aggregated net load of other customers, including consumers and prosumers, in this feeder (Pc) as presented in (1). Pt u  Pt M   Pjtc t. (1) jN The net load of consumers and prosumers is highly variable and uncertain, primarily due to the deployment of distributed renewable energy resources, and is further uncontrollable from the utility side. The net load of the microgrid, moreover, is controlled by the microgrid controller based on economy and reliability considerations. The summation of these two uncontrollable net loads with considerable levels of renewable generation causes variability (mainly in terms of large ramps) and uncertainty for the power that the electric utility needs to provide. A viable solution, however, is to incentivize the microgrid to locally capture the ramping, i.e., not only the microgrid retracts its variability, but also helps the electric utility in capturing the variability of other customers connected to the same distribution feeder. To model this, the utility grid ramping limit (2) should be translated into proper limitations on the microgrid net load as discussed in the next subsection. Pt u  P(ut1)   t. (2) B. Problem Formulation The flexibility-oriented microgrid optimal scheduling model under uncertainty is proposed as in (3)-(21). max min [  F ( Pit ) tM Pt M ] U P t iG (3)  Pit  Pt M   Ddt i t , (4) t , (5) i  G, t , d  P M , max  Pt M  P M , max min I it  Pit  Pi max Pit  Pi (t 1)  URi i  G, t , (6) (7) Pi (t 1)  Pit  DRi i  G, t , (8) Pi I it Titon  UTi ( I it  I i (t 1) ) i  G, t , (9) Titoff  DTi ( I i (t 1)  I it ) i  G, t , (10) Pit  P u P v i  S, t , (11) Pit  P u P v i  S, t , (12) i  S, t , (13) i  S, t , (14) i  S, t , (15)  MCi (uit  ui (t 1) ) i  S, t , (16)  MDi (vit  vi (t 1) ) i  S, t , (17) z  Ddt  D d  D, t , (18) d  D, t , (19) d  D, (20) t. (21) dch,max it it dch,min it it ch,min it it ch,max it it uit  vit  1 Cit  Ci (t 1)  ( Pituit /i )  Pit vit min i C ch it T dch it T  Cit  C max i min dt dt D max dt dt z Tdon  MU d ( z dt  z d (t 1) )  t[ d ,  d ] Ddt  Ed up low ≤Pt M  P(M t t 1) ≤ t time limits, respectively. Constraints (18)-(20) define the restrictions on adjustable loads, including rated power limitations (18), the minimum operating time (19), and the required energy to complete an operating cycle (20) [24]. Constraint (21) is the utility ramping limit which is translated into a constraint on the microgrid net load. This constraint is obtained by substituting the value of the utility power from (1) in (2) and rearranging the terms. The lower and upper limits, which now are functions of time, are calculated based on the net load of connected customers as in (22) and (23): low     ( Pjtc   Pjc(t 1) ) t j c c up t    ( Pjt   Pj ( t 1) ) j This objective is subject to system constraints (4)-(5), component constraints (6)-(20), and the flexibility constraint (21). The load balance equation (4) ensures that adequate generation is available (locally and purchased from the utility grid) to supply local loads. The capacity of the line connecting the microgrid to the utility grid defines the restriction on the exchanged power (5). Dispatchable units are subject to minimum and maximum generation capacity limits (6), ramping limits (7)-(8), and minimum up/down time limits (9)(10). Constraints (11)-(17) define the restrictions on energy storage. The maximum and minimum amounts of charging and discharging are define by (11) and (12). Constraint (13) checks the energy storage operation mode to ensure that it does not operate at both charging and discharging modes simultaneously. Available energy at each hour is calculated with (14), while its limitations are defined in (15). Constraints (16) and (17) specify the minimum charging and discharging (22) t. (23) j C. Solution Approach The proposed robust model is decomposed into a master problem and a subproblem using Benders decomposition as illustrated in Fig. 1. The master problem calculates the minimum operation cost considering only constraints that include binary variables. It can be represented as follows: min  F ( Pit ) (24) P The objective of this problem is to minimize the microgrid operation cost over primary variables and to maximize over uncertain variables. The microgrid operation cost consists of two terms; local generation cost, i.e. the first term of (3), and the cost of power exchange with the utility grid, i.e. the second term of (3). It should be noted that the primary variables are local distributed energy resources (DERs), loads, and utility grid power exchange, while uncertain variables are the net load of aggregated customers and the electricity price. Thus, a robust solution (i.e., the worst-case) will be calculated which ensures that the microgrid can capture distribution network net load ramping even if load, generation, and price forecasts are uncertain. t , j t iG subject to (6), (9)-(13), (16)-(19). Once binary scheduling variables are determined, including the DERs and loads schedules, these variables are sent to the subproblem, defined as follows: max min  tM Pt M U P (25) t subject to (4)-(8), (11)-(12), (14)-(15), (18), (20)-(21), and given binary variables from the master problem. Master Problem Determine optimal schedule of microgrid components (constraints with binary variables) Optimal Schedule Subproblem The worst-case optimal operation calculation over uncertainty sets UB Optimality Cut Formation No LB Converged? Yes Flexibility-Oriented Microgrid Schedule Under Uncertainty Fig. 1 Flowchart of the proposed flexibility-oriented microgrid optimal scheduling model. The subproblem finds the microgrid’s worst-case minimum operation cost over uncertainty sets based on the fixed schedules from the master problem. Since there is no binary variable in the subproblem, it is possible to convert the inner minimization problem into a maximization problem via duality theory and further combine the two maximization problems. Each uncertain parameter varies in an interval which is obtained from the forecasted value and expanded around the forecasted value based on the forecast error (i.e., a polyhedral uncertainty set). The robust optimization method finds the worst-case optimal operation solution while uncertain parameters vary within their associated uncertainty intervals. In order to control the robustness and restrict the solution conservatism, the budget of uncertainty is defined for confining the numbers of uncertain parameters which can take their worst-case values [21]. This robust optimization approach integrates uncertainties of distributed load, distributed solar generation, and market price forecasts. Once solved, the optimal DERs and loads schedules will be obtained which also ensure flexibility. Checking the lower and upper bound proximity of the problem is an approach for examining the solution convergence. As it is shown in the Fig. 1, the lower and the upper bounds of the problem are calculated in the master problem and the subproblem, respectively. The optimality cut will be formed in the subproblem and sent back to the master problem for updating the current schedule, if the solution is not converged. This iterative process continues until the convergence criterion is met and the solution is proven optimal [21]. III. NUMERICAL EXAMPLES The microgrid used for studying the performance of the proposed model in this paper consists of two nondispatchable units (solar and wind), four dispatchable units, one energy storage, and five adjustable loads. The characteristics of these energy resources, loads, as well as the hourly market price are available in [22]. The amount of aggregated load and solar generation in distribution feeder are tabulated in Tables I and II, respectively. A 10 MW capacity is assumed for the line between the microgrid and the utility grid. The developed mixed-integer programming problems are solved using CPLEX 12.6. Time (h) Load (MW) Time (h) Load (MW) Time (h) Load (MW) Time (h) Load (MW) TABLE I AGGREGATED DISTRIBUTED LOAD 1 2 3 4 13.50 12.50 11.80 11.70 7 8 9 10 12.80 14.00 14.60 15.20 13 14 15 16 18.50 18.00 17.00 16.70 19 20 21 22 20.25 20.65 19.00 17.00 5 12.10 11 16.00 17 17.00 23 14.50 6 12.50 12 17.00 18 18.00 24 13.80 TABLE II AGGREGATED DISTRIBUTED SOLAR GENERATION Time (h) 1 2 3 4 5 Power (MW) 0.00 0.00 0.00 0.00 0.00 Time (h) 7 8 9 10 11 Power (MW) 0.00 0.00 1.00 4.00 8.00 Time (h) 13 14 15 16 17 Power (MW) 14.00 14.20 14.00 12.40 11.00 Time (h) 19 20 21 22 23 Power (MW) 2.75 0.85 0.00 0.00 0.00 6 0.00 12 11.50 18 6.00 24 0.00 Three cases are studied to show the effectiveness of the proposed model for addressing distribution network flexibility concerns: Case 1: Flexibility-oriented microgrid optimal scheduling ignoring uncertainty. Case 2: Flexibility-oriented microgrid optimal scheduling considering uncertainty. Case 3: Sensitivity analysis with regards to the budget of uncertainty. Case 1: The flexibility-oriented microgrid optimal scheduling without consideration of any uncertainty is solved for a 24hour horizon. The microgrid should capture the rampings above desired amount of the utility grid, which has been assumed as 2 MW/h in this case. When there is no contribution from the microgrid, the utility grid should capture the ramping of distribution feeder net load, for instance a maximum of 6 MW/h load change or an average of 4.6 MW/h in 3 hours. In this condition, unit 1 is ON for the entire 24 hours and commitment of other units changes to achieve the optimal operation. The operation cost is calculated as $11262.8. The comparison of distribution feeder net load with and without considering ramping constraint shows that in the case which there is no collaboration between the microgrid and the utility grid, i.e. no ramping constraints, even sharper ramps should be addressed by the utility grid. Indeed, in this case the microgrid exacerbated the distribution feeder net load variability, which should be supplied by the utility grid. The results show that in the absence of microgrid, the utility grid should address a maximum of 6 MW/h load change, or an average of 4.6 MW/h in 3 hours, while adding the microgrid in the feeder without consideration of any ramping constraints increases this amount to a maximum of 11.85 MW/h, or an average of 7 MW/h in 3 hours. It is worthwhile to mention that the microgrid operation cost without consideration of any flexibility constraint is $11262.8, while it would be increased to $12126.3 after the addition of the ramping constraint. The reason of this cost increase, which should be paid to the microgrid by the utility grid, is the additional constraint that is imposed to the microgrid scheduling problem. Case 2: The flexibility-oriented microgrid optimal scheduling considering prevailing uncertainties is solved for a 24-hour horizon. Forecast errors in distribution feeder load, solar generation, and market prices are considered as ±10%, ±20%, and ±10%, respectively. Furthermore, a 12-hour/day budget is considered as a limitation on uncertainty. A ramping limit of 2 MW/h is considered similar to Case 1. Fig. 2 depicts the distribution feeder net load with and without considering flexibility constraint for ±10% load forecast error. As this figure shows, the utility grid encounters an average of 8.1 MW/h in 3 hours load change between hours 9 and 12 (maximum of 13.55 MW/h), as well as an average of 7.3 MW/h in 2 hours between hours 18 and 19 (maximum of 8 MW/h). The microgrid, however, restricts the ramping of the distribution feeder net load to 2 MW/h which has been requested by the utility grid. To obtain the desired ramping, the microgrid needs to deviate from its optimal schedule which leads to a $1652.9 increase in its operation cost. This 14.7% increase in the microgrid operation cost should be paid by the electric utility as an incentive for contribution in mitigating the net load ramping. mitigated by the microgrid. The obtained results show that the microgrid operation cost is increased by $1516.7, equal to 13.3%, due to the addition of the flexibility constraint. It should be noted that in all cases unit 1 is ON for the entire scheduling horizon, while there are changes in commitment and dispatch of other units. Table III summarizes the microgrid operation cost for studied cases. It clearly shows that considering uncertainty increases the microgrid operation cost, however it would be able to capture any possible deviations from the forecasted values. The table moreover shows the impact of different uncertainties on the microgrid operation cost. Fig. 2. Distribution feeder net load, with and without ramping constraint, for uncertain distributed load over the 24-hour scheduling horizon. Fig. 3. Distribution feeder net load, with and without ramping constraint, for uncertain market price over the 24-hour scheduling horizon. The obtained results for ±20% solar generation forecast error are almost the same as ±10% load forecast error with minor differences. For ±20% solar generation uncertainty, without any contribution from the microgrid, the utility grid encounters an average of 7.9 MW/h net load change in 3 hours between hours 10 and 12 (with a maximum of 15.75 MW/h), as well as an average of 6.8 MW/h in 2 hours between hours 18 and 19 (a maximum of 7.6 MW/h). The microgrid operation cost when capturing these ramps increases from $11262.8 to $12,642.2. The results show that although the load forecast error is ±10% compared with ±20% solar generation forecast error, the microgrid operation cost due to contribution in capturing ramping, for load uncertainty has been increased 2.5% more than solar generation uncertainty. Fig. 3 demonstrates the distribution feeder net load with and without considering flexibility constraint for ±10% market price uncertainty. This figure shows the effectiveness of microgrid to address the distribution feeder net load. An average of 7 MW/h ramping in 3 hours in the morning, 11.85 MW/h load change between hours 11 and 12, and 6 MW ramping in one hour between hours 21 and 22 have been TABLE III MICROGRID OPERATION COST ($) FOR VARIOUS OPERATION SCHEDULING AND 2 MW/HOUR RAMPING LIMITS Microgrid optimal Distributed Distributed Market scheduling load solar prices uncertainty uncertainty uncertainty Ignoring uncertainty $12126.3 $12126.3 $12126.3 Considering uncertainty $12915.7 $12642.15 $12862.9 Case 3: In this case the microgrid operation cost for various amounts of uncertainty budget are calculated. The obtained results in Table IV illustrate that the microgrid operation cost is directly proportional to the budget of uncertainty. The results further demonstrate that the changes on the load and solar generation have the highest and lowest impact on the microgrid operation cost, respectively. With increasing the budget of uncertainty 0 to 12 hours, the microgrid operation cost is increased by 6.5%, 4.25%, and 6% for distributed load, distributed solar generation, and market price uncertainty, respectively. It should be noted that ±10% was considered for load forecast error and market price uncertainty, whereas ±20% was considered for solar generation uncertainty. TABLE IV MICROGRID OPERATION COST FOR VARIOUS BUDGETS OF UNCERTAINTY (CONSIDERING A 2 MW/HOUR RAMPING LIMIT) Budget of Distributed load Distributed solar Market price Uncertainty (h) uncertainty uncertainty uncertainty 0 $12,126.3 $12,126.3 $12,126.3 3 $12,526.6 $12,393.4 $12,446.1 6 $12,715.3 $12,561.9 $12,611.7 9 $12,850.1 $12,607.9 $12,748.6 12 $12,915.7 $12,642.2 $12,862.9 IV. CONCLUSIONS A flexibility-oriented microgrid optimal scheduling under uncertainty was proposed in this paper to address distribution network net load ramping. The robust optimization method was used for capturing uncertainties and increasing the practicality of the proposed model. The obtained results showed that utilizing the microgrid decreases the utility ramping to the desired amounts. Although flexibility constraints led to higher microgrid operation cost, which should be paid to the microgrid by the electric utility, it removed the need for costly investments on reinforcing the existing electricity infrastructure. The numerical simulations further showed that by increasing the budget of uncertainty, the microgrid operation cost increases as it was required to capture uncertainty in a larger number of hours. In addition, the obtained results indicated that the microgrid operation cost is more sensitive to load uncertainty compared to renewable generation and price uncertainty. REFERENCES [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] Global trends in renewable energy investment 2016, Available at: http://fs-unepcentre.org/sites/default/files/publications/globaltrendsinrenewableenerg yinvestment2016lowres_0.pdf H. Yu and W. D. Rosehart, “An optimal power flow algorithm to achieve robust operation considering load and renewable generation uncertainties,” IEEE Trans. Power Syst., vol. 27, no. 4, pp. 1808–1817, Nov. 2012. California ISO, "The Duck Curve," Available [online:] https://www.caiso.com/Documents/FlexibleResourcesHelpRenewablesFastFacts.pdf A. Y. Saber and G. K. Venayagamoorthy, “Resource scheduling under uncertainty in a smart grid with renewables and plug-in vehicles,” IEEE Syst. J., vol. 6, no. 1, pp. 103–109, Mar. 2012. A. Y. Saber and G. K. Venayagamoorthy, “Resource scheduling under uncertainty in a smart grid with renewables and plug-in vehicles,” IEEE Syst. J., vol. 6, no. 1, pp. 103–109, Mar. 2012. N. Nikmehr, S. Najafi-Ravadanegh, "Optimal operation of distributed generations in micro-grids under uncertainties in load and renewable power generation using heuristic algorithm," IET Renewable Power Generation, Vol. 9, pp. 982-990, 2015. J. Wen, X. N. Han, J. M. Li, Y. Chen, H. Q. Yi, and C. Lu, “Transmission network expansion planning considering uncertainties in loads and renewable energy resources,” CSEE Journal of Power and Energy Systems, vol. 1, no. 1, pp. 78–85, Mar. 2015. W. A. Bukhsh, C. Zhang, P. Pinson, “An Integrated Multi period OPF Model With Demand Response and Renewable Generation Uncertainty,” IEEE Trans. Power Syst., vol. 7, no. 3, pp. 1495–1503, May. 2016. S. S. Reddy, P. R. Bijwe, and A. R. Abhyanka, “Real-time economic dispatch considering renewable power generation variability and uncertainty over scheduling period,” IEEE Systems Journal, vol. 9, no. 4, pp. 1440–1451, Dec. 2015. A. Kavousi-Fard and T. Niknam, "Considering uncertainty in the multiobjective stochastic capacitor allocation problem using a novel selfadaptive modification approach", Elect.Power Syst. Res., vol. 103, pp. 16-27, 2013. N. Gast, D. Tomozei, and J. Le Boudec, "Optimal Generation and Storage Scheduling in the Presence of Renewable Forecast Uncertainties," IEEE Trans. Smart Grid, vol. 5, pp. 1328-1339, May, 2014. E. Hajipour, M. Bozorg and M. Fotuhi, “Stochastic capacity expansion planning of remote microgrids with wind farms and energy storage,” IEEE Trans. Sustainable Energy, vol. 6, pp. 491-498, 2015. H. Nazaripouya, Y. Wang, P. Chu, H. R. Pota, and R. Gadh, "Optimal Sizing and Placement of Battery Energy Storage in Distribution System Based on Solar Size for Voltage Regulation", 2015 IEEE PES General Meeting, Denver, Colorado, 26-30 July 2015. [14] S. Mohajeryami, M. Doostan, and P. Schwarz, "The Impact of Customer Baseline Load (CBL) Calculation Methods on Peak Time Rebate Program Offered to Residential Customers," Electric Power Systems Research, vol. 137, pp. 59-65, 2016. [15] A.B.Arani, R.Yousefian, P.Khajavi and H.Monsef, “Load Curve Characteristics Improvement by Means of Optimal Utilization of Demand Response Programs,” in International Conference on Environment & Electrical Engineering, pp.1-5, 8-11 May. 2011. [16] V. S. K. M. Balijepalli, V. Pradhan, S. A. Khaparde, and R. M. Shereef, “Review of demand response under smart grid paradigm,” in Proc. IEEE Power Energy Syst. Innov. Smart Grid Technol. Conf., Kollam, India, Dec. 2011, pp. 236–243. [17] K. Tomsovic, A. Asadinejad, "Impact of Incentive Based Demand Response on Large Scale Renewable Integration," 2016 IEEE PES Innovative Smart Grid Technologies Conference (ISGT), in Press, 6-9 Sep. 2016. [18] M. Taherbaneh, AH. Rezaie, H. Ghafoorifard, K. Rahimi and MB. Menhaj, "Maximizing output power of a solar panel via combination of sun tracking and maximum power point tracking by fuzzy controllers," Int J Photoenergy, vol. 2010, Article ID 312580. [19] A. Majzoobi, A. Khodaei, "Application of Microgrids in Addressing Distribution Network Net-Load Ramping," 2016 IEEE PES Innovative Smart Grid Technologies Conference (ISGT), in Press, 6-9 Sep. 2016. [20] Department of Energy Office of Electricity Delivery and Energy Reliability. (2012). Summary Report: 2012 DOE Microgrid Workshop. [Online]. Available: http://energy.gov/sites/prod/files/2012%20Microgrid%20Workshop%2 0Report%2009102012.pdf [21] A. Khodaei, S. Bahramirad and M. Shahidehpour, “Microgrid Planning Under Uncertainty,” IEEE Trans. Power Syst., vol. 30, no. 5, pp. 24172425, Sep. 2015. [22] A. Khodaei, “Microgrid Optimal Scheduling with Multi-Period Islanding Constraints,” IEEE Trans. Power Syst., vol. 29, pp. 1383-1392, May 2014. [23] A. Khodaei, “Resiliency-Oriented Microgrid Optimal Scheduling,” IEEE Trans. Power Syst., vol. 5, pp. 1584-1591, July 2014. [24] A. Khodaei and M. Shahidehpour, “Microgrid-based Co-Optimization of Generation and Transmission Planning in Power Systems,” IEEE Trans. Power Syst., vol. 28, pp. 1582-1590, May 2013. [25] S. Bahramirad, W. Reder and A. Khodaei, “Reliability-Constrained Optimal Sizing of Energy Storage System in a Microgrid,” IEEE Trans. Smart Grid, Special Issue on Microgrids, vol. 3, pp. 2056-2062, Dec. 2012. [26] A. Khodaei, “Provisional Microgrids”, IEEE Transactions on Smart Grid, vol. 6, pp.1107-1115, May 2015. [27] A. Khodaei, “Provisional Microgrid Planning,” IEEE Transactions on Smart Grid, In press, 2015. [28] S. Parhizi, H. Lotfi, A. Khodaei, S. Bahramirad, “State of the Art in Research on Microgrids: A Review”, IEEE Access, Vol. 3, 2015. [29] S. Parhizi, A. Khodaei, and M. Shahidehpour, "Market-based vs. pricebased Microgrid optimal scheduling," IEEE Trans. Smart Grid, In press, 2016. [30] H. Lotfi and A. Khodaei, “An Efficient Preprocessing Approach for Uncertainty Consideration in Microgrids,” IEEE PES Transmission and Distribution Conference, Dallas, TX, 2016.
3cs.SY
Collaborative Platooning of Automated Vehicles Using Variable Time-Gaps Aria HasanzadeZonuzy∗ , Sina Arefizadeh† , Alireza Talebpour† , Srinivas Shakkottai∗ and Swaroop Darbha‡ ∗ Dept. of Electrical and Computer Engineering, Texas A&M University † Dept. of Civil Engineering, Texas A&M University ‡ Dept. of Mechanical Engineering, Texas A&M University arXiv:1710.02186v1 [cs.SY] 5 Oct 2017 Email:{azonuzy, sinaarefizadeh, atalebpour, sshakkot, dswaroop}@tamu.edu Abstract— Connected automated vehicles (CAVs) could potentially be coordinated to safely attain the maximum traffic flow on roadways under dynamic traffic patterns, such as those engendered by the merger of two strings of vehicles due a lane drop. Strings of vehicles have to be shaped correctly in terms of the inter-vehicular time-gap and velocity to ensure that such operation is feasible. However, controllers that can achieve such traffic shaping over the multiple dimensions of target time-gap and velocity over a region of space are unknown. The objective of this work is to design such a controller, and to show that we can design candidate time-gap and velocity profiles such that it can stabilize the string of vehicles in attaining the target profiles. Our analysis is based on studying the system in the spacial rather than the time domain, which enables us to study stability as in terms of minimizing errors from the target profile and across vehicles as a function of location. Finally, we conduct numeral simulations in the context of shaping two platoons for merger, which we use to illustrate how to select time-gap and velocity profiles for maximizing flow and maintaining safety. I. I NTRODUCTION Traffic shaping in terms of achieving desired time-gaps and velocities over platoons of vehicles is needed to handle variable traffic flows on highways caused by mergers at highway entrances, departures at exits or prevailing road conditions such as a lane drop. If uncontrolled, such events could lead to shockwave formation and breakdown. Connected automated vehicles (CAVs) have the potential to maintain maximum traffic flow on roadways under such dynamically changing traffic patterns. However, even in the CAV setting, significant coordination is needed to ensure that traffic is shaped in a manner that allows the seamless merger of the vehicle platoons in a safe manner. A. Safe Traffic Flow Consider the scenario of a platoon of vehicles in which the length of each vehicle is l units, and the maximum deceleration possible by a vehicle is amin . As illustrated in Figure 1, a safe operating point of this platoon would be to ensure that for any vehicle i, if the vehicle ahead of it, i − 1 were to stop instantaneously, then vehicle i must be able to come to a stop without hitting vehicle i − 1. This is a conservative approach, but provides a model under which collision-free operation can be deterministically guaranteed as long as the safety criterion is not violated. Fig. 1: The Eulerian view of two successive vehicles. Since the events of interest to us such as traffic merger requires that platoons be shaped at a particular location in space, we use the so-called Eulerian viewpoint of the platoon in which we specify the state by observing the system from a fixed location in space s, (as opposed to the Lagrangian viewpoint which does so by moving with the vehicle of interest and specifying state as a function of time t.) Thus, we use a fixed Cartesian coordinate system to indicate the position of each vehicle at each time. Assume that all vehicles are traveling at velocity v, and that vehicle i − 1 has just passed location s. Consider the scenario in which the distance between the vehicles i − 1 and i is d. The time-gap between the two vehicles, denoted as τ is the time required for vehicle i to just pass location s. The distance traveled by the vehicle i during this time interval is d + l. Determining the safe operating points in the system requires a kinematic model of the vehicles. For simplicity of exposition we use a so-called second order model of vehicular dynamics under which each vehicle can directly control its acceleration (within limits). Such a model does not account for the lag between the application of a control input and the desired acceleration actually being realized. However, it is relatively straightforward to extend the results that we present in this paper to a third order model that incorporates lag. Furthermore, since lag is a random variable that depends on individual vehicle dynamics and roadway conditions, the best option is often to develop controllers for 5.8 5.6 5.4 Traffic Shaping Region 5.2 6.5 5 6 5.5 4.8 5 4.6 Merged Platoon 6 Highway – Mainstream Platoon Time-gap (sec) 5.8 5.6 5.4 4.5 4.4 oad er R 5.2 4 C 4.8 3.5 1400 ubs m trea 0 160 d Fee 5 4.2 –S 0 155 1450 1500 1550 0 150 4.6 A 0 145 4.4 2.5 0 140 4.2 4 0 135 B 20 Upstream 1.5 0 5 1600 Fig. 3: Traffic shaping for smooth platoon merger. 3 2 oon Plat 10 15 20 Downstream Traffic Shaping Region 18 25 Velocity (m/sec) Velocity Profile Even Vehicles Odd Vehicles Fig. 2: Safety Region in terms of Time-Gap and Velocity. the second order model, and then study their performance using a third order model (with random lags) numerically. Let dmin be the smallest distance between the two vehicles such that we satisfy our safety requirement at velocity v. Then denoting the absolute value of the maximum possible deceleration of the vehicle by amin , the minimum distance for safe operation is dmin = v2 . 2amin (1) Assuming vehicle i has constant velocity v, the kinematic relation between v, τ and dmin is vτ = dmin + l, where τ is minimum time-gap required for safety. Then from (1) we have the relation between time-gap and velocity for safe operation as τ= v l + . 2amin v (2) B. Need for Traffic Shaping Figure 2 provides an illustration of the relationship derived above. The length of each vehicle, l is chosen as 6 m (and conservatively represents both the actual vehicle length plus the standstill spacing desired) and amin is chosen to be 4 m/s2 in this example. The x-axis represents the velocity v. The y-axis represents minimum time-gap τ achievable for each velocity. There is no control law that can safely operate (guarantee no collisions) outside of this convex region, i.e. the safe region is above the curve. However, there could be a control law that guarantees safe operation for points inside the safety region. Now, suppose that we have two platoons with different flow rates as in Figure 3. We refer to the existing platoon on the highway as the mainstream platoon, and the entering platoon from the feeder road as the substream platoon. We wish to merge these two asymmetric platoons, in which one vehicle from the substream enters for each pair of vehicles in the mainstream. Assume that the initial (upstream) operating point of the mainstream is at A = (v1 , τ1 ). Now, the minimum time-gap that can be supported in the merged Velocity (m/sec) 16 14 12 10 8 6 4 1400 1420 1440 1460 1480 1500 1520 1540 1560 1580 1600 Location (m) Fig. 4: Traffic shaping a platoon into sub-platoons of size two. platoon corresponds to the point B = (v2 , τ2 ). Suppose that the entering platoon from the feeder is already at v2 . In order to merge the two platoons, we need to first shape the mainstream into sub-platoons such that the velocity of all the vehicles is reduced to v2 , and the time-gaps between vehicles in each sub-platoon are selected appropriately to ensure that the merged platoon operates at point B = (v2 , τ2 ). Figure 4 provides an illustration of the above idea in which all vehicles of the mainstream platoon initially operate at point A = (v1 , τ1 ). The graph shows the desired velocity of every vehicle as a function of its location, and below that we provide a snapshot of how the vehicles are positioned in space at a particular time instant. As the vehicles of the mainstream platoon proceed along the highway (left to right in the figure), they are shaped into sub-platoons, each of size two. The lead vehicle of each sub-platoon (whose indices are even numbers) eventually operates at point C = (v2 , τ3 ), while the following vehicle in each sub-platoon (whose indices are odd numbers) operates at B = (v2 , τ2 ). Notice that by shaping the mainstream platoon in this manner, we have created the necessary spacings such that the substream platoon can be merged into the gaps created, with all vehicles in the merged platoon operating at point B = (v2 , τ2 ). The procedure for merging shaped platoons is relatively straightforward, and is not the focus of the paper. Our main goal is the design of a controller that can undertake traffic shaping of a single platoon. The shaping of a given platoon to attain a desired operating point requires the specification of the time-gap and velocity as a function of location, which we refer to as a to as a time-gap and velocity profile. As in the example above, these desired profiles could potentially be different for each vehicle, and need to be selected carefully so that they can be realized using a simple controller. In our example, even vehicles move from operating point A to C , while odd vehicles move from A to B. Hence, we require different desired time-gap profiles τi,des (s), based on whether the vehicle index is even or odd. Since the target velocity of vehicles is identical, the desired velocity profile, vdes (s) is the same for all of them. We will discuss how to design τi,des (s) and vdes (s) in detail in Section IV. C. Related Work There is much recent work on autonomous vehicle control. For instance, [1] designs spacing policies that could lead to higher roadway throughput or reduce the congestion. Most of these studies consider the Lagrangian viewpoint (i.e., from the perspective of a moving vehicle), and focus on the stability of traffic policies under a fixed spacing between vehicles (constant distance headway) or fixed time to collide with the preceding vehicle (constant time headway). For instance, the stability of a platoon under decreased time headway is studied in [2]–[4]. While [2], [3] focus on performance of constant time-headway policy, [4] states that variable time-headway policy outperforms previous one in terms of traffic flow. Distance-based spacing policies are studied in [5]–[8]. In [5] it is indicated that a distance-based spacing policy leads to higher throughput than time-headway policy, however, at the cost of more inter-vehicular communication. Constant distance headway is considered in [6], [7] , where the focus is on stability of either homogeneous or heterogeneous platoons of vehicles. In [8], it is proven that variable distance headway as a function of velocity leads to safer and higher throughput than constant time-headway. The above works are interested in traffic flows as a function of time, and do not study traffic shaping as a function of location. However, as we indicated in our motivating example, events such as lane drops and mergers require a platoon to be at a specific operating points at a particular location. The first work that we are aware of that considers the Eulerian viewpoint is [9], which introduces a constant time-gap policy. They show that a platoon following a constant time-gap policy can be string stable. In the context of platoon merger, [10], [11] propose communication-based solutions to create gaps in a platoon into which another platoon maybe merged. However, stability is not guaranteed through their communication process. The goal of the above work is to maintain constant headways in a platoon, which implies a fixed flow rate, and only allows change of the operating point along the velocity axis in Figure 2. Thus, none of the above-mentioned articles provide results on shaping traffic along the roadway to create variable gaps as a function of location that we desire. D. Main Results Our paper has two main contributions. The first is the design of a string-stable controller that is capable of tracking a multi-dimensional target profile (both time-gap and velocity) at each vehicle. The technique that we use to obtain the controller is based on feedback linearization [12], and the controller itself can be considered as a generalization of the one presented in [9] in a high level sense, wherein space (not time) is used as the independent variable. As mentioned above, the basis for such design is the Eulerian view of the system that permits us to connect the safety of flows (which must hold at all locations) with the idea of changing flows via traffic shaping (also as a function of location). We show that each vehicle is able to track the desired profile, and that the platoon as a whole is string stable. Our second contribution is in determining the nature of the feasible traffic profile under safety constraints. We use the context of traffic shaping for platoon merging, where greater flow has to be supported after the merger. Further, the actual traffic shaping must happen is as short a distance as possible, since slowing down the vehicles far ahead of the merger point would cause increased travel times. Hence, we pose the problem of profile design as an optimization problem in which the traffic shaping region must be minimized subject to safety constraints, as well as the deceleration limits of the vehicles. We show how these boundary conditions imposed by safety considerations can be used in the design of time-gap and velocity profiles that can be attained by our controller. Finally, we use numerical simulations using our combination of profile and controller to illustrate how it is successful in attaining the desired traffic shaping. II. S YSTEM M ODEL AND C ONTROL L AW We now design a control law to attain a given time-gap and velocity profile. This section deals with the system model and controller design that is capable of tracking the desired target, while the next section will introduce a (modified) concept of string stability and conduct stability analysis. Consider an infinite platoon of homogenous vehicles. As described in the previous section, we consider a secondorder kinematic model of vehicles as opposed to a thirdorder model that includes lag such as that considered in [13], [14]. However, essentially the same approach would work for the for third-order model as well, although the resultant controller would be more complex and less intuitive. We begin with the basic second order kinematic equations dsi = vi (t), (3a) dt dvi = ui (t), (3b) dt where si (t) is location of ith vehicle at time t, vi (t) is velocity of the vehicle at time t and ui (t) is input to the vehicle i. The initial location of i starts from 0. Index i = 0 indicates the leading vehicle. Notice that time in the independent variable in the above model. Supposing that velocities are positive, it is possible to change the independent variable to location s as follows: dti 1 = , (4a) ds vi (s) ui (s) dvi = , ds vi (s) (4b) where ti (s) is the time instant when vehicle i passes location s. Therefore, the time-gap between two vehicles is ti (s) − ti−1 (s). For the infinite platoon described above, the lead vehicle (i = 0) needs to only track a given velocity profile. However, other vehicles have to track the velocity profile as well as their time-gap profile. We can define the state of each vehicle in terms of the errors that it sees between the desired targets and the actual value. Then, considering (4), we define two tracking error terms for each vehicle as follows: ei (s) = 1 1 − , vi (s) vdes (s) ∆i (s) = ti (s) − ti−1 (s) − τi,des (s), (5a) (5b) where vdes (s) is the desired velocity profile and τi,des (s) is the desired time-gap profile. We make following assumption on the time-gap profile. Assumption 1: τi,des is twice continuously differentiable with respect to s. Effectively, each vehicle tracks its own time-gap profile. An appropriate pattern of time-gap tracking divides the platoon to sub-platoons. Therefore, there are sub-platoons with smaller time-gap followed by another identical subplatoon. Choosing the proper form will ensure string stability as will be discussed in the next section. Now, we will derive control laws for the lead vehicle and the following vehicles. Since there is no time-gap error for the lead vehicle, the dynamics for the lead vehicle is de0 u0 (s) ∂(1/vdes ) =− 3 . − ds v0 (s) ∂s (6) Applying feedback linearization [12] (i.e., choosing a control input such that the system is linearized) on the dynamics of the lead vehicle using control input   ∂(1/vdes ) , (7) u0 (s) = v03 pe0 (s) − ∂s where p > 0 leads to de0 (s) = −pe0 (s). (8) ds Hence, the dynamics of the lead vehicle is linear. For other vehicles, we need to differentiate the error term (5b) twice to obtain the input to the vehicles. Applying feedback linearization, the control input to such a following vehicle would be   d∆i ui−1 (s) ∂ 2 τi,des 3 ui (s) = vi (s) p0 ∆i + pa + 3 − , ds vi−1 (s) ∂s2 (9) where p0 > 0 and p1 > 0. With V2V/V2I communication it is possible to obtain information about the preceding vehicle. Thus, the the dynamics of a following vehicles is d2 ∆i d∆i = −p0 ∆i − p1 , 2 ds ds where p0 > 0 and p1 > 0. (10) Choosing ei (s) as the output of the each vehicle, ei (s) for following vehicles would be ei (s) = d∆i ∂τi,des + ei−1 (s) + , ds ∂s (11) ∂τ i,des 1 1 i since d∆ ds = vi − vi−1 − ∂s . Using the inputs in (7) and (9), the dynamics of the platoon would be de0 = −pe0 (s), (12a) ds d∆i d2 ∆i = −p0 ∆i (s) − p1 , (12b) ds ds d∆i ∂τi,des ei (s) = + ei−1 (s) + . (12c) ds ∂s where p > 0, p0 > 0 and p1 > 0. III. S TABILITY A NALYSIS In this section, we will prove the stability of our controllers. We have two notions of stability that will be required at an individual vehicle level (plant stability), and at the level of a string of vehicles (string stability). A second assumption on the time-gap profile will be required to show stability. ∂τi,des = 0. Assumption 2: lims→∞ ∂s A. Plant Stability Theorem 1: The unique equilibrium point of the dynamics defined in (12) is the origin (0 error). The equilibrium point is asymptotically stable if the parameters p, p0 and p1 are chosen to be positive. Proof: The proof is though induction over vehicles, since the error of each following vehicle i is dependent on vehicle i − 1 as given in (12). First, we start with the lead vehicle dynamics (12a), which is a first-order differential equation. Solving, the velocity tracking error of lead vehicle is: e0 (s) = e0 (0) exp(−ps), (13) for s > 0 ,and where e0 (0) = 1 v0 (0) − 1 vdes (0) . Therefore, lim e0 (s) = 0, s→∞ since p > 0. Thus, the error term of lead vehicle is asymptotically stable. Next, the solution to second-order equation (12b), which represents the dynamics of time-gap tracking error is ∆i (s) = Ai exp(r1 s) + Bi exp(r2 s), (14) where r1 and r2 are roots of characteristic function of (12b) p p −p1 + p21 − 4p0 −p1 − p21 − 4p0 , r2 = . (15) r1 = 2p1 2p1 Also, A and B are determined by initial conditions via Cramer’s rule as ∆i (0) 1 1 ∆i (0) d∆i (0) i (0) r2 r2 d∆ds ds A= ,B = , (16) 1 1 1 1 r1 r2 r1 r2 i (0) where ∆i (0) is ti (0) − ti−1 (0) − τi,des (0) and d∆ds = ∂τi,des (0) 1 1 − − . Hence, according to (14): vi (0) vi−1 (0) ∂s lim ∆i (s) = 0, s→∞ since <(r1 ), <(r2 ) < 0. Thus, ∆i of each vehicle is asymptotically stable. Finally, the error in tracking velocity of vehicle i is found by solving (12c). Applying induction on (12c), we obtain ei (s) = e0 (s) + r1 exp(r1 s) r2 exp(r2 s) i X Bj + j=1 i X Aj + j=1 i X j=1 ∂τj,des . ∂s (17) is string stable with ∂Tdes |. ∂s τ0 is initial time-gap between vehicles(τ0 = lims→−∞ τi,des (s)). Tdes (s) is a variable part of the time-gap profile and is assumed to be decreasing, twice continuously differentiable in s and lims→∞ ∂T∂sdes = 0. Proof: Consider the dynamics in (12) with p > 0, i (0) p0 > 0 and p1 > 0, initial conditions of ∆i (0) = d∆ds = 0, and velocity tracking error e0 (s) for the leading vehicle. For all s ≥ 0, the errors ei (s) of following vehicles would satisfy η=| ∂Tdes |. ∂s In order to prove (20), consider the (12c) and |ei (s)| ≤ |e0 (s)| + | Now, e0 (s) is asymptotically stable, as proven in (13). The second and third terms also go to 0 as s → ∞, since <(r1 ), <(r2 ) < 0. Further, from Assumption 2, τi,des (s), ∂τi,des = 0. Hence, lims→∞ ∂s lim ei (s) = 0, s→∞ kei (0)k∞ < δ ⇒ sup kei (.) + ηk∞ < , (18) i where η is constant. In the above definition, κ is an upper bound on acceptable velocity tracking error. The definition indicates that if an error occurs in one of the vehicles, will not amplify by more than η. Theorem 2: The platoon of vehicles with dynamics (12) and τi,des (s) = τ0 + (−1)i Tdes (s) (19) (21) i ∂Tdes X (−1)j . ∂s j=1 (22) Thus, by induction we have which shows that ei (s) is asymptotically stable. In the previous subsection, we proved plant stability, meaning that each vehicle is able to track desired velocity and time-gap profiles. However, we need to guarantee that an error that occurs in one of the vehicles does not amplify unboundedly through the entire platoon. This system is supposed to track both velocity and timegap profiles. Therefore, string stability must be studied for both velocity tracking error and time-gap tracking error. According to (12b), the error of time-gap tracking is decoupled, i.e. there is no effect of proceeding vehicle on the vehicle. Therefore, any error that occurs at any vehicle regarding time-gap tracking, would not propagate through the whole platoon. Further, since each vehicle is asymptotically stable in terms of ∆i , this error term would damp in each vehicle. Hence, in terms of time-gap tracking error, the dynamics of (12) is string stable in the notion of [15]. However, as is obvious from (12c), the preceding vehicle affects the behavior of the following one. Thus, the system is not decoupled in terms of velocity tracking error. The definition of string stability in this study is that errors should not be amplified unboundedly. Hence, we require that given any  > 0, there exists a δ > 0 such that ∂Tdes . ∂s e1 (s) = e0 (s) + ei (s) = e0 (s) + B. String Stability (20) Pi Since sequence (−1)i is periodic, j=1 (−1)j is bounded by 1. Further, applying the triangle inequality on (22) yields the inequality (20). Hence, it is obvious that η in (18) is |e0 (s)| + | ∂T∂sdes |, which means that η = | ∂T∂sdes |. Consequently, the dynamics in (12) is string stable in terms of both errors of tracking the velocity and time-gap profiles. IV. P ROFILE D ESIGN In this section our objective is to design time-gap and velocity profiles that will be used as inputs to the control laws derived in Section II. There are three conditions that must be satisfied during the design process. First, the traffic shaping procedure must be undertaken in the smallest length of roadway, since this would allow for vehicles to travel at the (high) initial velocity for the longest distance, and hence minimize the travel time. Second, the deceleration required of the vehicles must remain bounded by the maximum acceptable value. Finally, the time-gaps and velocities of each vehicle at any location must lie in safety region shown in Figure 2. Time-Gap Profiles Our first problem is to design a time-gap profile that is simple (has few parameters over which to optimize), and satisfies Assumption 1 and Assumption 2. Our choice in this study is the logistic function. Hence, the desired time-gap profiles based on general form given in (19) are τi,des (s) = τ0 + (−1)i (α + β tanh(γs)), (23) where γ > 0 and α and β are to be chosen based on the desired initial and final value of time-gaps and the kinematic constraints. The initial value of time-gap profile is lims→−∞ τi,des (s), which is τ0 , and final value is 3.6 3.6 20 3.4 3.4 18 Even Vehicles Odd Vehicles 3.2 Even Vehicles Odd Vehicles 3.2 16 3 3 2.8 2.8 t (sec) 14 2.6 2.6 12 2.4 2.4 2.2 2.2 10 2 2 8 1.8 1.6 1400 1.8 1420 1440 1460 1480 1500 1520 1540 1560 1580 1600 6 1400 1420 1440 1460 1480 1500 1520 1540 1560 1580 1.6 1400 1600 1420 1440 1460 1480 1500 1520 1540 1560 1580 1600 Location (m) Fig. 5: Time-Gap Profile v.s. Location Fig. 6: Velocity Profile v.s. Location lims→∞ τi,des (s). For instance, if τodd,end is final value of time-gap of odd vehicles, α and β would be: τ0 − τodd,end . (24) 2 The parameter γ determines the maximum slope of the logistic function. In our platooning scenario, a larger slope intuitively implies a shorter distance required for traffic shaping. However, we cannot choose γ arbitrarily large, since that would impact the maximum deceleration required of the vehicles. In order to understand this intuition precisely, we first need to determine the impact of the time-gap profile choice on the velocity profile. α=β= Velocity Profile The velocity profile must be designed jointly with the time-gap profile so as to ensure that vehicles are within the safe region of operation (see Figure 2) at all times. Now, the odd vehicles are the ones that operate on the boundary of the safe region (the operating point for odd vehicles goes from point A to B in Figure 2). Hence, we design the velocity profile of odd vehicles in a manner that they operate on the boundary of the safe region as specified by (2). Thus, from (2), the velocity profile of odd vehicles as a function of timegap is vodd (s) =   q τodd,des (s)amin + (τodd,des (s)amin )2 − 2lamin , (25) where τodd,des (s) is the time-gap profile for odd vehicles as determined from (23). We next find the velocity profile of even vehicles, which is the same as the lead vehicle desired velocity profile vdes (s) (since the lead vehicle is even). To determine the velocity profile, we consider (12c) in which we set all the error terms equal to zero (since profile design is under the assumption i of ideal operation). Thus, we set d∆ ds = ei−1 (s) = 0. Hence, from (5a) vdes (s) = veven (s) = vodd (s) . 1 − vodd (s) ∂T∂sdes (26) Optimization Problem Now that we have candidate time-gap profiles and the corresponding safe velocity profiles, we have to determine Fig. 7: Realized Time-Gap Profiles. the value of γ so that the deceleration process occurs in as small as possible distance, while ensuring that deceleration remains bounded. The following optimization problem may be used to determine the value of γ: maximize γ s.t. min aeven ≥ amin min aodd ≥ amin (27) γ > 0. Since the constraints above are in the form of bounds on acceleration, we need to determine the acceleration requirements imposed by the candidate velocity profile (26). The relation between velocity and acceleration is easily determined via the chain rule as ∂v ∂s ∂v ∂v = =v . ∂t ∂s ∂t ∂s The equation above holds for both odd and even vehicles. Thus, we can find aodd and aeven by substituting for odd and even vehicles using (25) and (26), respectively. Now that we have a well defined set of constraints, we solve the optimization problem numerically. Once we determine γ, we immediately have the time-gap profile τi,des (s). We then use (25) to yield the odd vehicle velocity profile vodd (s). Finally, we find vdes (s) = veven (s) using (26). V. E VALUATION We now perform numerical simulations to evaluate the performance of the proposed controller according to designed profiles. We use the example of traffic shaping of a platoon of vehicles in the manner described in Section I. We recall that the objective in that example was to reduce the operating velocity of the mainstream vehicles, while adjusting their time-gaps appropriately to allow for the merger with another substream platoon. Thus, we desire to shape the mainstream platoon into sub-platoons with a smaller time-gap between members of each sub-platoon, and larger time-gaps between each sub-platoon. We choose τ0 = 2.6sec, which is 1.5 time of minimum of time-gap in Figure 2. τodd,end = 1.74sec is the minimum time-gap supported by merged platoon on the highway. Under these targets, α and β in (24) would be 2.17 and 0.43, respectively. Finally, to determine parameter γ, we solve the Vehicle Input 0 20 1600 Even Vehicles Odd Vehicles Even Vehicles Odd Vehicles 1580 -0.5 18 1560 -1 1540 14 12 -1.5 Location (m) Velocity (m/sec) 2 Acceleration (m/sec ) 16 -2 -2.5 1520 1500 1480 1460 10 -3 1440 8 6 1400 -3.5 1420 1440 1460 1480 1500 1520 1540 1560 1580 1600 Location (m) Fig. 8: Velocity of Two Successive Vehicles. The pattern is periodic. -4 1400 1420 1420 1440 1460 1480 1500 1520 1540 1560 1580 1400 75 1600 80 85 90 95 Location (m) Fig. 9: Acceleration of Odd and Even Vehicles optimization problem of (27) numerically. The optimal value of γ is 0.057. Figure 5 illustrates the time-gap of each vehicle at each location (τi,des (s)), while Figure 6 shows the velocity profile (vdes (s)). Figure 8 shows the realized velocity profiles of odd and even vehicles.vehicles along the road. The figure indicates tha even vehicles are track the desired velocity profile shown in Figure 6 accurately. However, odd vehicles show some amount of error while decelerating. This observation is consistent with (12c), which indicates that odd vehicles have an error of ∂τ ∂s in tracking the desired velocity profile. All vehicles eventually converge to an identical velocity downstream. The acceleration of all vehicles are in the desired bounded range at all locations as seen in Figure 9. The acceleration of odd and even vehicles follow different profiles, consistent with their tracking different time-gap profiles as well as experiencing errors in velocity tracking in the case of odd vehicles. Figure 10 shows the trajectories of vehicles as a function of time. As the figure indicates, the uniform spacing across vehicles in the platoon (bottom of figure) gradually gives way to sub-platoons of size two (top of figure). We see that the density of vehicles at a sub-platoon level (as indicated by their spacing) increases, while the velocity of each vehicle decreases simultaneously. Finally, Figure 11 indicates that the traffic shaping operation occurs in the safe region operation, since the time-gap and velocity of all vehicles remain above the curve at all locations. 105 110 115 120 Fig. 10: Trajectories of all Vehicles in the Platoon 6.5 Even Vehicles Odd Vehicles Capacity Region 6 5.5 5 Time-Gap (sec) Figure 7 illustrates the time-gap tracking performance of the controller as a function of its location. There are two plots shown in this figure. On the one hand, the decreasing plot is associated with odd vehicles, showing that they reduce the time-gaps and approach closer to the vehicle in front. On the other hand, the increasing time-gap plot shows the time-gap of even vehicles, and indicates the creation of subplatoons. Comparison of the realized time-gaps of vehicles in Figure 7 with the desired time-gap profiles in Figure 5 indicates precise tracking is achieved. 100 Time (sec) 4.5 4 C 3.5 3 A 2.5 2 B 1.5 0 5 10 15 20 25 Velocity (m/sec) Fig. 11: Operation of controller in the safe region VI. D ISCUSSION Merging two strings of vehicles is the motivation of this study as mentioned previously. There is an issue of providing gaps in between of vehicles and increasing the flow rate in order to prevent the shockwaves before merging. The proposed controller is capable of changing the distribution of vehicles in a string, which other controllers with constant time-gap or spacing policy are not. Thus, appending this controller with an appropriate merging policy could solve the automated merging problem. An appropriate merging scenario with the controller could be locating two strings with a time-gap shift. Considering a road with two lanes merging, if the leading vehicles of two strings maintain a time-gap of τ0 and the strings change their distribution before merging, it is possible to locate the subplatoons created to one platoon while merging. Therefore, after merging point there is a platoon of vehicles with higher flow rate and desired velocity. Besides, probable shockwaves are prevented, since all vehicles are tracking the velocity profile with respect to location. Consequently, this merging scenario shows the importance of the proposed controller. VII. C ONCLUSION In this work, we studied the problem of traffic shaping of a platoon of vehicles in terms of achieving a variable timegap and velocity as a function of location. The motivation for such shaping is to handle conditions of variable flow, such as two platoons merging due to a lane drop. Existing controllers have focussed primarily on fixed spacing or timegap regimes, which are not able to account for spatially changing flows. The controller that we designed is able to locally modify a platoon by increasing or decreasing its flow locally via variable time-gaps in a provably safe manner. In the example of platoon merger, it is thus able provide the necessary gaps to accomodate merging vehicles. Our approach involves defining system parameters over space, rather than time, and can be seen as an generalization using this approach for constant flow (fixed time-gap) problems. Our methodological contribution was to identify the conditions needed on the time-gap and velocity profile to ensure stability, and to design such profiles keeping in mind the safe operating region of the system. We showed that appropriately designed target profiles can be used to ensure that errors do not propagate unboundedly across vehicles, hence attaining a notion of string stability across the platoon. R EFERENCES [1] D. Swaroop and R. Huandra, “Intelligent cruise control system design based on a traffic flow specification,” Vehicle system dynamics, vol. 30, no. 5, pp. 319–344, 1998. [2] P. Y. Li and A. Shrivastava, “Traffic flow stability induced by constant time headway policy for adaptive cruise control vehicles,” Transportation Research Part C: Emerging Technologies, vol. 10, no. 4, pp. 275– 301, 2002. [3] D. Swaroop and K. Rajagopal, “A review of constant time headway policy for automatic vehicle following,” in Intelligent Transportation Systems, 2001. Proceedings. 2001 IEEE. IEEE, 2001, pp. 65–69. [4] J. Wang and R. Rajamani, “The impact of adaptive cruise control systems on highway safety and traffic flow,” Proceedings of the Institution of Mechanical Engineers, Part D: Journal of Automobile Engineering, vol. 218, no. 2, pp. 111–130, 2004. [5] D. Swaroop, J. Hedrick, C. Chien, and P. Ioannou, “A comparision of spacing and headway control laws for automatically controlled vehicles,” Vehicle System Dynamics, vol. 23, no. 1, pp. 597–625, 1994. [6] J. Hedrick, “Constant spacing strategies for platooning in automated highway systems,” 1999. [7] E. Shaw and J. K. Hedrick, “String stability analysis for heterogeneous vehicle strings,” in American Control Conference, 2007. ACC’07. IEEE, 2007, pp. 3118–3125. [8] J. Zhao, M. Oya, and A. El Kamel, “A safety spacing policy and its impact on highway traffic flow,” in Intelligent Vehicles Symposium, 2009 IEEE. IEEE, 2009, pp. 960–965. [9] B. Besselink and K. Johansson, “Control of platoons of heavy-duty vehicles using a delay-based spacing policy this research is funded by the fp7 programme of the european union through the project companion.” IFAC-PapersOnLine, vol. 48, no. 12, pp. 364–369, 2015. [10] M. Suzuki, “Efficient communication for platooning and overtaking in intelligent transport systems,” 2013. [11] H. H. Bengtsson, L. Chen, A. Voronov, and C. Englund, “Interaction protocol for highway platoon merge,” in Intelligent Transportation Systems (ITSC), 2015 IEEE 18th International Conference on. IEEE, 2015, pp. 1971–1976. [12] H. K. Khalil, Noninear Systems. Prentice-Hall, New Jersey, 1996. [13] S. S. Stankovic, M. J. Stanojevic, and D. D. Siljak, “Decentralized overlapping control of a platoon of vehicles,” IEEE Transactions on Control Systems Technology, vol. 8, no. 5, pp. 816–832, 2000. [14] J. Ploeg, N. Van De Wouw, and H. Nijmeijer, “Lp string stability of cascaded systems: Application to vehicle platooning,” IEEE Transactions on Control Systems Technology, vol. 22, no. 2, pp. 786–793, 2014. [15] D. Swaroop and J. Hedrick, “String stability of interconnected systems,” IEEE transactions on automatic control, vol. 41, no. 3, pp. 349–357, 1996.
3cs.SY
IEEE Power and Energy Conference at Illinois (PECI), Champaign, IL, 2017. Power System Supplementary Damping Controllers in the Presence of Saturation arXiv:1705.09849v1 [cs.SY] 27 May 2017 M. Ehsan Raoufat, Student Member, IEEE, Kevin Tomsovic, Fellow, IEEE, Seddik M. Djouadi, Member, IEEE Abstract—This paper presents the analysis and a method to design supplementary damping controllers (SDCs) for synchronous generators considering the effects of saturation limits. Usually such saturations of control signals are imposed in order to enforce practical limitations such as component ratings. However, to guarantee the stability in the presence of saturation limits, the state trajectories must remain inside the domain of attraction (DA). In this paper, the domain of attraction of a single-machine infinite-bus (SMIB) power system with saturation nonlinearity is estimated and compared with the exact description of the null controllable region. Then, state-feedback controllers are designed to enlarge the DA. Our analysis shows that nonlinear effects of saturation should be considered to guarantee stability and satisfactory performance. Simulation results on a detailed nonlinear model of a synchronous generator indicate that the DA enlarges with the proposed controller. The results also indicate that Critical Clearing Time (CCT) and damping of the system with saturation can be improved by the proposed method. Index Terms—Power system stability, supplementary damping controller, saturation limits, domain of attraction. N OMENCLATURE δ ωs ωr H TM Eq0 Id , Iq D 0 Td0 Xl , Xt Xd , Xq Xd0 Ef d Vref Vt Vd , Vq V∞ Vs generator angle, in rad; synchronous and speed, in rad/s; normalized speed, in pu; inertia constant, in s; mechanical torque, in pu; q-axis transient voltage, in pu; d-axis and q-axis current, in pu; generator damping coefficient; in pu; d-axis time constant, in s; line and transformer reactance, in pu; d-axis and q-axis reactance of the generator, in pu; d-axis transient reactance of the generator, in pu; field voltage, in pu; reference voltage, in pu; generator terminal voltage, in pu; d-axis and q-axis voltage, in pu; infinite bus voltage, in pu; supplementary control input, in pu; This work was supported in part by the National Science Foundation under grant No CNS-1239366, and in part by the Engineering Research Center Program of the National Science Foundation and the Department of Energy under NSF Award Number EEC-1041877 and the CURENT Industry Partnership Program. M. Ehsan Raoufat, Kevin Tomsovic and Seddik M. Djouadi are with the Min H. Kao Department of Electrical Engineering and Computer Science, The University of Tennessee, Knoxville, TN 37996 USA (e-mail: [email protected]). 978-1-5090-5550-0/17/$31.00 c 2017 IEEE KA TA KD KS excitation gain; excitation time constant, in s; damping coefficient, in pu/(rad/s); synchronizing coefficient, in pu/rad; I. I NTRODUCTION One of the most common instability problems in power system is low frequency electromechanical oscillations, which may grow and result in loss of synchronization under certain conditions [1]. Supplementary damping controllers (SDCs) based on wide-area measurements [2] can be used to damp these oscillations. Multiple approaches have been proposed in literature to design SDCs for power system components, including traditional synchronous generators [3]–[6], modern FACTS devices [7], [8], energy storage systems [9] and renewable resources [10]. These efforts generally do not consider the nonlinear effects of hard saturation limits on control signals. Moreover, new generation sources connected to the grid through inverters, such as, photovoltaics, have the ability to provide damping signals but only within a narrow range dependent on operating conditions. It is critical to consider these actuator constraints for such components. Moreover, the actuator saturation effect is also a common phenomenon in other fields including saturation of robotic actuators or modulation signals of power converters [11]–[14]. In this work, saturation, or a hard limit, is considered for the control signals. Note this is different from the traditional magnetic saturation of generators but instead reflects the practical limitations of equipment ratings and can be expressed using hard saturation limits restricting the amplitude of the controller output. These limits can be considered in the excitation to prevent undesirable tripping initiated by over-excitation or under-excitation of generators [15]. In case of generator SDCs, saturation limits should be considered in the supplementary control input signal and are usually in the range of ±0.05 to ±0.1 per unit which guarantee a modest level of contribution [16]. These limits allow an acceptable control range to provide adequate damping while preventing tripping of the equipment protection. Moreover, this may minimize the negative effects of SDCs on the voltage regulatory response. There exists a large body of work in the control literature on stability analysis of systems with input constraints [17]– [20]. However, the effects of saturation have not been taken into account in previous works for analyzing and designing SDCs [3]–[9]. This paper also extends the work reported in [21] and [22] in which the nonlinear effects of saturation on stability has not been considered. Saturation can negatively impact the performance of SDC since this restriction can limit the control effort available to damp the oscillation and consequently decreases the damping or leads to instability. The main goal in this paper is to propose a new method to design SDCs which results in a larger domain of attraction (DA) in the presence of saturation. In this paper, the DA of a single-machine infinite-bus (SMIB) power system with saturation nonlinearity is estimated to guarantee a safety region of initial conditions (which may be caused by faults) and compared with exact description of the null controllable region. Then, state-feedback controllers are designed to enlarge the DA. In this way, the stability of the SMIB power system is guaranteed and saturation limits are represented in the analysis and design procedure. Our analysis shows that nonlinear effects of saturation should be considered to guarantee the stability and satisfactory performance. Moreover, enlargement of DA effectively enhances the Critical Clearing Time (CCT) and damping of the system with saturation can be improved by the proposed method. The rest of this paper is structured as follows: preliminaries on dynamic modeling of the SMIB power system with input saturation nonlinearity are described in Section II. Section III is devoted to optimal estimation of the DA for a power system with pre-designed state-feedback controller. For comparison purposes, exact description of the null controllable region of the SMIB power system is given in this section. An optimization method to design state-feedback controllers and to enlarge the DA is described in section IV. The results are compared through detailed nonlinear simulations. Concluding remarks are presented in section V. II. DYNAMIC M ODEL OF P OWER S YSTEM In this study, a SMIB power system model is considered. However, the analysis can be extended to cases of SMIB power system with FACTS devices. As shown in Fig. 1, this system consists of a synchronous generator connected through two transmission lines to an infinite bus that represents an approximation of a large system. A flux-decay model of the synchronous generator equipped with a fast excitation system can be represented by the following set of dynamic equations: δ̇ = ωs (ωr − 1) (1)  1  TM − Eq0 Iq + (Xq − Xd0 )Id Iq +Dωs (ωr − 1) (2) ω˙r = 2H  1  Ėq0 = − 0 Eq0 + (Xd − Xd0 )Id − Ef d (3) Td0  KA  Ef d Ėf d = − + Vref − Vt + sat(Vs ) (4) TA TA while satisfying the following algebraic equations: Re Iq + Xe Id − Vq + V∞ cos(δ) = 0 Re Id − Xe Iq − Vd + V∞ sin(δ) = 0 q Vt = Vd2 + Vq2 (5) (6) (7) where Re and Xe = Xt + are the total external resistance and reactance, respectively. One of the nonlinearities 1 2 Xl Fig. 1. A single-machine infinite-bus power system. associated with the above model is due to the hard saturation limit considered on the supplementary control input of the exciter. In this work, the hard limit is defined as: (8) sat(Vs ) = sign(Vs ) min{m, |Vs |} m= Vsmax = −Vsmin (9) where the nonlinearity is assumed to be symmetric and ±m are the saturation limits. To design a SDC and study the effects of saturation, the above nonlinear model can be linearized around the nominal operating point and expressed in the following state-space representation: (10) ẋ(t) = Ax(t) + Bsat(Vs ) where  x = ∆δ  ∆ωr 0  K1  − 2H A=  − K4 0  Td0 KA K5 − TA ∆Eq0 ∆Ef0 d T ωs 0 s − Dω 2H K2 − 2H 0 0 − K31T 0 d0 − KTAAK6 0   0       0   , B =  0  (11)  0  1  0    Td0 KA 1 − TA TA and K1 –K6 are the well-known linearization constants presented in Appendix A [23]. Although the large gain of the excitation system KA can reduce the generator terminal voltage fluctuations, it can also introduce negative damping torque to the system at times sufficient to result in instability. To increase the guaranteed region of stability, the DA for this unstable system with saturated feedback controller should be optimized. III. E STIMATION OF THE D OMAIN OF ATTRACTION In this section, we address the problem of estimating the DA for a system with actuator constraint and a pre-designed state-feedback law. Consider the system of equations (10) with unstable matrix A ∈ <n×n and state-feedback control law defined by Vs = F x(t), the closed loop system can be expressed as follows: ẋ(t) = Ax(t) + Bsat(F x(t)) (12) where the DA with the above transition map of φ : (t, x0 ) → x(t) can be defined as  D := x0 ∈ <n : lim φ(t, x0 ) = 0 (13) t→+∞ Without saturation limits, the DA for stable A + BF is <n ; however in the presence of saturation, DA is a subset of <n and needs to be estimated. There are various methods to approximate the DA [17], [19]. In this paper, we follow the work in [20] to obtain the least conservative estimation based on the Lyapunov function. For a matrix P > 0 and η > 0, we can define the ellipsoid ε(P, η) representing the DA as follows:  ε(P, η) = x ∈ <n , x0 P x ≤ η (14) which is a contractive invariant set inside the DA. Each eigenvalue of P is related with the length of one axis. Since trace(P ) is the sum of its eigenvalues, its minimization leads to the largest ellipsoid having the same weight in all directions. This problem can be formulated indirectly as the following optimization. min S,W,Z,Mw subject to trace(MW )   MW I n >0 In W  W (A + BF )0 + (A + BF )W SB 0 − Z   W W F 0 − Z0 >0 FW − Z m2  BS − Z 0 <0 −2S (15) where S, W and MW are symmetric positive definite matrices and the ellipsoid ε(P, η) with P = W −1 is the estimated DA. In the above optimization, minimizing trace(MW ) implies the minimization of trace(P ) as the first constraint guarantees that P < MW . The second and third constraints guarantee asymptotic stability of saturated system via a quadratic Lyapunov function. Other size criteria such as maximization of the volume or other geometric characterization can also be considered. The estimated result can be compared with null controllable region C, which is defined as the region where there exists an admissible bounded control that can steer the system towards the origin. The null controllable region of an unstable system can be found using the following theorem [24]. Theorem: Consider the open loop system (10) with unstable matrix A and B that can be partitioned as follows:     A1 0 B1 A= , B= (16) 0 A2 B2 where A1 ∈ <n1 ×n1 is semi-stable and A2 ∈ <n2 ×n2 is an unstable subsystem. Then null controllable region of the system can be written as: C = <n 1 × C 2 (17) where C2 is the null controllable region of the unstable subsystem. Different cases can be considered to find the boundary of C2 ; however, in the case of second order subsystems where A2 has a pair of unstable complex eigenvalues +α ± jβ, C2 can be characterized as follows:   ∂C2 = ± e−A2 t (I + e−A2 Tp )−1 (I − e−A2 Tp )   −1 −A2 t − (I − e ) mA2 B2 : t ∈ [0, Tp ) (18) where Tp = πβ and ∂C2 is the boundary of the null controllable region of the second subsystem. Example: Throughout this paper, the SMIB power system is considered to demonstrate the idea and verify the resulting improvement. Parameters of the machine, excitation system, transformer and transmission lines are: V∞ = 1.056 0◦ , Xt = 0.1, Xl = 0.8, Re = 0, Xd = 2.5, Xq = 2.1, Xd0 = 0.39, Vt = 16 15◦ , 0 Td0 H = 3.2, D = 0, = 9.6, TA = 0.02, KA = 100, Vsmax = ωs min −Vs = 377, = 0.05, Eigenvalue analysis shows that the open loop system has unstable complex eigenvalues of +0.2423 ± 7.6064i with frequency of 1.21 Hz and damping of −3.18%. The fault considered in this paper is a three-phase fault to ground at bus 2 which is applied at t = 0.1s with fault duration of tf and cleared without line tripping. The CCT can be defined as the maximum allowable time to clear the fault such that system remains stable and gives information regarding the fault ridethrough capability of the generator. First without considering the saturation, a state-feedback controller is designed using the LQR method [25] to minimize the following quadratic performance index: Z 1 ∞ T (x Qx + uT Ru)dt (19) J= 2 0 where Q is a positive semi-definite weighted matrix related to state cost and R is a positive definite weighted matrix related to the control cost. The parameters of the LQR controller are chosen to be Q = I4×4 and R = 0.1 and the controller gain can be obtained as follows:   FLQR = −0.7047 9.4825 −3.9325 −3.1523 (20) In the practice, these controllers can be implemented based on dynamic state estimation using PMU measurements [26]– [29]. The largest guaranteed DA of the SMIB system with the above LQR controller can now be estimated from (15). The ellipsoidal DA is given as DLQR = ε(P, 1) with:   1.1072 −0.0679 1.2368 2.5003×10−4    −0.0679 2844.6 −46.7344 −0.0036   (21) P =  1.2368 −46.7344 19.6725 0.0014    2.5×10−4 −0.0036 0.0014 9.4678×10−4 Using the canonical state-space transformation z = T x [30], the linear system of equation (10) can be transformed to canonical form and then partitioned as stable and unstable parts similar to (16). Fig. 2 compares cuts of the guaranteed DA of the closed loop system with LQR controller and the null controllable region in the presence of saturation. Using nonlinear simulations, the system with LQR controller has a CCT of 0.081 s. Fig. 3 shows the estimated DA and the extremal trajectory of the nonlinear SMIB system, which demonstrates the accuracy of estimated DA. In the next section, the optimization problem will be modified to design 0.04 0.03 0.02 0.01 0 -0.01 -0.02 -0.03 -0.04 -1.5 -1 -0.5 0 0.5 1 1.5 Fig. 3. Boundary of estimated DA and trajectory of nonlinear SMIB system with LQR controller and critical fault duration of CCT = 0.081s. Fig. 2. Boundary of null controllable region (∂C) and estimated DA for LQR controller (DLQR ) in the presence of saturation. a state-feedback controller to expand the domain of attraction toward the null controllable region. IV. E NLARGING THE D OMAIN OF ATTRACTION U SING S TATE -F EEDBACK C ONTROLLER In general, size of the DA depends on the feedback controller and the system constraints, such as, saturation limits. Consequently, the choice of an optimization criterion should include the controller design F in order to enlarge the guaranteed DA. This formulation will introduce bilinear terms of a variable associated with the quadratic Lyapunov function W = P −1 and the controller matrix F . By introducing an axillary variable Y = F W , this problem can be transformed into an LMI problem, namely: min S,W,Y,Z,MW subject to trace(MW )   MW I n >0 In W  W A0 + AW + BY + Y 0 B 0 SB 0 − Z   W Y 0 − Z0 >0 Y −Z m2  BS − Z 0 <0 −2S W A0 + AW + (Y 0 Γj+ + Z 0 Γj− )B 0 + B(Γj+ Y + Γj− Z) + 2α1 W < 0 W A0 + AW + (Y 0 Γj+ + Z 0 Γj− )B 0 + B(Γj+ Y + Γj− Z) + 2α2 W > 0 (22) where controller matrix F can be obtained from F = Y W −1 . Matrices Γ+ and Γ− ∈ <m×m are diagonal matrices whose diagonal elements take the value 1 or 0, and Γ− + Γ+ = Im where j = 1, . . . , 2m . For a single input system, these matrices can be either 0 or 1. The last two inequalities in optimization (22) are to restrict the pole placement region to a strip of the complex plane between −α1 and −α2 to avoid high gains in the controller. Example (continued): Using the above optimization (22), a controller can be designed to enlarge the DA of the SMIB system. Assuming α1 = 0 and α2 = 80, the enlarged DA is obtained as DEnl = ε(P, 1) with:   0.8411 0.6754 0.6719 0.0015   0.6754 2180.8 −27.7163 −0.0454   (23) P = 0.6719 −27.7163 0.9029 0.0018    0.0015 −0.0454 0.0018 3.7605×10−6 where the optimized state-feedback controller is:   FEnl = −3.3026 98.2739 −3.9459 −0.0081 (24) Fig. 4 illustrates the effectiveness of the proposed approach in designing the SDC, which results in a significantly larger DA toward the boundary of null controllable region ∂C for the closed loop system, in compared to the original LQR controller. Numerical simulations reveal that system with optimized state-feedback controller shows improvement in the CCT to 0.109 s. Fig. 5 depicts a cut of the enlarged DA and extremal trajectory of the nonlinear SMIB system with optimized controller, which demonstrates the satisfactory accuracy. Moreover, synchronizing and damping components of electrical torque can be used to compare the dynamic performance of the aforementioned controllers. The damping component (proportional to speed change) and the synchronizing component (proportional to angular change) are related to smallsignal and transient stability, respectively. The corresponding coefficients are defined according to the following equation: ∆Te = KD ωs ∆ωr + KS ∆δ (25) 1.04 Unstable system 1.03 1.02 1.01 1 0.99 0.98 0.97 0.96 0 1 2 3 4 5 6 7 8 Fig. 6. Comparison of transient responses for the system with fault duration of tf = 0.1s. 0.08 0.06 0.04 0.02 0 -0.02 Fig. 4. Boundary of null controllable region (∂C), estimated DA for LQR controller (DLQR ) and enlarged DA (DEnl ) in the presence of actuator saturation. -0.04 Unstable system -0.06 -0.08 0 1 2 3 4 5 6 7 8 Fig. 7. Comparison of supplementary control signals for system with fault duration of tf = 0.1s. TABLE I CCT AND C OEFFICIENT C OMPARISON FOR SMIB S YSTEM WITH D IFFERENT C ONTROLLERS . SDC type CCT KD KS Without controller 0.0 s -0.00242 pu/(rad/s) 1.0003 pu/rad LQR controller 0.081 s 0.00223 pu/(rad/s) 0.7078 pu/rad 0.109 s 0.00946 pu/(rad/s) 0.8091 pu/rad Optimized stateFig. 5. Comparison of estimated DA and trajectory of nonlinear SMIB system with LQR controller and critical fault duration of CCT = 0.109s. where values of parameters KD and KS are estimated using the breaking algorithm [31] based on the angle, speed and torque response of the nonlinear system with actuator saturation. As shown in Table I, the system with optimized controller has larger CCT, higher damping ratio and synchronization coefficient. Fig. 6 shows a comparison of the transient response of the closed loop system for a fault duration of tf = 0.1s in the presence of actuator saturation. It can be seen that the system with LQR controller will be unstable. However, the optimized state-feedback controller significantly improves the damping of the closed loop system. Fig. 7 shows that the proposed controller uses the full feasible control range of  min Vs , Vsmax to enlarge the DA and its performance is close to a bang-bang control law. feedback controller V. C ONCLUSIONS In this paper, a new approach to design supplementary damping controllers by taking into account the effects of saturation limits is introduced. The problem of determining the optimal estimation of DA for SMIB power in the presence of saturation on the control signal is considered. To increase the region of stability, state-feedback controllers are designed to enlarge the guaranteed DA. Consequently, the enlargement of the DA of the post-fault system effectively increases the CCT, which is an important measure of transient stability. Detailed dynamic simulation results demonstrate that the proposed controllers use the available control range to effectively enlarge the DA, improve the damping and enhance the stability in the presence of hard saturation. A PPENDIX A K constants in terms of system parameters can be summarized as follows: ∆e = Re2 + (Xd0 + Xe )(Xq + Xe )  1  K1 = − Iq V∞ (Xd0 − Xq ) (Xq + Xe ) sin(δ)−Re cos(δ) ∆e   + V∞ (Xd0 −Xq )Id −Eq0 (Xd0 +Xe ) cos(δ)+Re sin(δ)   1  Iq ∆e − Iq (Xq + Xe ) + Re Id (Xd0 −Xq )+Re Eq0 K2 = ∆e ∆e K3 = ∆e + (Xd − Xd0 )(Xq + Xe )   V∞ K4 = (Xd − Xd0 ) (Xq + Xe ) sin(δ) − Re cos(δ) ∆e 1  K5 = Vd Xq Re V∞ sin(δ) + Vd Xq V∞ (Xd0 + Xe ) cos(δ) ∆e Vt  + Vq Xd0 Re V∞ cos(δ) − Vq Xd0 V∞ (Xq + Xe ) sin(δ)  Vd 1  Vd Re Xq − Vd Xd0 (Xq + Xe ) + K6 = ∆e Vt Vt R EFERENCES [1] Y. Zhang, M. E. Raoufat, and K. Tomsovic, Remedial Action Schemes and Defense Systems, in Smart Grid Handbook, Wiley, Ltd, 2016. [2] D. Zhou et al., “Distributed data analytics platform for wide-area synchrophasor measurement systems,” IEEE Trans. on Smart Grid, vol. 7, pp. 2397-2405, 2016. [3] R. Yousefian and S. Kamalasadan, “Hybrid transient energy function based real-time optimal wide-area damping controller,” IEEE Trans. on Industry Applications, vol. PP, pp. 1-1, 2016. [4] F. Bai et al., “Design and implementation of a measurement-based adaptive wide-area damping controller considering time delays,” Electric Power Systems Research, vol. 130, pp. 1-9, 2016. [5] H. Liu et al., “ARMAX-based transfer function model identification using wide-area measurement for adaptive and coordinated damping control,” IEEE Trans. on Smart Grid, vol.PP, pp.1-1, 2015. [6] M. Mahmoudi, J. Dong, K. Tomsovic, and S. Djouadi, “Application of distributed control to mitigate disturbance propagations in large power networks,” North American Power Symposium (NAPS), 2015. [7] M. E. Raoufat, K. Tomsovic and S. M. Djouadi, “Virtual actuators for wide-area damping control of power systems,” IEEE Trans. on Power Systems, vol. 31, pp. 4703-4711, 2016. [8] S. Zhang and V. Vittal, “Design of wide-area power system damping controllers resilient to communication failures,” IEEE Trans. on Power Systems, vol. 28, pp. 4292-4300, 2013. [9] H. Silva-Saravia, H. Pulgar-Painemal, and J. Mauricio, “Flywheel energy storage model, control and location for improving stability: The Chilean case,” IEEE Trans. on Power Systems, vol.PP, pp.1-1, 2016. [10] R. Yousefian, R. Bhattarai and S. Kamalasadan, “Direct intelligent widearea damping controller for wind integrated power system,” IEEE Power and Energy Society General Meeting (PESGM), Boston, MA, 2016. [11] M. Aleenejad, H. Mahmoudi, and R. Ahmadi, “Unbalanced space vector modulation with fundamental phase shift compensation for faulty multilevel converters, IEEE Trans. on Power Electronics, vol. 31, pp. 7224-7233, 2016. [12] H. Mahmoudi, M. Aleenejad, and R. Ahmadi, “A new multiobjective modulated model predictive control method with adaptive objective prioritization,” IEEE Trans. on Industry Applications, vol. PP, pp. 11, 2016. [13] M. Aleenejad, H. Mahmoudi, R. Ahmadi, and H. Iman-Eini, “A new high switching frequency modulation technique to improve the DC link voltage utilization in multilevel converters” IEEE Trans. on Industrial Electronics, vol.PP, pp. 11, 2016. [14] X. Liu, A. R. Yazdanpanah, G. J. Mancini and J. Tan, “Control of a magnetic actuated robotic surgical camera system for single incision laparoscopic surgery,” 2015 IEEE International Conf. on Robotics and Biomimetics (ROBIO), pp. 1396-1402, 2015. [15] H. Aotsu, A. Isono, M. Goto, K. Kimura, Y. Momochi, T. Kai, S. Kitamura, A. Kaihara, and H. Okada, “Excitation control apparatus for a generator,” US4245182 A, 13-Jan-1981. [16] T. T. Nguyen and R. Gianto, “Optimal design for control coordination of power system stabilizers and flexible alternating current transmission system devices with controller saturation limits,” IET generation, transmission & distribution, vol. 4, pp. 1028-1043, 2010. [17] T. Hu and Z. Lin, Control Systems with Actuator Saturation: Analysis and Design. Birkhuser, Boston, USA: Springer, 2001. [18] T. Hu, Z. Lin, and B. M. Chen, “Analysis and design for discrete-time linear systems subject to actuator saturation,” Systems & Control Letters, vol. 45, pp. 97-112, 2002. [19] Y. Li and Z. Lin, “Stability and performance analysis of saturated systems via partitioning of the virtual input space,” Automatica, vol. 53, pp. 85-93, 2015. [20] S. Tarbouriech, G. Garcia, J. M. Gomes da Silva, and I. Queinnec, Stability and Stabilization of Linear Systems with Saturating Actuators. London, UK: Springer London, 2011. [21] M. E. Raoufat, K. Tomsovic and S. M. Djouadi, “Control allocation for wide-area coordinated damping,” 2017 IEEE Power and Energy Society General Meeting (PESGM), Chicago, IL, 2017. [22] M. E. Raoufat, K. Tomsovic and S. M. Djouadi, “Dynamic control allocation for damping of inter-area oscillations,” submitted to IEEE Trans. on Power Systems, 2016. [23] D. Mondal, A. Chakrabarti, and A. Sengupta, Power System Small Signal Stability Analysis and Control. London, UK: Academic Press, 2014. [24] T. Hu, Z. Lin, and L. Qiu, “An explicit description of null controllable regions of linear systems with saturating actuators,” Systems & Control Letters, vol. 47, pp. 65-78, 2002. [25] B. D. O. Anderson and J. B. Moore, Optimal Control-Linear Quadratic Methods. Upper Saddle River, NJ, USA: Prentice-Hall, 1989. [26] S. Akhlaghi, N. Zhou, and Z. Huang, “A multi-step adaptive interpolation approach to mitigating the impact of nonlinearity on dynamic state estimation,” IEEE Trans. on Smart Grid, vol. PP, pp. 1-1, 2016. [27] S. Akhlaghi, “Adaptive multi-step prediction based EKF to power system dynamic state estimation,” IEEE Power and Energy Conference at Illinois (PECI), Urbana, IL, 2017. [28] S. Akhlaghi, N. Zhou and Z. Huang, “Exploring adaptive interpolation to mitigate non-linear impact on estimating dynamic states,” IEEE Power & Energy Society General Meeting, Denver, CO, 2015. [29] J. Dong, X. Ma, S. M. Djouadi, H. Li and Y. Liu, “Frequency prediction of power systems in FNET based on state-space approach and uncertain basis functions,” IEEE Trans. on Power Systems, vol. 29, pp. 2602-2612, 2014. [30] T. Kailath, Linear Systems, Englewood Cliffs, NJ, USA: Prentice-Hall, 1980. [31] R. T. Alden and A. Shaltout, “Analysis of damping and synchronizing torques part I-A general calculation method,” IEEE Trans. on Power Apparatus and Systems, vol. 98, pp. 1696-1700, 1979.
3cs.SY
arXiv:1705.06366v2 [cs.LG] 31 May 2017 Automatic Goal Generation for Reinforcement Learning Agents David Held∗ Computer Science, UC Berkeley [email protected] Carlos Florensa∗ Computer Science, UC Berkeley [email protected] Xinyang Geng∗ Computer Science, UC Berkeley [email protected] Pieter Abbeel OpenAI Computer Science, UC Berkeley International Computer Science Institute (ICSI) [email protected] Abstract Reinforcement learning is a powerful technique to train an agent to perform a task. However, an agent that is trained using reinforcement learning is only capable of achieving the single task that is specified via its reward function. Such an approach does not scale well to settings in which an agent needs to perform a diverse set of tasks, such as navigating to varying positions in a room or moving objects to varying locations. Instead, we propose a method that allows an agent to automatically discover the range of tasks that it is capable of performing in its environment. We use a generator network to propose tasks for the agent to try to achieve, each task being specified as reaching a certain parametrized sub-set of the state-space. The generator network is optimized using adversarial training to produce tasks that are always at the appropriate level of difficulty for the agent. Our method thus automatically produces a curriculum of tasks for the agent to learn. We show that, by using this framework, an agent can efficiently and automatically learn to perform a wide set of tasks without requiring any prior knowledge of its environment. Our method can also learn to achieve tasks with sparse rewards, which traditionally pose significant challenges. 1 Introduction Reinforcement learning (RL) can be used to train an agent to perform a task by optimizing a reward function. Recently, a number of impressive results have been demonstrated by training agents using reinforcement learning: such agents have been trained to defeat a champion Go player (Silver et al., 2016), to outperform humans in 49 Atari games (Guo et al., 2016; Mnih et al., 2015), and to perform a variety of difficult robotics tasks (Lillicrap et al., 2015; Duan et al., 2016; Levine et al., 2016). In each of the above cases, the agent is trained to optimize a single reward function in order to learn to perform a single task. However, there are many real-world environments in which a robot will need to be able to perform not a single task but a diverse set of tasks, such as navigating to varying positions in a room or moving objects to varying locations. To automatically learn to achieve a diverse set of tasks, our algorithm allows an agent to generate its own reward functions, defined with respect to target sub-sets of the state space, called goals. Our method will propose different goals for the agent to try to reach, and then the agent will learn what actions are necessary to reach each ∗ Equal contribution. proposed goal. After multiple training iterations, the agent learns to reach a wide variety of goals in its state space. Specifically, our approach learns a policy that takes as input not only the current observation but also the goal (i.e. the parameters describing the target state set) currently to be achieved, similar to the universal value functions in Schaul et al. (2015). We consider the problem of maximizing the average success rate of our agent over all possible goals, where success is defined as the probability of successfully reaching each goal by the current policy. In order to efficiently maximize this objective, the algorithm must intelligently choose which goals to focus on at every training stage: goals should be feasible and at the appropriate level of difficulty for the current policy. We generate such goals using a Goal Generative Adversarial Network (Goal GAN), a variation of to the GANs introduced by Goodfellow et al. (2014). A goal discriminator is trained to evaluate whether a goal is feasible and at the appropriate level of difficulty for the current policy, and a goal generator is trained to generate goals that meet this criteria. We show that such a framework allows a policy to quickly learn to reach all feasible goals in its environment, with no prior knowledge about the environment or the tasks being performed. Our method automatically creates a curriculum, in which, at each step, the generator generates goals that are only slightly more difficult than the goals that the agent already knows how to achieve. Due to this curriculum, the policy is able to learn even with a sparse reward function, such as an indicator that rewards the agent for reaching the goal. In summary, our main contribution is a method for automatic curriculum generation that considerably improves the sampling efficiency of learning to reach all feasible goals in the environment. Learning to reach multiple goals is useful for multi-task settings such as navigation or manipulation, in which we want the agent to perform a wide range of tasks. Our method naturally handles sparse reward functions, without needing to manually modify the reward function for every task, based on prior task knowledge. Instead, our method dynamically modifies the probability distribution from which goals are sampled to ensure that the generated goals are always at the appropriate difficulty level, until the agent learns to reach all goals within the feasible goal space. 2 Related Work Intrinsic Motivation: Intrinsic motivation involves learning with an intrinsically specified objective (Schmidhuber, 1991, 2010). Recently there have been various formulations of intrinsic motivation, relating to optimizing surprise (Houthooft et al., 2016; Achiam & Sastry, 2016) or surrogates of state-visitation counts (Bellemare et al., 2016; Tang et al., 2016). All these approaches improve learning in sparse tasks where naive exploration performs poorly. However, these formulations do not have a notion of what states are hard for the learner and the intrinsic motivation is independent of the current performance of the agent. In contrast, our formulation of intrinsic motivation directly relates to our policy improvement: the agent is motivated to train on tasks that push the boundaries of its capabilities. Skill-learning: We are often interested in training an agent to perform a collection of tasks rather than a single one, like reaching different positions in the agent’s state-space. Skill learning is a common approach to this problem as it allows the agent to re-use skills, improving learning compared to training for every task from scratch. Discovering useful skills is a challenging task that has mostly been studied for discrete environments (Vigorito & Barto, 2010; Mnih et al., 2016) or for continuous tasks where demonstrations are provided (Konidaris et al., 2011; Ranchod et al., 2015). More recent work overcomes some of these limitations by training low-level modulated locomotor controllers (Heess et al., 2016), or multimodal policies with an information theoretic regularizer to learn a fixed-size set of skills (Florensa et al., 2017). Nevertheless, previous work usually sees the skills learning as a pre-training step from which useful primitives are obtained and can later be used to achieve other tasks. Hence, additional downstream training is required to properly compose the skills in a purposeful way. On the other hand, our approach directly trains policies that take as input the desired goals, enabling generalization to new desired (test) goals without the need for fine tuning. The problem that we are exploring has been referred to as “multi-task policy search” (Deisenroth et al., 2014) or “contextual policy search,” in which the task is viewed as the context for the policy (Deisenroth et al., 2013; Fabisch & Metzen, 2014). As opposed to the work of Deisenroth et al. (2014), our work uses a curriculum to perform efficient multi-task learning, even in sparse reward 2 settings. In contrast to Fabisch & Metzen (2014), which trains from a small number of discrete contexts / tasks, our method generates a training curriculum directly in continuous task space. Curriculum Learning: The increasing interest on training single agents to perform multiple tasks is leading to new developments on how to optimally present the tasks to the agent during learning. The idea of using a curriculum has been explored in many prior works on supervised learning (Bengio et al., 2009; Zaremba & Sutskever, 2014; Bengio et al., 2015). However, these curricula are usually hand-designed, using the expertise of the system designer. Another line of work takes into explicit consideration which examples are hard for the current learner and allows it to not consider them (Kumar et al., 2010; Jiang et al., 2015). However this has mainly been applied for supervised tasks and most curriculum learning in reinforcement learning still relies on fixed pre-specified sequences of tasks (Karpathy & Van De Panne, 2012). In contrast, we automatically create a curriculum with no prior knowledge by discovering which tasks are easy or difficult for a given policy. Other recent work has proposed using a given baseline performance for several tasks to gauge which tasks are the hardest and require more training (Sharma & Ravindran, 2017), but the framework can only handle a finite set of tasks and cannot handle sparse rewards. Our method trains a policy that generalizes to a set of continuously parameterized tasks and is shown to perform well even under sparse rewards by not allocating training effort to tasks that are too hard for the current performance of the agent. Finally, an interesting self-play strategy has recently been proposed that is concurrent to our work (Sukhbaatar et al., 2017), but, contrary to our approach that is designed to generate many training tasks at the right level of difficulty, the asymmetric component of their method could lead to biased exploration. Furthermore, they view their work as simply an exploration bonus for a single target task (and they evaluate their method accordingly); in contrast, we define a new problem of efficiently optimizing a policy across a range of goals, as we explain below. 3 3.1 Problem Definition Goal-parameterized Reward Functions In the traditional reinforcement learning framework, at each timestep t, the agent in state st ∈ S ⊆ Rn takes an action at ∈ A ⊆ Rm , according to some policy π(at | st ) that maps from the current state st to a probability distribution over actions. Taking this action causes the agent to enter into a new state st+1 according to a transition distribution p(st+1 |st , at ), and receive a reward rt = r(st , at , st+1 ). The objective of the agent is to find the policy π that maximizes the expected PT return, defined as the sum of rewards R = t=0 rt , where T is a maximal time given to perform the task. The learned policy corresponds to maximizing the expected return for a single reward function. In our framework, instead of learning to optimize a single reward function, we consider a range of reward functions rg indexed or parametrized by a goal g ∈ G. Each goal g corresponds to a set of states S g ⊂ S such that goal g is considered to be achieved when the agent is in any state st ∈ S g . Then the objective is to learn a policy that, given any goal g ∈ G, acts optimally with respect to rg . In this paper, we define a very simple reward function that measures whether the agent has reached the goal rg (st , at , st+1 ) = 1{st+1 ∈ S g } , (1) g where 1 is the indicator function. In our case, we use S = {st : d(f (st ), g) ≤ }, where f (·) is a function that projects a state into goal space G, d(·, ·) is a distance metric in goal space, and  is the acceptable tolerance that determines when the goal is reached. However, our method can handle generic sparse rewards (as in Eq. (1)) and does not require a distance metric for learning. Furthermore, we define our MDP such that each episode terminates when st ∈ S g . Thus, the return PT Rg = t=0 rtg is a binary random variable whose value indicates whether the agent has reached the set S g in at most T time-steps. Hence, the return of a trajectory s0 , s1 , . . . can be expressed ST as Rg = 1{ t=0 st ∈ S g }. Now, policies are also conditioned on the current goal g, written as π(at | st , g), and the expected return obtained when we take actions sampled from it can then be expressed as the probability of succeeding on each goal within T timesteps, as shown in Eq. (2). Rg (π) = Eπ(· | st ,g) 1{ T [ st ∈ S g } = P t=0 T [ t=0 3 st ∈ S g π, g  (2) The sparse indicator reward function of Eq. (1) is not only simple but also represents a property of many real-world goal states: in many settings, it may be difficult to tell whether the agent is getting closer to achieving a goal, but easy to tell when a goal has been achieved. For example, for a robot moving in a maze, taking actions that maximally reduce the straight-line distance from the start to the goal is usually not a feasible approach for reaching the goal, due to the presence of obstacles along the path. In theory, one could hand-engineer a meaningful distance function for each task that could be used to create a dense reward function. Instead, we use the indicator function of Eq. (1), which simply captures our objective by measuring whether the agent has reached the goal state. We show that our method is able to learn even with such sparse rewards. 3.2 Overall Objective We desire to find a policy π(at | st , g) that achieves a high reward for many goals g. We assume that there is a test distribution of goals pg (g) that we would like to perform well on. For simplicity, we assume that the test distribution samples goals uniformly from the set of goals G, although in practice any distribution can be used. The overall objective is then to find a policy π ∗ such that π ∗ (at | st , g) = arg max Eg∼pg (·) Rg (π) . π (3) Recall from Eq. (2) that Rg (π) is the probability of success for each goal g. Thus the objective of Eq. (3) measures the average probability of success over all goals sampled from pg (g). We refer to the objective in Eq. (3) as the coverage objective. 4 Method Our approach can be broken down into three parts: First, we label a set of goals based on whether they are at the appropriate level of difficulty for the current policy. Second, using these labeled goals, we construct and train a generator to output new goals that are at the appropriate level of difficulty. Finally, we use these new goals to efficiently train the policy, improving its coverage objective. We iterate through each of these steps until the policy converges. 4.1 Goal Labeling As shown in our experiments, sampling goals from pg (g) directly, and training our policy on each sampled goal may not be the most sample efficient way to optimize the coverage objective of Eq. (3). Instead, we modify the distribution from which we sample goals during training: we wish to find the set of goals g in the set Gi = {g : Rmin ≤ Rg (πi ) ≤ Rmax } ⊆ G. The justification for this is as follows: due to the sparsity of the reward function, for most goals g, the current policy πi (at iteration i) obtains no reward. Instead, we wish to train our policy on goals g for which πi is able to receive some minimum expected return Rg (πi ) > Rmin such that the agent receives enough reward signal for learning. On the other hand, if we only sample from goals for which Rg (πi ) > Rmin , we might sample repeatedly from a small set of already mastered goals. To force our policy to train on goals that still need improvement, we train on the set of goals g for which Rg (πi ) ≤ Rmax , where Rmax is a hyperparameter setting a maximum level of performance above which we prefer to concentrate on new goals. Thus, training our policy on goals in Gi allows us to efficiently maximize the coverage objective of Eq. (3). Note that from Eq. (2), Rmin and Rmax can be interpreted as a minimum and maximum probability of reaching a goal over T timesteps. Given a set of goals sampled from some distribution pdata (g), we wish to estimate a label yg ∈ {0, 1} for each goal g that indicates whether g ∈ Gi . To label a given goal, we empirically estimate g the expected return for this goal R̄ o of our current policy πi . The label n (πi ) by performing rollouts g for this goal is then set to yg = 1 Rmin ≤ R̄ (πi ) ≤ Rmax . In the next section we describe how we can generate more goals that also belong to Gi , in addition to the goals that we have labeled. 4.2 Adversarial Goal Generation In order to sample new goals g uniformly from Gi , we introduce an adversarial training procedure called ”goal GAN”, which is a modification of to the procedure used for training Generative 4 Adversarial Networks (GANs) (Goodfellow et al., 2014). The modification allows to train the generative model both with positive examples from the distribution we want to approximate, and negative examples sampled from a distribution that does not share support with the desired one. This improves the accuracy of the generative model despite being trained with very few positive samples. Other generative models like Stochastic Neural Networks (Tang & Salakhutdinov, 2013) don’t accept negative examples and don’t have the potential to scale up to higher dimensions as well as GAN approaches. In our particular application, we use a neural network G(z) known as the “goal generator” to generate goals g from a noise vector z. We train the goal generator to uniformly output goals in Gi , using a second network D(g) known as a “goal discriminator”. The goal discriminator is trained to distinguish goals that are in Gi from goals that are not in Gi . We optimize our goal generator and discriminator in a manner similar to the training procedure for the Least-Squares GAN (LSGAN) (Mao et al., 2016), but introducing the binary label yg indicating whether g ∈ Gi . We found that the LSGAN works better than other forms of GAN for our problem. We use a = -1, b = 1, and c = 0, as in Mao et al. (2016). i h min V (D) = Eg∼pdata (g) yg (D(g) − b)2 + (1 − yg )(D(g) − a)2 + Ez∼pz (z) [(D(G(z)) − a)2 ] D min V (G) = Ez∼pz (z) [D(G(z)) − c)2 ] (4) G Unlike in the original LSGAN paper (Mao et al., 2016), we have three terms in our value function V (D) rather than the original two. For goals g for which yg = 1, the second term disappears and we are left with only the first and third terms, which are identical to that of the original LSGAN framework. Viewed in this manner, the discriminator is trained to discriminate between goals from pdata (g) with a label yg = 1 and the generated goals G(z). Looking at the second term, our discriminator is also trained with “negative examples,” i.e. goals with a label yg = 0 which our generator should not generate. The generator is trained to “fool” the discriminator, i.e. to output goals that match the distribution of goals in pdata (g) for which yg = 1. 4.3 Policy Optimization Our full algorithm for training a policy Algorithm 1: Generative Goal Learning π(at | st , g) to maximize the coverage objective Input : Policy π0 in Eq. (3) is shown in Algorithm 1. At each iterOutput: Policy πN ation i, we generate a set of goals from our goal (G, D) ← initialize GAN() generator G(z). We use these goals to train our goalsold ← ∅ policy using reinforcement learning, with the for i ← 1 to N do reward function given by Eq. (1). The training z ← sample noise(pz (·)); can be done with any Reinforcement Learning goals ← G(z) ∪ sample(goalsold ); algorithm; in our case we use TRPO (Schulman πi ← update policy(goals, πi−1 ); et al., 2015) with GAE (Schulman et al., 2016). returns ← evaluate policy(goals, πi ); After training our policy, we evaluate our pollabels ← label goals(returns) icy’s performance on these goals; this perfor(G, D) ← mance is used to determine each goal’s label train GAN(goals, labels, G, D); yg , as described in Section 4.1. Next, we use goalsold ← update replay(goals) these labels to train our goal generator and our end goal discriminator, as described in Section 4.2. The generated goals from the previous iteration are used to compute the Monte Carlo estimate of the expectations with respect to the distribution pdata (g) in Eq. (4). By training on goals within Gi produced by the goal generator, our method efficiently finds a policy that optimizes the coverage objective. In addition to training our policy on the goals that were generated in the current iteration, we also save a list (“regularized replay buffer”) of goals that were generated during previous iterations and use these to train our policy as well, so that our policy does not forget how to achieve goals that it has previously learned. When we generate goals for our policy to train on, we sample two thirds of the goals from the Goal GAN and we sample the one third of the goals uniformly from the replay buffer. To prevent the replay buffer from concentrating in a small portion of goal space, we only insert new goals that are further away than  from the goals already in the buffer, where we chose the goal-space metric and  to be the same as the ones introduced in Section 3.1. 5 The algorithm described above naturally creates a curriculum for our policy. The goal generator generates goals in Gi , for which our policy obtains an intermediate level of return, and thus such goals are at the appropriate level of difficulty for our current policy πi . As our policy improves, the generator learns to generate goals in order of increasing difficulty. Hence, our method can be viewed as a way to automatically generate a curriculum of goals. However, the curriculum occurs as a by-product via our optimization, without requiring any prior knowledge of the environment or the tasks that the agent must perform. 4.4 Goal GAN Initialization In order to begin our training procedure, we need to initialize our goal generator to produce an initial set of goals. If we initialize the goal generator randomly (or if we initialize it to sample uniformly from the goal space), it is likely that, for most (or all) of the sampled goals, our initial policy would receives no reward due to the sparsity of the reward function. Thus we might have that all of our initial goals g have R̄g (π0 ) < Rmin , leading to very slow training. To avoid this problem, we initialize our goal generator to output a set of goals that our initial policy is likely to be able to achieve with R̄g (πi ) ≥ Rmin . To accomplish this, we run our initial policy π0 (at | st , g) with goals sampled uniformly from the goal space. We then observe the set of states S v that are visited by our initial policy. These are states that can be easily achieved with the initial policy, π0 , so the goals corresponding to such states will likely be contained within S0I . We then train the goal generator to produce goals that match the state-visitation distribution pv (g), defined as the uniform distribution over the set f (S v ). We can achieve this through traditional GAN training, with pdata (g) = pv (g). This initialization of the generator allows us to bootstrap the Goal GAN training process, and our policy is able to quickly improve its performance. 5 Experimental Results In this section we provide the experimental results to answer the following questions about our goal generation algorithm: • Does the automatic curriculum yield faster maximization of the coverage objective? • Does the Goal GAN dynamically shift to sample goals of the appropriate difficulty? • Does it scale to a higher-dimensional state-space with a low-dimensional space of feasible goals? To answer the first two questions, we demonstrate our method in a maze task where the goals are the (x, y) position of the Center of Mass (CoM) of a dynamically complex agent. Hence the feasible goal space is the interior of the maze, and we demonstrate how our goal generation can guide the agent around a turn in the maze. Then, we study how our method scales with the dimension of the state-space in an environment where the feasible region is kept of approximately constant volume in an embedding space that grows in dimension. For the implementation details refer to Appendices A.4 and A.5. Visualization of the learned policies are provided on our website 2 . We compare our Goal GAN method against three baselines. Uniform Sampling (baseline 3) is a method that does not use a curriculum at all, training at every iteration on goals uniformly sampled from the state-space. Many goals are unfeasible or too difficult for the current performance of the agent and hence no reward is received, making this method very sample-inefficient. To demonstrate that a straight-forward distance reward can be prone to local minima, Uniform Sampling with L2 loss (baseline 2) samples goals in the same fashion as baseline 3, but instead of the indicator reward that our method uses, it receives the negative L2 distance to the goal as a reward at every step. Finally, On-policy GAN (baseline 1) samples goals from a GAN that is constantly retrained using the state visitation distribution (as in Section 4.4). Finally, we also show the performance of using Rejection Sampling (oracle), where we sample goals uniformly from the feasible state-space and only keep them if they satisfy the criterion defined in Section 4.1. This method is orders of magnitude more expensive in terms of labeling, but serves to estimate an upper-bound for our method in terms of performance. 5.1 Ant Maze 2 https://sites.google.com/view/goalgeneration4rl 6 We test our method in the challenging environment of a complex robotic agent (Ant) navigating a U-shaped maze, as depicted in Fig. 1. Duan et al. (2016) describe the task of trying to reach the other end of the U-turn and they show that standard Reinforcement Learning methods are unable to solve it. We further extend the task to try to reach every point of the maze, still keeping the sparse indicator reward (here with  = 1). Our goal GAN method successfully learn how to cover most of the maze, including the other end. The goal space is two dimensional, allowing us to study the goals generated by the automatic curriculum and how it drives the training through the U-turn. The visualizations and the experimental results Figure 1: Ant Maze environwill help us answer the first two questions from the previous sec- ment tion. We first explore whether, by training on goals that are generated by our Goal GAN, we are able to improve our policy’s training efficiency, compared to the baselines described above. In Fig. 2 we see that our method leads to faster training compared to the baselines. Using the Goal GAN, we are always training our policy on goals that are at the appropriate level of difficulty, leading to more efficient learning. Interestingly, for this task our method is very close the oracle of rejection sampling. The On-policy GAN baseline is, in this environment, performing reasonably well because we inject high noise in the actions of the ant, making the current policy visit further and further regions. This baseline performs worse in other experiments presented in the supplementary material3 . The worse performing baseline is the one rewarding the L2 goal distance at every time-step, because the complex dynamics of the ant and the fact that goals are sampled all around make the optimization fall in the bad local optimal policy of not moving. The purpose of the Goal GAN is to always generate goals at the appropriate level of difficulty for the current policy, i.e. goals g for which Rmin ≤ R̄g (πi ) ≤ Rmax . We explore the difficulty of the generated goals in Fig. 3. Note that the goals in this figure include a mix of newly generated goals as well as goals from previous iterations that we use to prevent our policy from “forgetting.” It can be observed in these figures that the location of the generated goals shifts to different parts of the maze as the policy improves. The percentage of genFigure 2: Learning curves comparing the training efficiency erated goals that are at the appropriof our method and the baselines. The y-axis indicates the ate level of difficulty (“good goals”) average return over all goal positions in the maze, and the stays around 20% even as the policy x-axis shows the number of times that new goals have been improves. The Goal GAN learns to sampled. All plots are an average over 7 random seeds. generate goals at the appropriate locations based on the policy performance such that many of the generated goals are at the appropriate level of difficulty. The corresponding performance of the policy can be shown in Fig. 4. 5.2 N-dimensional Point Mass In most real-world reinforcement learning problems, the set of feasible states is a lower-dimensional subset of the full state space, defined by the constraints of the environment. For example, the kinematic constraints of a robot limit the set of feasible states that the robot can achieve. Therefore, uniformly sampling goals from the full state-space would yield very few achievable goals. In this section we use an N-dimensional Point Mass to explore this issue and demonstrate the performance of our method as the embedding dimension increases. 3 https://sites.google.com/view/goalgeneration4rl 7 (a) Iteration 5 (b) Iteration 90 (c) Iterartion 350 Figure 3: Goals sampled by the Goal GAN (same policy training as in Fig. 4). “High rewards” (in green) are goals with R̄g (πi ) ≥ Rmax ; “Good goals” (in blue) are those with the appropriate level of difficulty for the current policy (Rmin ≤ R̄g (πi ) ≤ Rmax ). The red ones have Rmin ≥ R̄g (πi ) (a) Iteration 5: Coverage = 0.20 (b) Iteration 90: Coverage = 0.48 (c) Iteration 350: Coverage = 0.71 Figure 4: Visualization of the policy performance for different parts of the state space (same policy training as in Fig. 3). For illustration purposes, the feasible state-space (i.e. the space within the maze) is divided into a grid, and a goal location is selected from the center of each grid cell. Each grid cell is colored according to the expected return achieved on this goal: Red indicates 100% success; blue indicates 0% success. In our experiments, the full state-space of the N -dimensional Point Mass is the hypercube [−5, 5]N . However, the Point Mass can only move within a small subset of this state space. In the twodimensional case, the set of feasible states corresponds to the [−5, 5] × [−1, 1] rectangle, making up 20% of the full space. For N > 2, the feasible space is the Cartesian product of this 2D strip with [−, ]N −2 , where  = 0.3. In this √ higher-dimensional environment, our agent receives a reward of 1 when it moves within N = 0.3 √N2 of the goal state, to account for the increase in average L2 distance between points in higher dimensions. The ratio of the volume of the embedded space to the volume of the full state space decreases as the state-dimension N increases, down to a ratio of 0.00023:1 for 6 dimensions. Figure 5: Goal coverage obtained on the N-dim point mass environment, for an increasing number of dimensions. Each policy is trained for the same number of total iterations. All plots are an average over 5 random seeds. 8 Fig. 5 shows the performance of our method compared to the baseline methods, as the number of dimensions increases. The uniform sampling baseline results in very poor performance as the number of dimensions increases. This is because the fraction of feasible states within the full state space decreases as the dimension increases. Thus, sampling uniformly results in sampling an increasing percentage of infeasible states as the dimension increases, leading to poor training. In contrast, the performance of our method does not decay as much as the state space dimension increases, because our Goal GAN always generates goals within the feasible portion of the state space, and at the appropriate level of difficulty. The On-policy GAN baseline suffers from the increase in dimension because it is not encouraged to keep exploring other parts of the space than the ones it has already visited. Finally, the oracle and the base- line with an L2 loss as reward have perfect performance, which is expected in this simple task where the optimal policy is just to go in a straight line towards the goal. 6 Conclusions and Future Work We propose a new paradigm in reinforcement learning where the objective is to train a single policy to succeed on a variety of goals, under sparse rewards. To solve this problem we develop a method for automatic curriculum generation that dynamically adapts to the current performance of the agent. The curriculum is obtained without any prior knowledge of the environment or of the tasks being performed. We use generative adversarial training to automatically generate goals for our policy that are always at the appropriate level of difficulty (i.e. not too hard and not too easy). We demonstrated that our method can be used to efficiently train a policy to reach a range of goal states, which can be useful for multi-task learning scenarios. References Achiam, Josh and Sastry, Shankar. Surprise-based intrinsic motivation for deep reinforcement learning. In 2016 Deep Reinforcement Learning Workshop at NIPS, 2016. Bellemare, Marc G, Srinivasan, Sriram, Ostrovski, Georg, Schaul, Tom, Saxton, David, and Munos, Remi. Unifying count-based exploration and intrinsic motivation. Advances in Neural Information Processing Systems, 2016. Bengio, Samy, Vinyals, Oriol, Jaitly, Navdeep, and Shazeer, Noam. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems 28, pp. 1171–1179. Curran Associates, Inc., 2015. Bengio, Yoshua, Louradour, Jérôme, Collobert, Ronan, and Weston, Jason. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009. Deisenroth, Marc Peter, Neumann, Gerhard, Peters, Jan, et al. A survey on policy search for robotics. Foundations and Trends in Robotics, 2(1–2):1–142, 2013. Deisenroth, Marc Peter, Englert, Peter, Peters, Jan, and Fox, Dieter. Multi-task policy search for robotics. In Robotics and Automation (ICRA), 2014 IEEE International Conference on, pp. 3876– 3881. IEEE, 2014. Duan, Yan, Chen, Xi, Houthooft, Rein, Schulman, John, and Abbeel, Pieter. Benchmarking deep reinforcement learning for continuous control. International Conference on Machine Learning (ICML), 2016. Fabisch, Alexander and Metzen, Jan Hendrik. Active contextual policy search. Journal of Machine Learning Research, 15(1):3371–3399, 2014. Florensa, Carlos, Duan, Yan, and Abbeel, Pieter. Stochastic neural networks for hierarchical reinforcement learning. In International Conference in Learning Representations, 2017. Goodfellow, Ian, Pouget-Abadie, Jean, Mirza, Mehdi, Xu, Bing, Warde-Farley, David, Ozair, Sherjil, Courville, Aaron, and Bengio, Yoshua. Generative adversarial networks. In Advances in neural information processing systems, pp. 2672–2680, 2014. Guo, Xiaoxiao, Singh, Satinder, Lewis, Richard, and Lee, Honglak. Deep learning for reward design to improve monte carlo tree search in atari games. Conference on Uncertainty in Artificial Intelligence (UAI), 2016. Heess, Nicolas, Wayne, Greg, Tassa, Yuval, Lillicrap, Timothy, Riedmiller, Martin, and Silver, David. Learning and transfer of modulated locomotor controllers. 2016, arXiv:1610.05182. Houthooft, Rein, Chen, Xi, Duan, Yan, Schulman, John, De Turck, Filip, and Abbeel, Pieter. Variational information maximizing exploration. Advances in Neural Information Processing Systems, 2016. 9 Jiang, Lu, Meng, Deyu, Zhao, Qian, Shan, Shiguang, and Hauptmann, Alexander G. Self-paced curriculum learning. In AAAI, volume 2, pp. 6, 2015. Karpathy, Andrej and Van De Panne, Michiel. Curriculum learning for motor skills. In Canadian Conference on Artificial Intelligence, pp. 325–330. Springer, 2012. Konidaris, George, Kuindersma, Scott, Grupen, Roderic A, and Barto, Andrew G. Autonomous skill acquisition on a mobile manipulator. In AAAI, 2011. Kumar, M. P., Packer, Benjamin, and Koller, Daphne. Self-paced learning for latent variable models. In Advances in Neural Information Processing Systems 23, pp. 1189–1197. 2010. Levine, Sergey, Finn, Chelsea, Darrell, Trevor, and Abbeel, Pieter. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 2016. Lillicrap, Timothy P, Hunt, Jonathan J, Pritzel, Alexander, Heess, Nicolas, Erez, Tom, Tassa, Yuval, Silver, David, and Wierstra, Daan. Continuous control with deep reinforcement learning. 2015, arXiv:1509.02971. Mao, Xudong, Li, Qing, Xie, Haoran, Lau, Raymond YK, Wang, Zhen, and Smolley, Stephen Paul. Least squares generative adversarial networks. 2016, arXiv:1611.04076. Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, Rusu, Andrei A, Veness, Joel, Bellemare, Marc G, Graves, Alex, Riedmiller, Martin, Fidjeland, Andreas K, Ostrovski, Georg, et al. Humanlevel control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. Mnih, Volodymyr, Agapiou, John, Osindero, Simon, Graves, Alex, Vinyals, Oriol, Kavukcuoglu, Koray, et al. Strategic attentive writer for learning macro-actions. 2016, arXiv:1606.04695. Ranchod, Pravesh, Rosman, Benjamin, and Konidaris, George. Nonparametric bayesian reward segmentation for skill discovery using inverse reinforcement learning. In International Conference on Intelligent Robots and Systems, pp. 471–477. IEEE, 2015. Schaul, Tom, Horgan, Daniel, Gregor, Karol, and Silver, David. Universal value function approximators. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1312–1320, 2015. Schmidhuber, Jürgen. Curious model-building control systems. In International Joint Conference on Neural Networks, pp. 1458–1463. IEEE, 1991. Schmidhuber, Jürgen. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). IEEE Transactions on Autonomous Mental Development, 2(3):230–247, 2010. Schulman, John, Levine, Sergey, Abbeel, Pieter, Jordan, Michael, and Moritz, Philipp. Trust region policy optimization. In Proceedings of The 32nd International Conference on Machine Learning, pp. 1889–1897, 2015. Schulman, John, Moritz, Philipp, Levine, Sergey, Jordan, Michael, and Abbeel, Pieter. Highdimensional continuous control using generalized advantage estimation. ICLR, 2016. Sharma, Sahil and Ravindran, Balaraman. Online Multi-Task Learning Using Biased Sampling. 2017, arXiv:1702.06053. Silver, David, Huang, Aja, Maddison, Chris J, Guez, Arthur, Sifre, Laurent, Van Den Driessche, George, Schrittwieser, Julian, Antonoglou, Ioannis, Panneershelvam, Veda, Lanctot, Marc, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016. Sukhbaatar, Sainbayar, Kostrikov, Ilya, Szlam, Arthur, and Fergus, Rob. Intrinsic Motivation and Automatic Curricula via Asymmetric Self-Play. 2017, arXiv:1703.05407. Tang, Haoran, Houthooft, Rein, Foote, Davis, Stooke, Adam, Chen, Xi, Duan, Yan, Schulman, John, Turck, Filip De, and Abbeel, Pieter. #exploration: A study of count-based exploration for deep reinforcement learning. CoRR, abs/1611.04717, 2016. 10 Tang, Yichuan and Salakhutdinov, Ruslan. Learning Stochastic Feedforward Neural Networks. Nips, 2:530–538, 2013. doi: 10.1.1.63.1777. Todorov, Emanuel, Erez, Tom, and Tassa, Yuval. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012. Vigorito, Christopher M and Barto, Andrew G. Intrinsically motivated hierarchical skill learning in structured environments. IEEE Transactions on Autonomous Mental Development, 2(2):132–143, 2010. Zaremba, Wojciech and Sutskever, Ilya. Learning to execute. CoRR, abs/1410.4615, 2014. A A.1 Implementation details Ant Maze Environment The environment is implemented in Mujoco (Todorov et al., 2012). The agent is constrained to move within the maze environment, which has dimensions of 6m x 6m. The full state-space has an area of size 10 m x 10 m, within which the maze is centered. To compute the coverage objective, goals are sampled from within the maze according to a uniform grid on the maze interior. For each goal, we estimate the empirical return with three rollouts. The maximum time-steps given to reach the current goal are 400. A.2 Ant specifications The ant is a quadruped with 8 actuated joints, 2 for each leg. Besides the coordinates of the center of mass, the joint angles and joint velocities are also included in the observation of the agent. The high degrees of freedom and the required motor coordination make this task much harder than the point mass. More details found in Duan et al. (2016). A.3 Maze navigation with point-mass We have also conducted experiments with a point-mass instead of the complex ant inside the maze, to understand the dynamics of our curriculum generation. Results are reported in Fig. 6. A.4 Point-mass specifications For both the N-dim point mass of Section 5.2 and the results from Figure 6, in each episode (rollout) the point-mass has 400 timesteps to reach the goal, where each timestep is 0.02 seconds. The agent can accelerate in up to a rate of 5 m/s2 in each dimension (N = 2 for the maze). The observations of the agent are 2N dimensional, including position and velocity of the point-mass. A.5 Goal GAN design and training After the generator generates goals, we add noise to each dimension of the goal sampled from a normal distribution with zero mean and unit variance. At each step of the algorithm, we train the policy for 5 iterations, each of which consists of 1000 episodes. After 5 policy iterations, we then train the GAN for 200 iterations, each of which consists of 1 iteration of training the discriminator and 1 iteration of training the generator. The generator receives as input 4 dimensional noise sampled from the standard normal distribution. The goal generator consists of two hidden layers with 128 nodes, and the goal discriminator consists of two hidden layers with 256 nodes, with relu nonlinearities. A.6 Policy and optimization The policy is defined by a neural network which receives as input the goal appended to the agent observations described above. The inputs are sent to two hidden layers of size 32 with tanh nonlinearities. The final hidden layer is followed by a linear N -dimensional output, corresponding to accelerations in the N dimensions. For policy optimization, we use a discount factor of 0.998 and 11 Figure 6: Point-mass in the same maze as described for Ant a GAE lambda of 0.995. The policy is trained with TRPO with Generalized Advantage Estimation implemented in rllab (Schulman et al., 2015, 2016; Duan et al., 2016). Every ”update policy” consists of 5 iterations of this algorithm. 12
2cs.AI
MIXED LOJASIEWICZ EXPONENTS, LOG CANONICAL THRESHOLDS OF IDEALS AND BI-LIPSCHITZ EQUIVALENCE arXiv:1405.2110v1 [math.AG] 8 May 2014 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Abstract. We study the Lojasiewicz exponent and the log canonical threshold of ideals of On when restricted to generic subspaces of Cn of different dimensions. We obtain effective formulas of the resulting numbers for ideals with monomial integral closure. An inequality relating these numbers is also proven. We also introduce the notion of bi-Lipschitz equivalence of ideals and we prove the bi-Lipschitz invariance of Lojasiewicz exponents and log canonical thresholds of ideals. 1. Introduction In 1970, O. Zariski posed in [51, p. 483] the following celebrated question: Let f and g be two holomorphic function germs (Cn , 0) → (C, 0). If there is a homeomorhism ϕ : (Cn , 0) → (Cn , 0) so that ϕ(f −1 (0)) = g −1(0), then do the germs f and g have the same multiplicity? This question is still unsolved except for the case n = 2 and is known as the Zariski’s multiplicity conjecture (see the survey [13]). One of the main difficulties to attack this question comes from the fact that the image of a line by a homeomorphism ϕ : (Cn , 0) → (Cn , 0) may not carry any algebraic (or analytic) structure. Let On denote the ring of complex analytic function germs (Cn , 0) → C and let mn denote the maximal ideal of On . We recall that the multiplicity or order of f is defined as the maximum of those r ∈ Z>1 such that f ∈ mrn . Let f ∈ On such that f has an isolated singularity at the origin. In his famous book [32], J. Milnor showed several topological interpretations of the number ∂f ∂f , . . . , ∂x i, µ(f ) = dimC On /h ∂x n 1 which is usually known as the Milnor number of f . Zariski’s multiplicity conjecture and Milnor’s book have been some of the most important motivations of many researchers to explore the relations between invariants of different nature (topological, analytic or algebraic) of a given singular function germ f ∈ On , or more generally, of complete intersection singularities. B. Teissier introduced in [47, p. 300] the sequence of Milnor numbers  µ∗ (f ) = µ(n) (f ), µ(n−1) (f ), . . . , µ(1) (f ) Key words and phrases. Lojasiewicz exponents, integral closure of ideals, mixed multiplicities of ideals, monomial ideals, log canonical threshold, bi-Lipschitz equivalence. The first author was partially supported by DGICYT Grant MTM2009–08933. 1 2 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI where µ(i) (f ) denotes the Milnor number of the restriction of f to a generic linear idimensional subspace of Cn , for i ∈ {0, 1, . . . , n}. In particular µ(1) (f ) = ord(f ) − 1 and µ(n) (f ) = µ(f ). By the results of Teissier [47, p. 334] and Briançon-Speder [10, p. 159] we know that, if ft : (Cn , 0) → (C, 0) denotes an analytic family of function germs such that ft have simultaneously isolated singularities at 0, then the constancy of µ∗ (ft ) is equivalent to the Whitney equisingularity of the deformation ft . In [46, 1.7], Teissier also obtained a relation between the set of polar multiplicities of a given function germ f ∈ On with the Lojasiewicz exponent L0 (∇f ). The number L0 (∇f ) is defined as the infimum of those α ∈ R>0 for which there exists a positive constant C > 0 and an open neighbourhood U of 0 ∈ Cn such that kxkα 6 Ck∇f (x)k ∂f ∂f , . . . , ∂x ) of f . Teissier also asked for all x ∈ U, where ∇f denotes the gradient map ( ∂x n 1 in [46, p. 287] whether L0 (∇ft ) remains constant in µ-constant analytic deformations ft : (Cn , 0) → (C, 0). There is still no general answer to this question. However as a consequence of [46, 1.7] and [46, Théorème 6] it follows that, if ft : (Cn , 0) → (C, 0) denotes a µ∗ -constant analytic deformation, then L0 (∇ft ) is also constant. The research of such invariants is motivated not only to understand the topology of hypersurfaces and singular varieties in general but also to understand the behaviour of functions and maps. In [31], J. Mather introduced the language to investigate singularities of maps and functions. This language has been widely-accepted and studied (see for instance the survey of C. T. C. Wall [50]). J. Mather defined the notions of right equivalence, right-left equivalence and contact equivalence for map germs. The corresponding equivalence classes are the orbits of the action of the groups R, A and K respectively, where • R is the group of diffeomorphism germs of the source, • A is the direct product of the group of diffeomorphism germs of the source and the target, • K is the group that is formed by the elements (ϕ(x), φx (y)) so that • x 7→ ϕ(x) is a diffeomorphism germ of the source, and • y 7→ φx (y) are diffemorphism germs of the target for any x. In [31, (2.3)], J. Mather also showed that two map germs f and g are contact equivalent if and only if the ideals generated by the component functions of f and that of g ◦ ϕ, respectively, are the same for some coordinate change ϕ of the source. These notions have clearly a holomorphic analogue. For shortness, we often call right equivalence, right-left equivalence and contact equivalence by R-equivalence, A-equivalence, and K-equivalence, respectively. It is natural to consider the bi-Lipschitz analogue of these notions. This direction seems to be first considered in [43] by J.-J. Risler and D. Trotman in the context of singularity theory after the establishment of the theory of Lipschitz stratifications [35] (see also [37]). They showed that if two holomorphic function germs are right-left equivalent in the biLipschitz sense, then they have the same multiplicity. This fact was a bit surprising, since MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 3 there is a bi-Lipschitz homeomorphism which sends a semi-line to the log spiral: (R2 , 0) → (R2 , 0), (r, θ) → (r, θ − log r), in terms of polar coordinates (r, θ). The images of lines by bi-Lipschitz homeomorphisms may not be analytic spaces, but the concept of bi-Lipschitz homeomorphism is substantially more fruitful than just talking about homeomorphisms. After [43], researchers in singularity theory started to investigate singularities from the viewpoint of bi-Lipschitz equivalence in several contexts. According to this, we list (non-exhaustively) the following topics of study and some references: • • • • • • bi-Lipschitz R-classification of functions ([14, 18, 19, 44]) properties on bi-Lipschitz K-equivalence ([3, 44]) classification of complex surfaces singularities in the bi-Lipschitz context ([2]) directional properties of subanalytic sets via bi-Lipschitz homeomorphisms ([25]) bi-Lipschitz stratifications ([24, 48]) the notion of integral closure technique in the bi-Lipschitz context ([16]). One of the motivations of this paper is the study of the invariance of L0 (∇f ) under bi-Lipschitz equivalences (see Subsection 2.1 and Theorem 6.1) and related outcomes of the discussion based on the estimation of Lojasiewicz exponents. Moreover, we explore in §3, §4 and §5 the notion of Lojasiewicz exponent L0 (I1 , . . . , In ) of n ideals in a Noetherian local ring of dimension n. This concept was introduced in [4] using the notion of mixed multiplicities of ideals. If I denotes an ideal of finite colength of On , then we are particularly interested in the Lojasiewicz exponent that arises when restricting I to generic linear subspaces of Cn of different dimensions, thus leading to the sequence of relative Lojasiewicz exponents (see Definition 3.7). The notion of mixed multiplicities of ideals was originated by the results of Risler and Teissier in [47] about the study of the µ∗ -sequence of function germs with an isolated singularity at the origin. Subsequently there is a well-developed theory of the notion of mixed multiplicities of ideals which can be found in [23] (see also the invaluable paper of D. Rees [41]). In §4, we discuss a generalization of an inequality proven by Hickel [21]. In §5 we obtain an expression of the sequence of relative Lojasiewicz exponents of a monomial ideal I of On in terms of the Newton polyhedron of I. In §6, we show the bi-Lipschitz A-invariance of L0 (∇f ) and several outcomes of the proof. We also show a result about the constancy of Lojasiewicz exponents in µ-constant deformations of weighted homogeneous functions (Cn , 0) → (C, 0). In §7, we discuss the notion of log canonical threshold lct(I) of an ideal I of On . We show that this number is bi-Lipschitz invariant and show a relation between lct(I) and Lojasiewicz exponents that enables us to express lct(I) in terms of Lojasiewicz exponents when the integral closure I of I is a monomial ideal. In §8 we discuss the behaviour of lct(I) when restricting I to generic i-dimensional linear subspaces of Cn , for i = 1, . . . , n. Then there arises the sequence lct∗ (I) = (lct(n) (I), . . . , lct(1) (I)) for which we show a closed formula when I is a monomial ideal. The authors would like to thank S. Ishii, M. A. S. Ruas and D. Trotman for helpful conversations. 4 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI 2. Preliminaries We start by recalling notational conventions. Let a(x) and b(x) be two function germs (Cn , x0 ) → R, where x0 ∈ Cn . Then • a(x) . b(x) near x0 means that there exists a positive constant C > 0 and an open neighbourhood U of x0 in Cn such that a(x) 6 C b(x), for all x ∈ U. • a(x) ∼ b(x) near x0 means that a(x) . b(x) near x0 and b(x) . a(x) near x0 . p For an n-tuple x = (x1 , . . . , xn ) ∈ Cn , we write kxk = |x1 |2 + · · · + |xn |2 . 2.1. Bi-Lipschitz equivalences. We start with recalling the definition of bi-Lipschitz map. A map germ f : (Cn , 0) → (Cp , 0) is said to be Lipschitz if kf (x) − f (x′ )k . kx − x′ k near 0. We say that a homeomorphism h : (Cn , 0) → (Cn , 0) is bi-Lipschitz if h and h−1 are Lipschitz. Now we can state obvious bi-Lipschitz analogues for several equivalence relations: • Two map germs f, g : (Cn , 0) → (Cp , 0) are said to be bi-Lipschitz R-equivalent if there is a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) so that f = g ◦ ϕ. • Two map germs f, g : (Cn , 0) → (Cp , 0) are said to be bi-Lipschitz A-equivalent if there are a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) and a bi-Lipschitz homeomorphism φ : (Cp , 0) → (Cp , 0) so that φ(f (x)) = g(ϕ(x)), for all x belonging to some open neighbourhood of 0 ∈ Cn . • Two map germs f, g : (Cn , 0) → (Cp , 0) are said to be bi-Lipschitz K-equivalent if there are a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) and a bi-Lipschitz homeomorphism Φ : (Cn ×Cp , 0) → (Cn ×Cp , 0), written as (x, y) 7→ (ϕ(x), φx (y)), so that Φ(Cn × {0}) = Cn × {0} and φx (f (x)) = g(ϕ(x)), for all x belonging to some open neighbourhood of 0 ∈ Cn . • Two map germs f, g : (Cn , 0) → (Cp , 0) are said to be bi-Lipschitz K∗ -equivalent if there are a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) and a map A : (Cn , 0) → GL(Cp ) so that A(x) and A(x)−1 are Lipschitz and that A(x)f (x) = g(ϕ(x)), for all x belonging to some open neighbourhood of 0 ∈ Cn . • Two subsets X1 and X2 of (Cn , 0) are bi-Lipschitz equivalent if there is a biLipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) so that ϕ(X1 ) = X2 . The definition of bi-Lipschitz K-equivalence is used in [3]. It is possible to consider a weaker version of the definition of K-equivalence by replacing the condition that Φ is bi-Lipschitz by the condition that φx is bi-Lipschitz, for all x belonging to some open neighbourhood of 0 ∈ Cn . We only need this condition in the proof of Theorem 7.3. The definition of K∗ -equivalence is inspired by the condition (iii) of the first proposition in paragraph (2.3) in [31]. For a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0), we do not have the induced map ϕ∗ : On → On , since f ◦ ϕ may not be holomorphic for f ∈ On . So we introduce the following definition. Definition 2.1. Let I and J be ideals of On . We say that I and J are bi-Lipschitz equivalent if there exist two families f1 , . . . , fp and g1 , . . . , gq of functions of On such that (a) hf1 , . . . , fp i ⊆ I and hf1 , . . . , fp i = I, MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 5 (b) hg1, . . . , gq i ⊆ J and hg1 , . . . , gq i = J, (c) there is a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) such that k(f1 (x), . . . , fp (x))k ∼ k(g1 (ϕ(x)), . . . , gq (ϕ(x)))k near 0. We remark that, under the conditions of item (a), the ideal hf1 , . . . , fp i is usually called a reduction of I (see [23, p. 6]). Here there are some obvious consequences: • If two map germs f, g : (Cn , 0) → (Cp , 0) are bi-Lipschitz R-equivalent, then they are bi-Lipschitz A (and K∗ )-equivalent. • If two map germs f, g : (Cn , 0) → (Cp , 0) are bi-Lipschitz A-equivalent or K∗ equivalent, then they are bi-Lipschitz K-equivalent. • If two map germs f and g are bi-Lipschitz K-equivalent, then the ideals generated by their components are bi-Lipschitz equivalent. • If two ideals are bi-Lipschitz equivalent, then their zero loci are bi-Lipschitz equivalent. The following questions seem to be open. Question 2.2. • If f and g are bi-Lipschitz K-equivalent, are f and g bi-Lipschitz K∗ -equivalent? • If f and g are bi-Lipschitz A-equivalent, are f and g bi-Lipschitz K∗ -equivalent? Question 2.3. Let X and Y be germs of complex analytic subvarieties at 0 in Cn . If there exist a bi-Lipschitz homeomorphism h : (Cn , 0) → (Cn , 0) so that h(X) = Y , are the respective defining ideals of X and Y bi-Lipschitz equivalent? Let f, g : (Cn , 0) → (C, 0) be two holomorphic functions. Assume that there is a biLipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) so that f −1 (0) = ϕ(g −1(0)). The authors do not know whether g(ϕ(x))/f (x) is bounded away from 0 and infinity, or not. 2.2. Lojasiewicz exponent of ideals. Let I and J be ideals of On . Let {f1 , . . . , fp } be a generating system of I and let {g1, . . . , gq } be a generating system of J. Let us consider the maps f = (f1 , . . . , fp ) : (Cn , 0) → (Cp , 0) and g = (g1 , . . . , gq ) : (Cn , 0) → (Cq , 0). We define the Lojasiewicz exponent of I with respect to J, denoted by LJ (I), as the infinimum of the set  (2.1) α ∈ R>0 : kg(x)kα . kf (x)k near 0 . By convention, we set inf ∅ = ∞. So if the previous set is empty, then we set LJ (I) = ∞. We thus have that LJ (I) is finite if and only if V (I) ⊆ V (J) (see [30]). Let us suppose that the ideal I has finite colength. When J = mn , then we denote the number LJ (I) by L0 (I). That is  L0 (I) = inf α ∈ R>0 : kxkα . kf (x)k near 0 . We refer to L0 (I) as the Lojasiewicz exponent of I. 6 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI 3. The sequence of mixed Lojasiewicz exponents If I denotes an ideal of a ring R, then we denote by I the integral closure of I. Let us suppose that I is an ideal of finite colength of On and let J be a proper ideal of On . Then, by virtue of the results of Lejeune and Teissier in [30, Théorème 7.2], the Lojasiewicz exponent LJ (I) can be expressed algebraically as o nr LJ (I) = inf : r, s ∈ Z>1 , J r ⊆ I s . s This fact is one of the motivations of the definition in [4] of the notion of Lojasiewicz exponent of a set of ideals. The main tool used for this definition is the mixed multiplicity of n ideals in a local ring of dimension n. Let (R, m) denote a Noetherian local ring of dimension n. If I1 , . . . , In are ideals of R of finite colength, then we denote by e(I1 , . . . , In ) the mixed multiplicity of I1 , . . . , In defined by Teissier and Risler in [47, §2]. We also refer to [23, §17.4] or [45] for the definitions and fundamental results concerning mixed multiplicities of ideals. Here we recall briefly the definition of e(I1 , . . . , In ). Under the conditions exposed above, let us consider the function H : Zn>0 → Z>0 given by   R (3.1) H(r1, . . . , rn ) = ℓ , I1r1 · · · Inrn for all (r1 , . . . , rn ) ∈ Zn>0 , where ℓ(M) denotes the length of a given R-module M. Then, it is proven in [47] that there exists a polynomial P (x1 , . . . , xn ) ∈ Q[x1 , . . . , xn ] of degree n such that H(r1 , . . . , rn ) = P (r1 , . . . , rn ), for all sufficiently large r1 , . . . , rn ∈ Z>0 . Moreover, the coefficient of the monomial x1 · · · xn in P (x1 , . . . , xn ) is an integer. This integer is called the mixed multiplicity of I1 , . . . , In and is denoted by e(I1 , . . . , In ). We remark that if I1 , . . . , In are all equal to a given ideal I of finite colength of R, then e(I1 , . . . , In ) = e(I), where e(I) denotes the Samuel multiplicity of I. If i ∈ {0, 1, . . . , n}, then we denote by ei (I) the mixed multiplicity e(I, . . . , I, m, . . . , m), where I is repeated i times and the maximal ideal m is repeated n − i times. In particular en (I) = e(I) and e0 (I) = e(m). If f ∈ On is an analytic function germ with an isolated singularity at the origin and J(f ) denotes the Jacobian ideal of f , then we denote by µ(i) (f ) the Milnor number of the restriction of f to a generic linear subspace of dimension i passing through the origin in Cn , for i = 0, 1, . . . , n. Teissier showed in [47] that µ(i) (f ) = ei (J(f )), for all i = 0, 1, . . . , n. The µ∗ -sequence of f is defined as µ∗ (f ) = (µ(n) (f ), . . . , µ(1) (f )). If g1 , . . . , gr ∈ R and they generate an ideal J of R of finite colength then we denote the multiplicity e(J) also by e(g1 , . . . , gr ). We will need the following known result (see for instance [23, p. 345]). Lemma 3.1. Let (R, m) be a Noetherian local ring of dimension n > 1. Let I1 , . . . , In be ideals of R of finite colength. Let g1 , . . . , gn be elements of R such that gi ∈ Ii , for all i = 1, . . . , n, and the ideal hg1 , . . . , gn i has also finite colength. Then e(g1 , . . . , gn ) > e(I1 , . . . , In ). MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 7 Definition 3.2. Let (R, m) be a Noetherian local ring of dimension n. Let I1 , . . . , In be ideals of R. Then we define (3.2) σ(I1 , . . . , In ) = max e(I1 + mr , . . . , In + mr ). r∈Z>1 The set of integers {e(I1 + mr , . . . , In + mr ) : r ∈ Z>0 } is not bounded in general. Thus σ(I1 , . . . , In ) is not always finite. The finiteness of σ(I1 , . . . , In ) is characterized in Proposition 3.3. We remark that if Ii has finite colength, for all i = 1, . . . , n, then σ(I1 , . . . , In ) equals the usual notion of mixed multiplicity e(I1 , . . . , In ). Let us suppose that the residue field k = R/m is infinite. Let I1 , . . . , In be ideals of R. We say that a given property is satisfied for a sufficiently general element of I1 ⊕ · · · ⊕ In , when, after identifying (I1 /mI1 ) ⊕ · · · ⊕ (In /mIn ) with k s , for some s > 1, there exist a Zariski open subset U ⊆ k s such that the said property holds for all elements of U. Proposition 3.3 ([5, p. 393]). Let I1 , . . . , In be ideals of a Noetherian local ring (R, m) such that the residue field k = R/m is infinite. Then σ(I1 , . . . , In ) < ∞ if and only if there exist elements gi ∈ Ii , for i = 1, . . . , n, such that hg1 , . . . , gn i has finite colength. In this case, we have that σ(I1 , . . . , In ) = e(g1 , . . . , gn ) for a sufficiently general element (g1 , . . . , gn ) ∈ I1 ⊕ · · · ⊕ In . Proposition 3.3 shows that, if σ(I1 , . . . , In ) < ∞, then σ(I1 , . . . , In ) is equal to the mixed multiplicity of I1 , . . . , In defined by Rees in [40, p. 181] (see also [42]) via the notion of general extension of a local ring. Therefore, we will refer to σ(I1 , . . . , In ) as the Rees’ mixed multiplicity of I1 , . . . , In . Lemma 3.4 ([4, p. 392]). Let (R, m) be a Noetherian local ring of dimension n > 1. Let J1 , . . . , Jn be ideals of R such that σ(J1 , . . . , Jn ) < ∞. Let I1 , . . . , In be ideals of R for which Ji ⊆ Ii , for all i = 1, . . . , n. Then σ(I1 , . . . , In ) < ∞ and σ(J1 , . . . , Jn ) > σ(I1 , . . . , In ). Under the conditions of Definition 3.2, let us denote by J a proper ideal of R. From Lemma 3.4 we obtain easily that σ(I1 , . . . , In ) = max σ(I1 + J r , . . . , In + J r ). r∈Z>0 Let us suppose that σ(I1 , . . . , In ) < ∞. Hence, we define  (3.3) rJ (I1 , . . . , In ) = min r ∈ Z>0 : σ(I1 , . . . , In ) = σ(I1 + J r , . . . , In + J r ) . If I is an ideal of finite colength of R then we denote rJ (I, . . . , I) by rJ (I). We remark that if R is quasi-unmixed, then, by the Rees’ multiplicity theorem (see for instance [23, p. 222]) we have  rJ (I) = min r ∈ Z>0 : J r ⊆ I . We will denote the integer rm (I) by r0 (I). Definition 3.5 ([6]). Let (R, m) be a Noetherian local ring of dimension n. Let I1 , . . . , In be ideals of R such that σ(I1 , . . . , In ) < ∞. Let J be a proper ideal of R. We define the 8 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Lojasiewicz exponent of I1 , . . . , In with respect to J, denoted by LJ (I1 , . . . , In ), as (3.4) rJ (I1s , . . . , Ins ) . s>1 s LJ (I1 , . . . , In ) = inf In accordance with mixed multiplicities of ideals, we also refer to the number LJ (I1 , . . . , In ) as the mixed Lojasiewicz exponent of I1 , . . . , In with respect to J; when J = m we denote this number by L0 (I1 , . . . , In ). Remark 3.6. Let us observe that, under the conditions of Definition 3.5, if I is an ideal of finite colength of R such that I1 = · · · = In = I, then the right hand side of (3.4) can be rewritten as o nr : r, s ∈ Z>1 , e(I s ) = e(I s + J r ) . (3.5) inf s If we assume that R is quasi-unmixed and r, s ∈ Z>1 , then the condition e(I s ) = e(I s +J r ) is equivalent to saying that J r ⊆ I s , by the Rees’ multiplicity theorem. Therefore (3.5) is expressed as o nr : r, s ∈ Z>1 , J r ⊆ I s , inf s which coincides with the usual notion of Lojasiewicz exponent LJ (I) of I with respect to J (see [30, Théorème 7.2]). As a particular case of the previous definition we introduce the following concept. Definition 3.7. Let (R, m) be a Noetherian local ring of dimension n. Let I be an ideal of R of finite colength. If i ∈ {1, . . . , n}, then we define the i-th relative Lojasiewicz exponent of I as (3.6) (i) L0 (I) = L0 (I, . . . , I , m, . . . , m). | {z } | {z } i times n − i times We define the L∗0 -vector, or L∗0 -sequence, of I as  (n) (1) L∗0 (I) = L0 (I), . . . , L0 (I) . If J denotes a proper ideal of R, then we define the i-th relative Lojasiewicz exponent of (i) I with respect to J, denoted by LJ (I), by replacing m by J in (3.6). The L∗J -sequence of I is defined analogously. Definition 3.8. Let (X, 0) ⊆ (Cn , 0) be the germ at 0 of a complex analytic variety X. Let h1 , . . . , hm ∈ On such that (X, 0) = V (h1 , . . . , hm ). Let h denote the map (h1 , . . . , hm ) : (Cn , 0) → (Cm , 0). Let I be an ideal of On such that V (I) ∩ X = {0}. Then we define the Lojasiewicz exponent of I relative to (X, 0) as the infimum of those α > 0 such that there exists a constant C > 0 and an open neighbourhood U of 0 ∈ Cn such that kxkα 6 Ckh(x)k, for all x ∈ U ∩ X. By the results of Lejeune-Teissier [30] we have that if J is the ideal of On generated by h1 , . . . , hm , then L(X,0) (I) = LJ (I). We will study the number L(X,0) (I) specially when (X, 0) is a linear subspace of Cn . MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 9 Theorem 3.9. Let π : M → Cn be a proper modification so that π ∗ (mI)0 is formed by normal crossing divisors whose support has the irreducible decomposition ∪i Di . If X X (π ∗ m)0 = si Di , (π ∗ I)0 = mi Di , si , mi ∈ Z, i i then we have (3.7) L(X,0) (I) = max  mi : Di ∩ X ′ 6= ∅ si  where X ′ denotes the strict transform of X by π (see [7] for details). 4. Inequalities relating Lojasiewicz exponents and mixed multiplicities This section is motivated by the results of Hickel in [21]. In this section we show some results showing how Lojasiewicz exponents are related with quotients of mixed multiplicities; the main result in this direction is Theorem 4.7. Proposition 4.1. Let (R, m) be a quasi-unmixed Noetherian local ring of dimension n. Let I1 , . . . , In , J be ideals of R such that σ(I1 , . . . , In ) < ∞, σ(I1 , . . . , In−1 , J) < ∞ and In has finite colength. Then σ(I1 , . . . , In ) 6 LJ (In ). σ(I1 , . . . , In−1 , J) Proof. Let r, s ∈ Z>1 . Let us suppose that J r ⊆ Ins . Then we obtain (4.1) (4.2) r · σ(I1 , . . . , In−1, J) = σ(I1 , . . . , In−1 , J r ) > σ(I1 , . . . , In−1 , Ins ) = s · σ(I1 , . . . , In−1 , In ). We refer to [4, Lemma 2.6] for equality (4.1) and to Lemma 3.1 for the inequality in (4.2). In particular r σ(I1 , . . . , In−1 , In ) > . s σ(I1 , . . . , In−1 , J) By [30, Théorème 7.2] we have LJ (In ) = inf{ rs : r, s ∈ Z>1 , J r ⊆ Ins } (see Remark 3.6). Then the result follows.  Corollary 4.2. Let (R, m) be a quasi-unmixed Noetherian local ring of dimension n. Let I be an ideal of finite colength of R. Then e(I) (4.3) 6 L0 (I). en−1 (I) and equality holds if and only if en−1 (I)n e(I) = e(I en−1 (I) + me(I) ). Proof. Inequality (4.3) follows from applying Proposition 4.1 to the case I1 = · · · = In = I and J = m. By the definition of L0 (I) we observe that equality holds in (4.3) if and only if me(I) ⊆ I en−1 (I) . This inclusion is equivalent to saying that e(I en−1 (I) ) = e(I en−1 (I) + me(I) ), by the Rees’ multiplicity theorem.  10 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Remark 4.3. Let w = (w1 , . . . , wn ) ∈ Zn>1 and let d ∈ Z>1 . Let us denote mini wi by w0 . Let f ∈ On denote a semi-weighted homogeneous function germ of degree d with respect 0 to w. It is known that L0 (∇f ) 6 d−w (see for instance [6, Corollary 4.7]). Hence it w0 0 (see is interesting to determine when L0 (∇f ) attains the maximum possible value d−w w0 [6, 28]). By (4.3) we obtain (4.4) µ(f ) µ(n−1) (f ) 6 L0 (∇f ). µ(f ) 0 0 Therefore, if µ(n−1) = d−w then we have the equality L0 (∇f ) = d−w . w0 w0 (f ) 3 Let ft : (C , 0) → (C, 0) denote the analytic family of functions of Briançon-Speder’s example (see Example 5.5). We recall that ft is weighted homogeneous of degree 15 with respect to w = (1, 2, 3), for all t. When t 6= 0, equality holds in (4.4) and thus we observe 0 but the equality does not hold in that inequality (4.3) is sharp. However L0 (∇f0 ) = d−w w0 (4.4). We also remark that the Briançon-Speder’s example also shows that if f : (Cn , 0) → (C, 0) is a weighted homogeneous function of degree d with respect to a given vector of weights w = (w1 , . . . , wn ) ∈ Z>1 , then we can not expect a formula for the whole sequence µ∗ (f ) in terms of w and d. Corollary 4.4. Let (R, m) be a quasi-unmixed Noetherian local ring of dimension n. Let I1 , . . . , In and J1 , . . . , Jn be two families of ideals of R of finite colength. Then (4.5) e(I1 , . . . , In ) 6 LJ1 (I1 )LJ2 (I2 ) · · · LJn (In ). e(J1 , . . . , Jn ) In particular, if I is an ideal of R of finite colength, then (4.6) e(I) 6 L0 (I)n . Proof. Relation (4.5) follows immediately as a recursive application of Proposition 4.1. Inequality (4.6) is a consequence of applying (4.5) by considering I1 = · · · = In = I and J1 = · · · = Jn = m.  Lemma 4.5. Let (R, m) denote a Noetherian local ring of dimension n. Let I1 , . . . , In be ideals of R such that σ(I1 , . . . , In ) < ∞. Let g ∈ In such that dim R/hgi = n − 1 and let p : R → R/hgi denote the canonical projection. Then σ(I1 , . . . , In ) 6 σ(p(I1 ), . . . , p(In−1 )). Proof. By Proposition 3.3, there exist gi ∈ Ii , for i = 1, . . . , n − 1, such that σ(p(I1 ), . . . , p(In−1 )) = σ(p(g1 ), . . . , p(gn−1)). The image in a quotient of R of a given ideal of R has multiplicity greater than or equal to the multiplicity of the given ideal (see for instance [23, Lemma 11.1.7] or [20, p. 146]). Therefore σ(p(I1 ), . . . , p(In−1 )) = e(p(g1 ), . . . , p(gn−1)) > e(g1 , . . . , gn−1 , g) > σ(I1 , . . . , In ) where the last inequality is a consequence of Lemma 3.1.  MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 11 Proposition 4.6. Let (R, m) be a Noetherian local ring of dimension n > 2. Let J be a proper ideal of R and let I1 , . . . , In be ideals of R such that σ(I1 , . . . , In ) < ∞. Let g denote a sufficiently general element of In and let p : R → R/hgi denote the canonical projection. Then (4.7) (4.8) σ(p(I1 ), . . . , p(In−1 )) = σ(I1 , . . . , In ) Lp(J) (p(I1 ), . . . , p(In−1 )) 6 LJ (I1 , . . . , In ). Proof. Let us suppose that g ∈ In is a superficial element for I1 , . . . , In according to [23, Definition 17.2.1]. In particular, the element g can be considered as a sufficiently general element of In , by [23, Proposition 17.2.2]. Therefore equality (4.7) holds, by a result of Risler and Teissier [23, Theorem 17.4.6] (see also [47, p. 306]). From (4.7) we obtain the following chain of inequalities, for any pair of integers r, s > 1: σ(I1s , . . . , Ins ) = sn σ(I1 , . . . , In ) = sn σ(p(I1 ), . . . , p(In−1 )) (4.9) = s · σ(p(I1 )s , . . . , p(In−1 )s ) > s · σ(p(I1 )s + p(J)r , . . . , p(In−1 )s + p(J)r ) s s > s · σ(I1s + J r , . . . , In−1 + J r , In ) = σ(I1s + J r , . . . , In−1 + J r , Ins ) s + J r , Ins + J r ), > σ(I1s + J r , . . . , In−1 where the inequality of (4.9) is a direct application of Lemma 4.5. In particular, we find that rp(J) (p(I1 )s , . . . , p(In−1)s ) 6 rJ (I1s , . . . , Ins ), for all s > 1, and hence relation (4.8) follows.  The next result shows an inequality that in some situations (see Corollary 4.8) is more subtle than inequality (4.5). Moreover, Theorem 4.7 constitutes a generalization of the inequality proven by Hickel in [21, Théorème 1.1]. Theorem 4.7. Let us suppose that (R, m) is a quasi-unmixed Noetherian local ring. Let I1 , . . . , In and J1 , . . . , Jn two families of ideals of R of finite colength. Then e(I1 , . . . , In ) 6 LJ1 (I1 , J2 . . . , Jn )LJ2 (I2 , I2 , J3 . . . , Jn )LJ3 (I3 , I3 , I3 , J4 . . . , Jn ) e(J1 , . . . , Jn ) · · · LJn−1 (In−1 , . . . , In−1, Jn )LJn (In , . . . , In ). Proof. By Proposition 4.1, we have (4.10) e(I1 , . . . , In ) 6 e(I1 , . . . , In−1 , Jn )LJn (In ). Let gn ∈ Jn such that dim R/hgn i = n − 1 and let p : R → R/hgn i be the natural projection. Therefore we obtain (4.11) e(I1 , . . . , In−1 , Jn ) 6 e(p(I1 ), . . . , p(In−1 )), by Lemma 4.5. Applying again Proposition 4.1 we have e(p(I1 ), . . . , p(In−1)) 6 e(p(I1 ), . . . , p(In−2 ), p(Jn−1 ))Lp(Jn−1 ) (p(In−1 )) (4.12) 6 e(p(I1 ), . . . , p(In−2 ), p(Jn−1 ))LJn−1 (In−1 , . . . , In−1 , Jn ), where (4.12) follows from Proposition 4.6. Thus joining (4.10), (4.11) and (4.12) we obtain e(I1 , . . . , In ) 6 e (p(I1 ), . . . , p(In−2 ), p(Jn−1 )) LJn−1 (In−1 , . . . , In−1, Jn )LJn (In ). 12 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Now we can bound the multiplicity e(p(I1 ), . . . , p(In−2 ), p(Jn−1)) by applying the same argument. Then, by finite induction we construct a sequence of elements gi ∈ Ji , for i = 2, . . . , n, such that dim R/hgi , . . . , gn i = i − 1, for all i = 2, . . . , n, and if q denotes the projection R → R/hg2 , . . . , gn i, then e(I1 , . . . , In ) 6 e(q(I1 ))LJ2 (I2 , I2 , J3 . . . , Jn )LJ3 (I3 , I3 , I3 , J4 . . . , Jn ) · · · LJn−1 (In−1 , . . . , In−1 , Jn )LJn (In , . . . , In ). By Propositions 4.1 and 4.6 we have e(q(I1 )) 6 e(q(J1 ))Lq(J1 ) (q(I1 )) 6 e(q(J1 ))LJ1 (I1 , J2 , . . . , Jn ). Moreover, we can assume from the beginning that gn , gn−1 , . . . , g2 forms a superficial sequence for Jn , Jn−1 , . . . , J2 , J1 , in the sense of [23, Definition 17.2.1]. In particular we have the equality e(q(J1 )) = e(J1 , . . . , Jn ), by [23, Theorem 17.4.6]. Thus the result follows.  Corollary 4.8. Let (R, m) be a quasi-unmixed Noetherian local ring and let I and J be ideals of R of finite colength. Then e(I) (1) (n) 6 LJ (I) · · · LJ (I), e(J) (i) where LJ (I) = LJ (I, . . . , I , J, . . . , J ), for i = 1, . . . , n. | {z } | {z } i times n − i times Proof. It follows by considering I1 = · · · = In = I and J1 = · · · = Jn = J in the previous theorem.  From the above result we conclude that if f ∈ On has an isolated singularity at the origin, then (1) (n) µ(f ) 6 L0 (∇f ) · · · L0 (∇f ). We remark that Theorem 4.7 and Corollary 4.8 are suggested by [21, Remarque 4.3]. (i) Moreover, let us observe that the numbers νI defined by Hickel in [21, p. 635] in a regular (i) local ring coincide with the numbers L0 (I) introduced in Definition 3.7, as is shown in the following lemma. Lemma 4.9. Let (R, m) be a regular local ring with infinite residue field k. Let I be (i) an ideal of R of finite colength and let i ∈ {1, . . . , n − 1}. Then L0 (I) is equal to the Lojasiewicz exponent of the image of I in the quotient ring R/hh1 , . . . , hn−i i, where h1 , . . . , hn−i are linear forms chosen generically in k[x1 , . . . , xn ] and x1 , . . . , xn denote a regular parameter system of R. Proof. By [23, Proposition 17.2.2] and [23, Theorem 17.4.6], we can take generic lineal forms h1 , . . . , hn−i ∈ k[x1 , . . . , xn ] in order to have e(IRH ) = ei (I), where RH denotes the quotient ring R/hh1 , . . . , hn−i i. Let us denote by mH the maximal ideal of RH . By [21, Théorème 1.1], the number L0 (IRH ) does not depend on h1 , . . . , hn−i . Let us denote the resulting number by νIi , as in [21]. We observe that o nr r s : mH ⊆ I RH , r, s > 1 L0 (IRH ) = inf s MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS = inf Moreover (i) L0 (I) nr s s s : e(I RH ) = e(I RH + nr s s r mrH ), 13 o r, s > 1 . o : ei (I ) = ei (I + m ), r, s > 1 . s Let r, s > 1, then we have the following: = inf ei (I s ) = si ei (I) = si e(IRH ) = e(I s RH ) > e(I s RH + mrH ) > ei (I s + mr ), where the last inequality follows from Lemma 4.5. In particular, if ei (I s ) = ei (I s + mr ), (i) then e(I s RH ) = e(I s RH + mrH ). This means that L0 (IRH ) 6 L0 (I) and consequently (i) νIi 6 L0 (I). (i) (i) Let us suppose that νIi < L0 (I). Let r, s > 1 such that νIi < rs < L0 (I). Therefore ei (I s ) > e(I s + mr ). Let us consider generic linear forms h1 , . . . , hn−i ∈ k[x1 , . . . , xn ] such that ei (I s ) = e(I s RH ) and ei (I s + mr ) = e((I s + mr )RH ), where RH = R/hh1 , . . . , hn−i i. (i) Since νI = L0 (IRH ) < rs , then e(I s RH ) = e((I s +mr )RH ) and hence ei (I s ) = ei (I s +mr ), (i) which is a contradiction. Therefore L0 (I) = νIi .  Lemma 4.10. Let (R, m) be a quasi-unmixed Noetherian local ring and let I, J be ideals of R of finite colength such that I ⊆ J. Let us suppose that the residue field k = R/m is infinite. Let i ∈ {1, . . . , n − 1}. If ei+1 (I) = ei+1 (J), then ei (I) = ei (J). Proof. Let h1 , . . . , hn−i ∈ m sufficiently general elements of m. Let us define R1 = R/hh1 , . . . , hn−i i and R2 = hh1 , . . . , hn−i−1 i. If p : R → R1 and q : R → R2 denote the natural projections, then ei (I) = e(p(I)R1 ), ei (J) = e(p(J)R1 ), ei+1 (I) = e(q(I)R2 ) and ei+1 (J) = e(q(J)R2 ). Since the ring R2 is also quasi-unmixed (see for instance [23, Proposition B.44]), the condition ei+1 (I) = ei+1 (J) implies that q(I) = q(J), where the bar denotes integral closure in R2 , by the Rees’ multiplicity theorem. In particular we have p(I) = p(J), as an equality of integral closures in R1 . Thus e(p(I)R1 ) = e(p(J)R1 ) and the result follows.  Corollary 4.11. Let (R, m) be a quasi-unmixed Noetherian local ring and let I, J be ideals of R of finite colength. Let us suppose that the residue field k = R/m is infinite. (1) (n) Then LJ (I) 6 · · · 6 LJ (I). Proof. Let us fix an index i ∈ {1, . . . , n − 1}. Let us fix two integers r, s > 1 such that ei+1 (I s ) = ei+1 (I s + J r ). Then ei (I s ) = ei (I s + J r ), by Lemma 4.10. Hence the result (i) follows from the definition of LJ (I).  5. Mixed Lojasiewicz exponents of monomial ideals Let v ∈ Rn>0 , v = (v1 , . . . , vn ). We define vmin = min{v1 , . . . , vn } and A(v) = {j : vj = vmin }. Given an index i ∈ {1, . . . , n}, we define S (i) = {v ∈ Rn>0 : #A(v) > n + 1 − i} and (i) (1) S0 = {v ∈ Rn>0 : #A(v) = n + 1 − i}. We observe that S (1) = S0 = {(λ, . . . , λ) : λ > 0}, (i) S (n) = Rn>0 and S0 = S (i) r S (i−1) , for all i = 1, . . . , n, where we set S (0) = ∅. P k If h ∈ On and h = k ak x denotes the Taylor expansion of h around the origin, then support of h is defined as the set supp(h) = {k ∈ Zn>0 : ak 6= 0}. If h 6= 0, the 14 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Newton polyhedron of h, denoted by Γ+ (h), is the convex hull in Rn of the set {k + v : k ∈ supp(h), v ∈ Rn>0 }. If h = 0, then we set Γ+ (h) = ∅. If I denotes an ideal of On and g1 , . . . , gr is a generating system of I, then the Newton polyhedron of I, denoted by Γ+ (I), is defined as the convex hull of Γ+ (g1 ) ∪ · · · ∪ Γ+ (gr ). It is easy to check that the definition of Γ+ (I) does not depend on the chosen generating system g1 , . . . , gr of I. If v ∈ Rn>0 and I denotes an ideal of On , then we define ℓ(v, I) = min {hv, ki : k ∈ Γ+ (I)} , where h , i stands for the standard scalar product in Rn . Therefore, if v = (1, . . . , 1) ∈ Rn>0 , then ℓ(v, I) = ord(I), where ord(I) is the order of I, that is, the minimum of those r > 1 such that I ⊆ mr . If h ∈ On and v ∈ Rn>0 , then the number ℓ(v, h) is also denoted by dv (h) and we refer to dv (h) as the degree of h with respect to v. Theorem 5.1. If I is a monomial ideal of On of finite colength, then   ℓ(v, I) (i) (i) L0 (I) = max , :v∈S vmin for all i = 1, . . . , n. (i) Proof. Let us fix an index i ∈ {1, . . . , n}. The closures of connected components S0 form a regular subdivision corresponding to the blow up at the origin. Let us consider a regular subdivision Σ of the dual Newton polyhedron of Γ+ (I), which is also a subdivision (i) (i) of {S0 }. Then we have a natural map from Σ to {S0 }. Take a vector a which is a generator of 1-cone of Σ and denote by Ea the corresponding exceptional divisor. Then Ea meets L′ if and only if the cone generated by a is in the closure of some connected (i) component of S0 , i > n + 1 − k, where L′ denotes the strict transform of L. So (3.7) implies the result.  Let us fix a subset L ⊆ {1, . . . , n}, L 6= ∅. Then we define RnL = {x ∈ Rn : xi = P 0, for all i ∈ / L}. If h ∈ On and h = k ak xk is the Taylor expansion of h around the origin, then we denote by hL the sum of all terms ak xk such that k ∈ RnL ; if no such terms exist then we set hL = 0. Let On,L denote the subring of On formed by all function germs of On that only depend on the variables xi such that i ∈ L. If I is an ideal of On , then I L denotes the ideal of On,L generated by all hL such that h ∈ I. In particular, if I is an ideal of On of finite colength then I {i} 6= 0, for all i = 1, . . . , n. Corollary 5.2. Let I be a monomial ideal of On of finite colength. Then, for all i ∈ {1, . . . , n}, we have  (i) (5.1) L0 (I) = max ord(I {j1 ,...,jn+1−i } ) : 1 6 j1 < · · · < jn+1−i 6 n . Proof. Let us fix an index i ∈ {1, . . . , n} and let us denote the number on the right 1 v by wv . If hand side of (5.1) by mi (I). If v ∈ Rn>0 , then we denote the vector vmin wv = (w1 , . . . , wn ), then we observe that wj = 1 whenever j ∈ A(v) and wj > 1, otherwise. By Theorem 5.1 we have  (i) L0 (I) = max ℓ(wv , I) : v ∈ S (i) . MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 15 We remark that, since I is an ideal of finite colength, then I L 6= 0, for all L ⊆ {1, . . . , n}, L 6= ∅. Let us fix a vector v ∈ S (i) . Then from the inclusion I A(v) ⊆ I we deduce ℓ(wv , I) 6 ℓ(wv , I A(v) ) = ord(I A(v) ). In particular, we have   max ℓ(wv , I) : v ∈ S (i) 6 max ℓ(wv , I A(v) ) : v ∈ S (i)  = max ord(I A(v) ) : v ∈ S (i) o n (i) A(v) 6 max ord(I ) : v ∈ S0  = max ord(I {j1 ,...,jn+1−i } ) : 1 6 j1 < · · · jn+1−i 6 n . (i) Hence L0 (I) 6 mi (I). Let us see the converse inequality by proving that for any subset L ⊆ {1, . . . , n} such that |L| = n + 1 − i, there exist some vector v ∈ Rn>0 such that A(v) = L and ℓ(wv , I) = ord(I L ). Let us fix a subset L ⊆ {1, . . . , n} such that |L| = n+1−i and let v = (v1 , . . . , vn ) ∈ Rn such that vi = 1 for all i ∈ L and vj > ord(I L ), for all j ∈ / L. Let us observe that, if xk ∈ / I L , then there exists some j0 ∈ / L such that kj0 > 1; in particular hv, ki > ord(I L ). Therefore we have     L ℓ(wv , I) = ℓ(v, I) = min min hk, vi, min hk, vi = min ord(I ), min hk, vi = ord(I L ). xk ∈I L xk ∈I / L xk ∈I / L Thus the result follows.  Remark 5.3. If I denotes an ideal of finite colength of On then we observe that L∗0 (I) = L∗0 (I). Therefore in Theorem 5.1 and Corollary 5.2 we can replace the ideal I by any ideal of On whose integral closure is a monomial ideal. Example 5.4. Let us consider the monomial ideal of O3 given by I = hxa , y b, z c , xyzi, where a, b, c ∈ Z>0 and 3 < a < b < c. Using the formula e(I) = 3!Vn (R3>0 r Γ+ (I)) we obtain e(I) = ab + ac + bc. Moreover L∗0 (I) = (c, b, 3), by Corollary 5.2. We remark that L∗0 (I) does not depend on a. Example 5.5. Let us consider the family ft : (C3 , 0) → (C, 0) given by: ft (x, y, z) = x15 + z 5 + xy 7 + ty 6z. This is known as the Briançon-Speder’s example (see [9]). We have that ft has an isolated singularity at the origin, ft is weighted homogeneous with respect to w = (1, 2, 3) and dw (ft ) = 15, for all t. Therefore L0 (∇ft ) = 14, for all t, by [28]. It is known that µ(2) (f0 ) = 28 and µ(2) (ft ) = 26, for all t 6= 0 (see [9]). Hence ( (364, 28, 5) if t = 0 µ∗ (f ) = (364, 26, 5) if t 6= 0. It is straightforward to check that the ideal J(f0 ) is Newton non-degenerate, in the sense of [8, p. 57]. Thus the integral closure of J(f0 ) is a monomial ideal. That is J(f0 ) = hx14 , y 7, xy 6 , z 4 i. In particular, we can apply Corollary 5.2 to deduce L∗0 (∇f0 ) = (14, 7, 5). 16 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI If t 6= 0, then Γ+ (J(ft )) = Γ+ (J), where J is the monomial ideal given by J = hx14 , y 6, z 4 , y 5z, xy 6 i. Obviously J ⊆ J(ft ). We observe that e(J) = 336, whereas e(J(ft )) = 364. Since e(J) 6= e(J(ft )) we conclude that the ideal J(ft ) is not Newton non-degenerate. In particular, we can not apply Corollary 5.2 to obtain the sequence L∗0 (∇ft ). (2) Let us compute the number L0 (J(ft )), for t 6= 0. Let us fix a parameter t 6= 0. We (2) remark that L0 (J(ft )) is equal to the Lojasiewicz exponent of the function g(x, y) = ft (x, y, ax + by), for generic values a, b ∈ C, by Lemma 4.9 and [47, Proposition 2.7]. We recall that if I denotes an ideal of On of finite colength, then we denote by r0 (I) the minimum of those r > 1 such that mr ⊆ I. Using Singular [11] we observe that r0 (J(g)) = 7. s) By a result of Ploski [38, Proposition 3.1], it is enough to compute the quotients r0 (J(g) s only for those integers s such that 1 6 s 6 r0 (J(g)s ) 6 e(J(g)) = 26. Moreover, since s) , we can consider only the integers s such that r0 (J(g)) − 1 < L0 (J(g)) = inf s>1 r0 (J(g) s e(J(g)) 26 1 6 s 6 r0 (J(g))−1 = 6 ≃ 4.3, that is, such that 1 6 s 6 4. Again, by applying Singular [11] we obtain r0 (J(g)) = 7 Then r0 (J(g)2) = 13  r0 (J(g)3) = 20 r0 (J(g)4) = 26. r0 (J(g)) r0 (J(g)2 ) r0 (J(g)3) r0 (J(g)4 ) , , , L0 (J(g)) = min 1 2 3 4 Summing up the above information we conclude ( (14, 7, 5) if t = 0 L∗0 (∇ft ) = (14, 6.5, 5) if t 6= 0.  = 6.5. It is known that the deformation ft : (C3 , 0) → (C, 0) is topologically trivial (see [9]). However, this deformation is not bi-Lipschitz R-trivial, as is observed by Koike [26]. Therefore, the fact that L∗0 (∇f0 ) 6= L∗0 (∇ft ), for t 6= 0, in this example constitutes a clue pointing that, if f ∈ On is a function germ having an isolated singularity at the origin, then the sequence L∗0 (∇f ) might be invariant in the bi-Lipschitz R-orbit of f . 6. The bi-Lipschitz invariance of the Lojasiewicz exponent In this section we show three theorems. The first one shows that L0 (∇f ) is bi-Lipschitz A-invariant and bi-Lipschitz K∗ -invariant, for any f ∈ On with an isolated singularity at the origin. The second shows the bi-Lipschitz invariance of L0 (I) and ord(I), for any ideal I of On of finite colength. The third one concerns the invariance of L0 (∇f ) in µ-constant deformations of f . Theorem 6.1. Let f, g ∈ On with an isolated singularity at the origin. Let us suppose that f and g are bi-Lipschitz A-equivalent or bi-Lipschitz K∗ -equivalent. Then L0 (∇f ) = L0 (∇g). Proof. By symmetry, it is enough to show L0 (∇f ) 6 L0 (∇g). Let us consider a biLipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) and a bi-Lipschitz homeomorphism φ : MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 17 (C, 0) → (C, 0) so that g(ϕ(x)) = φ(f (x)), for all x belonging to some open neighbourhood of 0 ∈ Cn . By Rademacher’s theorem (see for instance [27, Theorem 5.1.11]), the partial derivatives of ϕ and ϕ−1 exist in some open neighbourhood of 0 ∈ Cn except in a thin set. The bi-Lipschitz property implies that ϕ and ϕ−1 are bounded. Then we conclude that (6.1) k∇g(ϕ(x))k . k∇g(ϕ(x))Dϕ(x)k = kDφ(f (x))∇f (x)k . k∇f (x)k almost everywhere. By continuity, we have k∇g(ϕ(x))k . k∇f (x)k near 0. If kxkθ . k∇g(x)k, then kxkθ ∼ kϕ(x)kθ . k∇g(ϕ(x))k . k∇f (x)k and we obtain L0 (∇f ) 6 L0 (∇g). The proof for K∗ -equivalence is similar. Let A : (Cn , 0) → C∗ be a Lipschitz map such that the map A−1 : (Cn , 0) → C∗ defined by A−1 (x) = A(x)−1 is Lipschitz and g(ϕ(x)) = A(x)f (x), for all x belonging to some open neighbourhood of the origin. Then we obtain that k∇g(ϕ(x))k .k∇g(ϕ(x))Dϕ(x)k =k∇A(x)f (x) + A(x)∇f (x)k ≤k∇A(x)k|f (x)| + |A(x)|k∇f (x)k .|f (x)| + k∇f (x)k .kxkk∇f (x)k + k∇f (x)k .k∇f (x)k, (since ϕ−1 is Lipschitz) (since g(ϕ(x)) = A(x)f (x)) (since A(x) is Lipschitz) (since |f (x)| . kxkk∇f (x)k) almost everywhere and we conclude that L0 (∇f ) 6 L0 (∇g).  Theorem 6.2. Let I and J be ideals of On such that I and J are bi-Lipschitz equivalent. Then ord(I) = ord(J), and L0 (I) = L0 (J) if I and J have finite colength. Proof. Since I and J are bi-Lipschitz equivalent, there exist analytic map germs f = (f1 , . . . , fp ) : (Cn , 0) → (Cp , 0) and g = (g1 , . . . , gq ) : (Cn , 0) → (Cq , 0) such that I = hf1 , . . . , fp i , J = hg1 , . . . , gq i and there exists a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0) so that kg(ϕ(x))k ∼ kf (x)k near 0. By symmetry, it is enough to show that L0 (I) 6 L0 (J) and ord(I) 6 ord(J). Let θ ∈ R>0 such that kxkθ . kg(x)k near 0. Then kxkθ ∼ kϕ(x)kθ . kg(ϕ(x))k ∼ kf (x)k near 0 and we obtain that L0 (I) 6 L0 (J). We remark that ord(J) = max{s : J ⊆ msn } = max{s : J ⊆ msn } = max{s : kg(x)k . kxks near 0}. If kf (x)k . kxks near 0, then we have kg(x)k ∼ kf (ϕ(x))k . kϕ(x)ks ∼ kxks near 0 and we obtain ord(I) 6 ord(J).  To end this section we show a result about the constancy of L0 (∇ft ) in deformations of weighted homogeneous functions. 18 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI Theorem 6.3. Let f : (Cn , 0) → (C, 0) be a weighted homogeneous function of degree d with respect to w = (w1 , . . . , wn ) with an isolated singularity at the origin. Let w0 = min{w1 , . . . , wn }. Let us suppose that   d − w0 . (6.2) L0 (∇f ) = min µ(f ), w0 Let ft : (Cn , 0) → (C, 0) be an analytic deformation of f such that ft has an isolated singularity at the origin, for all t. If µ(ft ) is constant, then L0 (∇ft ) is also constant. Proof. By a result of Varchenko [49] (see also [36, Proposition 2]), the deformation ft verifies dw (ft ) > d, for all t, where dw (ft ) denotes the degree of ft with respect to w. Then we have the following: (d − w1 ) · · · (d − wn ) (dt − w1 ) · · · (dt − wn ) (d − w1 ) · · · (d − wn ) = µ(f ) = µ(ft ) > > . w1 · · · wn w1 · · · wn w1 · · · wn Therefore dw (ft ) = d and (d − w1 ) · · · (d − wn ) w1 · · · wn for all t. Consequently ft is a semi-weighted homogeneous function, for all t, by [8, Theorem 3.3] (see also [15]). Then, by [6, Corollary 4.7], we obtain µ(ft ) = L0 (∇ft ) 6 d − w0 . w0 By the lower semi-continuity of Lojasiewicz exponents in µ-constant deformations (see [39]) we have       d − w0 d − w0 d − w0 = L0 (∇f ) 6 L0 (∇ft ) 6 min µ(ft ), = min µ(f ), . min µ(f ), w0 w0 w0 Then the result follows.  Since the order of a function can be seen as a Lojasiewicz exponent, that is ord(f ) = Lhf i (mn ), for all f ∈ mn , we can consider the previous result as a counterpart of the known results of O’Shea [36, p. 260] and Greuel [17, p. 164] in the context of Lojasiewicz exponents of gradient maps. We remark that in general we always have the inequality (6) in (6.2). 7. Log canonical thresholds The purpose of this section is to show in Theorem 7.3 that the log canonical threshold lct(I) is bi-Lipschitz invariant. We also show Theorem 7.4, which enables us to compute lct(I) in terms of Lojasiewicz exponents when I is monomial. We start with a quick survey on log canonical thresholds. We refer to the survey [34] for more information about the notion of log canonical threshold. The log canonical threshold of a function f : (Cn , 0) → C, denoted by lct(f ), is the supremum of those s so that |f (x)|−2s is locally integrable at 0, that is, integrable on some compact neighbourhood of 0. This definiton is generalized for ideals as follows. MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 19 Definition 7.1. Let I be an ideal of On . Let us consider a generating system {g1 , . . . , gr } of I. The log canonical threshold of I, denoted by lct(I), is defined as follows: −s lct(I) = sup{s ∈ R>0 : |g1(x)|2 + · · · + |gr (x)|2 is locally integrable at 0}. It is straightforward to see that this definition does not depend on the choice of generating 1 (see for systems of I. The Arnold index of I, denoted by µ(I), is defined as µ(I) = lct(I) instance [12]). One origin of the notion of log canonical threshold comes back to analysis on complex powers as generalized functions. M. Atiyah ([1]) showed a way to compute (candidate) poles of complex powers using resolution of singularities. This leads to the following well-known result. P Theorem 7.2. Let π : M → Cn be a proper modification so that (π ∗ I)0 = i mi Di where Di form a family of normal crossing divisors. Then nk + 1o X i where KM = ki Di is the canonical divisor of M. lct(I) = min i mi i The proof is based on the following observation: Z dx ∧ dx̄ mn −2s k1 1 |xm |x1 · · · xknn |2 √ n < ∞ 1 · · · xn | −1 kxk≤ε If I ⊆ mrn , then ⇐⇒ mi s < ki + 1, for all i. n lct(mn ) = r r by [34, Property 1.14]. As a consequence, we conclude that lct(I) ord(I) 6 n. Combining this with [34, Property 1.18], we have 1 n 6 lct(I) 6 . ord(I) ord(I) lct(I) 6 lct(mrn ) 6 Theorem 7.3. (i) If two functions f and g of On are bi-Lipschitz K-equivalent, then lct(f ) = lct(g). (ii) If two ideals I and J of On are bi-Lipschitz equivalent, then lct(I) = lct(J). Proof. (i): Assume that we have g(ϕ(x)) = φx (f (x)), for all x belonging to some open neighbourhood of 0 ∈ Cn , for a bi-Lipschitz homeomorphism ϕ : (Cn , 0) → (Cn , 0), x 7→ x′ = ϕ(x), and bi-Lipschitz homeomorphisms φx : (C, 0) → (C, 0), y 7→ y ′ = φx (y). By Rademacher’s theorem (see [27, Theorem 5.1.11]), ϕ is differentiable almost everywhere in the sense of Lebesgue measure, and its jacobian J(ϕ) is measurable. By Lipschitz property, we have |J(ϕ)| . 1 and |φx (y)| ∼ |y|. So we have Z Z ′ ′ dx ∧ dx̄ ′ −2s dx ∧ dx̄ |g(ϕ(x))|−2s|J(ϕ)| √ n √ n = |g(x )| −1 −1 K ϕ(K) Z dx ∧ dx̄ . |φx (f (x))|−2s √ n −1 ZK dx ∧ dx̄ . |f (x)|−2s √ n −1 K 20 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI where K is a compact neighbourhod of 0. This implies lct(f ) 6 lct(g) and vice versa. (ii): Choose f = (f1 , . . . , fp ) and g = (g1 , . . . , gq ) so that I = hf1 , . . . , fp i, J = hg1 , . . . , gq i and kf (x)k ∼ kg(ϕ(x))k where ϕ : (Cn , 0) → (Cn , 0) is a bi-Lipschitz homeomorphism. We have Z Z Z ′ ′ dx ∧ dx̄ dx ∧ dx̄ −2s ′ −2s dx ∧ dx̄ kg(ϕ(x))k |J(ϕ)| √ n . kf (x)k−2s √ n √ n = kg(x )k −1 −1 −1 K K ϕ(K) where K is a compact neighbourhod of 0. This implies lct(I) 6 lct(J) and vice versa.  Theorem 7.4. Let I be an ideal of On such that V (I) ⊆ V (x1 · · · xn ). We have (7.1) 1 6 lct(I)Lx1 ···xn (I) and equality holds when I is a monomial ideal. Proof. Let us consider an analytic map germ f = (f1 , . . . , fp ) : (Cn , 0) → (Cp , 0) such that I = hf1 , . . . , fp i. Let θ ∈ R>0 such that |x1 . . . xn |θ . kf (x)k. If s > 0 then Z Z dx ∧ dx̄ −2s dx ∧ dx̄ √ n . kf (x)k |x1 · · · xn |−2sθ √ n . −1 −1 K K Thus s < lct(I) whenever sθ < 1. This implies that 1/Lx1···xn (I) 6 lct(I). If I is monomial, then we consider the toric modification π : M → Cn corresponding to a regular subdivision of Γ+ (I). Let a denote a primitive vector which generate a 1-cone P of this regular fan. Then the order of |x1 · · · xn |θ ◦ π is ni=1 ai θ = (ka + 1)θ along the exceptional divisor corresponding to a, where ka denotes the multiplicity of the canonical divisor along the component corresponding to a. The order of |f ◦ π| is ℓ(a, I) along the exceptional divisor corresponding to a. So we have n ℓ(a, I) o 1 = , Lx1 ···xn (I) = max P lct(I) i ai where the maximum is taken over those a which correspond to the components of the exceptional divisor of π.  The previous result is motivated by [22, Example 5]. Example 7.5. Let us consider the ideal I = hx + y, xyi of C[[x, y]]. Then Lxy (I) = 1 and lct(I) = 3/2. We remark that I = hx + yi + hx, yi2. Hence this example shows that, in general, equality does not hold in (7.1). Proposition 7.6. Let I and J be ideals of On such that V (J) ⊆ V (I). Then (7.2) lct(I) 6 LI (J) lct(J). Proof. Set I = hf1 , . . . , fr i and J = hg1 , . . . , gs i. If kf (x)kθ . kg(x)k, for some θ ∈ R>0 and we fix any s > 0 then Z Z dx ∧ dx̄ −2s dx ∧ dx̄ √ n . kg(x)k kf (x)k−2sθ √ n . −1 −1 K K This means that sθ < lct(I) implies s < lct(J), i.e., lct(I)/θ 6 lct(J). We thus obtain that lct(I) ≤ θ lct(J).  MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 21 Remark 7.7. It is natural to ask when the equality holds in (7.2). If I and J are monomial ideal of On , then we have nP a o n ℓ(a, J) o nP a o i i i i , lct(J) = min , L (J) = max . lct(I) = min I a∈Rn a∈Rn a∈Rn ℓ(a, I) ℓ(a, J) ℓ(a, I) >0 >0 >0 When the same a attains these minimums and maximum, we have lct(I) = LI (J) lct(J). 8. Log canonical thresholds of generic sections Definition 8.1. Let I be an ideal of On . For any integer k ∈ {0, 1, . . . , n − 1} we set lct(n−k) (I) = lct(I|L ), where L denote a generic (n − k)-dimensional linear subspace of Cn , and I|L denote the restriction of the ideal I to the space L. By the semicontinuity of the log canonical threshold ([29, Corollary 9.5.39]), for every family {Lt }t∈U of linear subspaces of dimension n − k with L0 = L there is an open neighborhood W of 0 such that lct(I|Lt ) > lct(I|L0 ) for every t ∈ W . So lct(n−k) (I|L ) is well-defined and characterized as maximal possible one, despite of the fact that the isomorphism classes of I|Lt may vary along t. When L is the zero set of h1 , . . . , hk , then lct(n−k) (I) is the log canonical threshold of the ideal generated by the image of I in On /hh1 , . . . , hk i. By Proposition 4.5 of [33] (or Property 1.17 of [34]), we have (8.1) lct(1) (I) 6 lct(2) (I) 6 · · · 6 lct(n) (I) We know that lct(n) (I) = lct(I) and lct(1) (I) = 1/ ord(I) are bi-Lipschitz invariant. So it is natural to ask the following Question 8.2. Is lct∗ (I) = (lct(n) (I), lct(n−1) (I), . . . , lct(1) (I)) a bi-Lipschitz invariant? Theorem 7.4 has the following analogy for lct(k) (I). Theorem 8.3. Let I be an ideal of On such that V (I) ⊆ V (x1 · · · xn ). Then k 1 − 6 lct(n−k) (I)Lx(n−k) (I) 1 ···xn n for all k = 0, 1, . . . , n − 1. Proof. Let L be a linear (n − k)-dimensional subspace of Cn . Assume that I is generated by f1 , . . . , fm and set f = (f1 , . . . , fm ). Let Hi = {hi = 0} denote a generic hyperplane of Cn through 0 so that L = H1 ∩· · ·∩Hk . Let ω denote an (n−k)-form with dx1 ∧· · ·∧dxn = dh1 ∧ · · · ∧ dhk ∧ ω. Let π : M → Cn denote the blow up at the origin and let h′i denote the strict transform of hi . Set x1 = u1 and xi = u1 ui (i = 2, . . . , n). Since hi = u1 h′i , then dhi = d(u1h′i ) = u1 dh′i + h′i du1 = u1 dh′i on the set defined by h′i = 0. Let ω ′ denote an (n − k)-form with du1 ∧ · · · ∧ dun = dh′ ∧ ω ′ . Since L is generic, the strict transform L′ of L and the zeros of ui (i = 2, . . . , n) form a normal crossing variety. Since (u1 dh′1 ) ∧ · · · ∧ (u1 dh′k ) ∧ ω =dh1 ∧ · · · dhk ∧ ω 22 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI =dx1 ∧ · · · ∧ dxn =u1n−1 du1 ∧ · · · ∧ dun on L′ , we may assume that ω = un−k−1 ω ′ on L′ . If |x1 · · · xn |θ . kf k on L, we have 1 Z Z ω ∧ ω̄ −2s ω ∧ ω̄ |x1 · · · xn |−2θs √ n−k kf k √ n−k . K∩L K∩L −1 −1 Z ω ′ ∧ ω̄ ′ = |un1 u2 · · · un |−2θs |u1 |2(n−k−1) √ n−k π −1 (K)∩L′ −1 Z ω ′ ∧ ω̄ ′ = |u1 |−2(nθs−n+k+1) |u2 · · · un |−2θs √ n−k π −1 (K)∩L′ −1 (n−k) which is integrable whenever nθs < n − k. So we have that s < (1 − nk )/Lx1 ···xn (I) implies s < lct(n−k) (I), and we have k (I). 6 lct(n−k) (I)Lx(n−k) 1 ···xn n 1−  We close the paper to show a closed formula for lct(k) (I) when I is monomial. Theorem 8.4. Let I be an ideal of On such that I is a monomial ideal. Then o n P a − (n − k)a min (k) i i : a ∈ S (k) lct (I) = min ℓ(a, I) n P a − (n − k) o (k) i i = inf :a∈S ∩A ℓ(a, I) where A = {a = (a1 , . . . , an ) : min{a1 , . . . , an } = 1}, for all k ∈ {1, . . . , n}. Proof. We may assume that I is a monomial ideal. We consider a toric modification σ : X → Cn which dominate the blowing up at the origin. There is a coordinate system (y1 , . . . , yn ) so that σ is expressed by a1 a1 an xi = y1 i · · · yni (aji ∈ Z, i = 1, . . . , n). an Then we have hi = y1 min · · · ynmin h̃i where h̃i denotes the strict transform of hi by σ. So we have a1 an dhi = y1 min · · · ynmin dh̃i on the set defined by h̃i = 0. Since   a1 an ∧ki=1 (y1 min · · · ynmin dh̃i ) ∧ ω =dh1 ∧ · · · ∧ dhk ∧ ω =dx1 ∧ · · · ∧ dxn P =y1 we obtain that P ω = y1 i a1i −ka1min −1 i a1i −1 P · · · yn i P · · · yn i an i −1 n an i −kamin −1 dy1 ∧ · · · ∧ dyn ω̃ MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 23 where ω̃ is a holomorphic (n − k)-form which does not vanish on the strict transform L̃ of L by σ with dy1 ∧ · · · ∧ dyn = dh̃1 ∧ · · · ∧ dh̃k ∧ ω̃. Since L is generic, L̃ and the zeros of yj form a normal crossing variety and we conclude that n P a − ka o min (n−k) i i lct (I) = min : a ∈ S (n−k) . ℓ(a, I) We complete the proof by replacing k by n − k.  References [1] M. F. Atiyah, Resolution of singularities and division of distributions, Comm. Pure Appl. Math. 23 (1970), 145–150. [2] L. Birbrair, A. Fernandes and W. D. Neumann, Bi-Lipschitz geometry of weighted homogeneous surface singularities. Math. Ann. 342 (2008), no. 1, 139–144. [3] L. Birbrair, J. C. F. Costa, A. Fernandes and M. A. S. Ruas, K-bi-Lipschitz equivalence of real function-germs. Proc. Amer. Math. Soc. 135 (2007), no. 4, 1089–1095. [4] C. Bivià-Ausina, Local Lojasiewicz exponents, Milnor numbers and mixed multiplicities of ideal, Math. Z. 262 (2009), no. 2, 389-409. [5] C. Bivià-Ausina, Joint reductions of monomial ideals and multiplicity of complex analytic maps, Math. Res. Lett. 15 (2008), no. 2, 389–407. [6] C. Bivià-Ausina and S. Encinas, Lojasiewicz exponent of families of ideals, Rees mixed multiplicities and Newton filtrations, Rev. Math. Complut. 26 (2013), no. 2, 773–798. [7] C. Bivià-Ausina and S. Encinas, Lojasiewicz exponents and resolution of singularities, Arch. Math. 93 (2009), no. 3, 225-234. [8] C. Bivià-Ausina, T. Fukui and M. J. Saia, Newton graded algebras and the codimension of nondegenerate ideals, Math. Proc. Cambridge Philos. Soc. 133 (2002), 55–75. [9] J. Briançon and J. P. Speder, La trivialité topologique n’implique pas les conditions de Whitney, C. R. Acad. Sc. Paris 280 (1975), 365–367. [10] J. Briançon and J. P. Speder, Les conditions de Whitney impliquent µ∗ constant, Ann. Inst. Fourier 26 (1976), no. 2, 153–163. [11] W. Decker, G.-M. Greuel, G. Pfister and H. Schönemann, Singular 3-1-3 — A computer algebra system for polynomial computations, http://www.singular.uni-kl.de (2011). [12] T. de Fernex, L. Ein and M. Mustaţă, Multiplicities and log canonical threshold, J. Algebraic Geom. 13 (2004), no. 3, 603–615. [13] C. Eyral, Zariski’s multiplicity question – a survey, New Zealand J. Math. 36 (2007), 253–276. [14] A. C. G. Fernandes and M. A. S. Ruas, Bi-Lipschitz determinacy of quasihomogeneous germs, Glasg. Math. J. 46 (2004), no. 1, 7782. [15] M. Furuya and M. Tomari, A characterization of semi-quasi-homogeneous functions in terms of the Milnor number, Proc. Amer. Math. Soc. 132 (2004), no. 7, 1885–1890. [16] T. Gaffney, Bi-Lipschitz equivalence, integral closure and invariants, Real and complex singularities, 125–137, London Math. Soc. Lecture Note Ser., 380, Cambridge Univ. Press, Cambridge, 2010. [17] G. M. Greuel, Constant Milnor number implies constant multiplicity for quasihomogeneous singularities, Manuscripta Math. 56 (1986), 159–166. [18] J.-P. Henry and A. Parusiński, Existence of moduli for bi-Lipschitz equivalence of analytic functions, Compositio Math. 136 (2003), no. 2, 217–235. [19] J.-P. Henry and A. Parusiński, Invariants of bi-Lipschitz equivalence of real analytic functions, Geometric singularity theory, 67–75, Banach Center Publ., 65, Polish Acad. Sci., Warsaw, 2004. [20] M. Herrmann, S. Ikeda and U. Orbanz, Equimultiplicity anb Blowing Up. An algebraic study with an appendix by B. Moonen, Springer-Verlag (1988). 24 CARLES BIVIÀ-AUSINA AND TOSHIZUMI FUKUI [21] M. Hickel, Fonction asymptotique de Samuel des sections hyperplanes et multiplicité, J. Pure Appl. Algebra 214 (2010), no. 5, 634-645. [22] J. A. Howald, Multiplier ideals of monomial ideals, Trans. Amer. Math. Soc. 353 (2001), no. 7, 26652671. [23] C. Huneke and I. Swanson, Integral Closure of Ideals, Rings, and Modules, London Math. Soc. Lecture Note Series 336, 2006, Cambridge University Press. [24] D. Juniati and G. Valette, Bi-Lipschitz trivial quasi-homogeneous stratifications, Saitama Math. J. 26 (2010), 1–13 [25] S. Koike and L. Paunescu, The directional dimension of subanalytic sets is invariant under biLipschitz homeomorphisms, Ann. Inst. Fourier (Grenoble) 59 (2009), no. 6, 2445–2467. [26] S. Koike, The Briançon-Speder and Oka families are not biLipschitz trivial, Several Topics in Singularity Theory, RIMS Kokyuroku 1328 (2003), 165–173. [27] S. Krantz and H. Parks, Geometric Integration Theory, Birkhuser, 2008. [28] T. Krasiński, G. Oleksik and A. Ploski, The Lojasiewicz exponent of an isolated weighted homogeneous surface singularity, Proc. Amer. Math. Soc. 137 (2009), no. 10, 3387–3397. [29] R. Lazarsfeld, Positivity in algebraic geometry II, Ergebnisse der Mathematik und ihrer Grenzgebiete, Vol. 49, Springer Verlag, Berlin, 2004. [30] M. Lejeune and B. Teissier, Clôture intégrale des idéaux et equisingularité, with an appendix by J. J. Risler. Centre de Mathématiques, Ecole Polytechnique (1974) and Ann. Fac. Sci. Toulouse Math. (6) 17 (2008), no. 4, 781–859. [31] J. Mather, Stability of C ∞ -map-germs III. Finitely determined map-germs, Inst. Hautes tudes Sci. Publ. Math. 35 (1968), 127–156. [32] J. Milnor, Singular points of complex hypersurfaces, Annals of Mathematics Studies, 61 Princeton University Press, Princeton, N.J.; University of Tokyo Press, Tokyo 1968 [33] M. Mustaţă, Singularities of pairs via jet schemes, J. Amer. Math. Soc. 15 (2002), 599–615. [34] M. Mustaţă, IMPANGA lecture notes on log canonical threshold, arXiv:1107.2676 (2011). [35] T. Mostowski, Lipschitz equisingularity, Dissertationes Math. 243 (1985), [36] D. O’Shea, Topologically trivial deformations of isolated quasihomogeneous hypersurface singularities are equimultiple, Proc. Amer. Math. Soc. 101 (1987), no. 2, 260–262. [37] A. Parusiński, Lipschitz stratification, Global analysis in modern mathematics (Orono, ME, 1991; Waltham, MA,1992), 73–89, Publish or Perish, Houston, TX, 1993. [38] A. Ploski, Multiplicity and the Lojasiewicz exponent, Singularities (Warsaw, 1985), 353–364, Banach Center Publ., 20, PWN, Warsaw, 1988. [39] A. Ploski, Semicontinuity of the Lojasiewicz exponent, Univ. Iagel. Acta Math. 48 (2010), 103–110. [40] D. Rees, Lectures on the asymptotic theory of ideals, London Math. Soc. Lecture Note Series 113 (1988), Cambridge University Press. [41] D. Rees, Generalizations of reductions and mixed multiplicities, J. London Math. Soc. (2) 29 (1984), 397–414. [42] D. Rees and J. Sally, General elements and joint reductions, Mich. Math. J. 35 (1988), no. 2, 241– 254. [43] J.-J. Risler and D. Trotman, Bi-Lipschitz invariance of the multiplicity, Bull. London Math. Soc. 29 (1997), no. 2, 200–204. [44] M. A. S. Ruas and G. Valette, C 0 and bi-Lipschitz K-equivalence of mappings, Math. Z. 269 (2011), no. 1-2, 293–308 [45] I. Swanson, Mixed multiplicities, joint reductions and quasi-unmixed local rings, J. London Math. Soc. (2) 48 (1993), no. 1, 1–14. [46] B. Teissier, Variétés polaires. I. Invariants polaires des singularités d’hypersurfaces, Invent. Math. 40 (1977), 267–292. [47] B. Teissier, Cycles évanescents, sections planes et conditions of Whitney, Singularités à Cargèse, Astérisque, no. 7–8 (1973), 285–362. MIXED LOJASIEWICZ EXPONENTS AND LOG CANONICAL THRESHOLDS 25 [48] G. Valette, Bi-Lipschitz sufficiency of jets, J. Geom. Anal. 19 (2009), no. 4, 963–993. [49] A. Varchenko, A lower bound for the codimension of the stratum µ =const by mixed Hodge structures, Vestnik MGU, Ser. Math. 6 (1982), 28-31. [50] C. T. C. Wall, Finite determinacy of smooth map-germs, Bull. London Math. Soc. 13 (1981), 481– 539. [51] O. Zariski, Some open questions in the theory of singularities, Bull. Amer. Math. Soc. 77 (1971), 481–491. Institut Universitari de Matemàtica Pura i Aplicada, Universitat Politècnica de València, Camı́ de Vera, s/n, 46022 València, Spain E-mail address: [email protected] Department of Mathematics, Saitama University, 255 Shimo-Okubo, Sakura-ku Saitama 338-8570, Japan E-mail address: [email protected]
0math.AC
Infinite Horizon Average Optimality of the N-network Queueing Model in the Halfin–Whitt Regime arXiv:1602.03275v3 [math.OC] 28 Aug 2017 ARI ARAPOSTATHIS† AND GUODONG PANG‡ Abstract. We study the infinite horizon optimal control problem for N-network queueing systems, which consist of two customer classes and two server pools, under average (ergodic) criteria in the Halfin–Whitt regime. We consider three control objectives: 1) minimizing the queueing (and idleness) cost, 2) minimizing the queueing cost while imposing a constraint on idleness at each server pool, and 3) minimizing the queueing cost while requiring fairness on idleness. The running costs can be any nonnegative convex functions having at most polynomial growth. For all three problems we establish asymptotic optimality, namely, the convergence of the value functions of the diffusion-scaled state process to the corresponding values of the controlled diffusion limit. We also present a simple state-dependent priority scheduling policy under which the diffusion-scaled state process is geometrically ergodic in the Halfin–Whitt regime, and some results on convergence of mean empirical measures which facilitate the proofs. 1. Introduction Parallel server networks in the Halfin–Whitt regime have been very actively studied in recent years. Many important insights have been gained in their performance, design and control. One important question that has mostly remained open is optimal control under the long-run average expected cost (ergodic) criterion. Since it is prohibitive to exactly solve the discrete state Markov decision problem, the plausible approach is to solve the control problem for the limiting diffusion in the Halfin–Whitt regime and use this as an approximation. However, the results in the existing literature for ergodic control of diffusions (see a good review in Arapostathis et al. [2]) cannot be directly applied to the class of diffusion models arising from the parallel server networks in the Halfin–Whitt regime. Recently, Arapostathis et al. [3] and Arapostathis and Pang [1] have developed the basic tools needed to tackle this class of ergodic control problems. Given an optimal solution to the control problem for the diffusion limit, the important task that remains is to show it gives rise to a scheduling policy for the network and establish that any sequence of such scheduling policies is asymptotically optimal in the Halfin–Whitt regime. Under the discounted cost criterion, this task has been accomplished in Atar et al. [8] for the multiclass V-model (or V-network ), which consists of multiple customer classes that are catered by servers in a single pool, and in Atar [7] for multiclass multi-pool networks with certain tree topologies. Under the ergodic criterion, the problem becomes much more difficult because it is intertwined with questions concerning the ergodicity of the diffusion-scaled state process under the scheduling policies. This relates to various open questions on the stochastic stability of parallel server networks in the Halfin–Whitt regime. † Department of Electrical and Computer Engineering, The University of Texas at Austin, 2501 Speedway St., EER 7.824, Austin, TX 78712 ‡ The Harold and Inge Marcus Dept. of Industrial and Manufacturing Eng., College of Engineering, Pennsylvania State University, University Park, PA 16802 E-mail addresses: [email protected], [email protected]. 2000 Mathematics Subject Classification. 60K25, 68M20, 90B22, 90B36. Key words and phrases. parallel-server network, N-network, reneging/abandonment, Halfin–Whitt (QED) regime, diffusion scaling, long time average control, ergodic control, ergodic control with constraints, geometric ergodicity, stable Markov optimal control, asymptotic optimality. 1 2 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Stability of the multiclass V-model in the Halfin–Whitt regime Class 2 Class 1 is well treated in Gamarnik and Stolyar [14]. Stolyar [23] has recently proved the tightness of the stationary distributions of the diffusion-scaled state process for the so-called N-network (or Nmodel ), depicted in Figure 1, with no abandonment under a static priority policy. For the V-network, Arapostathis et al. [3] have shown that a sequence of scheduling policies constructed from the optimal solution to the diffusion control problem under the ergodic Pool 1 Pool 2 criterion is asymptotically optimal. In this construction, the state space is divided into a compact subset with radius in the order of the square root of the number of servers around the steady state, and its complement. An approximation to the optimal control for Figure 1. The N-Network the diffusion is used inside this set, and a static priority policy is employed in its complement. It follows from the results of [3] that under this sequence of scheduling policies the state process is geometrically ergodic. The proof of asymptotic optimality takes advantage of the fact that, under the static priority scheduling policy, the state process of the V-model in the Halfin–Whitt regime is geometrically ergodic. In fact, such a static priority policy for the V-model also corresponds to a constant Markov control, under which the limiting diffusion is geometrically ergodic. However, for multiclass multi-pool networks, although the optimal control problem for the limiting diffusion has been thoroughly solved in Arapostathis and Pang [1], the lack of sufficient understanding of the stochastic stability properties of the diffusion-scaled state process has been the critical obstacle to establishing asymptotic optimality. It is worth noting that this difficulty is related to the so-called “joint work conservation” (JWC) condition which plays a key role in the study of multiclass multi-pool networks as shown in Atar [6, 7]. Although the JWC condition holds for the limiting diffusions over the entire state space, it generally holds only in a bounded subset of the state space for the diffusion-scaled process, whose radius is in the order of the number of servers around the steady state. Thus, an optimal control derived from the limiting diffusion does not translate well to a scheduling policy which is compatible with the controlled dynamics of the network on the entire state space. At the same time, although as shown in [1] there exists a constant Markov control under which the limiting diffusion of multiclass multi-pool networks is geometrically ergodic, it is unclear if this is also the case for the diffusion-scaled state processes under the corresponding static priority scheduling policy. Therefore, the limiting diffusion does not offer much help in the synthesis of a suitable scheduling policy on the part of the state space where the JWC condition does not hold, and as a result constructing stable policies for multiclass multi-pool networks is quite a challenge. In this paper, we address these challenging problems for the N-network. We study three ergodic control problems: (P1) minimizing the queueing (and idleness) cost, (P2) minimizing the queueing cost while imposing a constraint on the idleness of each server pool (e.g., the long-run average idleness cannot exceed a specified threshold), and (P3) minimizing the queueing cost while requiring fairness on idleness (e.g., the average idleness of the two server pools satisfies a fixed ratio condition). The running cost can be any nontrivial nonnegative convex functions having at most polynomial growth. Under its usual parameterization, the control specifies the number of customers from each class that are scheduled to each server pool, and we refer to it as a “scheduling” policy. However, the control can be also parameterized in a way so as to specify which class of customers should be scheduled to server pool 2 if it has any available servers (“scheduling” control), and which of the server pools should class-1 customers be routed to, if both pools have available servers (“routing” control). The optimal control problems for the limiting diffusion corresponding to (P1)– (P3) are well-posed and in the case of (P1)–(P2) the solutions can be fully characterized via HJB equations, following the methods in [1, 3]. The dynamic programming characterization for (P3) is INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 3 more difficult. This is one of those rare examples in ergodic control where the running cost is not bounded below or above, and there is no blanket stability property. In this paper, we establish the existence of a solution to the HJB equation, and the usual characterization of optimality for this problem. We first present a Markov scheduling policy, for the N-network under which the diffusion-scaled state processes are geometrically ergodic in the Halfin–Whitt regime (see Section 3.2). Unlike the V-model, this scheduling policy is a state-dependent priority (SDP) policy, i.e., priorities change as the system state varies—yet it is simple to describe. This result is significant since it indicates that the ergodic control problems for the diffusion-scaled processes in the Halfin–Whitt regime have finite values. Moreover, it can be used as a scheduling policy outside a bounded subset of the state space where the JWC property might fail to hold. On the other hand, it follows from the theory in Arapostathis and Pang [1] that the controlled diffusion limit is geometrically ergodic under some constant Markov control (see Theorem 4.2 in [1]). In this paper we show that a much stronger result applies for the N-network (Lemma 4.1): as long as the scheduling control is a constant Markov control with pool 2 prioritizing class 2 over 1, the controlled diffusion limit is geometrically ergodic, uniformly over all routing controls (e.g., class-1 customers prioritizing server pool 1 over 2, or a state-dependent priority policy, or even a non-stationary one). The main results of the paper center around the proof of convergence of the value functions, which is accomplished by establishing matching lower and upper bounds (see Theorems 5.1–5.2). To prove the lower bound, the key is to show that as long as the long-run average first-order moment of the diffusion-scaled state process is finite, the associated mean empirical measures are tight and converge to an ergodic occupation measure corresponding to a stationary stable Markov control for the limiting diffusion (Lemma 7.1). In fact, we can show that for the N-network, under any admissible (work conserving) scheduling policy, the long-run average mth (m ≥ 1) moment of the diffusion-scaled state process is bounded by the long-run average mth moment of the diffusionscaled queue under that policy (Lemma 8.1). The lower bounds can then be deduced from these observations. It is worth noting that in order to establish asymptotic optimality for the fairness problem (P3), we must relax the equality in the constraint and show instead that the constraint is asymptotically feasible. In order to establish the upper bound, a Markov scheduling policy is synthesized which is the concatenation of a Markov policy induced by the solution of the ergodic control problem for the diffusion limit, and which is applied on a bounded subset of the state space where the JWC condition holds, and the SDP policy, which is applied on the complement of this set. The proof involves the following key components. First, we apply the spatial truncation approximation technique developed in Arapostathis et al. [3] and Arapostathis and Pang [1] for the ergodic control problem for the diffusion limit. This provides us with an -optimal continuous precise control. Second, we show that under the concatenation of the Markov scheduling policy induced by this -optimal control and the SDP policy, the diffusion-scaled state processes are geometrically ergodic (Lemma 9.1). Then we prove that the mean empirical measures of the diffusion-scaled process and control, converge to the ergodic occupation measure of the diffusion limit associated with the -optimal precise control originally selected (Lemma 7.2). Uniform integrability implied by the geometric ergodicity takes care of the rest. 1.1. Literature review. In a certain way, the N-network has been viewed as the benchmark of multiclass multi-pool networks, mainly because it is simple to describe, yet it has complicated enough dynamics. There are several important studies on stochastic control of parallel server networks, focusing on N-networks. Xu et al. [30] studied the Markovian single-server N-network and showed that a threshold scheduling policy is optimal under the expected discounted and long-run average linear holding cost, utilizing a Markov decision process approach. In the conventional 4 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK (single-server) heavy-traffic regime, the N-network with two single severs, was first studied in Harrison [19], under the assumption of Poisson arrivals and deterministic services, and a “discretereview” policy is shown to be asymptotically optimal under an infinite horizon discounted linear queueing cost. The N-model with renewal arrival processes and general service time distributions was then studied in Bell and Williams [10], as a Brownian control problem under an infinite horizon discounted linear queueing cost, and a threshold policy is shown to be asymptotically optimal. Ghamami and Ward [15] studied the N-network with renewal arrival processes, general service time distributions and exponential patience times, and showed a two-threshold scheduling policy is asymptotically optimal via a Brownian control problem under an infinite horizon discounted linear queueing cost. Brownian control models for multiclass networks were pioneered in Harrison [18, 20] and have been extended to many interesting networks; see Williams [29] for an extensive review of that literature. In the many-server Halfin–Whitt regime, Atar [6, 7] pioneered the study of multiclass multi-pool networks with abandonment (of a certain tree topology) via the corresponding control problems for the diffusion limit under an infinite-horizon discounted cost. Gurvich and Whitt [16, 17] have studied queue-and-idleness-ratio controls for multiclass multi-pool networks (including the N-network) in the Halfin–Whitt regime by establishing a State-Space-Collapse property, under certain assumptions on the network structure and the system parameters. The N-network with many-server pools and abandonment has been recently studied in Tezcan and Dai [26], where a static priority policy is shown to be asymptotically optimal in the Halfin–Whitt regime under a finite-time horizon cost criterion. In Ward and Armony [27], some blind fair routing policies are proposed for some multiclass multi-pool networks (including the N-network), where the control problems are formulated to minimize the average queueing cost under a fairness constraint on the idleness. On the other hand, most of the existing results on the stochastic control of multiclass multi-pool networks in the Halfin–Whitt regime have only considered either discounted cost criteria (Atar [6, 7], Atar et al. [9]) or finite-time horizon cost criteria (Dai and Tezcan [12, 13]). There is only limited work of multiclass networks under ergodic cost criteria. Arapostathis et al. [3] have recently studied the multiclass V-model under ergodic cost in the Halfin–Whitt regime. The inverted V-model is studied in Armony [4], and it is shown that the fastest-server-first policy is asymptotically optimal for minimizing the steady-state expected queue length and waiting time. For the same model, Armony and Ward [5] showed that a threshold policy is asymptotically optimal for minimizing the steady-state expected queue length and waiting time subject to a “fairness” constraint on the workload division. Biswas [11] has recently studied a multiclass multi-pool network with “help” under an ergodic cost criterion, where each server pool has a dedicated stream of a customer class, and can help with other customer classes only when it has idle servers. The N-network does not belong to the class of models considered in Biswas [11]. For general multiclass multipool networks, Arapostathis and Pang [1] have thoroughly studied ergodic control problems for the limiting diffusion. However, as mentioned earlier, asymptotic optimality has remained open. This work makes a significant contribution in that direction, by studying the N-network. The fairness problem we study fills, in some sense (our formulation is more general), the asymptotic optimality gap in Ward and Armony [27], where the associated approximate diffusion control problems are studied via simulations. We also feel that this work contributes to the understanding of the stability of multiclass multipool networks in the Halfin–Whitt regime. In this topic, in addition to the stability studies of the V and N-networks in Gamarnik and Stolyar [14] and Stolyar [23], it is worthwhile mentioning the following relevant work. Stolyar and Yudovina [25] studied the stability of multiclass multipool networks under a load balancing scheduling and routing policy, “longest-queue freest-server” (LQFS-LB). They showed that the fluid limit may be unstable in the vicinity of the equilibrium point for certain network structures and system parameters, and that the sequence of stationary distributions of the diffusion-scaled processes may not be tight in both the underloaded regime and INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 5 the Halfin–Whitt regime. They also provided positive answers to the stability and exchange-of-limit results in the diffusion scale for one special class of networks. Stolyar and Yudovina [24] proved the tightness of the sequence of stationary distributions of multiclass multi-pool networks under a leaf activity priority policy (assigning static priorities to the activities in the order of sequential “elimination” of the tree leaves) in the scale n1/2+ε (n is the scaling parameter) for all ε > 0, which was extended to the diffusion scale n1/2 in Stolyar [23]. The stability/recurrence properties for general multiclass multi-pool networks under other scheduling policies remain open. As alluded above, the main challenge to establish asymptotic optimality for general multiclass multi-pool networks is to understand the stochastic stability/recurrence properties of the diffusionscaled state processes in the Halfin-Whitt regime. Despite the recent development in [23, 24, 25], these are far from being adequate for proving the asymptotic optimality for general multiclass multi-pool networks. The stochastic stability/recurrence properties may depend critically upon the network topology and/or parameter assumptions. We believe that the methodology developed here for the N-network will provide some important insights on what stochastic stability properties are required and the roles they may play in proving asymptotic optimality. 1.2. Organization of the paper. The notation used in this paper is summarized in Section 1.3. A detailed description of the N-network model is given in Section 2. We define the control objectives in Section 3.1 and present a state-dependent priority policy that is geometrically stable in Section 3.2. We state the corresponding ergodic control problems for the limiting diffusion, as well as the results on the characterization of optimality in Section 4. The asymptotic optimality results are stated in Section 5. We describe the system dynamics and an equivalent control parameterization in Section 6. In Section 7, we establish convergence results for the mean empirical measures for the diffusion-scaled state processes. We then prove the lower and upper bounds in Sections 8 and 9, respectively. The proof of geometric stability of the SDP policy is given in Appendix A, and Appendix B is concerned with the proof of Theorem 4.3. 1.3. Notation. The following notation is used in this paper. The symbol R, denotes the field of real numbers, and R+ , N, and Z denote the sets of nonnegative real numbers, natural numbers, and integers, respectively. Given two real numbers a and b, the minimum (maximum) is denoted by a ∧ b (a ∨ b), respectively. Define a+ := a ∨ 0 and a− := −(a ∧ 0). The integer part of a real number a is denoted by bac. We also let e := (1, 1)T . For a set A ⊂ Rd , we use Ā, Ac , and 1A to denote the closure, the complement, and the indicator function of A, respectively. A ball of radius r > 0 in Rd around a point x is denoted by Br (x), or simply as Br if x = 0. The Euclidean norm on Rd is denoted by | · |, x · y denotes the inner product P of x, y ∈ Rd , and kxk := di=1 |xi |. For a nonnegative function g ∈ C(Rd ) we let O(g) denote the space of functions f ∈ C(Rd ) |f (x)| satisfying supx∈Rd 1∨g(x) < ∞. We also let o(g) denote the subspace of O(g) consisting of those |f (x)| functions f satisfying lim sup|x|→∞ 1∨g(x) = 0 . Abusing the notation, O(x) and o(x) occasionally denote generic members of these sets. We let Cc∞ (Rd ) denote the set of smooth real-valued functions on Rd with compact support. Given any Polish space X , we denote by P(X ) the set of probability measures on X and we endow P(X ) with the Prokhorov metric. For ν ∈ R P(X ) and a Borel measurable map f : X → R, we often use the abbreviated notation ν(f ) := X f dν . The quadratic variation of a square integrable martingale is denoted by h · , · i. For any path X(·) of a càdlàg process, we use the notation ∆X(t) to denote the jump at time t. 2. Model Description All stochastic variables introduced below are defined on a complete probability space (Ω, F, P). The expectation w.r.t. P is denoted by E. 6 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 2.1. The N-network model. Consider an N-network with two classes of jobs (or customers) and two server pools, as depicted in Figure 1. Jobs of each class arrive according to a Poisson process with rates λni , i = 1, 2. There are two server pools, each of which have multiple statistically identical servers, and servers in pool 1 can only serve class-1 jobs, while servers in pool 2 can serve both classes of jobs. Let Njn be the number of servers in pool j, j = 1, 2. The service times of all jobs are exponentially distributed, where jobs of class 1 are served at rates µn11 and µn12 by servers in pools 1 and 2, respectively, while jobs of class 2 are served at a rate µn22 by servers in pool 2. Throughout the paper we set µn21 ≡ 0, and µ21 ≡ 0. Jobs may abandon while waiting in queue, with an exponential patience time with rate γin for i = 1, 2. We study a sequence of such networks indexed by an integer n which is the order of the number of servers and let n → ∞. Throughout the paper we assume that the parameters satisfy the following conditions. Assumption 2.1. (Halfin–Whitt Regime) As n → ∞, the λni λni − nλi √ → λ̂i , γin → λi > 0 , n n Njn √ → νj > 0 , n (n−1 Njn − νj ) n √ µnij → µij > 0 , n (µnij − µij ) → We also have following hold: → γi ≥ 0 , → 0, µ̂ij , i = 1, 2 , j = 1, 2 , i, j = 1, 2 . λ1 − µ11 ν1 λ2 + = 1. µ12 ν2 µ22 ν2 λ1 > µ11 ν1 , (2.1) Note that (2.1) implies that class-1 jobs are overloaded for server pool 1, class-2 jobs are underloaded for server pool 2, and the overload of class-1 jobs can be served by server pool 2 so that both server pools are critically loaded. This assumption is referred to as the complete resource pooling condition (Atar [7], Williams [28]). Let ξ ∗ be a constant matrix # " λ1 −µ11 ν1 1 µ12 ν2 ξ ∗ := . (2.2) λ2 0 µ22 ν2 ∗ can be interpreted as the steady-state fraction of service allocation of pool j to The quantity ξij ∗) class-i jobs in the fluid scale. Define x∗ = (x∗i )i=1,2 and z ∗ = (zij i,j=1,2 by ∗ ∗ x∗1 := ξ11 ν1 + ξ12 ν2 , ∗ ∗ z ∗ = (zij ) := (ξij νj ) = ∗ x∗2 := ξ22 ν2 , " ν1 λ1 −µ11 ν1 µ12 λ2 µ22 (2.3) # . (2.4) 0 ∗ can be interThen x∗i can be interpreted as the steady-state total number of class-i jobs, and zij preted as the steady-state number of class-i jobs receiving service in pool j, in the fluid scale. It is easy to check that e · x∗ = e · ν, where ν := (ν1 , ν2 )T . For each i = 1, 2, let Xin = {Xin (t) : t ≥ 0} and Qni = {Qni (t) : t ≥ 0} be the total number of class-i jobs in the system and in the queue, respectively. For each j = 1, 2, let Yjn = {Yjn (t) : t ≥ 0} n = {Z n (t) : t ≥ 0} be be the number of idle servers in server pool j. For i, j = 1, 2, let Zij ij n ≡ 0. The following the number of class-i jobs being served in server pool j, and note that Z21 fundamental balance equations hold: n n n X1n (t) = Qn1 (t) + Z11 (t) + Z12 (t) , N1n = Y1n (t) + Z11 (t) , n X2n (t) = Qn2 (t) + Z22 (t) , Xin (t) ≥ 0 , Qni (t) ≥ 0 , Zn n) (Zij i,j=1,2 , for each t ≥ 0. We let = n n N2n = Y2n (t) + Z12 (t) + Z22 (t) , Yjn (t) ≥ 0 , Xn = n Zij (t) ≥ 0 , (Xin )i=1,2 , i, j = 1, 2 , and analogously define Qn and Y n . (2.5) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 7 2.2. Scheduling control. We only consider work conserving policies that are non-anticipative and preemptive. Work conservation requires that the processes Qn and Y n satisfy Qn1 (t) ∧ Yjn (t) = 0 ∀j = 1, 2, and Qn2 (t) ∧ Y2n (t) = 0 , ∀t ≥ 0. In other words, no server will idle if there is any job in a queue that the server can serve. Service preemption is allowed, that is, jobs in service at pool 2 can be interrupted and resumed at a later time in order to serve jobs from the other class. Let q1 (x, z) := x1 − z11 − z12 , y1n (x, z) := N1n − z11 , y2n (x, z) := N2n − z12 − z22 . q2 (x, z) := x2 − z22 , We define the action set Z n (x) as  Z n (x) := z ∈ Z2×2 : z21 = 0 , q1 (x, z) ∧ q2 (x, z) ∧ y1n (x, z) ∧ y2n (x, z) ≥ 0 , +  q1 (x, z) ∧ y1n (x, z) + y2n (x, z) = 0 , q2 (x, z) ∧ y2n (x, z) = 0 . Define the σ-fields  n Ftn := σ X n (0), Ãni (s), S̃ij (s), R̃in (s) : i, j = 1, 2, 0 ≤ s ≤ t ∨ N ,  n Gtn := σ δ Ãni (t, r), δ S̃ij (t, r), δ R̃in (t, r) : i, j = 1, 2, r ≥ 0 , where N is the collection of all P-null sets, and Ãni (t) := Ani (λni t),  Z t  n n n n S̃ij (t) := Sij µij Zij (s) ds , δ Ãni (t, r) := Ãni (t + r) − Ãni (t) ,  Z t  n n n n n n δ S̃ij (t, r) := Sij µij Zij (s) ds + µij r − S̃ij (t) , 0  R̃in (t) := Rin γin Z 0 t Qni (s) ds  ,  Z t  n n n n n δ R̃i (t, r) := Ri γi Qi (s) ds + γi r − R̃in (t) . 0 Ani , n Sij 0 Rin The processes and are all rate-1 Poisson processes, representing the arrival, service and abandonment quantities, respectively. We assume that they are mutually independent, and also independent of the initial condition Xin (0). Note that quantities with subscript i = 2, j = 1 are all equal to zero. The filtration Fn := {Ftn : t ≥ 0} represents the information available up to time t, and the filtration Gn := {Gtn : t ≥ 0} contains the information about future increments of the processes. We say that a scheduling policy Z n is admissible if (i) Z n (t) ∈ Z n (X n (t)) for all t ≥ 0; (ii) Z n (t) is adapted to Ftn ; (iii) Ftn is independent of Gtn at each time t ≥ 0; n (t, ·) agrees in law with S n (µn ·), (iv) for each i, j ∈ {1, 2}, and for each t ≥ 0, the process δ S̃ij ij ij and the process δ R̃in (t, ·) agrees in law with Rin (γin ·). We denote the set of all admissible scheduling policies (Z n , Fn , Gn ) by Zn . Abusing the notation we sometimes denote this as Z n ∈ Zn . Following Atar [7], we also consider a stronger condition, joint work conservation (JWC), for preemptive scheduling policies. Namely, for each x ∈ Z2+ , there exists a rearrangement z ∈ Z n (x) of jobs in service such that there is either no job in queue or no idling server in the system, satisfying e · q(x, z) ∧ e · y n (x, z) = 0 . (2.6) We let Xn denote the set of all possible values of Z2+ for which the JWC condition (2.6) holds, i.e.,  Xn := x ∈ Z2+ : (2.6) holds for some z ∈ Z n (x) . 8 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Note that the set Xn may not include all possible scenarios of the system state X n (t) for finite n at each time t ≥ 0. We quote a result from Atar [7], which is used later. Lemma 2.1 (Lemma 3 in Atar [7]). There exists a constant c0 > 0 such that, the collection of sets X̆n defined by  X̆n := x ∈ Z2+ : kx − nx∗ k ≤ c0 n , satisfies X̆n ⊂ Xn for all n ∈ N. Moreover, for any x, q, y ∈ Z2+ satisfying e · q ∧ e · y = 0 and e · (x − q) = e · (N n − y) ≥ 0, we have  n  N1 − y1 x1 − q1 − (N1n − y1 ) ∈ Z n (x) . (2.7) 0 x 2 − q2 We need the following definition. Definition 2.1. We fix some open ball B̆ centered at the origin, such that n(B̆ + x∗ ) ⊂ X̆n for all n ∈ N. The jointly work conserving action set Z̆ n (x) at x is defined as the subset of Z n (x), which satisfies ( z ∈ Z n (x) : e · q(x, z) ∧ e · y n (x, z) = 0 if x ∈ n(B̆ + x∗ ) , Z̆ n (x) := Z n (x) otherwise. We also define the associated admissible policies by   Z̆n := Z n ∈ Zn : Z n (t) ∈ Z̆ n X n (t) , ∀ t ≥ 0 , Z := {Z n ∈ Z̆n : n ∈ N} . We refer to the policies in Z as eventually jointly work conserving (EJWC). Remark 2.1. The ball B̆ is fixed in Definition 2.1 only for convenience. We could instead adopt a more general definition of Z, without affecting the results of the paper. Let {Dn , n ∈ N} be a √ collection of domains which covers R2 and satisfies Dn ⊂ Dn+1 , and nDn +nx∗ ⊂ X̆n for all n ∈ N. √ Then we redefine Z̆ n using Definition 2.1 and replacing n(B̆ + x∗ ) with nDn + nx∗ and define Z analogously. If {Z n } ⊂ Z, then, in the diffusion scale, JWC holds on an expanding sequence of domains which cover R2 . This is the reason behind the terminology EJWC. The EJWC condition plays a crucial role in the derivation of the controlled diffusion limit. Therefore, convergence of mean empirical measures of the diffusion-scaled state process and control, and thus, also the lower and upper bounds for asymptotic optimality are established for sequences {Z n , n ∈ N} ⊂ Z. 3. Ergodic Control Problems n n n T n) We define the diffusion-scaled processes Ẑ n = (Ẑij i,j∈{1,2} , X̂ = (X̂1 , X̂2 ) , and analogously for Q̂n and Ŷ n , by 1 X̂in (t) := √ (Xin (t) − nx∗i ) , n Q̂ni (t) 1 := √ Qni (t) , n where x∗ and z ∗ are defined in (2.3)–(2.4). 1 n n ∗ Ẑij (t) := √ (Zij (t) − nzij ), n Ŷjn (t) 1 := √ Yjn (t) , n (3.1) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 9 3.1. Control objectives. We consider three control objectives, which address the queueing (delay) and/or idleness costs in the system: (i) unconstrained problem, minimizing the queueing (and idleness) cost and (ii) constrained problem, minimizing the queueing cost while imposing a constraint on idleness, and (iii) fairness problem, minimizing the queueing cost while imposing a constraint on the idleness ratio between the two server pools. The running cost is a function of the diffusionscaled processes, which are related to the unscaled ones by (3.1). For simplicity, in all three cost minimization problems, we assume that the initial condition X n (0) is deterministic and X̂ n (0) → x ∈ R2 as n → ∞. Let r̂ : R2+ × R2+ → R+ be defined by r̂(q, y) := 2 X ξi qim i=1 + 2 X ζj yjm , q ∈ R2+ , y ∈ R2+ , for some m ≥ 1 , (3.2) j=1 where ξ = (ξ1 , ξ2 )T is a strictly positive vector and ζ = (ζ1 , ζ2 )T is a nonnegative vector. In the case ζ ≡ 0, only the queueing cost is minimized. In (P1) below, idleness may be added as a penalty n in the objective. We denote by EZ the expectation operator under an admissible policy Z n . (P1) (unconstrained problem) The running cost penalizes the queueing (and idleness). Let r̂(q, y) be the running cost function as defined in (3.2). Given an initial state X n (0), and an admissible scheduling policy Z n ∈ Zn , we define the diffusion-scaled cost criterion by Z T    1 Zn n n n n E r̂ Q̂ (s), Ŷ (s) ds . (3.3) J X̂ (0), Z := lim sup T →∞ T 0 The associated cost minimization problem becomes V̂ n (X̂ n (0)) :=  n n J X̂ (0), Z . inf n n Z ∈Z (P2) (constrained problem) The objective here is to minimize the queueing cost while imposing idleness constraints on the two server pools. Let r̂o (q) be the running cost function cor responding to r̂ in (3.2) with ζ ≡ 0. The diffusion-scaled cost criterion Jo X̂ n (0), Z n is defined analogously to (3.3) with running cost r̂o (Q̂n (s)), that is,  Z T   1 Zn n n n Jo X̂ (0), Z := lim sup r̂o Q̂ (s) ds . E T →∞ T 0 Also define n Jc,j X̂ (0), Z n  1 Zn := lim sup E T →∞ T Z T  m̃ Ŷjn (s) ds , j = 1, 2 , 0 with m̃ ≥ 1. The associated cost minimization problem becomes V̂cn (X̂ n (0)) := subject to Jc,j X̂ n (0), Z n   n n inf J X̂ (0), Z , o n n Z ∈Z ≤ δj , j = 1, 2 , (3.4) where δ = (δ1 , δ2 )T is a positive vector. (P3) (fairness) Here we minimize the queueing cost while keeping the average idleness of the two server pools balanced. Let θ be a positive constant and let 1 ≤ m̃ < m. The associated cost minimization problem becomes  V̂fn (X̂ n (0)) := ninf n Jo X̂ n (0), Z n , Z ∈Z subject to Jc,1 X̂ n (0), Z  n  = θJc,2 X̂ n (0), Z n . 10 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK We refer to V̂ n (X̂ n (0)), V̂cn (X̂ n (0)) and V̂fn (X̂ n (0)) as the diffusion-scaled optimal values for the nth system given the initial state X n (0), for (P1), (P2) and (P3), respectively. Remark 3.1. We choose running costs of the form (3.3) mainly to simplify the exposition. However, all the results of this paper still hold for more general classes of functions. Let ho : R2 → R+ be a convex function satisfying ho (x) ≥ c1 |x|m + c2 for some m ≥ 1 and constants c1 > 0 and c2 ∈ R, and h : R2 → R+ , hi : R → R+ , i = 1, 2, be convex functions that have at most polynomial growth. Then we can choose r̂(q, y) = ho (q) + h(y) for the unconstrained problem, and hi (yi ) as the functions in the constraints in (3.4) (with r̂o = ho ). For the problem (P3) we require in addition that h1 = h2 6= 0 and they are in o(|x|m ). The analogous running costs can of course be used in the corresponding control problems for the limiting diffusion, which are presented later in Section 4.2. 3.2. A geometrically stable scheduling policy. We introduce a Markov scheduling policy for the N-network that results in geometric ergodicity for the diffusion-scaled state process, and also implies that the diffusion-scaled cost in the ergodic control problem (P1) is bounded, uniformly in n := bξ ∗ N n c and N n := dξ ∗ N n e. Note that N n + N n = N n . n ∈ N. Let N12 12 2 22 22 2 12 22 2 Definition 3.1. For each n, we define the scheduling policy ž n = ž n (x), x ∈ Z2+ , by n ž11 (x) = x1 ∧ N1n , ( n n (x1 − N1n )+ ∧ N12 if x2 ≥ N22 n ž12 (x) = (x1 − N1n )+ ∧ (N2n − x2 ) otherwise, ( n n if x1 ≥ N1n + N12 x2 ∧ N22 n ž22 (x) =  x2 ∧ N2n − (x1 − N1n )+ otherwise. Note that the scheduling policy ž n is state-dependent, and can be interpreted as follows. Class-1 jobs prioritize server pool 1 over 2. Server pool 2 prioritizes the two classes of jobs depending on n , server pool 2 allocates no more than N n servers to the system state. Whenever x1 ≥ N1n + N12 22 n n servers to class-1 jobs. It is class-2 jobs, while whenever x2 ≥ N22 , it allocates no more than N12 easy to check that this policy ž n is work conserving. The resulting queue length and idleness q̌ n and y̌ n can be obtained by the balance equations: for x ∈ Z2+ , n n q̌1n (x) = x1 − ž11 (x) − ž12 (x) , n q̌2n (x) = x2 − ž22 (x) , n y̌1n (x) = N1n − ž11 (x) , n n y̌2n (x) = N2n − ž12 (x) − ž22 (x) . Definition 3.2. For each x ∈ R2+ , define x̃n (x) := x̂n (x) :=  x1 − nx∗1 , x2 − nx∗2 , (3.5) x̃n (x) √ . n where x∗ is given in (2.3). Also define  Sn := x̂n (x) : x ∈ Z2+ , S̆n :=  x̂n (x) : x ∈ X̆n . For k ≥ 2 and β > 0, we let Vk,β (x) := |x1 |k + β|x2 |k , x ∈ R2 . The generator of the state process X n under a scheduling policy z n takes the form n Lnz f (x) := 2 X i=1   n n λni f (x + ei ) − f (x) + (µn11 z11 + µn12 z12 ) f (x − e1 ) − f (x) (3.6) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 2  X  n + µn22 z22 f (x − e2 ) − f (x) + γin qin f (x − ei ) − f (x) , 11 x ∈ Z2+ , (3.7) i=1 b zn L n (R2 ). for f ∈ Cb We can write the generator of the diffusion-scaled state process X̂ n using (3.7) and the function x̂n in Definition 3.2 as  b z n f (x̂) = Lz n f x̂n (x) . L (3.8) n n We have the following. Proposition 3.1. Let X̂ n denote the diffusion-scaled state process under the scheduling policy ž n b ž n be its generator. For any k ≥ 2, there exists β0 > 0, such that in Definition 3.1, and L n b ž n Vk,β (x̂) ≤ C1 − C2 Vk,β (x̂) L n ∀ x̂ ∈ Sn , ∀ n ≥ n0 , (3.9) for some positive constants C1 , C2 , and n0 ∈ N, which depend on β ≥ β0 and k. Namely, X̂ n under the scheduling policy ž n is geometrically ergodic. As a consequence, for any k > 0, there exists n0 ∈ N such that  Z T 1 ž n k n (3.10) X̂ (s) ds < ∞ , E sup lim sup n≥n0 T →∞ T 0 and the same holds if we replace X̂ n with Q̂n or Ŷ n in (3.10). In other words, the diffusion-scaled cost criterion J(X̂ n (0), Z n ) is finite for n ≥ n0 . Proof. See Appendix A.  Remark 3.2. We remark that given (3.10) for X̂ n , the same property may not hold for Q̂n or Ŷ n . It always holds if a scheduling policy satisfies the JWC condition (by the balance equation (6.5)). Otherwise, that property needs to be verified under the given scheduling policy. It can easily checked that if the property holds for any two processes of X̂ n , Q̂n and Ŷ n , then it also holds for the third. 4. Ergodic Control of the Limiting Diffusion 4.1. The controlled diffusion limit. If the action space is Z̆ n , or equivalently Z n ∈ Z̆n , the convergence in distribution of the diffusion-scaled processes X̂ n to the limiting diffusion X in (4.1) is shown in Proposition 3 in Atar [7]. For the class of multiclass multi-pool networks, the drift of the limiting diffusion is given implicitly via a linear map in Proposition 3 of Atar [7]. For the Nnetwork, the drift can be explicitly expressed as we show below in (4.4). In Arapostathis and Pang [1], a leaf elimination algorithm has been developed to provide an explicit expression for the drift of the limiting diffusion of general multiclass multi-pool networks. In the case of the N-network, the limit process X is an 2-dimensional diffusion satisfying the Itô equation dXt = b(Xt , Ut ) dt + Σ dWt , with initial condition X0 = x and the control Ut ∈ U, where  U := u = (uc , us ) ∈ R2+ × R2+ : e · uc = e · us = 1 . (4.1) (4.2) In (4.1), the process W is a 2-dimensional standard Wiener process independent of the initial condition X0 = x. Following the leaf elimination algorithm for the N-network, the drift of the diffusion can be computed as follows. Let ! −(e · x)− us1 x1 − (e · x)+ uc1 + (e · x)− us1 b G[u](x) := , u ∈ U. (4.3) 0 x2 − (e · x)+ uc2 12 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Then the drift b : R2 × U → R2 takes the form ! b 11 [u](x) − µ12 G b 12 [u](x) − γi (e · x)+ uc + `1 −µ11 G i b(x, u) = b 22 [u](x) − γ2 (e · x)+ uc + `2 , µ22 G 2 which can also be written as (see Lemma 4.3 and Section 4.2 in [1]) b(x, u) = −B1 (x − (e · x)+ uc ) + (e · x)− B2 us − (e · x)+ Γuc + ` , (4.4) with B1 := diag{µ12 , µ22 } , Here, ` := (`1 , `2 )T B2 := diag{µ11 − µ12 , 0} , Γ := diag{γ1 , γ2 } . is defined by ∗ ∗ ∗ `1 := λ̂1 − µ̂11 z11 − µ̂12 z12 , and `2 := λ̂2 − µ̂22 z22 . (4.5)  √ √ The covariance matrix is given by Σ := diag 2λ1 , 2λ2 . The control process U lives in the compact set U in (4.2), and Ut (ω) is jointly measurable in (t, ω) ∈ [0, ∞) × Ω. Moreover, it is non-anticipative: for s < t, Wt − Ws is independent of Fs := the completion of σ{X0 , Ur , Wr , r ≤ s} relative to (F, P) . Let U be the set of all such controls, referred to as admissible controls. We refer the reader to Section 6.2 on the control parameterization. A mere comparison of (4.3) with (6.10) makes it clear how the control process U relates to the control process U n for the nth system in Definition 6.1. We remark that (4.1) can be regarded as a piecewise-linear controlled diffusion. Note that the matrix B1 is an M -matrix. However, there is an additional term (e · x)− B2 us in the drift, which differs from the class of piecewise-linear controlled diffusions discussed in Section 3.3 of Arapostathis et al. [3]. We refer to (4.1) as the limiting diffusion, or the diffusion limit. The associated limit processes Q, Y , and Z satisfy the following balance equations: X1 (t) = Q1 (t) + Z11 (t) + Z12 (t) , X2 (t) = Q2 (t) + Z22 (t) , Y1 (t) + Z11 (t) = 0 , Y2 (t) + Z12 (t) + Z22 (t) = 0 , with Qi (t) ≥ 0, Yj (t) ≥ 0, i, j = 1, 2. Note that these ‘balance’ conditions imply that JWC always holds at the diffusion limit, i.e., + − e · Q(t) = e · X(t) , e · Y (t) = e · X(t) ∀t ≥ 0. 4.2. Control problems for the diffusion limit. We state the three problems which correspond to (P1)–(P3) in Section 3.1 for the controlled diffusion in (4.1). Let r : R2 × U → R be defined by   r(x, u) = r x, (uc , us ) := r̂ (e · x)+ uc , (e · x)− us , with the same r̂ in (3.2), that is, r(x, u) = [(e · x)+ ]m 2 X ξi (uci )m + [(e · x)− ]m i=1 )T 2 X ζj (usj )m , m ≥ 1, (4.6) j=1 )T for the given ξ = (ξ1 , ξ2 and ζ = (ζ1 , ζ2 in (3.2). Let the ergodic cost associated with the controlled diffusion X and the running cost r be defined as Z T  1 U Ex r(Xt , Ut ) dt , U ∈ U . Jx,U [r] := lim sup T →∞ T 0 (P10 ) (unconstrained problem) The running cost function r(x, u) is as in (4.6). The ergodic control problem is then defined as %∗ (x) = inf Jx,U [r] . U ∈U (4.7) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 13 (P20 ) (constrained problem) The running cost function ro (x, u) is as in (4.6) with ζ ≡ 0. Also define rj (x, u) := [(e · x)− usj ]m̃ , j = 1, 2 , (4.8) with m̃ ≥ 1, and let δ = (δ1 , δ2 ) be a positive vector. The ergodic control problem under idleness constraints is defined as %∗c (x) = inf Jx,U [ro ] , U ∈U (4.9) subject to Jx,U [rj ] ≤ δj , j = 1, 2 . (P30 ) (fairness) The running costs ro , r1 and r2 are as in (P20 ). Let θ be a positive constant, and 1 ≤ m̃ < m. The ergodic control problem under idleness fairness is defined as %∗f (x) = inf Jx,U [ro ] , U ∈U (4.10) subject to Jx,U [r1 ] = θ Jx,U [r2 ] . The last problem enforces fairness of idleness allocation among the two server pools. Also note that penalizing only the queueing cost in (P1), raises a well-posedness question, which was resolved in Corollaries 4.1–4.2 of Arapostathis and Pang [1]. The quantities %∗ (x), %∗c (x) and %∗f (x) are called the optimal values of the ergodic control problems (P10 ), (P20 ) and (P30 ), respectively, for the controlled diffusion process X with initial state x. Note that as is shown in Section 3 of Arapostathis et al. [3] and Sections 3 and 5.4 of Arapostathis and Pang [1], the optimal values %∗ (x), %∗c (x) and %∗f (x) do not depend on x ∈ R2 , and thus we remove their dependence on x in the statements below. Recall that a control is called Markov if Ut = v(t, Xt ) for a measurable map v : R+ ×R2 → U, and it is called stationary Markov if v does not depend on t, i.e., v : R2 → U. Let USM denote the set of stationary Markov controls. Recall also that a control v ∈ USM is called stable if the controlled process is positive recurrent. We denote the set of such controls by USSM , and let µv denote the unique invariant probability measure on R2 for the diffusion under the control v ∈ USSM . We also let M := {µv : v ∈ USSM }, and G denote the set of ergodic occupation measures corresponding to controls in USSM , that is,   Z 2 u ∞ 2 G := π ∈ P(R × U) : L f (x) π(dx, du) = 0 ∀ f ∈ Cc (R ) , R2 ×U where Lu f (x) is the controlled extended generator of the diffusion X, Lu f (x) := 2 2 X 1 X bi (x, u) ∂i f (x) , aij ∂ij f (x) + 2 i,j=1 u ∈ U, i=1 ∂2 ∂ with a := ΣΣT and ∂i := ∂x and ∂ij := ∂xi ∂xj . The restriction of the ergodic control problem with i running cost r to stable stationary Markov controls is equivalent to minimizing Z π(r) = r(x, u) π(dx, du) R2 ×U over all π ∈ G. If the infimum is attained in G, then we say that the ergodic control problem is well posed, and we refer to any π̄ ∈ G that attains this infimum as an optimal ergodic occupation measure. We define the class of admissible controls U := {U = (U c , U s ) : U c = v c (x) = (1, 0) ∀ x ∈ R2 }, and we also let (γ1 ∨ µ11 ∨ µ12 )k+1 β̄k := . (4.11) µ22 (γ1 ∧ µ11 ∧ µ12 )k We have the following lemma. 14 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Lemma 4.1. Let Vk,β be as in (3.6). There exist positive constants C1 and C2 depending only on k and β ≥ β̄k , such that LU Vk,β (x) ≤ C1 − C2 Vk,β (x) ∀U ∈ U, ∀ x ∈ R2 . Proof. By (4.4) we have ( −γ1 x1 + (µ12 − γ1 )x2 + `1  b1 x, U =  − µ11 U1s + µ12 U2s x1 − (µ11 − µ12 )U1s x2 + `1  b2 x, U = −µ22 x2 + `2 ∀ x ∈ R2 . if (e · x)+ ≥ 0 otherwise, Therefore, LU Vk,β (x) ≤ −k(γ1 ∧ µ11 ∧ µ12 )|x1 |k + k(γ1 ∨ µ11 ∨ µ12 )|x2 ||x1 |k−1  − βkµ22 |x2 |k + k`1 |x1 |k−1 + βk`2 |x2 |k−1 + k(k − 1) λ1 |x1 |k−2 + λ2 β|x2 |k−2 . (4.12) Let α := γ1 ∧ µ11 ∧ µ12 . γ1 ∨ µ11 ∨ µ12 Using Young’s inequality we write k α−k α α−k α k−1 |x1 |k + |x2 |k ≤ (k − 1) |x1 |k + |x2 |k . |x2 ||x1 | ≤ (k − 1) k k k k Thus, by (4.12), we have k−1 LU Vk,β (x) ≤ −(γ1 ∧ µ11 ∧ µ12 )|x1 |k − (kβµ22 − β̄k )|x2 |k + k`1 |x1 |k−1 + βk`2 |x2 |k−1  + k(k − 1) λ1 |x1 |k−2 + λ2 β|x2 |k−2 , from which the result easily follows.  As shown in Corollary 4.2 of Arapostathis and Pang [1], for any k ≥ 1, there exists a constant C = C(k) > 0 such that any solution Xt of (4.1) with X0 = x0 ∈ R2 satisfies Z T  Z T   U k k U + k Ex |Xt | dt ≤ C|x0 | + CT + C Ex (e · Xt ) dt ∀ U ∈ U , ∀ T > 0 . (4.13) 0 0 This property plays a crucial role in solving (P10 )–(P30 ). 4.3. Optimal solutions to problems (P10 )–(P30 ). The characterization of the optimal solutions to the ergodic control problems (P10 )–(P30 ) has been thoroughly studied in Arapostathis et al. [3] and Arapostathis and Pang [1]. We review some results that are used in the sections which follow to construct asymptotically optimal scheduling policies and prove asymptotic optimality. We first introduce some notation. Let   Hr (x, p) := min b(x, u) · p + r(x, u) for x, p ∈ R2 . (4.14) u∈U R2+ , For δ = (δ1 , δ2 ) ∈ let  H(δ) := π ∈ G : π(rj ) ≤ δj , j = 1, 2 , For δ ∈ R2+ and λ = (λ1 , λ2 )T ∈ R2+ Ho (δ) :=  π ∈ G : π(rj ) < δj , j = 1, 2 . define the running cost gδ,λ by gδ,λ (x, u) := ro (x, u) + 2 X  λj rj (x, u) − δj . j=1 (0, ∞)2 We say that the vector δ ∈ is feasible (or that the constraints in (4.9) are feasible) if 0 o 0 there exists π ∈ H (δ) such that π (ro ) < ∞. The following is contained in Theorem 5.2 of [1]. INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 15 Theorem 4.1. For the ergodic control problem in (4.7), there exists a unique solution V ∈ C 2 (R2 ), satisfying V (0) = 0, to the associated HJB equation:   min Lu V (x) + r(x, u) = %∗ . u∈U Moreover, a stationary Markov control v ∈ USSM is optimal if and only if it satisfies    Hr x, ∇V (x) = b x, v(x) · ∇V (x) + r x, v(x) a.e. in R2 . The following is contained in Lemmas 3.3–3.5, and Theorems 3.1–3.2 of [1]. Theorem 4.2. Suppose that δ is feasible for the ergodic control problem under constraints in (4.9), i.e., there exists π0 ∈ Ho (δ) such that π0 (ro ) < ∞. Then the following hold. (a) There exists λ∗ ∈ R2+ such that inf π ∈ H(δ) (b) If π∗ π(ro ) = inf π(gδ,λ∗ ) = %∗c . π∈G ∈ H(δ) attains the infimum of π 7→ π(ro ) in H(δ), then π∗ (ro ) = π∗ (gδ,λ∗ ), and π∗ (gδ,λ ) ≤ π∗ (gδ,λ∗ ) ≤ π(gδ,λ∗ ) ∀ (π, λ) ∈ G × R2+ . (c) There exists Vc ∈ C 2 (R2 ) satisfying   min Lu Vc (x) + gδ,λ∗ (x, u) = π∗ (gδ,λ∗ ) = %∗c , u∈U x ∈ R2 . (d) A stationary Markov control vc ∈ USSM is optimal if and only if it satisfies    Hgδ,λ∗ x, ∇Vc (x) = b x, vc (x) · ∇Vc (x) + gδ,λ∗ x, vc (x) a.e. in R2 , where Hgδ,λ∗ is defined in (4.14) with r replaced by gδ,λ∗ . (e) The map δ 7→ inf π ∈ H(δ) π(ro ) is continuous at any feasible point δ̂. For uniqueness of the solutions Vc see Theorem 3.2 in Arapostathis and Pang [1]. We now turn to the constrained ergodic control problem in (4.10). Lemma 4.1 implies that Assumption 5.1 in [1] holds, and consequently the solution of (P30 ) follows by Theorem 5.8 in the same paper. However, the Lagrangian in (P30 ) is not bounded below in R2 , and since no details were provided in [1] on the existence of solutions to the HJB equation, we provide a proof in Appendix B. Theorem 4.3. For any θ > 0 the constraint in (4.10) is feasible. All the conclusions of Theorem 4.2 hold, provided that we replace H(δ) and gδ,λ with  Hf (θ) := π ∈ G : π(r1 ) = θ π(r2 ) , (4.15) and  hθ,λ (x, u) := ro (x, u) + λ r1 (x, u) − θ r2 (x, u) , λ ∈ R, respectively. 5. Asymptotic Optimality In this section, we present the main results on asymptotic optimality. We show that the values of the three ergodic control problems in the diffusion scale converge to the values of the corresponding ergodic control problems for the limiting diffusion, respectively. The proofs of the lower and upper bounds are given in Sections 8 and 9, respectively. Recall the definitions of J, Jo , V̂ n , V̂cn , and V̂fn in (P1)–(P3), and the definitions of %∗ , %∗c , and ∗ %f in (P10 )–(P30 ). Theorem 5.1. (lower bounds) Let X̂ n (0) ⇒ x ∈ R2 as n → ∞. The following hold: 16 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK (i) For any sequence {Z n , n ∈ N} ⊂ Z the diffusion-scaled cost in (3.3) satisfies  lim inf J X̂ n (0), Ẑ n ≥ %∗ . n→∞ (ii) Suppose that under a sequence {Z n , n ∈ N} ⊂ Z the constraint in (3.4) is satisfied for all sufficiently large n ∈ N. Then  lim inf Jo X̂ n (0), Ẑ n ≥ %∗c , n→∞ and as a result we have that lim inf V̂cn (X̂ n (0)) ≥ %∗c . n→∞ (iii) There exists a positive constant Ĉ, such that if a sequence {Z n , n ∈ N} ⊂ Z satisfies  Jc,1 X̂ n (0), Z n (5.1)  −θ ≤  Jc,2 X̂ n (0), Z n for some  ∈ (0, θ), and all sufficiently large n ∈ N, then lim inf Jo (X̂ n (0), Z n ) ≥ %∗f − Ĉ . (5.2) n→∞ The proof of the theorem that follows relies on the fact that r and also rj for i = 0, 1, 2, are convex functions of u. Theorem 5.2. (upper bounds) Let X̂ n (0) ⇒ x ∈ R2 as n → ∞. The following hold: (i) lim sup V̂ n (X̂ n (0)) ≤ %∗ . n→∞ (ii) For any  > 0, there exists a sequence {Z n , n ∈ N} ⊂ Z such that the constraint in (3.4) is feasible for all sufficiently large n, and  lim sup Jo X̂ n (0), Ẑ n ≤ %∗c +  . n→∞ Consequently, we have that lim sup V̂cn (X̂ n (0)) ≤ %∗c . n→∞ (iii) For any  > 0, there exists a sequence {Z n , n ∈ N} ⊂ Z such that (5.1) holds for all sufficiently large n ∈ N, and lim sup Jo (X̂ n (0), Z n ) ≤ %∗f +  . n→∞ 6. System dynamics and an equivalent control parameterization 6.1. Description of the system dynamics. The processes X n can be represented via rate-1 Poisson processes: for each i = 1, 2 and t ≥ 0, we have    Z t  Z t X n n n n n n n n n n S1j µ1j Z1j (s)ds − R1 γ1 Q1 (s)ds , X1 (t) = X1 (0) + A1 (λ1 t) − 0 j=1,2  n X2n (t) = X2n (0) + An2 (λn2 t) − S22 µn22 Z 0   Z t  t n n n n Z22 (s)ds − R2 γ2 Q2 (s)ds . 0 Ani , n Sij (6.1) 0 Rin Recall that the processes and are all rate-1 Poisson processes and mutually independent, and independent of the initial quantities Xin (0). By (3.1) and (6.1), we can write X̂1n (t) and X̂2n (t) as Z t Z t Z t n n n n n n n n Ẑ11 (s)ds − µ12 Ẑ12 (s)ds − γ1 Q̂n1 (s)ds X̂1 (t) = X̂1 (0) + `1 t − µ11 0 0 + n M̂A,1 (t) 0 − n M̂S,11 (t) n n − M̂S,12 (t) − M̂R,1 (t) , (6.2) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK X̂2n (t) = X̂2n (0) + `n2 t − µn22 Z t n Ẑ22 (s)ds − γ2n t Z 0 17 n n n Q̂n2 (s)ds + M̂A,2 (t) − M̂S,22 (t) − M̂R,2 (t) , (6.3) 0 where for i = 1, 2, and j = 1, 2, 1 n M̂A,i (t) := √ (Ani (λni t) − λni t), n     Z t Z t 1 n n n n n n Zij (s)ds , Zij (s)ds − µij M̂S,ij (t) := √ Sij µij n 0 0    Z t  Z t 1 n n n n n n M̂R,i (t) := √ Qi (s)ds , Ri γi Qi (s)ds − γi n 0 0 and `n = (`n1 , `n2 )T is defined by 1 ∗ ∗ `n1 := √ (λn1 − µn11 z11 n − µn12 z12 n) , n 1 ∗ `n2 := √ (λn2 − µn22 z22 n) , n ∗ as in (2.4). It is easy to see that under the assumptions on the parameters in Assumpwith zij n := {M̂ n (t) : t ≥ 0}, tion 2.1, `n → ` as n → ∞, where ` is defined in (4.5). The processes M̂A,i A,i n n n n M̂S,ij := {M̂S,ij (t) : t ≥ 0}, and M̂R,i := {M̂R,i (t) : t ≥ 0} are square integrable martingales w.r.t. the filtration Fn with quadratic variations Z Z µnij t n λni γin t n n n n hM̂A,i i(t) := t , hM̂S,ij i(t) := Z (s)ds , hM̂R,i i(t) := Q (s)ds . n n 0 ij n 0 i By (2.2)–(2.4), (2.5), and (3.1), we obtain the balance equations n Ŷ1n (t) + Ẑ11 (t) = 0 , n n X̂1n (t) = Q̂n1 (t) + Ẑ11 (t) + Ẑ12 (t) , (6.4) n n Ŷ2n (t) + Ẑ12 (t) + Ẑ22 (t) = 0 , n X̂2n (t) = Q̂n2 (t) + Ẑ22 (t) , for all t ≥ 0. The work conservation and JWC conditions translate to the following: Q̂n1 (t) ∧ Ŷjn (t) = 0 ∀j = 1, 2, and Q̂n2 (t) ∧ Ŷ2n (t) = 0 , ∀t ≥ 0, and e · Q̂n (t) ∧ e · Ŷ n (t) = 0, t ≥ 0, respectively. 6.2. Control parameterization. By (6.4), we obtain e · X̂ n (t) = e · Q̂n (t) − e · Ŷ n (t) , and therefore the JWC condition is equivalent to + e · Q̂n (t) = e · X̂ n (t) , e · Ŷ n (t) = − e · X̂ n (t) . (6.5) (6.6) Definition 6.1. We define the processes U c,n := (U1c,n , U2c,n )T and U s,n := (U1s,n , U2s,n )T , t ≥ 0, by ( n Q̂ (t) if e · Q̂n (t) > 0 , c,n U (t) := e·Q̂n (t) (6.7) e1 = (1, 0) otherwise, and Ŷ n (t) e·Ŷ n (t) if e · Ŷ n (t) > 0 , e2 = (0, 1) otherwise, ( U and let U n := (U c,n , U s,n ). s,n (t) := (6.8) 18 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK The process Uic,n (t) represents the proportion of the total queue length in the network at queue i at time t, while Ujs,n (t) represents the proportion of the total idle servers in the network at station j at time t. The control U c,n (t) = e1 = (1, 0) means that server pool 2 gives strict static priority to class-2 jobs, while the control U s,n (t) = e2 = (0, 1) means that class-1 jobs strictly prefer service in pool 1. Given Z n ∈ Zn , the process U n is uniquely determined via (6.4) and (6.7)–(6.8) and lives in the set U in (4.2). It follows by (6.4) and (6.6) that, under JWC, we have that for each t ≥ 0, + − Q̂n (t) = e · X̂ n (t) U c,n (t) , Ŷ n (t) = e · X̂ n (t) U s,n (t) . (6.9) Also, by (6.9), under the JWC condition, we have " # −(e · X̂ n )− U1s,n X̂1n − (e · X̂ n )+ U1c,n + (e · X̂ n )− U1s,n n Ẑ = . 0 X̂2n − (e · X̂ n )+ U2c,n (6.10) 7. Convergence of mean empirical measures Xn For the process under a scheduling policy Z n , and with U n as in Definition 6.1, we define the mean empirical measures Z T   1 Zn n n Zn E 1A×B X̂ (t), U (t) dt (7.1) ΦT (A × B) := T 0 for Borel sets A ⊂ R2 and B ⊂ U. Recall Definition 2.1. The lemma which follows provides n a sufficient condition under which the mean empirical measures ΦZ T are tight and converge to an ergodic occupation measure corresponding to some stationary stable Markov control for the limiting diffusion control problem. The condition simply requires a finite long-run average firstorder moment of the diffusion-scaled state process under an EJWC scheduling policy. This lemma is used in Section 8 to prove the lower bounds in Theorem 5.1. Lemma 7.1. Suppose that under some sequence {Z n , n ∈ N} ⊂ Z we have  Z T 1 Zn n X̂ (s) ds < ∞ . E sup lim sup n T →∞ T 0 (7.2) n Then any limit point π ∈ P(R2 × U) of ΦZ T , defined in (7.1), as (n, T ) → ∞ satisfies π ∈ G. Proof. Let f ∈ Cc∞ (R2 ), and define Df (X̂ n , s) := ∆f (X̂ n (s)) − 2 X ∂i f (X̂ n (s−))∆X̂in (s) i=1 − 2 1 X ∂ii0 f (X̂ n (s−))∆X̂in (s)∆X̂in0 (s) . (7.3) 2 0 i,i =1 By applying Itô’s formula (see, e.g., Theorem 26.7 in Kallenberg [21]) and using the definition of n n ΦZ T in (7.1) and X̂ in (6.2)–(6.3), we obtain " #     Z X E f (X̂ n (T )) − E f (X̂ n (0)) 1 n n Zn = A f (x̂, u) ΦT (dx̂, du) + E Df (X̂ , s) , (7.4) T T R2 ×U s≤T INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 19 n with E = EZ . Define An1,1 (x̂, u) := −µn12 (x̂1 − (e · x̂)+ uc1 ) + (µn11 − µn12 )(e · x̂)− us1 − γ1n (e · x̂)+ uc1 + `n1 , An2,1 (x̂, u) := −µn22 (x̂2 − (e · x̂)+ uc2 ) − γ2n (e · x̂)+ uc2 + `n2 ,   1 1 λn1 n ∗ ∗ + √ µn12 x̂1 − (e · x̂)+ uc1 A1,2 (x̂, u) := + µn11 z11 + µn12 z12 2 n n  1 n 1 n n − s + c + √ (µ11 − µ12 )(e · x̂) u1 + √ γ1 (e · x̂) u1 , n n    1 1 λn2 1 ∗ An2,2 (x̂, u) := + µn22 z22 + √ µn22 x̂2 − (e · x̂)+ uc2 + √ γ2n (e · x̂)+ uc2 . 2 n n n √ √ Since Z n ∈ Z̆n , the operator An : Cc∞ ( nB̆) → Cc∞ ( nB̆ × U) takes the form An f (x̂, u) := 2  X (7.5)  Ani,1 (x̂, u) ∂i f (x̂) + Ani,2 (x̂, u) ∂ii f (x̂) . i=1 Let  kf kC 3 := sup |f (x)| + x∈R2 X |∂i f (x)| + i=1,2 2 X |∂ij f (x)| + i,j=1 By Taylor’s formula, using also the fact that the jump size is Df (X̂ n , s) ≤ κkf kC 3 2 X 2 X  |∂ijk f (x)| . i,j,k=1 √1 , n we obtain ∆X̂in (s) ∆X̂jn (s) ∆X̂kn (s) i,j,k=1 2 κ0 kf kC 3 X √ ≤ ∆X̂in (s)∆X̂in0 (s) , n 0 i,i =1 κ0 that do not depend on n ∈ N. Let λn 1 1 1 n n X̄1n (t) := 1 + µn11 Z11 (t) + µn12 Z12 (t) + γ1n Qn1 (t) , n n n n for some constants κ and λn 1 1 n := 2 + µn22 Z22 (t) + γ2n Qn2 (t) n n n for t ≥ 0. Since independent Poisson processes have no simultaneous jumps w.p.1., we have Z T X  Z T 2  1 1 n n ∆X̂i (s)∆X̂i0 (s) ds ≤ E E X̄1n (s) + X̄2n (s) ds , T T 0 0 0 (7.6) X̄2n (t) i,i =1 and that the right hand side is uniformly bounded over n ∈ N and T > 0 by (7.2). Thus, we have " # Z T X  2 X 1 κ0 kf kC 3 n √ E E Df (X̂ , s) ≤ ∆X̂in (s)∆X̂in0 (s) ds → 0 , T T n 0 0 s≤T i,i =1 as (n, T ) → ∞. Therefore, taking limits in (7.4), we obtain Z n lim sup An f (x̂, u) ΦZ T (dx̂, du) = 0 . (n,T ) → ∞ R2 ×U Note that for i = 1, 2, Ani,1 tends to the drift of the limiting diffusion bi , while Ani,2 tends to λi as n → ∞, uniformly over compact sets in R2 × U. 20 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK n 2 Let (nk , Tk ) be any sequence along which ΦZ T converges to some π ∈ P(R × U). Let u L f (x) = 2 X   λi ∂ii f (x) + bi (x, u) ∂i f (x) . i=1 We have Z u Z n L f (x) π(dx, du) − R2 ×U R2 ×U An f (x̂, u) ΦZ T (dx̂, du) Z = R2 ×U  n Lu f (x) π(dx, du) − ΦZ T (dx, du) Z + R2 ×U  n Lu f (x̂) − An f (x̂, u) ΦZ T (dx̂, du) . (7.7) The first term on the right hand side of (7.7) converges to 0 as n → ∞ by the convergence of n u n ΦZ T to π, while the second term also converges to 0n by the uniform convergence of L f to A f on 2 Z compact subsets of R × U and the tightness of ΦT . Thus we obtain Z Lu f (x) π(dx, du) = 0 . R2 ×U This completes the proof.  Before stating the second lemma, we first introduce a canonical construction of scheduling policies from the optimal control v ∈ USSM for the diffusion control problems. Recall the notation in Definition 3.2. Definition 7.1. Let $ : {x ∈ R2+ : e · x ∈ Z} → Z2+ be a measurable map defined by  $(x) := bx1 c, e · x − bx1 c , x ∈ R2 . For any precise control v ∈ USSM , define the maps q n [v] and y n [v] by +  −  √ √ y n [v](x̂) := $ e · ( nx̂ + nx∗ ) v s (x̂) . q n [v](x̂) := $ e · ( nx̂ + nx∗ ) v c (x̂) , for x̂ ∈ Sn . We also define define the map (Markov scheduling policy) z n [v] on S̆n by " # n − y n [v](x̂) n [v](x̂) − N n − y n [v](x̂) N x − q 1 1 1 1 1 1 z n [v](x̂) := , x̂ ∈ S̆n . 0 x2 − q2n [v](x̂) Compare this to (2.7). Corollary 7.1. For any precise control v ∈ USSM we have   e · q n [v] x̂n (x) ∧ e · y n [v] x̂n (x) = 0 , and  z n [v] x̂n (x) ∈ Z n (x) for all x ∈ X̆n , i.e., the JWC condition is satisfied for x ∈ X̆n . Proof. This follows from Lemma 2.1 and the definition of the maps q n [v], y n [v] and z n [v].  The lemma which follows asserts that if a sequence of EJWC scheduling policies is constructed using any precise stationary stable Markov control in a way that the long-run average moment condition in Lemma 7.1 is satisfied, then any limit of the mean empirical measures of the diffusion scaled processes agrees with the ergodic occupation measure of the limiting diffusion corresponding to that control. This lemma is used in the proof of upper bounds in Theorem 5.2. Recall Definition 2.1. INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 21  Lemma 7.2. Let v ∈ USSM be a continuous precise control, and Z n : n ∈ N be any sequence of admissible scheduling policies such that each Z n agrees with the Markov scheduling policy z n [v] given  √ √ √ in Definition 7.1 on nB̆, i.e., Z n (t) = z n [v] X̂ n (t) whenever X̂ n (t) ∈ nB̆. For x̂ ∈ nB̆ ∩ Sn , we define  n  q n[v](x̂) if e · q n [v](x̂) > 0 , e·q [v](x̂) c,n u [v](x̂) := v c (x̂) otherwise, and s,n u [v](x̂) :=   y n [v](x̂) e·y n [v](x̂) if e · y n [v](x̂) > 0 , v s (x̂) otherwise. For the process X n under the scheduling policy Z n , define the mean empirical measures  Z T  1 Zn n n n n X̂ (t) dt (7.8) X̂ (t), u [v] E 1 Φ̃Z (A × B) := A×B T T 0 √ for Borel sets A ⊂ nB̆ and B ⊂ U. Suppose that (7.2) holds under this sequence {Z n }. Then the ergodic occupation measure πv of the controlled diffusion in (4.1) corresponding to v is the unique n limit point in P(Rd × U) of Φ̃Z T as (n, T ) → ∞. Proof. It follows by Corollary 7.1 that {Z n } ∈ Z. Also, by the continuity of v, we have |un [v](x̂) − v(x̂)| → 0 sup as n → ∞ , (7.9) x̂∈Sn ∩K for any compact set K ⊂ R2 . Also, for any f ∈ Cc∞ (R2 × U), it holds that Z T  Z  1 Zn Zn n n n f (x̂, u) Φ̃T (dx̂, du) = E f X̂ (t), u [v] X̂ (t) dt , T R2 ×U 0 √ for all sufficiently large n such that the support of f is contained in nB̆. Therefore, if πn is any n n limit point of Φ̃Z T as T → ∞, and we disintegrate π as πn (dx̂, du) = ν n (dx̂) ξ n (du | x̂) , then we have Z An f (x̂, u) πn (dx̂, du) = Z (7.10)  An f x̂, un [v](x̂) ν n (dx̂) . R2 R2 ×U {ν n } By Lemma 7.1, the sequence is tight. Let {n} ∈ N be any increasing sequence such that n 2 ν → ν ∈ P(R ). To simplify the notation, let Ãn f (x̂) := An f x̂, un [v](x̂)). We have Z Z Z Z  n  n n v n v à f dν − L f dν = à f − L f dν + Lv f dν n − dν . (7.11) R2 R2 R2 R2 It follows by (7.9) that Ãn f − Lv f → 0, uniformly as n → ∞, which implies that the first term on the right hand side of (7.11) converges to 0. The second term does the same by the convergence of R ν n to ν. By Lemma 7.1, we have R2 Ãn f dν n → 0 as n → ∞. Therefore, we obtain Z Lv f (x) ν(dx) = 0 , R2 and this means that ν is an invariant probability measure for the diffusion associated with the √ control v. Next note that the Markov control ξ n in (7.10) agrees with un [v](x̂) when x̂ ∈ nB̆ ∩ Sn by definition. In other words, ξ n (du | x̂) = δun [v](x̂) (u), where δ denotes the Dirac measure. It then follows by (7.9) that ξ n converges to v as n → ∞ in the topology of Markov controls [2, Section 2.4]. 22 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK The ergodic occupation measure πv ∈ P(R2 × U) is given by πv (dx, du) := ν(dx, du)δv(x) (u). With g ∈ Cc (R2 × U), i.e., a continuous function with compact support, we write  Z Z Z   g(x, u) ν(dx) − ν n (dx) ξ n (du | x) g(x, u) πv (dx, du) − πn (dx, du) ≤ R2 ×U U R2 Z Z  g(x, u)ν(dx) + U R2  ξ n (du | x) − δv(x) (u) . (7.12) The first term on the right hand side of (7.12) converges to 0 as n → ∞ by the convergence of ν n → ν in P(R2 ). Since ν has a continuous density, the second term also converges to 0 as n → ∞ by [2, Lemma 2.4.1]. Therefore (7.12) shows that πn → πv in P(R2 × U), and this completes the proof.  8. Proof of the lower bounds In this section, we prove the lower bounds in Theorem 5.1. The following lemma which applies to the diffusion-scaled process, is analogous to Lemma 3.1 (c) for the diffusion limit in Arapostathis and Pang [1]. Lemma 8.1. There exist constants C1 and C2 independent of n such that Z T   1 Zn m lim sup E X̂ n (s) ds ≤ C1 + C2 Jo X̂ n (0), Ẑ n T →∞ T 0 ∀n ∈ N, (8.1) for any sequence {Z n ∈ Zn , n ∈ N}, where m ≥ 1 is as in (3.2). Proof. Let V(x) := V1 (x1 ) + βV2 (x2 ), x ∈ R2 , where β is a positive constant to be determined m+1 n later, and Vi (x) = √|xi | 2 for m ≥ 1. By applying Itô’s formula on V, with E = EZ , we obtain 1+|xi | from (6.2) that for t ≥ 0, " #  Z t X      E V(X̂ n (t)) = E V(X̂ n (0)) + E An V X̂ n (s), Ẑ n (s) ds + E DV(X̂ n , s) , 0 (8.2) s≤t where DV(X̂ n , s) is defined as in (7.3),  2  X  n n n A V x̂, ẑ := Ai,1 (x̂, ẑ)∂i V(x̂) + Ai,2 (x̂, ẑ)∂ii V(x̂) , i=1 and An1,1 x̂, ẑ An2,1 An1,2 An2,2  := `n1 − µn11 ẑ11 − µn12 ẑ12 − γ1n x̂1 − ẑ11 − ẑ12 ,   x̂, ẑ := `n2 − µn22 ẑ22 − γ2n x̂2 − ẑ22 ,       1 γn 1 λn1 ∗ ∗ + µn11 z11 + µn12 z12 + √ µn11 ẑ11 + µn12 ẑ12 + √1 x̂1 − ẑ11 − ẑ12 , x̂, ẑ := 2 n n n     1 λn2 1 γn ∗ + µn22 z22 + √ µn22 ẑ22 + √2 x̂2 − ẑ22 , x̂, ẑ := 2 n n n  ∗ ) for z ∗ for x̂ ∈ Sn , and ẑij := √1n (zij − nzij ij ∈ Z+ and z defined in (2.4). We also use the nonnegative variables q̂i and ŷi , i = 1, 2, which are defined as functions of x̂ and ẑ via the balance equations (6.4), keeping in mind that the work conservation condition holds for these. Define   Ā1,1 x, z := `1 − µ11 z11 − µ12 z12 − γ1 x1 − z11 − z12 , INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Ā2,1 x, z  23  := `2 − µ22 z22 − γ2 x2 − z22 , for x ∈ R2 and z ∈ R2×2 . By the convergence of the parameters in Assumption 2.1, we have that for i = 1, 2,  Āi,1 x̂, ẑ − Ani,1 (x̂, ẑ) ≤ κ1 (n)(kx̂k + kẑk) (8.3) for some constant κ1 (n) & 0 as n → ∞. Let ξˆ := (e · q̂) ∧ (e · ŷ). We claim that if ξˆn > 0 then q̂1 = 0, ŷ2 = 0 by the work conservation condition. Indeed since q̂i ∧ ŷ2 = 0 for i = 1, 2, then ξˆn > 0 implies that ŷ2 = 0, which in turn implies that ŷ1 > 0. This of course implies that q̂1 = 0. ˆ ẑ12 = x̂1 + ξ, ˆ and ẑ22 = x̂2 − q̂2 . On If ξˆ = ŷ1 , then by the balance equations we have ẑ11 = −ξ, ˆ ẑ12 = ξˆ − x̂2 , and ẑ22 = x̂2 − ξ. ˆ Hence the other hand, if ξˆ = q̂2 , then we obtain ẑ11 = x̂1 + x̂2 − ξ, ˆ when ξ > 0 we have Ā1,1 (x̂, ẑ) = −µ12 x̂1 + (µ11 − µ12 ) ξˆ + `1 if ŷ1 < q̂2 , Ā2,1 (x̂, ẑ) = −µ22 (x̂2 − q̂2 ) − γ2 q̂2 + `2 (8.4) Ā1,1 (x̂, ẑ) = −µ11 x̂1 + (µ11 − µ12 ) (ξˆ − x̂2 ) + `1 if ŷ1 ≥ q̂2 . ˆ − γ2 ξˆ + `2 Ā2,1 (x̂, ẑ) = −µ22 (x̂2 − ξ) and when ξˆ = 0, we can use the parameterization q̂ = (e · x̂)+ uc and ŷ = (e · x̂)− us and (7.5) to obtain Ā1,1 (x̂, ẑ) = −µ12 x̂1 + (µ12 − γ1 ) q̂1 + `1 if (e · x̂)+ > 0 , Ā2,1 (x̂, ẑ) = −µ22 (x̂2 − q̂2 ) − γ2 q̂2 + `2 Ā1,1 (x̂, ẑ) = −(µ12 (1 − us1 ) + µ11 us1 )x̂1 − (µ11 − µ12 ) x̂2 us1 + `1 Ā2,1 (x̂, ẑ) = −µ22 x̂2 + `2 (8.5) if (e · x̂)− ≥ 0 . It follows by the above analysis that |zij | ∈ O(|x| + |q|) , i, j ∈ {1, 2} . (8.6) Hence we have Ani,2 (x̂, ẑ) ∈ O(1 + n− /2 |x̂|) . 1 (8.7) Following the steps in the proof of Lemma 4.1, and also using the fact that ξˆ ≤ e · q̂ and Young’s inequality, it follows by (8.4)–(8.5) that we can choose β > 0 and positive constants c1 and c2 such that 2 X  Āni,1 (x̂, ẑ)∂i V(x̂) ≤ −c1 V(x̂) + c2 1 + |q̂|m . (8.8) i=1 Thus, by (8.3), (8.7), and (8.8) we obtain An V(x̂, ẑ) ≤ −c01 V(x̂) + c02 1 + |q̂|m  (8.9) for some positive constants c01 and c02 . For the jumps in (8.2), we first note that by the definition of Vi , since there exists a positive constant c3 such that  sup V00i (x0i ) ≤ c3 1 + |xi |m−2 ∀ xi ∈ R . |x0i −xi |≤1 24 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Since also the jump size is of order √1 , n then by Taylor’s expansion we obtain   1 ∆Vi X̂ n (s) − V0i X̂ n (s−) · ∆X̂in (s) ≤ sup |V00 (x0 )| (∆X̂in (s))2 . 2 |x0 −X̂ n (s−)|≤1 i i i X̄1n i X̄2n for i = 1, 2. Recall the definitions of and in (7.6). Thus, for i = 1, 2, using also (8.6), we obtain " # " #  X X   2 E DVi (X̂ n , s) ≤ E c3 1 + |X̂in (s−)|m−1 ∆X̂in (s) s≤t s≤t Z t    n m−1 n ≤ c3 E 1 + |X̂i (s)| X̄i (s) ds 0 Z t     n m−1 −1/2 n n ≤ c4 E 1 + |X̂i (s)| 1+n |X̂ (s)| + |Q̂ (s)| ds , (8.10) 0 for some positive constant c4 . Therefore, by (8.2), (8.9), and (8.10), we can choose positive constants c5 and c6 such that Z t  Z t      n n n m n m E V(X̂ (t)) ≤ E V(X̂ (0)) + c6 t − c5 E |X̂ (s)| ds + c6 E |Q̂ | ds . 0 0 Dividing by t and taking limits as t → ∞, establishes (8.1).  We are now ready to prove Theorem 5.1. Proof of Theorem 5.1. Let Z n ∈ Zn , n ∈ N, be an arbitrary sequence of scheduling policies in Z, n and let Φn := ΦZ as defined in (7.1). Without loss of generality we assume that along some  increasing sequence {nk } ⊂ N, we have supk J X̂ nk (0), Z nk < ∞; otherwise there is nothing to prove. By Lemmas 7.1 and 8.1, the sequence of mean empirical measures {ΦnTk : T > 0, k ≥ 1} is tight and any subsequential limit as (nk , T ) → ∞ is in G. Select any subsequence {Tk , n0k } ⊂ R+ × {nk }, with Tk → ∞, as k → ∞, and such that  1 0 0  + lim inf J X̂ n` (0), Z n` , J X̂ nk (0), Z nk ≤ `→∞ k and Z 1 0 0  n0 r(x, u) ΦTkk (dx, du) ≤ J X̂ nk (0), Z nk + , k R2 ×U n0 for all k ∈ N, and extract any further subsequence, also denoted as {Tk , n0k }, along which ΦTkk → π̂ ∈ G. Since r is nonnegative, taking limits as k → ∞ we obtain  lim inf J X̂ nk (0), Z nk ≥ π̂(r) ≥ %∗ . k→∞ This proves part (i). We next show the lower bound (ii) for the constrained problem. Repeating the same argument  as in part (i), suppose that supk Jo X̂ nk (0), Z nk < ∞ along some increasing sequence {nk } ⊂ N. As in the proof of part (i), let π̂ ∈ P(R2 × U) be a limit of ΦnT as (n, T ) → ∞. Recall the definition of rj in (4.8). Since rj is bounded below, taking limits, we obtain π̂(rj ) ≤ δj , j = 1, 2. Therefore π̂ ∈ H(δ), and by optimality we must have π̂(ro ) ≥ %∗c . Similarly, we obtain,  lim inf Jo X̂ nk (0), Z nk ≥ π̂(ro ) ≥ %∗c . k→∞ This proves part (ii). INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 25 The result in part (iii) for the fairness problem follows along the same lines as part (ii). With π̂ as in part (ii), we have  (8.11) lim inf Jo X̂ nk (0), Z nk ≥ π̂(ro ) . k→∞ The uniform integrability of 1 Zn E T Z T  m̃ Ŷjn (s) ds , j = 1, 2 , 0 which follows by (4.13) and the assumption that m̃ < m, together with (5.1), imply that (θ − )π̂(r2 ) ≤ π̂(r1 ) ≤ (θ + )π̂(r2 ) . Therefore, π̂(r1 ) = θ̃()π̂(r2 ) for some θ̃() satisfying |θ̃() − θ| ≤ . Let %̃ := inf π ∈ Hf (θ̃()) π(ro ) , and λ∗ denote the Lagrange multiplier for the problem in Theorem 4.3. It is clear that π̂(ro ) ≥ %̃. Writing π̂(r1 ) = θ̃()π̂(r2 ) as π̂(r1 ) − θπ̂(r2 ) = θ̃() − θ)π̂(r2 ), we obtain by [22, Theorem 1, p. 222] that %∗f − %̃ ≤ λ∗ θ̃() − θ)π̂(r2 ) ≤ ε λ∗ π̂(r2 ) . (8.12) Without loss of generality, we may assume that π̂(ro ) ≤ %∗f ; otherwise (5.2) trivially follows by (8.11). By (4.13) and Jensen’s inequality we have  m̃ π̂(r2 ) ≤ κ̂ 1 + π(ro ) /m  m̃ (8.13) ≤ κ̂ 1 + (%∗f ) /m for some constant κ̂. Therefore combining (8.12)–(8.13), we obtain π̂(ro ) ≥ %̃ ≥ %∗f −  |λ∗ |κ̂ 1 + (%∗f ) m̃/m  , and (5.2) follows by this estimate and (8.11). This completes the proof.  9. Proof of the upper bounds In this section, we prove the upper bounds in Theorem 5.2. We need the following lemma. Lemma 9.1. Let Vk,β be as in (3.6). Suppose v ∈ USSM is such that for some positive constants C1 , C2 , β and k ≥ 2, it holds that Lv Vk,β (x) ≤ C1 − C2 Vk,β (x) ∀x ∈ R2 . Let X̂ n denote the diffusion-scaled state process under the scheduling policy z n [v] in Definition 7.1, b n be its generator. Then, there exists n0 ∈ N such that and L b n Vk,β (x̂) ≤ C 0 − C 0 Vk,β (x̂) L 1 2 ∀x̂ ∈ S̆n , for some positive constants C10 and C20 , and for all n ≥ n0 . Proof. See Appendix A.  26 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Proof of Theorem 5.2. We first prove part (i) for the unconstrained problem. Recall the definition in (3.6). Let k = m + 1. By Theorems 5.5 in Arapostathis and Pang [1] and Lemma 4.1, there exists a continuous precise control v ∈ USSM which is -optimal for (P10 ) and satisfies Lv Vk,β (x) ≤ c1 − c2 Vk,β (x) ∀x ∈ R2 , (9.1) for any β ≥ β̄ defined in (4.11), and for some positive constants c1 , c2 which depend on β. Recall Definition 2.1. The scheduling policy that we apply to the nth system is as follows: Inside the ball nB̆ we apply the Markov policy in Definition 7.1 z n [v ], while outside this ball we apply the Markov policy ž n in Definition 3.1. Let Z n denote this concatenated policy. By Proposition 3.1 and Lemma 9.1 there exist positive constants C1 , C2 , β, and n0 ∈ N, such that b Z n Vk,β (x̂) ≤ C1 − C2 Vk,β (x̂) L ∀x̂ ∈ Sn , ∀ n ≥ n0 . (9.2) n Let Φ̃nT ≡ n Φ̃Z T as defined in (7.8). We define q̂(x̂) := ŷ(x̂) :=  n n n x̂1 − Z11 (x̂) − Z12 (x̂), x̂2 − Z22 (x̂) ,  n n n −Z11 (x̂) − Z12 (x̂), −Z22 (x̂) , By (9.2) we have supn≥n0 J(X̂ n (0), Z n ) < ∞, and by Birkhoff’s ergodic theorem for each n ≥ n0 there exists Tn ∈ R+ , such that Z + +  1 , (9.3) r̂ (e · q̂(x̂) uc , (e · ŷ(x̂) us Φ̃nT (dx̂, du) − J(X̂ n (0), Z n ) ≤ n R2 ×U for all T ≥ Tn and n ≥ n0 . By (9.2) the sequence {Tn } can be selected so as to also satisfy Z sup sup Vk,β (x̂) Φ̃nT (dx̂, du) < ∞ . n≥n0 T ≥Tn (9.4) R2 ×U Without loss of generality we assume that Tn → ∞. Hence, by uniform integrability which is implied by (9.4), together with (9.3) for any η > 0 there exists a ball Bη such that Z + +  1 r̂ (e · q̂(x̂) uc , (e · ŷ(x̂) us Φ̃nT (dx̂, du) − J(X̂ n (0), Z n ) ≤ +η, (9.5) n Bη ×U for all T ≥ Tn and n ≥ n0 . + + √ By JWC on {x̂ ∈ nB̆}, we have (e · q̂(x̂) = (e · x̂)+ and (e · ŷ(x̂) = (e · x̂)− for all x̂ ∈ Bη , and for all large enough n by Corollary 7.1. On the other hand, Φ̃nT converges, as (n, T ) → ∞, to πv in P(R2 × U) by Lemma 7.2. Therefore Z Z + +  r̂ (e · q̂(x̂) uc , (e · ŷ(x̂) us Φ̃nTn (dx̂, du) −−−→ r(x, u) πv (dx, du) . (9.6) n→∞ Bη ×U Bη ×U By (9.5)–(9.6) we obtain lim sup J(X̂ n (0), Z n ) ≤ %∗ +  + η . n→∞ Since η and  are arbitrary, this completes the proof of part (i). We next show the upper bound for the constrained problem. Let  > 0 be given. By Theorem 5.7 in [1] and Lemma 4.1, there exists a continuous precise control v ∈ USSM and constants δj < δj , j = 1, 2, satisfying πv (ro ) ≤ %∗c + , and πv (rj ) ≤ δj , j = 1, 2, and (9.1) holds. Let Z n be the Markov policy constructed in part (i) by concatenating z n [v ] and ž n . Following the proof of part (i) and choosing η small enough, i.e., η <  ∧ 12 min(δj − δj , j = 1, 2), we obtain lim sup Jo (X̂ n (0), Z n ) ≤ %∗c + 2 , n→∞ lim sup Jc,j X̂ n (0), Z n n→∞  ≤ 1 (δj + δj ) , 2 j = 1, 2 . INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 27 This completes the proof of part (ii). The proof of the upper bound for the fairness problem is analogous to part (ii). By Theorem 5.7 and Remark 5.1 in [1], for any  > 0, there exists a continuous precise control v ∈ USSM for (P30 ) satisfying πv (ro ) ≤ %∗f +  , and πv (r1 ) = θ πv (r2 ) . (9.7) − Since {πv ,  ∈ (0, 1)} is tight, and (e · x) is strictly positive on an open subset of B1 , it follows by the Harnack inequality for the density of the invariant probability measure of the diffusion that πv (r2 ) > 0 . inf ∈(0,1) (9.8) Arguing as in part (ii), we obtain lim sup Jo (X̂ n (0), Z n ) ≤ %∗f +  , n→∞ (9.9) n lim Jc,j X̂ (0), Z n  n→∞ = πv (rj ) , j = 1, 2 . The result then follows by (9.7)–(9.9), thus completing the proof.  10. Conclusion We have proved asymptotic optimality for the N-network in the Halfin-Whitt regime. The analysis results in a good understanding of the stability of the diffusion-scaled state processes under certain scheduling policies and the convergence properties of the associated mean empirical measures. The state-dependent priority scheduling policy constructed not only gives us a better understanding of the N-network, but also plays a key role in proving the upper bound. In addition we have identified some important properties of the diffusion-scaled state processes that concern existence of moments, and the convergence of the mean empirical measures. The methodology we followed should help to establish asymptotic optimality for more general multiclass multi-pool networks in the Halfin-Whitt regime. If this is done, it will nicely complement the results on ergodic control of the limiting controlled diffusion in Arapostathis and Pang [1]. Appendix A. Proofs of Proposition 3.1 and Lemma 9.1 In these proofs we use the fact that the quantities n n n n λn1 − µn11 N1n − µn12 N12 , nx∗1 − N1n − N22 , λn2 − µn22 N22 , nx∗2 − N22 , and λn2 − µn22 nx∗2 , √ are in O( n). This is straightforward to verify using Assumption 2.1. Proof of Proposition 3.1. Simplifying the notation in Definition 3.1 we let z n = ž n , and analogously for y̌ n and q̌ n . Fix k > 2. Under the scheduling policy in Definition 3.1, the resulting process X n is Markov with generator n Lžn f (x) := 2 X   n n λni f (x + ei ) − f (x) + (µn11 z11 + µn12 z12 ) f (x − e1 ) − f (x) i=1 + n µn22 z22  f (x − e2 ) − f (x) + 2 X  γin qin f (x − ei ) − f (x) , x ∈ Z2+ , (A.1) i=1 Recall the definition of x̂ in (3.5). Define  k fn (x) := |x1 − nx∗1 |k + β|x2 − nx∗2 |k = n /2 |x̂1 |k + β|x̂2 |k , for some positive constant β, to be determined later. If we show that n Lžn fn (x) ≤ C1 n /2 − C2 fn (x) , k x ∈ Z2+ , (A.2) 28 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK for some positive constants C1 and C2 , and for all n ≥ n0 , then by using (3.8) we obtain (3.9). Given (A.2), we easily obtain that Z T  n n n E [fn (X (T ))] − fn (X (0)) = E Ln fn (X (s)) ds 0 ≤ C1 n k/2 Z T − C2 E T  fn (X (s)) ds , n 0 which implies that Z T    1   1 1 n E Vk,β X̂ (s) ds ≤ C1 + Vk,β X̂ n (0) − E Vk,β X̂ n (T ) . T T T 0 By letting T → ∞, this implies that (3.10) holds. We now focus on proving (A.2). Note that (a ± 1)k − ak = kak−1 + O(ak−2 ) , a ∈ R. Recall x̃ in (3.5). Then by (A.1), we have n Lžn fn (x) = λn1 kx̃1 |x̃1 |k−2 + O |x̃1 |k−2 + βλn2 kx̃2 |x̃2 |k−2 + O |x̃2 |k−2  n n + (µn11 z11 + µn12 z12 ) −kx̃1 |x̃1 |k−2 + O |x̃1 |k−2  n + βµn22 z22 −kx̃2 |x̃2 |k−2 + O |x̃2 |k−2  + γ1n q1n −kx̃1 |x̃1 |k−2 + O |x̃1 |k−2  + βγ2n q2n −kx̃2 |x̃2 |k−2 + O |x̃2 |k−2 .   Let Fn(1) (x) :=     λn1 + γ1n q1n O |x̃1 |k−2 + β λn2 + γ2n q2n O |x̃2 |k−2    n n n + µn11 z11 + µn12 z12 O |x̃1 |k−2 + βµn22 z22 O |x̃2 |k−2 , (A.3) and   Fn(2) (x) := kx̃1 |x̃1 |k−2 λn1 − γ1n q1n + βkx̃2 |x̃2 |k−2 λn2 − γ2n q2n n n n − kx̃1 |x̃1 |k−2 (µn11 z11 + µn12 z12 ) − βkx̃2 |x̃2 |k−2 µn22 z22 . (A.4) Then n Lžn fn (x) = Fn(1) (x) + Fn(2) (x) . (1) We first study Fn (x). It is easy to observe that for each i = 1, 2 and j = 1, 2, n zij ≤ xi , and qin ≤ xi . (A.5) Thus, we obtain Fn(1) (x) ≤ = ≤     λn1 + γ1n x1 O |x̃1 |k−2 + β λn2 + γ2n x2 O |x̃2 |k−2    + µn11 + µn12 x1 O |x̃1 |k−2 + βµn22 x2 O |x̃2 |k−2     λn1 + γ1n (nx∗1 + x̃1 ) O |x̃1 |k−2 + β λn2 + γ2n (nx∗2 + x̃2 ) O |x̃2 |k−2    + µn11 + µn12 (nx∗1 + x̃1 )O |x̃1 |k−2 + βµn22 (nx∗2 + x̃2 )O |x̃2 |k−2 2  X i=1   O(n)O |x̃i |k−2 + O |x̃i |k−1 , (A.6) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 29 where the last inequality follows from Assumption 2.1. (2) We next focus on Fn (x). We consider four cases: n and x ≥ N n . Then Case 1 : x1 ≥ N1n + N12 2 22 n z11 = N1n , n n z12 = N12 , n n z22 = N22 , n q1n = x1 − N1n − N12 , n q2n = x2 − N22 . We obtain   n n ) Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 N12 − γ1n (nx∗1 − N1n − N12   n n + βkx̃2 |x̃2 |k−2 λn2 − µn22 N22 − γ2n (nx∗2 − N22 ) − kγ1n |x̃1 |k − βkγ2n |x̃2 |k  √ (A.7) = O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kγ1n |x̃1 |k − βkγ2n |x̃2 |k . n and x < N n . Consider two subcases: Case 2 : x1 < N1n + N12 2 22 n Case 2.1 : x1 > N1 . Then n z11 = N1n , n z12 = x1 − N1n , n z22 = x2 , q1n = q2n = 0 . We have   Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 (nx∗1 − N1n )   + βkx̃2 |x̃2 |k−2 λn2 − µn22 nx∗2 − kµn12 |x̃1 |k − βkµn22 |x̃2 |k  √ = O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kµn12 |x̃1 |k − βkµn22 |x̃2 |k . (A.8) Case 2.2 : x1 < N1n . Then n z11 = x1 , n z12 = 0, n z22 = x2 , q1n = q2n = 0 . We obtain     Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 x1 + βkx̃2 |x̃2 |k−2 λn2 − µn22 (x̃2 + nx∗2 )     n ≤ kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 N12 + βkx̃2 |x̃2 |k−2 λn2 − µn22 nx∗2 n + kµn12 N12 x̃1 |x̃1 |k−2 − βkµn22 |x̃2 |k . (A.9) Since x1 ≤ N1n we have µn12 N2n |x̃1 |2 N1n √ µ12 ν2 = − |x̃1 |2 + O( n)|x̃1 | . ν1 µn12 N2n x̃1 ≤ − Thus, (A.9) takes the form  √ ∗ µ12 ν2 Fn(2) (x) ≤ O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kξ12 |x̃1 |k − βkµn22 |x̃2 |k . ν1 (A.10) n and x < N n . We distinguish two subcases. Case 3 : x1 ≥ N1n + N12 2 22 n Case 3.1 : x1 + x2 ≥ N1 + N2n . Then n z11 = N1n , n z12 = N2n − x2 , n z22 = x2 , q1n = x1 + x2 − N1n − N2n , q2n = 0 . We have   Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 (N2n − nx∗2 − x̃2 ) − γ1n (x1 + x2 − N1n − N2n )   + βkx̃2 |x̃2 |k−2 λn2 − µn22 (nx∗2 + x̃2 ) 30 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK   n n = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 N12 + µn12 (nx∗2 + N22 )   − kx̃1 |x̃1 |k−2 γ1n (nx∗1 + nx∗2 − N1n − N2n ) + βkx̃2 |x̃2 |k−2 λn2 − µn22 nx∗2 + k(µn12 − γ1n )x̃1 x̃2 |x̃1 |k−2 − kγ1n |x̃1 |k − βkµn22 |x̃2 |k  √ = O( n) |x̃1 |k−1 + β|x̃2 |k−1 + k(µn12 − γ1n )x̃1 x̃2 |x̃1 |k−2 − kγ1n |x̃1 |k − βkµn22 |x̃2 |k . (A.11) Case 3.2 : x1 + x2 < N1n + N2n . Then n z11 = N1n , n z12 = x̃1 + nx∗1 − N1n , n z22 = x2 , q1n = q2n = 0 . We have   Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 (x̃1 + nx∗1 − N1n )   + βkx̃2 |x̃2 |k−2 λn2 − µn22 (nx∗2 + x̃2 )   n n = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 N12 − µn12 (nx∗1 − N1n − N12 )   + βkx̃2 |x̃2 |k−2 λn2 − µn22 nx∗2 − kµn12 |x̃1 |k − βkµn22 |x̃2 |k  √ = O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kµn12 |x̃1 |k − βkµn22 |x̃2 |k . (A.12) n and x ≥ N n . Here we distinguish four subcases. Case 4 : x1 < N1n + N12 2 22 Case 4.1 : x1 ≤ N1n and x2 ≤ N2n . Using the argument used in Case 2.2, we obtain the same estimate as (A.10). Case 4.2 : x1 ≤ N1n and x2 > N2n . Then n z11 = x1 , n z12 = 0, n z22 = N2n , q1n = 0 , q2n = x2 − N2n . We use the inequality √ n µn22 N12 + γ2n (x̃2 + nx∗2 − N2n ) ≥ (µn22 ∧ γ2n ) x̃2 + O( n) , x2 > N2n to write λn2 − µn22 N2n − γ2n (x2 − N2n ) = λn2 − µn22 N2n − γ2n (x̃2 + nx∗2 − N2n ) √ n ≤ λn2 − µn22 N22 + (µn22 ∧ γ2n ) x̃2 + O( n) . Therefore, as in Case 2.2, we obtain  √ √  n Fn(2) (x) ≤ kO( n) |x̃1 |k−1 + βkx̃2 |x̃2 |k−2 λn2 − µn22 N22 + O( n) ∗ µ12 ν2 |x̃1 |k − βk(µn22 ∧ γ2n ) |x̃2 |k − kξ12 ν1  √ ∗ µ12 ν2 ≤ O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kξ12 |x̃1 |k − βk(µn22 ∧ γ2n ) |x̃2 |k . ν1 Case 4.3 : x1 > N1n and x1 + x2 < N1n + N2n . Then n z11 = N1n , n z12 = x1 − N1n , n z22 = x2 , q1n = 0 , q2n = 0 . We obtain   Fn(2) (x) = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 (x̃1 + nx∗1 − N1n )   + βkx̃2 |x̃2 |k−2 λn2 − µn22 (x̃2 + nx∗2 )   n n = kx̃1 |x̃1 |k−2 λn1 − µn11 N1n − µn12 N12 − µn12 (nx∗1 − N1n − N12 ) (A.13) INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 31   n n + βkx̃2 |x̃2 |k−2 λn2 − µn22 N22 − µn22 (nx∗2 − N22 ) − kµn12 |x̃1 |k − βkµn22 |x̃2 |k  √ = O( n) |x̃1 |k−1 + β|x̃2 |k−1 − kµn12 |x̃1 |k − βkµn22 |x̃2 |k . (A.14) Case 4.4 . x1 > N1n and x1 + x2 ≥ N1n + N2n . Then n Z11 = N1n , n Z12 = x1 − N1n , n Z22 = N2n + N1n − x1 , Qn1 = 0 , Qn2 = x1 + x2 − N1n − N2n . Therefore, we obtain   Fn(2) (x) = qβ1 x̃1 |x̃1 |q−2 λn1 − µn11 N1n − µn12 (x̃1 + nx∗1 − N1n )   + qβ2 x̃2 |x̃2 |q−2 λn2 − µn22 (N2n + N1n − x1 ) − γ2n x2 − (N2n + N1n − x1 )   n n ≤ qβ1 x̃1 |x̃1 |q−2 λn1 − µn11 N1n − µn12 N12 − µn12 (x̃1 + nx∗1 − N1n − N12 )   + qβ2 x̃2 |x̃2 |q−2 λn2 − (µn22 ∧ γ2n )(x̃2 + nx∗2 )  √ ≤ O( n) β1 |x̃1 |q−1 + β2 |x̃2 |q−1 − qβ1 µn12 |x̃1 |q − qβ2 (µn22 ∧ γ2n )|x̃2 |q , (A.15) where the first inequality follows by observing that  µn22 (N2n + N1n − x1 ) + γ2n x2 − (N2n + N1n − x1 ) ≥ (µn22 ∧ γ2n )x2 , n + N n − x > 0. since x2 ≥ N2n + N1n − x1 and N2n + N1n − x1 > N22 1 1 By Young’s inequality, we have 1 |x̃1 |k−1 |x̃2 | ≤ |x̃1 |k + k−1 |x̃2 |k ,  1 |x̃2 |k−1 |x̃1 | ≤ |x̃1 |k + 1 |x̃2 |k  k−1 for any  > 0. Using this in (A.11) in combination with (A.7)–(A.8), (A.10) and (A.12)–(A.15), we can choose the constant β properly so that  2  2 X X   √ ž n k−2 k−1 Ln fn (x) ≤ O(n)O |x̃i | + O( n)O |x̃i | − C̃2 |x̃i |k , (A.16) i=1 i=1 for some positive constant C̃2 . Now applying Young’s inequality again to the first two terms on the right hand side of (A.16), we obtain k/(k−1) √ √ k + 1−k O( n) , O( n)O(|x̃i |k−1 ) ≤  O(|x̃i |k−1 ) k/(k−2) k/2 k O(n)O(|x̃i |k−2 ) ≤  O(|x̃i |k−2 ) + 1− /2 O(n) for any  > 0. This shows that can choose β, C1 and C2 appropriately to obtain the claim in (A.2). √ Recall x̂n in (3.5) and let q̂in := qin / n for i = 1, 2. Concerning the claim in (3.10) with X̂ n replaced by Q̂n we observe that in Case 1, q̂1n = x̂n1 + O(1), and q̂2n = x̂n2 + O(1), in Case 3.1, q̂1n = x̂n1 + x̂n2 + O(1), and q̂2n = 0, in Case 4.2, q̂1n = 0, and q̂2n ≤ x̂n2 + O(1), in Case 4.4, q̂1n = 0, and q̂2n = x̂n1 + x̂n2 + O(1), and in all the other cases, q̂1n = q̂2n = 0. The same claim for Ŷ n then follows from the balance equation (6.5). The proof of the proposition is complete.  Proof of Lemma 9.1. We need to show (A.2) holds for Ln fn (x) under the scheduling policy z n [v] (1) (2) (1) (2) in Definition 7.1. We can write Ln fn (x) = Fn (x) + Fn (x) with Fn (x) and Fn (x) given by (1) (A.3) and (A.4) respectively. We obtain (A.6) for Fn (x) since (A.5) also holds under the policy 32 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK (2) z n [v]. For Fn (x), by (A.4) and Definition 7.1, since the control v satisfies (9.1) and x ∈ Xn (JWC being satisfied), we easily obtain 2 X  √ |x̃i |k , Fn(2) (x) ≤ O( n) |x̃1 |k−1 + β|x̃2 |k−1 − C̃3 i=1 for some positive constant C̃3 . Thus, following the argument in the proof of Proposition 3.1, we obtain the claim in (A.2) and hence the result follows by scaling.  Appendix B. Proof of Theorem 4.3 Recall Hf (θ) defined in (4.15). As in Theorem 4.2 there exists λ∗ ∈ R such that inf π ∈ Hf (θ) π(ro ) = inf π(hθ,λ∗ ) = %∗f , π∈G and the property in (4.13) implies that the infimum is attained in some π∗ ∈ G. Therefore, the conclusions analogous to parts (a) and (b) of Theorem 4.2 hold. Part (e) is also standard. It remains to derive the HJB equation and the characterization of optimality corresponding to Theorem 4.2 (c)–(d). This is broken in a series of lemmas. We need to introduce some notation. We denote by τ̆δ , δ > 0, the first exit time of a process from Bδc , i.e., τ̆δ := inf {t > 0 : Xt 6∈ Bδc } . We denote by U?SM the class of Markov controls v satisfying πv (ro ) < ∞, and by G? the corresponding class of ergodic occupation measures. By the method of proof of (4.13) there exists inf-compact V ∈ C 2 (R2 ) and positive constants κ1 and κ2 satisfying Lu V(x) ≤ κ1 − κ2 |x|m + ro (x, u) ∀(x, u) ∈ R2 × U . Moreover, since (e · x)− ∈ o(|x|m ), there exists a constant κ0 such that κ2 m (1 + θ)λ∗ rj (x, u) ≤ κ0 + |x| ∀(x, u) ∈ R2 × U , 2 For  > 0 we define h (x, u) := hθ,λ∗ (x, u) + κ2 |x|m . j = 1, 2 . (B.1) (B.2) Lemma B.1. The following hold: π(hθ,λ∗ ) ≤ κ0 + κ1 2 + 32 π(ro ) ∀ π ∈ G? , + π(hθ,λ∗ ) ∀π ∈ G,  π(h ) ≤  κ0 + κ21 + κ22 + (1 + )π(hθ,λ∗ ) . π(ro ) ≤ κ0 + κ2 2 Proof. This is an easy calculation using (B.1)–(B.2).  Lemma B.2. There exists a unique function V ε ∈ C 2 (R2 ) with V ε (0) = 0, which is bounded below in R2 , and solves the HJB   min Lu V ε (x) + h (x, u) = % , x ∈ R2 . (B.3) u∈U π(h ), where %ε := inf π∈G and the usual characterization of optimality holds. Moreover, (a) for every R > 0, there exists a constant kR > 0 such that sup osc V ε ≤ kR ; ∈(0,1) BR INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 33 (b) if vε is a measurable a.e. selector from the minimizer of the Hamiltonian in (B.3), then for any δ > 0, we have Z τ̆δ   ε vε  V (x) ≥ Ex h (Xs , vε (Xs )) − %ε ds + inf V ε ; Bδ 0 (c) for any stationary control v ∈ U?SM and for any δ > 0, it holds that  Z τ̆δ    ε ε v h Xs , v(Xs ) − %ε ds + V (Xτ̆δ ) . V (x) ≤ Ex 0 Proof. The proof follows along the lines of Theorem 3.3 in Arapostathis et al. [3], using the fact that h is inf-compact, for each  > 0, and inf π∈G π(h ) < ∞ by Lemmas 4.1 and B.1. There is one important difference though: the running cost h is not bounded below uniformly in  > 0, and the estimate in part (a) needs special attention. By (B.1)–(B.2), using Itô’s formula, we obtain Z ∞  Z ∞   U −αs ∗ U −αs κ1 1 Ex e (1 + θ)λ ri (Xs , Us ) ds ≤ V(x) + Ex e κ0 + 2 + 2 ro (Xs , Us ) ds 0 0 for all U ∈ U, α > 0. It follows that, given any ball BR , the discounted value function Z ∞    U −αs  Ṽα (x) := inf Ex e 2κ0 + κ1 + h (Xs , Us ) ds U ∈U 0 is strictly positive on BR for all sufficiently small α > 0. Therefore, by adding the constant 2κ0 + κ1 to the running cost, we obtain estimates on the oscillation of Ṽ  that are uniform over  > 0 by Lemmas 3.5 and 3.6 of [3].  The next lemma completes the proof of Theorem 4.3. Lemma B.3. Let V ε and %ε , for ε > 0, be as in Lemma B.2. The following hold: (i) The function V ε converges to some Vf ∈ C 2 (R2 ), uniformly on compact sets, and %ε → %∗f , as ε & 0, and Vf satisfies   min Lu Vf (x) + hθ,λ∗ (x, u) = %∗f = π∗ (hθ,λ∗ ) . (B.4) u∈U Also, any limit point v ∗ (in the topology of Markov controls) as ε & 0 of measurable selectors {vε } from the minimizer of (B.3) satisfies ∗ Lv Vf (x) + hθ,λ∗ (x, v ∗ (x)) = %∗f a.e. in R2 . (ii) A stationary Markov control v ∈ USM is optimal if and only if it satisfies    Hhθ,λ∗ x, ∇Vf (x) = b x, v(x) · ∇Vf (x) + hθ,λ∗ x, v(x) a.e. in R2 , (B.5) where Hhθ,λ∗ is defined in (4.14) with r replaced by hθ,λ∗ . (iii) The function V∗ has the stochastic representation Z τ̆δ    v Vf (x) = lim inf? Ex hθ,λ∗ Xs , v(Xs ) − %∗ ds δ&0 v ∈ USM = lim δ&0 Ev̄x Z 0 τ̆δ h θ,λ∗    Xs , v̄(Xs ) − %∗ ds 0 for any v̄ ∈ USM that satisfies (B.5). Proof. We follow the method in the proof of Theorem 3.4 in [3]. Since % is non-increasing and bounded below, it converges to some value which is clearly π∗ (hθ,λ∗ ) by Lemma B.1. Parts (i) and (iii) then follow as in the proof of Lemma 3.9 in [3], and we can follow the method in the proof of Lemma 3.10 in the same paper to establish that Vf− ∈ o(V). 34 INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK Now let v̂ ∈ USM be any control satisfying (B.5). We modify the estimate in (B.2) and write it as (1 + θ)λ∗ ri (x, u) ≤ κ0 + κ42 |x|m for some constant κ00 . An easy calculation using (B.1) then shows that  κ2 Lv̂ (V + 2Vf ) ≤ κ0 + κ1 + 2κ00 − |x|m − hθ,λ∗ x, v̂(x) . 2 Therefore, since V + 2Vf is inf-compact, we must have v̂ ∈ U?SM . Using this and the fact that  − − 1 v̂ Vf ∈ o(V), we deduce that T Ex Vf (XT )] → 0 as T → ∞. Hence, by Itô’s formula and (B.4) we obtain πv̂ (hθ,λ∗ ) ≤ %∗f . Thus we must have equality πv̂ (hθ,λ∗ ) = π∗ (hθ,λ∗ ), i.e., v̂ is optimal. This completes the proof.  Acknowledgements The authors thank the referees for the helpful comments that have improved the paper. This research was supported in part by the Army Research Office under grant W911NF-17-1-0019. The work of Ari Arapostathis was also supported in part by the Office of Naval Research through grant N00014-14-1-0196. The work of Guodong Pang is also supported in part by the Marcus Endowment Grant at the Harold and Inge Marcus Department of Industrial and Manufacturing Engineering at Penn State. References [1] A. Arapostathis and G. Pang. Ergodic diffusion control of multiclass multi-pool networks in the Halfin-Whitt regime. Ann. Appl. Probab., 26(5):3110–3153, 2016. [2] A. Arapostathis, V. S. Borkar, and M. K. Ghosh. Ergodic control of diffusion processes, volume 143 of Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge, 2012. [3] A. Arapostathis, A. Biswas, and G. Pang. Ergodic control of multi-class M/M/N + M queues in the Halfin-Whitt regime. Ann. Appl. Probab., 25(6):3511–3570, 2015. [4] M. Armony. Dynamic routing in large-scale service systems with heterogeneous servers. Queueing Syst., 51(3-4):287–329, 2005. [5] M. Armony and A. R. Ward. Fair dynamic routing in large-scale heterogeneous-server systems. Oper. Res., 58(3):624–637, 2010. [6] R. Atar. A diffusion model of scheduling control in queueing systems with many servers. Ann. Appl. Probab., 15(1B):820–852, 2005. [7] R. Atar. Scheduling control for queueing systems with many servers: asymptotic optimality in heavy traffic. Ann. Appl. Probab., 15(4):2606–2650, 2005. [8] R. Atar, A. Mandelbaum, and M. I. Reiman. Scheduling a multi class queue with many exponential servers: asymptotic optimality in heavy traffic. Ann. Appl. Probab., 14(3):1084– 1134, 2004. [9] R. Atar, A. Mandelbaum, and G. Shaikhet. Simplified control problems for multiclass manyserver queueing systems. Math. Oper. Res., 34(4):795–812, 2009. [10] S. L. Bell and R. J. Williams. Dynamic scheduling of a system with two parallel servers in heavy traffic with resource pooling: asymptotic optimality of a threshold policy. Ann. Appl. Probab., 11(3):608–649, 2001. [11] A. Biswas. An ergodic control problem for many-sever multi-class queueing systems with help. arXiv, 1502.02779v2, 2015. [12] J. G. Dai and T. Tezcan. Optimal control of parallel server systems with many servers in heavy traffic. Queueing Syst., 59(2):95–134, 2008. [13] J. G. Dai and T. Tezcan. State space collapse in many-server diffusion limits of parallel server systems. Math. Oper. Res., 36(2):271–320, 2011. INFINITE HORIZON AVERAGE OPTIMALITY OF THE N-NETWORK 35 [14] D. Gamarnik and A. L. Stolyar. Multiclass multiserver queueing system in the Halfin-Whitt heavy traffic regime: asymptotics of the stationary distribution. Queueing Syst., 71(1-2):25–51, 2012. [15] S. Ghamami and A. R. Ward. Dynamic scheduling of a two-server parallel server system with complete resource pooling and reneging in heavy traffic: Asymptotic optimality of a two-threshold policy. Math. Oper. Res., 38(4):761–824, 2013. [16] I. Gurvich and W. Whitt. Queue-and-idleness-ratio controls in many-server service systems. Math. Oper. Res., 34(2):363–396, 2009. [17] I. Gurvich and W. Whitt. Service-level differentiation in many-server service system via queueratio routing. Oper. Res., 58(2):316–328, 2010. [18] J. M. Harrison. Brownian models of queueing networks with heterogeneous customer populations. In Stochastic differential systems, stochastic control theory and applications (Minneapolis, Minn., 1986), volume 10 of IMA Vol. Math. Appl., pages 147–186. Springer, New York, 1988. [19] J. M. Harrison. Heavy traffic analysis of a system with parallel servers: Asymptotic optimality of discrete-review policies. Ann. Appl. Probab., 8:822–848, 1998. [20] J. M. Harrison. Brownian models of open processing networks: Canonical representation of workload. Ann. Appl. Probab., 10(1):75–103, 2000. [21] O. Kallenberg. Foundations of modern probability. Probability and its Applications (New York). Springer-Verlag, New York, second edition, 2002. [22] D. G. Luenberger. Optimization by vector space methods. John Wiley & Sons Inc., New York, 1967. [23] A. L. Stolyar. Diffusion-scale tightness of invariant distributions of a large-scale flexible service system. Adv. in Appl. Probab., 47(1):251–269, 2015. [24] A. L. Stolyar and E. Yudovina. Tightness of invariant distributions of a large-scale flexible service system under a priority discipline. Stoch. Syst., 2(2):381–408, 2012. [25] A. L. Stolyar and E. Yudovina. Systems with large flexible server pools: instability of “natural” load balancing. Ann. Appl. Probab., 23(5):2099–2183, 2012. [26] T. Tezcan and J. G. Dai. Dynamic control of N-systems with many servers: asymptotic optimality of a static priority policy in heavy traffic. Oper. Res., 58(1):94–110, 2010. [27] A. R. Ward and M. Armony. Blind fair routing in large-scale service systems with heterogeneous customers and servers. Oper. Res., 61(1):228–243, 2013. [28] R. J. Williams. On dynamic scheduling of a parallel server system with complete resource pooling. Analysis of Communication Networks: Call Centres, Traffic and Performance. Fields Inst. Commun. Amer. Math. Soc., Providence, RI., 28:49–71, 2000. [29] R. J. Williams. Stochastic processing networks. Annual Review of Statistics and Its Application, 3, 2016. [30] S. H. Xu, R. Righter, and J. G. Shanthikumar. Optimal dynamic assignment of customers to heterogeneous servers in parallel. Oper. Res., 40(6):1126–1138, 1992.
3cs.SY
Logical Methods in Computer Science Vol. 7 (4:06) 2011, pp. 1–19 www.lmcs-online.org Submitted Published Nov. 16, 2010 Nov. 24, 2011 THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS MANUEL BODIRSKY a AND JENS K. MUELLER b a CNRS/LIX, École Polytechnique, Palaiseau, France e-mail address: [email protected] a Friedrich-Schiller-University, Jena, Germany e-mail address: [email protected] Abstract. Several computational problems in phylogenetic reconstruction can be formulated as restrictions of the following general problem: given a formula in conjunctive normal form where the literals are rooted triples, is there a rooted binary tree that satisfies the formula? If the formulas do not contain disjunctions, the problem becomes the famous rooted triple consistency problem, which can be solved in polynomial time by an algorithm of Aho, Sagiv, Szymanski, and Ullman. If the clauses in the formulas are restricted to disjunctions of negated triples, Ng, Steel, and Wormald showed that the problem remains NP-complete. We systematically study the computational complexity of the problem for all such restrictions of the clauses in the input formula. For certain restricted disjunctions of triples we present an algorithm that has sub-quadratic running time and is asymptotically as fast as the fastest known algorithm for the rooted triple consistency problem. We also show that any restriction of the general rooted phylogeny problem that does not fall into our tractable class is NP-complete, using known results about the complexity of Boolean constraint satisfaction problems. Finally, we present a pebble game argument that shows that the rooted triple consistency problem (and also all generalizations studied in this paper) cannot be solved by Datalog. 1. Introduction Rooted phylogeny problems are fundamental computational problems for phylogenetic reconstruction in computational biology, and more generally in areas dealing with large amounts of data about rooted trees. Given a collection of partial information about a rooted tree, we would like to know whether there exists a single rooted tree that explains the data. A concrete example of a computational problem in this context is the rooted triple consistency problem. We are given a set V of variables, and a set of triples ab|c with a, b, c ∈ V , 1998 ACM Subject Classification: F.4.1. Key words and phrases: Constraint Satisfaction Problems, Phylogenetic Reconstruction, Computational Complexity, Datalog, ω-categorical structures. A preliminary version of this work appeared in the Proceedings of the 13th International Conference on Database Theory (ICDT), 2010. a The first author has received funding from the European Research Council under the European Community’s Seventh Framework Programme (FP7/2007-2013 Grant Agreement no. 257039). l LOGICAL METHODS IN COMPUTER SCIENCE c DOI:10.2168/LMCS-7 (4:06) 2011 CC M. Bodirsky and J. K. Mueller Creative Commons 2 M. BODIRSKY AND J. K. MUELLER and we would like to know whether there exists a rooted tree T with leaf set V such that for each of the given triples ab|c the youngest common ancestor of a and b in this tree is below the youngest common ancestor of a and c (if such a tree exists, we say that the instance is satisfiable). The rooted triple consistency problem has an interesting history. The first polynomial time algorithm for the problem was discovered by Aho, Sagiv, Szymanski, and Ullman [ASSU81], motivated by problems in database theory. This algorithm was later rediscovered for phylogenetic analysis [Ste92]. Henzinger, King, and Warnow [HKW96] showed how to use decremental graph connectivity algorithms to improve the quadratic runtime √ O(mn) of the algorithm by Aho et al. to a deterministic algorithm with runtime O(m n). Dekker [Dek86] asked the question whether there is a finite set of ‘rules’ that allows to infer a triple ab|c from another given set of triples Φ if all trees satisfying Φ also satisfy ab|c. This question was answered negatively by Bryant and Steel [BS95]. Dekker’s ‘rules’ have a very natural interpretation in terms of Datalog programs. Datalog as an algorithmic tool for rooted phylogeny problems is more powerful than Dekker’s rules. We say that a Datalog program solves the rooted triple consistency problem if it derives a distinguished 0-ary predicate false on a given set of triples if and only if the instance of the rooted triple consistency problem is not satisfiable. One of the results of this paper is the proof that there is no Datalog program that solves the rooted triple consistency problem. Datalog inexpressibility results are known to be very difficult to obtain, and the few existing results often exhibit interesting combinatorics [KV95, ASY91, FV99, Gro94, BK10]. The tool we apply to show our result, the existential pebble game, originates in finite model theory, and was successfully applied to finite domain constraint satisfaction [KV98]. A recent generalization of the intimate connection between Datalog and the existential pebble game to a broad class of infinite domain constraint satisfaction problems [BD08] allows us to apply the game to study the expressive power of Datalog for the rooted triple consistency problem. There are several other important rooted phylogeny problems One is the subtree avoidance problem, introduced by [NSW00], or the forbidden triple problem [Bry97]; both are NP-hard. It turns out that all of those problems and many other rooted phylogeny problems can be conveniently put into a common framework, which we introduce in this paper. A rooted triple formula is a formula Φ in conjunctive normal form where all literals are of the form ab|c. It turns out that the problems mentioned above and many other rooted phylogeny problems (we provide more examples in Section 2) can be formalized as the satisfiability problem for a given rooted triple formula Φ where the set of clauses that might be used in Φ is (syntactically) restricted. If C is a class of clauses, and the input is confined to rooted triple formulas with clauses from C, we call the corresponding computational problem the rooted phylogeny problem for clauses from C. In this paper, we determine for all classes of clauses C the computational complexity of the rooted phylogeny problem for clauses from C. In all cases, the corresponding computational problem is either in P or NP-complete. In our proof of the complexity classification we apply known results from Boolean constraint satisfaction. The rooted phylogeny problem is closely related to a corresponding split problem (defined in Section 4), which is a Boolean constraint satisfaction problem where we are looking for a surjective solution, i.e., a solution where at least one variable is set to true and at least one variable is set to false. The complexity of Boolean split problems has been classified in [CKS01]. If C is such that the corresponding split problem can be solved efficiently, our algorithmic results in Section 4 THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 3 show that the rooted phylogeny problem for clauses from C can be solved in polynomial time. Conversely, we present a general reduction that shows that if the split problem is NP-hard, then the rooted phylogeny problem for C is NP-hard as well. 2. Phylogeny Problems We fix some standard terminology concerning rooted trees. Let T be a tree (i.e., an undirected, acyclic, and connected graph) with a distinguished vertex r, the root of T . The vertices with exactly one neighbor in T are called leaves. The vertices of T are denoted by V (T ), and the leaves of T by L(T ) ⊆ V (T ). For u, v ∈ V (T ), we say that u lies below v if the path from u to r passes through v. We say that u lies strictly below v if u lies below v and u 6= v. The youngest common ancestor (yca) of two vertices u, v ∈ V (T ) is the node w such that both u and v lie below w and w has maximal distance from r. Note that the yca, viewed as a binary operation, is commutative and associative, and hence there is a canonical definition of the yca of a set of elements u1 , . . . , uk . The tree T is called binary if the root has two neighbors, and every other vertex has either three neighbors or one neighbor. A neighbor u of a vertex v is called a child of v (and v is called the parent of u) in T if the distance of u from the root is strictly larger than the distance of v from the root. We write uv|w (or say that uv|w holds in T ) if u, v, w are distinct leaves of T and yca(u, v ) lies strictly below yca(u, w ) in T . Note that for distinct leaves u, v, w of any binary tree T , exactly one of the triples uv|w, uw|v, and vw|u holds in T . Definition 2.1. A rooted triple formula is a (quantifier-free) conjunction of clauses (also called triple clauses) where each clause is a disjunction of literals of the form xy|z. Example 2.2. An example of a triple clause is xz|y ∨ yz|x; it will also be denoted by xy - z. Another example of a triple clause is xy|z1 ∨ xy|z2 . The following notion is used frequently in later sections. If Φ is a formula, and S is a subset of the variables of Φ, then Φ[S] denotes the conjunction of all those clauses in Φ that only contain variables from S. Definition 2.3. A rooted triple formula Φ is satisfiable if there exists a rooted binary tree T and a mapping α from the variables of Φ to the leaves of T such that in every clause at least one literal is satisfied. A literal xy|z is satisfied by (T, α) if α(x), α(y), α(z) are distinct and if yca(α(x ), α(y)) lies strictly below yca(α(x ), α(z )) in T . The pair (T, α) is then called a solution to Φ. We would like to remark that a rooted triple formula Φ is satisfiable if and only if there exists a rooted binary tree T and an injective mapping α from the variables of Φ to the leaves of T such that the formula evaluates under α to true. Example 2.4. Let Φ = xz|y ∨ yz|x ∧ xy|w be a rooted triple formula with variables V = {w, x, z, y}. Then the tree T w x z y together with the identity mapping on V is a solution to Φ. A fundamental problem in phylogenetic reconstruction is the rooted triple consistency problem [HKW96, BS95, Ste92, ASSU81]. This problem can be stated conveniently in terms of rooted triple formulas. 4 M. BODIRSKY AND J. K. MUELLER Problem 2.5 (Rooted-Triple-Consistency). INSTANCE : A rooted triple formula Φ without disjunction. QUESTION: Is Φ satisfiable? The following NP-complete problem was introduced and studied in an equivalent formulation by Ng, Steel, and Wormald [NSW00]. Problem 2.6 (Subtree-Avoidance-Problem). INSTANCE : A rooted triple formula Φ where each clause is of the form x1 y1 - z1 ∨ · · · ∨ xk yk - zk . (As in Example 2.2, xy - z stands for xz|y ∨ yz|x.) QUESTION: Is Φ satisfiable? Also the following problem is NP-hard; it has been studied in [Bry97]. Problem 2.7 (Forbidden-Triple-Consistency). INSTANCE : A rooted triple formula Φ where each clause is of the form xy - z. QUESTION: Is Φ satisfiable? More generally, if C is a class of triple clauses, the rooted phylogeny problem for clauses from C is the following computational problem. Problem 2.8 (Rooted-Phylogeny for clauses from C). INSTANCE : A rooted triple formula Φ where each clause can be obtained from clauses in C by substitution of variables. QUESTION: Is Φ satisfiable? All of these problems belong to NP. A given solution (T, α) can be verified in polynomial time using the following deterministic algorithm. For each literal of each clause of Φ check whether the literal is satisfied. If there is at least one literal per clause satisfied by (T, α), then the given solution is valid else it is invalid. A literal ab|c is satisfied if α(a), α(b), and α(c) are distinct and if v1 = yca(α(a), α(b)) lies strictly below v2 = yca(α(a), α(c)) (recalling definition 2.3). Determining the youngest common ancestor of two vertices is straightforward using a bottom-up search for each vertex. Another search is then used to check if v1 lies strictly below v2 . Note that the rooted triple consistency problem, the subtree avoidance problem, and the forbidden triple consistency problem are examples of rooted phylogeny problems, by appropriately choosing the class C. For example, for the rooted triple consistency problem we choose C = {xy|z}. The subtree avoidance problem is the rooted phylogeny problem for the class C that contains for each k the clause x1 y1 - z1 ∨ · · · ∨ xk yk - zk . Finally, note that when C contains clauses with literals of the form xx|y, xy|x, or xy|y, then these literals can be removed from the clause since they are unsatisfiable. If all literals in a triple clause are of this form, then the clause is unsatisfiable. It is clear that in instances of the rooted phylogeny problem for clauses from a fixed class C one can efficiently decide whether the input contains such clauses (in which case the input is unsatisfiable). Thus, removing such clauses from C does not affect the complexity of the rooted phylogeny for clauses from C. To prevent dealing with degenerate cases, we therefore make the convention that all clauses in C do not contain literals of the form xx|y, xy|x, or xy|y. THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 5 Constraint Satisfaction Problems. Many phylogeny problems can be viewed as infinite domain constraint satisfaction problems (CSPs), which are defined as follows. Let Γ be a structure1 with a finite relational signature τ . A first-order formula over τ is called primitive positive if it is of the form ∃x1 , . . . , xn . ψ1 ∧ · · · ∧ ψm where ψ1 , . . . , ψm are atomic formulas over τ , i.e., of the form x = y or R(x1 , . . . , xk ) for a k-ary R ∈ τ . Then the constraint satisfaction problem for Γ, denoted by CSP(Γ), is the computational problem to decide whether a given primitive positive sentence (i.e., a primitive positive formula without free variables) is true in Γ. The sentence Φ is also called an instance of CSP(Γ), and the clauses of Φ are also called the constraints of Φ. We cannot give a full introduction to constraint satisfaction and to constraint satisfaction on infinite domains, but point the reader to [BJK05, Bod08]. Here, we only specify an infinite structure ∆ that can be used to describe the rooted triple consistency problem as a constraint satisfaction problem. It will then be straightforward to see that all rooted phylogeny problems for clauses from a finite class C can be formulated as infinite domain CSPs as well. The signature of ∆ is {|} where | is a ternary relation symbol. The domain of ∆ is N → {0, 1}, i.e., the set of all infinite binary strings (hence, the domain of ∆ is uncountable). For two elements f, g of ∆, let lcp(f, g) be the set {1, . . . , n} where n is the largest natural number i such that f (j) = g(j) for all j ∈ {1, . . . , i}; if no such i exists, we set lcp(f, g) := ∅, and if f = g, we set lcp(f, g) := N. The ternary relation f g|h in ∆ holds on elements f, g, h of ∆ if they are pairwise distinct and | lcp(f, g)| > | lcp(f, h)|. The following lemma shows that instances of the rooted triple consistency problem can be viewed as primitive positive formulas over the signature {|}. Proposition 2.9. A rooted triple formula Φ(x1 , . . . , xn ) is satisfiable if and only if the sentence ∃x1 , . . . , xn . Φ(x1 , . . . , xn ) is true in ∆. Proof. Suppose that ∃x1 , . . . , xn . Φ(x1 , . . . , xn ) is true in ∆, and let f1 , . . . , fn : N → {0, 1} be witnesses for x1 , . . . , xn that satisfy Φ in ∆. We define a finite rooted tree T as follows. The vertex set of T consists of the restrictions of fi to lcp(fi , fj ) for all 1 ≤ i, j ≤ n (we do not require i and j to be distinct). Vertex g is above vertex g 0 in T if g 0 extends g; it is clear that this describes T uniquely. Note that f1 , . . . , fn are exactly the leaves of T , and that T is binary. Let α be the map that sends xi to fi . Then (T, α) satisfies Φ. Conversely, let (T, α) be a solution to Φ. For each vertex v of T that is not a leaf, let l(v) and r(v) be the two neighbors of v in T that have larger distance from the root than v. Let h be the length of the path r = p1 , . . . , ph = α(xi ) from the root r to α(xi ) in T . Define fi : N → {0, 1} by setting fi (j) = 0 if pj+1 = l(pj ), 1 ≤ j < h, and fi (j) = 1 otherwise. Clearly, the elements f1 , . . . , fn of ∆ show that ∃x1 , . . . , xn .Φ(x1 , . . . , xn ) is true in ∆. This shows that the rooted triple consistency problem is indeed a constraint satisfaction problem. A refined version of this observation will be useful in Section 3 to apply known techniques for proving Datalog inexpressibility of the rooted triple consistency problem. A triple clause is called trivial if the clause is satisfied by any injective mapping from the variables into the leaves of any rooted tree. The following lemma (Lemma 2.10) shows that the rooted triple consistency problem is among the simplest rooted phylogeny problems, that is, for every class C that contains a non-trivial triple clause the rooted phylogeny problem for C can simulate the rooted triple consistency problem in a simple way. 1We follow standard terminology in logic, see e.g. [Hod93]. 6 M. BODIRSKY AND J. K. MUELLER Lemma 2.10. Let φ(x1 , . . . , xk ) be a non-trivial V triple clause. Then there are variables y11 , . . . , yk1 , . . . , y1l , . . . , ykl ∈ {a, b, c} such that i=1..l φ(y1i , . . . , yki ) is logically equivalent to ab|c. Proof. First observe that if k = 3 and if φ(x1 , x2 , x3 ) contains only one literal then renaming its variables is trivial. Second, if φ(x1 , x2 , x3 ) = x1 x3 |x2 ∨ x2 x3 |x1 , then φ(a, c, b) ∧ φ(b, c, a) is logically equivalent to ab|c. If φ(x1 , x2 , x3 ) contains three or more literals, then due to its non-triviality there can only be at most two distinct literals. Thus, we fall back to one of the already shown cases and the claim follows for all clauses with exactly three variables. If k > 3, then non-triviality of φ implies that φ(x1 , . . . , xk ) can be written as xi1 xi2 |xi3 ∨ φ0 (x1 , . . . , xk ) for distinct variables xi1 , xi2 , xi3 such that φ0 does not imply xi1 xi2 - xi3 , or as xi1 xi2 - xi3 ∨ φ0 (x1 , . . . , xk ) for distinct variables xi1 , xi2 , xi3 such that φ0 does not imply xi1 xi2 |xi3 . In both cases we can falsify all literals in φ0 that contain a variable xi4 distinct from xi1 , xi2 , xi3 by making xi4 equal to some other variable in this literal. The claim then follows from the case k = 3. This implies that the Datalog inexpressibility result for the rooted triple consistency problem we present in the next section applies to all the rooted phylogeny problems for clauses from C that contain a non-trivial clause. 3. Datalog Datalog is an important algorithmic concept originating both in logic programming and in database theory [AHV95, EF99, Imm98]. Feder and Vardi [FV99] observed that Datalog programs can be used to formalize efficient constraint propagation algorithms used in Artificial Intelligence [All83, Mon74, Dec92, Mac77]. Such algorithms have also been studied for the phylogenetic reconstruction problem. Dekker [Dek86] studied rules that infer rooted triples from given sets of rooted triples, and asked whether there exists a set of rules such that a rooted triple can be derived by these rules from a set of rooted triples Φ if and only if it is logically implied by Φ. This question was answered negatively by Bryant and Steel [BS95]. In this section, we show the stronger result that the rooted triple consistency problem cannot be solved by Datalog. This is a considerable strengthening of this previous result by Bryant and Steel, since we can use Datalog programs not only to infer rooted triples that are implied by other rooted triples, but rather might use Datalog rules to infer an arbitrary number of relations (aka IDBs) of arbitrary arity to solve the problem. Moreover, we only require that the Datalog program derives false if and only if the instance is unsatisfiable. In particular, we do not require that the Datalog program derives every rooted triple that is logically implied by the instance (which is required for the question posed by Dekker). Finally, as already announced in the conference version of this paper, we show that the proof technique extends to other constraint formalisms for reasoning about trees. In our proof, we use a pebble-game that was introduced to describe the expressive power of Datalog [KV95] and which was later used to study Datalog as a tool for finite domain constraint satisfaction problems [FV99]. The correspondence between Datalog and pebble games extends to infinite domain constraint satisfaction problems for countably infinite ω-categorical structures. A countably infinite structure is called ω-categorical if its firstorder theory2 has exactly one countable model up to isomorphism. It can be seen (e.g. 2The first-order theory of a structure is the set of first-order sentences that are true in the structure. THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 7 using the theorem of Ryll-Nardzewski, see [Hod93]) that the structure ∆ introduced in Section 2 is, unfortunately, not ω-categorical. However, there are several ways of defining an ω-categorical structure Λ (described also in [Cam90]) which has the same constraint satisfaction problem. We exactly follow the axiomatic approach to define such a structure Λ given in [AN98]. A ternary relation C is said to be a C-relation on a set L if for all a, b, c, d ∈ L the following conditions hold: (C1) C(a; b, c) → C(a; c, b); (C2) C(a; b, c) → ¬C(b; a, c); (C3) C(a; b, c) → C(a; d, c) ∨ C(d; b, c); (C4) a 6= b → C(a; b, b). A C-relation is called dense if it satisfies (C7) C(a; b, c) → ∃e. (C(e; b, c) ∧ C(a; b, e)). The structure (L; C) is also called a C-set. A structure Γ is called k-transitive if for any two k-tuples (a1 , . . . , ak ) and (b1 , . . . , bk ) of distinct elements of Γ there is an automorphism3 of Γ that maps ai to bi for all i ≤ k. A structure Γ is said to be relatively k-transitive if for every partial isomorphism f between induced substructures of Γ of size k there exists an automorphism of Γ that extends f . Note that a relatively 3-transitive C-set is necessarily 2-transitive. Theorem 3.1 (Theorem 14.7 in [AN98]). Let (L; C) be a relatively 3-transitive C-set. Then (L; C) is ω-categorical. Theorem 11.2 and 11.3 in [AN98] show how to construct such a C-relation from a semilinear order 4 that is dense, normal, and branches everywhere (all these concepts are defined in [AN98]). Such a semi-linear order is explicitly constructed in Section 5 of [AN98]. In fact, there is, up to isomorphism, a unique relatively 3-transitive countable C-set which • is uniform with branching number 2, that is, if for all a, b, c ∈ L we have C(a; b, c) ∨ C(b; c, a) ∨ C(c; a, b), • is dense, and • satisfies ¬C(a; a, a) for all a ∈ L. (See the comments in [AN98] after the statement of Theorem 14.7; the condition that ¬C(a; a, a) for all (equivalently, for some) a ∈ L has been forgotten there, but is necessary to obtain uniqueness.) In the following, let Λ be the structure whose domain is the domain of the dense C-set that is uniform with branching number 2; the signature of Λ is not the C-relation, but the relation xy|z defined from the C-relation by xy|z ⇔ C(z; x, y) ∧ x 6= y ∧ y 6= z ∧ x 6= z . Structures that are first-order definable in ω-categorical structures are ω-categorical (Theorem 7.3.8 in [Hod93]), so in particular Λ is ω-categorical. Note that the relation | of Λ satisfies (C1), (C2), (C3), but not (C4). 3An automorphism of a structure Γ is an isomorphism between Γ and itself. 4 A poset is connected if for any two a, b there exists a c such that a ≤ c and b ≤ c, or a ≥ c and b ≥ c. A connected poset is called semi-linear if for every point, the set of all points above it is linearly ordered. 8 M. BODIRSKY AND J. K. MUELLER The following observation has already been made in [Bod08], but without proof, so we provide a proof here. Proposition 3.2. A rooted triple formula Φ(x1 , . . . , xn ) is satisfiable if and only if the sentence ∃x1 , . . . , xn . Φ(x1 , . . . , xn ) is true in Λ. Proof. Suppose that there are a1 , . . . , an such that Φ(a1 , . . . , an ) is true in Λ. We first define a binary relation  on the set of all pairs (a, b) with a, b ∈ {a1 , . . . , an }. We set (a, b)  (c, d) if ¬cd|a ∧ ¬cd|b, and define R := {(u, v) | u  v ∧ v  u}. Lemma 3.3 (Lemma 12.1 in [AN98]). The relation  is a preorder, and hence R is an equivalence relation. Also the following is taken from [AN98]; but to avoid extensive references into the proofs there, we give a self-contained presentation here. We claim that the poset  /R that is induced by  in the natural way on the equivalence classes of R is semi-linear. To see this, let (a1 , a2 ), (b1 , b2 ), (c1 , c2 ) be such that (a1 , a2 )  (b1 , b2 ) and (a1 , a2 )  (c1 , c2 ). We have to show that (b1 , b2 ) and (c1 , c2 ) are comparable in . If (b1 , b2 ) 6 (c1 , c2 ), then c1 c2 |b1 or c1 c2 |b2 . Suppose in the following that c1 c2 |b1 ; the case c1 c2 |b2 is analogous. Since (a1 , a2 )  (c1 , c2 ) we have in particular ¬c1 c2 |a1 in Λ. Recall that the relation | satisfies (C3), which can be equivalently written as ∀a, b, c. (C(a; b, c) ∧ ¬C(d; b, c)) → C(a; d, c), so we find that a1 c1 |b1 . By (C2) we have ¬a1 b1 |c1 . Since (a1 , a2 )  (b1 , b2 ) we have ¬b1 b2 |a1 . Axiom (C3) can also be written as ∀a, b, c. (¬C(a; d, c) ∧ ¬C(d; b, c)) → ¬C(a; b, c), and thus ¬b1 b2 |c1 . Similarly, ¬b1 b2 |c2 . Therefore, (c1 , c2 )  (b1 , b2 ), which is what we had to show. Next, note that when (d1 , d2 ) and (e1 , e2 ) are incomparable with respect to , then (d1 , e1 ) is an upper bound for (d1 , d2 ) and (e1 , e2 ), that is, (d1 , d2 )  (d1 , e1 ) and (e1 , e2 )  (d1 , e1 ). It follows that  /R is indeed a semi-linear order with a smallest element r, and there exists a tree T on the equivalence classes of R such that p lies below q in T if for all (equivalently, for some) (a, b) ∈ p and (c, d) ∈ q we have (c, d)  (a, b). Let α be the map that sends xi to the equivalence class of (ai , ai ); it is straightforward to verify that (T, α) satisfies Φ. Conversely, let (T, α) be a solution to Φ. We now determine elements a1 , . . . , an from Λ, and prove by induction on i that α(xr )α(xs )|α(xt ) in T if and only if ar as |at in Λ, for all r, s, t ≤ i. This is trivial for n = i = 1, and for n = i = 2 we can choose arbitrary distinct elements a1 and a2 from Λ. Now suppose we have already found elements a1 , . . . , ai of Λ, for 2 ≤ i < n, that satisfy the inductive hypothesis. Let v be the vertex in T that has the maximal distance from the root of T such that there is an j ≤ i where both α(xj ) and α(xi+1 ) lie strictly below v. First consider the case that v is the root of T . Then we can choose k, l ∈ {1, . . . , i} such that v = yca(α(xk ), α(xl )). Let a be an element of Λ that is distinct from ak and al , and by the properties of Λ (xy|z is uniform with branching number 2) we have that ak al |a, ak a|al or aak |al holds. In the first case, we set ai+1 to a. In the second case, by relative 3-transitivity of Λ there exists an automorphism β of Λ that maps ak to al and that fixes a. In this case we set ai+1 to β(al ). In the third case we proceed similar to the second. In all three cases we have ap aq |ai+1 for all p, q ≤ i, which proves the inductive step. Next, consider the case that v is not the root of T . In this case, there must be an m ≤ i such that α(xj )α(xi+1 )|α(xm ); choose m such that the distance between the root and yca(α(xj ), α(xm )) is maximal. When j is the only index of size at most i such that α(xj ) lies below v in T , then density of Λ (axiom (C7) in the special case that b = c) THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 9 implies that there is an a such that aj a|am . We can then set ai+1 to a. Otherwise, there are j 0 , j 00 ≤ i such that α(xj 0 )α(xj 00 )|α(xi+1 ); choose j 0 , j 00 such that the distance between v and yca(α(xj 0 ), α(xj 00 )) is minimal. Again we apply density (axiom (C7)) and conclude that there is an a such that aj 0 aj 00 |a and aj 0 a|am . We can then set ai+1 to a. The Existential Pebble Game. The fact that Λ is ω-categorical allows us to use the existential k-pebble game to establish the Datalog lower bound for the rooted triple consistency problem [BD08]. The existential k-pebble game (for a structure Γ) is played by the players Spoiler and Duplicator on an instance Φ of CSP(Γ) and Γ. Each player has k pebbles, p1 , . . . , pk for Spoiler and q1 , . . . , qk for Duplicator; we say that that qi corresponds to pi . Spoiler places his pebbles on the variables of Φ, Duplicator her pebbles on elements of Γ. Initially, none of the pebbles is placed. In each round of the game Spoiler picks some of his pebbles. If some of these pebbles are already placed on Φ, then Spoiler removes them from Φ, and Duplicator responds by removing the corresponding pebbles from Γ. Duplicator looses if at some point of the game • there is a clause R(x1 , . . . , xk ) in Φ such that x1 , . . . , xk are pebbled by pj1 , . . . , pjk , and • the corresponding pebbles qj1 , . . . , qjk of Duplicator are placed on elements b1 , . . . , bk in Γ such that R(b1 , . . . , bk ) does not hold in Γ. Duplicator wins if the game continues forever. We will make use of the following theorem from [BD08]. Theorem 3.4 (Theorem 5 in [BD08]). Let Γ be an ω-categorical (or finite) structure. Then there is no Datalog program that solves CSP(Γ) if and only if for every k there exists an unsatisfiable instance Φk of CSP(Γ) such that Duplicator wins the existential k-pebble game on Φk and Γ. Our Method. The incidence graph G(Φ) of an instance Φ of CSP(Γ) is the (undirected, simple) bipartite graph whose vertex set is the disjoint union of the variables of Φ and the clauses of Φ. An edge joins a variable a and a clause φ of Φ when a appears in φ. A leaf of Φ is a variable that has degree one in G(Φ). An instance has girth k if the shortest cycle of its incidence graph has 2k edges5. Lemma 3.5. Let Γ be an l-transitive (for l ≥ 1) ω-categorical (or finite) structure with relations of arity at most l + 1. Suppose that for every k there exists an unsatisfiable instance Φk of girth at least k where every constraint has an injective satisfying assignment. Then CSP(Γ) cannot be solved by Datalog. We will see examples for l = 1 and for l = 2 in this paper. Note that by 1-transitivity, every unary relation in Γ either denotes the empty set or the full domain of Γ. Since Φk only contains satisfiable constraints, all unary constraints in Φk are satisfied by every mapping to Γ. So we make in the following the assumption that Φk does not contain unary constraints. In the proof we use the following concept, inspired by a Datalog inexpressibility result that was established for temporal reasoning [BK10]. 5If we view instances in the obvious way as structures rather than formulas, our definition of girth corresponds to the standard definition of girth in graph theory. 10 M. BODIRSKY AND J. K. MUELLER r1 r2 T1 a S1 T2 S2 Figure 1: A situation in the proof of Lemma 3.5: Spoiler just pebbled a, Duplicator is next. Definition 3.6. Let Φ be an instance of girth at least k + 1. Then a subset S of at least 2 and at most k variables of Φ is called dominated if GS := G(Φ[S]) is connected (and hence a tree), and if all but at most one of the leaves of GS are pebbled. The notion of dominated sets allows us to specify a winning strategy for Duplicator for the existential k-pebble game. Proof of Lemma 3.5. To apply Theorem 3.4, we have to prove that Duplicator wins the existential k-pebble game on Φk and Γ. Suppose that in the course of the game, u is an unpebbled leaf of a dominated set S with pebbled leaves a1 , . . . , al , and let b1 , . . . , bl be the corresponding responses of Duplicator. Duplicator will play in such a way that b1 , . . . , bl are pairwise distinct. Moreover, Duplicator always maintains the following invariant. Whenever Spoiler places a pebble on al+1 , Duplicator can play a value bl+1 from Γ such that the mapping that assigns ai to bi for 1 ≤ i ≤ l + 1 can be extended to all of S such that this extension is a satisfying assignment for Φk [S]. The invariant is satisfied at the beginning of the game: when spoiler places a pebble on a1 , Duplicator can play any value b1 , which is a legal move by our assumption that Φk does not contain unary constraints. Suppose that during the game Spoiler pebbles a variable a. Let S1 , . . . , Sp be the dominated sets where a is the unpebbled leaf before Spoiler puts his pebble on a. (If there is no such dominated set, then p = 0.) Let T1 , . . . , Tq be the newly created dominated sets after Spoiler put his pebble on a. Note that since each Ti has not been a dominated set before Spoiler put his pebble on a, it must contain one unpebbled leaf distinct from a, which we denote by ri . For an illustration, see Figure 1. We have to show that under the assumption that Duplicator in her previous moves has always maintained the invariant, she will be able to make a move that again fulfills the invariant. If p > 0, then the union S of the sets S1 , . . . , Sp was itself a dominated set already before Spoiler played on a, since GS is clearly connected (all the Si share the vertex a) and no unpebbled leaves can be created by taking a union of dominated sets. The next move of Duplicator is the value b from the invariant applied to S. This preserves the invariant, since for every i ≤ q, the set Ti ∪ S has been a dominated set already before Spoiler played on a: because Ti and S share the vertex a, the graph GS∪Ti is connected, and since a is not THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS Ti 11 ri φ v a C Figure 2: A situation in the proof of Lemma 3.5: extending α to all of Ti . a leaf in GS∪Ti , the only unpebbled leaf of GS∪Ti is ri . Therefore, α can be extended to all of Ti . If p = 0, Duplicator plays an arbitrary element b in Γ. We prove by induction on the size of Ti that α can be extended to Ti such that α(a) = b. We can assume that only leaves in GTi are pebbled (otherwise, since GTi is a tree, the task reduces to proving the statement for proper subsets of Ti ). Consider a clause φ of Φk [Ti ] that contains a, and let V be the variables of φ. This clause must be unique: otherwise, the graph obtained from G(Φk ) by removing the vertex a has at least two components. Only one of those components can contain ri ; the other component must then be a dominated set where all leaves are pebbled, a contradiction to the assumption that p = 0. Now consider the graph H obtained from GTi by removing the vertex that corresponds to φ. See Figure 2. If one of the connected components of H, say C, forms a dominated set, then the unique variable v in C ∩ V (uniqueness again follows from the fact that GTi is a tree) is the unique unpebbled leaf of C, and by the invariant of Duplicator’s strategy α can be extended to α0 that is defined on all of C such that it satisfies Φk [C]. Hence, by removing the pebbles from C and adding a pebble on v, with α0 (v) the corresponding response of Duplicator, we can apply the inductive assumption to Ti \ C ∪ {v} to find an extension of α that is a satisfying assignment for Φk [Ti ] and maps a to b. Otherwise, all variables in V except for the variable that lies in the connected component of ri in H are pebbled. By our assumption on the signature, the clause φ contains at most l pebbled variables (including a). Also by assumption there exists an injective mapping β : V → Γ that satisfies φ. Since Γ is l-transitive, there is an automorphism γ of Γ that maps β(a) to b and that sends β(w) to α(w), for w ∈ Ti \ {v}. Then we extend α to v by α(v) := γ(β(v)); the extension clearly satisfies φ. Now we repeat the argument with v in place of a, and α(v) in place of b, and are done by inductive assumption. Application to the Rooted Phylogeny Problem. We now turn back to the rooted triple consistency problem, CSP(Λ). The structure Λ is 2-transitive and the only relation has arity three, and hence we can apply Lemma 3.5 to prove that CSP(Λ) cannot be solved by Datalog. 12 M. BODIRSKY AND J. K. MUELLER To construct an unsatisfiable girth k instance Φk for CSP(Λ), let G be a cubic graph of girth at least k that has a Hamiltonian cycle. Such a graph exists; see e.g. the comments after the proof of Theorem 3.2 in [Big98]. Note that G must have an even number of vertices. Let H = (v1 , v2 , . . . , vn ) be the Hamilton cycle of G. For any vertex a of G, let r(a) be the vertex that precedes a on H, s(a) the vertex that follows a on H, and t(a) the third remaining neighbor of a in G. We now define Φk . The vertices of G will be the variables of Φk . Then ^ r(a)s(a)|t(a) . Φk := a∈V (G) Consider the graph on the variables of Φk that has an edge ab when Φk contains a triple clause ab|c for some variable c of Φk . This graph is connected, since it actually equals the Hamilton cycle H of G. Hence, a condition due to Aho et al. [ASSU81] implies that Φk is unsatisfiable for all k ≥ 1. This can also be seen by Lemma 4.3 in Section 4. It is clear that every triple clause of Φk has an injective satisfying assignment. So the only remaining condition to apply Lemma 3.5 is the verification that G(Φk ) has girth k. But this is obvious since any cycle of length 2l < 2k in the incidence graph G(Φk ) would give rise to a cycle of length l < k in G, in contradiction to G having girth k. Corollary 3.7. There is no Datalog program that solves the rooted triple consistency problem. Other Applications of the Technique. Our technique to show Datalog inexpressibility can be adapted to show that the following (closely related) problems cannot be solved by Datalog as well. • Satisfiability of branching time constraints [BJ03]; • The network consistency problem of the left-linear-point algebra [Due05, Hir97]; • Cornell’s tree description logic [Cor94, BK07]; All these three problems contain the following computational problem as a special case. Problem 3.8 (Tree-Description-Consistency). INSTANCE : A finite structure (V ; <, ||) where < and || are binary relations. QUESTION: Is there a rooted tree T and α : V → V (T ) such that if x < y then α(y) lies strictly below α(x) in T , and if x||y then neither α(x) lies below α(y) nor α(y) lies below α(x) in T ? To again apply Lemma 3.5, we first have to show that Tree-Description-Consistency can be formulated as a CSP for a transitive ω-categorical structure Ω = (D; <, ||); this has already been observed in [BN06]. This time, it is more convenient to directly construct Ω. The domain D consists of the set of all non-empty finite sequences of rational numbers. 0 ), n ≤ m, we write a < b if one of the following For a = (q1 , q2 , . . . , qn ), b = (q10 , q20 , . . . , qm conditions holds: • a is a proper initial subsequence of b, i.e., n < m and qi = qi0 for 1 ≤ i ≤ n; • qi = qi0 for 1 ≤ i < n, and qn < qn0 . The relation || is the set of all unordered pairs of distinct elements that are incomparable with respect to <. A proof that Ω is indeed 1-transitive and ω-categorical can be found THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 13 in [AN98] (Section 5). Since the signature is binary, we can again apply Lemma 3.5, and have to find unsatisfiable instances of arbitrarily high girth. Here we use the fact that Tree-Description-Consistency can simulate the rooted triple consistency problem by a simple reduction [BK07]. We construct Ψk from Φk by replacing each triple clause of Φk of the form xy|z by the three conjuncts uxyz ||z, uxyz < x, and uxyz < y, where uxyz is a newly introduced variable. It can be shown (see [BK07]) that this transformation preserves (un-)satisfiability, and thus Ψk is unsatisfiable as well. Moreover, the transformation is such that the girth of Ψk is not smaller than the girth of Φk . Finally, it is clear that every conjunct in Ψk has an injective satisfying assignment. Hence, Lemma 3.5 applies, and CSP(Ω) cannot be solved by Datalog. 4. The Algorithm In this section we show that the rooted phylogeny problem can be solved in polynomial time if all clauses come from the following class T , defined as follows. Definition 4.1. A disjunction ψ := x1 y1 |z1 ∨ · · · ∨ xp yp |zp is called tame if it is trivial or if {xi , yi } = {xj , yj } for all 1 ≤ i, j ≤ p. The set of all tame clauses is denoted by T . The algorithm we present in this section builds on previous algorithmic results about the rooted triple consistency problem, most notably [ASSU81, HKW96]. One of the central ideas for the polynomial-time algorithm for the rooted triple consistency problem in [ASSU81] is to associate a certain undirected graph to an instance of the rooted triple consistency problem. We generalize this idea to tame clauses as follows. Definition 4.2. Let Φ be an instance of the rooted triple consistency problem with tame clauses. Then FΦ := (V, E) is the graph where the vertex set V is the set of variables of Φ, and where E contains an edge {x, y} iff Φ contains a clause xy|z1 ∨ · · · ∨ xy|zp for p ≥ 1. The following provides a sufficient (but not a necessary) condition for unsatisfiability of rooted triple formulas with tame clauses. Lemma 4.3. Let Φ be an instance of the rooted phylogeny problem with tame clauses. If FΦ is connected then Φ is unsatisfiable. Proof. Let V be the set of variables in Φ. Suppose that there is a solution (T, α) for Φ. Let r be the yca of α(V ) in T (where α(V ) is the set of all leaves in the image of V under α). It cannot be that all vertices in α(V ) lie below the same child of r in T , since otherwise the child would have been above r = yca(α(V )), which is impossible. Since the graph FΦ is connected, there is an edge {x, y} in FΦ such that α(x) and α(y) lie below different children of r in T . Hence, there are z1 , . . . , zp ∈ V and a clause xy|z1 ∨ · · · ∨ xy|zp in Φ. By assumption, the yca of α(x) and α(y), which is r, lies strictly below the yca of α(x) and α(zi ) for some 1 ≤ i ≤ p, a contradiction to the choice of r. To see that the condition is not necessary consider the following example. Example 4.4. The rooted triple formula Φ = (ab|c ∧ bc|a ∧ ab|d) is unsatisfiable since the first two literals cannot simultaneously be satisfied. But the graph FΦ is disconnected; it has the two components {a, b, c} and {d}. 14 M. BODIRSKY AND J. K. MUELLER Solve(Φ) Input: A rooted triple formula Φ with variables V and clauses from T . Output: ‘yes’ if Φ is satisfiable, ‘no’ otherwise. If Φ is the empty conjunction then return ‘yes’ If FΦ is connected return ‘no’ else Let S be the vertices of a connected component of FΦ If Solve(Φ[S]) is false or Solve(Φ[V \ S]) is false return ‘no’ else return ‘yes’ end if end if Figure 3: The algorithm for the rooted phylogeny problem for tame clauses. Theorem 4.5. The algorithm Solve in Figure 3 determines whether a given instance Φ of the rooted phylogeny problem for tame clauses is satisfiable. When m is the number of triples in all clauses, and n is the number of variables of Φ, then the algorithm can be implemented to run in time O(m log2 n). Proof. If Φ is the empty conjunction, then Φ is clearly satisfiable, and so the answer of the algorithm is correct in this case. The algorithm first computes a connected component S of FΦ (we discuss details of this step in the paragraph about the running time of the algorithm); if S = V , i.e., if FΦ is connected, then Lemma 4.3 implies that Φ is unsatisfiable. Otherwise, we execute the algorithm recursively on Φ[S] and on Φ[V \ S]. If any of these recursive calls reports an inconsistency, then Φ is clearly unsatisfiable as well: since if there was a solution (T, α) to Φ, then (T, α|V ) would be a solution to Φ[V ]. Otherwise, we inductively assume that the algorithm correctly asserts the existence of a solution (T1 , α1 ) of Φ[S] and of a solution (T2 , α2 ) of Φ[V \ S]. Let T be the tree obtained by creating a new vertex r, linking the roots of T1 and T2 below r, and making r the root of T . Let α be the mapping that maps x to αi (x) if x ∈ L(Ti ), for i ∈ {1, 2}. We claim that (T, α) is a solution to Φ, i.e., we have to show that in every clause ψ of Φ at least one literal is satisfied. If ψ = (xy|z1 ∨ · · · ∨ xy|zp ), then x and y are in the same subtree Ti of T , since they are connected by an edge in FΦ . If all variables of ψ lie completely inside S or completely inside V \ S, we are done by inductive assumption, because (T1 , α1 ) is a solution for Φ[S] and (T2 , α2 ) is a solution for Φ[V \ S]. Otherwise, there must be a j, 1 ≤ j ≤ p, such that zj lies in a different component than x and y. But in this case the yca of α(x) and α(y) lies strictly below r, which is the yca of α(x) and α(zj ). Hence, the literal xy|zj in ψ is satisfied. This concludes the correctness proof of the algorithm shown in Figure 3. We still have to show how this procedure can be implemented such that the running time is in O(m log2 n). There are amortized sub linear algorithms for testing connectivity in undirected graphs while removing the edges of the graph. This was used to speedup the algorithm for the rooted triple consistency problem [HKW96]. At present, the fastest known algorithm for this purpose appears to be the deterministic decremental graph connectivity algorithm of Holm, de Lichtenberg, and Thorup [THdL98], which has a query THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 15 time in O(log n/ log log n), and an update time in O(log2 n). We can use the same approach as in [HKW96] and obtain an O(m log2 n) bound for the worst-case running time of our algorithm. 5. Complexity Classification This section is devoted to the proof of the following result. Theorem 5.1. Let C be a set of rooted triple clauses that contains clauses that are not tame (Definition 4.1). Then the rooted phylogeny problem for clauses from C is NP-complete. Our proof of Theorem 5.1 consists of two parts. In the first part, we show that if C is not a subset of T , then a certain Boolean split problem associated to C (defined below) is NP-hard. In the second part we show that this Boolean split problem reduces to the rooted phylogeny problem for C. Definition 5.2 (split formula for Φ). Let Φ be a rooted triple formula. Then the split formula for Φ is the Boolean formula obtained from Φ by replacing each literal xy|z by (x ↔ y) ∧ (z ∨ ¬z). The purpose of the tautological second conjunct z ∨ z is to introduce the variable z, which would otherwise not appear in the formula; this becomes relevant in the following. If C is a class of triple clauses, we define B(C) to be the set of split formulas for the clauses from C. A solution to a propositional formula is called surjective if at least one variable is set to true and at least one variable is set to false. The split problem for a set of Boolean formulas B is the problem to decide whether a given conjunction of formulas obtained from formulas in B by variable substitution has a surjective solution. We will show that if C is a class of triple clauses that is not a subclass of T , then there exists a finite subset C 0 of C such that the split problem for B(C 0 ) is NP-complete. In the proof of this statement we use the following result, which follows from Theorem 6.12 in [CKS01], and is due to [CH97]. The notion of Horn, dual Horn, affine, and bijunctive Boolean formulas are standard and introduced in detail in [CKS01]. Bijunctive formulas are also known as 2-CNF formulas. Theorem 5.3 (of [CH97]). Let B be a set of Boolean formulas. Then the split problem for B is in P if all formulas in B are from one of the following types: Horn, dual Horn, affine, bijunctive. In all other cases, B contains a finite subset B 0 such that the split problem for B 0 is NP-complete. We say that a Boolean formula ψ is preserved by an operation f : {0, 1}k → {0, 1} if for all satisfying assignments α1 , . . . , αk of ψ the mapping defined by x 7→ f (α1 (x), . . . , αk (x)) is also a satisfying assignment for ψ. Proposition 5.4. If C is not a subclass of T , then B(C) is neither Horn, dual Horn, affine, nor bijunctive. Proof. Let φ be a clause from C \ T . By construction the split formula ψ for φ is preserved by x 7→ ¬x and is also preserved by constant operations. Moreover, it is known (and follows from [Pos41]) that every Boolean formula that is preserved by ¬, contains the constants, and is either Horn, dual Horn, affine, or bijunctive must also be preserved by the operation 16 M. BODIRSKY AND J. K. MUELLER xor defined as (x, y) 7→ (x + y mod 2). So it suffices to show that ψ cannot be preserved by xor. Because φ is not from T and in particular non-trivial, there is a tree T and an injective mapping from the variables V of φ to the leaves of T such that (T, α) is not a solution to φ. Moreover, since the clause φ is not tame, it must contain triples ab|c and uv|z where {a, b} = 6 {u, v}. Consider the assignment β that maps x ∈ V to 0 if α(x) is below the first child of the yca of α(V ) in T , and that maps x to 1 otherwise (which child is selected as the first child is not important in the proof). By construction, the assignment β does not satisfy the split formula for ψ, since φ is not satisfied by (T, α). Observe that the assignment β1 that is obtained from β by negating the value assigned to a is a satisfying assignment for ψ, since it satisfies the disjunct ((a ↔ b) ∧ (c ∨ ¬c)) of ψ. The assignment β2 that is constant 0 except for the variable a which is assigned 1 is also a satisfying assignment for ψ, because ψ satisfies ((u ↔ v) ∧ (w ∨ ¬w)). But since xor(β1 (x), β2 (x)) equals β(x) for all x ∈ V , this shows that ψ is not preserved by xor, which is what we wanted to show. We now turn to the second part of the proof of Theorem 5.1. The idea to reduce the split problem for B(C) to the rooted phylogeny problem for clauses from C is to construct instances Φ of the phylogeny problem for C in such a way that Φ is satisfiable if and only if B(Φ) has a surjective solution. To implement this idea, we construct an instance of the phylogeny problem Φ that fragments into simple and satisfiable pieces if B(Φ) has a surjective solution. Proposition 5.5. Let C be a finite class of triple clauses. Then the split problem for B(C) can be reduced in polynomial time to the rooted phylogeny problem for clauses from C. Proof. Note that the split formula for a trivial clause is a tautological Boolean formula. Hence, if all clauses in C are trivial, then the split problem for B(C) is clearly in P and there is nothing to show. Otherwise, we can assume that C contains the clause that just consists of ab|c since this clause can be simulated by non-trivial clauses from C by appropriately equating variables (Lemma 2.10). Suppose we are given an instance of the split problem for B(C) with clauses ψ1 , . . . , ψm and variables V = {x0 , . . . , xn−1 }. We create an instance Φ of the rooted phylogeny problem for C as follows. The variables U of Φ are triples (x, i, j) where x ∈ V , i ∈ {0, . . . , m − 1}, and j ∈ {1, . . . , n − 1}. In the following, all indices of variables from V are modulo n. Moreover, if m > 1 we will also write (x, i, n) for (x, i + 1, 1) for all i ∈ {0, . . . , m − 2}. The clauses of Φ consist of two groups, Φ1 and Φ2 . • To define the first group Φ1 of clauses, suppose that ψi has variables y1 , . . . , yq . Let φi (y1 , . . . , yq ) be the triple clause that defines the Boolean relation from B(C) used in ψi (y1 , . . . , yq ). By the assumption that C and B(C) are finite it is clear that φi can be computed efficiently (in constant time). We then add the clause φi ((y1 , i, 1), . . . , (yq , i, 1)) to Φ1 . • The second group Φ2 of clauses has for all xs ∈ V , i ∈ {0, . . . , m − 2} (if m = 1 the second group of clauses is empty), and j ∈ {1, . . . , n − 1} the clause (xs , i, j)(xs , i, j + 1)|(xs+j , i, 1) . Note that Φ2 only consists of rooted triples, and therefore FΦ2 is defined, and consists of exactly n paths of length (n − 1)(m − 1). We claim that Φ is satisfiable if and only if ψ1 ∧ · · · ∧ ψm has a surjective solution. First suppose that Φ has a solution (T, α). Then the variables U of Φ can be partitioned into the THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 17 variables that are mapped via α below the left child of yca(α(U )), and the ones mapped below the right child. Note that both parts of the partition are non-empty. Variables (x, i, j) of U that share the first coordinate are in the same part of the partition due to the clauses in Φ in the second group. Hence, the mapping that sends x ∈ V to 0 if (x, i, j) is mapped to the first part, and that sends x to 1 otherwise is well-defined, and a surjective assignment. It also satisfies all clauses ψ1 , . . . , ψm , because of the first group of clauses in Φ. Conversely, suppose that there is a surjective solution s for ψ1 ∧ · · · ∧ ψm . Let S be the subset of the variables V of Φ assigned to 0 by s, and consider the instances Φl := Φ[S] and Φr := Φ[V \ S]. Since the assignment is surjective, there is a variable xp ∈ V that is mapped to 1 and a variable xq ∈ V that is mapped to 0. Hence, for all i ∈ {0, . . . , m − 1} the clauses (xp , i, q − p)(xp , i, q − p + 1)|(xq , i, 1) from the second group are neither in Φl nor in Φr , because they contain variables from both parts of the partition. Therefore, any clause from the first group in Φl will be disconnected in the incidence graph G(Φl ) from any other clause in the first group in Φl . Since each clause from the first group is satisfiable, it is easy to see that Φl has a solution (Tl , αl ). The same statements holds for Φr ; let (Tr , αr ) be a solution for Φr . Let T be the rooted tree obtained from Tl and Tr by creating a new vertex t, linking the roots of Tl and Tr below t, and making t the root of T . Let α be the common extension of αl and αr to all of U . Then (T, α) is clearly a solution to Φ. Both groups of clauses together consist of m + n(n − 1)(m − 1) many clauses, and it is easy to see that the reduction can be implemented in polynomial time. We conclude this section with a combination of the results above. Proof of Theorem 5.1. As mentioned, the rooted phylogeny problem for C is clearly in NP. Let C be a class of triple clauses that is not a subset of T . We prove NP-hardness as follows. By Proposition 5.4, B(C) is neither Horn, dual Horn, affine, nor bijunctive. Theorem 5.3 asserts that there exists a finite subset B of B(C) such that the split problem for B is NPhard. This means that there is a subset C 0 of C such that the split problem for B(C 0 ) is NP-hard. Proposition 5.5 shows that the rooted phylogeny problem for clauses from C 0 (and hence also for clauses from C) is NP-hard as well. 6. Concluding Remarks We have shown that consistency of rooted phylogeny data can be decided in polynomial time when the data consists of tame disjunctions of rooted triples. Our algorithm extends previous algorithmic results about the rooted triple consistency problem, without sacrificing worst-case efficiency. The class T of tame triple clauses that can be handled efficiently is also motivated by another result of this paper, which states that any set of triple clauses that is not contained in T has an NP-complete rooted phylogeny problem. Here we use known results about the complexity of surjective Boolean constraint satisfaction problems. We also show that no Datalog program can solve the rooted triple consistency problem, using a pebble game that captures the expressive power of Datalog for constraint satisfaction problems with infinite ω-categorical structures. In fact, our result follows from a more general result that also applies to many constraint satisfaction problems outside of phylogenetic reconstruction. We show that a constraint satisfaction problem for a structure with a large automorphism group cannot be solved by Datalog if, roughly, for all k there exists a unsatisfiable instance of girth at least k. 18 M. BODIRSKY AND J. K. MUELLER The class of phylogeny problems studied in this paper has a natural generalization to a larger class of computational problems, namely problems of the form CSP(Γ) where Γ has a first-order definition in Λ, the ω-categorical relatively 3-transitive C-set introduced in Section 3. This class contains several additional problems that have been studied in phylogenetic reconstruction, for instance the quartet consistency problem [Ste92]. The larger class also contains new problems that can be solved in polynomial time, and where the split problem consists in finding surjective solutions to Boolean linear equation systems. A complexity classification for this larger class of computational problems remains open and is left for future research. Acknowledgement We would like to thank the reviewers for their helpful comments. References [AHV95] S. Abiteboul, R. Hull, and V. Vianu. Foundations of Databases. Addison Wesley, 1995. [All83] J. F. Allen. Maintaining knowledge about temporal intervals. Communications of the ACM, 26(11):832–843, 1983. [AN98] Samson Adepoju Adeleke and Peter M. Neumann. Relations related to betweenness: their structure and automorphisms, volume 623 of Memoirs of the AMS 131. American Mathematical Society, 1998. [ASSU81] A.V. Aho, Y. Sagiv, T.G. Szymanski, and J.D. Ullman. Inferring a tree from lowest common ancestors with an application to the optimization of relational expressions. SIAM Journal on Computing, 10(3):405–421, 1981. [ASY91] F. Afrati, S.S.Comadakis, and M. Yannakakis. On Datalog vs. polynomial time. In 21st ACM SIGACT-SIGMOD-SIGART Symp. on Principles of Database Systems, pages 113–126, 1991. [BD08] Manuel Bodirsky and Vı́ctor Dalmau. Datalog and constraint satisfaction with infinite templates. An extended abstract appeared in the proceedings of STACS’06. The full version is available online at arXiv:0809.2386 [cs.LO], 2008. [Big98] Norman Biggs. Constructions for cubic graphs with large girth. Electronic Journal of Combinatorics, 5, 1998. [BJ03] Mathias Broxvall and Peter Jonsson. Point algebras for temporal reasoning: Algorithms and complexity. Artificial Intelligence, 149(2):179–220, 2003. [BJK05] A. Bulatov, P. Jeavons, and A. Krokhin. The complexity of constraint satisfaction: An algebraic approach (a survey paper). In: Structural Theory of Automata, Semigroups and Universal Algebra (Montreal, 2003), NATO Science Series II: Mathematics, Physics, Chemistry, 207:181–213, 2005. [BK07] Manuel Bodirsky and Martin Kutz. Determining the consistency of partial tree descriptions. Artificial Intelligence, 171:185–196, 2007. [BK10] Manuel Bodirsky and Jan Kára. A fast algorithm and Datalog inexpressibility for temporal reasoning. ACM Transactions on Computational Logic, 11(3), 2010. [BN06] Manuel Bodirsky and Jaroslav Nešetřil. Constraint satisfaction with countable homogeneous templates. Journal of Logic and Computation, 16(3):359–373, 2006. [Bod08] Manuel Bodirsky. Constraint satisfaction problems with infinite templates. In Heribert Vollmer, editor, Complexity of Constraints (a collection of survey articles), pages 196–228. Springer, LNCS 5250, 2008. [Bry97] David Bryant. Building trees, hunting for trees, and comparing trees. PhD-thesis at the University of Canterbury, 1997. [BS95] D. Bryant and M. Steel. Extension operations on sets of leaf-labelled trees. Advances in Applied Mathematics, 16:425–453, 1995. [Cam90] Peter J. Cameron. Oligomorphic Permutation Groups. Cambridge University Press, Cambridge, 1990. THE COMPLEXITY OF ROOTED PHYLOGENY PROBLEMS 19 [CH97] Nadia Creignou and Jean-Jacques Hébrard. On generating all solutions of generalized satisfiability problems. Informatique Thèorique et Applications, 31(6):499–511, 1997. [CKS01] Nadia Creignou, Sanjeev Khanna, and Madhu Sudan. Complexity Classifications of Boolean Constraint Satisfaction Problems. SIAM Monographs on Discrete Mathematics and Applications 7, 2001. [Cor94] Thomas Cornell. On determining the consistency of partial descriptions of trees. In Proceedings of the ACL, pages 163–170, 1994. [Dec92] Rina Dechter. From local to global consistency. Artificial Intelligence, 55(1):87–108, 1992. [Dek86] M. C. H. Dekker. Reconstruction methods for derivation trees. Masters thesis, Vrije Universiteit, Amsterdam, 1986. [Due05] Ivo Duentsch. Relation algebras and their application in temporal and spatial reasoning. Artificial Intelligence Review, 23:315–357, 2005. [EF99] H.-D. Ebbinghaus and J. Flum. Finite Model Theory. Springer, Berlin, Heidelberg, New York, 1999. 2nd edition. [FV99] Tomás Feder and Moshe Vardi. The computational structure of monotone monadic SNP and constraint satisfaction: A study through Datalog and group theory. SIAM Journal on Computing, 28:57–104, 1999. [Gro94] Martin Grohe. The structure of fixed-point logics. PhD-thesis at the Albert-Ludwigs Universität, Freiburg i. Br., 1994. [Hir97] R. Hirsch. Expressive power and complexity in algebraic logic. Journal of Logic and Computation, 7(3):309 – 351, 1997. [HKW96] Monika Henzinger, Valerie King, and Tandy Warnow. Constructing a tree from homeomorphic subtrees, with applications to computational evolutionary biology. In Proceedings of the 7th Symposium on Discrete Algorithms (SODA’96), pages 333–340, 1996. [Hod93] Wilfrid Hodges. Model theory. Cambridge University Press, 1993. [Imm98] N. Immerman. Descriptive Complexity. Graduate Texts in Computer Science, Springer, 1998. [KV95] Phokion G. Kolaitis and Moshe Y. Vardi. On the expressive power of Datalog: Tools and a case study. Journal of Computer and System Sciences, 51(1):110–134, 1995. [KV98] Phokion G. Kolaitis and Moshe Y. Vardi. Conjunctive-query containment and constraint satisfaction. In Proceedings of PODS, pages 205–213, 1998. [Mac77] A. K. Mackworth. Consistency in networks of relations. Artificial Intelligence, 8:99–118, 1977. [Mon74] Ugo Montanari. Networks of constraints: Fundamental properties and applications to picture processing. Information Sciences, 7:95–132, 1974. [NSW00] Meei Pyng Ng, Mike Steel, and Nicholas C. Wormald. The difficulty of constructing a leaf-labelled tree including or avoiding given subtrees. Discrete Applied Mathematics, 98:227–235, 2000. [Pos41] Emil L. Post. The two-valued iterative systems of mathematical logic. Annals of Mathematics studies, 5, 1941. [Ste92] Michael Steel. The complexity of reconstructing trees from qualitative charaters and subtrees. Journal of Classification, 9:91–116, 1992. [THdL98] Mikkel Thorup, Jacob Holm, and Kristian de Lichtenberg. Poly-logarithmic deterministic fullydynamic graph algorithms I: connectivity and minimum spanning tree. Technical report, Department of Computer Science, University of Copenhagen, 1998. This work is licensed under the Creative Commons Attribution-NoDerivs License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.0/ or send a letter to Creative Commons, 171 Second St, Suite 300, San Francisco, CA 94105, USA, or Eisenacher Strasse 2, 10777 Berlin, Germany
5cs.CE
Learning to Explore with Meta-Policy Gradient Tianbing Xu 1 Qiang Liu 2 Liang Zhao 1 Jian Peng 3 arXiv:1803.05044v2 [cs.LG] 26 Mar 2018 Abstract The performance of off-policy learning, including deep Q-learning and deep deterministic policy gradient (DDPG), critically depends on the choice of the exploration policy. Existing exploration methods are mostly based on adding noise to the on-going actor policy and can only explore local regions close to what the actor policy dictates. In this work, we develop a simple meta-policy gradient algorithm that allows us to adaptively learn the exploration policy in DDPG. Our algorithm allows us to train flexible exploration behaviors that are independent of the actor policy, yielding a global exploration that significantly speeds up the learning process. With an extensive study, we show that our method significantly improves the sample-efficiency of DDPG on a variety of reinforcement learning tasks. 1. Introduction Recent advances in deep reinforcement learning (RL) have demonstrated significant applicability and strong performance in games (Mnih et al., 2015; Silver et al., 2017), continuous control (Lillicrap et al., 2016), and robotics (Levine et al., 2016). Among them, deep neural networks, such as convolutional neural networks, are widely used as powerful functional approximators for extracting useful features and enabling complex decision making. For instance, in continuous control tasks, a policy that selects actions under certain state observation can be parameterized by a deep neural network that takes the current state observation as input and gives an action or a distribution of action as output. In order to optimize such policies, various policy gradient methods (Heess et al., 2017; Mnih et al., 2016; Schulman et al., 2015; 2017), including both off-policy and on-policy approaches, have been proposed. In particular, deterministic policy gradient method (DPG), which extends the discrete Q-learning algorithm for the continuous action spaces, exploits previous experience or off-policy data from a replay buffer and 1 Baidu Research, Sunnyvale, CA, USA 2 University of Texas at Austin, USA 3 University of Illinois at Urbana-Champaign, USA. often achieves more desirable sample efficiency compared to most existing on-policy policy gradient algorithms. In the recent NIPS 2017 learning to run challenge, the deep deterministic policy gradient algorithm (DDPG) (Lillicrap et al., 2016), a variant of DPG, has been applied by almost all top-ranked teams and achieved a very compelling success in a high-dimensional continuous control problem, while onpolicy algorithms, including TRPO (Schulman et al., 2015) and PPO (Schulman et al., 2017), performed much worse with the same amount of data collected. In contrast to deep Q-learning (DQN) (Mnih et al., 2015) which only learns a value function on a set of discrete actions, DDPG also parameterizes a deterministic policy to select a continuous action, thus avoiding the optimization in or the discretization of the continuous action space. As an off-policy actor-critic method, DDPG utilizes Bellman equation updates for the value function and the policy gradient descent to directly optimize the actor policy. Unlike DQN which often applies epsilon-greedy exploration on a set of discrete actions, more sophisticated continuous exploration in the high-dimensional continuous action space is required for DDPG. A common practice of exploration in DDPG is to add a uncorrelated Gaussian or a correlated Ornstein-Uhlenbeck (OU) process (Uhlenbeck & Ornstein, 1993) to the action selected by the deterministic policy. The data collected by this exploration method is then added to a replay buffer used for DDPG training. However, in practice, Gaussian noises may be sub-optimal or misspecified, and hyper-parameters in the noise process are hard to tune. In this work, we introduce a meta-learning algorithm to directly learn an exploration policy to collect better experience data for DDPG training. Instead of using additive noises on actions, we parameterize a stochastic policy to generate data to construct the replay buffer for training the deterministic policy in the DDPG algorithm. This stochastic policy can be seen as an exploration policy or a teacher policy that gathers high-quality trajectories that enable better training of the current deterministic policy and the value function. To learn the exploration policy, we develop an on-policy policy gradient algorithm based on the training improvement of the deterministic policy. First, we obtain a collection of exploration data from the stochastic policy and then apply DDPG on this data-set to make updates of the value function and the deterministic policy. We then evaluate the updated Learning to Explore with Meta-Policy Gradient deterministic policy and compute the improvement of these updates based on the data just collected by comparing to the previous policy. Therefore, the policy gradient of the stochastic policy can be computed using the deterministic policy improvement as the reward signal. This algorithm adaptively adjusts the exploration policy to generate effective training data for training the deterministic policy. We have performed extensive experiments on several classic control and Mujoco tasks, including Hopper, Reacher, HalfCheetah, Inverted Pendulum, Inverted Double Pendulum and Pendulum. Compared to the default DDPG in OpenAI’s baseline (Plappert et al., 2017), our algorithm demonstrated substantial improvements in terms of sample efficiency. We also compared the default Gaussian exploration and the learned exploration policy and found that the exploration policy tends to visit novel states that are potentially beneficial for training the target deterministic policy. 2. Related Work The idea of meta learning has been widely explored in different areas of machine learning, under different names, such as meta reinforcement learning, life-long learning, learning to learn, and continual learning. Some of the recent work in the setting of reinforcement learning includes (Duan et al., 2016; Finn et al., 2017; Wang et al., 2016), to name a few. Our work is related to the idea of learning to learn but instead of learning the optimization hyperparameters we hope to generate high quality data to better train reinforcement agents. Intrinsic rewards such as prediction gain (Bellemare et al., 2016), learning progress (Oudeyer & Kaplan, 2007), compression progress (Schmidhuber, 2010), variational information maximization (Houthooft et al., 2016; Todd & Peter, 2017), have been employed to augment the environment’s reward signal for encouraging to discover novel behavior patterns. One of limitations of these methods is that the intrinsic reward weighting relative to the environment reward must be chosen manually, rather than learned on the fly from interaction with the environment. Another limitation is that the reshaped reward might not guarantee the learned policy to be the same optimal one as that learned from environment rewards only (Ng et al., 1999). The problem of exploration has been widely used in the literature. Beyond the traditional studies based on epsilongreedy and Boltzmann exploration, there are several recent advances in the setting of deep reinforcement learning. For example, (Tang et al., 2017) studied count-based exploration for deep reinforcement learning; (Stadie et al., 2015) proposed a new exploration method based on assigning exploration bonuses from a concurrently learned transition model; (Hester et al., 2013) studied a bandit-based algorithm for learning simple exploration strategies in model-based set- tings; (Osband et al., 2016a) used a bootstrapped approach for exploration in DQN, a simple algorithm in a computationally and statistically efficient manner through the use of randomized value functions (Osband et al., 2016b). 3. Reinforcement learning In this section, we introduce the background of reinforcement learning. We start with introducing Q-learning in Section 3.1, and then deep deterministic policy gradient (DDPG) which works for continuous action spaces in Section 3.2. 3.1. Q-learning Considering the standard reinforcement learning setting, an agent takes a sequence of actions in an environment in discrete time and collects a scalar reward per timestep. The objective of reinforcement learning is to learn a policy of the agent to optimize the cumulative reward over future time. More precisely, we consider an agent act over time t ∈ {1, . . . , T }. At time t, the agent observes an environment state st and selects an action at ∈ A to take according to a policy. The policy can be either a deterministic function a = µ(s), or more generally a conditional probability π(a|s). The agent will then observe a new state st+1 and receive a scalar reward value rt ∈ R. The set A of possible actions can be discrete, continuous or mixed in different tasks. Given a trajectory {st , at , rt }Tt=1 , the overall reward is defined as a discounted sum of incremental PT rewards, R = t=1 γ t rt , where γ ∈ [0, 1) is a discount factor. The goal of RL is to find the optimal policy to maximize the expected reward. Q-learning (Watkins, 1989; Watkins & Dayan, 1992) is a well-established method that has been widely used. Generally, Q-learning algorithms compute an action-value function, often also referred to as Q-function, Q∗ (s, a), which is the expected reward of taking a given action a in a given state s, and following an optimal policy thereafter. The estimated future reward is computed based on the current state s or a series of past states st if available. The core idea of Q-learning is the use of the Bellman equation as a characterization of the optimal future reward function Q∗ via a state-action-value function Q∗ (st , a) = E[rt + γ max Q∗ (st+1 , a0 )], 0 a (1) where the expectation is taken w.r.t the distribution of state st+1 and reward rt obtained after taking action a. Given the optimal Q-function, the optimal policy greedily selects the actions with the best Q-function values. Deep Q-learning (DQN), a recent variant of Q-learning, uses deep neural networks as Q-function to automatically extract intermediate features from the state observations and shows good Learning to Explore with Meta-Policy Gradient performance on various complex high-dimensional tasks. Since Q-learning is off-policy, a particular technique called “experience replay” (Lin, 1992; Wawrzyski, 2009) that stores past observations from previous trajectories for training has become a standard step in deep Q-learning. Experience replays are stored as a dataset, also known as replay buffer, B = {(sj , aj , rj , sj+1 )} which contains a set of previously observed state-action-reward-future state-tuples (sj , aj , rj , sj+1 ). Such experience replays are often constructed by pooling such tuples generated by recent policies. With the replay buffer D, Deep Q learning follows the following iterative procedure (Mnih et al., 2013; 2015): start an episode in the initial state s0 ; sample a mini-batch of tuples M = {(sj , aj , rj , sj+1 )} ⊆ B; compute and fix the targets yj = rj + γ maxa Qθ− (sj+1 , a) for each tuple using a recent estimate Qθ− (the maximization is only considered if sj is not a terminal state); update the Q-function by optimizing the following program w.r.t the parameters θ typically via stochastic gradient descent: X 2 min (Qθ (sj , aj ) − yj ) . (2) θ (sj ,aj ,rj ,sj+1 )∈M Besides updating the parameters of the Q-function, each step of Q-learning needs to gather additional data to augment the replay buffer. This is done by performing an action simulation either by choosing an action at random with a small probability  or by following the strategy arg maxa Qθ (st , a) which is currently estimated. This strategy is also called the -greedy policy which is applied to encourage visiting unseen states for better exploration and avoid the training stuck at some local minima. We subsequently obtain the reward rt . Subsequently we augment the replay buffer B with the new tuple (st , at , rt , st+1 ) and continue until this episode terminates or reaches an upper bound of timesteps, and then we restart a new episode. When optimizing w.r.t the parameter θ, a recent Q-network is used to compute the target yj = rj + γ maxa Qθ− (sj+1 , a). Q(s, a). so that a = µ(s, θπ ) can be viewed as an approximate action-argmax operator of the Q-function, and we do not have to perform the action maximization in the high-dimensional continuous space. In training, the critic Qθ (s, a) is updated using the Bellman equation as in Qlearning that we introduced above, and the actor is updated to maximize the expected reward w.r.t. Qθ (s, a),  max J(θπ ) := Es∼B [Qθ (s, µ(s, θπ ))] , π θ where s ∼ B denotes sampling s from the replay buffer B. This is achieved in DDPG using gradient descent: θπ ← θπ + η∇θπ J(θπ ), where ∇θπ J(θπ ) = ∇θπ Es∼B [∇a Qθ (s, µ(s, θπ ))∇θπ µ(s)]. In DDPG, the actor µ(s, θπ ) and the critic Qθ (s, a) are updated alternatively until convergence. As in Q-learning, the performance of DDPG critically depends on a proper choice of exploration policy πe , which controls what data to add at each iteration. However, in highdimensional continuous action space, exploration is highly nontrivial. In the current practice of DDPG, the exploration policy πe is often constructed heuristically by adding certain type of noise to the actor policy to encourage stochastic exploration. A common practice is to add an uncorrelated Gaussian or a correlated Ornstein-Uhlenbeck (OU) process (Uhlenbeck & Ornstein, 1993) to the action selected by the deterministic actor policy, that is, a = µ(s, θπ ) + N (0, σ 2 ). Since DDPG is off-policy, the exploration can be independently addressed from the learning. It is still unclear whether these exploration strategies can always lead to desirable learning of the deterministic actor policy. 3.2. Deep Deterministic Policy Gradient 4. Learning to Explore For continuous action spaces, it is practically impossible to directly apply Q-learning, because the max operator in the Bellman equation, which find the optimal a, is usually infeasible, unless discretization is used or some special forms of Q-function are used. Deep deterministic policy gradient (DDPG) Lillicrap et al. (2016) addresses this issue by training a parametric policy network together with the Q-function using policy gradient descent. We expect to construct better exploration strategies that are potentially better than the default Gaussian or OU exploration. In practice, e.g., in the Mujuco control tasks, the action spaces are bounded by a high-dimensional continuous cube [−1, 1]d . Therefore, it is very possible that the Gaussian assumption of the exploration noises is not suitable when the action selected by the actor policy is close to the corner or boundaries of this cube. Furthermore it is also possible that the actor policy gets stuck in a local basin in the state space and thus cannot escape even with random Gaussian noises added. Specifically, DDPG maintains a deterministic actor policy π = δ(a − µ(s, θπ )) where µ(s, θπ ) is a parametric function, such as a neural network, that maps the state to actor. We want to iteratively update θπ , such that a = µ(s, θπ ) gives the optimal action that maximizes the Q-function All existing exploration strategies seem to be based on the implicit assumption that the exploration policy πe should Learning to Explore with Meta-Policy Gradient Algorithm 1 Teacher: Learn to Explore Initialize πe and π. Draw D1 from π to estimate the reward R̂π of π. Initialize the Replay Buffer B = D1 . for iteration t do Generate D0 by executing teacher’s policy πe . Update actor policy π to π 0 using DDPG based on D0 : π 0 ← DDPG(π, D0 ). Generate D1 from π 0 and estimate the reward of π 0 . 7: Calculate the meta reward: R̂(D0 ) = R̂π0 − R̂π . 8: Update Teacher’s Policy πe with meta policy gradient 1: 2: 3: 4: 5: 6: θ πe ←θ πe + η∇θπe log P(D0 |πe )R̂(D0 ) Add S bothSD0 and D1 into the Replay Buffer B ← B D0 D1 . 10: Update π using DDPG based on Replay Buffer, that is, π ← DDPG(π, B). Compute the new R̂π . 11: end for 9: stay close to the actor policy π, but with some more stochastic noise. However, this assumption may not be true. Instead, it may be beneficial to make πe significantly different from the actor π in order to explore the space that has not been explored previously. Even in the case of using Gaussian noise for exploration, the magnitude of the Gaussian noise is also a critical parameter that may influence the performance significantly. Therefore, it is of great importance to develop a systematic approach to adaptively learn the exploration strategy, instead of using simple heuristics. Since DDPG is an off-policy learning algorithm and the exploration is independent from the learning, we can decouple the exploration policy with the actor policy. We hope to construct an exploration policy which generates novel experience replays that are more beneficial for training the actor policy. To do so, we introduce a meta-reinforcement learning approach to learn an exploration policy so that it most efficiently improves the training of the actor policy. ward function R : S × A → R could be defined as Policy Evaluator to specify the exploitation agent’s performance. Furthermore, we define meta-reward R(D0 ) = Rπ0 − Rπ to measure the student’s performance improvement. To produce a reward, for example, we can make a state transition (π, D0 ) → π 0 with transition function DDPG, and get the Monte Carlo estimation of the reward R based on the rollouts D1 generated by executing the look-ahead policy π 0 . For more details, please refer to Algorithm 1. 4.2. Learning Exploration Policy with Policy Gradient Our framework can be best viewed as a teacher-student learning framework, where the exploration policy πe , viewed as the teacher, generates a set of data D0 at each iteration, and feeds it into a DDPG agent with an actor policy π (the student) who learns from the data and improves itself. Our goal is to adaptively improve the teacher πe so that it generates the most informative data to make the DDPG learner improve as fast as possible. In this meta framework, the generation of data D0 can be viewed as the “action” taken by the teacher πe , and its related reward should be defined as the improvement of the DDPG learner using this data D0 , J (πe ) = ED0 ∼πe [R(D0 )] = ED0 ∼πe [RDDPG(π,D0 ) − Rπ ], where π 0 = DDPG(π, D0 ) denotes a new policy obtained from one or a few steps of DDPG updates from π based on data D0 ; RDDPG(π,D0 ) and Rπ are the actual cumulative reward of rollouts generated by policies π 0 = DDPG(π, D0 ) and π, respectively, in the original RL problem. Here we use R(D0 ) to denote the “meta” reward of data D0 in terms of how much it helps the progress of learning the agent. Similar to the actor policy, we can parameterize this exploration policy πe by θπe . Using the REINFORCE trick, we can calculate the gradient of J (πe ) w.r.t. θπe : ∇θπe J = ED0 ∼πe [R(D0 )∇θπe log P(D0 |πe )] , (4) where P(D0 |πe ) is the probability of generating transition tuples D0 := {st , at , rt }Tt=1 given πe . This distribution can be factorized as 4.1. A view from MDP To better understand our method, we can formulate a MDP (Markov Decision Process) for the interaction between exploration agent (or teacher with policy πe ) and exploitation agent (or student with policy π). The state space S is defined as the collection of the (exploitation) policy π, the action in space A is defined as the rollouts D0 generated by executing the meta-exploration-policy πe . Then any Policy Updater could be defined as a transition function to map a policy to the next policy: T : S × A → S. For example, DDPG is a off-policy Policy Updater. The re- (3) P(D0 |πe ) = p(s0 ) T Y πe (at |st )p(st+1 |st , at ), t=0 where p(st+1 |st , at ) is the transition probability and p(s0 ) the initial distribution. The dependency of the reward is omitted here. Because p(st+1 |st , at ) is not involved with the exploration parameter θπe , by taking the gradient w.r.t. θπe , we have ∇θπe log P(D0 |πe ) = T X t=1 ∇θπe log πe (at |st ). Learning to Explore with Meta-Policy Gradient This can be estimated easily on the rollout data. We can also approximate this gradient with sub-sampling for the efficiency purpose. To estimate the meta-reward R(D0 ), we perform an “exercise move” by running DDPG ahead for one or a small number of steps: we first calculate a new actor policy π 0 = DDPG(π, D0 ) by running DDPG based on data D0 ; we then simulate from the new policy π 0 to get data D1 , and use D1 to get an estimation R̂π0 of the reward of π 0 . This allows us to estimate the meta reward by Number of Epoch Cycles Number of Rollout Steps Number of Training Steps DDPG and Meta 20 200 50 Table 1. Common Parameter settings for DDPG and Meta in most tasks R̂(D0 ) = R̂π0 − R̂π , where R̂π is the estimated reward of π, which we should have obtained from the previous iteration. Once we estimate the meta-reward R(D0 ), we can update the exploration policy πe by following the meta policy gradient in (4). This yields the following update rule: θπe ← θπe + η R̂(D0 ) T X ∇θπe log πe (at |st ). Time Steps (×1000) (5) t=1 After updating the exploration policy, we add both D0 and D1 into a replay buffer B that we maintain across the whole process, that is, B ← B ∪ D0 ∪ D1 ; we then update the actor policy π based on B, that is, π ← DDPG(π, B). Our main algorithm is summarized in Algorithm 1. It may appear that our meta update adds significant computation demand, especially in requiring to generate D1 for the purpose of evaluation. However, D1 is used highly efficiently since it is also added into the replay buffer and is subsequently used for updating π. This design helps improve, instead of decrease, the sample efficiency. Our framework allows us to explore different parametric forms of πe . We tested two design choices: i) Similar to motivated by the traditional exploration strategy, we can set πe to equal the actor policy adding a zero-mean Gaussian noise whose variance is trained adaptively, that is, πe = N (µ(s, θπ ), σ 2 I), where σ is viewed as the parameter of πe and is trained with meta policy gradient (5). ii) Alternatively, we can also take πe to be another Gaussian policy that is completely independent with π, that is, πe = N (f (s, θf ), σ 2 I), where f is a neural network with parameter θf , and θπe := [θf , σ] is updated by the meta policy gradient (5). We tested both i) and ii) empirically, and found that ii) performs better than i). This may suggest that it is beneficial to explore spaces that are far away from the current action policy (see Figure 4). Figure 1. Comparison between meta exploration policies and DDPG 5. Experiments In this section, we conduct comprehensive experiments to understand our proposed meta-exploration-policy learning algorithm and to demonstrate its performance in various continuous control tasks. Two videos are included as supplementary material to illustrate the running results of Pendulum and Inverted Double Pendulum. 5.1. Experimental Setting Our implementation is based on the OpenAI’s DDPG baseline (Plappert et al., 2017) on the GitHub website1 . Our experiments were performed on a server with 8 Tesla-M4024GB GPU and 40 Intel(R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz processors. The deterministic actor (or student) policy network and Q-networks have the same architectures as implemented in the default DDPG baseline, which are multi-layer perceptrons with two hidden layers (64-64). For the meta-exploration policy (teacher πe ), we implemented a stochastic Gaussian policy with a mean network represented with a MLP with two hidden layers (64-64), and a log-standard-deviation variance network with a MLP with two hidden layers (64-64). In order to make a fair comparison with baseline, we try to set the similar hyper-parameters as DDPG. The common pa1 https://github.com/openai/baselines/tree/master/baselines/ddpg Learning to Explore with Meta-Policy Gradient Figure 2. Illustrative screenshots of environments we experiment with Meta and DDPG rameter settings for DDPG and our meta-learning algorithm in most tasks are listed in Table 1. Besides those common ones, our method has some extra parameters: exploration rollout steps (typically 100) for generating exploration trajectories, number of evaluation steps (typically 200, same as DDPG’s rollout steps) for generating exploitation trajectories used to evaluate student’s performance, number of training steps (typically 50, aligning with DDPG’s training steps) to update student policy π, and number of exploration training steps (typically 1) to update the Meta policy πe . In most experiments, we set number of cycles 20 in an epoch to align with DDPG’s corresponding setting. Tasks such as Half-Cheetah, Inverted Pendulum, which need more explore rollout steps (1000) to finish the task, and ended up with 2000 evaluation steps, 500 number of training steps to update students and 100 exploration training steps to update teacher. In OpenAI’s DDPG baseline (Plappert et al., 2017), the total number of steps of interactions is 1 million. Here, in tasks such as Half-Cheetah, Inverted Pendulum and Inverted Double Pendulum, it takes about 1.5 million steps, Hopper with 1 million steps, and 0.7 million and 0.9 million steps are sufficient for Reacher and Pendulum to achieve convergence. Similar to DDPG, the optimizer we use to update the network parameter is Adam (Kingma & Ba, 2015) with the same actor learning rate 0.0001, critic learning rate 0.001, and additionally learning rate 0.0001 for our meta policy. Similar to DDPG, we adopt LayerNormalization (Ba et al., 2016) for our two policy networks and one Q-network. 5.2. Meta Exploration Policy Explores Efficiently To investigate and evaluate different teacher’s behaviors, we tested in Inverted Double Pendulum the two possible choices of policy architectures of πe listed in Section 4. In Figure 1, Meta denotes that we learn an exploration policy that is a Gaussian MLP policy with independent network architecture of student’s policy. Meta runs consistently better than DDPG baseline with relative high return and sample-efficiency. Usually, Meta policy learns in the same pace as student policy, it updates every time both from student’s success (performance improvement) and failure (negative performance). For a further more robust policy updates, we may need to take consideration of the trade-off between sample efficiency and sample quality. A second exploration policy denoted as Meta (variance) in Figure 1 is by taking advantage of student’s learning, combined with a variance network as πe = π + N (0, σ 2 I). Essentially, we are learning adaptive variance for exploration. Based on the student’s performance, teacher is able to learn to provide training transitions with appropriate noise. This teacher’s demonstrations help student to explore different regions of state space in an adaptive way. For Figure 1, we can see that the fully independent exploration policy perform better than the more restrictive policy that only adds noise to the action policy. As we show in Figure 4, the independent exploration policy tends to explore regions that are not covered by the actor policy, suggesting that it is beneficial to perform non-local exploration. 5.3. Sample Efficiency in Continuous Control Tasks We show the learning curves in Figure 3 for six various continuous control tasks, each is running three times with different random seeds to produce reliable comparison. Overall, our meta-learning algorithm is able to achieve sampleefficiency with better returns in most of the following continuous control tasks. Significantly, in Inverted Pendulum and Inverted Double Pendulum, on average, in about 250 thousands out of 1500 thousands steps, we are able to achieve the similar return as the best of DDPG. That is about 1/6 number of baseline’s samples. Finally, our average return is about 7718 compared to DDPG’s 2795. In Pendulum, we performed clearly better with higher average return, and converge faster than DDPG in less than 200 thousand steps. In Half-Cheetah and Hopper, on average, our meta-learning algorithm is pretty robust with higher returns and better sample-efficiency. In Reacher, we have very similar return as DDPG baseline with lower variance. The possible intuition we are able to improve the sample-efficiency and returns in most of tasks is that teacher is able to learn to help student to improve their performance, which is the student’s ultimate goal. Learning to Explore with Meta-Policy Gradient Table 2. Reward achieved in different environments env-id InvertedDoublePendulum-v1 InvertedPendulum-v1 Hopper-v1 Pendulum-v0 HalfCheetah-v1 Reacher-v1 Meta 7718 ± 277 745 ± 27 205 ± 41 -123 ± 10 2011 ± 339 -12.16 ± 1.19 DDPG 2795 ± 1325 499 ± 23 135 ± 42 -206 ± 31 1594 ± 298 -11.67 ± 3.39 (a) InvertedPendulum (b) InvertedDoublePendulum (c) Hopper (d) Pendulum (e) HalfCheetah (f) Reacher Figure 3. Performance Comparison of Meta and DDPG for Six Continuous Control Tasks. 5.4. Guided Exploration with Diverse Meta Policies To further understand the behaviors of teacher and student policies and how teacher interacts with student during the learning process, we plot the density contours of state visitation probabilities in Figure 4. The probabilities are learned with Kernel Density Estimation based on the samples in 2D embedding space. In Inverted Double Pendulum task, we collect about 500 thousands observation states for teacher policy and 1 million states for student policy. As comparison, we get 1 million states from DDPG policy. Then we project these data-sets jointly into 2D embedding space by t-SNE (Maaten & Hinton, 2008). We may be able to find interesting insights, although it is possible that the t-SNE projection might introduce artifacts in the visualization. As shown in Figure 4, we have two groups of comparison studies for the evolution of teacher and student learning processes in different stages. In each row, the first column is Meta-Teacher, the second one is Meta-Student policy and the third one is the DDPG baseline. The first row (Figure 4(a, b, c)) visualize state distributions from the first 50 roll-outs by executing the random teacher and student policies where the policies are far from becoming stationary. The bottom row (Figure 4(d,e,f)) demonstrates the state distribution landscape visited by teacher, student and DDPG, respectively, from the last 50 roll-outs to the end of learning The teacher is exploring the state space in a global way. In the two learning stages, the Meta-Teacher (Figure 4(a, d)) has diversified state visitation distributions ranging from different modes in separate regions. We can see that MetaTeacher policy has high entropy, which implies that MetaTeacher provides more diverse samples for student. Guided by teacher’s wide exploration, student policy is able to learn from a large range of state distribution regions. Interestingly, compared to teacher’s behavior, the student visits almost complementary different states in distribution space consistently in both the early (Figure 4(a,b)), and later Learning to Explore with Meta-Policy Gradient (a) Meta-Teacher (early) (b) Meta-Student (early) (c) DDPG (early) (d) Meta-Teacher (late) (e) Meta-Student (late) (f) DDPG (late) Figure 4. State Visitation Density Contours of Meta and DDPG in Early and Late Training Stages. (Figure 4(d,e)) stages. We can see that the teacher interacts with the student and is able to learn to explore different regions based on student’s performance. Meanwhile, the student is learning from teacher’s provided demonstrations and is focusing on different regions systematically. This allows the student to improve its performance consistently and continuously. It indicates that our global exploration strategy is quite different from noise-based random walk local exploration in principle. is possible and more efficient to perform global exploration, by training an independent exploration policy that allows us to explore spaces that are far away from the current state distribution. This finding has a substantial implication to our understanding on exploration strategies, showing that more adaptive, non-local methods should be used in order to learn more efficiently. Finally, this meta-policy algorithm is general and could be applied to the other offpolicy reinforcement learning problems. From the early (Figure 4(b)) to the later stage (Figure 4(e)), we find that the student is growing to be able to learn stationary and robust policies, guided by teacher’s interactive exploration. Finally, compared to DDPG (Figure 4(f)), we achieve better return (8530 vs 2830) for this comparison, which indicates that our Meta policy is able to provide a better exploration strategy to help improve the baseline. We appreciate Kliegl Markus for his insightful discussions and helpful comments. 6. Conclusion Ba, Jimmy Lei, Kiros, Ryan, and Hinton, Geoffrey E. Layer normalization. arXiv, 2016. URL https://arxiv. org/pdf/1607.06450.pdf. We introduce a meta-learning algorithm to adaptively learn exploration polices to collect better experience data for DDPG training. Using a simple meta policy gradient, we are able to efficiently improve the exploration policy and achieve significantly higher sample efficiency than the traditional DDPG training. Our empirical study demonstrates the significant practical advantages of our approach. Although most traditional exploration techniques are based on local exploration around the actor policy, we show that it Acknowledgement References Bellemare, Marc G., Srinivasan, Sriram, Ostrovski, Georg, and et al. Unifying count-based exploration and intrinsic motivation. In Proceedings of the International Conference on Neural Information Processing Systems (NIPS), pp. 1471–1479, 2016. Duan, Yan, Schulman, John, Chen, Xi, Bartlett, Peter L, Sutskever, Ilya, and Abbeel, Pieter. Rl2: Fast reinforce- Learning to Explore with Meta-Policy Gradient ment learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016. learning. In Proceedings of the International Conference on Machine Learning, 2016. Finn, Chelsea, Abbeel, Pieter, and Levine, Sergey. Modelagnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017. Ng, Andrew Y., Harada, Daishi, and Russell, Stuart. Policy invariance under reward transformations: Theory and application to reward shaping. In Proceedings of the Sixteenth International Conference on Machine Learning, pp. 278–287, 1999. Heess, Nicolas, TB, Dhruva, Sriram, Srinivasan, and et al. Emergence of locomotion behaviours in rich environments. arXiv, 2017. URL https://arxiv.org/ pdf/1707.02286.pdf. Hester, Todd, Lopes, Manuel, and Stone, Peter. Learning exploration strategies in model-based reinforcement learning. In Proceedings of the 2013 international conference on Autonomous agents and multi-agent systems, pp. 1069–1076. International Foundation for Autonomous Agents and Multiagent Systems, 2013. Houthooft, Rein, Chen, Xi, Duan, Yan, and et al. Vime: Variational information maximizing exploration. In Proceedings of the International Conference on Neural Information Processing Systems (NIPS), pp. 1109–1117, 2016. Kingma, Diederik P and Ba, Jimmy Lei. Adam: A method for stochastic optimization. In Proceedings of the Conference on Learning Representations (ICLR 2015), 2015. Levine, Sergey, Finn, Chelsea, Darrell, Trevor, and Abbeel, Pieter. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, pp. 1334– 1373, 2016. Lillicrap, Timothy P., Hunt, Jonathan J., Pritzel, Alexander, Heess, Nicolas, Erez, Tom, Tassa, Yuval, Silver, David, and Wierstra, Daan. Continuous control with deep reinforcement learning. In International Conference on Learning Representations (ICLR 2016), 2016. Lin, Long-Ji. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine Learning, pp. 293321, 1992. Maaten, Laurens and Hinton, Geoffrey. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov): 2579–2605, 2008. Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, and et al. Playing atari with deep reinforcement learning. 2013. Mnih, Volodymyr, Kavukcuoglu, Koray, Silver, David, and et al. Human-level control through deep reinforcement learning. Nature, 518:529–533, 2015. Mnih, Volodymyr, Badia, Adri Puigdomnech, Mirza, Mehdi, and et al. Asynchronous methods for deep reinforcement Osband, Ian, Blundell, Charles, Pritzel, Alexander, and Van Roy, Benjamin. Deep exploration via bootstrapped dqn. In Advances in neural information processing systems, pp. 2377–2386, 2016a. Osband, Ian, Van Roy, Benjamin, and Zheng, Wen. Generalization and exploration via randomized value functions. In International Conference on Machine Learning, pp. 4026–4034, 2016b. Oudeyer, Pierre-Yves and Kaplan, Frederic. What is intrinsic motivation? a typology of computational approaches. Frontiers in Neurorobotics, 1, 2007. Plappert, Matthias, Houthooft, Rein, Dhariwal, Prafulla, and et al. Parameter space noise for exploration. arXiv, 2017. URL https://arxiv.org/pdf/ 1706.01905.pdf. Schmidhuber, Jurgen. Formal theory of creativity, fun, and intrinsic motivation (19902010). IEEE Transactions on Autonomous Mental Development, 2(3):230–247, 2010. Schulman, John, Levine, Sergey, Moritz, Philipp, Jordan, Michael I., and Abbeel, Pieter. Trust region policy optimization. In Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015. Schulman, John, Wolski, Filip, Dhariwal, Prafulla, Radford, Alec, and Klimov, Oleg. Proximal policy optimization algorithms. arXiv, 2017. URL https: //arxiv.org/pdf/1707.06347.pdf. Silver, David, Schrittwieser, Julian, Simonyan, Karen, and et al. Mastering the game of go without human knowledge. Nature, 550:354359, 2017. Stadie, Bradly C, Levine, Sergey, and Abbeel, Pieter. Incentivizing exploration in reinforcement learning with deep predictive models. arXiv preprint arXiv:1507.00814, 2015. Tang, Haoran, Houthooft, Rein, Foote, Davis, and et al. # exploration: A study of count-based exploration for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2750–2759, 2017. Todd, Hester and Peter, Stone. Intrinsically motivated model learning for developing curious robots. Artificial Intelligence, 247:170–186, 2017. Learning to Explore with Meta-Policy Gradient Uhlenbeck, G. E. and Ornstein, L. S. On the theory of the brownian motion. Physical Review, 36:823, 1993. Wang, Jane X, Kurth-Nelson, Zeb, and et al. Learning to reinforcement learn. arXiv preprint arXiv:1611.05763, 2016. Watkins, Chris. Learning from delayed rewards. Ph.D. Thesis, Cambridge, 1989. Watkins, Chris and Dayan, P. Q learning: Technical note. Machine Learning, pp. 279–292, 1992. Wawrzyski, Pawe. Real-time reinforcement learning by sequential actor-critics and experience replay. Neural Networks, pp. 1484–1497, 2009.
2cs.AI
Modeling the wind circulation around mills with a Lagrangian stochastic approach Mireille Bossy∗1 , José Espina2 , Jacques Morice †2 , Cristián Paris ‡2 , and Antoine Rousseau§ 3 1 Tosca Laboratory, Inria Sophia Antipolis – Méditerranée, France 2 Inria, Chile 3 Lemon Laboratory, Inria Sophia Antipolis – Méditerranée, France arXiv:1404.4282v4 [cs.CE] 6 Sep 2016 September 7, 2016 Abstract This work aims at introducing model methodology and numerical studies related to a Lagrangian stochastic approach applied to the computation of the wind circulation around mills. We adapt the Lagrangian stochastic downscaling method that we have introduced in [3] and [4] to the atmospheric boundary layer and we introduce here a Lagrangian version of the actuator disc methods to take account of the mills. We present our numerical method and numerical experiments in the case of non rotating and rotating actuator disc models. First, for validation purpose we compare some numerical experiments against wind tunnel measurements. Second we perform some numerical experiments at the atmospheric scale and present some features of our numerical method, in particular the computation of the probability distribution of the wind in the wake zone, as a byproduct of the fluid particle model and the associated PDF method. Key words: Lagrangian stochastic model; PDF method; atmospheric boundary layer; actuator disc model 1 Introduction Modeling the flow through wind turbines and wind farms is a research area of growing importance with the fast and worldwide development of installed wind farms. Therefore there exists a wide variety of approaches that combine atmospheric computational fluid dynamics methods (CFD) with wake models (from actuator disc models to full rotor computations, see eg. Sørensen and Myken [30], Hallanger and Sand [13], Bergmann and Iollo [2]). Most popular atmospheric boundary layer computations are based on Reynolds averaged Navier-Stokes (RANS) turbulence models and large eddy simulation (LES) approaches. PDF methods, based on stochastic Lagrangian models, constitutes an interesting alternative (see the discussions in Pope [25]) that have been not yet fully developed in the case of atmospheric boundary layer modeling but are mostly used for reactive flows because this approach does not necessitate to approximate the reaction terms (Haworth [15], Minier and Peirano [21]). Among the reasons that can explain this phenomena, we can first rise the fact that such kinds of models handle nonlinear stochastic differential equations that necessitate a background on stochastic calculus, rather than classical PDE analysis. Second, the development of numerical solvers, based on stochastic particles approximation, requires the design of a hybrid Lagrangian/Eulerian algorithm from scratch. However, it is worth mentioning PDF methods are computationally inexpensive and allow to refine the space scale without any numerical constraints. In recent works, some of the authors developed modeling numerical frameworks for the downscaling problem in meteorology (see [3],[4]). An algorithm called Stochastic Downscaling Method (SDM) is currently under validation when coupled with a coarse resolution wind prediction, provided thanks to classical numerical weather prediction (NWP) solvers. Quite a few widely used predictive numerical solvers (such as the weather research & ∗ [email protected][email protected][email protected] § [email protected] 1 forecasting model (WRF)) are based on a LES approach. To this purpose, we have developed a branch of SDM that includes atmospheric boundary layer modeling and ground interaction (log law). In this paper, we present our methodology to introduce wake models (typically actuator disc models) in the SDM solver. We also present the related numerical experiments on wake computation, in a classical log law context. We emphasize the fact that the basis of stochastic Lagrangian models consists in describing the stochastic dynamics of a fluid particle’s state variables (Xt , Ut ), under an appropriated probabilistic space (Ω, F, P) equipped with the expectation operator E. The Lagrangian approach allows to define the Eulerian average of the veloce in the LES approach, as the ity, classically represented by the bracket operator hUi in the RANS approach or U 1 mathematical conditional expectation of the particle velocity Ut knowing its position x ∈ R3 hUi(t, x) := E [Ut |Xt = x] , (1.1) hf (U)i(t, x) := E [f (Ut )|Xt = x] . (1.2) and more generally, for any function f , Equivalently, in term of PDF2 modeling approach (see [25] for further details) the Eulerian density at time t and at a given x is identified with the conditioned Lagrangian density, knowing the event {Xt = x}. The connections between RANS/LES models and stochastic Lagrangian models are realized via a specific design of the stochastic equation coefficients for (Xt , Ut ) allowing to reproduce k − ε and Reynolds-stress models (see the review on Lagrangian modeling in Pope [24] and the discussion in [4]). In particular such PDF models can be used to reconstitute subgrid information of fluctuations in LES modeling. After a short description of the SDM modeling, mathematical framework, and numerical method in Section 2, we introduce our Lagrangian version of the actuator disc modeling in Section 3. For validation purpose, in Section 4 we compare some numerical experiments against wind tunnel measurements. Section 5 is devoted to some numerical experiments at the atmospheric scale. To assess the mill impact in the flow, SDM simulations are run in both experiments with the two turbine models presented in Section 3, namely: the non-rotating actuator disc model, and the rotating actuator disc model. 2 Stochastic downscaling methodology This section is devoted to the description of the Stochastic Downscaling Method, in the framework of turbulence modeling of an incompressible flow in the neutral case (constant mass density). Consider the computational domain D as an open bounded subset of R3 . In order to model the flow in D, we consider a couple of stochastic processes (Xt , Ut ) that respectively describe the location and the velocity of a generic fluid-particle. The evolution of (Xt , Ut ) is governed by the following generic system of stochastic differential equations (SDEs): dXt =Ut dt,     1 dUt = − ∇x hPi(t, Xt ) dt − G(t, Xt ) Ut − hUi(t, Xt ) dt + C(t, Xt )dWt . % (2.1a) (2.1b) Here W is a standard 3-dimensional Brownian motion, G, C and Uext are functions to be defined in accordance with the turbulence underlying model (see Section 2.3 below), and X(t = 0) = X0 , U(t = 0) = U0 where (X0 , U0 ) are random variables whose probability law µ0 is given. The parameter % is the mass density of the fluid (which is assumed to be constant). We supplement the dynamics (2.1), with generic (Dirichlet) boundary conditions on the mean velocity: hUi(t, x) := E [Ut |Xt = x] = Uext (t, x), (2.2) when x = (x, y, z) belongs to the lateral-boundary part or top-boundary part of ∂D. The bottom-boundary condition that should account for the surface roughness is described in Section 2.4. 1 We consider here only the case of constant mass density, for the sake of clarity. In other cases a scalar state variable is introduced such as temperature, that weights the conditional expectation operator. 2 Probability Density Function 2 2.1 Mathematical framewrok According to (1.1), the term hUi(t, Xt ) = E [Ut |Xt ] denotes the expected velocity of the particle conditioned by its position Xt , making the equation (2.1) a nonlinear SDEs in the sense of McKean. This means that a Markovian solution to (1.1) must be a process ((Xt , Ut ); 0 ≤ t ≤ T ) complemented with the set of its time-marginal laws ρ(t) of (Xt , Ut ) at any time 0 ≤ t ≤ T , which allows to define (assuming the existence of densities for the marginal laws ρ(t)) E [f (Ut )|Xt = x] for any measurable function f , as the conditional Lagrangian mean R 3 f (u)ρ(t, x, u)du RR ρ(t, x, u)du R3 R whenever the marginal mas R3 ρ(t, x, u)du is positive. In the framework of turbulent modeling this conditional Lagrangian mean is then identified to the Eulerian mean (see Pope [25] and the references therein) In a series of papers, (see in particular Bossy and Jabir [6], Bossy, Jabin, Jabir and Fontbona [5], and references therein), the wellposedness of toy-models version of stochastic Lagrangian models, typically with drift coefficients of the velocity equation expressed as conditional expectation with respect to position, was initiated. The wellposedness of the stochastic process ((Xt , Ut ); 0 ≤ t ≤ T ), for any arbitrary finite time T > 0, whose time-evolution is given by the McKean-nonlinear SDE  Z t    X = X + Us ds, 0  t 0 (2.3) Z t    U = U + B[X ; ρ(s)]ds + σW , where ρ(t) is the density law of (X , U ) for all t ∈ (0, T ],  t 0 s t t t 0 can by found in [6], where W is a standard Rd -Brownian motion, the diffusion σ is a positive constant, and the drift coefficient (x, ψ) 7→ B(x, ψ) is the mapping from D × L1 (D × Rd ) to Rd defined by R d b(v)ψ(t, x, v)dv (2.4) 1{RRd ψ(t,x,v)dv6=0} B[x; ψ] = RR ψ(t, x, v)dv d R where b : Rd → Rd is a given bounded measurable function. This definition of the drift B makes the mapping (t, x) 7→ B[x; ρ(t)] coincides with (t, x) 7→ E[b(Ut )|Xt = x] and the velocity equation rewrites Z t Ut = U0 + E[b(Us )|Xs ]ds + σWt 0 or equivalently, using the notation in (1.1) dUt = hb(U )i(t, Xt )dt + σdWt . Moreover a particle system, based on kernel regression estimator of the conditional expectation B is shown to converge weakly to the model (2.3). The construction of the particle approximation is based on local averaging estimate on a N -particle set (Xti , Uti , i = 1, . . . , N, t ∈ [0, T ]) of E[b(Ut )|Xt = x] by N X WN,i (x)b(Uti ). i=1 Well-known propositions for the weights WN,i (x) are Nadaraya-Watson estimator K (x − X i ) WN,i (x) = PN , j j=1 K (x − X ) for a well chosen kernel K (x) = K( x ), and partitioning estimator 1{X i ∈BM,j } WN,i (x) = PN , k=1 1{X k ∈BM,j } 3 for x ∈ BM,j given a M -partition PM = {BM,1 , BM,2 , . . . , BM,M } of the domain. It is worth to notice that the algorithm complexity of a particle system based on kernel estimator is up to O(N 2 ) whereas the partitioning estimator version is up to O(N ). We retained this last solution for SDM together with some refinement of Particle-in-cell (PIC) technics (see further details in [3, 4]). Also a confined version of (2.3) by mean of specular reflection is shown to produce Dirichlet boundary condition, as mean no-permeability boundary condition: E[(Ut · nD (Xt ))|Xt = x] = hU · nD i(t, x) = 0, for dt ⊗ dσ∂D -a.e. (t, x) ∈ (0, T ) × ∂D. In [5], for D equal to the torus R/Z (and with (x)mod 1 := x − bxc), a step is made in the wellposedness of Lagrangian equation with pressure term:   Z t Z t Z t Xt = X0 + Us ds , Ut = U0 + σWt − ∇x P (s, Xs )ds − β (Us − αE(Us |Xs ))ds (2.5a) 0 0 0 law(X0 , U0 ) = ρ0 (x, u)dx du, (2.5b) P(Xt ∈ dx) = dx, for all t ∈ [0, T ], (2.5c) For now on, and under drastic hypotheses on the initial condition law, only analytical solutions of the Fokker Planck equation associated to (2.5) is established. This first step contributes to analyze the role of the gradient pressure term to guarantee the incompressibility constraint on the Eulerian velocity and constant mass density. In the modeling of turbulent flow, the constraint (2.5c) is indeed formulated heuristically (see e.g. [24]) by rather imposing some divergence free property on the flow, which in the case of system (2.5) would correspond to a divergence free condition on the bulk velocity field: ∇x · E[Ut |Xt = x] = 0. By taking the divergence of a formal equation for the bulk velocity derived from the Fokker-Planck equation, and a classical projection argument on the space of divergence free fields, it is then assumed that the field P verifies an elliptic PDE, which in our notation is written as 4x P = − d X h i (i) (j) ∂xi xj E Ut Ut |Xt = x (2.6) i,j=1 (see [25] for a precise formulation). 2.2 Generic numerical scheme We present hereafter the numerical discretization of equations (2.1). It consists in one main time loop in which we identified three main steps: see Algorithm 1. The interested reader may refer to [3, 4] for additional details. In particular, the link between Lagrangian and Eulerian fields (i.e. between particles and mesh) is established thanks to classical particle-in-cell (PIC) methods (see Raviart [27]), which are thus used to compute conditional expectations (1.1) and (1.2). The domain D is divided in partitioning cells defined from a Cartesian regular mesh. We denote Np the total number of particles in the computation, Npc is the number of particles per cell, that is maintained constant in the time step procedure, by the effect of the mass conservation constraint. In the case where the nearest grid point method (spline of order 0) is used, any conditional expectation such as (1.2) is computed in each cell C(i, j, k) thanks to an average value over the Npc particles located in the cell: X 1 f (Up (t)). (2.7) hhf (U)ii(t, xi,j,k ) = Npc p∈C(i,j,k) This approach coincides with the partitioning estimator described at Section 2.1. For robustness considerations (see Appendix A), we consider an exponential version of the explicit Euler scheme for the prediction Step (1). We propose in Step (2) an original method to confine particles in D according to the following downscaling principle: the inferred Eulerian velocity field satisfiesthe Dirichlet condition (2.2).   p,Np p,Np p p At time tn−1 = t0 + (n − 1)∆t, the Np Lagrangian variables Xn−1 , Un−1 := Xn−1 , Un−1 are known, as well as the statistics kn−1 and hUn−1 i in each cell C of the partition of D= Nc [ i=1 4 Ci . Algorithm 1 – Time-Step in SDM while t0 + n∆t < Tfinal do (1) Prediction step: move particles thanks to a partial exponential scheme. (2) Account for boundary conditions (3) Correction step: conservation constraints ensuring constant density and free divergence. end while At time tn , for each particle p: Step 1. Prediction: we compute the following quantities e pn = Xp + ∆tUp • The particle position X n−1 n−1 e pn is calculated applying an exponential Euler scheme to the SDE (see Appendix A) • The velocity U   e pt = −G(tn−1 , Xp ) U e pt − hUn−1 i dt + C(tn−1 , Xp )dWt , t ∈ [tn−1 , tn ], dU (2.8) n−1 n−1 where hUn−1 i, kn−1 and εn−1 are evaluated in the cell containing Xpn−1 . e pn ∈ D, then set Xpn = X e pn and Upn = U e pn . If X e pn ∈ Step 2. Boundary condition: When X / D; let tout be the boundary hitting time after tn−1 , and Xpout = Xpn−1 + p (tout − tn−1 )Un−1 be the hitting position, then the reflected position is set to Xpn = Xpout − (tn − tout )Upn−1 . (2.9) In concern of the velocity, we simulate Equation (2.8) between tn−1 and tout with an exponential scheme to obtain the velocity Upt− . Then, in order to match the boundary conditions, we impose a jump on the velocity out at t = tout : Upt+ = 2Uext (tn−1 , Xpout ) − Upt− . (2.10) out out We finally compute Upn thanks to the numerical computation of Equation (2.8) between tout and tn . Remark 2.1. In a three-dimensional domain, it may happen that Xpn written in (2.9) remains outside the computational domain after the reflection, for instance in the neighborhood of the corners. In this case, the particle is replaced near the outward boundary and the new particle position is set to Xpn = Xpout + γ, where γ is a small vector pushing Xpout back into D. The new velocity Upn is unchanged. Step 3. Conservation constraints: Once the Np particles are advanced at time tn , • move the particles such that there is exactly the same number Npc of particles per cell to fulfill the mass density constraint. To this aim, we use the so-called triangular transport (see [3]) which consists in sequentially sorting the particle in each of the three space directions. This sequential 1D rearrangement corresponds to the solution of an optimal transport problem according to the uniform distribution). e n i, and project the new Eulerian velocity field on the diver• compute the new Eulerian quantities hU gence free space. This may be done thanks to the classical resolution of a Poisson equation for the pressure, with homogeneous Neumann boundary conditions. 2.3 A specific Lagrangian model for the atmospheric boundary layer We consider our computational domain D in the neutral atmospheric boundary layer such as drawn in Figure 1. From floor to top, the height of D is at most the approximate size of the atmospheric boundary layer, namely 600 to 1000 m (in Section 5, we shall perform our numerical simulations for a domain D of height 300 m and 750 m). We now detail the generic terms G, C in (2.1)–(2.2), and boundary conditions Uext in order to model the atmospheric boundary layer. In what follows, all the Eulerian averages h i are in the sense of (1.2). 5 Figure 1: Schematic view of the atmosperic boundary layer. Courtesy of P. Drobinski [9]. Turbulence modeling We use the classical notation for the velocity components (with numbering or with letters, depending on how it is convenient in the equations) (1) (2) (3) Ut = (ut , ut , ut ) = (ut , vt , wt ). Also for the components of the instantaneous turbulent velocity, 0(1) Ut − hUi(t, Xt ) = (ut 0(2) , ut 0(3) , ut ) = (u0t , vt0 , wt0 ), for the turbulent kinetic energy (tke), k(t, x) = 1 (hu0t u0t i + hvt0 vt0 i + hwt0 wt0 i) , 2 and for P = 21 (P11 + P22 + P33 ), the rate of turbulent energy production, with Pij := − 3 X 0(i) 0(k) hu k=1 u ∂hu(j) i ∂hu(i) i i + hu0(j) u0(k) i ∂xk ∂xk ! . Turbulence models roughly consist in linking the turbulent kinetic energy k and the turbulent energy dissipation ε. In order to account for turbulence effects in the Lagrangian velocity equation (2.1b), we define its coefficients as: p (2.11a) C(t, x) = C0 ε(t, x), Gi,j (t, x) = − CR ε(t, x) ∂hu(i) i δij + C2 (t, x). 2 k(t, x) ∂xj (2.11b) The tensor Gi,j is related to the isotropization of turbulence production model (IP model) that accounts to the Reynolds-stress anisotropies (see Durbin and Speziale [11] and [25] ) and C0 is given by   P 2 CR + C2 − 1 . (2.12) C0 = 3 ε The turbulent energy dissipation ε(t, x) is recovered via the turbulent kinetic energy as a parametrization (see Drobinski et al. [10]), k 3/2 (t, x) . (2.13) ε(t, x) = Cε `m (x) k 1/2 (t, x) . Thus when the turbulent `m (x) kinetic energy k vanishes, all the terms in the particles dynamics (2.5, 2.11) stay well defined. As a local model, It is worth to notice that the term ε(t, x)/k(t, x) in the Gi,j tensor is Cε 6 possibly forced by dynamical boundary condition as in [3] or by a log law wind profile as in the following Sections 4 and 5, SDM is mainly pertinent in the turbulent part of the atmosphere. However, it can be observed that SDM well reproduces the decay of the turbulent kinetic energy in the boundary layer, and up to the geostrophic height, making vanished the tke k at the top, where the flow becomes laminar (see Figure 15). The mixing length `m can be considered as constant away from the floor (above the surface layer). However, as can be seen in Carlotti [7], it should be proportional to the vertical coordinate z within the surface layer. A classical choice consists in a piecewise linear function for `m proportional to von Karman constant κ: `m (z) = κ(z − z`m )1[0,z`m ] (z) + κz`m . (2.14) Putting together (1.2),(2.11) with the generic Eulerian average approximation formula (2.7), we obtain the following expression for the turbulent characteristics computed by SDM: 1 (hhu0 u0 ii(t, x) + hhv 0 v 0 ii(t, x) + hhw0 w0 ii(t, x)) . 2 ! 3 (i) (j) X ∂h hu i i ∂h hu i i + hhu0(j) u0(k) ii Pij ' − hhu0(i) u0(k) ii ∂xk ∂xk k(t, x) ' (2.15) k=1 Gi,j (t, x) ' − CR k 1/2 (t, x) ∂hhu(i) ii Cε δij + C2 (t, x). 2 `m (x) ∂xj Boundary conditions As can be seen in Figure 1, our computational domain is bounded from above by the free troposhere where a geostrophic balance can be considered. As a consequence, we shall use Dirichlet boundary conditions at the top of the domain, hUi(t, x) = UG (t, x), (2.16) where UG is given, corresponding to the output of a geostrophic model. The bottom boundary condition should account for the surface roughness and corresponding layer: we incorporate a log law in our model, such as described in the forthcoming section. Finally, since we want to model one or several mills we propose to use inflow (log law profile) and outflow (free output) boundary conditions for the (x, y) lateral frontiers, as described in Section 5 below. 2.4 Wall-boundary condition For the modeling effect of the ground, we borrow and adapt the particle boundary condition proposed by Minier and Pozorski [23] that aims to reproduce the momentum exchange between the ground and the bulk of the flow. This method is equivalent to wall functions approach in classical turbulence models. Here, we just resume the main idea in [23] which consists in imposing a reflection to the particle trajectories, when it arrive to a given height zmirror , where zmirror is chosen in the logarithmic layer. In order to define the reflection of the particles on this mirror face {z = zmirror }, we denote with a ‘in’ the inward velocities in the region {z ∈ [zmirror , H]} and with a ‘out’ the outward velocities in the region {z ∈ [0, zmirror ]}. The velocity Uin is oriented to the top whereas Uout is oriented to the bottom. A symmetry principle allows to replace any outward particle to its mirror inward particle. The vertical component is simply reflected at zmirror : win = −wout (2.17) whereas the horizontal velocity are lifted in a way that preserves the covariances hu0 w0 i and hv 0 w0 i in this reflection process: hu0 w0 i wout , hw02 i hv 0 w0 i vin = vout − 2 02 wout . hw i uin = uout − 2 7 (2.18) (2.19) Cells Cell center • {z = zc } Uin Outward particle • {z = zmirror } Uout Mirror particle • {z = z0 } {z = 0} Ground Figure 2: The mirror reflection scheme for the velocity near the ground. It remains to impose the covariances at the ground. In [7], Carlotti describes the method used in the Meso-NH model [17] for the account of the log law. This method is inspired from the one of Schmid and Schumann [29]: the boundary condition for the subgrid covariances hu0 w0 i and hv 0 w0 i are fixed to   hui u2∗  (t, x, y) (2.20) hu0 w0 i(t, x, y) = −  q 2 2 hui + hvi   hvi hv 0 w0 i(t, x, y) = −  q u2∗  (t, x, y) (2.21) 2 2 hui + hvi where the friction velocity u∗ 3 is computed in each cell at the bottom of the domain using the log law q 2 2 hui (t, xc , yc , zc ) + hvi (t, xc , yc , zc )   u∗ (t, xc , yc ) = κ zc log z0 (2.22) where κ is the von Karmann constant, z0 is the roughness length parameter, and (xc , yc , zc ) is the position of a cell’s center, for the cells on the floor. We adapt this idea in SDM with the following steps. Step 1. Given hui(tn ) and hvi(tn ), for any of the cells on the floor, - we compute u∗ (tn , xc , yc ) with (2.22) - we compute hu0 w0 i(tn , xc , yc ) and hv 0 w0 i(tn , xc , yc ) using (2.20) and (2.21). Step 2. For the particle boundary condition at zmirror , we localize the particle crossing the interface in the cell of center (xc , yc , zc ); we use hu0 w0 i(tn , xc , yc ) and hv 0 w0 i(tn , xc , yc ) to compute the reflected velocity of the mirror particle at the interface, using (2.17), (2.18) and (2.19). In [23], the authors propose to fix zmirror to 53 zc . In our simulations in the following sections, we used zmirror = 12 zc . 3u ∗   2 2 1/4 = hu0 w0 i + hv 0 w0 i . 8 3 Actuator disc methods in the Lagrangian setting The presence of wind mills is taken into account thanks to additional force terms in the stochastic differential equations that govern the movement of the particles. To this end, equation (2.1b) (which governs the time evolution of the velocity Ut = (ut , vt , wt ) of a particle) is modified as follows:   1 dUt = − ∇x hPi(t, Xt ) dt ρ   (3.1) − G(t, Xt ) Ut − hUi(t, Xt ) dt + C(t, Xt )dWt + f (t, Xt , Ut ) dt + fnacelle (t, Xt , Ut ) dt + fmast (t, Xt , Ut ) dt. The term f (t, Xt , Ut ) represents the body forces that the blades exert on the flow. The supplementary terms fnacelle (t, Xt , Ut ) and fmast (t, Xt , Ut ) represent the impact of the mill nacelle and mast. In the present work, only the blade and nacelle forces are considered. In this section, we discuss how those force terms should be implemented in the Lagrangian setting considered here, in order to recover consistency with classical Eulerian formulations. Considering the full geometrical description of the blades (that requires a very fine mesh), the force f is a very complex function which encodes the geometry of the blades; however, in this study we are interested in the overall impact of the mills in the flow, and not in the fine geometrical details of the reciprocal interactions. For this reason, and to avoid costly computations, an actuator disc approach is used to provide approximations of f , with two different levels of complexity: (a) Non-rotating actuator disc with uniform loading. (b) Rotating actuator disc. In the Actuator Disc approach, each mill is represented as an immersed surface which concentrates all forces exerted by the mill on the flow. A thorough description of this methodology can be found in Mikkelsen [20], and in the books by Hansen [14] and Manwell, McGowan and Rogers [18]. With different degrees of complexity, it has been applied to wind turbine simulations in Porté-Agel, Lub and Wu [26], Master et al. [19], El Kasmi and Masson [12]. It has also been used to simulate arrays of turbines in Wu and Porté-Agel [33]. (b) The cylinder C (a) Local coordinates Figure 3: (a) The local reference frame at the actuator disc of the turbine, using cylindrical coordinates. (b) The cylinder C that extends the actuator disc. Mill forces are applied to particles that lie inside. It is assumed that the flow moves along the positive direction of the x axis, and that the turbine’s main axis is aligned with the x axis, so that it faces the wind directly. It is convenient to define local reference frame of cylindrical coordinates centered at the hub of the turbine, with basis vectors ex , er and eθ as shown in Figure 3a. In order to apply the forces to the particles, the actuator disc is expanded to a cylinder C of depth ∆x, and the 9 forces per unit mass are used to correct the velocities of all particles lying inside C. This cylinder is divided in two regions: C = Cblades ∪ Cnacelle , as depicted in Figure 4, where Cblades represents the region occupied by the blades, and Cnacelle represents the region occupied by the nacelle. For the two models considered here (non-rotating and rotating actuator disc), the force term f is computed for and applied to particles lying inside region Cblades ; and correspondingly, the term fnacelle is computed for and applied to particles lying inside region Cnacelle . The following sections describe the way in which this is done. Figure 4: Left: cylinder C representing the turbine. Right: sub-regions corresponding to the nacelle and blades, viewed by particles. In the rest of this section we discuss successively on the force f in the non rotating actuator disc model, and in the rotating actuator disc model. We end by considering the fnacelle . 3.1 Non rotating, uniformly loaded actuator disc model In this model, the turbine force corresponding to the blades is distributed uniformly over the region Cblades , and rotational effects are ignored. In the simplest formulation of the model, for a turbine facing a uniform laminar steady state flow, and ignoring the influence of the nacelle, the total thrust force exerted by the turbine is given by an expression of the form 1 2 ex , Fx = − ρACT U∞ 2 where U∞ is the unperturbed velocity far upstream from the turbine’s location, U∞ is its norm, A is the surface area of the turbine’s disc, ρ is the density of air, and CT is a dimensionless, flow dependent parameter called the thrust coefficient. An elementary deduction of this expression can be found in [14] or [18]. This deduction, which is essentially one-dimensional, is based on conservation of linear momentum for a stream tube passing through the turbine’s disc (see Figure 5). The analysis assumes that the turbine faces uniform, inviscid, steady-state flow, and hence there is radial symmetry with respect to the hub of the turbine. Further, a constant loading is assumed at the disc, and thus the velocity field is constant and uniform there. The thrust coefficient CT is specified in terms of the axial induction factor a, U∞ − UD a= , (3.2) U∞ which measures the relative decrease in speed from the far upstream region and the disc region, where the local velocity has magnitude UD < U∞ (see Figure 5). As in Réthoré et al. [28], the local velocity magnitude UD (whose exact formula is yet to be specified) is used instead of U∞ by combining (3.2) with the thrust force expression that becomes Fx = −2ρ a 2 AUD ex , (1 − a) (3.3) and CT = 4a(1 − a). 10 (3.4) Figure 5: A stream tube passing through the actuator disc of the turbine. Uniform flow is assumed at the far upstream region. In order to adapt this thrust force model to particles, the disc is extended to a cylinder C of length ∆x and mass ρA∆x (see Figure 3b), which is subdivided in the two regions Cblades and Cnacelle , as depicted in Figure 4. In both cases, the force is assumed to be uniformly distributed along the additional dimension. In the present section, we restrict ourselves to the adaptation of the model to the region Cblades . The force per unit mass inside region Cblades is then given by: 1 2a U 2 1{x∈Cblades } ex . (3.5) ∆x 1 − a D As soon as we have specified how UD is computed for each individual particle, from (3.5) follows Algorithm 2, for a given time step of length ∆t beginning at time tn , and a given particle with position Xtn and velocity Utn at time tn . fx = − Algorithm 2 – Update the Lagrangian velocity with thrust force in the non rotating actuator disc model. (Lagrangian) PRESTEP Compute the mean local speed at the disc UD if Xtn ∈ Cblades then  (Lagrangian) 2 1 2a UD Utn+1 7→ Utn+1 − ∆x ex ∆t. 1−a end if Since (3.5) is derived from a laminar one-dimensional analysis, its generalization to turbulent shear flow (Lagrangian) requires UD to be carefully specified. For a particle with position Xtn in Cblades and velocity Utn at time tn , at least three possibilities exist (all equivalent for uniform, laminar, steady-state flows): (Lagrangian) (a) define UD = |utn |; (Lagrangian) (b) define UD = |hui| (tn , Xtn ); (Lagrangian) (c) compute UD as the magnitude of average velocity of particles inside cylinder Cblades : (Lagrangian) UD = |E [utn |Xtn ∈ Cblades ]| . (3.6) If one selects options (a), Equation (3.5) describes the instantaneous force, and not the mean one. Given the flowdependent nature of the axial induction factor a, and the fact that it pertains to the whole disc of the turbine, option (c) is adopted, preferably to option (b); the force density then becomes: fx = − 3.2 1 2a 2 E [ut |Xt ∈ Cblades ] 1{Xt ∈Cblades } ex . ∆x 1 − a (3.7) Rotating actuator disc model This model is based on a blade element analysis, which gives a description of the blade forces in terms of a set of simple geometrical parameters. The model assumes that each blade is comprised of tiny pieces (blade elements), each encompassing an infinitesimal length dr, which concentrate the relevant forces that the turbine exerts on the 11 flow. It is assumed that these blade elements are independent of one another, in the sense that they do not induce any radial movement on the flow. To be precise, consider the reference frame depicted in Figure 3a, with basis vectors ex , er , eθ along the axial (stream wise), radial and tangential directions, respectively. The corresponding flow velocity components in this frame will be denoted (Ux , Ur , Uθ ). We assume that the turbine rotates with angular speed ω, oriented along −eθ . Consider a blade element located at radius r from the center of the turbine, and a portion of fluid near this blade element. By the model hypotheses, it is assumed that Ur = 0, and thus the flow velocity at this blade element is U = Ux ex + Uθ eθ . Under these conditions, the local relative velocity of the flow with respect to the blade, Urelat , is given by: Urelat = Ux ex + (Uθ + ω r) eθ . (3.8) To introduce the blade forces, consider the blade depicted in Figure 6. In this model, the actual blade geometry is considered indirectly. The blades themselves are not meshed, but instead are represented by the following information: • • • the lift and drag curves corresponding to a given airfoil model of each blade element; the local chord length c(r) of the blade at radius r, which is the length of the blade element located there (see Figure 6); the local pitch angle γ(r) of the blade at radius r; γ(r) is the angle between the chord line of the blade element located at radius r, and the rotational plane of the turbine (see Figure 7). From this data and Urelat , two important angles are defined for each blade element (see Figure 7): • • the flow angle φ, which is the angle between Urelat and the rotational plane of the turbine, and is given by   Ux , (3.9) φ = arctan Uθ + ω r the angle of attack α, which is the angle between Urelat and the main chord line of the blade element, and is given by α = φ − γ(r). (3.10) Figure 6: A blade, with chord length c and local pitch angle γ varying along its radius. Orange (solid) lines lie in the rotational plane of the turbine. For the i-th blade, blade element theory tells us that the total force exerted on the flow by each blade element – spanning an infinitesimal portion dr of the blade – is proportional to the square of the norm of Urelat and to the surficial area of the element, which is approximated as c(r)dr. The force is divided in two orthogonal components: 1) A lift force dL(i) , which is parallel to Urelat 2) A drag force dD(i) , which is orthogonal to Urelat 12 Figure 7: Visualisation in the (ex , eθ ) plane of a blade element located at radius r from the center of the turbine: relative velocity Urelat , rotational velocity −ωreθ , local pitch angle γ(r) and angle of attack α. The expressions for the magnitudes of these forces, dL and dD, read as follows (Urelat being the magnitudes of Urelat ): 1 2 c(r) CL dr, dL(i) = ρ Urelat 2 (3.11) 1 2 dD(i) = ρ Urelat c(r) CD dr. 2 The terms CL and CD are called the lift coefficient and drag coefficient respectively, and are functions of the angle of attack α, as well as the local Reynolds number at the blade. These functions are determined either empirically or via numerical simulations, and are often found in the form of tabulated data. In the present work, two approaches are used to determine CL and CD for a given value of the angle of attack α, depending on the mill data we have: - numerical interpolation using tabulated data giving the values of both coefficients for a range of possible values of α, corresponding to a given airfoil design at a given Reynolds number. This approach is used in Section 4. - direct computation using analytical expressions for the dependence on the angle of attack α, corresponding to a given airfoil design at a given Reynolds number. This approach is used in Section 5. Expressions in (3.11) depend on i as Urelat , CL and CD are computed locally at each different blade position using one of the methods described above. In the local reference frame of the turbine (see Figure 3a), the components of the differential force along ex and eθ corresponding to the i-th blade are, respectively:   1 2 dFx(i) = − dL(i) cos(φ) + dD(i) sin(φ) = − ρ Urelat c(r) (CL cos(φ) + CD sin(φ)) dr, 2 1 (i) 2 dFθ = dL(i) sin(φ) − dD(i) cos(φ) = ρ Urelat c(r) (CL sin(φ) − CD cos(φ)) dr. 2 (3.12) Now consider a turbine with Nblades blades. The aim is to use (3.12) to obtain expressions for the components of the force per unit mass along ex and eθ , corresponding to each blade. To do this, the blade in question is expanded a distance ∆x along the axial direction, and smeared over an angular distance ∆θ, resulting in the three dimensional region shown in Figure 8. To a blade element located at radius r there corresponds an infinitesimal sector of volume r∆x∆θdr and mass ρr∆x∆θdr. Dividing the expressions in (3.12) by the element sector mass, 13 one obtains the forces per unit mass at radius r from the center of the wind turbine: (i) fx(i) = dFx 1 ρr∆θ∆x dr =− (i) (i) fθ dFθ 1 = ρr∆θ∆x dr 1 U 2 c(r) (CL cos(φ) + CD sin(φ)) , 2r∆θ∆x relat (3.13) 1 = U 2 c(r) (CL sin(φ) − CD cos(φ)) . 2r∆θ∆x relat Figure 8: A three dimensional sector corresponding to one blade. Note that expressions in (3.13) correspond to the force per unit mass of one single blade. In principle, each particle of the simulation will receive at most the force of one blade (the one corresponding to the sector where the particle is), and thus it is necessary to keep track of the positions of each blade (and the corresponding blade sector). However, if one is only interested in the global impact of the blades, it is possible to simplify the computations by selecting ∆θ = N2π , where Nblades is the number of blades of the turbine. In this case, the union of all blades blade sectors results in the same region Cblades used in section 3.1 (see Figure 9), and the blade positions become irrelevant. Expressions (3.13) then read as follows: 1 dFx Nblades 2 =− U c(r) (CL cos(φ) + CD sin(φ)) , ρ2πr∆x dr 4πr∆x relat dFθ Nblades 2 1 = U c(r) (CL sin(φ) − CD cos(φ)) . fθ = ρ2πr∆x dr 4πr∆x relat fx = (3.14) Note that this is equivalent to summing the contributions of (3.12) for all blades, and distributing the resulting force in an annulus of mass 2πρr∆xdr (or equivalently, to choosing ∆θ = 2π and summing the contributions of (3.13) for the Nblades blades). In this case, since the blades are essentially delocalised within the mill region, their contributions may be considered equal to one another, and the total force at radius r will be given by: dFx = N blades X dFx(i) = −Nblades (dL cos(φ) + dD sin(φ)) , i=1 dFθ = N blades X (3.15) (i) dFθ = Nblades (dL sin(φ) − dD cos(φ)) . i=1 Under these assumptions, since the blade characteristics (local pitch, local chord length, lift and drag coefficients) are defined locally, and since the blade positions within Cblades are indeterminate, we may use the particle positions and Lagrangian velocities (Xt , Ut ) to compute the angle of attack α, the local pitch angle γ and deduce all the needed information Urelat , c(r), CL (α) and CD (α). From (3.8), we derive the relative velocity Urelat from the instantaneous particle position and Lagrangian velocity (Xt , Ut ) by Urelat (Xt , Ut ) = (Ut · ex )ex + ((Ut · eθ ) + ω r(Xt )) eθ . (3.16) We also compute the flow angle φ using (3.9):  φ(Xt , Ut ) = arctan (Ut · ex ) (Ut · eθ ) + ω r(Xt ) α(Xt , Ut ) = φ(Xt , Ut ) − γ(r(Xt )). 14  , (3.17) Then the force added in the Lagrangian velocity Equation (3.1) is Nblades 2 (Urelat (Xt , Ut )) c(r(Xt )) (CL (α) cos(φ) + CD (α) sin(φ)) (Xt , Ut ), 4πr∆x Nblades 2 fθ (t, Xt , Ut ) = 1{Xt ∈Cblades } (Urelat (Xt , Ut )) c(r(Xt )) (CL (α) sin(φ) − CD (α) cos(φ)) (Xt , Ut ). 4πr∆x (3.18) This results in the numerical Algorithm 3. fx (t, Xt , Ut ) = −1{Xt ∈Cblades } Figure 9: Left: cylinder C representing the turbine viewed by a particle. Right: decomposition of C in three blade sectors. In these figures the nacelle sector Cnacelle is omitted for simplicity. 3.3 Nacelle model In all the simulation results presented in Sections 4 and 5, we use a simple model for the turbine nacelle. As in Wu and Porté-Agel [32], the nacelle force fnacelle is modeled as a permeable actuator disc, but here we adapt the model to the Lagrangian setting. The nacelle is assumed to occupy a cylinder Cnacelle , with frontal area Anacelle and depth ∆x (see Figure 4). A particle (Xt , Ut ) lying within the nacelle region is applied a force per unit mass of: fnacelle = − 1 2anacelle 1{Xt ∈Cnacelle } (Ut · ex )2 ex . ∆x 1 − anacelle (3.19) At the same time, the actuator disc models presented in Section 3.2 are modified to account for the nacelle’s presence: the relevant region for the mill forces will not be C, but instead the subregion Cblades defined as (see Figure 4): Cblades = C \ Cnacelle . (3.20) In this manner, only particles belonging to Cblades (and not C) are applied the mill forces. Also, for the Non-Rotating Actuator Disc, the local velocity is estimated considering only particles lying inside Cblades . 4 Comparison with high-resolution windtunnel measurements In this section, the method presented above is tested against wind tunnel measurements performed at the Saint Anthony Falls Wind Tunnel, University of Minnesotta, by Chamorro and Porté-Agel [8]. The data consists of high resolution, hot-wire anemometry wind speed measurements at different downstream positions and heights. We particularly focus on three key turbulence statistics that are commonly used to characterize wind-turbine wakes: the mean and turbulence intensity profiles of the streamwise velocity, and the kinematic shear stress profile (see e.g. Wu and Porté-Agel [32]). 4.1 Experimental setup The Saint Anthony Falls Laboratory wind tunnel consists of two main sections. The air recirculates among these main sections. Turbulence is created using a picket fence, and an adjustable ceiling height allows a zero-pressure 15 Algorithm 3 – Update the Lagrangian velocity with thrust force in the rotating actuator disc model. PRESTEP Compute the relevant geometrical information of the particle at time tn , relative to the turbine: • the radial position r (Xtn ) of the particle (component of Xtn along er ) • the distance to the rotational plane of the turbine. With this information, determine if Xtn lies inside Cblades or not. if Xtn ∈ Cblades then (1) compute the tangent vector eθ corresponding to the projection of Xtn on the rotational plane of the turbine; (tan) (2) compute the tangential velocity of the particle, Utn ; that is, its component along eθ ; (3) compute the relative velocity Urelat using (3.16) and the particle velocity components at time tn :   (tan) Urelat = utn ex + Utn + ω r (Xtn ) eθ ; (4) compute the flow angle φ using (3.17) and the particle velocity components at time tn : ! ut n φ = arctan ; (tan) Utn + ω r (Xtn ) (5) compute the angle of attack α using (3.17), with the local pitch computed at the radial position of the particle: α = φ − γ (r (Xtn )) ; (6) obtain the lift and drag coefficients CL (α) and CD (α) using the airfoil data; (7) apply the axial and tangential forces per unit mass (3.18) respectively to the particle velocity: utn+1 7−→ utn+1 − (tan) (tan) Utn+1 7−→ Utn+1 + Nblades 2 Urelat c (CL cos(φ) + CD sin(φ)) ∆t, 4πr∆x Nblades 2 Urelat c (CL sin(φ) − CD cos(φ)) ∆t. 4πr∆x end if gradient boundary layer flow to be created in the main sections. A miniature wind turbine is located in the tunnel, and sensors are placed at different upstream and downstream positions relative to the wind turbine (see [8] for details). For the comparison between Lagrangian simulations and measurements, we used the neutrally-stratified boundary layer experiment. The main characteristics of the neutral boundary layer flow produced in the wind tunnel are summarized in Table 1a. To test the implementation of mills in the stochastic Lagrangian settings presented before, a one-mill configuration reproducing the Saint Anthony Falls experiment has been used. A single mill has been placed in a rectangular domain spanning 4.32 × 0.72 × 0.46 meters in the x, y and z directions, respectively (Figure 10). The mill faces atmospheric flow with a log-law profile at the inlet section, that develops moving along the x direction. The main physical and computational parameters of the simulations are detailed in Table 1c. The miniature threeblade wind turbine is chosen so as to represent the typical dimensions and tip speed ratios of commercial wind turbines. The main parameters of the wind turbine used in the simulations are listed in Table 1d. To assess the impact of the mill in the flow, Lagrangian simulations are run with the rotating actuator disc turbine model. The mill’s position is such that the x and y coordinates of the hub lie at the center of one of the computational cells. To initialize the simulations, a warm-up simulation is run first, without mill. For this warmup simulation, an inflow-outflow condition is used in the x axis (the main direction of the wind): particles exiting the domain at 16 Boundary layer characteristics in the wind tunnel Boundary layer depth 0.46 m Wind speed at the top 2.8 m s−1 Velocity friction u∗ 0.11 m s−1 Roughness length z0 0.04 mm (a) Main characteristics of the boundary layer flow Simulation parameters Domain size x 2.16 m Domain size y 0.726 m Domain size z 0.42 m 96 cells in x ∆x = 0.0225 m 33 cells in y ∆y = 0.022 m 84 cells in z ∆z = 0.005 m Particles per cell 150 Final time is 30 s Time step is 0.03 s Model constants Rotta constant CR von Karman constant κ C2 C z`m 1.8 0.4 0.60 0.068 0.1 m (b) Main model physical constants Mill configuration Coordinates of the hub: (0.5 0.36 0.125) m Hub height 0.125 m Radius 0.075 m Nacelle radius 0.01 m Rotational speed 112.0 rad.s−1 Inflow factor of the nacelle anacelle = 0.4 (d) parameters of the mill (c) configuration of the simulations Table 1: Main parameters of the wind tunnel simulations. Figure 10: Domain for the wind tunnel scale simulations. the outflow boundary are reinserted at the inflow boundary with a mean velocity given by the targeted log-law4 plus a random velocity vector normally distributed, that renders the covariance structure taken from the cell where the particle was in the previous time step. A similar boundary condition is used in the y axis. The results of the warmup simulation are averaged along the x and y axes to produce empirical profiles of all relevant statistics of the velocity field. For the mill simulations, an inflow-outflow boundary condition is applied in the x axis, using the empirical profile from the warmup simulation to force the inflow condition: particles exiting the domain at the outflow boundary are reinserted at the inflow one with velocities following a trivariate Gaussian distribution computed with the information of these empirical profiles. A similar strategy is used in the y axis boundaries: particles exiting the domain through one of these boundaries are reinserted in the opposite boundary, with a new velocity following a trivariate Gaussian distribution computed with the empirical profiles. In all simulations, the boundary conditions for the z axis are as described in Section 2. As in [32], we use the lift and drag data CL (α) and CD (α) provided by Blade data taken from Sunada Sakaguchi and Kawachi [31]. The chord length and twist angle of the turbine are taken from [32]. 4 u(z) = u∗ κ log z . z0 17 4.2 Comparison with experimental data The results of SDM with the more complex Rotating Actuator Disc mill model is compared against experimental data obtained from Wu and Porté-Agel [32]. Three quantities are of particular interest: the streamwise component of the mean velocity field, the streamwise turbulent intensity, and the shear stress between streamwise and vertical components. As underlined in [32], du to the non-uniform (logarithmic) mean velocity profile of the incomming boundary-layer flow, the profiles of those three quantities yield non-axisymmetric distribution. SDM simulations are showed without any time average on the SDM output produced after a total of 1000 time iterations after the warm-up phase. We show hui, I and −huwi as they are computed at the final time step, using the second order CIC-estimator for the computation of Eulerian fields on the last 20 time steps only, to not burden the computation time. First, we examine the streamwise component of the mean velocity. A profile comparison against experimental data at several downstream locations is shown in Figure 11. For the Rotating ADM a good agreement is seen for distances equal and higher than 5 turbine diameters, while a reasonable agreement is seen near the turbine; Figure 11: Comparison of vertical profiles of hui at different downstream positions x from the turbine (-1, 2, 5, 7 and 10 diameters respectively). The profiles are centred to the hub y position. The blue curve represents the wind tunnel measures, the red curve represents SDM simulation with the Rotating Actuator Disc mill model. Secondly, the turbulence intensity I of the stream-wise component of velocity is analyzed. Figure 12 shows the vertical turbulence intensity profiles, which are plotted at the same downstream positions as was done for hui. We compute the turbulence intensity with SDM, using the same inflow mean velocity Uhub at the hub height than in [32]: q I= 2 3 k Uhub , with Uhub = 2.2 m s−1 . We observe a good fit with the measures far and close to the mill, even if the turbulent intensity seems to be overestimated in the area of the nacelle (in light red) at 2 and 3 diameters of the hub. Also of interest is the shear stress (i.e −huwi the covariance between x and z components of velocity). As before, vertical profiles are plotted for different downstream positions from the turbine. Figure 13 shows the results. Again, the fit is good but SDM seems to overestimate a little the shear stress. It is it is worth noting that the SDM computation locates the maximum of the shear stress at the top tip of the blades area (top limit of the light blue area) as expected. The same effect can be observed for the turbulent intensity. 18 Figure 12: Comparison of vertical profiles of the turbulence intensity at different downstream positions x from the turbine (-1, 2, 5, 7 and 10 diameters respectively). The profiles are centred to the hub y position. The blue curve represents the wind tunnel measures, the red curve represents SDM simulation with the Rotating Actuator Disc mill model. We complement the comparison between the 2D xz-profiles in Figures 11 12 13, with some other directional views in Figure 14 showing in particular the winding of the streamlines passing through the turbine. It is worth to notice that in this first Lagrangian approach for Rotating-ADM, we did not dissociate the ∆x corresponding to the thickness of the Cblades cylinder with the ∆x of the cell mesh. Thus, in these simulations the Cblades thickness is about 66% of the disk diameter. Refine this thickness independently to the cell mesh size can bring substantial improvements without additional computational cost. Furthermore, the model of permeable disk for the nacelle can be improved (without counting the mast model that we have not put yet in our simulation). In these simulations, we introduce the corresponding force term in the velocity computation without any correction terms for the second order moments, as we did for the wall law model at the ground. There is therefore some margin of improvement for the Rotating-ADM model with SDM. Computation time. To produce all the results shown in this paper, we have used one 32-cores Intel Xeon CPU E5-2665 0 @ 2.40GHz computer node. The elapsed time for the 1000 iterations with 96 × 33 × 84 × 150 Lagrangian particles (about 40 millions of particles) is about 8 hours and 10 minutes. A new version of our code for multi-nodes computer architecture is under development. 5 Some numerical experiments at the atmospheric scale We reproduce atmospheric turbulent condition approaching a real-size neutrally-stratified boundary layer condition, by parametrizing our simulation inspired by the numerical experiments performed in Drobinski et al. in [10] for an atmospheric neutral case. The corresponding boundary layer characteristics are summarized in Table 2b Figure 15 shows how SDM reproduces turbulence characteristics of the same order than in [10] as well as log-law profile for the velocity. In particular the anisotropic variance profiles, computed here in the whole boundary layer depth converge to zero at the top of the boundary layer. The turbulent kinetic energy goes naturally to zero at the boundary layer top and SDM fits the prescribed laminar geostrophic flow. 19 Figure 13: Comparison of vertical profiles of the shear stress −hu0 w0 i at different downstream positions x from the turbine (-1, 2, 5, 7 and 10 diameters respectively). The profiles are centred to the hub y position. The blue curve represents the wind tunnel measures, the red curve represents SDM simulation with the Rotating Actuator Disc mill model. Figure 14: Streamlines visualization (Rotating ADM simulation), with a yz-contour plot of the turbulent kinetic energy circles at one diameters of the hub (left); with a yz-contour plot of the hu0 w0 i covariance at 3.5 diameters of the hub (right). 5.1 Simulation setup To test the implementation of mills in the stochastic Lagrangian settings presented before, a one-mill configuration has been used. A single mill has been placed in a rectangular domain spanning 1500 × 400 × 300 meters in the x, y and z directions, respectively (Figure 16). The mill faces atmospheric flow with a log-law profile at the inlet section, that develops moving along the x direction. The main physical and computational parameters of the simulations are detailed in Table 2. To assess the impact of the mill in the flow, simulations are run with the two turbine models presented in Section 3, namely: the non-rotating actuator disc mode (NR-ADM), and the rotating actuator disc model (R-ADM). The mill’s position is such that the x and y coordinates of the hub lie at the center of one of the computational cells. To initialize the simulations, a warm-up simulation is run first, according to the same process described to initialize the wind tunnel simulation in Section 4. 20 Figure 15: Profiles of main turbulence charateristics computed by SDM in the whole boundary layer (averaged in the x and y-directions). The numerical parameters are the same than in Tables 2 exept that the computational domain height is 750 m. Boundary layer characteristics Boundary layer depth 750 m Wind speed at the top 10.63 m s−1 Velocity friction u∗ 0.42 m s−1 Roughness length z0 0.03 m (a) Main characteristics of the boundary layer flow Simulation parameters Domain size x 1488 m Domain size y 403 m Domain size z 300 m 90 cells in x ∆x = 16 m 31 cells in y ∆y =13 m 80 cells in z ∆z = 3.75 m Particles per cell 128 Final time is 1000 s Time step is 1.0 s Model constants Rotta constant CR von Karman constant κ C2 C z`m 1.8 0.4 0.60 0.08 150 m (b) Main model physical constants Mill configuration Coordinates of the hub: (496.875,200,50) m Hub height 50 m Radius 20.5 m Nacelle radius 4.5 m Rotational speed 2.83 rad.s−1 anacelle for the Rotation ADM 0.38 anacelle for the Non Rotation ADM 0.45 (d) parametrers of the mill (c) configuration of the simulations Table 2: Main parameters of the simulations at the atmospheric scale. For the mill simulations, an inflow-outflow boundary condition is applied in the x axis, as described again in Section 4. For the rotating case, a realistic wind turbine has been designed using blade data of a NTK 500/41 wind turbine (as found in [14]), together with lift and drag coefficients corresponding to a NACA 23012 airfoil at Reynolds numbers of the order of 106 (as found in Abbott and von Doenhoff [1]). 21 Figure 16: Domain for the atmospheric scale simulations. 5.2 Computation of the non-rotating equivalent For the non-rotating case, we need to specify the values of a, CT and U∞ (as used in Equations (3.2), (3.4), and (3.3)) so that the simulation is equivalent to the rotating actuator disc. Again, we define this equivalence by requiring the total thrust force in both cases to be the same. However, in this section we introduce an additional method to compute the required quantities, which also serves as a consistency validation of our simulations in the atmospheric case: the Blade Element Momentum method (BEM). Compute thrust from the SDM particles For the non-rotating (NR) actuator disc model, we compute the total thrust excluding the area Anacelle occupied by the nacelle: 1 2 , (5.1) FxNR = − ρ(A − Anacelle )CT U∞ 2 whereas for the rotating (R) model, the total thrust can be computed by integrating Equation (3.15) from the nacelle radius rnacelle to the turbine radius R: FxR ZR  = −Nblades  dD dL cos (φ) + sin (φ) dr. dr dr (5.2) rnacelle The idea is then to compute U∞ and FxR , and substitute them in (5.1) to obtain CT . The magnitude U∞ can be easily estimated as the z-averaged value of the mean velocity hUi at the inlet section of the domain, over the diameter of the turbine: h+R   Z 1 u∗ z U∞ = log dz, (5.3) 2R κ z0 h−R To compute FxR in (5.2) from the particle information, the integrand is estimated for all particles within region C, using equations (3.18): 1 1 dFxR = ρ dr ρ  dL dD cos (φ) + sin (φ) dr dr  ' −2πr (Xt ) ∆xfx (Xt , Ut ) . The total thrust over ρ, FxR /ρ, is then computing by an estimation of the integral: 22 (5.4) Np X FxR =R ρ 2π r (Xpt ) ∆xfx (Xpt , Upt ) 1C (Xpt ) p=1 Np X . (5.5) 1C (Xpt ) p=1 Compute thrust with BEM A complete description of BEM theory can be found in [14] or [18]. It stems from the combination of two different analyses of the turbine performance facing a steady-state, uniform, radially symmetric flow: (1) a linear and angular momentum balance in thin, radially distributed, annular stream tubes passing through the turbine swept area at different radii; (2) a blade element analysis of the turbine. The first of these analyses assumes that the relative velocity decrease from the far upstream region to the disc region depends on the radial position, so that a now varies with r: a(r) = U∞ − UD (r) . U∞ (5.6) It is also assumed that the flow gains angular momentum, related to the rotational speed of the turbine. The angular speed Uθ at radius r at the disc is controlled by an additional function a0 (r): Uθ (r) = a0 (r)ωr, (5.7) where ω is the angular speed of the turbine. The following expressions are then found for the differential forces in directions ex and eθ , at an annulus located at radius r from the turbine’s center (see [18] or [14] for details): 2 dFx (r) = −4πρra(r)(1 − a(r))U∞ dr, 0 2 dFθ (r) = 4πρωa (r)(1 − a(r))U∞ r dr. (5.8) (5.9) Given the assumption of radially symmetric flow made by BEM, in this analysis Urelat and the angle φ are functions of r only. In terms of a(r) and a0 (r), expressions (3.8) and (3.9) are simplified to: Urelat (r) = (1 − a(r))U∞ ex + (1 + a0 (r))ωreθ ,  φ(r) = arctan (1 − a(r))U∞ (1 + a0 (r))ωr (5.10)  . (5.11) On the other hand, a pure blade element analysis like the one presented in Section 3.2 yields the following expressions for the same quantities: 1 2 dFx (r) = − Nblades cρ Urelat (r)(CL cos(φ(r)) + CD sin(φ(r)))dr, 2 1 2 dFθ (r) = Nblades cρ Urelat (r)(CL sin(φ(r)) − CD cos(φ(r)))dr. 2 (5.12) (5.13) In BEM, the rotor is discretized in a finite number of blade elements. For a set of radial positions and given values of U∞ and ω, the values of a and a0 , the flow angle φ and the relative velocity magnitude Urelat are computed for each blade element separately, by equating (5.8) with (5.12) and (5.9) with (5.13) and using an iterative procedure (see [14] for a detailed description of the algorithm). The procedure delivers the values of Urelat (r), φ(r), a(r) and a0 (r). 23 Two Non-Rotating equivalent models are obtained: one with the computation of the thrust according to (5.5), and the other using the BEM method described above. The corresponding estimated values for the thrust coefficient are reported in Table 3. The a values produced par the two methods are so close that the plotting of the corresponding simulation profiles (as those in Figures 17 and 19) are completely indistinguishable. This first comparison validates the thrust equivalence computation with the SDM particles, but as we will see in the next section, at least with this value of a, the NR-ADM underestimates the three main characteristic that we analyze in the flow, hui, hu0 u0 i and hu0 w0 i. In addition to the assumptions of homogeneity and symmetry of the wind fields that are not well respected in our case, the thrust computation methods described above may be sensitive to the blade geometry discretization parameter (in our data dr =1m) for the BEM-based method, to the ∆x parameter for the density estimator, in (5.5) for the SDM particles-based method. Equivalent non rotating actuator disc parameter estimations Method FxR /ρ (Nblades m3 /kg) a CT SDM Particle computation 28680.55 0.2081584 0.659314 BEM computation 27863.06 0.2034322 0.648190 Table 3: Estimation of the equivalent non-rotating actuator disc for our mill configuration. 5.3 Numerical experiments, comparison between rotating and non-rotating actuator disc methods It is interesting and useful to analyze the differences between results obtained with the simple Non-Rotating model and the more complex Rotating model, and to determine to which extent they give a similar development of the turbine wake. In particular, as can be seen in the simulations of Wu and Porté-Agel [32], one would expect an under-prediction of the speed deficit near the turbine for the non-rotating case, while both models should yield similar results far downstream from the turbine. This and other effects are studied hereafter. To begin with, mean velocity contour plots along the stream-wise direction are shown for both models in Figure 17. These plots show that rotation and non-uniform loading have a clear impact in the turbine wake. This Figure 17: Comparison of xz cross sections of hui: Rotating Actuator Disc (top), Non-Rotating Actuator Disc with a estimated from thrust equivalence (bottom). is confirmed by the mean velocity profiles at different downstream positions, as shown in Figure 18. As expected the Rotating AD model and the Non-Rotating AD model present substantial differences, as already observed in the LES framework in [32]. The mean velocity component hui is underestimates in the disk area (blades area corresponds to the light blue zone, and the nacelle area corresponds to the light red zone in the plots). Secondly, the variance of the stream-wise component of velocity hu0 u0 i is analyzed. Figure 19 shows contour plots taken at the middle of the xz plane, for both simulations. It is noteworthy that the variance near the turbine is 24 Figure 18: hui profiles at different downstream positions from the turbine. much higher for the rotating actuator disc simulation, although far from the turbine the differences begin to fade. It is also interesting that in Rotating AMD case the highest amount of variance is generated atop the turbine, while for the Non-Rotating AMD the variance at the hub is uniformly strong along the turbine disc, and not just at the tip top. We can obverse the impact of this variance anomaly that propagates in the particles environment behind the mill to the left and top. Knowing this, a remedy may consist to impose the values of the second order moments at the left boundary side from the warmup simulation to overcome this weird propagation of the variance. The same behavior can be seen in the vertical variance profiles, which are plotted at the same downstream positions as was done for hui (see Figure 20). At one diameter from the turbine, we can observe the overestimation of hu0 u0 i for the NR-ADM (in red), in particular in the nacelle area. A best estimate of anacelle could therefore contribute to reduce this variance anomaly. Figure 19: Comparison of xz cross section of variance hu0 u0 i along x: Rotating Actuator Ddisc (top), NonRotating Actuator Disc with a estimated from thrust equivalence (bottom). Also of interest is the covariance between x and z components of velocity. As before, to compare both simulations, xz contour plots are taken at the middle of the y axis, and vertical profiles are plotted for different downstream positions from the turbine. Again, the rotating model produces stronger values of covariance near the turbine with respect to the non-rotating model, while both tend to equalize as one moves to the far downstream 25 Figure 20: hu0 u0 i profiles at different downstream positions from the turbine. section. Figure 22 shows the results. Figure 21: hu0 w0 i profiles at different downstream positions from the turbine. Figure 21 gives some yz-cross sections of the covariance at the same x-distance to the turbine. The spacial structures of the covariances are similar, but the level of the shear is about three times smaller for the NR-ADM at 3.5 diameters from the turbine. 5.4 Probability distribution functions of the streamwise velocity One of the main advantages of the stochastic downscaling method presented in Section 2 is that it allows access to the instantaneous probability distribution functions of the wind velocity field at each time and position. In the case of mill simulations, this information may be used for various purposes. Contrary to deterministic methods, 26 Figure 22: Comparison of the yz cross section of covariance hu0 w0 i: Rotating Actuator Disc (left), Non-Rotating Actuator Disc with a estimated from thrust equivalence (right). the stochastic methodology used here estimates the PDFs of the velocity field in just one simulation, directly by sampling the particle properties in the same way the various statistics presented before are estimated. Plus, no time or spatial averaging is required, and it is possible to see how the PDF varies along the wake of a turbine. In this section, we present histograms that estimate the PDF of the streamwise velocity component u = hui + u0 , corresponding to several points before and after the wind turbine, located at the middle of the y axis and at hub height. To obtain each histogram, we discretise velocity space and sample the particle information of all cells in the neighborhood of the point of interest. (a) -1 diameters from turbine (b) 2 diameters from turbine (c) 3 diameters from turbine (d) 4 diameters from turbine (e) 5 diameters from turbine (f) 7 diameters from turbine Figure 23: Local distribution of velocity component u = hui + u0 at different positions of the x axis. As can be seen in Figure 23, the distribution of u is fairly non-symmetric at −1 diameter before the turbine (where the flow has not yet felt its presence) with a peak around 8 m s−1 , moving to around 3 m s−1 in the near turbine wake, progressively recovering to the −1 diameter distribution as one moves downstream from the turbine, and showing a bimodal distribution transition at 3 and 4 diameters from the turbine. 6 Conclusions In recent years, wind energy has seen an important growth worldwide, and the construction and operation of large wind farms necessitates a better understanding of the flow inside and through them in realistic and dynamic 27 atmospheric conditions. In the present study, actuator disc methods have been coupled with the SDM solver [4], which uses a probability distribution function (PDF) approach to turbulent flow simulation based on stochastic Lagrangian models. The result is an innovative methodology to simulate wind turbines and wind farms operating in atmospheric boundary layer flow. It has been shown that the particle setting of SDM is fit for mill simulations, providing qualitatively consistent estimations of the mill forces and wake properties. Plus, the PDF framework coupled with actuator disc methods allows one to obtain an estimation of the wind variability in the wake of a wind turbine, something which - to the best knowledge of the authors - has never been accomplished before. The present work is part of a larger project, which seeks to simulate large wind farms with complex topography using the SDM solver. Moreover as a downscaling method, SDM aims to be coupled with dynamic boundary conditions coming typically from mesoscale meteorological solvers. Here, the intent has been to present the methodology, as well as to give a preliminary validation analysis with respect to measurements and a comparison of the different models available, using simple attaptation of actuator disc models and just one turbine. Future stages of the project will produce: (1) a wind farm simulation using dynamical downscaled boundary conditions coming from a coarse meteorological solver; (2) simulations with complex topography; and (3) implementation of more complex models for the blade forces in the SDM framework. Regarding this last point, we would like to conclude showing some of our ongoing work concerning individual blade visualizations, using the methodology presented in Section 3.2. In particular, it is possible - by modifying the shape of the blade sectors - to obtain estimations of more involved 3D quantities than the ones presented here, such as the vorticity structures generated behind an individual mill. As proof of concept, Figure 24 shows a visualization of such structures for the same turbine presented in Section 5, but using a finer discretization and a smaller domain. Future stages of our project will perfect these preliminary simulations, by introducing more complex models than the Lagrangian actuator disc models presented in this work. Figure 24: Iso-surfaces of the x component of vorticity behind a wind turbine. Acknowledgments The authors thank Philippe Drobinski for very fruitful discussions related to modeling aspects of the atmospheric boundary layer. A Appendix On the partial exponential Euler scheme for partially linear SDEs A part of the drift of the fluid-particle velocity equation (2.1b) is a linear term of the form −G(t, Xt )(Ut − hUi(t, Xt )). 28 It means that during a time step ∆t, each component of the velocity behaves like a one-dimensional OrnsteinUhlenbeck process of generic form: given Zt , dZs = (α(Zs − m) + β) ds + σdWs , for s ∈ [t, t + ∆t], (A.1) where here we assume that α ≤ 0, σ, m and β are constants, or coefficients values frozen at the time t. Typically, from the tensor terms G(t, Xt ), we put in α only the diagonal terms, while extra diagonal terms are included in β. To simplify the presentation, assume that we work coordinate by coordinate, and that Brownian motion W and all the coefficients are valued in R. Such linear SDE (A.1) has an explicit solution Z valued in R and given by   Z t+∆t  β e−αr dWr . Zt+∆t = eα∆t Zt + m − × 1 − eα ∆t + σeα ∆t α t It is classical to notice that σeα t R t+∆t t e−αr dWr is normally distributed with Gaussian law N (0, γ 2 ), where γ 2 = σ 2 e2α∆t Z ∆t e−2αr dr = 0  σ  2α∆t e −1 . 2α We thus have the following exact simulation formula for Ztn+1 , given Ztn α∆t Ztn+1 = e  Ztn β −m+ α   β + m− α  p 1 − exp(2α∆t) p +σ ηn , (−2α) where (ηn ) is a sequence of independent N (0, 1)-identically distributed random variables. This procedure delivers a discrete time random process with the exact law of the solution of (A.1), as long as m, α, β and σ are constant. In the situation of Equation (2.1b), all those parameters may correspond to frozen coefficients αn , σn , mn , βn during the integration step [tn , tn + ∆t], and the exponential Euler scheme below becomes an approximation procedure: p     1 − exp(2αn ∆t) βn βn αn ∆t p Z tn+1 = e Z tn − mn + + mn − + σn ηn . (A.2) αn αn (−2αn ) Such exponential scheme strategy was previously considered in the context of Lagrangian two-phase flow modeling by Minier, Peirano and Chibbaro [22], who numerically analyses the ability of such method to be insensitive to some limit value of the time scale α1n . Here, our concern slightly differ. To be precise, the main advantage of the partial exponential Euler scheme to the classical Euler scheme, defined as (with the same notation for coefficients) √ Z tn+1 = Z tn + αn (Z tn − mn )∆t + σn ∆tηn , arises from the fact that the rate of strong convergence of the exponential scheme depends only on the time variation of the map t 7→ α(t) withing its Lipschitz or Hölder regularity parameters, but does not depend directly on the values of αn . This is not true for the classical Euler scheme (see the computation below). Concerning the time discretisation part, the convergence of our numerical scheme, described in section 2.2, is mainly driven by the notion of the weak convergence: |Ef (ZT ) − Ef (Z T )| −→ 0, when ∆t → 0, given a set on test function f . But the notion of strong convergence of a p-th moment approximation: 1/p E[|ZT − Z T |p ] −→ 0, when ∆t → 0 plays also an important role when one mix a SDE time discretisation scheme with a Monte Carlo procedure. Indeed, a particular attention should be paid to the upper-bound of the overall variance of the error: when N 1 X (i) Ef (ZT ) is approximated by f (Z T ), N i=1 29 classical error analysis decomposes the error in the time discretisation error part (bias bound) and the mean square Monte Carlo error part v " # u  N  u 1 X (i) 2 t |Ef (ZT ) − Ef (Z T )| + E Ef (Z T ) − f (Z T ) . N i=1 It is well known that the variance of the error N   1 X (i) f (Z T ) Var Ef (ZT ) − N i=1 can be control with the strong error (as soon as f is for instance Lipschitz, see e.g Kebaier [16]). Thus, in our case the exponential scheme prevents the variance of the error to fluctuate too much with huge values of |αn |. Let us now recall that in our Lagrangian stochastic model, αn is mainly the square root of the turbulent kinetic energy k in (2.15), computed itself with the PIC estimator (2.7) for the variance of the velocity components. It is then numerically pertinent to prefer the partial exponential scheme in order to stabilize the variance of k estimator. Notice that all this empirical analysis is contingent to the fact that (αn , n ∈ N) stays negative. For the sake of completeness, we detail below some basic computations in order to compare the behavior of the Euler schemes and Exponential Euler schemes on the generic linear SDE dZt = (α(t)(Zt − m(t)) + β(t)) dt + σ(t)dWt , Z0 given. (A.3) On the moments stability and the strong convergence of the discussed schemes for the SDE (A.3) Assume that the coefficients α(·), m(·), β(·), σ(·) in (A.3) are continuous on [0, T ] for a finite final time T . As an affine SDE (A.3) has a unique strong solution. Using Itô formula, it is easy to check that the solution is given by the following closed expression Zt =Z0 e Rt 0 α(r)dr Z − t R t e s α(r)dr Z α(s)m(s)ds + t R t e 0 s α(r)dr Z β(s)ds + 0 t R t e s α(r)dr σ(s)dWs (A.4) 0 Freezing the coefficients on each subinterval [n∆t, (n + 1)∆t), we consider the continuous version of the exponential scheme Z t R Rt t Z t =Z0 e 0 α(τ (s))dr − e s α(τ (r))dr α(τ (s))m((τ (s))ds 0 (A.5) Z t R Z t R t t α((τ (r))dr α((τ (r))dr + es β((τ (s))ds + es σ((τ (s))dWs 0 0 where τ (t) = supk∈{1,...,N } {tk : tk ≤ t}, which coincide with the definition Z tn+1 = Z tn e ∆tα(tn ) Z tn+1 − e(tn+1 −s)α(tn ) α(tn )m(tn )ds tn Z tn+1 + e(tn+1 −s)α(tn ) β(tn )ds + tn Z tn+1 e(tn+1 −s)α(tn ) σ(tn )dWs tn at each time step tn . Using the closed forms, it is straightforward to compute a bound of any even 2p-th moment p ≥ 1, using successively the Jensen Inequality and Itô Isometry "Z 2p # E[Zt2p ] ≤42p−1 E[(Z02p e2p Rt 0 α(r)dr t R t ]+E e s α(r)dr α(s)m(s)ds 0 "Z +E t R t e s α(r)dr "Z 2p # p # t R 2 st α(r)dr 2 β(s)ds +E e σ(s) ds . 0 0 30 Assuming in addition that α is valued in (−∞, 0], we easily get that E[Zt2p ] is bounded by a constant uniform in 2p α. This is also true for E[Z t ] for the same reason. From a different computation, this stability property is also true for the classical Euler scheme Z tn+1 Z tn+1 Z tn+1 Z tn+1 = Z tn + α(tn )(Z tn − m(tn ))ds + β(tn )ds + σ(tn )dWs tn tn tn whose continuous version is Z t Z t Z t σ(τ (s)dWs α(τ (s))(Z τ (s) − m(τ (s)))ds + β(τ (s))ds + Z t =Z0 + 0 (A.6) 0 0 2p Indeed, applying the Itô formula to Z t and classical computations Z t Rt Rt 2p 2p−1 2pe s 2pα(s)ds) {β(s) − α(s)m(s)} E[Z s ]ds E[Z t ] = E[Z02p ]e 0 2pα(s)ds + 0 Z t Rt 2p−2 σ(s)2 + 2p(2p − 1)e s 2pα(s)ds E[Z s ]ds 2 0 and again, due to the sign of α, we easily conclude. 1/2p when other To simplify the presentation, we consider now the trajectorial error t 7→ E[|Zt − Z t |2p ] coefficients m, β and σ are some constants. So Zt − Z t writes Z t R  Rt   Rt Rt t Zt − Z t = (Z0 − m) e 0 α(s)ds − e 0 α(τ (s))ds + β e s α((τ (r))dr − e s α((τ (r))dr ds 0 Z t R  Rt t α(r)dr α((τ (r))dr +σ es −e s dWs . 0  Rt  Rt The strong error bound is then derived from the bound of terms of the form Et := e 0 α(s)ds − e 0 α(τ (s))ds , that also writes Z t  Rs Rt Rs α(τ (s))ds 0 Et = e α(s) − α(τ (s) e 0 α(r)dr e− 0 α(τ (r))dr ds. 0 Rt This last expression leads to the upper bound |Et | ≤ 0 |α(s)−α(τ (s))| ≤ L∆t, when for instance α is Lispschitz with constant L. Using again Jensen Inequality and Itô Isometry, we get that supt∈[0,T ] E[|Zt − Z t |2p ] ≤ C|Et |p where C does not depend on α. In particular, when α is also a constant, the strong error vanishes and we recover the fact that the exponential scheme is exact in that case. The strong convergence for the Euler scheme differs on this last point, even when all the coefficients are some constant. Indeed, starting with the Itô formula, we have the following E[(Zt − Z t )2p ] = t Z 2pαE[(Zs − Z s )2p−1 (Zs − Z τ (s) )]ds Z t Z t = 2pαE[(Zs − Z s )2p ]ds + 2pαE[(Zs − Z s )2p−1 (Z s − Z τ (s) )]ds. 0 0 0 From that point, if α is negative, the first term in the right hand side disappears, but the second one, multiplied by α is not a signed term, so any Young or Hölder inequality to separate this second term in what is called the local error E[(Z s − Z τ (s) )2p ] with the iteration term E[(Zs − Z s )2p ]] will make appear a |α| in the final bound. For instance, with Young inequality and next Grönwall lemma 2p Z E[(Zt − Z t ) ] ≤ t 2p Z (2p − 1)|α|E[(Zs − Z s ) ]]ds + 0 0 with a constant C that depends on |α|. 31 t |α|E[(Z s − Z τ (s) )2p ]ds ≤ C∆tp References [1] I.H. Abbott and A.E. von Doenhoff. Theory of Wing Sections. Dover Publications, 1959. 21 [2] M. Bergmann and A. Iollo. Numerical simulation of horizontal-axis wind turbine (HAWT). In International Conference on Computational Fluid Dynamics (ICCFD7), 2012. 1 [3] F. Bernardin, M. Bossy, C. Chauvin, P. Drobinski, A. Rousseau, and T. Salameh. Stochastic Downscaling Methods : Application to Wind Refinement. Stoch. Environ. Res. Risk. Assess., 23(6), 2009. 1, 4, 5, 7 [4] F. Bernardin, M. Bossy, C. Chauvin, J-F. Jabir, and A. Rousseau. Stochastic Lagrangian Method for Downscaling Problems in Computational Fluid Dynamics. ESAIM: M2AN, 44(5):885–920, 2010. 1, 2, 4, 28 [5] M. Bossy, J. Fontbona, P-E. Jabin, and J-F. Jabir. Local Existence of Analytical Solutions to an Incompressible Lagrangian Stochastic Model in a Periodic Domain. Communications in Partial Differential Equations, 38(7):1141–1182, 2013. 3, 4 [6] M. Bossy and J.-F. Jabir. Lagrangian stochastic models with specular boundary condition. Journal of Functional Analysis, 268(6):1309 – 1381, 2015. 3 [7] P. Carlotti. Two-point properties of atmospheric turbulence very close to the ground: Comparison of a high resolution les with theoretical models. Boundary-Layer Meteorology, 104(3):381–410, 2002. 7, 8 [8] L.P. Chamorro and F. Porté-Agel. Effects of thermal stability and incoming boundary-layer flow characteristics on windturbine wakes: A wind-tunnel study. Boundary-Layer Meteorology, 136(3):515–533, 2010. 15, 16 [9] P. Drobinski. Wind and Solar Renewable Energy Potential Resources Estimation, chapter Solar energy conversion and photoenergy systems. Encyclopedia of Life Support Systems. Encyclopedia of Life Support Systems (EOLSS), Developed under the Auspices of the UNESCO, Eolss Publishers, Oxford, UK, 2014. 6 [10] P. Drobinski, P. Carlotti, J.-L. Redelsperger, V. Masson, R.M. Banta, and R.K. Newsom. Numerical and experimental investigation of the neutral atmospheric surface layer. J. Atmos. Sci., (64):137–156, 2007. 6, 19 [11] P.-A. Durbin and C.-G. Speziale. Realizability of second-moment closure via stochastic analysis. J. Fluid Mech., 280:395–407, 1994. 6 [12] A. El Kasmi and C. Masson. An extended model for turbulent flow through horizontal-axis wind turbines. Journal of Wind Engineering and Industrial Aerodynamics, 96(1):103 – 122, 2008. 9 [13] A. Hallanger and I.Ø. Sand. CFD Wake Modelling with a BEM Wind Turbine Sub-Model. Modeling, Identification and Control, 34(1):19–33, 2013. 1 [14] M. Hansen. Aerodynamics of wind turbines. Earthscan, London, 2008. 9, 10, 21, 23 [15] D.C. Haworth. Progress in probability density function methods for turbulent reacting flows. Progress in Energy and Combustion Science, 36(2):168 – 259, 2010. 1 [16] A. Kebaier. Statistical romberg extrapolation: a new variance reduction method and applications to option pricing. The Annals of Applied Probability, 15(4):2681–2705, 2005. 30 [17] P.M. Lafore et al. The meso-nh atmospheric simulation system. part i: Adiabatic formulation and control simulations. Annales Geophysicae, 16:90–109, 1998. 8 [18] J.F. Manwell, J.G. McGowan, and A.L. Rogers. Wind Energy Explained: Theory, Design and Application. John Wiley & Sons, Ltd, 2002. 9, 10, 23 [19] I. Masters, R. Malki, A.J. Williams, and T.N. Croft. A modified k-epsilon turbulence model for tidal stream turbine simulations using a coupled bem-cfd model. ICOE, 2012. 9 [20] R. Mikkelsen. Actuator Disc Methods Applied to Wind Turbines. Doctoral dissertation, Technical University of Denmark, 2003. 9 [21] J.-P. Minier and E. Peirano. The pdf approach to turbulent polydispersed two-phase flows. Physics Reports, 352(1-3):1– 214, 2001. 1 [22] J.-P. Minier, E. Peirano, and S. Chibbaro. Weak first- and second-order numerical schemes for stochastic differential equations appearing in Lagrangian two-phase flow modeling. Monte Carlo Methods and Applications, 9(2):129–135, 2003. 29 [23] J.-P. Minier and J. Pozorski. Wall-boundary conditions in probability density function methods and application to a turbulent channel flow. Physics of Fluids, 11(9):2632–2644, 1999. 7, 8 [24] S.B. Pope. Lagrangian pdf methods for turbulent flows. Annu. Rev. Fluid Mech., 26:23–63, 1994. 2, 4 [25] S.B. Pope. Turbulent flows. Cambridge University Press, Cambridge, 2000. 1, 2, 3, 4, 6 [26] F. Porté-Agel, Hao Lub, and Y.-T. Wu. A large-eddy simulation framework for wind energy applications. In In the Fifth International Symposium on Computational Wind Engineering (CWE2010), 2010. 9 32 [27] P.-A. Raviart. An analysis of particle methods. In Numerical methods in fluid dynamics (Como, 1983), volume 1127 of Lecture Notes in Math., pages 243–324. Springer, Berlin, 1985. 4 [28] P.E. Réthoré, N.N. Sørensen, A. Bechmann, and F. Zahle. Study of the atmospheric wake turbulence of a cfd actuator disc model. In In Proceedings of European Wind Energy Conference, Marseille, France, 2009. 16-19 March. 10 [29] H. Schmidt and U. Schumann. Coherent structure of the convective boundary layer derived from large-eddy simulations. J. Fluid Mech., 1989. 8 [30] J.N. Sørensen and A. Myken. Unsteady actuator disc model for horizontal axis wind turbines. Journal of Wind Engineering and Industrial Aerodynamics, 39(1–3):139 – 149, 1992. 1 [31] S. Sunada, A. Sakaguchi, and K. Kawachi. Airfoil section characteristics at a low reynolds number. ASME. J. Fluids Eng., 119(1):129–135, 1997. 17 [32] Y.-T. Wu and F. Porté-Agel. Large-eddy simulation of wind-turbine wakes: Evaluation of turbine parametrisations. Boundary-Layer Meteorology, 138(3):345–366, 2011. 15, 17, 18, 24 [33] Y.-T. Wu and F. Porté-Agel. Simulation of turbulent flow inside and above wind farms: Model validation and layout effects. Boundary-Layer Meteorology, 146(2):181–205, 2013. 9 33
5cs.CE
Finding Model-Checkable Needles in Large Source Code Haystacks: Modular Bug-Finding via Static Analysis and Dynamic Invariant Discovery Mohammad Amin Alipour,∗ Alex Groce,∗ Chaoqiang Zhang,∗ Anahita Sanadaji,∗ and Gokul Caushik,∗ arXiv:1609.06382v1 [cs.SE] 20 Sep 2016 ∗ School of Electrical Engineering and Computer Science Oregon State University {alipourm,grocea,zhangch,alipourm,sanandaa,caushikg}@onid.oregonstate.edu Abstract—In this paper, we present a novel marriage of static and dynamic analysis. Given a large code base with many functions and a mature test suite, we propose using static analysis to find functions 1) with assertions or other evident correctness properties (e.g., array bounds requirements or pointer access) and 2) with simple enough control flow and data use to be amenable to predicateabstraction based or bounded model checking without human intervention. Because most such functions in realistic software systems in fact rely on many input preconditions not specified by the language’s type system (or annotated in any way), we propose using dynamically discovered invariants based on a program’s test suite to characterize likely preconditions, in order to reduce the problem of false positives. While providing little in the way of verification, this approach may provide an additional quick and highly scalable bug-finding method for programs that are usually considered “too large to model check.” We present a simple example showing that the technique can be useful for a more typically “model-checkable” code base, even in the presence of a poorly designed test suite and bad invariants. While new tools and techniques are being devised to conquer software verification problems, software systems themselves are becoming more complicated, with multiple layers of software/hardware interactions, functioning in dynamic, uncertain environments. Even where teams of model checking experts are in place, and formal verification is acknowledged as a valuable practice, model checking is seldom applied to complete modern code bases for realistic-scaled systems. For example, while model checking was applied to small portions (typically 10,000 lines or less) of the code base for NASA/JPL’s Curiosity rover [12], even the Laboratory for Reliable Software did not attempt to apply model checking to the full approximately 2 million lines of Curiosity software. Static analysis methods, on the other hand, are expected to scale to real-world code bases. Even the popular technical press [14] has noted the use of Coverity and other tools on huge code bases for the Curiosity rover, the CERN particle accelerator, and other big mission-critical systems. While model checking can be applied to whole systems when a research team drives the system design and realworld deadlines and constraints are removed, its role in most critical system development efforts is typically relegated to verifying (or finding bugs in) small components. One approach to escaping this limitation is to enhance the fundamental scalability of model checking by using abstraction or other techniques to manage huge state spaces, and especially by using compositional reasoning [4], [6], [9], [10] to handle large code bases. Such efforts are an important contribution, but thus far have yet to crack anything like the 1 million LOC mark in an automated fashion. Beyond the fundamental problem of the state space explosion, there is a second scalability problem with most current model checking tools: they are far less “industrially hardened” than commercial static analysis tools, and fail for a variety of essentially engineering reasons for very large code bases — partly because they are seldom tested on more than a few thousand lines of code at a time. Model checking tools work best, and most automatically, when given code fragments only the size of a few small functions, in which case both predicate abstraction [4] and bounded model checking [3], [5] can be used even by upper-level undergraduate students to verify properties and find subtle bugs. This fact may lie behind the success of model checkers for finding bugs in container classes [15]. This paper proposes and presents very preliminary results for a novel “modular” method for applying model checking automatically to real-world code bases that does not require conquering the state-space explosion problem, or automatically decomposing such a system into components in the traditional fashion for verification. We propose to exploit precisely the current strengths of model checking by mining a large code base for small, self-contained, portions of code suitable for push-button model checking. The core idea is to use static analysis to identify functions (or small sets of functions) without recursion or recursive datatypes, overly complex pointer Figure 1: The core workflow of our modular verification approach manipulations, or whatever other features typically frustrate model checking efforts. Additionally, such code fragments should contain assertions or other statements (e.g. array or pointer accesses, system calls) that make it easy to generate properties to check without human intervention. We call our search verification task triage: our contribution is to propose that one effective way to apply model checking to large systems is to simply cherry pick the parts of the system that can be model checked. This turns on its head the usual effort to apply human effort to verifying the components of most interest in a large system, which can proceed independently. Our approach to “modular verification” works more like many static analysis algorithms, which “give up” on pointers when alias analysis fails, and abandon overly complex paths. A more fanciful way to understand the idea is to consider the not infrequent occasion of a graduate student or model checking researcher combing a large, critical system (e.g. OpenSSL) for some functions suitable for specification and verification. We aim to replace such a human with a static analysis algorithm that is less intelligent, but much faster and able to generate many likely candidates rather than being satisfied after finding one or two functions. Unfortunately, naive verification task triage plus model checking is unlikely to yield effective results, even for the purpose of bug finding. We believe that most functions in complex code bases rely on preconditions over inputs and data values accessed that are not represented by the language’s type system or by other annotations. Model checking without these preconditions will probably lead to an unmanageable number of uninteresting bug reports — the false positives that have always plagued static analysis efforts. We propose to mitigate this problem by using dynamic invariant detection [7] in a (to our knowledge) novel way: as a tool for generating approximations of preconditions needed to avoid false positives in large code bases. The idea, shown in Figure 1, involves a twostage workflow. First, we perform verification task triage to identify suitable small pieces of code to model checking a large code base. Then, the test suite for the large system is run, with instrumentation inserted to extract trace information over the suitable functions. Dynamic invariant generation takes program traces and identifies, via “empirical” rather than static means, invariants — propositions that are true for all observed executions of the system. These invariants are then used to annotate the triage-identified functions with “preconditions” generalizing the data values seen during execution of the test suite. The annotated pieces of code are model checked, with the expectation that any bugs detected are likely to be real faults since the invariants ensure that data ranges and relationships are like those observed over the test suite. As a simple example, consider the case of a function f that takes as one input a value int m. In typical worldworld C code, m may in fact represent a highly constrained quantity, such as the number of minutes since midnight, but the type system will not express this constraint. Model checking f without this information may produce a counterexample involving, for example, integer overflow due to multiplying m by 60. Even if a real off-by-one bug exists when m = 1, the overflow bug may be much easier for a SAT solver in a bounded model checker to detect. Model checking the code with the added assumption that 0 <= m < 3600, however, the model checker will report the real bug. Even though 1 did not appear in the test suite, the generalization algorithms in the invariant detector generalized the actual input range to include it. Extremely large values of m also did not appear during test suite execution, of course, but the range observed was sufficiently small that invariant detection proposed that the range was likely restricted. An obvious objection to this approach is that the invariants from a test suite will often over-constrain the behavior of many small components, unless the test suite is very high quality. We hope that even highly inaccurate invariants may allow a model checker to find a real bug. For example, in the case of f, if the test suite falsely suggests that 0 <= m < 60 because tests only run for 1 hour, the model checker can still find the real bug. Our claim is that our use of dynamic invariants relies on their ability to crudely “carve away” the data values that a function is not expected to work rather than on their strict accuracy. A gross underapproximation of behavior can still lead to the discovery of real bugs, while an overappoximation buries a user in false positives. We provide suggestive evidence for the possibility that poor invariants can still be useful by applying our technique to a simple container class and a radically non-representative test suite. A more complex example with hand-generated “invariants” shows that even simple triage can discover useful targets for verification and avoid false positives using invariants. In the remainder of the paper, we first discuss key related work in Section I, to place our core idea in context, elaborate our proof-of-concept example in Section II, demonstrate verification triage in Section III, and discuss the challenges in bringing the full vision of a “static analysis-like” approach to modularity for model checking in Section IV. I. R ELATED W ORK To our knowledge, the idea of mining large code bases for arbitrary sub-components suitable for model checking has not been previously explored. The most closely related ideas are efforts to scale model checking by approximating the weakest precondition under which a sub-component satisfies its correctness properties [2], [6], [11]. The primary difference is that where these methods aim to learn or iterate to a “good” assumption that is as weak as possible, we simply want a precondition that removes false positives, even if it is too strong, and, of course, that such methods have no concept of mining a code base for possible targets for model checking. II. E XAMPLE : B INARY T REES As a simple example of how our approach might work in practice, assuming that an effective verification task triage can be designed, we apply our method to a frequently studied binary tree implementation [8], [15]. We use a RepOK function to test the validity of the tree structure, and have implemented a simple random testing system to test it, shown in Figure 3. We choose to verify the remove function, and instrument the code for the binary tree with extended invariants [1], as shown in Figure 2/footnoteInstrumentation for add, not remove is shown as it is easier to follow. to help us limit the behavior of the code to valid trees only. We use Daikon [7] to infer invariants from all traces generated during random testing. Extended invariants introduce history variables that allow Daikon to provide “invariants” in the form of code coverage facts as well as more traditional data invariants, to capture relationships such as, e.g., that a loop always executes a number of times equal to twice the value of a certain input. Unfortunately, when running the random tester for 5,000 tests, we choose to use tests with a maximum length of only 4 steps, which leads to extended invariants that radically underapproximate the behavior of the class: public void add(int x) { Node current = root; if (root == null) { br0 = br0 + 1; root = new Node(x); return; } while (current.value != x) { if (x < current.value) { if (current.left == null) { br1 = br1 + 1; current.left = new Node(x); } else { br2 = br2 + 1; current = current.left;} } else { if (current.right == null) { br3 = br3 + 1; current.right = new Node(x); } else { br4 = br4 + 1; current = current.right; } } } } Figure 2: Function add after instrumentation for branch count. this.br1 one of { 0, 1, 2 } this.br3 one of { 0, 1, 2 } Using these invariants (which restrict the structure to up to two right children or up to two left children), we generate a simple CBMC harness, knowing (thanks to our triage and invariant examination) that a shallow loop unwinding will suffice, and that no types encountered are likely to make verification difficult, as shown in Figure 4. With this extremely restricted harness, CBMC was able to find the bug in binary tree [8], despite the fact that the shallow random testing did not discover the bug. III. S IMPLE V ERIFICATION TASK T RIAGE Given that using even poor tests to generate potentially incorrect invariants for model checking can still lead to fast, effective bug discovery, the core of our modular verification approach becomes finding functions where this can be applied to large, real-world code bases. Figure 5 shows a function from the source code for version 1.6 of Mozilla’s SpiderMonkey JavaScript engine. This function was automatically identified using a very simple 100-line Python script that crawls through a set of C source files and identifies functions that: • do contain at least some assert statement or potentially crashing memory dereference (i.e., functions Random rand = new Rand(20); for(i = 0; i < N; i ++){ BinTree SUT = new BinTree(); for(int j = 0; j < M; j++){ int op = rand.nextInt(3); int value = rand.nextInt(20); switch(op){ case 0: SUT.add(value); break; case 1: SUT.remove(value); break; case 2: SUT.find(value); break; } assert(SUT.RepOK()); } } Figure 3: A simple random tester for the BinTree. void main() { int v1,v2,v3,v4; // symbolic inputs /* Using calls for simplicity; in practice would encode structure from Daikon invariants as a series of assumptions. */ add(v1); add(v2); add(v3); /* Invariant */ assume(0<=br1 && br1<=2 && 0<=br2 && br2<=2); remove(v4); assert(repOK); } Figure 4: CBMC Harness for BinTree. that have a “specification” even without human intervention) and • do not take parameters or declare local variables that cannot be resolved to simple C types (int, short, long, void, and char). This triage approach is both over-restrictive (in many cases functions taking structures or arrays as input can be handled easily) and not restrictive enough (it does not filter out functions with recursion or references to global values of “bad” types). In practice, we expect triage to require a deeper static analysis that includes more types and uses summaries of functions called by a function. Calling a “bad” function is not necessarily a problem, because the return value may be replaced by a value generated by our invariant generator in many cases. Even using this simplistic version of triage, however, we can obtain results. Reading through the roughly 40K lines of non-comment C code in SpiderMonkey 1.6 would be a time-consuming task for a human, even ignoring the need to resolve typedefs. The 11 functions chosen as possible verification targets by the simple algorithm include some unsuitable targets (including one case where the textual type analysis fails to notice a complex compiler state structure parameter). A few functions are simple bittwiddling or offset-computing code that can be trivially verified without invariants. The code in Figure 5 however is of considerably more interest. It implements the BoyerMoore-Harspool substring-finding algorithm [13]. After resolving the types to ground C types and choosing string sizes based on jsfunfuzz tests, we were able to incrementally increase loop bounds to not only verify memory safety for chosen strings, but to “discover” the worst case complexity of the algorithm, the point where unwinding assertions held. When we introduce an off-by-one error into the code (a case that should not be found by our testing due to the values chosen for start, we believe), CBMC instantly detects the error. On the one hand, because the size of strings analyzed is relatively small, this is not a complete verification of the Boyer-Moore-Horspool implementation in SpiderMonkey. On the other hand, in practice for bug finding, an informal “small model” assumption suggests that most code that works for all small inputs works for large inputs, at least short of integer overflow problems. Note that the small input size bounds in our verification are used to also generate small array sizes, so we can detect memory safety problems with small inputs, because our memory bounds are also artificially small due to the way we translate the code into a verification problem. One problem with this approach is that when small inputs can lead to larger outputs, and this invariant is not detected, our approach might result in false positives. It remains to be seen how important this is in practice. That a Boyer-Moore-Horspool implementation is the most interesting verification target detected by our initial triage system is fitting. The problem of finding a substring is often discussed (as in the Wikipedia entry for the algorithm) as the “needle in a haystack” problem with the pattern to find called the “needle.” Our approach is essentially the search for model-checkable needles in the haystacks of large, complex software systems not otherwise amenable to formal verification without large investments of expert effort. IV. C ORE C HALLENGES AND F UTURE W ORK We speculate that while model checking cannot apply to as many functions as static analysis, our method may be of considerable value for bug detection because of the jsint js_BoyerMooreHorspool(const jschar *text, jsint textlen, const jschar *pat, jsint patlen, jsint start) { jsint i, j, k, m; uint8 skip[BMH_CHARSET_SIZE]; jschar c; JS_ASSERT(0 < patlen && patlen <= BMH_PATLEN_MAX); for (i = 0; i < BMH_CHARSET_SIZE; i++) skip[i] = (uint8)patlen; m = patlen - 1; for (i = 0; i < m; i++) { c = pat[i]; if (c >= BMH_CHARSET_SIZE) return BMH_BAD_PATTERN; skip[c] = (uint8)(m - i); } for (k = start + m; k < textlen; k += ((c = text[k]) >= BMH_CHARSET_SIZE) ? patlen : skip[c]) { for (i = k, j = m; ; i--, j--) { if (j < 0) return i + 1; if (text[i] != pat[j]) break; } } return -1; } Figure 5: Verification target from Mozilla SpiderMonkey 1.6 source. precision and complete exploration of model checking. However, the critical question is whether dynamic invariants can actually produce accurate enough preconditions to reduce the false positive rate to a manageable level. Determining whether dynamic invariants over even poor test suites can still find bugs for realistic systems requires the development of a tool for automatic verification task triage. Our initial efforts suggest that this task is complex, though not infeasible. In particular, our early efforts to triage C programs have shown that the first steps are identifying code patterns that frustrate a particular model checker, and this requires a complete analysis of the accessed data types and call graphs from each function for “bad” patterns, like complex recursive data structures or system calls. We have identified some likely candidate functions in the Mozilla JavaScript engine and SQLite, and plan to use these modest sized code bases to tune a method for handling larger programs with more complex build environments. The next steps are continued development of the triage tools and experimentation with actual invariants from the test suites for our subject programs. R EFERENCES [1] M.A. Alipour and A. Groce. Extended program invariants: applications in testing and fault localization. In Proceedings of the 2012 Workshop on Dynamic Analysis, pages 7–11. ACM, 2012. [2] R. Alur, P. Madhusudan, and W. Nam. Symbolic compositional verification by learning assumptions. In Computer Aided Verification, pages 289–292. Springer, 2005. [3] Armin Biere, Alessandro Cimatti, Edmund M. Clarke, and Yunshan Zhu. Symbolic model checking without BDDs. In Tools and Algorithms for the Construction and Analysis of Systems, pages 193– 207, 1999. [4] S. Chaki, E. Clarke, A. Groce, S. Jha, and H. Veith. Modular verification of software components in C. In International Conference on Software Engineering, pages 385–395, 2003. [5] E. Clarke, D. Kroening, and F. Lerda. A tool for checking ansi-c programs. Tools and Algorithms for the Construction and Analysis of Systems, pages 168–176, 2004. [6] J.M. Cobleigh, G.S. Avrunin, and L.A. Clarke. Breaking up is hard to do: an investigation of decomposition for assume-guarantee reasoning. In Proceedings of the 2006 international symposium on Software testing and analysis, pages 97–108. ACM, 2006. [7] M.D. Ernst, J.H. Perkins, P.J. Guo, S. McCamant, C. Pacheco, M.S. Tschantz, and C. Xiao. The daikon system for dynamic detection of likely invariants. Science of Computer Programming, 69(1):35–45, 2007. [8] J. Geldenhuys, M.B. Dwyer, and W. Visser. Probabilistic symbolic execution. In Proceedings of the 2012 International Symposium on Software Testing and Analysis, pages 166–176. ACM, 2012. [9] M. Gheorghiu Bobaru, C. Păsăreanu, and D. Giannakopoulou. Automated assume-guarantee reasoning by abstraction refinement. In Computer Aided Verification, pages 135–148. Springer, 2008. [10] M. Gheorghiu Bobaru, C. Păsăreanu, and D. Giannakopoulou. Automated assume-guarantee reasoning by abstraction refinement. In Computer Aided Verification, pages 135–148. Springer, 2008. [11] D. Giannakopoulou, Z. Rakamarić, and V. Raman. Symbolic learning of component interfaces. Static Analysis, pages 248–264, 2012. [12] Alex Groce, Gerard Holzmann, Rajeev Joshi, and Ru-Gang Xu. Putting flight software through the paces with testing, model checking, and constraint-solving. In International Workshop on Constraints in Formal Verification, pages 1–15, 2008. [13] R. N. Horspool. Practical fast searching in strings. Software Practice & Experience, 10(6):501–506, 1980. [14] Anna Leach. Boffins zapped ’2,000 bugs’ from Curiosity’s 2 MILLION lines of code. http://www.theregister.co.uk/2012/08/ 22/mars rover software coverity/. [15] W. Visser, C.S. Păsăreanu, and R. Pelánek. Test input generation for Java containers using state matching. In Proceedings of the 2006 international symposium on Software testing and analysis, pages 37–48. ACM, 2006.
6cs.PL
arXiv:1207.4721v2 [math.AC] 29 Jan 2013 ON THE ASCENDING CHAIN CONDITION FOR MIXED DIFFERENCE IDEALS ALEXANDER LEVIN Abstract. We show that the ring of difference polynomials over a difference field does not satisfy the ascending chain condition for mixed difference ideals. This result solves an open problem of difference algebra stated by E. Hrushovski in connection with the development of difference algebraic geometry. 1. Introduction Recently E. Hrushovski [2] developed the theory of difference schemes where the key role is played by mixed difference ideals and well-mixed difference rings (these rings appear as difference factor rings by mixed difference ideals; the corresponding definitions are presented in the next section). Any difference integral domain, as well as any difference ring whose structure endomorphism is Frobenius, is wellmixed. The most attractive property of the class of well-mixed rings is the fact that they admit a reasonable theory of localization; as it is shown in [2, Chapter 3], a difference scheme based on well-mixed rings makes sense intrinsically, without including the generating difference rings explicitly in the data. In [2], E. Hrushovski raised an important question whether mixed difference ideals of R satisfy the ascending chain condition. In this paper, we resolve this open problem. We present a process of “shuffling” (see Lemma 3.1) for the construction of the mixed difference ideal generated by a set and use this construction to prove that a ring of difference polynomials over a difference field does not satisfy the ascending chain condition for mixed difference ideals. 2. Background information Recall that a difference ring is a commutative ring R considered together with a finite set Σ of mutually commuting injective endomorphisms of R called translations. If Σ consists of one translation, we say that the difference ring R is ordinary, otherwise, it is called partial. In what follows, we consider only ordinary difference rings. If σ is the translation of such a difference ring R, we say that R is a σ-ring. For any element a ∈ R, an element of the form σ k (a) (k ∈ N) is said to be a transform of a. (As usual, N denotes the set of all nonnegative integers.) In what follows, such an element will be also denoted by ak (if k = 0, we write a instead of a0 ). If a difference ring R with translation σ is a field, it is called a difference field or a σ-field. Date: November 12, 2017. 2000 Mathematics Subject Classification. Primary 12H10; Secondary 39??? Key words and phrases. Difference ring, difference ideal, difference polynomial. The author was supported by NSF Grant CCF #1016608. 1 2 ALEXANDER LEVIN Let R be a difference (σ-) ring and R0 a subring of R such that σ(R0 ) ⊆ R0 . Then R0 is called a difference (or σ-) subring of R and the ring R is said to be a difference (or σ-) overring of R0 . In this case, the restriction of the translation on R0 is denoted by same symbol σ. If J is an ideal of R such that σ(J) ⊆ J, then J is called a difference (or σ-) ideal of R. A σ-ideal J of R is called reflexive if for any a ∈ R, the inclusion a1 ∈ J (a ∈ R) implies a ∈ J. If a prime ideal P of R is closed with respect to σ (that is, σ(P ) ⊆ P ), it is called a prime difference (or prime σ-) ideal of R. If S is a subset of R, then the intersection of all σ-ideals of R containing S is denoted by [S]. Clearly, [S] is the smallest σ-ideal of R containing S; as an ideal, it is generated by the set {σ k (a)|a ∈ S, k ∈ N}. If J = [S], we say that the σ-ideal J is generatedby the set S called a set of difference (or σ-) generators of J. If S is finite, S = a(1) , . . . , a(m) , we write   J = a(1) , . . . , a(m) and say that J is a finitely generated σ-ideal of R. In this case, the elements a(1) , . . . , a(m) are said to be σ-generators of J. Let R be a difference (σ-) ring, R0 a σ-subring of R and B ⊆ R. The intersection of all σ-subrings of R containing R0 and B is called the σ-subring of R generated by the set B over R0 , it is denoted by R0 {B}. As a ring, R0 {B} coincides with the ring R0 [{bk | b ∈ B, k ∈ N}] obtained by adjoining the set {bk | b ∈ S, k ∈ N} to R0 . The set B is said to be the set of difference  (or σ-) generators of the difference ring R0 {B} over R0 . If this set is finite, B = b(1) , . . . , b(m) , we say that R′ = R0 {B} is a finitely generated difference (or σ-) ring extension (or overring) of R0 and write  R′ = R0 b(1) , . . . , b(m) . If I is a reflexive difference ideal of a difference (σ- ) ring R, then the factor ring R/I has a unique structure of a σ-ring such that the canonical surjection R → R/I is a difference homomorphism, that is, a ring homomorphism commuting with the action of σ. In this case, R/I is said to be the difference (or σ-) factor ring of R by I.  Let U = u(λ) |λ ∈ Λ be a family of elements in some σ-overring of a difference (σ-) ring R. We say that the family U is transformally (or σ-algebraically) dependent over R, if the family (λ) U σ = {uk | k ∈ N, λ ∈ Λ} is algebraically dependent over R (that is, there exist elements v (1) , . . . , v (m) ∈ U σ and a nonzero polynomial f in m variables with coefficients from R such that f v (1) , . . . , v (m) = 0). Otherwise, the family U is said to be transformally (or σ-algebraically) independent over R or a family of difference (or σ-) indeterminates over R. In the last case, the σ-ring R{U } is called the algebra of difference (or σ-) polynomials in the difference (or σ-) indeterminates u(λ) (λ ∈ Λ) over R. As it is shown in [1, Chapter 2, Theorem I] (see also [4, Proposition 3.3.7] for the partial case), if I is an arbitrary set, then there exists an algebra of difference polynomials over R in a family of difference indeterminates with indices from the set I. If S and S ′ are two such algebras, then there exists a difference isomorphism ON THE ASCENDING CHAIN CONDITION FOR MIXED DIFFERENCE IDEALS 3 S → S ′ that leaves all elements of the ring R fixed. If R is an integral domain, then any algebra of difference polynomials over R is an integral domain. The algebra of difference (σ-) polynomials in a set of indeterminates {yi | k ∈ N, i ∈ I} over R is constructed as follows. Let S be the polynomial R-algebra in a countable set of indeterminates  (i) yk | i ∈ I, k ∈ N . For any f ∈ S, let σ(f ) denote the polynomial from S obtained by replacing every (i) (i) indeterminate yk that appears in f by yk+1 and every coefficient a ∈ R by σ(a). We obtain an injective endomorphism S → S that extends σ (this extension is also (i) (i) denoted  (i) by σ). Setting y = y0 , we obtain a σ-algebraically independent over R set y | i ∈ I such that   S = R y (i) i∈I . Thus, S is an algebra of σ-polynomials over R in a family of σ-indeterminates  y (i) |i ∈ I . A difference ideal I of a difference ring R is called perfect if for any a ∈ R and k1 , . . . , km , d1 , . . . , dm ∈ N (m ≥ 1), the inclusion adk11 . . . adkm ∈ J implies a ∈ J. It m is easy to see that every perfect ideal is reflexive and every reflexive prime difference ideal is perfect. If B ⊆ R then the intersection of all perfect difference ideals of R containing B is the smallest perfect difference ideal containing B. It is denoted by {B} and called the perfect closure of the set B  or the perfect difference ideal generated by B. (It will be always clear whether a(1) , . . . , a(m) denotes the set consisting of the elements a(1) , . . . , a(m) or the perfect difference ideal generated by these elements.) The construction of the perfect closure via a process of “shuffling” is described in [1, Chapter 3, section 2] where one can also find a proof of the basis theorem, which states that if an ordinary difference ring R satisfies the ascending chain condition (ACC) for perfect difference ideals (in this case R is called a Ritt difference ring), then the ring of difference polynomials R{y (1) , . . . , y (m) } in a finite set of difference indeterminates satisfies ACC for perfect difference ideals as well (the partial version of this theorem, the process of ”shuffling” and some other properties of perfect difference ideals are presented in [4, Section 2.3]). The role of perfect difference ideals (in particular, in the difference version of Nullstellensatz) is similar to the role of radical ideals in commutative rings. Every perfect difference ideal of a difference ring R is the intersection of a family of reflexive prime difference ideals of R, and if R is a Ritt difference ring, then every perfect difference ideal of R is the intersection of a finite number of reflexive prime difference ideals, see [1, Chapter 3, Section 7]. (Generalizations of these results to partial difference and difference-differential rings can be found in [3, Chapter 3].) A difference ideal I of an ordinary difference (σ-) ring R is called mixed if the inclusion ab ∈ I (a, b ∈ R) implies that ab1 ∈ I. (Note that E. Hrushovski [2] uses the term “well-mixed” for a mixed difference ideal; we follow here the original terminology of R. Cohn.) One can see that every perfect ideal is mixed and that a σ-ideal I is mixed if and only if for any nonempty set S ⊆ R, I : S = {a ∈ R | as ∈ I for every s ∈ S} is a difference ideal of R. Furthermore, the radical of any mixed reflexive difference ideal is a perfect difference ideal. As an example of a mixed difference ideal, which 4 ALEXANDER LEVIN is not perfect, one can consider the ideal   J = y 2 , yy1 , yy2 . . . of the ring R = K{y} of difference polynomials in one difference indeterminate y over an ordinary difference field K. Indeed, J is mixed since it consists of all difference polynomials in which every term is at least of second degree in the indeterminates y, y1 , y2 , . . . . At the same time, J is not perfect, since y ∈ {J} = [y], but y ∈ / J. Note also that the property that determines a mixed difference ideal provides a bridge between prime difference ideals and σ-prime difference ideals in the sense of the author [4, Definition 2.3.20] as well as in the sense of M. Wibmer [6, Definition 1.4.3] (who calls them φ-ideals denoting the basic translation by φ). The last type of difference ideals plays the key role in the M. Wibmer’s geometric Galois theory developed in [6]. One can straightforwardly check that any mixed σ-prime (in any of the two senses) difference ideal is prime. 3. The main result Let R be an ordinary difference ring with translation σ. For any subset S of R, let hSi denote the smallest mixed difference ideal containing S. Furthermore, let S ′ denote the set {ab1 | ab ∈ S} (recall that we write b1 for σ(b)). Note that S ⊆ S ′ , since any s ∈ S can be written as s11 where s1 ∈ S.  ′ Lemma 3.1. With the above notation, let S [0] = S and S [n] = S [n−1] (n = 1, 2, . . . ). Then ∞ [ hSi = S [n] . n=0 S∞ [n] Proof. It is clear that n=0 S is a mixed difference ideal of R containing S (if an element ab lies in this union, then ab ∈ S [n] for some n, hence ab1 ∈ S [n+1] ). Therefore, ∞ [ hSi ⊆ S [n] . n=0 Conversely, S ⊆ hSi and for any set A ⊆ R, the inclusion A ⊆ hSi implies that [A]′ ⊆ hSi, since the difference ideal hSi is mixed. Proceeding by induction on n, we obtain that S [n] ⊆ hSi for all n = 1, 2, . . . .  Let K{y} be the ring of difference polynomials in one difference indeterminate y over an ordinary difference ring K with translation σ. In what follows power products of the form yik11 . . . yikmm , m ≥ 1, iν , kν ∈ N, ν = 1, . . . , m will be called terms and the number k1 + · · · + km will be called the degree of such a term. Clearly, every difference polynomial f in K{y} has a unique representation as a finite sum of terms with nonzero coefficients from K. If a term t appears in such a representation, we will say that t is contained in f . Furthermore, if t = yik11 . . . yikmm where the transforms of y are arranged in the increasing order (that is, i1 < · · · < im ), then the nonnegative integer im − i1 will be called the effective order of t and denoted by Eord(t). Note that for any term t, Eord(tk ) = Eord(t), k ∈ N. ON THE ASCENDING CHAIN CONDITION FOR MIXED DIFFERENCE IDEALS 5 Let U denote the set of terms {u(1) , u(2) , . . . }, where u(n) = yn+2n −1 yn+2n+1 −1 , n = 0, 1, 2, . . . , and let A(1) = u(0) + u(1) = yy1 + y2 y4 , A(n) A(2) = u(2) + u(3) = y5 y9 + y10 y18 , ... (2n−2) (2n−1) =u +u = y2n−3+22n−2 y2n−3+22n−1 + y2n−2+22n−1 y2n−2+22n , ... . Remark 3.2. Note that  Eord u(n) = 2n , n ∈ N. Furthermore, the effective orders of terms of the set U are all distinct and, moreover, if u(i) , u(j) , u(k) , and u(l) are distinct elements of U , then     Eord u(i) − Eord u(j) 6= Eord u(k) − Eord u(l) ,     Eord u(i) + Eord u(j) 6= Eord u(k) + Eord u(l) , and     Eord u(i) − Eord u(j) 6= Eord u(k) + Eord u(l) . This follows from the fact that, if a, b, c, and d are distinct nonnegative integers, then 2b − 2a 6= 2d − 2c , 2b − 2a 6= 2d + 2c , and 2a + 2b 6= 2d + 2c .  Let us fix some m ≥ 1 and let S denote the set A(1) , . . . , A(m) . Furthermore, let W denote the set of all homogeneous difference polynomials of degree 2 that lie in [S] and for any n ∈ N, let W [n] denote the set of all homogeneous difference polynomials of degree 2 that lie in S [n] . Lemma 3.3. Every difference polynomial in W is irreducible.   Proof. Since W ⊂ [S] = A(1) , . . . , A(m) and A(1) , . . . , A(m) are homogeneous difference polynomials of degree 2, an arbitrary element f ∈ W can be written as a linear combination of the form ri m X X (i) λ(ij) Aj (3.1) f= i=1 j=1 (ij) with 0 6= λ ∈ K (1 ≤ i ≤ m, 1 ≤ j ≤ ri , where r1 , . . . , rm ∈ N). Suppose that f is reducible. Then it can be written as   (3.2) f = a(1) yi1 + · · · + a(p) yip b(1) yj1 + · · · + b(q) yjq , where 0 6= a(i) , b(j) ∈ K, (1 ≤ i ≤ p, 1 ≤ j ≤ q), i1 < · · · < ip , j1 < · · · < jq , and ir 6= js for any r = 1, . . . , p; s = 1, . . . , q. (The last observation follows from the fact that the effective orders of all terms of A(i) , 1 ≤ i ≤ m, are positive, so the same is true for all terms in the right-hand side of (3.1); therefore, f cannot contain a term yj2 , j ∈ N.) Furthermore, p > 1 and q > 1. Indeed, if p = 1 (or q = 1), then f is divisible by some yk . However, this is impossible, since the effective orders of all terms that appear in the right-hand 6 ALEXANDER LEVIN (i) side of (3.1) are distinct, so both terms of any Aj (1 ≤ i ≤ m, 1 ≤ j ≤ ri ) are contained in f . Clearly, these terms have no common factor. It follows that the terms v (1) = yi1 yj1 , v (2) = yi1 yj2 , v (3) = yi2 yj1 , andv (4) = yi2 yj2 , (i) which appear in elements Aj in the right-hand side of (3.1), are transforms of four distinct elements of the set U (hence they have the same effective orders as the corresponding elements of U ) and appear in the right-hand side of (3.2) with nonzero coefficients. Without loss of generality we can assume that i1 < j1 . Then   Eord v (1) = j1 − i1 , Eord v (2) = j2 − i1 , and either  Eord v (3) = i2 − j1 ,  Eord v (4) = i2 − j2 (if i2 > j2 ) or  Eord v (3) = i2 − j1 ,  Eord v (4) = j2 − i2 (if j1 < i2 < j2 ) or  Eord v (3) = j1 − i2 ,  Eord v (4) = j2 − i2 (if i2 < j1 ). In the first of these three cases, one has     Eord v (1) + Eord v (3) = Eord v (2) + Eord v (4) = i2 − i1 . In the second case,     Eord v (1) + Eord v (3) = Eord v (2) − Eord v (4) = i2 − i1 . The third case gives     Eord v (1) − Eord v (3) = Eord v (2) − Eord v (4) = i2 − i1 . Since any of the last three equalities contradicts the property of effective orders of elements of U established in Remark 3.2, we conclude that f is irreducible.  Lemma 3.4. With the above notation, W = W [n] for n = 1, 2, . . . . Proof. Since [S] ⊆ S [n] , W ⊆ W [n] . We will show the opposite inclusion by induction on n. If n = 1 and f ∈ W [1] ⊂ S [1] = [S]′ , then f = gh1 , where gh ∈ [S]. If g ∈ K or h1 ∈ K (in the last case h ∈ K), then f ∈ [S], that is, f ∈ W. If g, h ∈ / K, then g and h1 are linear homogeneous difference polynomials and hence h is also such a difference polynomial. Then gh ∈ W , which contradicts the fact that every difference polynomial in W is irreducible (see Lemma 3.3). Thus, W [1] ⊆ W , that is, W [1] = W . Suppose that W = W [n] for some n ≥ 1. Since S consists of homogeneous difference polynomials of degree 2, the sets  [1]  [S], S [1] = {f g1 | f g ∈ [S]}, S , S [2] , . . . ON THE ASCENDING CHAIN CONDITION FOR MIXED DIFFERENCE IDEALS 7 cannot contain difference polynomials with terms of degree less than 2. Therefore, any homogeneous difference polynomial h of degree 2 in [S [n] ] can be written as a linear combination of the form (3.3) h= sd d X X (i) µ(ij) Bj i=1 j=1 with 0 6= µ(ij) ∈ K, B (i) ∈ W [n] (1 ≤ i ≤ d, 1 ≤ j ≤ sd where s1 , . . . , sd ∈ N). By the inductive hypothesis, W [n] = W ⊆ [S]. Hence, h is a homogeneous difference polynomial of degree 2 in [S], that is, h ∈ W . Thus, the set of all homogeneous difference polynomials of degree 2 in S [n] coincides with W .  ′ Let f ∈ W [n+1] . Then f ∈ S [n] , so f = gh1 ,   where gh ∈ S [n] and, therefore, gh ∈ W. Repeating the arguments of the first part of the proof we obtain that f ∈ W . Thus, W [n+1] = W .  Theorem 3.5. The ring of difference polynomials K{y} over a on ordinary difference field K does not satisfy the ascending chain condition for mixed difference ideals. Proof. Let us show that, with the above notation, the chain of mixed difference ideals (3.4) A(1) ⊂ A(1) , A(2) ⊂ · · · ⊂ A(1) , A(2) , . . . A(m) ⊂ . . . is strictly ascending. Indeed, suppose that A(m+1) ∈ A(1) , A(2) , . . . A(m) for some m ≥ 1. By 3.1, there exists n ∈ N such that A(m+1) ∈ S [n] , where  Lemma (1) (2) S denotes the set A , A , . . . A(m) . Since A(m+1) is a homogeneous difference polynomial of degree 2, we can apply Lemma 3.4 and obtain that A(m+1) ∈ W ⊆ [S]. However, the inclusion   A(m+1) ∈ [S] = A(1) , A(2) , . . . A(m) is impossible, since every term of any A(i) (1 ≤ i ≤ m) and, therefore, every term of any element of   (1) (2) A , A , . . . A(m) has the effective order at most 22m−1 while A(m+1) contains terms of effective orders 22m and 22m+1 . Thus, the chain of mixed difference ideals (3.4) is strictly ascending.  8 ALEXANDER LEVIN 4. Final remarks There are two important classes of difference ideals one of which is wider and the other one is narrower than the class of mixed difference ideals. The first one is the class of complete difference ideals. A difference ideal I of a difference ring R is called complete if the reflexive closure of its radical coincides with the perfect closure of I. Equivalently, one can say that a difference ideal I is complete if the presence in I of a product of powers of transforms of an element a implies the presence in I od a power of a transform of a. As it is shown in [1, Chapter 3, Section 21], every mixed difference ideal is complete. Therefore, Theorem 3.5. implies the following result. Corollary 4.1. The ring of difference polynomials K{y} over a on ordinary difference field K does not satisfy the ascending chain condition for complete difference ideals. The other class we would like to mention is the class of all mixed radical (not necessarily reflexive) difference ideals. The reflexive closure of any such an ideal is a perfect difference ideal. We know that perfect difference ideals satisfy ACC and we also know now that a wider class of mixed difference ideals does not satisfy ACC. At the same time the question whether mixed radical ideals satisfy the ascending chain condition is still open. References 1. Cohn, R. M., Difference Algebra, Interscience, New York, 1965. 2. Hrushovski, E., The Elementary Theory of the Frobenius Automorphism. Arxiv preprint. math/0406514, 2004, pp. 1-135, arxiv.org 3. Kondrateva, M.V.; Levin, A. B.; Mikhalev, A. V.; Pankratev, E. V., Differential and Difference Dimension Polynomials. Kluwer Academic Publishers, Dordrecht, 1998. 4. Levin, A. B., Difference Algebra. Springer, New York, 2008. 5. Ritt, J. F., Raudenbush, H. W., Ideal theory and algebraic difference equations. Trans. Amer. Math. Soc., 46 (1939), 445-453. 6. Wibmer, M., Geometric Difference Galois Theory, Ph.D. thesis, University of Heidelberg, 2010. Department of Mathematics, The Catholic University of America, Washington, D.C. 20064 E-mail address: [email protected]
0math.AC
Noname manuscript No. (will be inserted by the editor) Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces arXiv:1605.01583v1 [cs.CE] 5 May 2016 Daljit Singh J. Dhillon · Michel C. Milinkovitch · Matthias Zwicker Received: date / Accepted: date Abstract In this paper we present computational techniques to investigate the solutions of two-component, nonlinear reaction-diffusion (RD) systems on arbitrary surfaces. We build on standard techniques for linear and nonlinear analysis of RD systems, and extend them to operate on large-scale meshes for arbitrary surfaces. In particular, we use spectral techniques for a linear stability analysis to characterize and directly compose patterns emerging from homogeneities. We develop an implementation using surface finite element methods and a numerical eigenanalysis of the Laplace-Beltrami operator on surface meshes. In addition, we describe a technique to explore solutions of the nonlinear RD equations using numerical continuation. Here, we present a multiresolution approach that allows us to trace solution branches of the nonlinear equations efficiently even for large-scale meshes. Finally, we demonstrate the working of our framework for two RD systems with applications in biological pattern formation: a Brusselator model that has been used to model pattern development on growing plant tips, and a chemotactic model for the formation of skin pigmentation patterns. While these models have been used previously on simple geometries, our framework allows us to study the impact of arbitrary geometries on emerging patterns. Daljit Singh J. Dhillon Department of Computing, Imperial College London, London, United Kingdom. E-mail: [email protected] Note: While conducting this work, the first author was a Ph.D. student at the Institute of Computer Science, University of Bern, Bern, Switzerland. Michel C. Milinkovitch Department of Genetics and Evolution, Laboratory of Artificial and Natural Evolution (LANE), University of Geneva, Geneva, Switzerland E-mail: [email protected] Matthias Zwicker Institute of Computer Science, University of Bern, Bern, Switzerland. E-mail: [email protected] 2 Daljit Singh J. Dhillon et al. 1 Introduction Reaction-diffusion (RD) is often used to model the development of biological systems, most prominently in the study of biological pattern formation. The mathematical representation of these models results in systems of nonlinear partial differential equations (PDEs). The analysis of these systems of PDEs aim at answering two fundamental questions: (i) what are the possible solutions that satisfy the given system of PDEs, and how can these solutions be discovered systematically; and (ii) which of these solutions are stable against minor perturbations. Two strategies are commonly used to perform this analysis. First, linear stability analysis can predict the emergence of new patterns near trivial, homogeneous solutions (homogeneities) of the PDEs. These emergent patterns correspond to sudden qualitative changes to the state of an RD system and, hence, constitute bifurcations from the homogeneity. Second, nonlinear analysis provides solutions of the nonlinear RD equations far away from the homogeneous steady-states. To construct these solutions, numerical continuation techniques are used to follow continuous branches of solutions starting from initial bifurcation patterns constructed using the linear analysis. Solutions vary gradually with one of the system parameters, called the continuation parameter, along each branch. Several existing tools allow to delineate solutions for an RD system through linear and nonlinear bifurcation analyses. However, many of them are constrained to work with only simple surface geometries such as rectangles or hemispheres, and at low resolutions. These are serious limitations given that surface geometry plays an important role in pattern formation (Murray, 2003, page 108), that most of the interesting biological domains for RD systems have rather arbitrary shapes. In addition, corresponding patterns are too complex to be resolved with low-resolution meshes. In this paper, we develop a framework to perform bifurcation analysis for generic RD systems with two components, with or without cross diffusion, acting on arbitrary surfaces. Unlike approaches that iteratively traverse the trivial branch for a desired continuation parameter to detect bifurcation points step-by-step, our proposed framework uses an analysissynthesis approach to directly determine bifurcation points and construct emerging patterns along the trivial branch. We exploit the Hermitian nature of the Laplace-Beltrami (LB) operator, acting on a given arbitrary surface, which enables the computation of a spectral basis for emerging patterns. This allows us to derive formulae to directly compose emergent bifurcation patterns from eigenfunctions (also called eigenmodes or wavemodes) of the LB operator. Similarly, a bifurcation point for a given bifurcation pattern can be computed directly using its eigenvalues. We discuss several boundary conditions for our framework that are common for biological systems and ensure that the LB operator is Hermitian. Unlike detection-based approaches, our analysis-synthesis approach avoids missing out on bifurcations due to potential failures of a test function. In addition, our approach allows for tracing multiple and mixed-mode bifurcations apart from simple bifurcations. Our framework also supports high-resolution meshes for triangulated surface domains. We propose a progressive geometric multigrid approach to support multiple levels of mesh resolution. We first trace a branch at the lowest resolution for the surface mesh. Next, we use a simple two-step approach to upsample a solution pattern to the next level by first improving the mesh resolution for a solution, and then resolving the solution using an improved mesh geometry. This two-step approach progressively upsamples and converges a given pattern across multiple levels. Our multiresolution approach decouples branch tracing complexity from the complexity of dealing with a large-scale system. Unlike traditional multigrid approaches, our two-step approach does not go back and forth across multiple levels. This lends a high degree of parallelisability to our framework. Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 3 We demonstrate the working of our framework for a Brusselator system with zero Dirichlet boundary conditions to study the emergent patterns of cotyledons on a conifer tip (Nagata et al, 2003). We also demonstrate its working with Murray’s chemotactic model for pattern formation of skin pigmentation (Murray and Myerscough, 1991), subject to zero Neumann boundary conditions. In both cases, we illustrate the influence of surface shape on pattern formation using several example geometries. Finally, we evaluate the computational performance of our multiresolution branch tracing approach. In summary, our contributions include: – A framework for analysing two-component RD systems with or without cross diffusion that supports arbitrary triangulated surface domains. – A direct analysis-synthesis approach for computing emergent patterns and locating bifurcation points along the trivial branch based on spectral analysis of the LaplaceBeltrami operator on arbitrary triangulated surface domains. – A progressive geometric multigrid approach supporting high-resolution FEM discretisation to determine patterns along nonlinear branches. – Two case studies illustrating the effect of arbitrary geometries on pattern formation. 2 Related Work Emergent Patterns near Homogeneity. Linear stability analysis with two-component RD systems is often employed to study the emergence of new patterns from near homogeneous patternless initial conditions. Nagata et al (2003, 2013) study the relation between the shape and size of a conifer embryo and the emergent cotyledon patterns. They use a Brusselator RD system acting on a parametric family of spherical caps while imposing zero Dirichlet boundary conditions near homogeneity. With this, they explain how the number of emergent cotyledons is simply the selection of a spherical cap harmonic based on the radius of the conifer and its curvature (Nagata et al, 2013). Winters et al (1990) explain emergence of heterogeneous snake skin color patterns with a chemotactic RD model with cross diffusion (i.e., where the flux of one component is driven by gradients in the concentration of the second component). They perform numerical simulations on flat rectangular domains and illustrate the similarity of emergent patterns to the patterns observed in nature, for different snake species. Winters et al. use zero Neumann boundary conditions for their RD system. Similarly, Gambino et al (2013a) discuss pattern formation due to cross-diffusion for LotkaVolterra kinetics between two components in a 2D rectangular domain, commonly used to model predator-prey populations. Kealy and Wollkind (2012) use linear stability analysis to study onset of various spatial Turing patterns for vegetation in an arid flat land using a two-component RD system. They also apply a weak nonlinear stability analysis to predict the long-term behaviour of these emerging vegetation patterns. Murray (2003, Chapter 3) demonstrates the effect of both geometry and scale on the emergence of patterns under a two-component RD system and discusses the relevance of these parameters for explaining animal coat patterns. He derives an analytical form for the stripe and spot patterns that emerge on a tapering cylinder representing an animal tail. Also, he presents the selection of different stripe or patchy patterns (modes) with changes in the size of a planar 2D shape representing an animal coat. Most studies on the emergence of patterns, such as those discussed above, are limited to simple, well-defined surface geometries with analytically defined emergent patterns. Recently, Tuncer et al (2015) have introduced a projected Finite Elements Method for studying pattern formation by RD systems on surfaces that can be approximated analytically and later mapped with Lipschitz continuity onto a sphere. They note that studying RD systems 4 Daljit Singh J. Dhillon et al. on arbitrary surfaces is rather a “young and emerging research area”— (Tuncer et al, 2015) and that surface geometry is crucial for such studies. Our framework extends studies of RD systems with or without cross-diffusion to arbitrary surface domains without any geometric constraints by directly (numerically) computing emergent patterns on them. Also, it supports several common boundary conditions that arise in biological problems such as homogeneous Dirichlet, Neumann and Robin boundary conditions. As noted earlier, (arbitrary) surface geometry plays an important role in pattern formation. Thus our framework serves as an important tool for studying emergent patterns on ’real’ geometries. Marginal Stability Analysis. Marginal stability analysis is often used to study the interaction and mutual-exclusivity of two or more emergent wavemodes. It is also used to demarcate and characterise the parameter space of an RD system. Kealy and Wollkind (2012) use analytically defined marginal stability curves to demarcate regions in the parameter space with subjectively different vegetation patterns on arid flat lands (represented as 2D rectangles). Nagata et al (2013) define marginal stability curves for emergent wavemodes in terms of their corresponding eigenvalues and investigate the influence of the spherical cap surface geometry on the pattern of cotyledons development. In particular, they note that changes in the curvature or size of a plant tip may cause a change in the number of cotyledons that develop despite that the concentrations of chemical precursors are fixed. Our framework generalises such marginal stability analysis to arbitrary domains. It numerically computes the eigenvalues for the wavemodes that constitute emergent patterns. These eigenvalues can then be used to plot corresponding marginal stability curves. In its full potential, our framework supports case studies with dynamically changing arbitrary shapes for marginal stability analysis as demonstrated later. Bifurcations and Branch Tracing. Analytical solutions for branch tracing are only possible for simple surface domains. Ma and Hu (2014) express branches and patterns for a twocomponent Brusselator model acting on a 1D straight line domain in analytical forms. They prove that, except for the first branch along the continuation parameter dimension, all other branches are unstable. Méndez and Campos (2008) derive analytical expressions for tracing a branch with a single component RD system to predict the survival of an isolated 1D patch of a population in its surrounding 1D hostile environment. Using stability predictions along the branch, they establish that the survival of a population at a very low or negative growth rate depends on its initial density. Instead, we support branch tracing with numerical methods in our framework. Winters et al (1990) and Maini et al (1991) perform branch tracing numerically for their two-component RD system with cross diffusion acting on simple 2D rectangular domains. They simulate a diverse range of complex patterns with significant amplitudes for studying snakeskin pigmentations. Yochelis et al (2008) perform numerical branch tracing for a two-component Gierer-Meinhardt RD system on a simplified periodic 1D domain to study cardiovascular calcification patterns. They use the insights gained from branch tracing to characterise the parameter space for further experiments with 2D domains. Chien and Liao (2001) investigate multiple modes bifurcating at a given bifurcation point for a two-component Brusselator system subject to Robin boundary conditions. They demonstrate numerical continuation of multiple branches due to mode interactions for a 2D square domain. Paulau (2014) perform numerical branch tracing for a two-component FitzHugh-Nagumo (FHN) RD system on a 2D planar domain to study the properties of its localised solutions, i.e. solitons. With this, he establishes the existence and stability of certain first higher order radially symmetric solitons with non-zero azimuthal quantum number* which require the * i.e, characterising the zero crossings of a circumferential profile of a radially symmetric soliton. Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 5 third and fifth order nonlinear reaction terms to produce them. Our framework generalises such studies with two-component RD systems to arbitrary 2D surfaces. Other Cases. In general, studies with emergent patterns, marginal stability or bifurcation analysis may deal with more than two-components (Qian and Murray, 2001), coupled layers (Yang et al, 2002; Vasquez, 2013), quasi equilibrium (Rozada et al, 2014), advection (Vasquez, 2013; Satnoianu et al, 2001; Madzvamuse and Zenas George, 2013), a very large number (Zamora-Sillero et al, 2011) or range (Lo et al, 2012) of control parameters, shear-induced instability (Vasquez, 2013), growth induced instability (Madzvamuse, 2008), nonlinear diffusion (Gambino et al, 2013b), fractional RD (Gafiychuk et al, 2009) or even non-steady state (oscillatory) or travelling wave solutions (Draelants et al, 2013; Banerjee and Banerjee, 2012; Wyller et al, 2007; Qiao et al, 2006; Gambino et al, 2012). While our framework may be used directly or with simple modifications for only a few of these general cases, they serve as directions for future work on our framework. System Discretisation, Sparsity, large-scale and Numerical Methods. To numerically solve RD systems for emergent patterns and bifurcation branches, we must first discretise the PDEs. Several existing techniques allow discretisation based on either discrete geometric operators (Botsch et al, 2010), finite differences for closest-point methods (Ruuth and Merriman, 2008; Macdonald et al, 2011) or Finite Element Methods (FEM). We employ FEMs owing to their generality and robustness and use Deal.II (Bangerth et al, 2007), a general purpose software library that approximates arbitrary surface geometries with quadrilateral finite elements. With discretisation, a generic RD system is expressed as a linear system of equations where individual scalar elements may still be computed using nonlinear operations on discrete surface variables. With discretisation and linear stability analysis near homogeneity, the problem of computing emergent patterns translates into a problem of detecting bifurcations and solving a generalised eigenvalue problem at detected bifurcation points (Winters et al, 1990). Seydel (2010) discusses standard test function based techniques for detecting bifurcation points along any branch. These detection methods may fail, as strategies for evaluation (and construction) of test functions are empirical in nature. In contrast to these existing detection based approaches for bifurcations on a general branch, we exploit the spectral properties of a potential pattern emergent from a trivial branch to directly compute its bifurcation point. Seydel also describes methods such as the method of parallel computation to solve for emergent patterns along any branch for switching (see Seydel, 2010, Chapter 5). With our simplifications near homogeneity, we directly compose an emergent pattern and exploit the principles of the method of parallel computation to switch over to a new branch. We then use a pseudo arclength continuation approach for branch tracing as presented by Salinger et al (2002) which is also easily scalable to large systems (Salinger et al, 2001). Several natural steady state patterns are fairly complex and we need a sufficiently large system of discrete variables to study them. These large-scale systems result in sparse system matrices and we need iterative algorithms such as Krylov space methods (Gutknecht, 2007) to solve the aforementioned eigenvalue problems (Arbenz et al, 2012). In our framework, we use the Trilinos Project (Heroux et al, 2005) software libraries that implement various numerical algorithms for large-scale systems with sparse matrices on parallel processing architectures. When dealing with large-scale systems it is important to use preconditioners to avoid numerical instabilities due to poor conditioning of matrices. In our framework, we use algorithms based on incomplete factorization schemes, as implemented in packages like IFPACK and AztecOO for the Trilinos libraries. 6 Daljit Singh J. Dhillon et al. For large-scale systems under consideration, we need multigrid methods to make iterative algorithms practicable that otherwise generate smooth but stubborn residuals with poor convergence rates (Strang, 2007, Chapter 7). Analysing computational costs for iterative Krylov subspace methods is dependent on data, convergence criteria and numerical stability, and not generalisable (Liesen and Strakos, 2012, page 248). Furthermore, for non-symmetric matrices that arise with two-component RD systems, the convergence of popular methods like biconjugate gradient with stabilisation (Bi-CGStab) and generalised minimal residual (GMRES) that we use, is poorly understood (Simoncini and Szyld, 2007). However, multigrid methods coarsen a grid to increase the spatial frequency of residual errors which helps to accelerate their removal (Strang, 2007, Chapter 7). In practice, more than two grid levels and several passes (V-cycle, W-cycle or full-multigrid (Strang, 2007, Section 7.3)) across multiple levels are required. Also, multigrids may be classified as geometric (Landsberg and Voigt, 2010) or algebraic (Falgout, 2006) (Strang, 2007, Chapter 7), and used as preconditioners (Sala and Heroux, 2005) or even directly improve efficiency and robustness of branch tracing (Chien and Jeng, 2006). Baker et al (2011) demonstrate that the scalability and performance of algebraic multigrids is highly dependent on the multicore platform architecture and needs expert or empirical programming efforts for optimization. In addition, tightly coupled multilevels for existing multigrid approaches make distribution and scheduling of computational workload across parallel architectures difficult, owing to interdependencies across grid levels and decomposed domain partitions. In contrast, we propose a simple progressive geometric multigrid approach that decouples branch tracing from scale improvements to allow a highly parallelisable implementation. Our approach is based on a multigrid continuation approach by Bank and Chan (1986) where branch tracing is performed at the coarsest level and resultant solutions are refined for higher resolution meshes. We adapt this approach to perform alternative resolution and geometric improvements iteratively and demonstrate its working for a very high mesh resolution (1M FEM nodes) for an arbitrary surface. The inherent benefits of this decoupled progressive approach includes selective and parallel refinements of branch solutions. 3 Direct Linear Analysis with Laplacian Eigenbasis In this section, we formulate our direct approach to compute bifurcation patterns using eigenfunctions of the Laplacian-Beltrami operator. We derive a general form for an emergent pattern near homogeneity for a generic two-component RD system acting on arbitrary surfaces, with or without cross-diffusion. Also, we derive the constraints to be satisfied by the continuation parameter for locating a bifurcation point. We first perform a simplification of the generic RD system equations near homogeneity into a linear form, to be satisfied by an emergent pattern (Section 3.1). Next, we present a spectral decomposition of potential patterns and the boundary conditions that allow expressing these patterns with orthogonal basis functions (Section 3.2). Then, we substitute a spectrally decomposed potential pattern into the linearised system equations to obtain an explicit general form for an emergent pattern along with expressions and conditions for its spectral coefficients (Section 3.3). We also define the bifurcation point in terms of spectral eigenvalues and system parameters. We discuss three cases of simple, multiple and mixed-mode bifurcations and the constraints that they impose on our general derivations, and we discuss how to directly compose bifurcation patterns for these cases (Section 3.4). Also, we discuss common applications such as exclusive mode selection with isotropic domain-growth . Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 7 3.1 Linearising Generic Two-Component RD Systems Let us consider a two-component general RD system with cross diffusion, defined over an arbitrary surface. It can be expressed mathematically as    ∂a = ∇2 a Da + a Dα a + a Dβ b a + f (a, b) , ∂t h  i ∂b = ∇2 b Db + b Dα a + b Dβ b b + g(a, b) . ∂t (1) Here, a : Ω 7→ R and b : Ω 7→ R are the concentrations of two components over the surface Ω, diffusion is represented with the Laplace-Beltrami operator ∇2 , and functions f and g represent nonlinear reaction terms. The scalar coefficients a Da and b Db are positive diffusion rates, a Dα and b Dβ are non-negative self-diffusion factors and a Dβ and b Dα are non-negative cross-diffusion factors for the system (Lou and Ni, 1996). Throughout this paper, we consider only steady state solutions of RD systems. For Equation 1, this implies that we are interested in solutions with ∂a/∂t = ∂b/∂t = 0. To linearise the RD system defined in Equation 1, we first define its homogeneous steady state (a0 , b0 ) as a solution to the simultaneous equations f (a0 , b0 ) = 0 and g(a0 , b0 ) = 0. Note that depending on the complexity of f and g (say polynomial order), there may be multiple choices for the homogeneous steady state (a0 , b0 ). Given a steady state (a0 , b0 ), we now perform a Taylor series expansion for the nonlinear reaction terms f and g for infinitesimal deviations u = ∆a|a0 and v = ∆b|b0 , f (a0 + u, b0 + v) = f (a0 , b0 ) + u g(a0 + u, b0 + v) = g(a0 , b0 ) + u ∂f ∂a (a0 ,b0 ) ∂g ∂a (a0 ,b0 ) +v +v ∂f ∂b ∂g ∂b + n f (u, v), (a0 ,b0 ) + ng (u, v), (2) (a0 ,b0 ) where n f and ng are polynomial functions containing the second and higher order terms in u and v for their respective Taylor series expansions. In other words, n f and ng represent the nonlinear part of the reaction terms for the system defined by Equation 1 near the homogeneous steady state (a0 , b0 ). Now substituting a = a0 + u, b = a0 + v, f (a0 + u, b0 + v), and g(a0 + u, b0 + v) from Equation 2 into Equation 1 and ignoring the nonlinear terms yields ∂u u = Du ∇2 u + u Dv ∇2 v + fl (u, v) , ∂t ∂v v = Dv ∇2 v + v Du ∇2 u + gl (u, v) , ∂t with fl (u, v) = u Ku u + u Kv v , (3) gl (u, v) = v Ku u + v Kv v , (4) for u : Ω 7→ R and v : Ω 7→ R. Here, new diffusion coefficients {u Du , u Dv , v Du , v Dv } and reaction coefficients {u Ku , u Kv , v Ku , v Kv } are defined in terms of old coefficients in Equation 1, a0 , b0 , and partial derivatives ∂ f/∂a, ∂ f/∂b, ∂g/∂a and ∂g/∂b evaluated at (a0 , b0 ). See the supplemental material (SM01.D1) for the definition of these new coefficients along with necessary derivations. We emphasize that for the above linearisation, all non-linear terms in u, v, ∇u, ∇v, ∇2 u and ∇2 v are considered to be negligible and ignored since |u|  a0 and |v|  b0 near homogeneity. 8 Daljit Singh J. Dhillon et al. 3.2 Spectral Decomposition and Boundary Conditions Our framework performs bifurcation analysis near homogeneity using spectral analysis of the Laplace-Beltrami operator ∇2 . Any surface function such as u and v in Equation 3 can be expressed in terms of eigenmodes of ∇2 . Also, if a second-order linear operator such as ∇2 is Hermitian, then its eigenmodes form a set of orthonormal basis functions. Using an orthonormal spectral decomposition, we derive the form and conditions for an emergent pattern directly in terms of the eigenmodes and eigenvalues for the Laplacian-Beltrami operator. Now, in order to ensure the orthonormality of the basis functions, we need to consider the boundary conditions that u and v are subject to. Most biological problems expressed as RD systems are subject to either periodic boundary conditions or zero Dirichlet, Neumann, or Robin boundary conditions near homogeneity, or they deal with closed surfaces without boundaries. We show in the supplemental material (SM01.D2) that all these cases satisfy the Hermitian property of the Laplace-Beltrami operator. Spectral decomposition. To generate an orthonormal basis set {φk } using the LaplaceBeltrami operator ∇2 , we must solve the corresponding eigenvalue problem ∇2 φk = −λk φk , ∀k . (5) Here, all the eigenvalues λk are real and non-negative since ∇2 is Hermitian. We thus assume that the basis functions form an ordered set, where the ordering index k satisfies λk ≤ λk+1 . Using the basis functions {φk } we can express a smooth surface function f as f = ∑ fk φk , where fk = h f , φk i ∀k , (6) k and fk are called spectral coefficients. Next, we leverage the spectral decomposition in Equation 6 to express a pattern emergent near homogeneity for a generic RD system defined in Equation 1. 3.3 Bifurcation Patterns near Homogeneity While the spectral decomposition suggests that potential patterns could in general contain any superposition of eigenmodes, the conditions near homogeneity impose additional constraints on actual emergent patterns. We now derive an as–general–as–possible form for emergent steady-state patterns of our generic RD system formulation that respects these constraints. Consider a steady-state bifurcation pattern (ub , vb ) , where the superscript b denotes that this emergent pattern is a bifurcation from the trivial homogeneous solution. Substituting its spectral decomposition from Equation 6 into Equation 3, and setting the temporal derivatives to zero to obtain a steady-state solution, gives us ∂ub u = Du ∇2 ∑ uk φk + u Dv ∇2 ∑ vk φk + u Ku ∑ uk φk + u Kv ∑ vk φk ∂t k k k k = 0, ∂vb v = Dv ∇2 ∑ vk φk + v Du ∇2 ∑ uk φk + v Ku ∑ uk φk + v Kv ∑ vk φk ∂t k k k k = 0. (7) For simplicity, we dropped the superscript b from the spectral coefficients uk and vk . Simplifying Equation 7 using substitutions ∇2 φk = −λk φk , ∀k, and imposing linear independence Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces +ξ 0 − Exclusive mode Λn Non−exclusive mode +ξ λ Λn 0 − α = 12.02 9 Mixed−mode +ξ λ 0 − α = 13.73 Λm Λn λ α = 17.57 Fig. 1: Dispersion relation curves for the first three bifurcations for Murray’s chemotactic RD system (Winters et al, 1990) with α as a bifurcation parameter. Potential eigenvalues are represented along the λ-axis and the corresponding temporal growth rates are represented along the ξ-axis. Actual eigenvalues of the LB operator are shown as circles. As we move along the trivial branch by increasing the value of the bifurcation parameter α, different eigenmodes (represented by bigger brown circles) become unstable to branch out new bifurcations. of orthonormal basis functions φk yields the following relations between the spectral coefficients uk , vk , and eigenvalues λk , ∀k (see supplemental material (SM01.D3) for a detailed derivation), (u Ku − u Du λk ) uk + (u Kv − u Dv λk ) vk = 0 , (v Kv − v Dv λk ) vk + (v Ku − v Du λk ) uk = 0 . (8) For each non-zero pair of uk and vk , we derive the following constraint on the corresponding eigenvalue λk from the above equation, (u Du v Dv − v Du v Du )λ2k − (u Du v Kv + v Dv u Ku − u Dv v Ku − v Du u Kv )λk + u Ku v Kv − u Kv v Ku = 0 . (9) Equation 9 is quadratic in λk and it admits at most two real valued roots for λk , say Λm and Λn . This implies that at most two set of {φi } = {φk | λk = Λm } and {φ j } = {φk | λk = Λn } may be combined linearly to form an emergent pattern. Thus the most general form for a bifurcation pattern emergent near homogeneity for an RD system as in Equation 3 is ub = ∑ ui φi + {i} ∑ u jφ j , { j} with {i} = {k | λk = Λm } vb = ∑ vi φi + {i} ∑ v jφ j , { j} and { j} = {k | λk = Λn } . (10) Now, an important requirement for patterns given by Equation 10 to emerge due to diffusion driven instabilities is that the RD systems must be linearly stable in absence of diffusion. Murray expresses this requirement in terms of the differentials of the reaction terms in an RD system equation Murray (see 2003, Equation 2.19). For RD systems given by Equation 1, near homogeneity, the stability constraints are expressed in terms of system parameters as ∂ fl ∂gl + = u Ku + v Kv < 0 , and ∂u ∂v ∂ fl ∂gl ∂ fl ∂gl − = u Ku v Kv − u Kv v Ku > 0 . (11) ∂u ∂v ∂v ∂u To facilitate direct composition of emergent patterns we classify them based on two criteria. First, we classify patterns as (i) exclusive mode selections or (ii) non-exclusive mode selections based on certain conditions for the diffusion induced instability. Diffusion driven instabilities may activate multiple eigenmodes φk to grow or emerge simultaneously under a fixed set of system parameters. This is captured by the dispersion relation (Murray, 2003, 10 Daljit Singh J. Dhillon et al. page 86), which indicates the range of eigenvalues that are unstable for the fixed system parameters. The dispersion relation provides a growth rate ξk for each eigenvalue λk , and only eigenmodes with non-negative growth rates are unstable and may participate in pattern formation. Figure 1 plots dispersion relations as curves of growth rates ξ over potential eigenvalues λ. The shapes of the curves are determined by the given system parameters, and varying a free continuation parameter leads to a family of curves as shown here. Circles along the λ–axis indicate actual eigenvalues λk from the spectral analysis. In exclusive mode selection, eigenmodes corresponding to exactly one eigenvalue, say Λn , become unstable (they have a non-negative growth rate) at the bifurcation point. In non-exclusive mode selection, the system becomes unstable to a new set of eigenmodes with eigenvalue Λn , while it remains unstable to other modes with positive growth rates. Further, similar to Chien and Liao (2001)† , we classify bifurcations as: (a) simple if only a single wavemode constitutes the emergent pattern, (b) multiple if more than one wavemode constitutes the emergent pattern but all such wavemodes have the same eigenvalue, and (c) mixed-mode for the bifurcations with constituent wavemodes of more than one eigenfrequency, say Λn and Λm . Figure 1 on the right illustrates the dispersion relation for a mixed-mode pattern at its bifurcation point. Next, we derive different formulae to compose bifurcation patterns directly for these cases. 3.4 Composing Bifurcation Patterns for Continuation Building on the derivations from Sections 3.1, 3.2 and 3.3, we now derive equations to specifically compose simple, multiple, and mixed-mode bifurcations for the RD system in Equation 1 (near homogeneity), both under exclusive and non-exclusive mode selection. 3.4.1 Simple Bifurcations Simple bifurcation patterns are composed of a single wave φi such that the algebraic multiplicity of its corresponding eigenvalue λi = Λ is 1. Let for some i, (ub = ui φi , vb = vi φi ) be the steady state bifurcation pattern of interest. We now investigate the conditions that the system parameters must satisfy to branch out a steady state pattern (ub , vb ). Exclusive Mode Selection. For simple bifurcations in exclusive mode selection problems, the quadratic Equation 9 must have only one real root for λi = Λ satisfying 2 Λ (u Du v Dv − v Du v Du ) = u Du v Kv + v Dv u Ku − u Dv v Ku − v Du u Kv (12) at the bifurcation point. For RD systems without cross-diffusion, u Dv = v Du = 0 and the above relation becomes 2 Λ u Du v Dv = u Du v Kv + v Dv u Ku . Thus for studying exclusive mode selection for RD systems without cross-diffusion, the continuation parameter must be associated with either u Ku or v Kv . An interesting class of problems deals with isotropic growth of the domain as the mode selection criterion (Murray, 2003, page 151). For such cases, let us introduce a common scale factor γ > 0 for all the parameters to represent isotropic growth ‡ , i.e. u Ku = γ u Gu , † While Chien and Liao (2001) label all bifurcations made of two or more eigenmodes as mixed-mode, we reserve this term only for the bifurcations that involve eigenmodes with different eigenvalues. ‡ See Murray’s book (Murray, 2003, page 78) for an interpretation of the scale factor γ. Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 11 Kv = γ u Gv , v Ku = γ v Gu and v Kv = γ v Gv . Substituting these terms in Equation 12 gives us γ at the bifurcation point directly in terms of the system parameters as u γ = 2 Λ (u Du v Dv − v Du v Du ) / (u Du v Gv + v Dv u Gu − u Dv v Gu − v Du u Gv ) . (13) Non-Exclusive Mode Selection. For simple bifurcations that emerge non-exclusively, the λi = Λ for a given wavemode φi may not be a unique root for Equation 9. Nevertheless, for detecting bifurcations near homogeneity with all but one unknown system parameter, we can use Equation 9 with λi = Λ to directly compute the free (continuation) parameter. Thus, for all simple bifurcations along the trivial branch , we can directly compute a continuation parameter to locate the bifurcation point for a given wavemode φi by substituting Λ = λi in either Equation 12 (exclusive mode selection), 13 (exclusive mode selection under domain growth) or 9 (non-exclusive mode selection). Finally, with all system parameters known, we can obtain the spectral coefficients ui and vi by solving the simultaneous Equations 8. This yields the desired bifurcation pattern (ub , vb ), and we can switch to the new branch for tracing (see Section 4.5)§ . 3.4.2 Multiple Bifurcations For an eigenvalue λi = Λ with algebraic multiplicity > 1, we have multiple candidate wavemodes φi that satisfy the conditions and equations that we derived for simple bifurcations. Thus, for such cases, every linear combination of these wavemodes is a bifurcation pattern emergent at the same bifurcation point located using the results from Section 3.4.1. We discuss branch switching and continuation for such multiple bifurcations in more detail in Section 4. 3.4.3 Mixed-mode Bifurcations Let us now consider an as–general–as–possible emergent steady state bifurcation pattern as given in Equation 10. This means there are eigenmodes of two different eigenvalues Λm and Λn , and we assume that Λm < Λn . Let us define si = vi /ui and s j = v j /u j . Now, since λi = Λm , ∀i, Equation 8 implies that all si are equal, say si = sm , ∀i. Similarly, s j = sn (say), ∀ j. Substituting these scale factors with their respective eigenvalues in Equation 8 yields¶ u Ku = [ u Du (sn Λm − sm Λn ) + u Dv sm sn (Λm − Λn ) ] / (sn − sm ) , u Kv = [ u Du (Λn − Λm ) + u Dv (sn Λn − sm Λm ) ] / (sn − sm ) , v Ku = [ v Dv sm sn (Λm − Λn ) + v Du (sn Λm − sm Λn ) ] / (sn − sm ) , v Kv = [ v Dv (sn Λn − sm Λm ) + v Du (Λn − Λm ) ] / (sn − sm ) . (14) Now, one of the linear stability requirements in absence of diffusion is that u Ku v Kv > u Kv v Ku (Equation 11). Expanding this inequality with substitutions from Equation 14 gives us a constraint on the diffusion parameters, u Du v Dv > u Dv v Du , (15) § Note that Equation 8 is homogeneous and the terms u and v can only be solved upto a common scale factor, i i say si = vi /ui . ¶ See our supplemental material (SM01.D4) for detailed derivation for these coefficients and Equation 15. 12 Daljit Singh J. Dhillon et al. which needs to be satisfied to obtain a mixed mode bifurcation. Next, using the fact that Λn and Λm are solutions for λk in Equation 9, we can solve for the continuation parameter which is the only unknown in the following equation, (u Du v Dv − v Du v Du )2 (Λn − Λm )2 + 4 (u Du v Dv − v Du v Du ) (u Ku v Kv − u Kv v Ku ) − (u Du v Kv + v Dv u Ku − u Dv v Ku − v Du u Kv )2 = 0 . (16) Finally, with all system parameters determined, we can compute sm and sn as sm = (u Du Λm − u Ku )/(u Kv − u Dv Λm ) , sn = (v Du Λn − v Ku )/(v Kv − v Dv Λn ) . (17) In summary, to study a mixed-mode bifurcation we start composing a desired emergent pattern by selecting two eigenvalues, Λm and Λn , and the corresponding sets of eigenmodes {φi | λi = Λm } and {φ j | λ j = Λn }. In addition, we freely choose desired spectral coefficients ui and u j . We also set values for all but one system parameter such that they satisfy Equation 15. Then, we compute the unknown continuation parameter by solving the (quadratic) Equation 16. In order to continue with branch tracing, the solved bifurcation parameter must be real valued and satisfy preconditions in Equation 11. Else, our framework reports an error. Finally, we compute sm and sn using Equation 17, and the spectral coefficients vi and v j using ui , u j , sm and sn . Now, all terms are determined to compose the bifurcation pattern (ub , vb ) using Equation 10. 4 Numerical Method In this section we describe the numerical implementation of our framework in more detail. We build on the Trilinos and Deal.II libraries to provide an implementation of our proposed method for bifurcation analysis near homogeneity. Our framework uses FEM-based surface discretisation using quadrilateral finite elements (Q-FEs), and the order of the FEs can be configured up to three. We support the following operations for bifurcation analysis and branch tracing: approximating Laplacian eigenfunctions (Section 4.1), resolving bifurcations (Section 4.2), and branch tracing (Section 4.5). In addition, we will describe a strategy for resolving patterns at higher resolutions in Section 5. Our framework also includes a generic, indirect reference method for branch detection using a test function (see Seydel, 2010, Section 5.3). We use it for various comparisons during the evaluation of our framework. 4.1 Approximating Laplacian Eigenfunctions We saw in Section 3.3 that the eigenfunctions φk of the Laplacian of a surface domain Ω are the building blocks for composing bifurcation patterns, given an RD system satisfying one of the boundary conditions discussed in Section 3.2. Hence computing these eigenfunctions is a core functionality of our approach. Interestingly, the eigenfunctions depend only on the shape of the surface domain Ω and the boundary conditions. They are independent, however, of the RD system formulation and its parameters. We use an FEM discretisation of the domain Ω and apply a Galerkin method to discretise the eigenvalue problem in Equation 5 as Lbk = −λk Mbk . (18) Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 13 Here, bk is a discrete vector representation of the eigenfunction φk . We obtain the stiffness matrix L and the mass matrix M by applying a weak formulation integration to the Laplacian operator ∇2 and the eigenfunction φk , respectively. As before, λk is the eigenvalue corresponding to the eigenfunction φk . Equation 18 is a generalised eigenvalue problem, and in our case we obtain a large-scale system of sparse matrices. We use the Anasazi eigensolver package from the Trilinos library for finding the eigenvectors bk . For large-scale general eigenvalue problems a shift-invert approach is commonly used to solve for a band of eigenvectors as recommended by Lévy and Zhang (2010). However, for RD systems with zero Neumann boundary conditions, L is singular and the shift-invert method cannot be used to compute the lowest frequency band of eigenvectors. To keep things simple, we apply M−1 as a preconditioner to both sides and solve the resulting standard eigenvalue problem. We avoid explicit computation of the possibly non-sparse, large matrix M−1 with the use of the AztecOO package from the Trilinos library. AztecOO provides an inner loop implementation for each application of matrix M−1 to a vector (say) y for computing k = M−1 y by solving the linear system Mk = y instead of matrix inversion. 4.2 Resolving Bifurcations Given the eigenvectors {bk } and their respective eigenvalues {λk }, we can now compose bifurcation patterns and locate their point of emergence on the trivial branch. Section 3.4 explains how a bifurcation pattern may be categorised as a simple, multiple or mixed-mode bifurcation. For simple bifurcations, each basis vector bk defines a bifurcation pattern, which we denote as xb . We first locate the bifurcation point corresponding to xb as follows. Let α ∈ p = {u Du , u Dv , v Dv , v Du , u Ku , u Kv , v Ku , v Kv } be the unknown continuation parameter in p. Depending on the problem, we use one of the Equations 9, 12 or 13 to compute α by plugging in the known parameters from p, and λk (or Λ = λk ). Then, without loss of generality, we set uk = 1 and solve for vk using Equation 8 to compute xb = (uk bk , vk bk ). For multiple bifurcations, to compose a bifurcation pattern xb , we first select a set of eigenvectors {bi } = {bk | λk = Λm }. We then use Λm as λk in the case of simple bifurcations to compute α for the corresponding bifurcation point. Next we select an arbitrary set of spectral coefficients ui to define a desired linear combination of bi as an emergent pattern and compute the vi , ∀i using Equation 8. Thus we compute the multiple bifurcation pattern xb = (∑i ui bi , ∑i vi bi ). For a mixed mode bifurcation, we pick two sets {bi } = {bk | λk = Λm } and {b j } = {bk | λk = Λn } and compose an arbitrary linear combination of eigenvectors bk ∈ {bi } ∪ {b j } to define a desired emergent pattern. We then solve for the bifurcation point α by substituting all parameters from p, and Λm and Λn in Equation 16. With the known bifurcation point and Λm and Λn , we compute sm and sn using Equation 17. Next, with the previously defined arbitrary values of ui and u j for the desired emergent pattern, we compute vi = sm ui and v j = sn u j ∀i, j. Finally, we compose the mixed mode bifurcation pattern xb = (∑i ui xi + ∑ j u j b j , ∑i vi bi + ∑ j v j b j ). 4.3 Reference Method For evaluation purposes, we also implemented a standard approach for detecting bifurcation points (Seydel, 2010, Chapter 5). We call this the reference method since it uses common techniques for different tasks in detecting bifurcation points and computing bifurcation patterns. To detect a bifurcation point, we use a test function τ which is evaluated at (x,α) as, 14 Daljit Singh J. Dhillon et al. τ = eTk J v, where vector v satisfies equation Jk v = ek , with Jk = (I − ek eTk )J + ek eTk . Here, ek is a unit vector with all but the kth element set to zero and J is the Jacobian matrix for function f as discussed for branch tracing in Section 4.5. A bifurcation is detected each time τ changes its sign from − to + in an interval, say (αl , αu ). Next we perform a mid-point search to locate the 0-crossing for τ by iteratively evaluating it at αmid = (αl + αu )/2 and then setting αl = αmid if τ < 0 at αmid or otherwise setting αu = αmid . Upon convergence |τ| ≈ 0. This implies that vector v lies in the null-space of the Jacobian matrix J at αmid and it is a good approximation to the bifurcation pattern xs . We thus output xs = v and α0 = αmid as the next detected bifurcation pattern which may be used for branch tracing in a manner similar to the previous methods. Note that this method is not capable of resolving multiple bifurcations. 4.4 Advantages and Limitations of Proposed Approach The main advantage of our proposed approach is that finding bifurcation points and patterns is not dependent on the goodness of the tracing test function. Using a test function poses two issues: first, the potential presence of more than one bifurcation in an interval, and second, the lack of a guarantee for any test function to detect the presence of each bifurcation. While there are several strategies to address these two issues, often incompletely, our proposed direct approach completely avoids them. Furthermore, we do not need to perform repeated evaluations of the test function along the trivial branch. As a further advantage, depending on the complexity of the test function and the interval size, our approach reduces computational overheads. We tabulate performance gains due to our approach in Section 6. A third, important advantage of our approach is that it allows the direct composition of infinite multiple and mixed-mode bifurcation patterns. This adds considerable possibilities to bifurcation analysis by supporting the exploration of multiple co-located branches. At present, the main limitation of our proposed approach is that it can only be used to analyse primary branches emerging from the trivial branch. 4.5 Branch Tracing for Nonlinear Analysis Our framework also supports nonlinear analysis with branch tracing in the far-off nonlinear region for the PDEs. The first task in branch tracing is to switch over to the new branch of patterns characterised by a given bifurcation pattern xb = (ub , vb ). While the linear stability analysis gives us xb , we are interested in a non-trivial solution xs that fully satisfies the actual nonlinear PDE given in Equation 1, near the bifurcation point p (with α = α0 ) on the trivial branch. With xh ≡ (a0 , b0 ) as the homogeneous solution at the bifurcation point p, estimating a good starting point xs = xh + ∆x with α ≈ α0 on the new branch is a non-trivial task. The nonlinear solution xs must be qualitatively similar to the bifurcation pattern xb ; yet far-enough away from the trivial branch to allow continuation without falling back. To achieve this, we propose two improvements over a standard method of parallel computation approach for branch switching (see Seydel, 2010, Section 5.6.3). For the first improvement, we suggest using a bordering algorithm (Salinger et al, 2002) to iteratively compute the jump ∆x until a successful switch is made. Our key idea is to select a pattern dependent pivot (a discrete FEM node) for fixing the jump size and the direction of parallel computation. As a second improvement which helps multiple and mixed mode bifurcations we propose to apply a strong guidance to the jump ∆x at each intermediate step Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 15 of our iterative switching algorithm. The bifurcation pattern xb serves as a good guidance for the jump ∆x. The details for our proposed improvements are presented in the supplemental material (SM02.A1). Once we switch over to a new branch by jumping from the trivial solution xh to the nonlinear solution xs , we follow it by means of continuation. Our framework uses the LOCA and NOX packages from the Trilinos library to perform pseudo arc-length continuation. We use an adaptive approach that updates the step size after each continuation step and impose a tangent scale factor to manoeuvre the direction of the continuation curve as supported by the Trilinos library. In particular, we propose to establish a initial tangent direction which is strongly orthogonal to the trivial branch by attempting a jump from the nonlinear solution xs to its antithetic solution b xs = xh − ∆x, instead of jumping from the trivial solution xh to the nonlinear solution xs . Again, we present the details of our proposed improvement for branch tracing with other implementation details in the supplemental material (SM02.A1). Also, we provide further details about the configurability of our framework in the supplemental material (SM02.A2). 5 Multi-resolution Adaptation Resolution Improvement Unlike simple spot and stripe patterns, most interesting biological surface patterns exhibit high shape contour irregularities. The complexity of these patterns is attributed to the surface geometry and the (mid or high) frequency of the constituent eigenmodes (of the LB operator ∇2 ). Thus, for accurate computation of such complex patterns, the surface geometry must be represented with a high-resolution FEM discretisation. As discussed in Section 2, many existing geometric and algebraic multigrid approaches support high-resolution meshes but face challenges in either performance, scalability or parallelisability for branch tracing owing to tightly coupled multiple levels. We thus propose a simple multi-level approach in which branch tracing is performed at the base-level of discretisation and the resultant patterns are upsampled and resolved at higher levels progressively. Our framework uses a simplified geometric multigrid approach where the surface domain Ω is organized in multiple levels as Ll , with l = 0, . . . , N, where L0 is the lowest resolution representation and LN = Ω. We begin with the highest level mesh LN = Ω and generate each lower level mesh Ll−1 from mesh Ll by applying a quadric-based edge collapse decimation algorithm (Garland and Heckbert, 1997; Cignoni et al, 2008). We perform branch tracing at the lowest resolution L0 and progressively upsample resulting patterns up to the highest resolution LN . Unlike most of the multigrid approaches where all the mesh levels are used simultaneously in a V-cycle or a W-cycle (for the full multigrid approach) we perform complete upsampling of a solution using only two levels at a time. We thus call our approach a progressive geometric multigrid approach. We propose a two-step approach for upsampling the results between two levels l − 1 and l. For the first step, we increase the mesh resolution for Ll−1 without changing its geometry. We perform an in-plane subdivision of each existing (quad) finite element into four to give a new mesh, say Rl−1 . In the second step, we map the geometry of the mesh Rl−1 to Ll . For each solution vector xl−1 defined over Ll−1 with continuation parameter α = αb , we b first interpolate it linearly to the higher resolution mesh Rl−1 and then solve the nonlinear system f(rl−1 b , αb ) = 0 over Rl−1 . In general, we use a Newton method with backtracking to 16 Daljit Singh J. Dhillon et al. solve for rl−1 b . We compute the direction vector for the Newton method using a biconjugate gradient method with stabilization as implemented in the AztecOO package. For difficult cases, we use a trust region method for solving the above nonlinear system with a GMRES approach for establishing the search direction. Next we perform a similar interpolation from Rl−1 to Ll and then solve for xlb with f(xlb , αb ) = 0. For linear interpolation of a solution across two meshes (say, from Ll−1 to Rl−1 or from Rl−1 to Ll ) we use a projection based mapping scheme between meshes. We project each node from a target mesh (say Rl−1 ) onto the nearest face of the source mesh (Ll−1 ) and use the barycentric coordinates of the projected node to compute linear interpolation weights. A naive implementation of this mapping scheme has a computational complexity O(MN) with M and N as the number of nodes for the source and target meshes respectively. Computational complexity can be reduced to O(M log N) with the use of a kd-tree for the nearest face search. Note that we compute the multilevel meshes and the mappings for linear interpolation of solutions only once as a preprocessing step for a given surface domain Ω. Our two-step approach separates the complexity of resolution improvements from the complexity of geometry improvements for an upsampling task. The results for our progressive geometric multigrid approach are presented in Section 6. Parallelisability. Branch tracing is inherently a sequential task, because the next solution on a branch is computed by numerically analysing the previous one. For large-scale systems, Salinger et al (2005); Lehoucq and Salinger (2001) suggest using a multi-processor environment where a large domain (Ω) is partitioned into sub-domains and each domain is solved on a separate processor. Their domain-partitioning approach is generic but the parallelism is limited to solving for one solution at a time while tracing the branch sequentially. Similarly, Continillo (Continillo et al, 2012) present and discuss a method for parallelisation of the most repeated operation for their reactive dynamical system, i.e. the computation of the Jacobian Matrix J. They parallelise the computation of J using a cluster with a message passing interface (MPI). Again their approach limits parallelisation to the computation of the next solution. Our framework has considerable potential for parallelism. The most important of it is the scope for upsampling several patterns on a branch simultaneously. This is a direct outcome of our progressive geometric multigrid approach which completely delineates the branch tracing problem from the convergence of a solution at a higher resolution. Once a branch is traced at the lowest resolution with domain Ω0 , our framework can be invoked to resolve each of the patterns on the branch independently. This allows several instances of our framework to be launched on a computer cluster to simultaneously solve for all the solutions on a branch at higher resolutions. We evaluate the overhead of such parallel launches due to file reading and mesh data preparation operations in Section 6 and provide theoretical estimates for potential gains from parallel computation of a given branch. 6 Experiments and Results In this section, we describe our experimental setup, discuss case studies and present results. We use a 64-bit Ubuntu 14.04 LTS platform running on an Intel Xeon E5-2630 CPU with 6 Cores @2.3Ghz with 16GB RAM for all performance evaluations and most other experiments. We demonstrate our framework with two RD system case studies, a Brusselator system for the cotyledon patterning of conifer embryos (Section 6.1) and Murray’s chemotactic model for snake-skin pattern formation (Section 6.2). Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 17 6.1 Case Study I: A Brusselator model Nagata et al (2013) present a study of emergent cotyledon patterns on a plant tip. They model observed patterns as bifurcations for a two-component Brusselator RD system. They represent the plant tip with a simple geometric shape, a spherical cap. This spherical cap domain Ω is parameterised by its size factor R and a curvature factor ζ as shown in Figure 2. Nagata et al (2013) perform marginal stability analysis to study the relation between the number of emergent cotyledons and the size factor R or the curvature factor ζ for a cap. Mathematically, their model is defined as, ∂a = D1 ∇2 a + A − (D + B)a + Ca2 b , ∂t A BD with b.c. a(dΓ) = , b(dΓ) = , D AC ∂b = D2 ∇2 b + Ba − Ca2 b , ∂t dΓ ∈ Γ . (19) Here, a and b are concentrations of two Turing morphogens, A, B, C and D are positive rate constants, D1 and D2 are positive diffusion rates and dΓ is an infinitesimal element on the boundary Γ for the domain Ω. Nagata et al. linearise Equation 19 near homogeneity with (a0 = A/D, b0 = BD/AC) to derive an analytical expression for their continuation parameter (represented by A here) at a simple bifurcation point. The continuation parameter A is determined by the other system parameters and the eigenvalue Λ = λi of a spherical cap harmonic φi , which constitutes the emergent pattern. Note that λi , Fig. 2: A spherical cap. in turn, depends on the shape ζ and size R of the cap, and it can be computed by evaluating an associated Legendre function. This makes it possible to study the marginal stability of emergent patterns with respect to A, R and ζ. In our framework, the spherical cap harmonics are just a special case of eigenfunctions {φi } for a specific, simple domain. The benefit of our approach, however, is that we can easily generalise the analysis to arbitrarily shaped domains. This could facilitate the discovery of shape-induced anomalies in emergent patterns, as we discuss in an example later. Further, we simplify the analysis by incorporating the size factor R directly into the RD model. We replace the size R of the spherical cap with a factor γ that represents the relative scale of an arbitrary domain with respect to its canonic unit size. We then numerically compute the emergent patterns and corresponding Λ values. We first modify Equation 19 to include the scale factor γ in all the reaction terms, that is, in all coefficients except the diffusion rates D1 and D2 . Scaling the reaction relative to the diffusion coefficients has the same effect as scaling the domain (Murray, 2003, page 78). We use the notation A = γA∗ , where ∗ indicates corresponding rates at unit scale, and similarly for the other coefficients. This yields new linearisation parameters u Ku = γ (B∗ − D∗ ), u Kv = γ A2∗C∗ , D2∗ v Ku = −γ B∗ , v Kv = −γ A2∗C∗ . D2∗ (20) Substituting these parameters along with u Du = D1 , u Dv = 0, v Dv = D2 , v Du = 0 and λi = Λ in Equation 9 gives us the new continuation parameter A∗ as  1/2 D2 (B∗ − D∗ )Λ∗ − D1 D2 Λ2∗ Λ A∗ = D ∗ , with Λ∗ = . (21) C∗ (D1 Λ∗ + D∗ ) γ 18 Daljit Singh J. Dhillon et al. (5, 1) (0, 3) (2, 2) (3, 2) (6, 1) (1, 3) (4, 1) Fig. 3: Spherical cap harmonics in order of their emergence along the trivial branch with (a0 = A∗/D∗ , b0 = B∗ D∗/A∗C∗ ) for a spherical cap. Table 1: Errors in locating bifurcation points A∗ for the Brusselator model acting on a spherical cap domain. We compare the proposed and reference methods vis-a-vis analytically defined results with lookup tables from Bauer (1986), for several emergent modes. Mode Φi : (m, n) (5, 1) (0, 3) (2, 2) (3, 2) (6, 1) (1, 3) (4, 1) Bifurcation Point Location (A∗ ) Analytical Reference Proposed A0 A A1 0.76520 0.76382 0.76171 0.76049 0.75552 0.75406 0.74744 0.76528 0.76403 0.76200 0.75997 0.75475 0.75343 0.74792 0.76528 0.76403 0.76199 0.75997 0.75475 0.75343 0.74793 Relative Error RE0 (A - A0) / A0 RE1 (A1 - A0) / A0 1.07E-04 2.77E-04 3.84E-04 -6.88E-04 -1.02E-03 -8.41E-04 6.41E-04 1.07E-04 2.76E-04 3.74E-04 -6.91E-04 -1.02E-03 -8.37E-04 6.49E-04 Here Λ denotes the eigenvalue for a pattern φi at unit scale of the domain Ω. It can be shown that under uniform scaling of a surface domain Ω by a factor R, the eigenvalue for a given eigenfunction is inversely proportional to R2 . For spherical cap harmonics, for example, eigenvalues are analytically defined as λi = Ψ(φi , ζ)/R2 , where Ψ is defined in terms of an associated Legendre function dependent on the wavemode φi and the curvature factor ζ (see Nagata et al, 2013, Equation 11). Thus substituting γ = R2 in our modified Brusselator model allows us to incorporate the size factor R for studying marginal stability with arbitrary domains. We compute each eigenmode φi and its respective eigenvalue Λ numerically only for a representative arbitrary shape Ω at a unit scale. Our modified Brusselator model then enables us to plot marginal stability curves for different bifurcation patterns on this arbitrarily shaped plant tip against the size factor R, similar to the plots for spherical caps as presented by Nagata et al (2013) in Figure 3 of their paper. Experiments. First we validate our framework against analytically derived results from Nagata et al (2013). We use the same parameter values as given by Nagata et al. for their Figure 3 (i.e. D1 = 0.005, D2 = 0.1, B∗ = 1.5, C∗ = 1.8, D∗ = 0.375) and a spherical cap with radius R = 1 and curvature factor ζ = 0.5. For all quantitative evaluations in this section, we compute seven different emergent patterns as shown in Figure 3 and their corresponding bifurcation points A∗ using both our proposed method, and the reference method, as explained in Section 4. We begin by examining errors in computing A∗ with an FEM mesh of order one with about 4300 nodes. Table 1 provides a numerical comparison of relative errors for both methods against the analytically derived values. For all emergent patterns, our proposed method has a low relative error on the order of 10−3 when compared with the expected analytical results, and Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 19 Absolute Relative Error (in %) Bifurcation Point (A∗) Computation 0.4 Mode (5,1) is closest to the eigenfrequency for an exclusive mode selection ~1K Nodes ~2K Nodes ~4.3K Nodes ~10K Nodes ~20K Nodes 0.2 0 (4,1) (2,2) (0,3) (5,1) (3,2) Modes (6,1) (1,3) Fig. 4: Error in computing bifurcation points A∗ for seven emergent wavemodes φi using different mesh resolutions. The plot shows relative errors in comparison with analytically derived values for different wavemodes in order of their corresponding eigenvalues. the errors are quantitatively similar to those for the reference method. This implies that our direct approach works well and most of the errors can be explained as approximation errors due to FEM discretisation. Figure 4 shows relative errors for locating all seven bifurcation points at five mesh resolutions ranging from 1K - 20K vertices. The bifurcation points are ordered according to increasing eigenvalues along the horizontal axis. We found the relative error to fall quickly as a power-law function of the mesh resolution for each pattern. Mode (5, 1) is closest to the exclusive mode selection criterion in Equation 12 and it has the lowest relative error. We observe that the errors increase with the distance from this reference mode (5, 1) in the eigenspectrum and expect larger relative errors in locating bifurcation points for higher frequency patterns. Thus for applications requiring high accuracy for studying emergent patterns with arbitrary domains, our multi-resolution approach presented in Section 5 is beneficial. Next, we examine numerical errors in computing bifurcation patterns for our proposed method in comparison with analytically defined spherical cap harmonics (i.e. the ground truths). Figure 5a shows relative root mean square (RMS) errors in emergent patterns with different mesh resolutions. For comparison we normalize all spherical cap harmonics to have unit amplitude. Again we see that the accuracy improves with the discretisation resolution with some power-law function. We also include the errors for the reference method for a mesh with 4300 nodes in Figure 5a, which indicates that our proposed method is quantitatively consistent with the reference method. We also studied the impact of the FEM order on RMS errors with about 5000 nodes in each case, see Figure 5b. We denote surface geometries that are approximated with finite elements of order 1, 2 and 3, each with about 5000 nodes, by G1, G2, and G3. Since FEM of increasing order has an increasing number of nodes per planar finite element, the spherical surface geometry is approximated with a decreasing number of planar elements for higher orders. Comparing the solutions of order 1 FEM on G1, order 2 on G2, and order 3 on G3, we see that FEM order 1 outperforms higher orders for all emergent patterns. At the given resolution of 5K FEM nodes, the increase in error due to the geometric approximation in G2 and G3 apparently outweighs the error reduction due to higher order polynomials. In addition, we also report the error of order 1 FEM on the lower resolution geometries G2 and G3. As expected this increases the error due to the use of lower order polynomials, but only marginally. Next, we illustrate the key advantage of our approach, that is, the ability to study the effects of arbitrary shape distortions on emergent patterns. Figure 6 shows one such distorted 20 Daljit Singh J. Dhillon et al. Bifurcation Pattern Computation Bifurcation Pattern Computation 0.015 Relative RMS Error ~1K ~2K ~4.3K ~4.3K (reference) ~10K ~20K RMS Error 0.06 0.04 0.02 0 (5,1) (0,3) (2,2) (3,2) Modes (6,1) (a) Different resolutions (1,3) (4,1) 1st order with G1 2nd order with G2 1st order with G2 3rd order with G3 1st order with G3 0.01 0.005 0 (5,1) (0,3) (2,2) (3,2) (6,1) (1,3) (4,1) Modes (b) Different FEM order with 5K mesh Fig. 5: Relative mean error in computing the wavemode pattern φi . Fig. 6: Effects of shape distortion on emergent patterns. shape in its second row, which we generate by deforming the circular boundary of the cap and propagating the distortions smoothly over the entire surface. We visualize the effects of these shape distortions on three emergent patterns using a nonlinear color mapping, as illustrated in the figure. Clearly, new patterns show marked deviations from the respective spherical cap harmonics shown at the top row. Deviations from normal emergent patterns often lead to developmental anomalies, which are studied extensively in mathematical biology, refer to Harrison and Von Aderkas (2004) for an example. While our illustration here does not explain any specific anomaly, our framework can certainly be used to study the role of domain shape deviations on actual observed cases. Finally, we present marginal stability curves for mode (5, 1) in Figure 7. Here we consider three cases: (a) a spherical cap growing isotropically (greenish colour), (b) a distorted cap growing isotropically (brownish colour), and (c) a spherical cap that first grows isotropically until R = 1 and then progressively distorts with further growth (blue-gray colour). We first computed eigenvalues Λ for the spherical cap with R = 1, corresponding to a boundary perimeter P = 2πR, and ζ = 0.5, and for the distorted cap with boundary perimeter P = 2π. Using these eigenvalues we plot solid curves in Figure 7 for A∗ –vs.–R (or P) with γ = P2/4π2 for Equation 21. Our numerically computed marginal stability curve for the isotropically growing spherical cap domain conforms well with expected theoretical values shown using greenish circles (Nagata et al, 2013). The brown solid curve in Figure 7 shows that our framework can perform a similar study for an arbitrary shape domain. Last but not least, we demonstrate our capability to study marginal stability with a dynamically changing arbitrary Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 21 Fig. 7: Marginal stability for mode (5, 1) in A∗ -vs- P (cap boundary perimeter in 2π units) parameter slice. Analytically derived values as in Figure 3 by Nagata et al (2013) for an isotropically growing spherical cap are indicated with circular markers. Solid lines indicate results for our proposed method. shape. We progressively morph the spherical cap into a distorted cap as in case (b) with a shape-blending factor α that varies from 0 to 1 for P = 1 × 2π to P = 1.2 × 2π. The blue-gray solid curve in Figure 7 shows the respective stability curve. 6.2 Case Study II: Murray’s model Winters et al (1990) present bifurcation analysis of a two-component RD system with nonlinear reaction terms to model snakeskin pigmentation. They consider the role of chemotaxis, which is expressed in terms of surface gradients of the components. The nondimensional form of their system is given as   ∂a a ∂b 2 2 = D∇ a − α∇ · (a∇b) + SC a(N − a) , = ∇ b+S −b , ∂t ∂t 1+a with b.c. nb · ∇b(dΓ) = nb · ∇a(dΓ) = 0 , dΓ ∈ Γ . (22) Here, a represents the melanophore cell density, b the concentration of a chemoattractant that attracts the melanophores, D is the cell diffusion rate within the cell matrix over the surface, α is the strength of chemoattraction, C represents the cell mitotic rate, S is a positive scale factor, and N is the maximum cell concentration capacity for the growth model. All these parameters are positive and uniform over the entire snakeskin. Finally, dΓ is an infinitesimal element on the boundary Γ of Ω, nb is the outward surface normal at dΓ, and the model uses zero Neumann boundary conditions. Winters et al (1990) perform bifurcation detection and branch tracing to discover the steady-state solutions of the system in Equation 22 for 2D rectangular domains. They employ a second-order FEM approximation to represent the system state with a vector x = (a, b), and a standard Galerkin weak-formulation for a discretised representation of temporal derivatives given in Equation 22 with f(x, p, α) = (∂a/∂t, ∂b/∂t). Here, p = {C, D, N, S} is the set of fixed parameters and α, the chemoattraction strength, is the free continuation parameter. The vector f represents the temporal derivatives, and it is obtained via standard Galerkin FEM discretisation. 22 Daljit Singh J. Dhillon et al. Winters et al (1990) determine the next bifurcation point and its corresponding bifurcation pattern as follows. They first initialise the system with the only none-zero homogeneous steady-state solution x0 ≡ (a0 = N, b0 = N/1 + N) and α = α0 as a guess for the next bifurcation point. Next, using a Newton method, they solve an extended system of equations f(x, p, α) = 0, and J∆x = 0 with x = x0 + ∆x and α = α0 + ∆α as the unknowns, and J as the Jacobian of f at (x0 , p, α0 ). The equation extension solves for a non-trivial ∆x that lies in the nullspace of the Jacobian matrix and thus represents a pattern that may grow without affecting the system steadiness. From a solution of this extended system, (ub , vb ) = ∆x represents the emergent bifurcation pattern and αb = α0 + ∆α defines the corresponding bifurcation point along the trivial branch. Then, they use a pseudo-arclength continuation approach to follow the new branch and to determine the family of steady-state solutions along it. Our framework avoids the repetitive complexity of solving an extended system by directly locating each bifurcation point. Also, more importantly, our approach works on arbitrary surfaces and not just on rectangles. Consider linearising Equation 22 near the homogeneous solution a0 = N, b0 = N/(1 + N). We find the terms in the generic linearised PDE from Equation 3 as u Du = D, u u Ku = −CNS, Kv = 0, Ku = S/(1 + N)2 and v Kv = −S . Dv = −αN, u v Du = 0, v Dv = 1, v (23) We substitute these parameters in Equation 9 for a given mode φi with eigenvalue λi = Λ to express the continuation parameter α at the bifurcation point as      S D Λ αb = (1 + N)2 C 1 + + 1+ . (24) Λ N S Making similar substitutions in Equation 8 gives us the scale factor sΛ = vi /ui as sΛ = DΛ + CNS . αb NΛ (25) In our framework, we directly compute an eigenvector bk of the discrete Laplacian using Equation 18, corresponding to a continuous eigenfunction φk , and its respective eigenvalue Λ. Then, using Equations 24 and 25, we immediately locate the bifurcation point α = αb and compute the bifurcation pattern xb = (ub = bk , vb = sΛ bk ) by setting uk = 1, without loss of generality. For all experiments with Murray’s model, we set D = 0.25, C = 1.522, N = 1, and S = 1. Emergent Patterns. Again, we first validate our framework with analytically known emergent patterns on a simple geometry. We provide a general description of our experiments here, and provide detailed numerical results in the supplemental material (SM02.A3). For the rectangular domain Ω that we use in this case study, eigenvalues of the LB operator may have geometric multiplicity (independent eigenmodes) greater than one. In such cases, the uniqueness of numerically computed eigenvectors is not guaranteed. Thus, to analyse the accuracy of a numerically computed emergent pattern xb = (ub , vb ), we need bb which is nearest to ub . We do this with to first determine an analytically defined vector u an approach similar to that of Reuter et al (2009), i.e., by projecting the normalised vector ub onto a space with analytically defined basis vectors {bi }, which represent the ground Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 23 BiCG Stab Iterations Complexity of Test Function Evaluation 1000 500 0 0 Number of Evaluations Time Per Pattern Reference Proposed Computation Pattern Index 50 100 150 200 250 150 100 300 Test Function Bifurcation Point 3.7271 Emergent Pattern 16.318s 3.727s — — — 0.750s Total 20.045s 0.750s 50 0 Test Function Evaluation Per Pattern Table 2: Performance measures for Murray’s model on a rectangular domain. We used first order FEM with about 4400 nodes. Graphs on the left show statistics for test function evaluations for the reference method. bb . We then use the root truth patterns. This yields the closest analytically defined pattern u √ bb ||/ n, with n FEM nodes, as our error measure for the mean square error εRMS = ||ub − u numerically determined bifurcation pattern. We obtain each basis vector bi by discretizing its corresponding continuous eigenfunction φi at the FEM node positions. The analytical eigenfunctions on a rectangular domain are φi = cos (pπx/W ) cos (qπy/H) , and for λi =  pπ 2 + W Ω = {(x, y, 0) | 0 ≤ x ≤ W = 1, 0 ≤ y ≤ H = 4} ,  qπ 2 H , (26) where W and H are the width and height of the rectangle, respectively. The index i denotes a wavemode with p sinusoidal extrema (crust/trough) along the x–axis and q extrema along the y–axis. In the supplemental material we evaluate RMS errors εRMS for 100 emergent patterns with our proposed method and the reference method. We assign each emergent pattern an index based on its nearest analytically determined eigenvector bi . We solve for the eigenvectors with a convergence limit on the order of 10−12 , and this results in low RMS errors in general (on the order of 10−4 –10−6 ). In general, the emergent patterns ui found with our method and bi onto the analytical solutions are visually indistinguishable. In addition, their projections u while the reference method misses out on some emergent patterns due to multiple bifurcations or failures of the chosen test function, we discover all emergent patterns. We also analyse the relative error in locating a bifurcation point αb corresponding to xb by comparing it with an analytically defined αre f . We compute αre f from Equation 24 using analytically defined λi corresponding to basis vector bi closest to ub . We further investigated the impact of the FEM order on the accuracy of the discovered patterns, and we obtained similar conclusions as for the Brusselator model. Notably we observe that for FEM of order one, the error in locating a bifurcation point grows with the magnitude of the eigenvalue for the respective pattern. However, using higher order FEMs improves results considerably, albeit at the cost of some increase in relative errors for the emergent patterns. See supplemental material (SM02.A2) for details. It also includes an evaluation of the impact of mesh triangulation on the accuracy of our proposed method. Table 2 show a performance comparison between our proposed method and the reference method. We measured average time for different tasks while computing emergent patterns for Murray’s model acting on a rectangular domain. We used about 4400 (first order) FEM nodes for this evaluation with convergence limit set to 10−11 in each case. The graph on the left indicates that the required number of test function evaluations and thus the computational cost 24 Daljit Singh J. Dhillon et al. RMS Projection Error Errors in Emergent Patterns −3 10 −6 10 −9 10 −12 10 −15 10 (a) Different developable deformations of the 1 × 4 rectangular domain Ω of equal size (Illustrations are not on the same scale). 0 20 40 60 Pattern Index Planar Cylindrical Half−Bent Spiral 80 100 (b) Error plots on a semi-log scale. Fig. 8: RMS projection error in computing the wave mode pattern φi using our method on developable surfaces with different curvature profiles for Murray’s model. for the reference method decreases with the wavemode frequency. This happens because the distance between the wavemodes decreases with the eigenfrequency. However, it also implies that after some point the step size for evaluating the test function along the trivial branch would not be small enough to detection all emergent modes. Also note that the complexity of evaluating a test function increases with the wavemode frequency. This complexity is somehow artificially limited to 1000 iterations since we limit the BiCG Stab solver for computing the test function to 1000 iterations. Overall, Table 2 indicates that our proposed method is about 25× faster than the reference method in this case. Next, we evaluate the impact of different domain shapes on emergent patterns found with our framework. Figure 8a shows three different developable deformations of a 1 × 4 rectangular domain Ω. This includes a cylindrical surface with constant curvature, a half-bent surface composed of two parts with constant curvatures and curvature discontinuity between them, and a spiral surface with a continuously varying curvature profile. For comparison, we also used the original 1 × 4 rectangular domain Ω. We used a regular grid of about 4400 vertices in each case. With developable deformations, we do not expect that the non-planarity of the domains has an influence on emergent patterns. Figure 8b shows error statistics for all three deformed surfaces along with the rectangular surface as a reference. The differences in errors for different curvature profiles appear to be well within general variations in error statistics. We found a similar trend in relative errors for computing the bifurcation points and conclude that, as expected, the influence of developable deformations is negligible. To study the influence of local non-developable surface deformations on emergent patterns, we use surfaces with bump deformations at different locations or size to the reference rectangular domain Ω, see Figure 9. These bumps are akin to the emergence of animal limbs or appendices. We observed that even small local non-developable deformations bring out well-defined global deviations in emergent patterns as shown in the figure. To obtain an intuition about these new emergent patterns, we map them back onto the flat rectangular domain and project the mapped patterns onto the eigenvectors of the flat domain, as illustrated in Figure 9b. A main observation is that we can accurately represent many of the new patterns emerging on the deformed shape with only a few eigenvectors of the flat domain, where we measure accuracy as the correlation between a new pattern and its representation using a few eigenvectors. We indicate the few dominant wavemodes of the flat domain along with the correlation factor r below the emergent patterns in Figure 9b. This leads to the intuition that Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 25 (a) Bump at the center. (b) Bump at the edge. Fig. 9: Changes in emergent patterns for Murray’s model due to a surface bump. surface deformation leads to changes of the eigenfunctions and the eigenspectrum, such that many new, complex patterns emerging on deformed surfaces can be understood as linear combinations of simpler patterns on an original, undeformed domain. We also examined the influence of global non-developable deformations on emergent patterns. Figure 10 shows one such distortion comprised of a sliced paraboloid with a perimeter equal to that of the reference rectangular domain. Such a surface is representative of the region on a snake body which is undergoing morphogenesis for skin pattern formation. Again, we see interesting changes in emergent patterns which appear as deformations and mixing of eigenfunctions for the reference domain. Thus, we conclude that non-developability in surface geometry plays an important role on pattern formation and must be taken into consideration while studying such emergent patterns. Finally, we applied Murray’s model to a 3D reconstruction of a real gecko lizard body. In this hypothetical case, the eyes, the paws and the ventral side of the body are pruned 26 Daljit Singh J. Dhillon et al. Fig. 10: Emergent patterns on a paraboloid surface. (a) Patterns on real lizards. (b) Simulated patterns. Fig. 11: Emergent patterns on a Gecko lizard body surface. since these regions do not participate in pattern formation. We used first-order FEM with about 4600 nodes. Figure 11 illustrates a subjective comparison of several patterns observed on juvenile geckos and our simulations. For visualization, we perform a nonlinear softthresholding on the emergent patterns. Our simulation results give a good impression of the variety of patterns observed in nature and make a good case for using actual surface geometry in studying pattern formation. Branch Tracing We present results for branch tracing as explained in Section 4.5 with Murray’s chemotactic model. We use first-order FEM in all experiments with α as the continuation parameter and other parameters fixed as before. In general, for computing the eigenvectors we use a convergence limit ε ∈ [10−8 , 10−11 ] on the root-mean-square residual error for solving Equation 18. Also, we set the tolerance limit to 10−12 for the AztecOO inner loop GMRES solver. We perform branch switching with the parallel programming distance ε0 ∈ [1e−3, 0.07] for Equation 3 in the supplemental material (SM02). Also, the divergence limit αε discussed in Section A1 in the supplemental material (SM02) is set in the range [10−4 , 10−2 ] × α0 . For Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 27 Fig. 12: Branch tracing results for rectangular domain Ω. Fig. 13: Branch J–K for various developably deformed domains and corresponding patterns in sections J and K for the branches. an arclength continuation step, we set the convergence limit in the range [1e−8, 1e−11] for the RMS residual error. Figure 12 shows the branches traced for a rectangular domain Ω using our proposed direct approach. We first compute the eigenvectors for the domain with about 4400 FEM nodes. We then directly compose bifurcation patterns, compute the respective bifurcation points, and perform branch tracing as explained in Section 4. Our results for branches and segments A –K in Figure 12 are qualitatively similar to those presented by Winters et al (1990). Unlike Murray and Myerscough (1991) who change the underlying geometry for the rectangular domain to separate out multiple branches H–I and F–G, we trace these branches using our cosine factor method for branch switching (Refer the second approach in Section 4.5) without changing Ω. Our framework thus enables experiments with different linear combinations 28 Daljit Singh J. Dhillon et al. Fig. 14: Tracing branches on an arbitrary surface representing a Gecko lizard. Each row presents progressive changes in the emergent pattern as we move along its respective branch. of multiple bifurcation modes as seen later. Next, we repeat the branch tracing experiment for developable surfaces with different curvatures to obtain qualitatively similar results. For comparison, we present branch J–K for all four domains and resolved patterns in sections J and K of the branch, in Figure 13. After validating our framework with known results for simple geometries, we trace branches for an arbitrary surface geometry representing the Gecko lizard surface with about 900 FEM nodes. We trace branches for the first seventy eigenvectors of this shape. Figure 14 shows some of the interesting branches across the explored spectra. The leftmost column in Figure 14 plots the branches and each row shows the evolution of a pattern along its respective branch. We perform a nonlinear soft-thresholding again to visualise each pattern. For qualitative comparison, we use the same nonlinear color mapping for all the solutions along a branch after normalizing the pattern range to [0, 1] (as shown in the rightmost column of the figure). The first row in the figure shows one of the low frequency branches (branch 7). We notice clear qualitative changes that occur progressively as we move along the branch. The same is true for other branches such as two mid-frequency branches (branch 32 and 50) and one high-frequency branch (branch 69) shown here|| . Many interesting patterns such as C, G, H, L and P, which are qualitatively quite different from the emergent patterns, are discovered with branch tracing. Thus, we can say that branch tracing contributes significantly to the exploration of the solution space of a nonlinear system of PDEs and it is an important tool to study such biological systems. Unlike Murray’s approach for branch tracing, our framework has an added advantage of tracing branches for composite emergent patterns. In Figure 15 we show results for a composite emergent pattern on the rectangular domain Ω. This domain has three emergent patterns at α = 17.575. Two of those patterns are shown as H and F in Figure 12. We take a linear combination of patterns in H and F and trace a branch for it, as shown in Figure 15. Pattern A in the figure shows the starting pattern. A || We label the branches as low, mid or high frequency branches based on the range of the eigen-spectra which is explored. Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 29 Fig. 15: Tracing branch for a composite pattern. Upsampling patterns on a branch for the rectangular domain 4 10 mean | N−n | 0.6 0.4 0.2 Level L0: ~ 4400 FEM nodes Level L1: ~ 17000 FEM nodes Level L2: ~ 69000 FEM nodes Level L3: ~ 280000 FEM nodes Level L4: ~1100000 FEM nodes 0 13 14 15 α 16 17 18 (a) Branch Time taken (in secs) 0.8 Performance Profile 2 10 Average time per pattern Average time per iteration 0 10 4 10 5 10 Number of FEM nodes 6 10 (b) Performance plot on a log-log scale Fig. 16: An upsampled branch for the rectangular domain Ω and plots for performance analysis of this upsampling. variety of patterns appear as we move along the branch, changing progressively from A to F. All the observed patterns appear to be mainly composed of three emergent patterns at the multiple bifurcation point. Thus, this branch illustrates that such linear combinations could result in steady patterns in nonlinear regions far away from the trivial branch. Results for Multiresolution Adaptation Our progressive geometric multigrid approach (Section 5) allows us to perform branch tracing at high resolutions of up to one million FEM nodes. We proceed in two steps, namely (a) resolution improvements and (b) geometric improvements through multiple levels. We first demonstrate the upsampling of patterns on a branch for the rectangular domain in Figure 16. Since this domain is planar, we only need to perform step (a) for our multiresolution approach in this case. Figure 16a shows the upsampling of a branch originating at α = 13.736 (branch D-E in Figure 12) from level L0 ≈ 4400 FEM nodes to level L4 ≈ 1.1M FEM nodes. From one lower level to the next, we divide each quad finite element into four quad elements. For first order FEM this increases the number of FEM nodes by about 4×. Thus, with four levels of higher resolution, we go from about 4400 to 1.1 million FEM nodes. 30 Daljit Singh J. Dhillon et al. The flexibility of upsampling only a selective subset of solutions can help to reduce the computational load of such studies, and it allows the user to prioritise the upsampling of selected solutions. In Figure 16a we upsampled only about one third of the solution patterns from each level to the next. The figure shows that the solution patterns at each level lie close to the original branch at the lowest level. We found that the upsampled patterns resolved well in a few iterations and appeared subjectively very similar across all levels (not shown here for brevity). We also profiled the performance of our framework for this example. Table 3 shows the average number of iterations required to achieve convergence at each level along with the time taken. Figure 16b shows a log-log plot of average time taken for each iteration and total time for convergence of a pattern over the number of FEM nodes. Both plots are near linear in nature as illustrated by the line fit. Both fitted lines have a slope of 1.281, indicating the computational complexity of upsampling a given solution as O(N 1.281 ) with N FEM nodes. In contrast to our method, we found that a multi-level algebraic grid based preconditioner from the Trilinos library to directly trace a branch for the rectangular domain with about 100K FEM nodes failed to converge. Speaking of parallelisability, for the above case, we estimate that the overhead of the repeated task of reading mesh files and populating the internal data structures is less than 13% of the time taken to resolve a pattern at the highest level (L4 ). Thus the theoretical limit on the utility of a parallel processor is set high at 1/1.13 × 100 = 88.5%. Table 3: Performance profile for upsampling patterns on a branch for Murray’s model acting on the rectangular domain Ω. Level Quantity L1 L2 L3 L4 FEM nodes 17359 68869 274345 1095121 Iterations per pattern for convergence (average) Average time for convergence (in sec) Average time per iteration (in sec) 5.806 17.600 3.031 6.457 116.582 18.055 5.857 626.523 106.967 6.000 3668.539 611.423 We next demonstrate upsampling of a branch on the Gecko surface. In this case, we need to perform both (a) resolution improvement as well as (b) geometric improvement in our multiresolution approach. Figure 17 illustrates these two steps for upsampling patterns up by one level. We trace a branch at the lowest level L0 (green-coloured branch in the figure) and show qualitatively different patterns along the branch as A1 - D1 ** . We first upsample the patterns to level R0 , which has a higher resolution but the same geometry as L0 . We plot the branch at level R0 (orange branch in the figure) and notice that it drifts slightly from the original branch. However, we find patterns A2 - D2 to be qualitatively similar to the corresponding patterns on the branch for level L0 . Finally, we upsample the patterns to the improved geometry at level L1 . Here again, we find considerable changes in the plot for the branch while the patterns do not change much qualitatively, except for C3 (see patterns A3 –D3 .). The qualitative changes are limited across the levels mostly because of the lowfrequency nature of the patterns. At the same time, changes in the branch contours indicate ** In this example as well, we apply nonlinear soft-thresholding to aid visualization of the patterns. We use the same nonlinear mapping for each pattern which is first scaled and off-setted to the range [0, 1]. Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 31 Fig. 17: Upsampling a branch with low frequency patterns on an arbitrary surface, Ω. We see results for both, resolution improvement from L0 to R0 and geometry improvement R0 to L1 in this example. Fig. 18: Upsampling a pattern on a mid frequency branch for the Gecko surface in a far-off nonlinear region for the solution space of the underlying PDEs. We upsample results over two levels until patterns are fixed qualitatively. Note the pattern in the bottom right corner with no geometric improvements is qualitatively different from the pattern in the top right with geometric improvements while upsampling. that the resolution and geometry of the surface domain can influence the results. Particularly, C3 changes considerably because there is a branch-jump from C1 to D1 at the lowest level which gets corrected with our upsampling. We discuss branch-jumping and other issues in detail in Section 6.3. Next, we present an example of upsampling a pattern on a mid frequency branch (branch 50 in Figure 14), up by two levels. Figure 18 shows the results for levels L0 - L2 . For qualitative comparisons across different geometries, we map the values of each pattern into the range [0, 1]. Level L0 has about 900 FEM nodes, and the pattern looks unresolved even with a low RMS error of 1.61 × 10−14 units. We first improve its resolution to level R0 with about 3400 nodes. Adding more nodes changes the pattern qualitatively in several regions like the tail and the right forelimb. Next, we improve the geometry and resolve the pattern at level L1 with about 4400 nodes. Again we observe qualitative differences from level R0 in 32 Daljit Singh J. Dhillon et al. Fig. 19: Upsampling an emergent pattern on a Gecko surface for a resolution up to 1M FEM nodes. We begin with a relatively good surface geometry of about 4600 FEM nodes, which we do not refine during upsampling in this example. several regions like the right limbs. We further upsample the pattern to levels R1 and finally L2 , and find that the pattern at level L2 with about 18900 FEM nodes is qualitatively very similar to that at level L1 . We thus conclude that the pattern is well resolved, we do not need to further upsample it and the geometry at level L1 sufficed to resolve the pattern. For comparison, we also continue to sub-divide the quad elements from level R0 for one more step, while keeping the geometry from L0 , to resolve the pattern with about 13500 nodes. We show the result in the bottom-right corner, and observe that the resolved pattern is qualitatively different from those for the improved geometries L1 and L2 . This illustrates the effect that small changes in geometry can have on the resulting patterns. Finally, Figure 19 shows our upsampling results for a very high frequency emergent pattern (eigenvector 250). Starting from a geometry with about 4600 nodes, we upsample by only increasing the mesh resolution, but without changing the geometry. We show the results after two and four steps of upsampling in the middle and on the right, respectively. All the patterns were resolved with an RMS residual error O(10−8 ). We observe that as the resolution increases, the pattern contours between the red and blue color regions become more discernible. 6.3 Challenges, Limitations, and Future work Our framework is capable of determining all bifurcations along the trivial branch and works well to study emergent patterns and trace branches in general. However, there are certain aspects with room for improvement. Some of these are common challenges for all branch tracing algorithms. For example, it is common for a branch tracing algorithm to inadvertently switch over to another nearby branch in the solution space. Seydel (2010) discusses this problem in detail in Section 4.9 of his book. The possibility of such branch jumping in our framework is reduced to a good measure with the use of a Tangent Scale Factor to manoeuvre the direction of the continuation curve (refer to Section 4.5 for details). However, branch jumping cannot be completely avoided by our framework. A similar issue relating to interference between nearby branches is observed. Here we find that a sibling branch for a multiple bifurcation may interfere with continuation of the current branch and produce a pattern with a mix across two branches. Such crosstalk effects can be reduced by using a tangent predictor in our framework for branch tracing but not ruled out. Another limitation for our framework is related to the sampling theorem and FEM discretisation. While, in theory, we can solve for N eigenvectors for a domain Ω with N FEM nodes, not all of them are usable. For a simple case of a square planar domain, the sampling theorem dictates that there must be at least twice as many nodes along a dimension as the number of cycles for a Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 33 wavemode along that dimension to model the continuous wave accurately. Jiang et al (2010) discuss this specific limitation in detail in context of their problem relating to inertia moment analysis. Thus, while our framework is able to solve for a larger number of eigenvectors, only a fraction of it can be used for branch tracing. The simplest way out is to solve the eigenproblem by increasing the resolution at the lowest level Ω0 . However, this increase cannot be arbitrarily high since we can trace branches at the lowest level Ω0 only with domain-size O(104 ) or lower. Another limitation of our framework is that while tracing a branch at a higher resolution with the use of our progressive geometric multigrid approach, we only solve for a solution at a higher resolution for the continuation parameter value given by the respective solution at the lowest resolution. Thus for cases where the branch contour may change with upsampling, the parts of a (higher resolution) branch that lie beyond the continuation parameter range given by the lowest level branch become untraceable. This problem could possibly be addressed by either increasing the order of finite elements to reduce the change in the branch contour with upsampling or by allowing/forcing the continuation parameter to drift while upsampling the solutions at the twists and turns of a branch (Bolstad and Keller, 1986). Finally, the convergence of an upsampled solution is limited by the quality of the quad-mesh triangulation for FEM discretisation. Future work on our framework would focus on some of the challenges and limitations discussed here. 7 Conclusions We have presented a framework to perform bifurcation analysis for reaction diffusion systems on arbitrary surfaces. Our framework uses a compositional approach instead of traditional detection approach to discover new emergent patterns along the trivial branch with a homogeneous pattern. We discussed the boundary conditions which make the Laplacian-Beltrami operator acting on a surface domain Hermitian. Such an operator is self-adjoint and its eigenfunctions form an orthonormal basis set for all surface functions that satisfy given boundary conditions. We derive formulae to directly compose bifurcation patterns for two-component RD systems and to compute their respective bifurcation points. Our derivations substitute a spectral decomposition of the solution into a generalised system of PDEs linearised near homogeneity. Such a generalised system is representative of all two-component RD systems with or without cross-diffusion. Our framework first computes (FEM) discretised eigenvectors for the Laplacian-Beltrami operator acting on a given surface. It then composes bifurcation patterns and computes their respective bifurcation points using our derivations. In addition, our framework supports a multiresolution branch tracing algorithm. We propose a progressive geometric multigrid based approach with multiple levels for branch tracing. We demonstrate the working of our framework for two different RD systems (a Brusselator and a chemotactic model) with two different boundary conditions (zero Dirichlet and zero Neumann boundary conditions respectively). We validated our framework for these systems against known results in the literature, and experimented with the geometry of the underlying domains to obtain new results. In particular for Murray’s chemotactic model, we perform experiments with developable and non-developable distortions of the reference rectangular domain. Our experiments show interesting variations in the emergent patterns due to non-developable distortions. We also apply Murray’s model to study emergent patterns and branches for an arbitrary surface representing a gecko lizard. We upsample results to several higher levels with resolution upto one million FEM nodes, depending on the complexity of the pattern. We conclude that our framework can be used effectively to study emergent patterns and pattern branches for RD systems with or without cross diffusion, acting on 34 Daljit Singh J. Dhillon et al. arbitrary surfaces, with up to a few million FEM nodes. Our framework is flexible, highly parallelisable and can be configured to use higher-order FEMs as well. References Arbenz P, Kressner D, Zürich DME (2012) Lecture notes on solving large scale eigenvalue problems. D-MATH, ETH Zurich Baker AH, Gamblin T, Schulz M, Yang UM (2011) Challenges of scaling algebraic multigrid across modern multicore architectures. In: Parallel & Distributed Processing Symposium (IPDPS), 2011 IEEE International, IEEE, pp 275–286 Banerjee M, Banerjee S (2012) Turing instabilities and spatio-temporal chaos in ratiodependent holling–tanner model. Mathematical biosciences 236(1):64–76 Bangerth W, Hartmann R, Kanschat G (2007) deal.II – a general purpose object oriented finite element library. ACM Trans Math Softw 33(4):24/1–24/27 Bank RE, Chan TF (1986) Pltmgc: a multigrid continuation program for parameterized nonlinear elliptic systems. SIAM journal on scientific and statistical computing 7(2):540– 559 Bauer HF (1986) Tables of the roots of the associated legendre function with respect to the degree. Mathematics of computation 46(174):601–602 Bolstad JH, Keller HB (1986) A multigrid continuation method for elliptic problems with folds. SIAM Journal on Scientific and Statistical Computing 7(4):1081–1104 Botsch M, Kobbelt L, Pauly M, Alliez P, Lévy B (2010) Polygon mesh processing. CRC press Chien C, Jeng B (2006) A two-grid discretization scheme for semilinear elliptic eigenvalue problems. SIAM Journal on Scientific Computing 27(4):1287–1304 Chien CS, Liao Y (2001) Multiple bifurcations generated by mode interactions in a reaction– diffusion problem. Journal of computational and applied mathematics 130(1):345–368 Cignoni P, Corsini M, Ranzuglia G (2008) Meshlab: an open-source 3d mesh processing system. Ercim news 73:45–46 Continillo G, Grabski A, Mancusi E, Russo L (2012) Parallel tools for the bifurcation analysis of large-scale chemically reactive dynamical systems. Computers & Chemical Engineering 38:94–105 Draelants D, Broeckhove J, Beemster GT, Vanroose W (2013) Numerical bifurcation analysis of the pattern formation in a cell based auxin transport model. Journal of mathematical biology 67(5):1279–1305 Falgout RD (2006) An introduction to algebraic multigrid. Computing in Science and Engineering 8(6):24–33 Gafiychuk V, Datsko B, Meleshko V, Blackmore D (2009) Analysis of the solutions of coupled nonlinear fractional reaction–diffusion equations. Chaos, Solitons & Fractals 41(3):1095–1104 Gambino G, Lombardo M, Sammartino M (2012) Turing instability and traveling fronts for a nonlinear reaction–diffusion system with cross-diffusion. Mathematics and Computers in Simulation 82(6):1112–1132 Gambino G, Lombardo M, Sammartino M (2013a) Pattern formation driven by cross-diffusion in a 2d domain. Nonlinear Analysis: Real World Applications 14(3):1755–1779 Gambino G, Lombardo M, Sammartino M, Sciacca V (2013b) Turing pattern formation in the brusselator system with nonlinear diffusion. Physical Review E 88(4):042,925 Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 35 Garland M, Heckbert PS (1997) Surface simplification using quadric error metrics. In: Proceedings of the 24th annual conference on Computer graphics and interactive techniques, ACM Press/Addison-Wesley Publishing Co., New York, NY, USA, SIGGRAPH ’97, pp 209–216 Gutknecht MH (2007) A brief introduction to krylov space methods for solving linear systems. In: Frontiers of Computational Science, Springer, pp 53–62 Harrison LG, Von Aderkas P (2004) Spatially quantitative control of the number of cotyledons in a clonal population of somatic embryos of hybrid larch larix× leptoeuropaea. Annals of botany 93(4):423–434 Heroux MA, Bartlett RA, Howle VE, Hoekstra RJ, Hu JJ, Kolda TG, Lehoucq RB, Long KR, Pawlowski RP, Phipps ET, et al (2005) An overview of the trilinos project. ACM Transactions on Mathematical Software (TOMS) 31(3):397–423 Jiang Zr, Duan Pf, Guo Xl, Hua D (2010) Improvement of femâĂŹs dynamic property. Applied Mathematics and Mechanics 31:1337–1346 Kealy BJ, Wollkind DJ (2012) A nonlinear stability analysis of vegetative turing pattern formation for an interaction–diffusion plant-surface water model system in an arid flat environment. Bulletin of mathematical biology 74(4):803–833 Landsberg C, Voigt A (2010) A multigrid finite element method for reaction-diffusion systems on surfaces. Computing and visualization in science 13(4):177–185 Lehoucq RB, Salinger AG (2001) Large-scale eigenvalue calculations for stability analysis of steady flows on massively parallel computers. International Journal for Numerical Methods in Fluids 36(3):309–327 Lévy B, Zhang HR (2010) Spectral mesh processing. In: ACM SIGGRAPH 2010 Courses, ACM, p 8 Liesen J, Strakos Z (2012) Krylov subspace methods: principles and analysis. Oxford University Press Lo WC, Chen L, Wang M, Nie Q (2012) A robust and efficient method for steady state patterns in reaction–diffusion systems. Journal of computational physics 231(15):5062–5077 Lou Y, Ni WM (1996) Diffusion, self-diffusion and cross-diffusion. Journal of Differential Equations 131(1):79–131 Ma M, Hu J (2014) Bifurcation and stability analysis of steady states to a brusselator model. Applied Mathematics and Computation 236:580–592 Macdonald CB, Brandman J, Ruuth SJ (2011) Solving eigenvalue problems on curved surfaces using the closest point method. Journal of Computational Physics 230(22):7944– 7956 Madzvamuse A (2008) Stability analysis of reaction-diffusion systems with constant coefficients on growing domains. International Journal of Dynamical Systems and Differential Equations 1(4):250–262 Madzvamuse A, Zenas George U (2013) The moving grid finite element method applied to cell movement and deformation. Finite Elements in Analysis and Design 74:76–92 Maini P, Myerscough M, Winter K, Murray J (1991) Bifurcating spatially heterogeneous solutions in a chemotaxis model for biological pattern generation. Bulletin of mathematical biology 53(5):701–719 Méndez V, Campos D (2008) Population extinction and survival in a hostile environment. Physical Review E 77(2):022,901 Murray J (2003) Mathematical Biology II: Spatial Models and Biomedical Applications. Intercisciplinary Applied Mathematics: Mathematical Biology, Springer, URL http: //books.google.ch/books?id=2d-RLuD\_MX8C 36 Daljit Singh J. Dhillon et al. Murray J, Myerscough M (1991) Pigmentation pattern formation on snakes. Journal of theoretical biology 149(3):339–360 Nagata W, Harrison LG, Wehner S (2003) Reaction-diffusion models of growing plant tips: bifurcations on hemispheres. Bulletin of mathematical biology 65(4):571–607 Nagata W, Zangeneh HR, Holloway DM (2013) Reaction-diffusion patterns in plant tip morphogenesis: Bifurcations on spherical caps. Bulletin of mathematical biology 75(12):2346– 2371 Paulau P (2014) Fundamental-and first-order localized states in a cubic-quintic reactiondiffusion system. Physical Review E 89(3):032,910 Qian H, Murray JD (2001) A simple method of parameter space determination for diffusiondriven instability with three species. Applied Mathematics Letters 14(4):405–411 Qiao L, Kevrekidis I, Punckt C, Rotermund H (2006) Geometry-induced pulse instability in microdesigned catalysts: The effect of boundary curvature. Physical Review E 73(3):036,217 Reuter M, Biasotti S, Giorgi D, Patanè G, Spagnuolo M (2009) Discrete laplace–beltrami operators for shape analysis and segmentation. Computers & Graphics 33(3):381–390 Rozada I, Ruuth SJ, Ward M (2014) The stability of localized spot patterns for the brusselator on the sphere. SIAM Journal on Applied Dynamical Systems 13(1):564–627 Ruuth SJ, Merriman B (2008) A simple embedding method for solving partial differential equations on surfaces. Journal of Computational Physics 227(3):1943–1961 Sala M, Heroux M (2005) Robust algebraic preconditioners using ifpack 3.0. Sandia National Laboratories p 123 Salinger AG, Pawlowski RP, Romero L (2001) Scalable bifurcation analysis algorithms for large parallel applications. Computational Fluid and Solid Mechanics pp 1647–1650 Salinger AG, Bou-Rabee NM, Pawlowski RP, Wilkes ED, Burroughs EA, Lehoucq RB, Romero LA (2002) Loca 1.0 library of continuation algorithms: theory and implementation manual. Sandia National Laboratories, Albuquerque, NM, Technical Report No SAND2002-0396 Salinger AG, Burroughs E, Pawlowski RP, Phipps ET, Romero L (2005) Bifurcation tracking algorithms and software for large scale applications. International Journal of Bifurcation and Chaos 15(03):1015–1032 Satnoianu RA, Maini PK, Menzinger M (2001) Parameter space analysis, pattern sensitivity and model comparison for turing and stationary flow-distributed waves (fds). Physica D: Nonlinear Phenomena 160(1):79–102 Seydel R (2010) Practical bifurcation and stability analysis. Springer Simoncini V, Szyld DB (2007) Recent computational developments in krylov subspace methods for linear systems. Numerical Linear Algebra with Applications 14(1):1–59 Strang G (2007) Computational Science and Engineering. Wellesley-Cambridge Press, URL https://books.google.ch/books?id=GQ9pQgAACAAJ Tuncer N, Madzvamuse A, Meir A (2015) Projected finite elements for reaction–diffusion systems on stationary closed surfaces. Applied Numerical Mathematics 96:45–71 Vasquez DA (2013) Pattern formation induced by a differential shear flow. Physical Review E 87 Winters K, Myerscough M, Maini PK, Murray JD (1990) Tracking bifurcating solutions of a model biological pattern generator. IMPACT of Computing in Science and Engineering 2(4):355–371 Wyller J, Blomquist P, Einevoll GT (2007) Turing instability and pattern formation in a two-population neuronal network model. Physica D: Nonlinear Phenomena 225(1):75–93 Bifurcation Analysis of Reaction Diffusion Systems on Arbitrary Surfaces 37 Yang L, Dolnik M, Zhabotinsky AM, Epstein IR (2002) Spatial resonances and superposition patterns in a reaction-diffusion model with interacting turing modes. Physical review letters 88(20):208,303 Yochelis A, Tintut Y, Demer L, Garfinkel A (2008) The formation of labyrinths, spots and stripe patterns in a biochemical approach to cardiovascular calcification. New Journal of Physics 10(5):055,002 Zamora-Sillero E, Hafner M, Ibig A, Stelling J, Wagner A (2011) Efficient characterization of high-dimensional parameter spaces for systems biology. BMC systems biology 5(1):142 Sample Photographs Sourced from Internet For Figure11 Images in (a) are from Rooster (2009), Psyon (2009), Raven (2009), Locke (2007) and Gary and Julia (2013). Image References Gary, Julia (2013) [photograph] A gecko lizard with small spots. Retrieved from http://www. westcoastleopardgecko.com/images/00451.JPG, [Online; accessed 07-July-2015] Locke T (2007) [photograph] A gecko lizard with an aligned spot pattern. Retrieved from http://www. geckotime.com/breeding-leopard-geckos-on-a-small-scale/, [Online; accessed 07July-2015] Psyon (2009) [photograph] A gecko lizard with bands on its back. Retrieved from https://commons. wikimedia.org/wiki/File:Juvenile-leopard-gecko-2.jpg, [Online; accessed 07-July2015] Raven (2009) [photograph] An Eublepharis macularius gecko lizard with irregular spots. Retrieved from https://plus.google.com/communities/107069611951806704428, [Online; accessed 07-July-2015] Rooster (2009) [photograph] A juvenile gecko lizard with a stripe pattern. Retrieved from http://www.captivebredreptileforums.co.uk/members/rooster/albums/ rooster-s-geckos/4223-jungle-leopard-gecko-baby-pic-hes-bigger-now/, [Online; accessed 07-July-2015]
5cs.CE
arXiv:1711.00163v1 [math.RT] 1 Nov 2017 CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II JIARUI FEI Dedicated to Professor Sergey Fomin on the Occasion of his Sixtieth Birthday Abstract. We prove that the semi-invariant ring of the standard representation space of the l-flagged m-arrow Kronecker quiver is an upper cluster algebra for any l, m P N. The quiver and cluster are explicitly given. We prove that the quiver with its rigid potential is a polyhedral cluster model. λ As a consequence, to compute each Kronecker coefficient gµ,ν with λ at most m parts, we only need to count lattice points in at most m! fibre (rational) polytopes inside the g-vector cone, which is explicitly given. Contents Introduction Notations and Conventions 2 3 m Part 1. SIβl pKl,l q as an Upper Cluster Algebra 1. Basic Objects 2. Schofield’s Semi-invariants 2.1. The semi-invariants sni,j 2.2. Lifting sni,j 3. Graded Upper Cluster Algebras m 4. krZl,l s as a UCA 4.1. Cluster structure of krX2,2 s m 4.2. Cluster Structure of krZl,l s m 5. SIβl pKl,l q as a UCA m 5.1. Lifting the seed p♦m l , sl q m 5.2. Cluster structure of SIβl pKl,l q 3 3 7 7 9 11 13 13 17 22 22 24 Part 2. The Cluster Models 6. The QP Models 6.1. The QP models of UCA 6.2. Some sequences of mutations m m 6.3. p♦l , W l q is a cluster model 7. Computing Kronecker Coefficients 26 26 26 28 34 35 2010 Mathematics Subject Classification. Primary 13F60, 20C30; Secondary 16G20, 13A50, 52B20. Key words and phrases. Upper Cluster Algebra, Semi-invariant Ring, Kronecker Coefficient, Quiver Representation, Quiver with Potential, Cluster Character, Flagged Kronecker Quiver, Symmetric Function, g-vector Cone, Lattice Point. 1 2 JIARUI FEI 7.1. Recap from the previous paper 7.2. The g-vector cone Gm l Acknowledgement References 36 36 40 40 Introduction m In the previous paper [9], we studied the semi-invariant rings SIβl pKl,l q of the m flagged Kronecker quivers Kl,l with standard dimension vector βl below 1 /2 / ¨¨¨ /l m arrows ❴*4 l / ¨¨¨ /2 /1 These semi-invariant rings are interesting because they are related to the important Kronecker coefficients. We proved that when m “ 2, for each l the semi-invariant ring is an upper cluster algebra [1]. Moreover, the ice quiver of this upper cluster algebra has a rigid potential such that they form a polyhedral cluster model. Roughly speaking, this means that the upper cluster algebra has a basis parametrized by the lattice points in the µ-supported g-vector cone. In this paper, we settle the general case. Namely, m Theorem 0.1 (=Theorem 5.12). For any l, m ě 2, the semi-invariant ring SIβl pKl,l q m m rm r r is isomorphic to the graded upper cluster algebra Cp♦l , sl ; σ l q. m rm , r We explicitly construct an initial seed p♦ l sl q. Roughly speaking, the ice quiver r m is built up in two steps. We first glue m ´ 1 so-called diamond quivers ♦l ♦ l together, then we extend it through m frozen vertices. A single ♦l for l “ 5 is drawn in Figure 3 (right). Moreover, all cluster variables in r sm l are Schofield’s semi-invariants. Each such upper cluster algebra strictly contains the corresponding cluster algebra. The statement about the cluster model is also true for the general case. r m such that Ă m on ♦ Theorem 0.2 (=Theorem 6.22). There is a rigid potential W l l m m r ,W Ă q is a polyhedral cluster model. p♦ l l m m Actually, for the sake of exposition, we consider a quiver with potential p♦l , W l q rm, W Ă m q. Let Gm be the µ-supported g-vector cone of mutation-equivalent to p♦ l l l m m p♦l , W l q. We can explicitly describe it by stability conditions, more precisely by the dimension vectors of subrepresentations of some boundary representations m m of p♦l , W l q. Combining with a result in the previous paper, we are able to efλ ficiently compute Kronecker coefficients gµ,ν associated to all triple of partitions λ pλ, µ, νq of n. By definition gµ,ν is the tensor product multiplicity for irreducible representations of the symmetric group Sn : à λ λ Sµ b Sν – gµ,ν S . λ To author’s best knowledge, this is the fastest algorithm available so far. Theorem 0.3 (=Theorem 7.2). Let µ, ν (resp. λ) be partitions of length ď l (resp. ď m). Then ˇ ˇ ÿ m ˇ λ ω p♦l q0 ˇ gµ,ν “ sgnpωqˇGm pµ, ν, λ q X Z ˇ. l ωPSm pλq CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 3 m Here we write λω for the vector by λω piq “ λpiq ´ i ` ωpiq, and set ( in Z given m ω m Sm pλq :“ ω P Sm | λ P Zě0 . Moreover, Gl pµ, ν, λω q is the fibre polytope for m 2l`m . the grading map σ m l : Gl Ñ R An earlier version of this paper had been finished by summer of 2016. In that version, we proved the same main results using the methods similar to those in the first paper. However, with this application in mind and motivated by the work of Gross-Hacking-Keel-Kontsevich [17], we developed some machinery in [11]. The proof in the current version is much simpler and more conceptual than the previous one. The paper is almost self-contained – we only assume Theorem 0.1 from the first paper. Here is the outline of this paper. In Section 1, we introduce the basic objects m to study in this paper, including an important intermediate object Zl,l . Lemma 1.6 is a key lemma. In Section 2, we introduce a special class of Schofield’s semim invariants for Repβl pKl,l q, which will be our candidates for the cluster variables. In Section 3, we recall the definition of graded upper cluster algebras. In Section m 4, we describe the cluster structure of the coordinate algebra of Zl,l , and make a connection with a construction of Fock-Goncharov. In Section 5, we prove our first m main result (Theorem 5.12) that SIβl pKl,l q is an upper cluster algebra. In Section 6.1, we recall the ice quivers with potentials as cluster models following [4, 20, 7]. We also recall the main results in [11]. After some technical preparation in Section 6.2, we prove in Section 6.3 our second main result (Theorem 6.22) that m m p♦l , W l q is a polyhedral cluster model. In Section 7.1, we recap the connection to the Kronecker coefficients made in the first paper. As a consequence, we state our last main result (Theorem 7.2) on computing Kronecker coefficients. In Section 7.2, we briefly mention a description of the g-vector cone Gm l (Proposition 7.3 and 7.8). We provide a detailed example when l “ m “ 3. Notations and Conventions. Our vectors are exclusively row vectors. Unless otherwise stated, all modules are right modules. For a quiver Q, we denote by Q0 the set of vertices and by Q1 the set of arrows. Arrows are composed from left to a b right, i.e., ab is the path ¨ Ý Ñ¨Ý Ñ ¨. Throughout the paper, the base field k is algebraically closed of characteristic zero. Unadorned Hom and b are all over the base field k, and the superscript ˚ is the trivial dual for vector spaces. For any representation M , dimM is the dimension vector of M . For direct sum of n copies of M , we write nM instead of the traditional M ‘n . In this paper, we use the interval notation ra, bs for the sequence pa, a ` 1, ¨ ¨ ¨ , bq, ÐÝÝ and ra, bs for the reverse order sequence pb, b ´ 1, ¨ ¨ ¨ , aq. Moreover, rns is a shorthand for r1, ns. m q as an Upper Cluster Algebra Part 1. SIβl pKl,l 1. Basic Objects Let X be an irreducible affine variety acted by a reductive algebraic group G. We denote by X{G :“ Spec krXsG the categorical quotient (in the category of varieties). The typical situation throughout this paper is that there is a non-empty open subset X ˝ Ă X where the action of G is free. In particular, X ˝ admits a geometric quotient [21]. 4 JIARUI FEI Let Q “ pQ0 , Q1 q be a finite quiver. For a dimension ś vector β of Q (that is an element in ZQ0 ), let V be a β-dimensional vector space iPQ0 k βpiq . We write Vi for the i-th component of V . The space of all β-dimensional representations is à HompVtpaq , Vhpaq q. Repβ pQq :“ aPQ1 Here we denote by tpaq and hpaq the tail and head of a. The product of general linear group ź GLpVi q GLβ :“ iPQ0 acts on Repβ pQq by the natural base change. But ś in this paper we are mainly interested in the action of the subgroup SLβ :“ iPQ0 SLpVi q Ă GLβ . We define the rings of semi-invariants SIβ pQq :“ krRepβ pQqsSLβ . We call the linear quiver Al with the standard dimension vector βl a complete flag of length l /2 / ¨¨¨ /l. 1 op _ The opposite quiver Al :“ Al of Al with the same dimension vector βl is called its dual ¨¨¨ o l. 1o 2o ˝ ˝ _ Let Repβl pAl q (resp. Repβl pAl q) be the open subset of Repβl pAl q (resp. Repβl pA_ l q) where each linear map is injective (resp. surjective). Let F P Rep˝βl pAl q (resp. `I ˘ k F̌ P Rep˝βl pA_ l q) be the representation given by pIk , 0q (resp. 0 ) on each arrow k Ñ k ` 1 (resp. k ` 1 Ñ k), where Ik is the k ˆ k identity matrix. Throughout we set G :“ SLl . Let U ´ (resp. U :“ U ` ) and H be the subgroups of lower (resp. upper) triangular and diagonal matrices in G. For any l P N, we let γl :“ p1, 2, . . . , l ´ 1q so that we have the decomposition SLβl “ SLγl ˆ SLl . We denote by A and Ǎ the categorical quotient Repβl pAl q{ SLγl and Repβl pA_ l q{ SLγl respectively. The group SLγl acts freely on Rep˝βl pAl q so A˝ :“ Rep˝βl pAl q{ SLγl is a geometric quotient. Similarly Ǎ˝ :“ Rep˝βl pA_ l q{ SLγl is also a geometric quotient. By abuse of notation, we still write F and F̌ for the corresponding points in A and Ǎ. Since the action of GLl commutes with that of SLγl , the group GLl acts on A and Ǎ as well. As our convention, we change the left action of GLl on A to the right action by taking the inverse. Lemma 1.1 ([11, Lemma 4.5]). F ¨ G is the only G-orbit in A˝ and the stabilizer of F h is U ´ for any h P H. There is an obvious dual statement for F̌ . Let pi (resp. p̌i ) be the unique path from i to l in Al (resp. from l to i in Ǎl ). A pair of representations pA1 , A2 q P Repβl pAl q2 is called generic if the matrix ´ ¯ A1 ppi q has full rank for all i ` j “ l. Similarly, we can define the generic pair in A2 ppj q _ _ Repβl pA_ l q ˆ Repβl pAl q. A pair pA, Ǎq in Repβl pAl q ˆ Repβl pAl q is called generic if the matrix Appi qǍpp̌i q has full rank for all 1 ď i ď l ´ 1. It is clear that a representation A (resp. Ǎ) in a generic pair lies in Rep˝βl pAl q (resp. Rep˝βl pA_ l q). ˝ ˝ ˝ ˝ ˝ ˝ A pair in A ˆ A (or Ǎ ˆ Ǎ , A ˆ Ǎ ) is called generic if their corresponding representations are generic. Let pA ˆ Aq˝ , pA ˆ Ǎq˝ , and pǍ ˆ Ǎq˝ be the open subset of A ˆ A, A ˆ Ǎ, and Ǎ ˆ Ǎ consisting of generic pairs. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 5 Corollary 1.2 ([11, Corollary 4.6]). G acts freely on pA ˆ Aq˝ , pA ˆ Ǎq˝ , and pǍ ˆ Ǎq˝ . Their quotients are all isomorphic to H. We can reformulate the generic condition in terms of the diagonal GLl -action on A ˆ A and A ˆ Ǎ. It is easy to see that pA1 , A2 q (resp. pA, Ǎq) is generic if it is equivalent to pF, F hw0 q (resp. pF, hF̌ q) for some h P H under the GLl -action. Here w0 is the longest element in the Weyl group Sl of GLl . m Let Kl,l be the flagged m-arrow Kronecker quiver of length l ´1 / ´2 / ¨¨¨ / ´l a1 ,...,am m arrows ❴*4 l / ¨¨¨ /2 /1. m We still denote by βl the standard dimension vector βl piq “ |i| for Kl,l . We decompose the representation space as m Repβl pKl,l q :“ Repβl pAl q ˆ HompV´l , Vl qm ˆ Repβl pA_ l q. m m We call a map in HompV´l , Vl q a central map in Repβl pKl,l q. Let Rep˝βl pKl,l q be the m m q open subset of Repβl pKl,l q where all m central maps are invertible, and Rep1βl pKl,l be the closed subset where all m central maps are in G “ SLl . We have that (1.1) m Rep˝βl pKl,l q{ SLβl “ pA ˆ pGLl qm ˆ Ǎq{pG ˆ Gq. m Let Dc P SIβl pKl,l q be the product of central determinants Dc pM q :“ m ź m detpM pan qq for M P Repβl pKl,l q. n“1 m m So Rep˝βl pKl,l q “ Repβl pKl,l qzZpDq, where ZpDc q is the zero locus of Dc . We define m Zl,l :“ pA ˆ Gm ˆ Ǎq{pG ˆ Gq. The following lemma is a trivial fact but we will frequently use it (sometimes implicitly). Lemma 1.3. Localization with respect to an invariant commutes with taking invariants. m m Lemma 1.4. We have that Rep˝βl pKl,l q{ SLβl “ Zl,l ˆ pGm qm . In particular, “ m ‰ ` m˘ “ k Zl,l ˆ pGm qm . SIβl Kl,l D Proof. Recall the equality (1.1). Consider the G ˆ G-action on GLl “ G ¸ Gm . Since the action is trivial on Gm , we have that m m Rep˝βl pKl,l q{ SLβl “ pA ˆ pG ¸ Gm qm ˆ Ǎq{pG ˆ Gq “ Zl,l ˆ pGm qm . ‰ ‰ “ m “ m SLβl ˆ pGm qm . By Lemma 1.3, q “ k Zl,l Equivalently we have that k Rep˝βl pKl,l we have that ` “ ‰ ˘SL “ m ‰ m m SIβl pKl,l qD “ k Repβl pKl,l q D βl “ k Zl,l ˆ pGm qm .  6 JIARUI FEI For a positive integer n, we use the shorthand grns for the alternating product p´1qn´1 p´1qn´1 (1.2) Ý pA, g1 , . . . , gm , Ǎq ÞÑ pAgrn´1s , Agn , gÐ rns Ǎ, Ǎq, n P r2, ms even (1.3) Ý pA, g1 , . . . , gm , Ǎq ÞÑ pAgrn´1s , A, gÐ rns Ǎ, gn Ǎq, n P r3, ms odd. Ý g1 g2´1 ¨ ¨ ¨ gn , and gÐ rns for the product in reverse order gn us consider the map π rn : A ˆ Gm ˆ Ǎ Ñ A2 ˆ Ǎ2 given by ¨ ¨ ¨ g2´1 g1 . Let These maps followed by the quotient map A2 ˆ Ǎ2 Ñ pA2 ˆ Ǎ2 q{G are constant on the G ˆ G-orbits. By the universal property of the categorical quotient, we get a map πn : pA ˆ Gm ˆ Ǎq{pG ˆ Gq Ñ pA2 ˆ Ǎ2 q{G. (1.4) Note that each πn is dominant. We denote the quotient pA2 ˆ Ǎ2 q{G by X2,2 . Let ˝ X2,2 be the open subset of X2,2 where the pairs pA1 , A2 q, pA1 , Ǎ2 q, pA2 , Ǎ1 q and m pǍ2 , Ǎ1 q are all generic. We also define X2,2 to be the open subset of X2,2 where the pairs pA1 , Ǎ2 q and pA2 , Ǎ1 q are generic if m is even; pA1 , A2 q and pǍ2 , Ǎ1 q are generic if m is odd. Let m ˝ pZl,l qπ m be the open subset of Zl,l such that Ý pAgrns , Aq and pǍ, gÐ rns Ǎq are generic for each even n P r2, m ´ 1s; Ý pAgrns , Ǎq and pA, gÐ rns Ǎq are generic for each odd n P r1, m ´ 1s. m ˝ m In particular, pZl,l qπ is contained in the following open subset of Zl,l m ˝ pZl,l q :“ pA˝ ˆ Gm ˆ Ǎ˝ q{pG ˆ Gq. Recall that we say that g P SLl is Gauss decomposable if g “ uhu for some u P r l Ď SLl be some Tits’ lift of the Weyl group Sl . We U ´ , h P H, and u P U . Let S r write w r for the lift of w in Sl . Lemma 1.5. For any g P SLl , pF g, F̌ q (resp. pF g, F q) is generic if and only if g (resp. g w r0 ) is Gauss decomposable. Proof. By the Bruhat decomposition we can write g as g “ uhwu r with u P U ´ , h P r H, w P Sl , and u P U . By Lemma 1.1, pF g, F̌ q “ pF hw, r F̌ q. It is generic if and only if w r is the identity element. The argument is similar for pF g, F q.  Here is our key lemma. We suggest readers skipping its proof for the first-time read. The proof is easy to understand once readers have some pictures of Section 4 in mind. Lemma 1.6. The restriction of the map m π :“ pπ2 , . . . , πm q : Zl,l Ñ pX2,2 qm´1 m ˝ ˝ m´2 to the open set pZl,l qπ is a closed embedding to pX2,2 q ˆ X2,2 . m m ˝ Proof. We first show that the map restricted to pZl,l qπ is injective. By the definition ` m ˝˘ m ˝ m´2 m ˝ ˝ ˆX2,2 . We have seen that pZl,l q and X2,2 of π, the image π pZl,l qπ is in pX2,2 q m ˝ are geometric quotients. A point in pZl,l q can be represented by pF, g1 , . . . , gm , F̌ q. We keep in mind that the stabilizer of F h and hF̌ are U ´ and U (Lemma 1.1). By Lemma 1.5 g1 is Gauss decomposable, so we can assume that g1 P H. Suppose CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 7 1 that it has the same image as pF, g11 , . . . , gm , F̌ q with g11 P H. In particular, they m have the same image under π2 : Zl,l Ñ X2,2 , that is, ˘ ` ˘ ` ´1 (1.5) F g1 , F g2 , g2´1 g1 F̌ , F̌ “ F g11 , F g21 , g21 g11 F̌ , F̌ in X2,2 . Comparing the first and last factors in (1.5), we see that there are some u P U ´ and u P U such that u´1 g1 u “ g11 . Since g1 , g11 P H, we must have that u “ u “ e so g1 “ g11 “ h. Since the stabilizer of the generic pair pF h, F̌ q is equal to U ´ X U “ teu, (1.5) also implies that g21 g2´1 P U ´ and pg21 ´1 1 ´1 ´1 g1 q g2 g1 “ h´1 g21 g2 ´1 h P U. So g21 g2´1 P U ´ X h´1 U h “ teu, and we conclude that g2 “ g21 . We will prove gi “ gi1 for i P r1, ms by induction. We have treated the initial case. Let us assume that gi “ gi1 for i P r1, k ´ 1s and k is odd, then we consider m the map πk : Zl,l Ñ X2,2 . We have that ˘ ` 1 ˘ ` 1 1 Ý (1.6) Ý F̌ , gk F̌ in X2,2 . F grk´1s , F, gÐ rks F̌ , gk F̌ “ F grk´1s , F, gÐ rks 1 By the induction hypothesis, we have that grk´1s “ grk´1s . Since the stabilizer of the generic pair pF grk´1s , F q is teu, (1.6) implies that ˘´1 1 1 ` ´1 1 ÝÝÝÝ gk gÐ ÝÝÝÝ P U. Ý “ gk gÐ gk´1 gk1 P U and gÐ Ý gÐ rk ´ 1s rk ´ 1s rks rks ÝÝÝÝ r0 is Gauss decomposable. For the similar reason By the generic assumption, gÐ rk ´ 1s w ÝÝÝÝ r0 “ h P H. So w r0 h´1 gk ´1 gk1 hw r0´1 P U , and as before, we can assume that gÐ rk ´ 1s w thus gk´1 gk1 P U X hw r0´1 U w r0 h´1 “ U X U ´ “ teu. We conclude that gk “ gk1 . Similar argument can also treat the case when k is even. Therefore we finished the proof by induction. ` m ˝˘ m ˝ m´2 q ˆ X2,2 . We remain to show that the image π pZl,l qπ is closed in pX2,2 Let pij be` the natural projection from X2,2 to A2 {G (or pA ˆ Ǎq{G) induced by ˘ 2 mapping A1 , A1 , Ǎ1 , Ǎ2 P A ˆ Ǎ2 to its i, j-th factors. We shall write pni,j for ˝ m´1 the projection pi,j from the pn ´ 1q-th copy in pX2,2 q (note that the pn ´ 1q-th copy is the target of the map πn ). We recall from Corollary 1.2 that the quotient pA ˆ Aq˝ {G or pA ˆ Ǎq˝ {G is geometric and is isomorphic to the maximal torus m ˝ m´2 H Ă G. We define the map p : pX2,2 q ˆ X2,2 Ñ H 2p2m´3q by 1 ´ ¯ m´1 m m p21,4 , p22,3 , p21,2 , p31,2 , p23,4 , p33,4 , p31,4 , p41,4 , p32,3 , p42,3 , . . . , pm´1 , p , p , p i,j k,l k,l , i,j where pi, j, k, lq “ p1, 2, 3, 4q if m is odd; pi, j, k, lq “ p1,`4, 2, 3q ˘if m is even. It m ˝ qπ is equal to the is easy to see from the definition of π that the image π pZl,l ` ˘ inverse image p´1` p∆H q2m´3 , where ∆ is the diagonal in H ˆ H. This implies H ˘ m ˝  the closeness of π pZl,l qπ . 2. Schofield’s Semi-invariants 2.1. The semi-invariants sni,j . We follow the setting in [23]. Let Q be a finite quiver and add(Q) be the additive k-category generated by Q. For each vertex i we have an object Pi in add(Q) such that HomaddpQq pPi , Pj q is the vector space with 1The components of p correspond to the disk diagonals in the triangulation T (see Section 4) m 8 JIARUI FEI basis the paths from j to i including the trivial path ei if i “ j. From now on, we 0 shall write HomQ p´, ´q for HomaddpQq p´, ´q. For any f P ZQ ě0 , we denote à fpiqPi . P pfq :“ iPQ0 We call an element f in HomQ pP pf1 q, P pf0 qq a presentation. The weight of f is by definition f1 ´ f0 . From now on, we will view a weight as an element in the dual HomZ pZQ0 , Zq via the usual dot product. Recall that for any presentation f of weight f with fpβq “ 0, we can associate a Schofield’s semi-invariant function ([22]) spf q defined by spf qpM q :“ det M pf q, where M pf q is the matrix obtained from the transpose matrix of f by substituting each path p by M ppq. It is easy to check that spf q lies in the weight space ( SIβ pQqf :“ f P krRepβ pQqs | gpf q “ fpgqf, @g P GLβ , where by abuse of notation fpgq is the character map ź` ` ˘ ˘fpiq gpiq iPQ0 ÞÑ det gpiq . iPQ0 In this context f is also called the σ-weight of spf q. Definition 2.1. A Schofield’s semi-invariant is called pure if all the entries in the matrix representing f are given by a single path (rather than a linear combination of paths). m Let K l,l be the quiver m arrows ´1 / ´2 / ¨¨¨ / ´l ❱ eo ❯$/ l / ¨¨¨ /2 /1 m arrows m This quiver can be obtained from Kl,l by adjoining m arrows from l to ´l. We label the m new arrows by a´1 for n P r1, ms. We impose the relations n ´1 an a´1 n “ e´l and an an “ el for each n. So we can view each a´1 n as the formal (two-sided) inverse of an . A representation m M of K l,l with the above relation satisfies that ´1 M pan qM pa´1 n q and M pan qM pan q are identity matrices. This in particular implies that each M pan q P GLl . Throughout this paper, a m representation of K l,l always satisfies these relations. For any finite sequence I :“ pi1 , i2 , . . . , in q of numbers in r1, ms, we can associate a path from ´l to ˘l (˘ depends on the parity of the length of I) p´1qn´1 aI :“ ai1 a´1 i2 ai3 ¨ ¨ ¨ ain . Now each triple pi, j, Iq with n odd determines a unique path from ´i to j via I: pI´i,j :“ p´i,´l aI pl,j , where p´i,´l (resp. pl,j ) is the unique path from ´i to ´l (resp. from l to j). In this paper, I is always a subinterval in r1, ms with usual or reverse order. I,J For I and J both of odd length, let fi,j;k be the presentation (2.1) ppI´i,k ,pJ´j,k q Pk ÝÝÝÝÝÝÝÝÑ P´i ‘ P´j . CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 9 In this paper, we frequently abbreviate I for pI´i,k as a map in HomK m pPk , P´i q. l,l pI,Jq I,J So we shall write Pk ÝÝÝÑ P´i ‘ P´j for (2.1). When i ` j “ k, we will write fi,j ` I,J ˘ I,J for fi,j;k . So s fi,j is a pure Schofield semi-invariant of weight ek ´ e´i ´ e´j . By ` I,J ˘ [7, Lemma 1.8], all s fi,j are irreducible. Another convention is that if i or j is zero, then we set P´i or P´j to be zero. m We extend the involution _ on the path algebra kKl,l defined in [9] 2 to the Ð Ý m I , and thus k-category generated by K l,l as follows. It sends the path pI´i,j to p´j,i induces a map ´à ¯ ´à ¯ à à _ : HomK m Pj , P´i Ý Pi , P´j . Ñ HomK m l,l j l,l i i j ˘ `Ð ÝÐ Ý I ,J I,J I,J We will denote _fi,j by fˇi,j : Pi ‘ Pj ÝÝÝÝÝÑ P´k . In most part of this paper, we only care about the cases when I “ n and J “ rns or rn ´ 1s depending on the parity of n. In fact, they are n,rn´1s n fi,j :“ fi,j n,rns n fi,j :“ fi,j pn,rn´1sq : Pi`j ÝÝÝÝÝÝÑ P´i ‘ P´j pn,rnsq : Pi`j ÝÝÝÝÑ P´i ‘ P´j if n is even; if n is odd, n n n and their duals fˇi,j . We define sni,j :“ spfi,j q and šni,j :“ spfˇi,j q. m 2.2. Lifting sni,j . In this subsection we lift each sni,j to a function srni,j P SIβ pKl,l q. Definition 2.2. For any n P r1, ms, we define $ n ’ ’ &si,j ´ ` ¯ if j “ 0; rns ˘ n sri,j pM q :“ sni,j pM q det M aev if 1 ď i ` j ă l or n is even; ’ ’ %srn´1 pM q if i ` j “ l and n is odd. i,j ´ ` ¯ ś rns ˘ where we set det M aev :“ iPrn´1s even det M pai q. Similarly we define sřni,j by replacing sni,j with šni,j in the above formula. Remark 2.3. One reason why these cases should be treated separately is that otherwise Corollary 2.7 below will not hold. More reasons can be found in Section 5.1. m We are going to show that srni,j is regular on Repβl pKl,l q. Suppose A, B, C, D are p ˆ p, p ˆ q, q ˆ p, q ˆ q matrices respectively. Consider the block matrix B M “ pA C D q with D nonsingular. The Schur complement M {D of the block D in M is A ´ BD´1 C. Similarly if A is nonsingular, the Schur complement M {A is D ´ CA´1 B. Here is a standard fact in linear algebra. Lemma 2.4. detpM q “ detpDq detpM {Dq. 2It is denoted by ´ there. 10 JIARUI FEI n Let fri,j be the following presentation » Pi`j » Pi`j fi ¨¨¨ 0 ffi ffi .. .. ffi . ffi . 0 0 2 3 ffi ffi .. .. .. .. .. ffi . . . 0 ffi . . ffi ffi 0 0 ¨¨¨ 0 n´4 n´3 ffi fl 0 n ´ 1 0 ¨¨¨ 0 n´2 ‘ rPl ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÑ P´i ‘ P´j ‘ rP´l — — — — — — — — — — — – 0 n 1 0 ¨¨¨ 0 ffi ffi .. .. ffi . ffi . 0 0 2 3 ffi ffi .. .. . . .. .. ffi . . . 0 ffi . . ffi ffi 0 0 ¨¨¨ 0 n´3 n´2 ffi fl 0 n 0 ¨¨¨ 0 n´1 ‘ rPl ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÑ P´i ‘ P´j ‘ rP´l — — — — — — — — — — — – n 0 1 for n “ 2r ` 2, fi 0 for n “ 2r ` 1. We remind readers that according to our convention each entry n in the matrix represents the unique path passing an . Lemma 2.5. Suppose that j ‰ 0, then we have that # n p´1qjr spfri,j q if 1 ď i ` j ă l or n is even; n sri,j “ n´1 jpr´1q r p´1q spfi,j q if i+j=l and n is odd. m q. In particular, srni,j P SIβl pKl,l Proof. We only prove the statement for¯ even n. The case for odd n is similar. We ´ fA fB n n r r decompose fi,j in blocks fi,j “ fC fD , where pn,0q fA : Pi`j ÝÝÝÑ P´i ‘ P´j , p1,0,¨¨¨ ,0q fB : Pi`j ÝÝÝÝÝÝÑ rP´l , ´ 0 ¨¨¨ 0 0 0 ¨¨¨ 0 n´1 ¯T fC : rPl ÝÝÝÝÝÝÝÝÝÝÑ P´i ‘ P´j , fD : rPl Ý Ñ rP´l . n The Schur complement of M pfD q in M pfi,j q is M pfA q ´ M pfC qM pfD q´1 M pfB q. ´1 Elementary linear algebra shows that M pfD q´1 “ M pfD q, where ¨ ˚ ˚ ˚ ˚ ˚ ˚ ˚ ˚ ˚ ˝ ˛ ´1 ´1 ´1 ¨¨¨ z a´1 a´1 ´a´1 2 a3 a4 a5 a6 2 2 a3 a4 ‹ . . ‹ ´1 .. .. ´a´1 0 a´1 ‹ 4 a5 a6 4 ‹ ‹ .. .. .. .. .. ‹ . . . . . ‹ ‹ .. .. .. ´1 ´1 ... . . . ´an´4 an´3 an´2 ‹ ‚ 0 ¨¨¨ ¨¨¨ 0 a´1 n´2 ´1 : rPl ÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÝÑ rP´l . fD śn´2 p´1qi´1 “ p´1qr´1 a´1 In particular, z “ p´1qr´1 i“2 ai 1 arn´2s . Then ` ˘ ´1 r fA ´ fB fD fC “ n, p´1q rn ´ 1s : Pi`j Ý Ñ P´i ‘ P´j , ˘ ` ´1 so sni,j “ p´1qjr det M pfA ´ fB fD fC q . Note that ´1 fC q. M pfA q ´ M pfC qM pfD q´1 M pfB q “ M pfA ´ fB fD CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 11 By Lemma 2.4, ` ˘ n ´1 spfri,j qpM q “ det M pfA ´ fB fD fC q detpM pfD qq ź “ p´1qjr sni,j pM q det M pai q iPrns even “ p´1qjr srni,j pM q.  Let W be the m-dimensional vector space spanned by the arrows from ´l to l. Let T be the subgroup of diagonal matrices in GLpW q. The semi-invariant ring SIβ pKlm q is also graded by the T -weights λ. We call σ r :“ pσ, λq the extended 1 ,l2 σ-weight. Note that σ-weight of srni,j is equal to $ ’ j “ 0; &ei`j ´ e´i ´ e´j n σi,j :“ ei`j ´ e´i ´ e´j ` pr ´ 1qpel ´ e´l q i ` j “ l and n “ 2r ` 1; ’ % ei`j ´ e´i ´ e´j ` rpel ´ e´l q otherwise . We set ǫpkq :“ p´1qk´1 . We write ras` for maxpa, 0q. Lemma 2.6. Each srni,j is T -homogeneous of degree equal $ ’ &ien ř n λi,j :“ ien ` kPrns prǫpkqs` jek ` r´ǫpkqs` pl ´ jqek q ’ ř % ien ` kPrn´1s prǫpkqs` jek ` r´ǫpkqs` pl ´ jqek q to j “ 0; j ě 1, i ` j ă l, n odd; j ě 1, n even, or i ` j “ l, n odd. Proof. The case when j “ 0 is clear. For the rest, we observe that det ak is T homogeneous of degree lek and sni,j is T -homogeneous of degree # ř ien ` j kPrn´1s ǫpkqek if n is even; ř if n is odd and i ` j ă l. ien ` j kPrns ǫpkqek Then the result follows easily from Lemma 2.5.  m q. Corollary 2.7. Each srni,j is irreducible in SIβl pKl,l n Proof. By [7, Lemma 1.8], it suffices to show that each pσi,j , λni,j q is an extremal n m σ r-weight. Any decomposition of σi,j into σ-weights in SIβl pKl,l q must contain some multiple of el ´ e´l , say ppel ´ e´l q. According to [3, 23, 6] the semi-invariant of this σ-weight is spanned by the Schofield’s semi-invariants spf q, where f : pPl Ñ pP´l . So if it is T -homogeneous, then its λ-weight must be equal to lµ for some non-zero n µ P Zm ě0 . Then λi,j ´ lµ is not a λ-weight because it has some negative coordinate. A contradiction.  m q. In view of this lemma, each srni,j minimally lift sni,j to SIβl pKl,l We leave it to readers to formulate the analogous statement for the duals sřni,j . 3. Graded Upper Cluster Algebras The upper cluster algebras needed in this paper are so-called skew-symmetric and of geometric type. To define such an upper cluster algebra one needs to specify a seed p∆, xq in some ambient field F Ą k. Here, ∆ is an ice quiver with no loops 12 JIARUI FEI or oriented 2-cycles and the extended cluster x “ tx1 , x2 , . . . , xq u is a collection of algebraically independent (over k) elements of F attaching to each vertex of ∆. An ice quiver ∆ “ p∆0 , ∆1 q is a quiver, where some vertices in ∆0 are designated as mutable while the rest are frozen. We denote the set of mutable (resp. frozen) vertices of ∆ by ∆µ (resp. ∆ν ). We usually label the quiver such that the first p vertices are mutable. Up to arrows between frozen vertices, such a quiver is uniquely determined by its B-matrix Bp∆q. It is a p ˆ q matrix given by bu,v “ |arrows u Ñ v| ´ |arrows v Ñ u|. The elements of x associated with the mutable vertices are called cluster variables; they form a cluster. The elements associated with the frozen vertices are called frozen variables, or coefficient variables. Definition 3.1. Let u be a mutable vertex of ∆. The quiver mutation µu transforms ∆ into the new quiver ∆1 “ µu p∆q via a sequence of three steps. (1) For each pair of arrows v Ñ u Ñ w, introduce a new arrow v Ñ w; (2) Reverse the direction of all arrows incident to u; (3) Remove all oriented 2-cycles. Definition 3.2. A seed mutation µu at a (mutable) vertex u transforms p∆, xq into the seed p∆1 , x1 q “ µu p∆, xq defined as follows. The new quiver is ∆1 “ µu p∆q. The new extended cluster is x1 “ x Y tx1u uztxu u where the new cluster variable x1u replacing xu is determined by the exchange relation ź ź xu x1u “ xv ` xw . vÑu 1 uÑw 1 We note that the mutated seed p∆ , x q contains the same coefficient variables as the original seed p∆, xq. It is easy to check that one can recover p∆, xq from p∆1 , x1 q by performing a seed mutation again at u. Two seeds p∆, xq and p∆: , x: q that can be obtained from each other by a sequence of mutations are called mutation-equivalent, denoted by p∆, xq „ p∆: , x: q. Let Lpxq be the Laurent polynomial algebra in x over the base field k. If ∆ is an ice quiver, we denote by L∆ pxq in x which is polynomial ‰ “ the Laurent polynomial ‰ “ in xp∆ν q, that is, L∆ pxq :“ k xp∆µ q˘1 , xp∆ν q “ k x˘1 , . . . , x˘1 p , xp`1 , . . . xq . 1 Definition 3.3 (Upper Cluster Algebra). The upper cluster algebra (or UCA in short) with seed p∆, xq is č Cp∆, xq :“ L∆ px: q. p∆: ,x: q„p∆,xq Note that our definition of UCA is slightly different from the original one in [1], where L∆ px: q is replaced by Lpx: q. The Laurent Phenomenon [15, 1] says that a UCA contains all cluster and coefficient variables. Any UCA, being a subring of a field, is an integral domain (and under our conventions, a k-algebra). Since normality is preserved under localization and intersection, any UCA is normal. The next lemma is useful to identify a UCA as a subalgebra of some given Noetherian normal domain. Let R be a finitely generated k-algebra. We call two elements of R coprime in codimension 1 if the locus of their common zeros has codimension ě 2 in SpecpRq. Definition 3.4. We say that a seed p∆, xq is CR1 in R if CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 13 (1) x Ă R and each x1u P R. (2) each pair of cluster variables in x and each pair pxu , x1u q are coprime in codimension 1 in R. Lemma 3.5 ([13, Proposition 3.6]). Let R be a finitely generated k-algebra and a normal domain. If p∆, xq is a CR1 seed in R, then R Ě Cp∆, xq. Let e be a subset of ∆0 . We write xpeq for the set txe uePe . If xpeq is contained ś in a ring R, then we write Rxpeq for the localization of R at the product ePe xe . Let ∆e be the ice quiver obtained from ∆ by freezing every vertex in e. Lemma 3.6 ([8, Lemma 2.4]). Let e be a subset of ∆µ . Suppose that p∆, xq is a CR1 seed in Cp∆, xq, which is Noetherian. Then Cp∆, xqxpeq “ Cp∆e , xqxpeq . Definition 3.7 ([7]). A weight configuration σ of Zn on an ice quiver ∆ is an assignment for each vertex v of ∆ a (weight) vector σpvq P Zn such that for each mutable vertex u, we have that ÿ ÿ (3.1) σpvq “ σpwq. vÑu uÑw By slight abuse of notation, we can view σ as a matrix whose v-th row is the weight vector σpvq. In this matrix notation, the condition (3.1) is equivalent to Bσ is a zero matrix. Given a weight configuration σ on ∆, we can assign a multidegree (or weight) to the UCA Cp∆, xq by setting degpxv q “ σpvq for v P ∆0 . Then mutation preserves multihomogeneousity. We say that this UCA is σ-graded, and denoted by Cp∆, x; σq. m 4. krZl,l s as a UCA 4.1. Cluster structure of krX2,2 s. We denote the quotient pAp ˆ Ǎq q{G by Xp,q . The coordinate algebra krXp,q s is the same as semi-invariant ring of the quiver representations of Slp,q with the standard dimension vector βl : p1q ppq 1 /2 / ¨¨¨ .. . .. . .. . 1 /2 / ¨¨¨ / l´1 ❋❋ ❋❋ ❋❋ .. # . ①; l ① ①① ①① / l´1 l´1 ①; ① ①① . ①① .. ❋❋ ❋❋ ❋❋ # l´1 / ¨¨¨ /2 /1 .. . .. . .. . / ¨¨¨ /2 /1 p1q pqq It was proved in [7] that the algebra krX3,0 s is an upper cluster algebra. The quotient X3,0 is isomorphic to X2,1 and X1,2 , which are more useful for our purpose. We shall describe the seed p∆l , sl q for krX2,1 s directly. To do this, we only need to specify an oriented triangle with vertices labeled by (dual) flags: Ǎ1✼ ✞✞ ✼✼✼ ✞ ✼ ✞ ✞✞ ö ✼✼✼ ✞ ✞ A1 A2 We will denote such an oriented triangle by a cyclically ordered triples, eg., rǍ1 , A1 , A2 s “ rA1 , A2 , Ǎ1 s “ rA2 , Ǎ1 , A1 s. 14 JIARUI FEI The ice quiver ∆l is the (ice) hive quiver of size l. It has a cyclic symmetric. However, we label its vertices by two numbers in a non-symmetric manner according to the vertices in the triangle. The labels of the frozen vertices on the side Ǎ1 Ai (i “ 1, 2) have zeros in their j-th coordinates (i ‰ j). The orientation of ∆l is determined by the orientation of the triangle. Here is a picture of hive quiver ∆5 for the above oriented triangle. The dashed lines are called edges of ∆l . The cluster / 0,1 ✻ Z ✻✻ ✟✟ ✼✼ ✞✞ ✟ / 1,1 / 0,2 2,0 Z✻✻ ✼ [ ✟ ✼ ✻✻ ✞✞ ✼✼ ✼✼ ✟✟ ✞✞ ✞ ✟  / 1,2✞ / 2,1 / 0,3 3,0 Z✻✻ [✼✼ [✼✼ ✼✼ ✞ ✟ ✞ ✞ ✻ ✼ ✼✼ ✞✞ ✻ ✟✟✟ ✼ ✞✞✞ ✞ ✞ / 1,3 / 0,4 / 2,2 / 3,1 4,0 [✼✼✼ ✞ [✼✼✼✼ ✞ [✼✼✼✼ ✟✟ Z✻✻✻ ✞ ✞ ✞ ✟ ✞✞ ✞✞ ✞✞ 4,1 ❴ ❴ ❴ 3,2 ❴ ❴ ❴ 2,3 ❴ ❴ ❴ 1,4 1,0 Figure 1. The hive quiver ∆5 variable sl pi, jq “ si,j is the semi-invariant associated to the presentation ppi ,pj q fi,j : Pi`j ÝÝÝÝÑ Pi1 ‘ Pj2 , where pi is the unique path in HomS 2,1 pPi`j , Pi1 q. To define the cluster structure l on krX1,2 s we only need to dualize the construction for krX2,1 s. Its cluster variable šl pi, jq “ ši,j is the semi-invariant associated to the projective presentation ppi ,pj q fˇi,j : Pi1 ‘ Pj2 ÝÝÝÝÑ Pi`j . We can reformulate the generic condition in terms of these si,j on the edges. Lemma 4.1. A pair pA1 , Ǎ1 q P A1 ˆ Ǎ1 (resp. pA1 , A2 q P A1 ˆ A2 ) is generic if and only if it is not vanishing on any si,0 (resp. si,j pi ` j “ lq). Given a pair of oriented triangles, we can glue them along a pair of edges. For example, ⑧❁❁ ⑧❁❁ ⑧⑧ ❁❁❁ ⑧⑧ ❁❁❁ ⑧ ⑧ ⑧ ö ❁❁ ⑧ ö ❁❁ ❁ ❁ ⑧⑧ ⑧⑧ ❄ ❄ ⑧ ⑧❄ ❄❄ ❄❄ ✄✄ ✄✄ ❄ ✄ ✄ ❄❄ö ✄✄ ❄❄œ ✄✄ ❄❄ ✄✄ ❄❄ ✄✄ ✄ ✄ Figure 2 They correspond to the gluing of two ice hive quivers of the same size by identifying frozen vertices along the common edge. After the identification, we unfreeze those frozen vertices, and add additional arrows depending on the orientations as illustrated in Figure 3. The additional arrows are in red. The gluing on the left (resp. right) is called consistent (resp. non-consistent). CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II /‚ ❅❅ ❅❅ ⑧⑧⑧⑧ /‚ / ⑧ ‚ _❅ ⑧‚_❅❅ ❅❅ ❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧⑧ / ⑧ / ⑧ /‚ ‚ _❅ ⑧‚_❅❅ ⑧‚_❅❅ ❅❅ ❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧⑧ / ⑧ / / ⑧ / ⑧ ‚ a❈ ❈❈ ④④④‚a❈❈❈❈ ④④④‚a❈❈❈❈ ④④④‚a❈❈❈❈ ④④‚ ❈ }④④ ❈ }④④ ❈ }④④ ❈ }④④ ④‚= ❈❈ ④‚= ❈❈ ④‚= ❈❈ ④‚= ❈❈ ④④ ❈❈❈! ④④④④ ❈❈❈! ④④④④ ❈❈❈! ④④④④ ❈❈! ④ o o o ‚o ‚ ⑧‚? ❅❅ ⑧‚? ❅❅ ⑧‚? ❅❅ ⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧ ‚ ⑧ ? ⑧ ❅o ‚o ? ⑧ ‚ ‚ ❅o ⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅❅ ⑧ ❅ ⑧⑧ ‚ ⑧⑧ o ‚o ⑧‚? ❅❅❅❅ ⑧ ⑧ ❅ / ‚ ⑧⑧ ‚ ‚ _❅ 15 /‚ ❅❅ ❅❅ ⑧⑧⑧⑧ /‚ / ⑧ ‚ _❅ ⑧‚_❅❅ ❅❅ ❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧⑧ / ⑧ / ⑧ /‚ ‚ _❅ ⑧‚_❅❅ ⑧‚_❅❅ ❅❅ ❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧⑧ / ⑧ / / ⑧ / ⑧ ‚ a❈ ❈❈ ④④④‚a❈❈❈❈ ④④④‚a❈❈❈❈ ④④④‚a❈❈❈❈ ④④‚ ❈/ }④④ ❈/ }④④ ❈/ }④④ ❈ }④④ ‚a❈ ‚a❈ ‚a❈ ‚a❈ ④④ ❈❈❈❈ ④④④④ ❈❈❈❈ ④④④④ ❈❈❈❈ ④④④④ ❈❈❈ }‚ ④④ / }④ / }④ / }④ /‚ ⑧‚_❅❅ ⑧‚_❅❅ ⑧‚_❅❅ ⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅ ⑧ ⑧ ⑧ ⑧ /‚_❅ /‚ / _❅ ‚ ‚ ⑧⑧ ❅❅❅ ⑧⑧⑧ ❅❅❅❅ ⑧ ⑧ ❅ ⑧ ⑧ ⑧ /‚ /‚_❅ ‚ ⑧⑧ ❅❅❅❅ ⑧ ⑧⑧ /‚ ‚ ‚ _❅ Figure 3 More generally, let us recall that an ideal oriented triangulation of a marked bordered surface S is an oriented triangulation of S whose vertices are the marked points of S. All triangulations in this paper will be ideal and oriented. Let T be a triangulation of a marked bordered surface S. Then we can glue ice hive quivers of size l according to such a triangulation. We denote the resulting ice quiver by ♦l pTq. We allow self-fold triangles and two triangles glue along more than one edge. Note that they happen only when there are punctures (=marked points on the interior of S). Figure 4 is a picture for such a triangulation. ö ‚ œ A ‚ q‚/ A ❁f▼▼ / ‚ ❁ ✂✂qqq✂q✂✂ ❁❁❁▼▼▼▼❁❁❁ ✂ ❁ ▼❁ q ✂ ✂ ✂xq✂qq /‚G ✂w ✂ /‚G ✴d■ ❁‚/  ✴d■ ▼▼❁/‚ ✴d■ / ‚ / ‚ ‚ G ■ ■ ■ ✉ ✉ ✉ ✎G ✉✉✎✎ ✉✉✎✎ ✉✉✎✎ ✴✴ ■■ ✴✴ ■■ ✴✴ ■■ ✲✲ ✎✎z✉✎✉✉✉/ ✎z✉✎ ✉✉✉/ ✎z✉✎ ✉✉✉/ ✎v ✎ ✴ ■■■✴/  ■■■✴/  ■■■✲✲/  ‚✴d■ ✴✴■■■‚✴d■✴ ■■■‚✴d■✴ ■■■‚✴h ✴ ✎‚G ✉✉✉✎‚G ✉✉✉✎‚G ✉✉✉✑✑‚H ✴ ■■✴✴ ■■✴✴ ■■✴✴ ✎✎ ✉✉ ✎✎ ✉✉ ✎✎ ✉✉ ✑✑ ■ ✉ ■ ■/  ✉ ✉ f▼❁▼▼ ‚/  ❁g ❁ /‚ ✎z✉ ✂‚/ A ✎z✉ qq✂/‚A ✎z✉ / ‚ ‚ ‚❁ ❁❁▼▼▼❁❁ q ✂ ✂ q ❁❁ ▼▼❁❁ ✂✂✂qqq ✂✂✂  ‚ ▼‚/  ✂xqq / ‚ ✂ Figure 4 The result for krX3,0 s has been generalized to krXp,0 s as an example in [11]. Since krXp,q s is isomorphic to krXp`q,0 s, we actually get a cluster structure for all krXp,q s. For the rest of this subsection, we shall give a seed for krX2,2 s. We knew from [11] that the ice quiver of the upper cluster algebra krX4,0 s corresponds to the triangulation of a rectangle as in Figure 2 (left). However, we will consider a seed of krX2,2 s different from the one directly transferring from that of krX4,0 s. For this, let us recall an operation for T called twist defined in [11]. To describe this operation, we need to specify a triangle t P T and one of its edges e. The twist consists of 3 steps. (1) Cut along the other two edges of the chosen triangle (see Figure 5 left); (2) Change the orientation of the triangle and the identification of the two edges (the new identification is indicated by arrows, see Figure 5 right); 16 JIARUI FEI (3) Glue according to the new identification. ❁ ⑧⑧ ❁❁❁ ⑧ ❁❁ ⑧⑧ ❁❁ ⑧⑧ ❁ ❄ ⑧ ❁ ❁ ❄ ⑧ ⑧ ❁❁❄❄ ✄✄⑧⑧⑧ ❁❁❁ ⑧ ✄ ? ❁ ❁❄  ö A✄ ⑧ ⑧ ❁❁ ❁❁❄❄❄ ✄✄✄⑧A ⑧⑧? ❁❁ ⑧⑧ ⑧⑧ ✄⑧ ❁ ⑧⑧ ❁❁❁ ⑧ ❁❁ ⑧⑧ ❁❁ ⑧⑧ ❄ ❁ ❁ ⑧ ❄ ❁ ⑧ ⑧ ❁❁❄❄ ✄✄⑧⑧⑧ ❁❁❁ ⑧ ✄ ?  œ A✄ ⑧ ❁ ❁❄ ❁❁ ⑧ ❁❁❄❄❄ ✄✄✄⑧⑧⑧? ❁❁ ⑧⑧ ✄⑧ ⑧⑧ Figure 5. The twist We have a few remarks. In Step (1), if any of two edges is a part of boundary, then we do nothing for that edge. Readers should be aware that the new identification in Step (2) is not just a naive “interchange”. For example, let a be the vertex opposite to the chosen edge. According to our definition, the vertices of adjacent triangles previously glued to a will not be glued to a. Finally, we need to warn readers that this operation may alter the topology of the surface as we shall see. We denote the new triangulation (of a possibly new surface) by Tt,e . Lemma 4.2. [11, Lemma 3.3] There is a sequence of mutations µt,e such that µt,e p♦l pTqq “ ♦l pTt,e q. Readers can find the definition of µt,e in the proof of [11, Lemma 3.3]. Here we provide a picture for the hive quiver ∆5 (Figure 1) after applying the twist for the vertex e “ Ǎ1 . 4,0 0,4 o C✞ ✻✻ D ✼✼✼ ✟ ✞ ✻ ✟✟ ✞  1,1 o 3,0 0,3 o ✼✼ C C ✼✼✼ ✟D ✻✻✻ ✞ ✞ ✟ ✼ ✞ ✞ ✻ ✞✞ ✼ ✟✟ ✞  2,1 o 2,0 0,2 o 1,2 o D ✼✼ C ✻✻ ✼✼✼ ✼✼ C C ✟ ✞ ✞ ✞ ✻ ✼ ✞ ✼✼ ✞ ✻ ✟✟✟ ✼ ✞✞✞  ✞✞  ✞ 0,1 o 2,2 o 1,3 o 3,1 o 1,0 ✻ ✼ C D C ✼ C ✼✼✼ ✞ ✼✼✼ ✟✟ ✻✻ ✞ ✼✼✼ ✞ ✞ ✞  ✞✞  ✞✞  ✟  ✞✞ 1,4 o 3,2 o 2,3 o 4,1 We apply this operation to the seed transferring from krX4,0 s. The mutated quiver, denoted by ♦l 3, is the ice quiver corresponding to the triangulation in Figure 2 (right). We denote such a cluster still by sl . This seed can be visualized by the following picture. Recall that we have defined the seed for each triangle. Readers may reflect for a while to convince that the semi-invariants do agree along the common edge. 3Unfortunately we use this notation for a slightly different quiver in [9] CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 17 A ✂ 2❁❁❁ ❁❁ ✂✂ ✂ ❁❁ ✂ ✂ ❁ ö ✂ ✂ A1 Ǎ1 ❀ A1 ❀❀ ✄Ǎ1 ❀❀ œ ✄✄✄ ❀❀ ✄ ❀ ✄✄✄ Ǎ2 Figure 6 Lemma 4.3. The coordinate algebra krX2,2 s is isomorphic to the upper cluster ˝ algebra Cp♦l , sl q. Moreover, krX2,2 s is exactly krX2,2 s localizing at all frozen variables. m 4.2. Cluster Structure of krZl,l s. We fix an element g :“ pg1 , g2 , . . . , gm q P Gm . We shall write gI´1 :“ pgI q´1 . We mainly concern the two kinds of triangles in Figure 7 for n P r2, ms and their duals. By definition, the dual of such a triangle A✾ ✁✁ ✾✾✾ ✁ ✾✾ ✁✁ ✾✾ ✁✁ ö ✁ ✁ ´1 Agrns grn´1s Ǎ n is even A✾ ✁✁ ✾✾✾ ✁ ✾✾ ✁✁ ✾✾ ✁✁ ö ✁ ✾ ✁ ´1 Agrn´1s grns Ǎ n is odd Figure 7. The triangles tn ´1 Ý and all Ag ´1 to gÐ changes all gI Ǎ to AgÐ Ý Ǎ, and reverses the orientation. We I I I denote the both kinds by tn and their duals by ťn . It is clear that we can (consistently) glue the right edge of tn to the left edge of tn`1 for any n. We can also (non-consistently) glue tn and ťn along their bases if we introduce the G-action on Ap ˆ Ǎq . We justify this by Figure 6 and the following picture (for even n), where we transfer the triangles to equivalent ones by the G-action. According to construction of the last subsection, it is clear from the right-hand side of Figure 8 that when g varies the cluster variable sl ptn ; i, jq associated to tn is equal to sni,j and similarly sl pťn ; i, jq “ šni,j . We define the G-type of the edge Ag1 g2 Ǎ to be g1 g2 . Two such edges can be identified as in Figure 6 if and only if they have the same G-type. To define Ag2 , we need to fix a direction, say Ag1 ÝÑAg2 . the G-type of the edge Ag1 In this case, we define its G-type to be g1 g2´1 . We remark that this direction has nothing to do with the orientations of the triangles. Then two such edges can be identified along the chosen directions if and only if they have the same G-type. Although there is an ambiguity for this G-type, the triangle rg0 Ǎ, Ag1 , Ag2 s is uniquely determined up to the G-equivalence by the G-types of its edges (Indeed, ´1 the G-type h3 of Ag1 , Ag2 satisfies h3 “ h1 h´1 2 or h3 “ h2 h1 where hi (i “ 1, 2) is the G-type of Agi , g0 Ǎ). So to efficiently draw this kind of triangulation, it makes sense to introduce the edge-labeled triangles, that is, triangles with edges labeled 18 JIARUI FEI ✁A✾✾ ✁✁ ✾✾✾ ✁ ✁ ✾✾ ✁✁ ö ✾ ✁ ✁ ´1 Agrns grn´1s Ǎ ´1 gÐ Ý Ǎ rns ÝÝÝÝ AgÐ rn ´ ❂❂1s ✝ ❂❂ œ ✝✝ ❂❂ ✝ ✝ ❂❂ ❂ ✝✝✝ Ǎ ““ Ă Ǎ ““ Ă Agrn´1s ❇❇ ❇❇ ❇❇ ❇❇ ö ❇ Agn Agn❁ Ǎ ❁❁ ✝✝ ❁❁ œ ✝ ✝ ❁❁ ❁❁ ✝✝✝ ✝ Ý gÐ rns Ǎ Figure 8 ÐÝ Ý by their G-types. If the G-type is grns or gÐ rns , we will just label it by rns or rns. For example, after appropriate choice of directions, here is a picture for tn together with its adjacent triangles. ✹ ✹✹ rn´2s rn`1s ☞ ✹✹ ✡✡ ✹✹✹ ✡ ☞☞ ✹ ✹✹ ö ✡ ☞ ✹ ö ☞☞ ✡✡ rns✹ n`1 n´1 ✹✹ rn´1s ✹ ✡ ✹✹ ✡✡ ✹✹ ☞☞☞ ö ✹✹ ✡✡ ✹✹ ☞☞ ✡✹✹ n ✡☞ ✹✹ ✡ ✡ ✹ œ ✡✡ Ð Ý ÐÝÝÝÝ rns rn ´✹1s ✹✹ ✡✡ ✹✹ ✡✡ ✡ Definition 4.4. We define the oriented triangulation Tm as follows. The triangles in Tm are tn (n P r2, ms) and their duals. We glue them as the recipe above. We have seen that all elements in sl ptn q agree on common edges. So we obtained a set m sl pTm q Ă krZl,l s indexed by the vertices of ♦l pTm q. We denote p♦l pTm q, sl pTm qq m m by p♦l , sl q. Here is a picture for T5 , where all edges with the same label are identified. Note that the leftmost diamond itself have two pairs of edges identified. It corresponds to the quiver of Figure 4 (right). ✺ ✺ ✺ ✺ ✞✞ ✺✺✺ ✞✞ ✺✺✺ ✞✞ ✺✺✺ ✞✞ ✺✺✺ ✞ ✞ ✞ ✞ ✞ ✞ ✞ ✞ r4s✺ r5s✺ r3s r4s r3s✺ r2s ✞1 ö r2s✺✺✺ ✞ ✞✞ ö ✺✺✺ ✞✞ ö ✺✺✺ ✞✞ ö ✺✺✺ ✺ ✞ ✞ ✞ ✞ ✞✼✼ ✞✼ 2 4 5 3 ✠ ✞✼✼✼ ✠ ✞✼✼✼ ✠ ✠✠ ✼✼✼ ✼✼ ✼ ✼ ✠✠ ✠✠ ✠✠ ✠ ✠ œ ÐÝ✠✠ œ œ œ Ð Ý Ð Ý Ð Ý Ð Ý Ð Ý Ð Ý✠ 1✼ r2s✼ r3s✼ r4s✼ r3s r4s r5s ✼✼ ✠r2s ✼✼ ✠✠ ✼✼ ✠✠ ✼✼ ✠✠ ✼✠✠ ✼✠✠ ✼✠✠ ✼✠✠✠ We call such a picture the diamond view of Tm . An edge labeled by n P r2, ms is called a diamond diagonal. We label the diamonds by their diagonals. A diamond is called odd (resp. even) if its diagonal is labeled by an odd (resp. even) number. This view is related to the map π “ pπ2 , π3 , . . . , πm q in Lemma 1.6. To be more pnq pnq pnq precise, let ♦l be the diamond n and sl be the restriction of sm l to ♦l , then pnq pnq the upper cluster algebra Cp♦l , sl q is equal to πn˚ pkrX2,2 sq. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 19 Lemma 4.5. The set sm l is algebraically independent over k. m Proof. By Lemma 1.6 the functional field of Zl,l is isomorphic to that of the image Ť pnq m of π. So kpZl,l q “ π ˚ kppX2,2 qm´1 q is generated by nPrms sl “ sm l as a field. The m Krull dimension of the integral domain krZl,l s is equal to 2 dim A ` pm ´ 2q dim G “ pl ´ 1qpl ` 2q ` pl2 ´ 1qpm ´ 2q. m By a simple counting, this is exactly the cardinality of sm l . Hence sl must be algebraically independent over k.  We can also first glue all tn , and then all duals ťn together as shown below. ÐÝ Such a picture is called the disk view of Tm . We call an edge labeled by rns or rns ✺ ✠✠ ✺✺✺ ✠ ✺ ✠✠ 1✺ 2 ✠ ✠ ö ✺✺✺ ✠ ✺✺ ✺✠✠✺ r2s ✠ ✺✺ r5s ✺✺ ✠ ☞☞ ✺ ö ✠✠✠ ✺✺ ö ☞☞☞ r4s✺ r3s 3✺✺ 5 ✺✺ ✠✠✠ ö ✺✺✺ ☞☞☞ ✺☞☞ ✺✠✠ 4 ✺ ✠✠ ✺✺✺ ✠ ✺ ✠✠ 1✺ 2 ✠ ✠ œ ✺✺✺ ✠ ✺ Ð Ý Ð Ý ✺✠✺✠ ✠✺✺✺ r5s ✺✺ r2s ☞☞ ✠ ✺ ✠ ✺ œ ÐÝ✠ ☞☞ ☞ Ð Ý œ 3✺✺ 5 r4s r3s ✺✺ ✠✠ œ ✺✺✺ ☞☞☞ ✺☞☞ ✺✠✠ 4 Figure 9. Disk view of T5 Ð Ý (n P rm ´ 1s, including 1 “ r1s “ r1s) a disk diagonal. We call the edge labeled ÐÝ Ý by rms or rms the boundary. It is clear from both views that topologically we get a sphere with a disk cut out. It has m ´ 1 punctures and 2 marked points on the boundary. However, as we shall see at the end of this subsection if the nonconsistent gluing is forbidden, then it should be a (unpunctured) pm´ 2q-torus with some marked boundary circle(s). Let Dh be the product of all cluster variables on the disk diagonals. m m Corollary 4.6. The upper cluster algebra Cp♦m l , sl q is a subalgebra of krZl,l s. Moreover, the two algebras are equal after localizing at Dh . m Proof. Since each sni,j or šni,j is irreducible and krZl,l s is a UFD ([21, Theorem m m 3.17]), sl is a CR1 seed in krZl,l s. So we have from Lemma 3.5 the containment ` m d m˘ m m m m krZl,l s Ě Cp♦m l , sl q. By Lemma 3.6, Cp♦l , sl qDh is the same as C p♦l q , sl Dh d m all vertices on the disk diagonals. where p♦m l q is obtained from` ♦l by freezing pnq pnq ˘ m m Then Cp♦l , sl qDh contains C ♦l , sl for all n P r2, ms. Recall that by con` pnq pnq ˘ m struction each C ♦l , sl is equal to πn˚ pkrX2,2 sq. By Lemma 4.1 krZl,l sDh is m ˝ exactly krpZl,l qπ s. Then by Lemma 1.6 and 4.3, ` “ ˝ m´2 ‰˘ m m krZl,l sDh “ π ˚ k pX2,2 q ˆ X2,2 , which is generated by all πn˚ pkrX2,2 sq and inverse cluster variables on the disk diagonals. We thus get the other containment “Ď”.  Let d “ bc be the common edge of two adjacent triangles in T as in Figure 10 (left). A flip along d is an operation on T sending the pair to Figure 10 (right), 20 JIARUI FEI a❂❂ ❂❂ ö ❂❂❂ c b❂❂❂ ❂❂ ö ✂✂✂✂ ❂❂ ✂✂ ❂ ✂✂ d a❂❂ ❂❂ ❂❂ ❂ b❂❂ ö ö ✂c ❂❂ ✂ ❂❂ ✂✂✂ ❂ ✂✂ d Figure 10. The flip and keeping the remaining triangles unchanged. We denote the new triangulation by T1 . It is well-known [14] that any two consistent triangulations of S are related by a sequence of flips. We warn readers that the flip is not defined for a pair of triangles as in Figure 2 (right). Lemma 4.7. [12, 10.3] There is a sequence of mutations µd such that µd p♦l pTqq “ ♦l pT1 q. We define an edge-labeled oriented triangulation w0 pTm q as follows. We modify all edge-labels of Tm by the action of w0 . We must clarify what we mean by the action of w0 on edge-labels: ` n´1 ˘ p´1qn´1 ´1 “ gw0 p1q gw ¨ ¨ ¨ gw0 pnq , w0 pgrns q “ w0 g1 g2´1 ¨ ¨ ¨ gnp´1q 0 p2q Ý0 pTm q as the which is not rw0 pnqs or rw0 pnq, w0 p1qs in general. We also define Ð w edge-labeled triangulation obtained from w0 pTm q by reversing the order of all edgelabels. We can easily verify that when m is odd # Ð Ý0 pg q “ g´rm´n`1,ms n is even; w rns grm´n`1,ms n is odd, p´1qn where we set g´I :“ gi´1 gi2 ¨ ¨ ¨ gin . For example half of the disk views of w0 pT4 q 1 Ý0 pT5 q are display below (cf. Figure 9). and Ð w ✺ ✠✠ ✺✺✺ ✠ ✺ ✠✠ 5✺✺ 4 ✠ ✺✺ ✠✠ ✠ ÝÝÝ ✺✺ Ð ✺✺ ✺✠✺ ´r4,5s ✠✺✺✺ r5s 4 r1, 4s ✠ ☞ ☞ ✺✺ ✺✺ ✠✠ ✺✺✺ ☞☞ ☞☞ ✠✠ ✺✺ ✠ ✺ ✺ ☞ ☞ ✠ ✠ ☞ ☞ ÝÝÝ Ð ÝÝ Ý Ð r3,5s ´r2,5s 3✺✺ 3✺✺ r3, 4s r2, 4s ✺✺ ☞1 ✺✺ ☞1 ✠ ✺✺ ✠✠ ✺ ✺ ☞ ☞ ✠ ✺ ✺ ✺✺ ☞☞ ✺☞☞☞ ✺✠✠ ✺✠✠✠ ☞ 2 2 Lemma 4.8. Apply a sequence of flips at the disk diagonals rm ´ 1s, . . . , r3s, r2s and their duals to Tm , then we get the triangulation T:m “ w0 pTm q if m is even or Ý0 pTm q if m is odd. T:m “ Ð w ´1 Proof. Let t:n be the triangle obtained from tn by replacing A by B “ grms Ǎ if m is even or B “ grms Ǎ if m is odd. We can easily prove by induction that T:m consists of triangles t:n (n P r2, m ´ 1s) and t:m :“ rB, g1 Ǎ, As. The common edge of t:n and ´1 Agrns if n is even or B grns Ǎ if n is odd. They all have desired t:n`1 is B G-types. The situation is similar for dual triangles.  m m Proposition 4.9. We have an isomorphism krZl,l s – Cp♦m l , sl q. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 21 m m Proof. By Corollary 4.6, we have that krZl,l sDh “ Cp♦m l , sl qDh . The same argum : ments can show that the equality also holds for the seed p♦m l , sl q corresponding m : m to T:m , that is, krZl,l sD: “ Cp♦m l , sl q : . Moreover, by Lemma 4.8 and [11, Lemma h Dh m m m : 4.14] the two seeds are mutation-equivalent so that Cp♦m l , sl q “ Cp♦l , sl q . We : notice` that T ˘ m and Tm do not` have any ˘ disk diagonal in common. Let X :“ m m Spec krZl,l s and Y :“ Spec Cp♦m , s q . We have a regular birational map l l X Ñ Y induced by the inclusion of Corollary 4.6. To show it is in fact an isomorphism, it suffices to show according to [24, Corollary 1 of II.4.4] that ZpDh qXZpDh: q has codimension 2 in X. Recall that each function in sl pTm q and sl pT:m q is irreducible. Since X is factorial ([21]) and all irreducible factors in Dh and Dh: are distinct, we conclude that the intersection has codimension 2.  The above proof is similar to that of [11, Theorem 4.15]. As remarked there, condition for Y required in [24, Corollary 1 of II.4.4] is being nonsingular, but we see from the proof that it can be weakened as being locally factorial. In the end, we make a connection to the Fock-Goncharov’s construction [12], in which non-consistent gluing is not allowed. Proposition 4.10. If we apply the twist to each dual triangle ťn w.r.t the disk 1 1 diagonal, then we transforms ♦m l to ♦l pTm q, where Tm is a consistent ideal triangulation of a (unpunctured) torus of genus g “ m ´ 2 with # two boundary components and one marked point on each if m is even; one boundary component and two marked points if m is odd. Proof. It is not hard to show by induction that after applying such a sequence of twists, we get the same triangulation of dual disk but it will be glued to the other disk differently. We note that all gluing is consistent now. Then we glue the two disk pieces along the edge labeled by 1. We obtained a polygonal presentation of a pm ´ 2q-torus with a boundary on a 2m-gon. Moreover, we see that when m is ÐÝ Ý odd two edges rms and rms are glued to a (boundary) circle, and each vertex is ÐÝÝ identified to a marked point on the boundary. When m is even, rms (or rms) is glued to itself and form a boundary circle. Here is a picture for m “ 4. 3 ✠✺✺ ✠✺✺ ✠✠ ✺✺✺ ✠✠ ✺✺✺ ✠ ✠ ö ✠ ✠ ✠4 ö r3s✺✺✺ ✠✠r2s ö 2✺✺✺ ✠ ✺✺ ✺✺ ✠✠ ✠ Ð Ý ✺✠✺ ✠✠ r4s ✠✺✺✺ r4s ✺✺ 1 ☞☞ ✠ ✺ ö ÐÝ✠✠ ✺ÐÝ ö ☞☞☞ 4 2✺✺ r3s r2s ✺✺ ✠✠ ö ✺✺✺ ☞☞☞ ✺☞☞ ✺✠✠ 3  We remark that after applying the twists the cluster variables in the interior of each dual triangle are no longer given by the recipe described in Section 4.1. We label the vertex pi, jq in ∆l ptn q (resp. ∆l pťn q) by pni,j q (resp. pn_ i,j q). Throughn_ n q or p q, and v̌ for pn_ out the paper, we shall use the notation pnY q for p i,j i,j i,j q if i,j n v “ pi,j q. Since vertices on the edges will be identified, it is good to resolve the ambiguity. We shall use 22 JIARUI FEI (1) pni,0 q instead of pn_ i,0 q for each n; (2) pn´1Y q instead of pnY 0,j q for even n; 0,j n´1Y nY (3) pi,j q instead of pi,j q for i ` j “ l and odd n. Readers can find a quiver in such a labeling in Figure 12. m In particular, we have an exchange relation in krZl,l s at each mutable vertex in m m p♦l , sl q. We record these exchange relations at edge vertices, which are needed in Section 5.1. We set sn0,0 “ snl,0 “ 1 in (4.1) below. Corollary 4.11. There are exchange relations: (4.1) sni,0 sni,0 1 “ sni,1 šni,1 sni´1,0 ` sni´1,1 šni´1,1 sni`1,0 , (4.2) n`1 n sn0,j sn0,j 1 “ sn1,j sn`1 1,j´1 ` s1,j´1 s1,j (4.3) sni,j sni,j 1 “ sni´1,j sn`1 i,j´1 ` sni,j´1 sn`1 i´1,j n is odd, n is even and i ` j “ l. m . for some regular functions sni,j 1 on Zl,l The exchange relations (4.2) and (4.3) also hold for the dual semi-invariants. Similar to the Schofield’s construction in the proof of [11, Lemma 4.12], interested readers can give an explicit description for sni,j 1 . m q as a UCA 5. SIβl pKl,l m m m 5.1. Lifting the seed p♦m l , sl q. We are going to extend and lift the seed p♦l , sl q m rm m r to a seed p♦l , sl q such that the cluster variables in r sl are regular functions on m m Modβl pKl,l q :“ Repβl pKl,l q{ SLβl . We first notice that the m central determinants m are regular functions on Modβl pKl,l q. So we add them as m frozen variables to m q. We label the frozen vertex corresponding to det an by n. Next, we lift , s p♦m l l m r the cluster sm to a cluster s . The natural candidate for r sm rni,j . We see l l l ptn ; i, jq is s directly from Definition 2.2 that all srni,j ’s agree on the diagonals. We shall prove that with this natural choice we are able to lift the exchange relations as well. m Lemma 5.1. Let f and g be two T -homogeneous regular functions on Rep1βl pKl,l q. Suppose that the T -weights of f and g are λ1 , λ2 with λ1 ´ λ2 non-negative and m m q. Then s is regular on Repβl pKl,l q. s :“ f {g is also regular on Rep1βl pKl,l m Proof. For any representation M P Rep˝βl pKl,l q, we can write M as tN for some t P 1 m m pGm q and N P Repβl pKl,l q. This is possible since we are working over algebraically closed fields. Then spM q “ f ptN q{gptN q “ tλ1 ´λ2 f pN q{gpN q. Since f {g is regum m lar on Rep1βl pKl,l q, we see that it is regular on Rep˝βl pKl,l q. Moreover, by taking the ! ) m q | M pan q “ 0, n P rms . limit t Ñ 0 we see that s is regular on Z :“ M P Repβl pKl,l The locus of indeterminacy of s is a closed set contained in a union of irrem q defined by vanishing of central determinants. ducible subvarieties of Repβl pKl,l We note that the set Z is contained in every irreducible subvariety cut out by det an . We conclude that the locus of indeterminacy has codimension at least two. m q is normal, the function s is in fact regular everywhere.  Since Repβl pKl,l Definition 5.2. A vertex is called edge if it lies on an edge of a hive. It is called corner if it is on a corner of a hive (there are 6 corner vertices on a hive). CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 23 Corollary 5.3. The exchange relations (4.1), (4.2), and (4.3) are satisfied by the minimal lifts srni,j except at corner vertices pnl´1,0 q for each n, pn0,l´1 q for odd n, and pnl´1,1 q for even n. Proof. If v “ pni,j q is a non-edge vertex, then we have the exchange relation sni,j sni,j 1 “ sni,j´1 sni`1,j sni´1,j`1 ` sni,j`1 sni´1,j sni`1,j´1 . We first check using Lemma 2.6 that ř srni,j´1 srni`1,j srni´1,j`1 and srni,j`1 srni´1,j srni`1,j´1 have the same λ-weight equal to 3ien ` pPrn´1s prǫppqs` 3jep ` r´ǫppqs` 3pl ´ jqep q, which is greater than the λ-weight of srni,j . So by Lemma 5.1, there is some sni,j 1 m regular on Repβl pKl,l q. If v is an edge vertex, then we have three kinds of exchange relations (4.1)–(4.3). The verification is similar. For example, for (4.2) we check using Lemma 2.6 that for j ă l ´ 1, srn1,j srn`1 rn1,j´1 srn`1 1,j´1 and s 1,j have the same λ-weight greater than that n of sr0,j .  The exchange relations cannot be trivially lifted at the three kinds of corner vertices. For example, when j “ l ´ 1 the definition of srn1,j in (4.2) has a different formula (see Definition 2.2). We need to make use of the m new frozen variables to repair them. Here is the recipe. m at those corner vertices Corollary 5.4. We have exchange relations in SIβl Kl,l after we add (1) an arrow from pnl´1,0 q to n for each n; (2) an arrow from n to pnY l´1,1 q for even n; (3) an arrow from n to pnY 0,l´1 q for odd n ě 3. Proof. (1) corresponds to the exchange relation (4.1) when i “ l ´ 1. We recall that sl,0 “ 1 by definition. By lemma 5.1 and (4.1) it suffices to check that srl´1,1 sřl´1,1 srl´2,0 and srl´2,1 sřl´2,1 detpan q have the same λ-weight, which is greater than that of srnl´1,0 . We note that λ-weight of det an is len . (2) corresponds to the exchange relation (4.2) when j “ l ´ 1. We check that srn1,l´1 srn`1 rn1,l´2 srn`1 1,l´2 detpan q and s 1,l´1 have the same λ-weight, which is greater than n that of sr0,l´1 . (3) corresponds to the exchange relation (4.3) when i “ l ´ 1 and j “ 1. We check that srnl´2,1 srn`1 rnl´1,0 srn`1 l´2,1 have the same λ-weight, which is l´1,0 detpan q and s n greater than that of srl´1,1 .  Here is picture for l “ 4. The left one is for even n and the right one is for odd n ě 3. We omit n in the labels of vertices and write pi, ǰq for pn_ i,j q. We also provide a (half) disk-view for l “ m “ 4. The two frozen vertices 3 in the picture should be identified. m Corollary 5.5. The semi-invariant ring SIβl pKl,l q is a subalgebra of the upper m rm, r s q. cluster algebra Cp♦ l l Proof. Since sm sm l is algebraically independent, we see from Lemma 1.4 that r l is also algebraically independent. We check the conditions in Lemma 3.5. The condition (1) is verified by Corollary 5.3 and 5.4. The condition (2) almost follows from m Corollary 2.7. Indeed, since SIβl pKl,l q is a UFD, it suffices to show that each srni,j is n 1 not a factor of pr si,j q . But this is clear from the difference of their σ r-weights.  24 JIARUI FEI / 1,3 \✾✾ ✾✾ ✆✆✆ ✆ / 1,2 / 2,2 0,2 \✾✾ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ / 2,1✆ / 3,1 / 1,1✆ 0,1 \✾ \✾✾ ✾ \ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾ ✆  ✆ ✆  / 2,0 / 3,0 /n 1,0 \✾✾ \✾✾ \✾✾ ✆ ✆ ✆ ✆ ✾ ✾ ✾ ✆ ✾ ✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ✆✆ / 1,1̌ / 3,1̌ / 2,1̌ 0,1̌ ✆ \✾✾✾✾ ✆✆ \✾✾✾✾ ✆ ✆✆ ✆✆ / 1,2̌ / 2,2̌ 0,2̌ ✆ \✾✾✾✾ ✆ ✆✆ / 1,3̌ 0,3̌ /+ 0,3 \✾✾ ✆ ✾✾ ✆✆ ✆ / 1,2 / 0,2 2,2 \✾✾ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ / 1,1✆ / 0,1 / 2,1✆ 3,1 \✾✾ ✾ \ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✆ o / 2,0✆ / 1,0✆ 3,0 \✾ ✾ \ ✾ \ ✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆ ✆ ✆ / 1,1̌ / 3,1̌ / 2,1̌ 0,1̌ ✆ \✾✾✾✾ ✆✆ \✾✾✾✾ ✆ ✆✆ ✆✆ / 1,2̌ / 2,2̌ 0,2̌ ✆ \✾✾✾✾ ✆ ✆✆ /3 1,3̌ 0,3̌ 1,3 0,3 n Figure 11. The lifted even diamond (left) and odd diamond (right) 1 o 1 o 1 o 4 4 4 1 3 4 1,3 2,2 3,1 E☞ 0,1 ✹✹ F E☞0,2 ✷✷ E☞0,3 ✷✷ E☞ ✷✷ E E E ✸ ✸ ✸ ✍ ✹ ✸ ✸ ✸ ✷✷ ✷✷ ✷✷ ✍ ☞ ☞ ✹✹ ✸✸ ✸✸ ✸✸ ☛☛ ☛☛ ☛☛ ☞☞☞☞ ✷ ✷ ☞☞☞ ✷ ☞☞☞ ✹ ☛☛☛ ✸ ☛☛☛ ✸ ☛☛☛ ✸ ✍✍✍ ☞☞☞☞ 4 o 4 4 o 2 o 2 o 2 o 2 / 30,3 o 1,0 1,3 ✹✹ D 1,2 ✹✹ [✻✻ D 2,1 ✺✺ D 3,0 D 1,2 ✺✺ D 1,1 ✹✹ ✟ ✡ ✠ ✠ ✠ ✡ ✺✺ ✹✹ ✺✺ ✹✹ ✻✻ ✹✹ ✟ ✡ ✠ ✠ ✡ ✠✠ ✺ ✠✠✠ ✹ ✡✡✡ ✺ ✠✠✠ ✹ ✡✡✡ ✹ ✻ ✟✟✟ ✠✠ 2 4 4 o 2 o 2 o /3 o /3 1,2 2,2 0,2 2,0 1,1 2,0 D Z✹✹ ✻ [ D D✡2,1 ✹✹ ✺ ✹✹ ✻✻ ✟ ✠ ✺✺ ✠ ✠ ✹ ✹✹ ✹ ✟ ✠ ✠ ✠ ✡ ✹✹ ✟✟ ✺✺ ✠✠ ✹✹ ✻✻ ✠✠ ✠ ✹ ✡✡✡ ✟ ✠✠ ✠  ✠  3 3 3 4 2 o 2 / / o / 1,1 0,1 2,1 1,0 3,0 ✻ Z ✺ Z E✡3,1 Y✹✹ ✹✹ ✟ ✺✺ ✠ ✡ ✻✻ ✹✹ ✹ ✡ ✟ ✠ ✡ ✹ ✻ ✺ ✹ ✡✡✡ ✹ ✡✡✡ ✻ ✟✟✟ ✺ ✠✠✠ 3 3 / 2,0 / 31,0 2 3 o 3,0 r4 Figure 12. A half of ♦ 4 m 5.2. Cluster structure of SIβl pKl,l q. We first recall a lemma in [11]. We fix a r r obtained by set of frozen vertices e of ∆. Let ∆ be the full (ice) subquiver of ∆ forgetting e. It follows from [11, Lemma 2.2] and the remark afterwards that r x rq, there is Lemma 5.6. Suppose that Bp∆q has full rank. Then for any seed p∆, some x such that r x rqxr peq “ Cp∆, xq b krr Cp∆, xpeq˘1 s. The cluster x can be explicitly constructed as in [11] but we do not need it here. The next lemma can be easily proved by [11, Lemma 3.3 and 3.4]. Lemma 5.7. The B-matrix of ♦m l has full rank. śm Recall that Dc “ n“1 sn is the product of central determinants. m m rm, r Corollary 5.8. We have an isomorphism SIβl pKl,l qDc – Cp♦ l sl qDc . CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 25 ` m˘ “ m ‰ Proof. Recall from Lemma 1.4 that SIβl Kl,l “ k Zl,l ˆ pGm qm . So by PropoDc sition 4.9 we have that ` m˘ m m “ Cp♦m SIβl Kl,l l , sl q b krpGm q s. Dc On the other hand, we know from Lemma 5.6 that rm , r Cp♦ sm qD “ Cp♦m , tm q b krs˘1 , . . . , s˘1 s. l l c l l Here we use the letter t to indicate that the cluster But in any case we get our desired isomorphism. 1 tm l m may not be the same as sm l .  m m rm , r Lemma 5.9. We have that SIβl pKl,l q Ď Cp♦ l sl q. m m rm , r Proof. We already have that SIβl pKl,l qDc – Cp♦ l sl qDc . So every element in m SIβl pKl,l q can be written as a Laurent polynomial p in any rtm sm l „r l . We need to show that p is polynomial in each sk :“ det ak . Let m Dk :“ tM P Repβl pKl,l q | detpM pak qq “ 0u. We claim that it suffices to show that r sm l zsk is still algebraically independent when restricted to Dk . If this is the case, then pr tm l zsk q |Dk is also algebraically indepenm dent. Suppose for the contradiction that there is some s P SIβl pKl,l q which is not d polynomial in sk . Then we write s as s “ f {phsk q where f (resp. h) is a polynomial (resp. monomial) in rtm l such that sk ffl f . By the algebraic independence of m r ptl zsk q |Dk , f is not a zero function on Dk . But sk constantly vanishes on Dk . So s is not regular on Dk . m,k m by replacing the k-th Suppose that k is odd. Let Zl,l be obtained from Zl,l G by D :“ tM P Matl | detpM q “ 0u. The definition of sm l does not involve the inverse of gk when k is odd, so the definition can be straightforwardly extended m,k to Zl,l . It is easy to see from Lemma 1.4 and Definition 2.2 that pr sm l zsk q |Dk is m,k algebraically independent if and only if so is sm l as functions on Zl,l . Moreover, m,k each map πi can be defined for Zl,l as well. By examining the proof of Lemma m,k 4.5, we see that sm is algebraically independent is equivalent l as functions on Zl,l m,k to Lemma 5.11 below, an analogue of Lemma 1.6 for Zl,l . If k is even, then we assume m is even and we apply a sequence of flips as in : Lemma 4.8. Let psm l q be the new cluster after applying the sequence of mutations. : m Lemma 4.8 and [11, Lemma 4.14] implies that psm l q is obtained from sl by the m,k : action of w0 . In particular psm so the same argument applies. l q is defined on Zl,l If m is odd, then the desired statement follows from the case of m ` 1.  Let Ĥ be the set of diagonal matrices in Matl with diagonal pd1 , d2 , . . . , dl´1 , 0q pdi ‰ 0q. For any ĥ P Ĥ, there is a unique h P H Ă G such that h and ĥ have the same first l ´ 1 diagonal entries. Since pIdl´1 , 0qh “ pIdl´1 , 0qĥ, we see that F ĥ “ F h. Similarly, ĥF̌ “ hF̌ . Recall that D :“ tM P Matl | detpM q “ 0u. Lemma 5.10. The set D˝ :“ U ´ ĤU ` is dense in D. Proof. D is an irreducible hypersurface in Matl . By a simple dimension argument, it is enough to show that the map pū, ĥ, uq ÞÑ ūĥu is injective. Suppose that ū1 ĥ1 u1 “ ´ and u “ u2 u´1 ū2 ĥ2 u2 , then ūĥ1 “ ĥ2 u where ū “ ū´1 2 ū1 P U 1 P U . Elementary matrix calculation show that ū “ u “ e so that pū1 , ĥ1 , u1 q “ pū2 , ĥ2 , u2 q.  26 JIARUI FEI We extend the notion of Gauss decomposable to D. We say g P D is Gauss m,k ˝ decomposable if it is in D˝ . For an odd number k P rms, let pZl,l qπ be the (dense) m,k Ý subset of Zl,l where grns and gÐ rns are Gauss decomposable for each odd n and Ýw grns w r0 and gÐ r are Gauss decomposable for each even n. rns 0 Lemma 5.11. The restriction of the map m,k π :“ pπ2 , . . . , πm q : Zl,l Ñ pX2,2 qm´1 m,k ˝ to the dense set pZl,l qπ is an embedding. m,k ˝ Proof. The proof is almost the same of Lemma 1.6. A point in pZl,l q can be repre1 sented by pF, g1 , . . . , gm , F̌ q. Suppose that it has the same image as pF, g11 , . . . , gm , F̌ q. m,k In particular, they have the same image under π2 : Zl,l Ñ X2,2 , that is, pF g1 , F g2 , g2´1 g1 F̌ , F̌ q “ pF g11 , F g21 , g21 ´1 1 g1 F̌ , F̌ q in X2,2 . We keep in mind that (5.1) F h “ F ĥ and hF̌ “ ĥF̌ , and their stabilizers are U ´ and U respectively. Since g1 and g11 are Gauss decomposable, we can assume that g1 , g11 P Ĥ if k “ 1, otherwise g1 , g11 P H. In any case, in view of (5.1) the same argument as in Lemma 1.6 shows that g1 “ g11 and g2 “ g21 . The rest of the induction is conducted similarly.  rm rm Let σ r-weight of l be the weight configuration given by σ l pvq equal to the σ rsm pvq. It follows from Corollary 5.5 and Lemma 5.9 that l m q is isomorphic to the graded Theorem 5.12. The semi-invariant ring SIβl pKl,l m rm r m r upper cluster algebra Cp♦l , sl ; σ l q. Part 2. The Cluster Models 6. The QP Models 6.1. The QP models of UCA. In [4] and [5], the mutation of quivers with potentials is invented to model the cluster algebras. Following [4], we define a potential W on an ice quiver ∆ as a (possibly infinite) linear combination of oriented cycles in ∆. x :“ k∆{r x k∆, x k∆s, x More precisely, a potential is an element of the trace space Trpk∆q x x x where k∆ is the completion of the path algebra k∆ and rk∆, k∆s is the closure of x The pair p∆, W q is an ice quiver with potential, the commutator subspace of k∆. x is defined or IQP for short. For each arrow a P ∆1 , the cyclic derivative Ba on k∆ to be the linear extension of d ÿ Ba pa1 ¨ ¨ ¨ ad q “ a˚ pak qak`1 ¨ ¨ ¨ ad a1 ¨ ¨ ¨ ak´1 . k“1 For each potential W , its Jacobian ideal BW is the (closed two-sided) ideal in x generated by all Ba W . The Jacobian algebra Jp∆, W q is the quotient algebra k∆ x k∆{BW . If W is polynomial and Jp∆, W q is finite-dimensional, then the completion is unnecessary to define Jp∆, W q. This is the situation assumed throughout the paper. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 27 The key notion introduced in [4, 5] is the mutation of quivers with potentials and their decorated representations. Since we do not need the mutation in an explicit way, we refer readers to the original text. Unlike the quiver mutation, the mutation of IQP is not always defined for any sequence of (mutable) vertices because 2-cycles may be created along the way. A sequence of vertices is call admissible for an IQP if its mutation along this sequence is defined. In this case the mutation of IQP in certain sense “lifts” the quiver mutation. If all sequences are admissible for p∆, W q, then we call p∆, W q nondegenerate. Definition 6.1 ([4]). A potential W is called rigid on a quiver ∆ if every potential on ∆ is cyclically equivalent to an element in the Jacobian ideal BW . Such a QP p∆, W q is also called rigid. It is known [4, Proposition 8.1, Corollary 6.11] that every rigid QP is 2-acyclic, and the rigidity is preserved under mutations. In particular, any rigid QP is nondegenerate. Definition 6.2. A decorated representation of a Jacobian algebra J :“ Jp∆, W q is a pair M “ pM, M ` q, where M is a finite-dimensional J-module and M ` is a finite-dimensional k ∆0 -module. Let ReppJq be the set of decorated representations of Jp∆, W q up to isomorphism. Let K b pproj -Jq be the homotopy category of bounded complexes of projective representations of J, and K 2 pproj -Jq be the subcategory of 2-term complexes in fixed degrees (say ´1 and 0). There is a bijection between two additive categories ReppJq and K 2 pproj -Jq mapping any representation M to its minimal presentation in ReppJq, and the simple representation Su` of k ∆0 to Pu Ñ 0. We use the À ∆0 notation P pβq for vP∆0 βpvqPv , where β P Zě0 and Pv is the indecomposable projective representation corresponding to the vertex v. The weight vector of a projective presentation P pβ1 q Ñ P pβ0 q is equal to β1 ´ β0 . Definition 6.3. The g-vector gpMq of a decorated representation M is the weight vector of its image in K 2 pproj -Jq. Definition 6.4 ([2]). To any g P Z∆0 we associate the reduced presentation space PHomJ pgq :“ HomJ pP prgs` q, P pr´gs`qq, where rgs` is the vector satisfying rgs` puq “ maxpgpuq, 0q. We denote by Cokerpgq the cokernel of a general presentation in PHomJ pgq. Reader should be aware that Cokerpgq is just a notation rather than a specific representation. If we write M “ Cokerpgq, this simply means that we take a presentation general enough (according to context) in PHomJ pgq, then let M to be its cokernel. Definition 6.5 ([7]). A representation is called µ-supported if its supporting vertices are all mutable. A weight vector g P K0 pproj -Jq is called µ-supported if Cokerpgq is µ-supported. Let Gp∆, W q be the set of all µ-supported vectors in K0 pproj -Jq. ś gpvq For a vector g P Z∆0 , we write xg for the monomial vP∆0 xv . For u P ∆µ , we set yu “ x´bu where bu is the u-th row of the matrix Bp∆q, and let y “ tyu uuP∆µ . 28 JIARUI FEI Definition 6.6 ([20]). We define the generic character CW : Gp∆, W q Ñ Zpxq by ÿ ` ˘ CW pgq “ xg χ Gre pCokerpgqq ye , e e where Gr pM q is the variety parameterizing e-dimensional quotient representations of M , and χp´q denotes the topological Euler-characteristic. It is known [7, Lemma 5.3] that CW pgq is an element in Cp∆q. Note that CW pgq has a well-defined g-vector g, so we have that Gp∆, W q Ď Gp∆q. Theorem 6.7 ([7, Corollary 5.14], cf. [20, Theorem 1.1]). Suppose that IQP p∆, W q is nondegenerate and Bp∆q has full rank. The generic character CW maps Gp∆, W q (bijectively) to a set of linearly independent elements in Cp∆q containing all cluster monomials. Definition 6.8. We say that an IQP p∆, W q models an algebra A if the generic cluster character maps Gp∆, W q onto a basis of A. If A is the upper cluster algebra Cp∆q, then we simply say that p∆, W q is a cluster model. If in addition Gp∆, W q is given by lattice points in some polyhedron, then we say that the model is polyhedral. [7, Proposition 5.15] implies that being a (polyhedral) cluster model is mutationinvariant. Definition 6.9 ([17]). We say that a (frozen or mutable) vertex e can be optimized in ∆ if there is a sequence of mutations away from e making e into a sink or source of ∆ (possibly after deleting arrows between frozen vertices). It can be optimized in an IQP p∆, W q if in addition such a sequence is admissible. Ă be any potential on ∆ r such that its Theorem 6.10 ([11, Theorem 2.13]). Let W restriction on ∆ is W . Suppose that Bp∆q has full rank, and each vertex in e can be r W Ă q. If p∆, W q is a (polyhedral) cluster model, then so is p∆, r W Ă q. optimized in p∆, 6.2. Some sequences of mutations. The following lemma can be easily verified by the involutive property of the mutation. Lemma 6.11. Let ∆ be an ice quiver and e be a vertex of ∆. Let µ be a sequence of mutations away from e. We apply µ to ∆, delete e, and then apply µ backwards. We end with the ice quiver ∆ with e deleted. Consider the following hive strip of length n ` 1. The vertex n can be frozen or mutable. /‚ /‚ /‚ ‚ Z✻ Z✻✻ Z✻✻ Z✻✻ ✻ ✟ ✟ ✟ ✟ ✻ ✻ ✻ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✻✻✻ ✟✟ ✟ ✻ ✟ / n´1✟ /n / 1 ✟ / ¨ ¨ ¨✟ 0 Z✻ ✻ Z ✻ Z ✻ Z ✻✻ ✟ ✻ ✟ ✻ ✟ ✻✻ ✟✟ ✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻✻ ✟✟ ✻✻ ✟✟✟ ✻ ✟✟ ✻ ✟✟ ✻ ✟✟ /˝ /˝ / ˝ ✟ ˝ Lemma 6.12. The sequence of mutations p0, 1, ¨ ¨ ¨ , n ´ 1q transforms the quiver into /‚ /‚ /‚ ‚ ♥♥♥ ♥♥♥✟✟D ♥♥♥ ✟D ✟D ✟D ♥ ♥ ♥ ♥ ♥ ♥ ✟ ✟ ✟ ✟ ♥♥♥ ✟✟ ♥♥♥♥ ✟✟ ♥♥♥♥ ✟✟ ♥ ✟w♥✟♥♥♥ ✟ ♥♥ ✟ / 1 w♥ / ¨ ¨ ¨✟ w♥ /n / n´1 gP 0 ✻gPP ✻✻ PPPP ✻✻✻PPPPP ✻✻✻gPPPPP ✻✻ ✻✻ PPP ✻✻ PPP ✻✻ PPP ✻✻ PPP✻ PPP✻ PPP✻ ✻ /˝ /˝ /˝ ˝ CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 29 In particular, the sequence optimizes the (frozen or mutable) vertex n. r m (Figure 11 (right)). If we apply the twist for Consider any odd diamond in ♦ l t “ each triangle in the diamond and e “ the diamond diagonal, then we transform this diamond to a new one. Here is the quiver of the new diamond for l “ 4. We suggest readers comparing it with Figure 11 (right). / 0,1 3,1 \✾✾ \✾✾ ✆ ✆ ✾ ✾✾ ✆ ✾ ✆✆✆ ✆ ✆ / 0,2 / 1,2 2,2 \✾✾ \✾✾ \✾✾ ✆ ✆ ✆ ✾✾ ✾✾ ✆✆ ✾✾ ✆✆ ✆ ✆ ✆ ✆✆ / 1,1 / 2,1 / 0,3 1,3 \✾ \✾ \✾✾ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾ ✆ /n / 2,0✆ / 3,0✆ 1,0 ✾ \ ✾ \ ✾ ✾ ✆ ✾✾ ✆✆ ✾✾ ✆✆ \✾✾✾✾ ✆✆ ✆ ✆✆ ✆✆ ✆ ✆✆ / 0,3̌ / 2,1̌ / 1,1̌ 1,3̌ \✾✾ \✾ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✆ ✆ ✆ / 1,2̌ / 0,2̌ 2,2̌ ✾ \ \✾✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✆ ✆ / 0,1̌ 3,1̌ There are some additional arrows between edge vertices because the gluing is now r m are non-consistent (see Figure 3 (right)). Note that the even diamonds in ♦ l already in a similar form (see Figure 11 (left)). Finally, we mutate along the diamond diagonal towards n. In this way, we optimize n by Lemma 6.12. We conclude that r m can be optimized. Lemma 6.13. Each frozen vertex n in ♦ l We apply such twists for each odd diamond, and we denote the new triangulation by T1m . Note that all triangles are glued non-consistently in T1m . We denote the m quiver ♦l pT1m q by ♦yl . We apply the corresponding sequence of mutations to the m m m m m r ,r rm graded seed p♦ l q, and denote the new seed by p♦l , sl ; σ l q. Note that l sl ; σ m m ♦l can be obtained from ♦yl by adding m frozen vertices. σ m l can be directly rm computed from σ l . For the rest of this paper, we will mainly deal with the ice m r m because this makes proofs simpler. quiver ♦l rather than ♦ l Definition 6.14. Let ∆ be a quiver and u a set of vertices of ∆. The minimal extended subquiver of u in ∆ is the smallest (not necessarily full) subquiver of ∆ containing all arrows coming out and going into u. We come back to the hive strip of length n ` 1. Lemma 6.15. Let I “ pi1 , i2 , ¨ ¨ ¨ , il q P rn ´ 1s be an increasing sequence. We first mutate along I, then along rn ´ 1szI in the increasing order. Then we obtain the following minimal extended subquiver of t0, nu. n ´ ]❀1 ✄✄ ❀❀❀ ✄ ❀❀ ✄✄ ❀❀ ✄✄ /n 0 30 JIARUI FEI Proof. We shall prove by induction on the length of I. We set i0 “ 0 and il`1 “ n. Note that the sequence of mutations is equivalent to the sequence pi1 , a1 , i2 , a2 , ¨ ¨ ¨ , il , al , al`1 q, where ak is the sequence pik´1 ` 1, ik´1 ` 2, ¨ ¨ ¨ , ik ´ 1q. Here is the quiver after the mutation at i1 . ✟✟ ✟✟ ✟ ✟ 0 [✻ ✻✻ ✻✻ ✻ /‚ /‚ /˝ /˝o ‚ ✻✻ ✟ [✻✻✻ ✟C [✻✻ ✟ ✻✻ ✟ [✻✻ ✟ [✻✻ ✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻ ✻ ✟✟ ✻ ✟✟ ✻ ✟✟ ✻ ✟ ✻ ✟✟ ✻ , /n / / ¨ ¨ ¨✟ o / i1 ´1 o ¨ ¨ ¨[✻ i1 `1 i1 ✻ [ ✻ [ ✻ [ ✻ C ✻ ✻ ✟ ✟ ✟ ✻ ✻ ✻ ✟ ✟ ✟ ✻✻ ✻✻ ✟ ✟ ✟ ✻✻ ✻✻ ✻✻ ✟ ✟ ✟ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✟✟ ✟  ✟  ✟   ✟  ✟✟ ✟ / / o / / ˝ [✻ ‚ ‚ ‚ ˝ ˝ ˝ Then by a similar induction as in the proof of Lemma 6.12, we can show that the minimal extended subquiver ρ1 of ri1 ` 1, n ´ 1s Y t0, nu is the following. /‚ /‚ ‚ [✻ [✻✻ [✻✻ [✻✻ ✻ ✟ ✟ ✟ ✟ ✻ ✻✻ ✟ ✻ ✟ ✟ ✻ ✟ ✻ ✟ ✻ ✟ ✟ ✻✻ ✟ ✻✻ ✟✟ ✟ ✻✻ ✻ ✟✟ ✟ ✟ ✟✟ /n / i1 `1 / i1 `2 / ¨¨¨ 0 [✻✻ ✟ [✻✻✻ ✟ ✟ [✻✻✻ ✟ ✟ ✻✻ ✟ ✻✻ ✟✟ ✻✻ ✟✟ ✻✻ ✟✟✟ ✻ ✟✟ ✻ ✟✟ ✟ / /˝ ˝ ˝ i1 p´1q The vertex i1 p´1q is i1 ´ 1 if i1 ´ i0 ą 1; otherwise it is i1 . Since the later mutations are all in ri1 ` 1, n ´ 1s, this is the only relevant part. Although the shape of this quiver is slightly different with the original one, the minimal extended subquiver ρ2 of ri2 ` 1, n ´ 1s Y t0, nu after mutating along pi2 , a2 q is of the same shape but of shorter length (just replacing i1 by i2 in the above picture). Similarly the vertex i2 p´1q is i2 ´ 1 if i2 ´ i1 ą 1; otherwise it is i2 . We can thus prove by induction that the same holds for the minimal extended subquiver ρl of ril ` 1, n ´ 1s Y t0, nu after mutating along pil , al q. In the end, the last sequence of mutations al`1 transformations the quiver ρl to /‚ /‚ n ‚ ✟ Z✻✻✻ ✟ Z✻✻✻ ✟ Z✻✻✻ ✟ Z✻✻✻ ✟ ✟ ✟ ✟ ✻✻ ✟✟ ✻✻ ✻✻ ✟✟ ✟ ✻✻ ✟✟ ✟ ✟ ✟ ✟ ✟ / / / /0 il `2 il `1 ¨ ¨ ¨Z✻ n´1 Z✻✻ Z✻✻ ✻ ✟ ✟ ✟ ✻ ✻✻ ✟✟ ✻✻ ✟✟ ✻✻ ✟✟✟ ✻ ✟✟ ✻ ✟✟ ✻ ✟✟✟ /˝ /˝ ˝ This is what we desired.  CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 31 Lemma 6.16. Consider the following cross of two hive strips. /0 /‚ n1 ‚ ✆ \✾✾✾ ✆ \✾✾✾ ✆ \✾✾✾ ✆ \✾✾✾ ✆ ✆ ✆ ✆ ✆ ✾✾ ✆✆ ✾✾ ✆ ✆ ✆ ✆ / ‚ ✆ / ... / ... /‚ ‚ \✾ ✾✾ ✆ \✾✾✾ ✆ \✾✾✾✾ ✆ \✾✾✾ ✆ ✆ ✆ ✆ ✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾ ✆✆ ✾ ✆✆✆ ✆ / ‚ ✆ / pi`1q1 / i´1 ‚ \✾ ✾ \ ✾ \ ✾✾ ✆ ✆ ✾✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆ ✾✾ ✆✆✆ ✆ ✆  ✆ /i /‚ ‚ ✆ \✾✾✾✾ ✆ \✾✾✾ ✆ \✾✾✾ ✆ ✆ ✆ ✾✾ ✆ ✾ ✆✆ ✾ ✆✆✆ ✆✆ / pi´1q1 / i`1 /‚ ‚ \✾ \✾✾ \✾✾ \✾✾✾ ✾ ✆ ✆ ✆ ✆ ✾ ✾✾ ✆ ✾✾ ✆ ✆ ✆✆ ✆✆ ✾ ✾ ✆ ✆ . . ✆  ✆ / .. /‚ / .. /‚ ‚ \✾ ✾ \ ✾ \ ✾ \ ✾✾ ✆ ✾✾ ✆ ✆ ✾✾ ✆ ✾✾ ✆ ✆ ✆ ✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾ ✆✆ ✆ ✆ / ‚ ✆ / 01 n ‚ We first mutate at the center i, then the mutation at any other central vertex (that is non-dot vertex) on one strip commutes with the mutation at any other central vertex on the other strip. Proof. Suppose that we have mutated at i. A trivial observation is that it suffices to check that the mutation at either i ´ 1 or i ` 1 commutes with the mutation at either pi ´ 1q1 or pi ` 1q1 . This can be directly verified, say by [18].  m Each frozen vertex v “ pm i,j q generates a path pv in ♦l as follows. For the sake of explanation, we describe such a path with all arrows reversed. It starts from v0 :“ v, going in the only straight direction until it hits an edge vertex v1 in pm´1q ♦l . Then it starts from v1 , going in the only straight direction until it hits an edge vertex in the previous diamond. Keep this way until it hits the vertex p10,j q. ˚ Then from p1_ 0,j q it follows the same rule until it hits a frozen vertex v . It is easy ˚ m ˚ to see that v “ pj,i q if m is even and v “ v̌ if m is odd. We see that v and v ˚ coincide only when m is even and i “ j (in particular l is even as well). Example 6.17. Here is a picture for such a path when l “ 5 and m “ 4. ¨/ \✾ ¨\✾ ✆✆ ✾✾ ✆✆ ✾✾ ¨\✾✆✆ ✾¨/ ✆\✾✆ ✾/¨\✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆\✾✆ ✾/¨✆\✾✆ ✾/¨✆\✾✆ ✾/¨\✾ ¨ ✾ ✆ ✆ ✾ ✆ ✾ ✆✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ \¨✾✆✾ ✆/¨\✾✆✾ ✆¨/ \✾✆✾ ✆¨/ \✾✆✾ ✆/¨ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ /¨✆\✾ /¨✆\✾ ¨/ ✆\✾ ¨\✾✆ ✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆ ¨✆\✾✾✾ ✆/¨✆\✾✾✾ ✆/¨✆\✾✾✾ ✆¨/ ✆\✾✾✾ ✆/¨ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ¨\✾✾✾ ✆¨/ \✾✾✾ ✆¨/ \✾✾✾ ✆/¨ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ¨\✾✾✾ ✆¨/ \✾✾✾ ✆/¨ ✾ ✆✆✆ ✾ ✆✆✆ /¨ ¨ ¨\✾ ¨/ \✾ ✆✆ ✾✾ ✆✆ ✾✾ ¨\✾✆✆ ✾/¨✆\✾✆ ✾/¨\✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆\✾✆ ✾¨/ \✾✆✆ ✾/¨\✾✆✆ ✾/¨\✾ ¨ ✾ ✆ ✆✾ ✆ ✾ ✆ ✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ \¨✾✆✾ ✆¨/ ✆\✾✾ ✆/¨\✾✆✾ ✆¨/ \✾✆✾ ✆/¨ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✆✆ /¨✆\✾ ¨/ \✾✆ ¨/ ✆\✾ ¨✆\✾ ✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆ ¨✆\✾✾✾ ✆¨/ ✆\✾✾✾ ✆/¨\✾✆✾✾ ✆¨/ ✆\✾✾✾ ✆/¨ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ¨\✾✾✾ ✆¨/ \✾✾✾ ✆/¨\✾✾✾ ✆¨/ ✾ ✆✆✆ ✾ ✆✆✆ ✾ ✆✆✆ ¨\✾✾✾ ✆/¨\✾✾✾ ✆¨/ ✾ ✆✆✆ ✾ ✆✆✆ ¨ ¨/ Figure 13 /d\✾ ¨Z✺ ✠✠ ✺✺✺ ✠✠✠ ✾✾ ✠ ✠ / ✠ / ∗ ☛¨Y✸✸✸ ☛☛¨Y✸✸✸ ✞v [✼✼ ☛ ✼ ✸ ✸ ☛ ☛ ✞ ¨[✼☛✼ ✞¨/ ☛[✼✼ ✞¨/ ]❀✞❀ ✄/ v [✼✼ ✞ ✞✞ ✼✼ ✞✞ ✼✼ ✞✞ ❀❀/ ✄✄✄ ✼/ ¨✞\✾✾✾ ✆¨/ ✞\✾✾✾ ✆¨/ ✞\✾✾✾ ¨^❃❃❃ ✆d ✾ ✆✆✆ ✾ ✆✆✆ ✾ ❃ ✆✆ / / / ✆¨\✾✾✾✾ ✆✆¨\✾✾✾✾ ✆✆¨^❃❃❃❃ ¨\✾✾✾ ✆ /¨\✾✆✆ ¨\✾✆✆ /¨✆\✾✆ /d /¨^❃❃ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ❃❃ ✆✆ ✾ ✆✆ ✾ ✆✆ ✾ ✆  / / / d ¨\✾✾✾ ✆¨\✾✾✾ ✆¨^❃❃❃ ✾ ✆✆✆ ✾ ✆✆✆ ❃ / / d ¨\✾✾✾ ✆¨\✾✾ ✾ ✆✆✆ ✾ / d ¨ 32 JIARUI FEI Lemma 6.18. Let v be a frozen vertex of ♦m l and pv be the path defined above. We assume that v ‰ v ˚ . We first mutate at each cross-vertex of pv for v “ pm i,j q, then mutate at each non-cross vertex along this path. In this way, we optimize the frozen vertex v (in fact both v and v ˚ ). Proof. By Lemma 6.15 and 6.16, the minimal extended subquiver of tv, v ˚ u is given by v Ñ u Ñ v˚ , after deleting the arrows between the frozen vertices v and v ˚ . Here u is the last vertex connected to v on the path pv .  Remark 6.19. The above lemma does fail if v “ v ˚ . In the smallest non-trivial case when l “ m “ 2. The quiver ♦22 is 2 1,1 (6.1) B ✆✆ ✆ ✆o 1 0,1 o ✾✾ ✾✾  ✾✾ ✾✾  2 1,0 ✆B ✆ ✆✆ 2_ 1,1 The quiver has finite mutation-type so it can be easily checked that none of the two frozen vertices can be optimized. Now we proceed to the second part of this subsection. We are going to deal with the mutable vertices of ♦m l . Recall that ♦l is the ice quiver corresponding to the triangulation of Figure 2 (right). We delete the (frozen) vertices on the two right ˆl. edges, and denote this ice quiver by ♦ Lemma 6.20 (cutting diamond). Using mutations and sink-source deletions, we ˆl. can delete all the vertices on the diagonal of ♦ Proof. We prove by induction. By Lemma 6.12, we can delete the rightmost vertex. Now suppose that we have deleted a few vertices from the right as shown below. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 33 The vertices in gray has been deleted. 0,n 0,n´1 / \✾✾✾ 1,n´1 \✾✾✾ ✆✆ \✾✾✾✾ ✆ / ¨ ¨ ¨✆ / ¨¨¨ ¨¨¨ \✾✾ ✆✆ \✾✾✾ ✆✆ \✾✾✾ ✾ ✆✆ ✾ ✾ ✆ / ¨ ¨ ¨✆ / 1,n´k / k,n´k 0,n´k ✾ \ \✾✾✾ ✆✆ \✾✾✾✾ ✆✆ ✾✾✾ ✆✆ \✾✾✾✾ ✆ ✆ ✆ / ¨¨¨ / ¨ ¨ ¨✆ / ¨ ¨ ¨✆ / ¨ ¨ ¨✆ ¨¨¨ ✾ \ ✾ \ ✾ \ \✾✾ ✆✆ ✾✾ ✆ ✾✾ ✆ ✾✾ ✆✆ \✾✾✾ ✆ ✆ ✾ ✾ ✾ ✾ ✾ ✆✆ ✆✆ ✆✆ ✆✆ / ¨¨¨ / n´1,1 / ¨¨¨ / k,1 / k´1,1 0,1 \✾✾✾ ✆✆ \✾✾✾✾ ✆✆ \✾✾✾ ✆✆ \✾✾✾ ✆✆ \✾✾✾✾ ✆✆ \✾✾✾✾ ✆ ✆✆ ✆✆ ✆✆ ✆✆ / ¨¨¨ / k,0 / n,0 / k`1,0 / ¨¨¨ 1,0 ✾ \ \✾✾ ✾ \ ✾ \ ✾ \ ✾ ✆✆ ✾✾✾ ✆✆✆✆ ✾✾ ✆✆✆ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆✆ ✾✾ ✆✆✆ / ¨¨¨ / k,1̌ / ¨¨¨ / n´1,1̌ / k´1,1̌ 0,1̌ \✾✾ \✾✾ \✾✾ \✾✾ ✆ ✆ ✆ ✆ ✾ ✾ ✾✾ ✆✆ ✾✾ ✆✆ ✾ ✆✆✆ ✾ ✆✆✆✆ ✆✆ ✆ ✆ / / / / ¨¨¨ ¨ ¨ ¨\✾ ¨ ¨ ¨\✾ ¨ ¨ ¨\✾ ¨¨¨ ✆✆✆ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾ ✆✆✆ / ¨ ¨ ¨✆ / 1,n´k / k,n´k ˇ ˇ ˇ 0,n´k ✾ \ ✾✾ ✆✆ \✾✾✾ ✆✆ ✆ ✆ ✾ ✆ ✾ ✆ ✆ / ¨ ¨ ¨✆ / ¨ ¨ ¨✆ ¨¨¨ \✾✾ ✆✆✆ ✾✾ ✆✆✆✆ / 1,n´1 ˇ ˇ 0,n´1 ✆ ✆ ✆ 0,ň Let us look at the subquiver in red. We shall denote the sequence of mutations on the r-th row by µr :“ µ1,r µ2,r ¨ ¨ ¨ µk,r . Y Y Y We also write µY r for µř µr . By Lemma 6.12, after applying µn´k ¨ ¨ ¨ µ2 µ1 , we transform the subquiver in red into the following one / 1,n´k / 2,n´k / k,n´k / ¨¨¨ \✾ ❧❧❧ ✆✆ \✾✾✾✾ ✆✆ \✾✾✾✾ ✆✆✆ ✾✾✾ ✆✆ ❧ ❧ ✆ ✆ ✆✆ v❧❧❧ / ¨ ¨ ¨✆ / ¨ ¨ ¨✆ / ¨ ¨ ¨✆ ¨ ¨ ¨ ❧❧/ ¨ ¨ ¨\✾ ✾ \ ✾ \ ❧ ✆ ✾✾ ✆✆ ✾✾ ✆✆ ✾✾ ✾ ✆✆✆✆ ❧❧❧ ✆ ✾ ✆✆ ✾ ✆✆ v❧❧❧ / ✆✆ / / / ¨ ¨ ¨\✾ k,1 1,1 2,1 \✾✾ \✾ \✾ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾ ✆  ✆  ✆ / ¨¨¨ / k,0 / 2,0 1,0 \✾✾ \✾✾ \✾✾ ✆ ✆ ✾ ✆ ✆ ✾ ✆ ✾ ✆✆ ✾ ✆✆ ✾ ✆ ✆✆ / k,1̌ / 2,1̌ / ¨ ¨ ¨✆ h❘❘❘ / 1,1̌ \✾ ✾ \ ❘❘❘ ✾✾ ✆✆ \✾✾✾ ✆✆ ✾✾ ✆✆ \✾✾✾ ❘❘❘ ✾ ✆✆ ✾ ✆✆ ✾ ✾ ✆✆ / ¨¨¨ / ¨¨¨ / ¨¨¨ ¨ ¨ ¨ h❘❘ / ¨ ¨ ¨\✾ ✾ \ ✾ \ \✾ ❘❘❘ ✾ ❘❘❘ ✾ ✆✆✆ ✾✾ ✆✆✆ ✾✾✾ ✆✆✆ ✾✾ / ¨ ¨ ¨✆ / 1,n´k / k,n´k / 2,n´k ˇ ˇ ˇ ˇ 0,n´k 0,n´k 0,1 0,1̌ So we can apply Lemma 6.12 again to optimize the vertex pk, 0q. Since all mutations are outside pk, 0q, after deleting pk, 0q we can apply the same sequence of mutations 34 JIARUI FEI backwards to recover the original shape (Lemma 6.11). We finish the proof by induction.  m m 6.3. p♦l , W l q is a cluster model. Let a be the sum of all east arrows in the m diamond view of ♦l . Let b (resp. c) be sum of all southwest (resp. northwest) arrows in the even diamonds and all northwest (resp. southwest) arrows in the odd diamonds. These arrows are also called of type A, B, and C respectively. We remark that the arrows 10,j`1 Ñ10,j are summands in both b and c. We hope that Figure 13 is helpful for readers. We define the potential m W l :“ abc ´ acb. We call an oriented cycle a 3-cycle if it consists of three arrows. After a short m reflection, we can see that the definition can be rephrased as follows. W l is the alternating sum of all 3-cycles, except that we only take two 3-cycles from the m subquiver (6.1). The Jacobian ideal BpW l q is generated by the elements (6.2) eu1 pbc ´ cbqeu , eu1 pca ´ acqeu , eu1 pab ´ baqeu for u ‰ p10,j q, p21,0 q mutable, and u and u1 lie on the same side of diamond diagonals; (6.3) pbc ´ cbqeu , pac ´ abqeu for u “ p10,j q; (6.4) pbc ´ cbqeu for u “ p10,1 q; (6.5) pbc ´ cbqeu , aceu , abeu for u “ p21,0 q; (6.6) caev , baev for v frozen. 2 The requirement for u and u1 in (6.2) simply excludes the elements e2_ 1,j´1 pab´baqe1,j 2 2_ 2_ 2 and e1,j´1 pca ´ acqe1,j . They should be excluded because for example e1,j´1 bae1,j 2 is not contained in any 3-cycle and e2_ 1,j´1 abe1,j is zero. We denote the Jacobian m m m algebra Jp♦l , W l q by J l . m m Lemma 6.21. The IQP p♦l , W l q is rigid. Proof. We need to show that every cycle up to cyclic equivalence is zero in the m Jacobian algebra J l . By repeatedly applying (6.2) and cyclic equivalence, we can make any 3-cycle equivalent to cbaev or bcaev (depending on whether it is above or m below the diamond diagonal) for some frozen v, which is zero in J l by (6.6). For any cycle not hitting the edge 1, it must contains all three types of arrows. By (6.2) it is equivalent to a cycle containing some 3-cycle. Now let s be any cycle hitting the edge 1, then it must pass at least two vertices on that edge. So s contains a subpath of form p “ eu1 ap1 beu or p “ eu1 ap1 ceu where u “ p10,j q and u1 “ p10,j 1 q; the path p1 does not hit the edge 1. Suppose that we are in the former case (the latter can be treated similarly). If p1 contains a type C arrow, then by relations (6.2) and (6.3) or (6.4) we get a 3-cycle acbeu . So we can assume that s contains only two types of arrows and write s “ eu1 ar bs eu . By (6.2) we can move the last a to the right and get s “ eu1 ar´1 bs´1 abeu . If j ą 1, then s ą r ą 1 and by the relation abeu “ aceu of (6.3) we come back to the case when s contains three types of arrows. If j “ 1, then we get abeu “ 0 by (6.5).  m m Theorem 6.22. The rigid potential IQP p♦l , W l q is a polyhedral cluster model and its Jacobian algebra is finite-dimensional. CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 35 Proof. By the remark after [8, Theorem 3.17], the case for m follows from the case for m ` 1. So we can assume that m ě 3 is odd. We will recursively apply Theorem 6.10. But the proof will go backwards, that is, we use sink-source deletions to m reduce ♦l to some quiver, which is a cluster model with its rigid potential. Step 1. By Lemmas 5.7 and 6.13, we can delete all frozen vertices corresponding m to the central determinants to obtain ♦yl . Then we hope to delete the rest frozen m vertices p♦yl qν as well but we cannot do this directly because the full rank condition m will be violated. We need to add some axillary frozen vertices to ♦yl such that after m deleting p♦yl qν we still have a full rank B-matrix. We add for each vertex in the diamond 2 a frozen sink. This is valid due to [11, Lemma 2.5]. By Lemma 6.18, we m can delete all frozen vertices in ♦yl (but we keep the added frozen sinks there). Step 2. In this step we will delete all (mutable) vertices on the diamond diagonals. m Recall that ♦yl is obtained from ♦m l by the sequence of mutations corresponding to some twists on odd diamonds. We apply this sequence of mutations again, then we get the quiver ♦m l back but with some additional frozen sinks attached to the diamond 2. Now we start to prove by induction from the diagonal m. We can delete all vertices on the diagonal m by Lemma 6.20. After deleting all vertices on m, we can easily put the frozen vertices in ♦m l back to the original position by sink-source extensions and mutations (see Lemma 6.12). Then we delete all the axillary frozen sinks. Suppose that we have done for the diagonal k ` 1 as shown below. The dashed edges indicate that the vertices there have been deleted. ✻ ✠✠ ✻ ✠ ✻ ✠ ¨¨¨ ✠ ✠ k`2 ✻ ✠ ✻ ✠✠ ✻ ✠ ✻✠✻ rk`1s ✻✻ ✠ ✠ ✠ ✻ ✻ ✠ ✠ ✠ ✻✻ ✠ ✻✻ ✠ ✠✠ ✠✠ ✠ rks rk´1s rk´2s rk´1s k`1 ✻✻ ✻✻ ✠ ✻✻ ✠ ✠ ✻✻ ✠✠✠ ✠✠ ✻✠✻ ✻ ✠ ✠ ✻✠✻ ✻ ✠ k ¨¨¨ ✠ ✻✻ ✠ ✻✻ k´1 ✠ ✠ ✠ ✻✻ ✠ ✻✻ ✻ ✠ ✠ ✠Ý ÐÝÝÝÝ ÐÝ✠ ÐÝÝÝÝ ÐÝÝÝ k`1 rk ´✻2s rk ´ 1s rk ´✻1s rks ✻ ✻✻ ✠✠ ✻✻ ✠✠ ✻ ✻✻ ✠✠ ✻✻ ✠✠ ✻ ÝÝÝÝ ✻✠✻ Ð ✠ rk ` 1s ✠ ✻✻ ✠ ✻✻ ✠ k`2 ¨¨¨ ✻✻ ✻✻ ✠ ✠ ✻✠ To treat the next one – the diagonal k, we first apply the flip at the (disk) diagonals Ð Ý rks and rks. Then we are able to apply Lemma 6.20 to delete vertices on the diagonal k. Finally we apply the same flip to recover the original triangulation to continue the induction. Step 3. After deleting all diamond diagonals, we obtain two (disconnected) copies of triangulation of m ` 1-gon (see the disk view). All boundary edges except for one are dashed line. The ice quiver corresponding to such a triangulation has a full rank B-matrix [11]. It was shown in [11, Proposition 3.4] that this rigid IQP is a polyhedral cluster model. Moreover, its Jacobian algebra is finite-dimensional.  7. Computing Kronecker Coefficients 36 JIARUI FEI m 7.1. Recap from the previous paper. Suppose σ is a weight such that SIβ pKl,l qσ is non-zero, then it is clear from [3, Theorem 3] that σp´iq ď 0 and σpiq ě 0 for any i P r1, ls. For such a weight σ we associate two partitions ´ ´ ¯˚ ¯˚ µpσq :“ l´σp´lq , . . . , 2´σp´2q , 1´σp´1q and νpσq :“ lσplq , . . . , 2σp2q , 1σp1q , where ˚ is the transpose of a partition. Recall that W is the m-dimensional vector space spanned by the arrows from ´l to l. Let U be the subgroup of upper-triangular matrices in GLpW q. We m m write SIβ pKl,l qσ,λ for the weight λ component of SIβ pKl,l qσ . For ω P Sm , we ω m ω write λ for the vector in Z such that λ piq “ λpiq ´ i ` ωpiq. Let Sm pλq :“ ( ω P Sm | λω P Zm ě0 . m U Proposition 7.1 ([9, Corollary 3.2 and 3.4]). The dimension of SIβ pKl,l qσ,λ is λ equal to gµpσq,νpσq , which can be computed by the formula ÿ λ m “ gµpσq,νpσq sgnpωq dim SIβ pKl,l qσ,λω . ωPSm pλq m Now Theorem 5.12 and 6.22 imply that a basis of SIβ pKl,l q is parametrized by µm m supported g-vectors in p♦l , W l q, which is given by lattice points in some rational polyhedral cone. We denote this cone by Gm l . For the weight configuration σ on m m n ♦l viewing as a map Gl Ñ R , we denote Gm l pσq the fibre polytope at σ. Then m it follows that each weight multiplicity SIβ pKl,l qσ,λ is counted by the lattice points in Gm pσ, λq. l m Theorem 7.2. Let σ be a weight of Kl,l and λ be a partition of length ď m. Then ˇ ˇ ÿ m ˇ λ ω p♦l q0 ˇ gµpσq,νpσq “ sgnpωq ˇGm pσ, λ q X Z ˇ. l ωPSm pλq We remain to explicitly describe the polyhedral cone Gm l . It turns out that it is defined by dimension vectors of subrepresentations of some representations. m mY 7.2. The g-vector cone Gm l . Recall that the frozen vertices of ♦yl are pi,j q with mY i ` j “ l if m is even or p0,j q if m is odd. For each frozen vertex v we define its mY 1 predecessor v 1 to be pmY i`1,j´1 q if m is even or p0,j`1 q if m is odd. If v is undefined (eg., i “ l ´ 1 for even m or j “ l ´ 1 for odd m), then v is called terminal. Let av1 ,v be the unique arrow from v 1 to v. m Let I v be the indecomposable injective representation of J l corresponding to m the vertex v. We consider the following set of boundary representations Tv of J l for each frozen vertex v. m à pav,v1 ,fv q 1 (7.1) 0 Ñ Tv Ñ I v ÝÝÝÝÝÝÑ I v1 ‘ kn I n for v “ pmY i,j q and v is defined; n“1 fv (7.2) 0 Ñ Tv Ñ I v ÝÑ (7.3) 0 Ñ Tv Ñ I v Ñ 0 m à kn I n for v “ pmY i,j q is terminal; n“1 for v “ n P r1, ms. Here kn are sufficiently large integers such that Tv is not supported on any n P r1, ms Àm for a general morphism fv : I v Ñ n“1 kn I n . CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 37 It is easy to see that Tn “ I n (n P r2, ms) is the indecomposable module (of dimension p1, 1, ¨ ¨ ¨ , 1q) supported on the (diamond) diagonal of the diamond n. The module T1 “ I 1 is a (1-dimensional) simple module. We are going to give a concrete description of Tv for v R rms. a2 a1 v2 Ý Ñ ¨¨¨ Ý Ñ vt in a quiver ∆, where vi ’s may not v1 ÝÑ Let p be a path v0 ÝÑ be all distinct. We can attach a uniserial representation Sppq of ∆ with its basis elements mvi labeled by vi . The action of arrows on Sppq is given by mvi´1 ai “ mvi and mvj ai “ 0 otherwise. Proposition 7.3. The module Tv is exactly the path module Sppv q for any v R rms. Proof. Since Tv is not supported on any frozen vertex in r1, ms, we see that it is m m m m in fact a representation of p♦yl , Wlm q, which is te restriction of p♦l , W l q to ♦yl . m m m m pJl , ´q to (7.1), we get the Let Jl :“ Jp♦yl , Wl q. Applying the functor HomJ m l exact sequence av,v1 0 Ñ Tv Ñ Iv ÝÝÝÑ Iv1 , where Iv is the indecomposable injective representation of Jlm . Let us assume that m is even and v “ pm i,j q (other cases can be treated similarly). Then the arrow av1 ,v is of type C and the path pv is of form ew bs e10,j ar ev . m For any path p in ♦yl , we denote by rp˚ s the equivalence class of its dual in ` m ˘˚ Jl . Let p be a maximal path such that rp˚ s P Iv is in the kernel of av1 ,v . It is easy to see that the last arrow of p must be of type A unless p is trivial. If the second last arrow of p is of type B, then by (6.6) p is equivalent to a zero path. If the second last arrow of p is of type C, then by (6.2) rp˚ s does not lie in the kernel of av1 ,v . Inductively using (6.2), we can show that the last part of p must be of the 1_ 1 form e10,j ar ev . We claim that the previous arrow must be 2_ 1,j´1 Ñ 0,j “ 0,j . Indeed, 2_ 2 unlike the other cases, we cannot exchange b and a in e1,j´1 bae1,j . Then the similar argument shows that the rest of p must be of the form ew bs e10,j . Throughout the proof we do not have any other choice for p, p is in fact the maximal one, and any path such that its dual in Ker av,v1 is a subpath of p. This is easily seen to be equivalent to what we desired.  Remark 7.4. From this path description of Tv we can easily verify that dim Tv puq “ σu pjq and dim Tv̌ puq “ σu p´jq, where σu is the σ-weight of sm l puq. Moreover, when l and m are not both even, each m m Tv can be mutated from the negative simple Sv of µ´1 v p♦yl , Wl q by µv , where µv is the sequence optimizing v. Definition 7.5. A vertex v is called maximal in a representation M if dim M pvq “ 1 and all strict subrepresentations of M are not supported on v. We note that when v ‰ v ˚ , each Tv contains a maximal vertex: If v R r1, ms, the vertex v ˚ is maximal in Tv . If v “ n is even (resp. odd), pn1,0 q (resp. pnl´1,0 q) is maximal in Tv . Lemma 7.6. [7, Lemma 6.5] Suppose that a representation T contains a maximal vertex. Let M “ Cokerpgq, then HomJ m pM, T q “ 0 if and only if gpdimSq ě 0 for l all subrepresentations S of T . 38 JIARUI FEI When v and v ˚ coincide, Tv does not have a maximal vertex. In this case, we have an exact sequence 0 Ñ Tv1 Ñ Tv Ñ Sv Ñ 0. Then Tv1 have a maximal vertex v. Note that HompM, Tv1 q “ 0 if and only if HompM, Tv q “ 0 because we have another exact sequence 0 Ñ S Ñ Tv1 Ñ U Ñ 0. In particular, the conclusion of Lemma 7.6 holds for this Tv as well. m Lemma 7.7. Let M be any representation of J l . We have that HomJ m pM, Tv q “ 0 l for each frozen v if and only if HomJ m pM, Iv q “ 0 for each frozen v. l Proof. Since each subrepresentation of Tv is also a subrepresentation of Iv , one direction is clear. Conversely, let us assume that HomJ m pM, Tv q “ 0 for each l frozen vertex v. We prove that HomJ m pM, Iv q “ 0 by induction. l Recall that Tn are injective for all n P r1, ms. In general, for an injective pM, I0 q “ 0, we have that presentation of T : 0 Ñ T Ñ I1 Ñ I0 with HomJ m l HomJ m pM, I1 q “ 0 is equivalent to HomJ m pM, T q “ 0. Now we perform the inducl l tion from a terminal v then its predecessor using (7.2) and (7.1). We can conclude  that HomJ m pM, Iv q “ 0 for all frozen v. l m p♦l q0 is defined by gpdimSq ě 0 for all subProposition 7.8. The cone Gm l Ă R representations S Ď Tn for n P r1, ms, and for all strict subrepresentations S Ď Tv for all frozen v R r1, ms. Moreover, any inequality above is essential. Proof. Due to Lemma 7.6 and 7.7, Gm l is defined by gpdimSq ě 0 for all subrepresentations S of Tv and all v frozen. So it suffices to show that the condition gpdimTv q ě 0 is redundant for each v R r1, ms. This is because dimTv “ ew ` pdimTv ´ ew q and dimTv ´ ew is the dimension vector of a strict subrepresentation of Tv . For the last statement, we notice that each subrepresentation defining Gm l supported on a unique frozen vertex. So if one defining condition is a positive combination of others, their corresponding subrepresentations must share a common frozen vertex. But this is clearly impossible.  3 Example 7.9. For l “ m “ 3, the ice quiver ♦3 is draw in the diamond view below. 1 / 21,2 7 10,2 Z✻✻ Z✻✻ ✟ ✟ ✻✻ ✟✟ ✻✻ ✟ ✟ ✟ ✟ 1 2 / /2 0,1 2,1 1,1 Z✻✻ ✻ Z Z✻ ✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✻✻✻ ✟ ✟ 2 /2 /2 2,0 1,0 ✻ Z ✻ Z ✻ ✻ ✟ ✻✻ ✟✟✟ ✻✻ ✟✟ ✟✟ ✟ ✟ ✟✟ 1 / 2_ / 2_ 0,1 2,1 1,1 Z✻ Z✻✻ ✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✟ ✟  '1 / 2_ 0,2 1,2 / 3 0,1 ✻ [ ✻✻ [✻✻ ✟ ✟ ✟ ✻ ✟✟ ✟✟ 2 / 30,2 / 31,1 1,2 [✻✻ ✻ [ ✻✻ ✻✻ ✟✟✟ ✻ ✟✟✟ ✟ 3 /3 2,0 1,0 ✻ [ ✻ ✟ [✻✻✻ ✟ ✻ ✟ ✟ ✻ ✟✟ ✟✟ 2_ / 3_ / 3_ 1,2 1,1 0,2 [✻✻ [✻✻ ✟ ✻ ✻✻ ✟✟ ✟ ✟ ✟ 3_ 2_ / 0,1 2,1 2 2,1 [✻✻ ✻ /3 ✟ ✟ ✟ CLUSTER ALGEBRAS, INVARIANT THEORY, AND KRONECKER COEFFICIENTS II 39 We list some of the cluster variables mostly following Lemma 2.5 (s31,1 is obtained from sr31,1 by the mutation at p31,1 q). Recall that p10,i q “ p1i,0 q. n n sni,0 “ spfi,0 q n fi,0 : Pi Ý Ñ P´i , 2 s2i,j “ spfi,j q 2 fi,j : Pi`j ÝÝÝÑ P´i ‘ P´j , 3 s31,1 “ spf1,1 q p 0 12 q 3 Ñ P´2 ‘ P´2 , f1,1 : P1 ‘ P3 ÝÝ3ÝÝ 3 s30,j “ p´1qj spf0,j q p 0 12 q 3 Ñ P´j ‘ P´3 . f0,j : Pj ‘ P3 ÝÝ3ÝÝ p2 1q The path p30,1 and p30,2 are given by 3_ p30,1 “ 30,1 Ð 22,1 Ð 21,1 Ð 10,1 Ð 21,0 Ð 21,1 Ð 21,2 Ð 32,0 Ð 3_ 1,1 Ð 0,1 2 2 3 3_ 3_ p30,2 “ 30,2 Ð 31,1 Ð 21,2 Ð 10,2 Ð 2_ 1,1 Ð 2,0 Ð 2,1 Ð 1,1 Ð 1,0 Ð 0,2 3_ The paths p3_ 0,1 and p0,2 are very similar. So according to Proposition 7.8, the cone m 3Y Gl have exactly 43 supporting hyperplanes, including 9 ¨ 4 “ 36 coming from T0,1 3Y and T0,2 ; 3 ¨ 2 “ 6 coming from T2 and T3 ; 1 coming from T1 . This example has been implemented in SageMath [25] to compute the relevant Kronecker coefficients. The case when l “ m “ 4 is also implemented. Readers can download the code from author’s web page [10]. m As pointed out in the previous paper, the cluster structure for SIβl pKl,l q is not 3 unique for m ě 3. In the end, we give a seed for SIβ3 pK3,3 q, which is not mutationequivalent to the one in the last example. The proof is very similar. , sm Example 7.10. Let p♦m l q be the following quiver. l 1 Z✻✻ ✻✻ 1 / 21,2 0,2 ✻ Z Z✻ ✻ ✻✻ ✟✟✟ ✻✻✻ ✟✟ ✟ ✟✟ 1 / 21,1 / 22,1 0,1 Z✻✻ Z✻✻ ✟ ✟ ✻✻ ✟✟ ✻✻ ✟✟ ✟ ✟ 2 2 /2 / 2,0 1,0 ✻ Z ✻ Z ✻ ✻ ✻✻ ✟✟✟ ✻✻ ✟✟✟ ✟✟ ✟ ✟ ✟✟ 1 / 2_ / 2_ 0,1 2,1 1,1 Z✻ Z✻✻ ✻✻ ✟✟✟ ✻✻✻ ✟✟✟ ✟ ✟ 1 / 2_ 2 o 3 0,1 C 1,2 ✻✻ C ✻✻ ✟ ✻ ✟ ✟ ✻   ✟✟ ✟✟ 3 2 o 3 o 0,2 2,1 C✟ 1,1 ✻✻ ✻✻ ✻✻ ✟✟ ✻✻ ✟✟C  ✟  ✟ 3_ o 3_ o C✟ 0,2 ✻✻ C✟ 0,1 ✻✻ ✻ ✻✻ ✟✟ ✟ ✟✟  ✟ 3 2_ o 3_ o 2,0 2,1 C✟ 1,1 ✻✻ ✻✻ C ✻ ✻✻ ✟✟ ✟ ✟  ✟ 3 2_ o 1,0 1,2 ✟✟ ✟ ✟ 0,2 ✻✻ ✻ ✟C ✟✟ 3 1,2 m This seed cannot be mutated to p♦l , sm l q because they have different coefficients. Each cluster variables with the same label as in Example 7.9 are equal except that s31,1 “ spf 31,1 q s30,j “ p´1qj spf 30,j q ˆ 001 210 032 ˙ ˆ 0 01 2 10 0 32 ˙ f 31,1 : P1 ‘ 2P3 ÝÝÝÝÝÑ 2P´2 ‘ P´3 , f 30,j : Pj ‘ 2P3 ÝÝÝÝÝÑ P´j ‘ 2P´3 . 40 JIARUI FEI Acknowledgement The author would like to thank the NCTS (National Center for Theoretical Sciences) and Shanghai Jiao Tong University for the financial support. References 1. A. Berenstein, S. Fomin, A. Zelevinsky, Cluster algebras. III. Upper bounds and double Bruhat cells, Duke Math. J. 126 (2005), no. 1, 1–52. 2. H. Derksen, J. Fei, General presentations of algebras, Adv. Math. 278 (2015), 210–237. 3. H. Derksen, J. Weyman, Semi-invariants of quivers and saturation for Littlewood-Richardson coefficients, J. Amer. Math. Soc. 13 (2000), no. 3, 467–479. 4. H. Derksen, J. Weyman, A. Zelevinsky, Quivers with potentials and their representations I, Selecta Math. (N.S.) 14 (2008), no. 1, 59–119. 5. H. Derksen, J. Weyman, A. Zelevinsky, Quivers with potentials and their representations II, J. Amer. Math. Soc. 23 (2010), no. 3, 749–790. 6. M. Domokos, A. Zubkov, Semi-invariants of quivers as determinants, Transform. Groups 6 (2001), no. 1, 9–24. 7. J. Fei, Cluster algebras and semi-invariant rings I. Triple Flags, Proc. Lond. Math. Soc. (1) 115 (2017). 8. J. Fei, Cluster algebras and semi-invariant rings II. Projections, Math. Z. 285 (2017), no. 3-4, 939-966. 9. J. Fei, Cluster algebras, invariant theory, and Kronecker coefficients I, Adv. Math. 310 (2017), 1064-1112. 10. J. Fei, Author’s web page, https://sites.google.com/a/umich.edu/jiarui/research/tensorproduct-multiplicities/. 11. J. Fei, J. Weyman, Extending upper cluster algebras, arXiv:1707.04661. 12. V. Fock, A. Goncharov, Moduli spaces of local systems and higher Teichmüller theory, Publ. Math. Inst. Hautes Études Sci., 103 (2006) 1–211. 13. S. Fomin, P. Pylyavskyy, Tensor diagrams and cluster algebras, Adv. Math. 300 (2016), 717– 787. 14. S. Fomin, M. Shapiro, D. Thurston, Cluster algebras and triangulated surfaces. I. Cluster complexes, Acta Math. 201 (2008), no. 1, 83–146. 15. S. Fomin, A. Zelevinsky, Cluster algebras. I. Foundations, J. Amer. Math. Soc. 15 (2002), no. 2, 497–529. 16. S. Fomin, A. Zelevinsky, Cluster algebras. IV. Coefficients, Compos. Math. 143 (2007), no. 1, 112–164. 17. M. Gross, P. Hacking, S. Keel, M. Kontsevich, Canonical bases for cluster algebras, arXiv:1411.1394. 18. B. Keller, Quiver mutation in Java, http://www.math.jussieu.fr/˜keller/quivermutation/. 19. A. D. King, Moduli of representations of finite-dimensional algebras, Quart. J. Math. Oxford Ser. (2) 45 (1994), no. 180, 515–530. 20. P. Plamondon, Generic bases for cluster algebras from the cluster category, Int Math Res Notices (2013) 2013 (10): 2368–2420. 21. V. L. Popov, E. B. Vinberg, Invariant theory, in: Algebraic geometry. IV, Encyclopaedia of Mathematical Sciences, vol. 55, Springer-Verlag, Berlin, 1994, 123–284. 22. A. Schofield, Semi-invariants of quivers, J. London Math. Soc. (2) 43 (1991), no. 3, 385–395. 23. A. Schofield, M. Van den Bergh, Semi-invariants of quivers for arbitrary dimension vectors, Indag. Math. (N.S.) 12 (2001), no. 1, 125–138. 24. I. R. Shafarevich, Basic algebraic geometry. 1: Varieties in projective space, Transl. from the Russian by Miles Reid. 2nd, rev. and exp. ed. (English) Berlin: Springer-Verlag. xviii, 303 p. 25. W. A. Stein et al. Sage Mathematics Software (Version 7.0), The Sage Development Team, 2016. http://www.sagemath.org. Shanghai Jiao Tong University, School of Mathematical Sciences E-mail address: [email protected]
0math.AC
arXiv:1608.00617v1 [math.GR] 1 Aug 2016 ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP S. V. IVANOV Abstract. Let H, K be two finitely generated subgroups of a free group, let hH, Ki denote the subgroup generated by H, K, called the join of H, K, and let neither of H, K have finite index in hH, Ki. We prove the existence of an epimorphism ζ : hH, Ki → F2 , where F2 is a free group of rank 2, such that the restriction of ζ on both H and K is injective and the restriction ζ0 : H ∩ K → ζ(H) ∩ ζ(K) of ζ on H ∩ K to ζ(H) ∩ ζ(K) is surjective. This is obtained as a corollary of an analogous result on rank of the generalized join of two finitely generated subgroups in a free group. 1. Introduction It is a recurring theme in group theory to embed a countable group into a 2generated group often with some additional properties, see [1], [3], [4], [7], [11]. In this article we will look at two finitely generated subgroups of a free group from a similar perspective. Let H, K be two finitely generated subgroups of a free group F . Let S(H, K) denote a set of representatives of those double cosets HgK, g ∈ F , for which the intersection H ∩ gKg −1 is nontrivial. According to Walter Neumann [9], the set S(H, K) is finite and a formal disjoint W union s∈S(H,K) H ∩ sKs−1 of subgroups H ∩ sKs−1 , s ∈ S(H, K), could be considered as a generalized intersection of H and K. Let r(F ) denote the rank of a free group F and let r̄(F ) := max(r(F ) − 1, 0) denote the reduced rank of F . Theorem 1.1. Suppose that H, K are two finitely generated subgroups of a free group F , L = hH, K, S(H, K)i denotes the subgroup generated by H, K, S(H, K), and neither H nor K has finite index in L. Then there is an epimorphism η : L → F2 , where F2 is a free group of rank 2, such that the restriction of η on H and K is injective, a set S(η(H), η(K)) for subgroups η(H), η(K) of F2 can be taken to be η(S(H, K)), and, for every s ∈ S(H, K), the restriction ηs : H ∩ sKs−1 → η(H) ∩ η(s)η(K)η(s)−1 of η on H ∩ sKs−1 to η(H) ∩ η(s)η(K)η(s)−1 is surjective. Informally, we can say that, when given a generalized join L = hH, K, S(H, K)i of two finitely generated subgroups H, K of a free group F such that neither of H, K has finite index in L, it is always possible to assume that r(L) = 2, i.e., the subgroup hH, K, S(H, K)i is 2-generated. Since a free group of an arbitrary finite 2010 Mathematics Subject Classification. Primary 20E05, 20E07, 20F65, 57M07. Supported in part by the NSF under grant DMS 09-01782. 1 2 S. V. IVANOV rank is isomorphic to a subgroup of a free group of rank 2, it is easy to obtain the equality r(F ) = 2 and our goal here will be to attain the equality r(L) = 2. We mention an easy corollary of Theorem 1.1 for a “pure” intersection case. Corollary 1.2. Suppose that H, K are two finitely generated subgroups of a free group F , hH, Ki denotes the subgroup generated by H, K, and neither H nor K has finite index in their join hH, Ki. Then there is an epimorphism ζ : hH, Ki → F2 , where F2 is a free group of rank 2, such that the restriction of ζ on H and K is injective and the restriction ζ0 : H ∩K → ζ(H)∩ζ(K) of ζ on H ∩K to ζ(H)∩ζ(K) is surjective. It is worthwhile to mention that Theorem 1.1 is false in case when one of subgroups H, K has finite index in L = hH, K, S(H, K)i. Indeed, if H has finite index j in L and r(L) = n > 2 then, according to the Schreier’s formula, we have r(H) = (n − 1)j + 1, see [7]. Since η is an epimorphism, the subgroup η(H) has finite index j ′ ≤ j in F2 = η(L) and it follows from the Schreier’s formula that r(η(H)) = j ′ + 1. Hence, the equality r(H) = r(η(H)) is impossible as (n − 1)j > j ′ and the restriction of η may not be injective on H. We also remark that Theorem 1.1 is motivated by the author’s article [5] in which certain modifications of Stallings graphs of subgroups H, K, that do not change the ranks r(H), r(K), r(H ∩ sKs−1 ) for every s ∈ S(H, K), are used to achieve some desired properties of the Stallings graph of L whose rank r(L), however, might increase under carried out modifications. In this article, we make different modifications, in somewhat opposite direction, that decrease the rank r(L) down to 2 while the ranks r(H), r(K), r(H ∩ sKs−1 ) for every s ∈ S(H, K), and the cardinality |S(H, K)| are kept fixed. 2. Preliminaries Suppose that Q is a graph. Let V Q denote the set of vertices of Q and let EQ denote the set of oriented edges of Q. If e ∈ EQ then e−1 denotes the edge with the opposite to e orientation, e−1 6= e. For e ∈ EQ, let e− and e+ denote the initial and terminal, respectively, vertices of e. A path p = e1 . . . ek , where ei ∈ EQ, (ei )+ = (ei+1 )− , i = 1, . . . , k − 1, −1 is called reduced if, for every i = 1, . . . , k − 1, ei 6= ei+1 . The length of p is k, denoted |p| = k. The initial vertex of p is p− = (e1 )− and the terminal vertex of p is p+ = (ek )+ . A path p is closed if p− = p+ . If p = e1 . . . ek is a closed path then a cyclic permutation p̄ of p is a path of the form e1+i e2+i . . . ek+i , where i = 1, . . . , k and the indices are considered mod k. The subgraph of Q that consists of edges of all closed paths p of Q such that |p| > 0 and any cyclic permutation of p is reduced is called the core of X, denoted core(X). Let F be a free group of finite rank r(F ) > 1. We consider F as the fundamental group π1 (U ) where U is a bouquet of r(F ) circles. Following Stallings [10], see also [2], [6], with every (finitely generated) subgroup H of F = π1 (U ), we can associate a connected (resp. finite) graph X = X(H) with a distinguished vertex o ∈ V X and a locally injective map ϕ : X → U of graphs so that H is isomorphic to π1 (X, o). Such a graph X of H is called a Stallings graph of H and the map ϕ is called a canonical immersion. ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 3 Consider two finitely generated subgroups H, K of the free group F . Pick a set S(H, K) of representatives of those double cosets HgK, g ∈ F , for which the intersection H ∩ gKg −1 is nontrivial. Let X, Y be finite Stallings graphs of the subgroups H, K, resp., and let X ×U Y denote the pullback of canonical immersions ϕX : X → U, ϕY : Y → U. (2.1) According to Walter Neumann [9], the set S(H, K) is finite and the nontrivial intersections H ∩ sKs−1 , where s ∈ S(H, K), are in bijective correspondence with connected components Ws of the core W := core(X ×U Y ). Moreover, for every s ∈ S(H, K), we have r̄(H ∩ sKs−1 ) = 12 |EWs | − |V Ws |, where r̄(F ) = max(r(F ) − 1, 0) is the reduced rank of a free group F and |T | is the cardinality of a finite set T . Recall that, according to our notation, the number of nonoriented edges of Ws is 12 |EWs |. For a finite graph Q, denote r̄(Q) := 21 |EQ| − |V Q|, hence, r̄(Q) is the negative Euler characteristic of Q. In particular, r̄(Ws ) = r̄(H ∩ sKs−1 ) and X r̄(H ∩ sKs−1 ) = r̄(W ) = 21 |EW | − |V W |. s∈S(H,K) Let α′X , α′Y denote the projection maps X ×U Y → X, X ×U Y → Y , resp. Restricting α′X , α′Y to W ⊆ X ×U Y , we obtain immersions αX : W → X, αY : W → Y. We also consider the subgroup L = hH, K, S(H, K)i of F . Let Z denote a Stallings graph of hH, K, S(H, K)i and let γ : Z → U denote a canonical immersion. Let βX : X → Z, βY : Y → Z be graph maps that satisfy the equalities ϕX = γβX , ϕY = γβY , see (2.1) and Fig. 1. Clearly, βX and βY are immersions. It follows from the definitions that, for every Q ∈ {U, W, X, Y, Z}, there is a canonical immersion ϕ : Q → U , where ϕ = ϕQ if Q = X or Q = Y , ϕ = idU if Q = U , ϕ = γβX αX = γβY αY if Q = W , and ϕ = γ if Q = Z, see Fig. 1. X αX ϕX βX Z W αY βY ϕY Y Fig. 1 γ U 4 S. V. IVANOV It is not difficult to see that, up to a suitable conjugation of the ambient free group F , we may assume that the graphs X, Y coincide with their cores. Clearly, the same property holds for graphs U, W, Z as well. Without loss of generality, we may also assume that Z = U and γ = idZ . For this reason, we will disregard U and γ in subsequent arguments. 3. Five Lemmas −1 {a1 , a−1 1 , . . . , an , an } Let A = be an alphabet and let F (A) = ha1 , . . . , an i be a free group with free generators a1 , . . . , an . It will be convenient to consider elements −1 of the free group F (A) as words over the alphabet A = {a1 , a−1 1 , . . . , an , an }. A letter-by-letter equality of words u, w over A is denoted u ≡ v. Suppose w ≡ c1 . . . cℓ is a word over A, where c1 , . . . , cℓ ∈ A are letters. The length of w is denoted |w| = ℓ. We say that a word w ≡ c1 . . . cℓ is reduced if |w| > 0 and ci 6= c−1 i+1 for every i = 1, . . . , ℓ − 1. A finite graph B is called a labeled A-graph, or just an A-graph, if B is equipped with a function ϕ : EB → A so that, for every e ∈ EB, we have ϕ(e−1 ) = ϕ(e)−1 . An A-graph B is called irreducible if, for every pair e1 , e2 ∈ EB, the equalities ϕ(e1 ) = ϕ(e2 ) and (e1 )− = (e2 )− imply that e1 = e2 . Note that an irreducible A-graph need not be connected and may contain vertices of degree < 2. It is easy to see that B is an irreducible A-graph with a labeling function ϕ if and only if there is an immersion ϕ0 : B → A0 , where A0 is a bouquet of n oriented circles a1 , . . . , an so that the restriction of ϕ0 on EB is ϕ. We now discuss some operations over irreducible A-graphs. Let B be a finite irreducible A-graph. A connected component C of B is called A-complete if every vertex of C has degree |A| = 2n. Equivalently, the restriction of ϕ0 on C, ϕ0|C : C → A0 , is a covering. If a connected component C of B is not A-complete, we will say that C is A-incomplete. Suppose V1 ⊆ V B is a subset of vertices of B, w is a reduced word over A, w ≡ c1 . . . cℓ , where c1 , . . . , cℓ ∈ A are letters. For every v ∈ V1 , we consider a new graph which is a path p(v) = e1 (v) . . . eℓ (v), consisting of edges e1 (v), . . . , eℓ (v) labeled by the letters c1 , . . . , cℓ , resp., so ϕ(p(v)) ≡ w. For every v ∈ V1 , we attach the path p(v) to B by identifying the vertices p(v)− and v. This way we obtain a labeled A-graph B ′ (V1 , w). We will then apply a folding process to B ′ (V1 , w) that inductively identifies edges e and e′ whenever ϕ(e) = ϕ(e′ ) and e− = e′− . As a result, we obtain an irreducible A-graph B(V1 , w) that contains the original A-graph B, B ⊆ B(V1 , w), and has the following properties: r̄(B(V1 , w)) = r̄(B) and, for every v ∈ V1 , there is a unique path p(v) in B(V1 , w) such that p(v)− = v and ϕ(p(v)) ≡ w. We also observe that B(V1 , w) = B ∪ F (V1 , w), where F (V1 , w) is a forest, i.e., a disjoint collection of trees, and B ∩ F (V1 , w) = V1∗ , where V1∗ ⊆ V B. Lemma 3.1. Suppose that B is a finite irreducible A-graph and no connected component of B is A-complete. Then, for every subset V1 ⊆ V B, there is a reduced word w = w(V1 ) over A and there is an irreducible A-graph B(V1 , w) that has the following properties. The graph B(V1 , w) contains B as a subgraph, B(V1 , w) = B ∪F (V1 , w), where F (V1 , w) is a forest, B ∩F (V1 , w) = V1∗ , V1∗ ⊆ V B, and r̄(B(V1 , w)) = r̄(B). Furthermore, for every vertex v ∈ V1 , there is a unique path p(v) in B(V1 , w) such that p(v)− = v, ϕ(p(v)) ≡ w, p(v)+ has degree one, and p(v)+ 6∈ B. ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 5 Proof. We prove this Lemma by induction on |V1 | ≥ 1. To make the basis step, we let V1 := {v}. By the hypothesis of the Lemma, there is a path q in B such that ϕ(q) is reduced, q− = v and q− = u, where u is a vertex of B with deg(u) < 2n. Then there exists a letter c ∈ A such that there is no edge in B with e− = u and ϕ(e) = c. Taking the word w = ϕ(q)c, we will obtain the desired result. To make the induction step, assume that our claim holds for a set V1 = {v1 , . . . , vk } with |V1 | = k and V2 = {v1 , . . . , vk , vk+1 }, where vk+1 6∈ V1 . By the induction hypothesis, there exits a word w1 = c1 . . . cℓ and an irreducible A-graph B(V1 , w1 ) with the properties stated in Lemma. Let m denote the maximum of distances between vertices in the same connected component of B over all components of B. We replace w1 by the reduced word w2 = w1 cm+2 and construct the graph ℓ B(V1 , w2 ) for this new word w2 . It is clear that B(V1 , w2 ) has all of the properties of B(V1 , w1 ). In addition, for every path p(vi ) in B(V1 , w2 ), there is a factorization p(vi ) = p1 (vi )p2 (vi ) so that ϕ(p2 (vi )) = cm+2 , all the vertices of p2 (vi ), except for ℓ p2 (vi )+ , have degree 2 and deg p2 (vi )+ = 1. Now we take a new graph which is a path p(vk+1 ) with ϕ(p(vk+1 )) = w2 and attach it to B(V1 , w2 ) so that p(vk+1 )− = vk+1 . Then we do foldings to produce an irreducible graph B(V2 , w2 ) in which there is a path that starts at vk+1 and is labeled by w2 . We will denote this path by p(vk+1 ). Note B(V1 , w2 ) is a subgraph of B(V2 , w2 ). Moreover, if B(V1 , w2 ) ⊂ B(V2 , w2 ), then deg p(vk+1 )+ = 1 and 6= p(vk+1 )+ 6∈ B, hence B(V2 , w2 ) has all of the desired properties and the induction step is complete. Otherwise, we may assume that B(V1 , w2 ) = B(V2 , w2 ) and we consider two cases depending on whether or not p(vk+1 )+ ∈ B ⊆ B(V2 , w2 ). First assume that p(vk+1 )+ 6∈ B ⊆ B(V1 , w2 ), that is, the path p(vk+1 ) ends in a vertex of a tree T ⊆ F (V1 , w2 ), where B(V1 , w2 ) = B ∪ F (V1 , w2 ), B ∩ F (V1 , w2 ) = V1∗ , V1∗ ⊆ V B, and F (V1 , w2 ) is a forest. Let qT be a shortest path in T so that (qT )− = p(vk+1 )+ and (qT )+ 6∈ B, deg(qT )+ = 1. We remark that |qT | > 0 because, otherwise, p(vk+1 )+ = p(vi )+ for some i, i ≤ k, whence vk+1 = vi , contrary to vk+1 6∈ Vk . Let b ∈ A be the first letter of ϕ(qT ). Since w2 ends in cℓ , it follows that b 6= (cℓ )−1 . Let b′ ∈ A be different from the letters b, (cℓ )−1 . Then it follows from the definitions that the word w3 ≡ w2 ϕ(qT )b′ ≡ w1 cm+2 ϕ(qT )b′ ℓ is reduced and can be used as a desired word w for the set Vk+1 = Vk ∪ {vk+1 }. Now consider the case when p(vk+1 )+ ∈ B ⊆ B(V1 , w2 ). By the definition of m, the vertex p(vk+1 )+ can be joined in B(V1 , w2 ) with a vertex u of a tree T ′ , T ′ ⊆ F (V1 , w2 ), by a path q so that |q| ≤ m + 1, where u 6∈ B, and u is connected to a vertex in B by an edge of T ′ . Consider a reduced word w4 equal in F (A) to w1 cm+2 ϕ(q) which we write in the form ℓ F (A) w4 = w1 cm+2 ϕ(q). ℓ Note that at most |q| letters of the reduced word w1 cm+2 could cancel with those ℓ of ϕ(q). Since |q| ≤ m+1, the word w4 can still be used for the set V1 in place of w2 . As above, we construct an irreducible A-graph B(V2 , w4 ) with ϕ(p(vi )) = w4 for every i = 1, . . . , k +1. The path p(vk+1 ) with p(vk+1 )− = vk+1 and ϕ(p(vk+1 )) = z4 will have its terminal vertex p(vk+1 )+ on a tree T of F (V1 , w4 ). Now we can argue as 6 S. V. IVANOV in the foregoing case. We pick a shortest path qT in T such that (qT )− = p(vk+1 )+ , (qT )+ 6∈ B, deg(qT )+ = 1, and consider a reduced word w5 such that F (A) w5 = w4 ϕ(qT )c′ = w1 cm+2 ϕ(q)ϕ(qT )c′ , ℓ where c′ ∈ A is now chosen so that c′ is different from the first letter of ϕ(qT ) and from b−1 , where b is the last letter of w4 . As above, we see that |qT | > 0. It is straightforward to verify that the graph B(V2 , w5 ) has all of the required properties and Lemma 3.1 is proven.  We now generalize Lemma 3.1 to the situation with two subsets V1 , V2 ⊆ V B. Lemma 3.2. Suppose that B is a finite irreducible A-graph and no connected component of B is A-complete. Then, for every pair of subsets V1 , V2 ⊆ V B, there are nonempty reduced words w1 = w1 (V1 , V2 ), w2 = w2 (V1 , V2 ) over A and there is an irreducible A-graph B(V1 , w1 ; V2 , w2 ) such that B(V1 , w1 ; V2 , w2 ) contains B, B(V1 , w1 ; V2 , w2 ) = B ∪ F (V1 , w1 ; V2 , w2 ), where F (V1 , w1 ; V2 , w2 ) is a for∗ ∗ est, B ∩ F (V1 , w1 ; V2 , w2 ) = V12 , where V12 ⊆ V B, and r̄(B(V1 , w1 ; V2 , w2 )) = r̄(B). Furthermore, for every vertex vi ∈ Vi , i = 1, 2, there is a unique path p(vi ) in B(V1 , w1 ; V2 , w2 ) such that p(vi )− = vi , ϕ(p(vi )) ≡ wi , p(vi )+ has degree one, p(vi )+ 6∈ B, and the sets {p(v1 )+ | v1 ∈ V1 }, {p(v2 )+ | v2 ∈ V2 } are disjoint. Proof. First we apply Lemma 3.1 to the set V1 to obtain a word w1′ ∈ F (A) and a graph B(V1 , w1′ ) with properties of Lemma 3.1. We also apply Lemma 3.1 to the set V2 to obtain a word w2′ ∈ F (A) and a graph B(V2 , w2′ ) with properties of Lemma 3.1. Since |A| ≥ 4, it follows that there are letters b1 , b2 ∈ A so that the words w1′ b1 , w2′ b2 are reduced and b1 6∈ {b2 , (b2 )−1 }. Let k2 = |w1′ |+|w2′ |. Define the words w1 = w1′ bk12 , w2 = w2′ bk22 . Now we attach paths pi (vi ) with ϕ(pi (vi )) = wi , over all vi ∈ Vi , i = 1, 2, to the graph B by identifying the vertices pi (vi )− and vi ∈ Vi ⊆ B. Making foldings, we obtain an irreducible A-graph B(V1 , w1 ; V2 , w2 ). It is easy to see that the graph B(V1 , w1 ; V2 , w2 ) has all of the properties stated in Lemma 3.2.  As above, let B be a finite irreducible A-graph and f ∈ A. Let Ef B := {e | e ∈ EB, ϕ(e) = f } denote the set of all edges e ∈ EB such that ϕ(e) = f and, analogously, denote Ef −1 B := {e | e ∈ EB, ϕ(e) = f −1 }. Let Bf denote the graph B \ (Ef B ∨ Ef −1 B), Bf := B \ (Ef B ∨ Ef −1 B), and, similarly, denote Af := A \ {f, f −1 }. The restriction of the immersion ϕ0 : B → A0 to Bf denote ϕ0,f : Bf → A0,f , where V A0,f = {0f } and EA0,f = Af . Denote (Ef B)− := {e− | e ∈ Ef B}, (Ef B)+ := {e+ | e ∈ Ef B}. A connected component of the graph Bf is called Af -complete if the degree of its every vertex is equal to |Af | = 2n − 2. Otherwise, a connected component of the graph Bf is called Af -incomplete. ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 7 Let Bfcom denote the set of all Af -complete connected components of Bf and Bfinc denote the set of all Af -incomplete connected components of Bf . We also denote V1inc (f− ) := Bfinc ∩ (Ef B)− , V2inc (f+ ) := Bfinc ∩ (Ef B)+ . Let us apply Lemma 3.2 to the irreducible Af -graph Bfinc and its sets of vertices V1inc (f− ) and V2inc (f+ ). As a result, we obtain two reduced words w1 , w2 over Af and an irreducible Af -graph Bfinc (V1inc (f− ), w1 ; V2inc (f+ ), w2 ) with the properties of Lemma 3.2. Now we construct more labeled A-graphs in the following fashion. For every edge e ∈ Ef B, we consider a new graph which is a path p1 (e)ep2 (e)−1 so that ϕ(p1 (e)) ≡ w1 , ϕ(e) = f , ϕ(p2 (e)) ≡ w2 . We replace every e ∈ Ef B in B by such a path p1 (e)ep2 (e)−1 and then do edge foldings to get an irreducible A-graph which we denote B[f ]. We will call this graph B[f ], obtained by the described application of Lemma 3.2, an f -treatment of B. It is clear that the graph B[f ] can be thought of as the image of B under the automorphism of the free group F (A) that takes f to w1 f w2−1 and takes a to a if a ∈ Af . We also observe that the connected components of Bf and those of B[f ]f are in the natural bijective correspondence. Moreover, it follows from the definitions and Lemma 3.2 that a connected component of Bf is Af -complete if and only if its image in B[f ]f is Af -complete and, if they are both Af -complete, then they are identical. Suppose c ∈ A, c 6∈ {f, f −1 }. Using the notation analogous to what we introduced above for f , we consider the graph B[f ]c := B[f ] \ (Ec B[f ] ∨ Ec−1 B[f ]). As above, we consider a partition com B[f ]c = B[f ]inc c ∨ B[f ]c , where B[f ]inc c is the union of Ac -incomplete connected components of B[f ]c and is the union of Ac -complete connected components of B[f ]c . B[f ]com c Lemma 3.3. Suppose B is a finite irreducible A-graph, |A| ≥ 6, no connected component of B is a complete A-graph, f ∈ A, and B[f ] is an f -treatment of B. com Then, for every c ∈ A \ {f, f −1 }, considering the sets V (B[f ]com c ), V (B[f ]f ) as subsets of V B[f ], one has that com V (B[f ]com c )⊆V (B[f ]f ) com com com and either V (B[f ]com c ) = V (B[f ]f ) = ∅ or V (B[f ]c ) 6= V (B[f ]f ). Moreover, com |V (B[f ]com f )| = |V (Bf )|. Proof. As was observed above, connected components of Bf and those of B[f ]f are in the natural bijective correspondence, moreover, a connected component C of Bf is Af -complete if and only if its image in B[f ]f is Af -complete and, if, they are both Af -complete, then they are identical. Hence, the Af -graphs Bfcom and B[f ]com f com are isomorphic and |V (B[f ]com f )| = |V (Bf )|. Now suppose v ∈ V (B[f ]com c ). Considering v as a vertex of B[f ], we see that there are edges e1 , e2 in B[f ] starting at v such that ϕ(e1 ) = ϕ(e−1 2 ) = f . However, it follows from Lemma 3.2 that no vertex u of B[f ] has distinct edges e1 , e2 starting 8 S. V. IVANOV com at v such that ϕ(e1 ) = ϕ(e−1 2 ) = f . This shows that v ∈ V (B[f ]f ), whence, com com V (B[f ]c )⊆V (B[f ]f ), as desired. com Finally, assume that V (B[f ]com c ) = V (B[f ]f ) 6= ∅. Then for every vertex com v ∈ V (B[f ]com and c )⊆V (B[f ]) we have deg v = 2n − 2 in both graphs B[f ]f com com B[f ]c . Hence, deg v = 2n in B[f ] and so B[f ] contains all of the vertices of B[f ]com 6= ∅. This, however, means that B[f ] and, hence, B contains an Ac complete connected component. This contradiction to the assumption that B com com com is empty proves that V (B[f ]com c ) ⊂ V (B[f ]f ) whenever V (B[f ]f ) is not empty, 6= as desired.  Lemma 3.4. Suppose B is a finite irreducible A-graph, |A| ≥ 6, and no connected component of B is a complete A-graph. Then there exists a finite sequence of f1 -, . . . , fℓ+1 -treatments of the graph B so that the resulting graph, denoted B[f1 , . . . , fℓ+1 ], has the following property. For f ∈ A, denote B[f1 , . . . , fℓ+1 ]f := B[f1 , . . . , fℓ+1 ] \ (Ef (B[f1 , . . . , fℓ+1 ]) ∨ Ef −1 (B[f1 , . . . , fℓ+1 ])). For each f ∈ A, every connected component of B[f1 , . . . , fℓ+1 ]f is Af -incomplete. In addition, for every edge e ∈ E(B[f1 , . . . , fℓ+1 ]) such that ϕ(e) = fℓ+1 , one has deg e− = deg e+ = 2 and, if h1 (e)eh2 (e) is a reduced path in B[f1 , . . . , fℓ+1 ], where h1 (e), h2 (e) are edges, then the labels ϕ(h1 (e)), ϕ(h2 (e)) are independent of e. Proof. Pick an arbitrary letter f1 ∈ A and do an f1 -treatment of the graph B. Assuming that B[f1 ]com f1 6= ∅, we can see from Lemma 3.3 that the result is a new irreducible A-graph B[f1 ] such that, for every c ∈ A, where c 6∈ {f1 , f1−1 }, we have com |V (B[f1 ]com f1 )| = |V (Bf1 )|. com V (B[f1 ]com c ) ⊂ V (B[f1 ]f1 ), 6= Picking an edge f2 such that f2 ∈ A, f2 6∈ {f1 , f1−1 }, we will do a second f2 -treatment of the graph B[f1 ] and get a new irreducible A-graph B[f1 , f2 ] := B[f1 ][f2 ]. Assuming that B[f1 , f2 ]com f2 6= ∅, we obtain from Lemma 3.3 that, for every c ∈ A −1 such that c 6∈ {f2 , f2 }, we have com V (B[f1 , f2 ]com c ) ⊂ V (B[f1 , f2 ]f2 ), 6= com com com |V (B[f1 , f2 ]com f2 )| = |V (B[f1 ]f2 )| < |V (B[f1 ]f1 )| = |V (Bf1 )|. Then we pick an edge f3 , where f3 ∈ A, f3 6∈ {f2 , f2−1 }, and do a third f3 treatment of the graph B[f1 , f2 ] to construct an irreducible A-graph B[f1 , f2 , f3 ] = B[f1 , f2 ][f3 ] with further decreased |V (B[f1 , f2 , f3 ]com f3 )| and so on. Assuming for each j = 1, . . . , i that B[f1 , . . . , fj ]com 6= ∅, we obtain from Lemma 3.3 that, for fj every c ∈ A such that c 6∈ {fj , fj−1 }, it is true that com V (B[f1 , . . . , fj ]com c ) ⊂ V (B[f1 , . . . , fj ]fj ), 6= com |V (B[f1 , . . . , fj ]fj )| < |V (B[f1 , . . . , fj−1 ]com fj−1 )|, com |V (B[f1 , . . . , fj ]fj )| = |V (B[f1 , . . . , fj−1 ]com fj )|. Hence, it follows from these equalities and inequalities that com |V (B[f1 , . . . , fi+1 ]com fi+1 )| < . . . < |V (B[f1 , . . . , fj ]fj )| < . . . com < |V (B[f1 , f2 ]com f2 )| < |V (B[f1 ]f1 )|. ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 9 Therefore, the graph B[f1 , . . . , fi+1 ]com fi+1 will eventually become empty and then B[f1 , . . . , fi+1 ]com will be empty for every c ∈ A. Thus we may suppose that c B[f1 , . . . , fℓ ]com is empty for some ℓ ≥ 1. fℓ We will do one more fℓ+1 -treatment of the graph B[f1 , . . . , fℓ ]. Pick an edge fℓ+1 such that fℓ+1 ∈ A, fℓ+1 6∈ {fℓ , fℓ−1 }, do an fℓ+1 -treatment of the graph B[f1 , . . . , fℓ ] and obtain an irreducible A-graph B[f1 , . . . , fℓ+1 ] := B[f1 , . . . , fℓ ][fℓ+1 ]. It follows from Lemma 3.3 that, for every c ∈ A, the set B[f1 , . . . , fℓ+1 ]com is still c empty, in particular, B[f1 , . . . , fℓ+1 ]com = ∅. In addition, by the definitions and f Lemma 3.2, we will also have the claimed property of edges e ∈ EB[f1 , . . . , fℓ+1 ] such that ϕ(e) = fℓ+1 .  Lemma 3.5. Suppose |A| ≥ 4, d1 , d2 ∈ A and w is a nonempty reduced word over A. Then there are letters b1 , b2 ∈ A such that the word d1 (b1 wb2 )2 d2 is reduced. Furthermore, let c ∈ A, c 6∈ {b2 , b−1 2 }, and nw := |w| + 1. Then the word z4 (w) := b1 wb2 cnw +1 b2 b1 wb2 cnw +2 b2 b1 wb2 cnw +3 b2 b1 wb2 cnw +4 b2 (3.1) has the following properties. If (b2 cnw +i b2 )k , where k = ±1, i = 1, 2, 3, 4, is a subword of z4 (w), then k = 1 and the location of the subword b2 cnw +i b2 is standard, i.e., it is the suffix of length nw + i + 2 of the ith syllabus b1 wb2 cnw +i b2 of z4 (w). Moreover, the word d1 z4 (w)d2 is reduced. Proof. Since |A| ≥ 4, there are at least two letters x ∈ A such that the word d1 xw is reduced. Also, there are at least two letters y ∈ A such that the word wyd2 is reduced. If d1 (xwy)2 d2 is not reduced then x = y −1 . For every x with d1 xw being reduced, there is at most one y with wyd2 being reduced such that d1 (xwy)2 d2 is not reduced. Hence there exist x and y in A such that d1 (xwy)2 d2 is reduced. Denote b1 := x and b2 := y. Since c 6∈ {b2 , b−1 2 } and the maximal power of c that can occur in b1 wb2 is c|w|+1 = cnw , it follows from the definition (3.1) of the word z4 (w) that b2 cnw +i b1 can only occur in z4 (w)±1 as the suffix of length nw + i + 2 of the ith syllabus b1 wb2 cnw +i b2 of z4 (w). It remains to note that the word d1 z4 (w)d2 is reduced because the word d1 (xwy)2 d2 is reduced.  4. Proof of Theorem 1.1 As in Sect. 2, consider the graphs W , X, Y , Z. Lemma 4.1. Suppose either graph Q, where Q ∈ {X, Y }, contains a path pQ so that every vertex of pQ has degree 2 in Q, βQ (pQ ) ≡ z4 (w), where w is a nonempty reduced word over the alphabet A = EZ and z4 (w) is the word defined by (3.1). Let z4 (w) = z41 z42 be a factorization of z4 (w) so that z41 ≡ b1 wb2 cnw +1 b2 b1 wb2 cnw +2 b2 , z42 ≡ b1 wb2 cnw +3 b2 b1 wb2 cnw +4 b2 and let v2 (pQ ) be a vertex of the path pQ that defines a corresponding factorization pQ = pQ1 pQ2 so that ϕ(pQ1 ) ≡ z41 , ϕ(pQ2 ) ≡ z42 . Furthermore, assume that there exists a vertex u ∈ V W , where W = core(X ×Z Y ), such that either αX (u) = v2 (pX ) and αY (u) ∈ pY or αX (u) ∈ pX and αY (u) = v2 (pY ). Then αX (u) = v2 (pX ), αY (u) = v2 (pY ), and there is a path p in W such that αX (p) = pX and αY (p) = pY . 10 S. V. IVANOV Proof. For definiteness, suppose u ∈ V W is such that αX (u) = v2 (pX ) and αY (u) ∈ pY . Let pY = pY 1 pY 2 be the factorization of pY defined by the vertex αY (u). Pick a path pY i∗ , i∗ = 1, 2, such that |pY i∗ | ≥ 21 |pY |. Since the factorization of pX defined by the vertex αX (u) = v2 (pX ) defines the factorization z4 (w) = z41 z42 of the word z4 (w) = βX (pX ), it follows that if i∗ = 2 then the word βY (pY 2 ) contains a subword −nw −2 −1 b2 cnw +3 b2 or contains a subword b−1 b2 . The second subcase, however, is 2 c impossible by Lemma 3.5. Similarly, if i∗ = 1 then the word γβY (pY 1 ) contains −nw −3 −1 a subword b2 cnw +2 b2 or contains a subword b−1 b2 . The second subcase is 2 c ∗ impossible by Lemma 3.5. In either case i = 1, 2, we can apply Lemma 3.5 to the subword b2 cnw +3 b2 or the subword b2 cnw +2 b2 of βY (pY ) and obtain the desired conclusion.  We now define a special type of transformations over the graphs W, X, Y , Z, called (f, p)-transformations. Suppose that f is an edge of the graph Z and p = e1 . . . eℓ is a path in Z such that p− = (e1 )− = f− , p+ = (eℓ )+ = f+ , and there are no occurrences of f , f −1 among edges e1 , . . . , eℓ . Let Q ∈ {W, X, Y, Z} and ϕ : Q → Z = U be a canonical immersion. Consider a set Hf of all edges h in EW ∨ EX ∨ EY ∨ EZ that are sent by ϕ to f . We replace every edge h ∈ Hf with a path p(h) = e1 (h) . . . eℓ (h) such that ϕ(ei (h)) := ϕ(ei ) for every i = 1, . . . , ℓ, and we extend every map ν ∈ {αX , . . . , βY } to paths p(h) so that if ν : Q → Q′ , where Q, Q′ ∈ {W, X, Y, Z}, and ν(h) = h′ , then we extend ν to paths p(h), p(h′ ) by setting ν(e1 (h)) := e1 (h′ ), . . . , ν(eℓ (h)) := eℓ (h′ ). Thus obtained graphs we denote by Qf p , where Q ∈ {W, X, Y, Z}, and thus obtained maps we denote by αXf p , . . . , βYf p . We now perform folding process over every modified graph Qf p , Q ∈ {W, X, Y, Z}. Recall that this is an inductive procedure which identifies every pair of oriented edges g1 , g2 ∈ EQf p whenever (g1 )− = (g2 )− and g1 , g2 have the same labels ϕ(g1 ), ϕ(g2 ). Note that folding process decreases by one the reduced rank r(Z) because the new path p(f ) = e1 (f ) . . . eℓ (f ) that replaces the edge f in Z will be attached to the path p = e1 . . . eℓ in Z \{f, f −1 } thus producing a graph Z̄f p with r(Z̄f p ) = r(Z)−1. Clearly, Z̄f p is a bouquet of r(Z) − 1 circles and core(Z̄f p ) = Z̄f p . Furthermore, when a folding process applied to Qf p , Q ∈ {W, X, Y, Z}, is complete and produces a graph Q̄f p , we will take the core of Q̄f p thus obtaining a graph Qp = core(Q̄f p ). It follows from the definitions that we will have maps αXp , . . . , βYp with properties of original maps αX , . . . , βY . This alteration of the graphs W, X, Y, Z by means of an edge f ∈ EZ and a path p in Z will be called an (f, p)-transformation over the graphs W, X, Y , Z. We will say that an (f, p)-transformation is conservative if it preserves the numbers r̄(X), r̄(Y ), r̄(Ws ) for every connected component Ws of W , s ∈ S(H, K), and the core core(Xp ×Zp Yp ) of the pullback Xp ×Zp Yp coincides with the graph Wp . Thus a conservative (f, p)-transformation decreases r̄(Z) by one while keeping the numbers r̄(X), r̄(Y ), r̄(W ) unchanged. Here is our principal technical result that will be used to prove Theorem 1.1. Lemma 4.2. Suppose r̄(Z) ≥ 2, U = Z, γ = idZ , and neither of the maps βX : X → Z, βY : Y → Z is a covering. Then there is an automorphism τ of the ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 11 free W group F (EZ) = π1 (Z) such that Stallings graphs of subgroups τ (H), τ (K), τ ( s∈S(H,K) (H ∩ sKs−1 )), denoted X τ , Y τ , W τ , resp., have no vertices of degree 1 and there exists a conservative (f, p)-transformation over the graphs W τ , X τ , Y τ , Z τ = Z. Proof. Assume that neither of the maps βX : X → Z, βY : Y → Z is a covering. Consider the disjoint union X ∨ Y of X, Y as a graph B and the set EZ as the alphabet A. Let ϕ : EB → A be defined on EX as the restriction of βX and on EY as the restriction of βY . We also consider W as an A-graph by using the map ϕ : EW → A, where ϕ is the restriction of βX αX = βY αY . Since neither of X, Y is A-complete, we can apply Lemma 3.4 and find a sequence of f1 -, . . . , fℓ+1 -treatments for B which transform the graph B = X ∨ Y into B[f1 , . . . , fℓ+1 ] with the properties of Lemma 3.4. Note that an f-treatment of B = X ∨ Y can equivalently be described as an application of a suitable automorphism τf of the free group F (A) = π1 (Z). We specify that this automorphism τf is the composition of an automorphism θf , given by θf (f ) = w1 f w2−1 , θf (a) = a for every a ∈ Af , where w1 , w2 are some words over Af , and an inner automorphism of F (A) applied, if necessary, to move the base vertices of graphs θf (X), θf (Y ), representing subgroups θf (H), θf (K), resp., so that the base vertices, after the move, would be in core(θf (H)), core(θf (K)) and the correspondence between graphs and subgroups would be preserved. Therefore, the composition of these f1 -, . . . , fℓ+1 -treatments can be inducedWby a suitable automorphism of the free group F (A) applied to subgroups H, K, s∈S(H,K) (H ∩ sKs−1 ) and to corresponding Stallings graphs X, Y, W . By Lemmas 3.4, 3.2, we may assume that, for every c ∈ A, the graph B[f1 , . . . , fℓ+1 ]c has no Ac -complete component and that every edge e ∈ EB[f1 , . . . , fℓ+1 ] such that ϕ(e) = fℓ+1 is contained in a reduced path h1 (e)eh2 (e), where h1 (e), h2 (e) are edges, so that deg e− = deg e+ = 2 and the letters ϕ(h1 (e)), ϕ(h2 (e)) are independent of e. Denote ϕ(h1 (e)) = d1 , ϕ(h2 (e)) = d2 , (4.1) −1 where d1 , d2 ∈ Afℓ+1 = EZ \ {fℓ+1 , fℓ+1 }. Since B = X ∨ Y , we can represent the graph B[f1 , . . . , fℓ+1 ] in the form B[f1 , . . . , fℓ+1 ] = X[f1 , . . . , fℓ+1 ] ∨ Y [f1 , . . . , fℓ+1 ], where X[f1 , . . . , fℓ+1 ] = X τ is obtained from X by these f1 -, . . . , fℓ+1 -treatments and Y [f1 , . . . , fℓ+1 ] = Y τ is obtained from Y by the f1 -, . . . , fℓ+1 -treatments. Similarly, let W [f1 , . . . , fℓ+1 ] = W τ denote the graph obtained from W by the f1 -, . . . , fℓ+1 -treatments. Consider the irreducible Afℓ+1 -graph B[f1 , . . . , fℓ+1 ]fℓ+1 = X[f1 , . . . , fℓ+1 ]fℓ+1 ∨ Y [f1 , . . . , fℓ+1 ]fℓ+1 and apply Lemma 3.1 to this graph and to the vertex set V1 = V B[f1 , . . . , fℓ+1 ]fℓ+1 . According to Lemma 3.1, there exists a reduced nonempty word w over the alphabet −1 Afℓ+1 = EZ \ {fℓ+1 , fℓ+1 } with the properties of Lemma 3.1. In particular, for every vertex v ∈ V B[f1 , . . . , fℓ+1 ]fℓ+1 , the Afℓ+1 -graph B[f1 , . . . , fℓ+1 ]fℓ+1 contains no path p such that p− = v and ϕ(p) ≡ w. Since A = EZ and |A| ≥ 6, we have |Afℓ+1 | ≥ 4. Hence, Lemma 3.5 applies to the word w, to the alphabet Afℓ+1 and to the letters d1 , d2 ∈ Afℓ+1 defined 12 S. V. IVANOV by equalities (4.1). By Lemma 3.5, there are letters b1 , b2 ∈ Afℓ+1 such that the word d1 (b1 wb2 )2 d2 is reduced. Furthermore, let c ∈ Afℓ+1 , c 6∈ {b2 , b−1 2 }, and nw = |w| + 1. Then the word z4 (w) over Afℓ+1 , given by formula (3.1), has the properties stated in Lemma 3.5. Now we perform an (fℓ+1 , z4 (w))-transformation over the graphs W [f1 , . . . , fℓ+1 ] = W τ , X[f1 , . . . , fℓ+1 ] = X τ , Y [f1 , . . . , fℓ+1 ] = Y τ , Z. Making this transformation turns every edge e such that ϕ(e) = fℓ+1 into a path p = p(e) such that p− = e− , p+ = e+ , and ϕ(p) ≡ z4 (w). Let B(fℓ+1 , z4 ), X(fℓ+1 , z4 ), Y (fℓ+1 , z4 ), W (fℓ+1 , z4 ) denote the resulting Afℓ+1 -graphs. Observe that if µ : F (A) → F (Afℓ+1 ) is the epimorphism defined by µ(b) = b for every b ∈ Afℓ+1 and µ(fℓ+1 ) = z4 (w) then we have W (fℓ+1 , z4 ) = µ(W [f1 , . . . , fℓ+1 ]) = µ(W τ ), X(fℓ+1 , z4 ) = µ(X[f1 , . . . , fℓ+1 ]) = µ(X τ ), Y (fℓ+1 , z4 ) = µ(Y [f1 , . . . , fℓ+1 ]) = µ(Y τ ). A path p = p(e) in graphs X(fℓ+1 , z4 ), Y (fℓ+1 , z4 ), W (fℓ+1 , z4 ) such that ϕ(p) ≡ z4 (w) and p results from an edge e with ϕ(e) = fℓ+1 will be called a standard z4 path. Let p be a standard z4 -path and p = p1 p2 p3 p4 be a factorization of p so that ϕ(pi ) ≡ b1 wb2 cn+i b2 , where i = 1, 2, 3, 4. Denote v2 (p) := (p2 )+ . Recall that Z has a single vertex and an (fℓ+1 , z4 (w))-transformation converts −1 Z into Zfℓ+1 = Z \ {fℓ+1 , fℓ+1 } such that EZfℓ+1 = Afℓ+1 . Let ϕfℓ+1 : B(fℓ+1 , z4 ) = X(fℓ+1 , z4 ) ∨ Y (fℓ+1 , z4 ) → Zfℓ+1 denote the corresponding immersion. Consider the pullback X(fℓ+1 , z4 ) ×Zfℓ+1 Y (fℓ+1 , z4 ) f := core(X(fℓ+1 , z4 ) ×Z and its core W Y (fℓ+1 , z4 )). fℓ+1 f Let us prove the equality W = W (fℓ+1 , z4 ). Let f → X(fℓ+1 , z4 ), α f → Y (fℓ+1 , z4 ) α eX : W eY : W f is a vertex such that α denote the projection maps. Suppose u ∈ V W eX (u) = v2 (pX ), where pX is a standard z4 -path of X(fℓ+1 , z4 ). First we assume that α eY (u) ∈ Y [f1 , . . . , fℓ+1 ]fℓ+1 , (4.2) here the graph Y [f1 , . . . , fℓ+1 ]fℓ+1 is regarded as a subgraph of Y (fℓ+1 , z4 ). Note that the conclusion of Lemma 3.1 holds for the graph B[f1 , . . . , fℓ+1 ]fℓ+1 , for the set V1 = V B[f1 , . . . , fℓ+1 ]fℓ+1 and for the reduced word w1 ≡ b1 w in place of w. Hence, the graph Y [f1 , . . . , fℓ+1 ]fℓ+1 contains no path r such that r starts at α eY (u) and r has the label ϕfℓ+1 (r) ≡ b1 w. Since there is a path p′ in X(fℓ+1 , z4 ) such that p′ starts at α eX (u) = v2 (pX ), ϕfℓ+1 (p′ ) ≡ b1 wb2 cn+3 b2 , and all vertices of ′ p have degree 2, it follows that there is a path q in Y (fℓ+1 , z4 ) such that q starts at α eY (u) and ϕfℓ+1 (q) ≡ ϕfℓ+1 (p′ ) ≡ b1 wb2 cnw +3 b2 . Let q = q1 q2 be the factorization of q defined so that ϕfℓ+1 (q1 ) ≡ b1 w, ϕfℓ+1 (q2 ) ≡ b2 cnw +3 b2 . ON RANK OF THE JOIN OF TWO SUBGROUPS IN A FREE GROUP 13 By the above observation based on Lemma 3.1, the path q1 may not be entirely contained in Y [f1 , . . . , fℓ+1 ]fℓ+1 ⊆ Y (fℓ+1 , z4 ). On the other hand, if (q1 )+ ∈ Y [f1 , . . . , fℓ+1 ]fℓ+1 ⊆ Y (fℓ+1 , z4 ), then, in view of (4.2), the path q1 would have to contain a standard z4 -path of Y (fℓ+1 , z4 ) which is impossible for |q1 | < |z4 (w)|. Therefore, (q1 )+ 6∈ Y [f1 , . . . , fℓ+1 ]fℓ+1 ⊆ Y (fℓ+1 , z4 ) and the vertex (q1 )+ must belong to a standard z4 -path pY of Y (fℓ+1 , z4 ). Since |q1 | = |w| + 1, |q2 | = |w| + 6, and |pY | = |z4 (w)| = 8|w| + 26, it follows from (4.2) and from (q1 )+ ∈ pY that q2 is a subpath of pY±1 and there is a factorization pY = pY 1 pY 2 defined by the vertex (q2 )+ ∈ pY , where a shortest path out of pY 1 , pY 2 contains q2±1 and min(|pY 1 |, |pY 2 |) ≤ |q| = 2|w| + 7. (4.3) On the other hand, if pY = pY 3 pY 4 = pY 5 pY 6 are factorizations of pY so that the words ϕfℓ+1 (pY 3 ), ϕfℓ+1 (pY 6 ) contain the standard occurrence of the word b2 cnw +3 b2 in z4 (w), then |pY 3 | ≥ 6|w|+18 and |pY 6 | ≥ 3|w|+14. These inequalities, in view of (4.3), mean that the occurrence of (b2 cnw +3 b2 )±1 = ϕfℓ+1 (q2 )±1 in z4 (w) ≡ ϕfℓ+1 (pY ) is not standard. This contradiction to Lemma 3.5 proves that the inclusion (4.2) is impossible. f , if α Thus it is shown that, for every vertex u ∈ V W eX (u) = v2 (pX ) for some standard z4 -path pX of X(fℓ+1 , z4 ), then α eY (u) ∈ pY , where pY is a standard z4 path in Y (fℓ+1 , z4 ). Switching the graphs X(fℓ+1 , z4 ) and Y (fℓ+1 , z4 ) in the above f , if α arguments, we can analogously show that, for every vertex u ∈ W eY (u) = v2 (pY ) for some standard z4 -path pY of Y (fℓ+1 , z4 ), then α eX (u) ∈ pX , where pX is a standard z4 -path in X(fℓ+1 , z4 ). f , if α Now we can use Lemma 4.1 to conclude that, for every vertex u ∈ W eX (u) = v2 (pX ), where pX is a standard z4 -path of X(fℓ+1 , z4 ), or if α eY (u) = v2 (pY ), where pY is a standard z4 -path of Y (fℓ+1 , z4 ), then, in either case, α eX (u) = v2 (pX ) and α eY (u) = v2 (qY ), where both pX , pY are standard z4 -paths. In addition, there exists f such that α a path pW in W eX (pW ) = pX and α eY (pW ) = pY . Consequently, if p is f a path in W such that one of α eX (p), α eY (p) is a standard z4 -path, then both α eX (p), f = W (fℓ+1 , z4 ) α eY (p) must be standard z4 -paths. Now the desired equality W becomes apparent. Since r̄(X) = r̄(X(fℓ+1 , z4 )) = r̄(µ(X τ )) and r̄(Y ) = r̄(Y (fℓ+1 , z4 )) = r̄(µ(Y τ )), this (fℓ+1 , z4 (w))-transformation over the graphs W τ , X τ , Y τ , Z is conservative, as required. It remains to note that Afℓ+1 -graphs X(fℓ+1 , z4 ) = µ(X τ ), Y (fℓ+1 , z4 ) = µ(Y τ ) are Afℓ+1 -incomplete and Lemma 4.2 is proven.  Proof of Theorem 1.1. Since neither of subgroups H, K has finite index in L = hH, K, S(H, K)i, we conclude that r(L) ≥ 2. There is nothing to prove if r(L) = 2. Hence, we may assume that r(L) = n > 2. It follows from Lemma 4.2 and the definitions that there is an epimorphism η1 : L → Fn−1 , where Fn−1 is a free group of rank n − 1, with the following properties. The restriction of η1 on H and on K is injective, a set S(η1 (H), η1 (K)) for subgroups η1 (H), η1 (K) of Fn−1 can be taken 14 S. V. IVANOV to be η1 (S(H, K)), for every s ∈ S(H, K), the restriction η1,s : H ∩ sKs−1 → η(H) ∩ η(s)η(K)η(s)−1 of η1 on H∩sKs−1 to η(H)∩η(s)η(K)η(s)−1 is surjective, and neither of η1 (H), η1 (K) has finite index in the group Fn−1 = η1 (L) = hη1 (H), η1 (K), η1 (S(H, K))i. Iterating this argument, we obtain a desired epimorphism η : L → F2 .  Proof of Corollary 1.2. If one of subgroups H, K has infinite index in their join hH, Ki then one of H, K has also infinite index in the generalized join L = hH, K, S(H, K)i and Theorem 1.1 applies. By Theorem 1.1, there is an epimorphism η : L → F2 that has the required properties of ζ.  References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] D. F. Cummins and S. V. Ivanov, Embedding of groups and quadratic equations over groups, preprint, arXiv:1607.06784 [math.GR]. W. Dicks, Equivalence of the strengthened Hanna Neumann conjecture and the amalgamated graph conjecture, Invent. Math. 117(1994), 373–389. V. S. Guba, Finitely generated complete groups, Izv. Akad. Nauk SSSR Ser. Mat. 50(1986), 883–924. G. Higman, B. H. Neumann, and H. Neumann, Embedding theorems for groups, J. London Math. Soc. 24(1949), 247–254. S. V. Ivanov, On joins and intersections of subgroups in free groups, preprint, arXiv:1607.04890 [math.GR]. I. Kapovich and A. G. Myasnikov, Stallings foldings and subgroups of free groups, J. Algebra 248(2002), 608–668. R. C. Lyndon and P. E. Schupp, Combinatorial group theory, Springer-Verlag, 1977. H. Neumann, On the intersection of finitely generated free groups, Publ. Math. 4(1956), 186–189; Addendum, Publ. Math. 5(1957), 128. W. D. Neumann, On the intersection of finitely generated subgroups of free groups, Lecture Notes in Math. (Groups-Canberra 1989) 1456(1990), 161–170. J. R. Stallings, Topology of finite graphs, Invent. Math. 71(1983), 551–565. A. Yu. Ol’shanskii, Geometry of defining relations in groups, Nauka, Moscow, 1989; English translation: Math. and Its Applications, Soviet series, vol. 70, Kluwer Acad. Publ., 1991. Department of Mathematics, University of Illinois, Urbana, IL 61801, U.S.A. E-mail address: [email protected]
4math.GR
1 New Results on the Fluctuating Two-Ray Model with Arbitrary Fading Parameters and arXiv:1710.09234v1 [cs.IT] 25 Oct 2017 Its Applications Jiayi Zhang, Member, IEEE, Wen Zeng, Xu Li, Qiang Sun, and Kostas P. Peppas, Senior Member, IEEE Abstract The fluctuating two-ray (FTR) fading model provides a much better fit than other fading models for small-scale fading measurements in millimeter wave communications. In this paper, using a mixture of gamma distributions, new exact analytical expressions for the probability density and cumulative distribution functions of the FTR distribution with arbitrary fading parameters are presented. Moreover, the performance of digital communication systems over the FTR fading channel is evaluated in terms of the channel capacity and the bit error rate. The interaction between channel fading parameters and system performance is further investigated. Our newly derived results extend and complement previous knowledge of the FTR fading model. Index Terms Fluctuating two-ray fading model, channel capacity, bit error rate. Copyright (c) 2015 IEEE. Personal use of this material is permitted. However, permission to use this material for any other purposes must be obtained from the IEEE by sending a request to [email protected]. This work was supported in part by the National Natural Science Foundation of China (Grant No. 61601020), the Fundamental Research Funds for the Central Universities (Grant Nos. 2016RC013, 2017JBM319, and 2016JBZ003), and the Open Research Fund of National Mobile Communications Research Laboratory, Southeast University (No. 2015D02). J. Zhang, W. Zeng, and X. Li are with the School of Electronic and Information Engineering, Beijing Jiaotong University, Beijing 100044, P. R. China (e-mail: [email protected]). Q. Sun is with School of Electronic and information, Nantong University, Nantong 226019, P. R. China. He is also with National Mobile Communications Research Laboratory, Southeast University, Nanjing 210096. K. P. Peppas is the Department of Informatics and Telecommunications, University of Peloponnese, 22100 Tripoli, Greece (e-mail: [email protected]). October 26, 2017 DRAFT 2 I. I NTRODUCTION One of the major challenges for future generation wireless networks is the efficient utilization of available spectrum resources. The millimeter wave (mmWave) and device-to-device (D2D), are regarded as promising technologies to this end [1], [2]. Further research effort has focused on the characterization of the mmWave and D2D channel, e.g. see [3]–[6]. Recently, the socalled fluctuating two-ray (FTR) fading model, has been proposed as a versatile model that well characterizes wireless propagation in mmWave and D2D environments [7]. In contrast to the twowave with diffuse power (TWDP) fading model [8], the specular components of the FTR model are varying amplitudes rather than constant amplitudes, which bring a better description of amplitude fluctuations. FTR fading model fits well experimental channel characterization/modeling data, such as those obtained by outdoor millimeter-wave field measurements at 28 GHz [9], and includes several well known distributions, i.e. the Gaussian, Rayleigh, Rician and Nakagami-m ones, as special or limiting cases [7]. The probability density function (PDF) and cumulative distribution function (CDF) of the FTR fading model, assuming integer values of its shadowing parameter, m, have been derived in [7] by employing inverse Laplace transforms. In the same work, approximate expressions for the PDF and CDF have also been presented in terms of a mixture of gamma distributions, under the assumption of integer m. In realistic propagation scenarios, however, m is an arbitrary positive real number. Motivated by the above facts, this paper extends the work of [7] and derives a generic analytical framework for the statistical characterization of the FTR fading model, assuming arbitrary positive values of m, and in terms of elementary functions and coefficients consisting of fading parameters. Also, our derived results facilitate the performance analysis of wireless communication systems operating in the FTR fading channel. Based on the above formula, novel analytical expressions for the channel capacity of FTR fading channels and the bit error rate (BER) of various binary modulation formats are deduced. Asymptotic BER results that become tight at high-SNR values are further presented, that offer valuable insights as to the impact of fading parameters on the system performance. The results presented herein enable the evaluation of critical performance metrics at low computational complexity, and thus, they are useful to the system engineer for performance evaluation purposes. October 26, 2017 DRAFT 3 II. S TATISTICAL C HARACTERIZATION O F T HE FTR FADING M ODEL In this section, the statistical properties of the FTR fading model are investigated. To this end, novel, analytical expressions for its PDF and CDF are derived for arbitrary values of its parameters. A. An Overview of the FTR Fading Model According to the FTR fading model, the complex baseband response of the wireless channel can be expressed as Vr = p p ζV1 exp (ıφ1 ) + ζV2 exp (ıφ2 ) + X + ıY, (1) where ζ is a Gamma distributed random variable with unit mean, and PDF given by fζ (u) = mm um−1 −mu e . Γ (m) (2) Furthermore, V1 and V2 are constant amplitudes having specular components modulated by a Nakagami-m random variable, ı denotes the imaginary term, φ1 and φ2 are uniformly distributed random phases, namely φ1 , φ2 ∼ U [0, 2π). The random phase of each dominant wave is assumed to be statistically independent. In addition, X + ıY represents the diffuse component, which can be modeled as a complex Gaussian random variable as X, Y ∼ N (0, σ 2). The FTR fading model can be conveniently expressed by introducing the parameters K and ∆, which are respectively defined as K= V12 + V22 , 2σ 2 (3) ∆= 2V1 V2 , V12 + V22 (4) where K is the ratio of the average power of the dominant waves to the average power of the remaining diffuse multipath, in a similar fashion as the parameter K in the Rician channel model. Moreover, ∆ varies from 0 to 1 and characterizes the relation between the powers of two dominant waves. When ∆ = 1, the magnitudes of the two specular components are equal, e.g., V1 = V2 . When ∆ = 0, the FTR model reduces to a Rician shadowed fading model, including only one component, e.g., V1 = 0 or V2 = 0. By using the definitions for m, K and ∆, the October 26, 2017 DRAFT 4 FTR fading model encompasses the one-sided Gaussian, Rayleigh, Nakagami-q, Rician, Rician shadowed and TWDP, as special cases. B. New expressions for the PDF and CDF of the FTR fading model The received average SNR, γ̄, undergoing a multipath fading channel as described in (1) is given by  γ̄ = (Eb /N0 ) E |Vr |2 = (Eb /N0 ) 2σ 2 (1 + K) , (5) where Eb is the energy density and E {·} denotes the expectation operator. The PDF expression for the FTR fading power envelope can be obtained by Ku = uK over all possible realizations u of the random variable ζ, which follows a Gamma distribution as indicated in (2). It should be stressed that the PDF and CDF expressions presented in [7], are only valid for positive integer values of m. In what follows, novel PDF and CDF expressions for the power envelope of the FTR fading model are derived, assuming arbitrary positive real values of m. Lemma 1: For arbitrary positive values of m, the exact PDF and CDF of the instantaneous SNR in the FTR fading channel can be respectively expressed as ∞  mm X K j dj fG x; j + 1, 2σ 2 , fγ (x) = Γ (m) j=0 j! (6) ∞  mm X K j dj Fγ (x) = FG x; j + 1, 2σ 2 , Γ (m) j=0 j! (7) where xj x exp(− 2 ) , j+1 2σ Γ (j + 1) (2σ 2 )   x  1 2 γ j + 1, 2 , x; j + 1, 2σ , Γ (j + 1) 2σ  fG x; j + 1, 2σ 2 , FG dj , j X k=0   j k    ∆ 2 k X k × (m + K)2 −(K∆) October 26, 2017 l=0   −(j+m) 2 2 k l  Γ (j +m+2l−k) e  k−2l  q Pj+m−1 (8) (9) π(2l−k)i 2 m+K 2 (m+K) −(K∆) 2  . DRAFT 5 where γ (·, ·) is the incomplete gamma function [10, Eq. (8.350.1)] and P (·) denotes Legendre functions of the first kind [10, Eq. (8.702)]. Proof: Please see Appendix. In contrast to [7], the derived PDF and CDF expressions in Lemma 1 are more general and valid for arbitrary positive values of m. Fig. 1 depicts the PDF derived in (6) for different arbitrary positive values of m, and markers correspond to the simulation PDF based on (1). It is clear that the Monte Carlo simulations validate our derived result of PDF, and the difference of the PDF curves between considering m = 1.5 and m = 2 is pronounced. 1 m=1.5 m=2 m=10.1 Simulations 0.9 0.8 0.7 PDF 0.6 0.5 0.4 0.3 0.2 0.1 0 0 1 2 3 Transmit SNR γ [dB] 4 5 Fig. 1. FTR power envelope distribution for arbitrary positive values of m (K = 15, ∆ = 0.5 and γ̄ = 1). C. KS Goodness-of-fit test Herein, we investigate the validity of the proposed approximations by using the statistical tool and argument. Specifically, we employ the Kolmogorov-Smirnov (KS) goodness-of-fit statistical test [11], which measures the maximum value of the absolute difference between the empirical CDF of the random variable γ, F̂γ (·), and the analytical CDF of the random variable γ, Fγ (·). Hence, the KS test statistic is given by [11] T , max F̂γ (x) − Fγ (x) . (10) Table I depicts the KS test statistic for different combinations of channel parameters K, m and ∆, where T1 is for the proposed approximation in this paper, and T2 is for the approximation given in [7]. It should be noted that, for all considered cases in this paper, 40 terms have been used to converge the series. Without loss of generality, we assume that the average SNR γ̄ = 1. October 26, 2017 DRAFT 6 STATISTIC TABLE I KS TEST FOR DIFFERENT COMBINATIONS OF FTR Fading Parameters m=5.5, K=15, ∆=0.4 m=8.5, K=5, ∆=0.35 m=9.2, K=3, ∆=1 m=10, K=10, ∆=0.5 m=15, K=20, ∆=0.2 m=20, K=5, ∆=0.43 CHANNEL PARAMETERS K, m, ∆. T1 T2 0.013339 – 0.011112 – 0.009313 – 0.008867 0.008867 0.005461 0.005461 0.009404 0.009404 The exact results Fγ (x) have been obtained by averaging at least v = 104 samples of the FTR p random variables. The critical value Tmax = − (1/2v) ln (α/2), is given by Tmax = 0.0136, which corresponds to a significance level of α = 5% [11]. The hypothesis H0 is accepted with T < Tmax . It is clearly illustrated in Table I that hypothesis H0 is always accepted with 95% significance for different combinations of parameters K, m and ∆, as both T1 and T2 are smaller than Tmax . As opposed to [7], our derived approximations are valid for arbitrary positive values of parameters m, which is practical in a real wireless scenario. More specifically, the hypothesis H0 of the CDF expression (7) is also accepted for arbitrary positive values of m. It should be noted that, for all cases considered in this paper, 40 terms have been used to converge the series and the truncation error is less than 10−9 . III. P ERFORMANCE A NALYSIS A. Channel Capacity The average capacity per unit bandwidth is given by Z ∞ C, log2 (1 + x) fγ (x) dx. (11) 0 With the help of (11) and (6), we can obtain the capacity of the FTR channels. Lemma 2: For arbitrary positive values of m, the average FTR channel capacity per unit bandwidth can be obtained as ∞ CFTR October 26, 2017  mm X K j dj LG j + 1, 2σ 2 , = Γ (m) j=0 j! (12) DRAFT 7 where LG j +1, 2σ  2  j    exp 2σ12 X 1 2 −k 2σ Γ −k, 2 . , ln 2 2σ k=0 Proof: Substituting (6) into (11), we can obtain ∞ mm X K j dj C= Γ (m) j=0 j! and we define LG j + 1, 2σ 2  , Z Z ∞ 0 ∞ 0  log2 (1 + x) fG x; j + 1, 2σ 2 dx  log2 (1 + x) fG x; j + 1, 2σ 2 dx. The closed-form expression of LG (j + 1, 2σ 2) can be easily derived to finish the proof. B. Bit Error Rate For a variety of modulation formats, the average BER is given by Z ∞ PBER , Pe (x) fγ (x) dx, (13) 0 where Pe (x) is the conditional bit-error probability, which can be written as Pe (x) = Γ (β, αx) , 2Γ (β) (14) where Γ (β, αx) is the upper incomplete Gamma function [10, Eq. (8.350.2)], α and β are modulation-specific parameters for binary modulation schemes, respectively. For example, (α, β) = (1, 0.5) for binary shift keying (BPSK), (α, β) = (0.5, 0.5) for coherent binary frequency shift keying, and (α, β) = (1, 1) for differential BPSK [12]. By substituting (6) and (14) into (13) and based on the definition of Γ (β, αx) [13], (13) can be rewritten as Z ∞ αβ xβ−1 e−αx Fγ (x) dx. PBER = 2Γ (β) 0 (15) With the help of (15) and (7), we can obtain the BER of the FTR fading channel in the following lemma. Lemma 3: For arbitrary positive values of m, the average BER of the FTR fading channel can be obtained as ∞ PBER October 26, 2017  mm X K j dj = BG j + 1, 2σ 2 , Γ (m) j=0 j! (16) DRAFT 8 where BG j + 1, 2σ × 2 F1  2  , Γ (β + j + 1) (2σ 2 ) β (j + 1) (2ασ 2 + 1)β+j+1  1 1, β + j + 1; j + 2; , 1 + 2ασ 2 (17) where 2 F1 (·, ·; ·; ·) is the Gauss hypergeometric function [10, Eq. (9.14)]. Proof: Substituting (7) into (15), we can obtain ∞ mm X K j dj αβ PBER = Γ (m) j=0 j!Γ (j + 1) 2Γ (β) Z ∞  x  × xβ−1 e−αx γ j + 1, 2 dx 2σ {z } |0 (18) zj With the help of [10, Eq. (6.455.2)], the integral zj can be expressed as zj = Γ (β + j + 1) (2σ 2 ) β (j + 1) (2σ 2 α + 1)β+j+1  × 2 F1 1, β + j + 1; j + 2; 1 1 + 2ασ 2  . (19) The proof concludes by combining (19) and (18). Note that the derived BER expression (16) is given in terms of Gauss hypergeometric functions, which can be easily evaluated and efficiently programmed in most standard software packages (e.g., Matlab, Maple and Mathematica). However, our exact analytical results provide limited physical insights, we now present an asymptotic and simple expression of the error rates for the high-SNR regime. For the high-SNR regime, 2σ 2 approaches to ∞, resulting in the term BG (j + 1, 2σ 2) approaches zero. Therefore, the term with j = 0 is the maximum and we can remove other terms. After some simple manipulations, we obtain the average BER in the high-SNR regime for arbitrary positive values of m as ∞ PBER October 26, 2017 −m mm Γ (β + 1) 2 2 2 (m + K) − (K∆) = 2Γ (β) 2ασ 2   m+K . × Pm−1  q 2 2 (m + K) − (K∆) (20) DRAFT 9 10 m=0.3 m=2.3 m=10.3 Simulations Capacity per unit bandwidth bits/s/Hz 9 8 7 6 5 4 3 2 1 0 0 5 10 15 20 Average SNR γ̄ [dB] 25 30 Fig. 2. Capacity under unit bandwidth of the FTR fading channel against the average SNR γ̄ for different values of m (K = 10 and ∆ = 0.5). Note that (20) is coincident with the expression in [7], which is obtained from the asymptotic MGF for the high-SNR regime. Herein, we provide a method to obtain the BER for the high-SNR regime directly from the derived analytical BER expression. IV. N UMERICAL R ESULTS In this section, some representative plots that illustrate the capacity and BER performance of FTR fading channels are presented, along with the Monte Carlo simulation by generating 108 random realizations following the FTR distribution. Although some expressions presented herein are given in terms of infinite series, we only need use less than 40 terms to get a satisfactory accuracy (e.g., smaller than 10−9 ) for all considered cases. In the following, without loss of generality, the transmit SNR is normalized to be 1. Figs. 2-3 depict the analytical (12) and simulation channel capacity against the average SNR γ̄ for different values of m and K. By varying one parameter while keeping other parameters fixed, we find that increasing the values of m helps overcome the effect of the FTR channel fading. As expected, the capacity that corresponds to light fluctuations (m = 10.3) is larger than the capacity that corresponds to heavy fluctuations (m = 0.3). Moreover, this increase is more pronounced for smaller values of m. When ∆ = 0.9, it is clear from Fig. 3.(a) that the capacity that corresponds to high power of the dominant waves (K = 10) is larger than the capacity that corresponds to high power of the scattered waves (K = 1). For ∆ = 1 in Fig. 3.(b), however, the capacity increases as K decreases, which is consistent with [8]. October 26, 2017 DRAFT 10 10 10 8 6.95 6.9 7 6.85 6 22.5 5 6.45 9 7 Capacity per unit bandwidth bits/s/Hz Capacity per unit bandwidth bits/s/Hz 9 23 4 3 2 K =1 K =3 K =10 Simulations 1 8 6.4 7 6.35 6 21.2 21.4 5 4 3 2 K =5 K =10 K =20 Simulations 1 0 0 0 10 20 30 0 10 Average SNR γ̄ [dB] 20 30 Average SNR γ̄ [dB] (a) ∆ = 0.9 (b) ∆ = 1 Fig. 3. Capacity under unit bandwidth of the FTR fading channel against the average SNR γ̄ for different values of K (m = 25.5). 0 10 Case Case Case Case Case Case −1 10 −2 10 I:m=5.5, Exact I:m=5.5, High SNR I: Simulations II:m=10.5, Exact II:m=10.5, High SNR II: Simulations −3 BER 10 −4 m = 5.5 10 −5 10 −6 10 −7 10 m = 10.5 −8 10 0 5 10 15 20 Average SNR γ̄ [dB] 25 30 Fig. 4. BER performance of the FTR fading channel against the average SNR γ̄ for different values of m (K = 30 and ∆ = 0.45). The simulation, exact and high-SNR approximation BER curves based on (16) and (20) are depicted in Figs. 4-5, respectively. We consider the BPSK modulation with modulation parameters α = 1 and β = 0.5. Figs. 4-5 indicate that the analytical expressions coincide with the high-SNR approximation results when average SNR is high. It is clear from Fig. 4 that a large value of m diminishes the effect of channel fluctuations, thereby delivering a smaller BER. We also note that the BER is a decreasing function of the parameter K. With the increase of K, the variance σ 2 of the diffuse components decreases under the same average SNR, which results the BER for the case of K = 25 is lower than that of K = 10. October 26, 2017 DRAFT 11 0 10 Case Case Case Case Case Case −1 10 −2 10 I: K =10, Exact I: K =10, High SNR I: Simulations II: K =25, Exact II: K =25, High SNR II: Simulations −3 BER 10 K = 10 −4 10 −5 10 −6 10 −7 K=25 10 −8 10 0 5 10 15 20 Average SNR γ̄ [dB] 25 30 Fig. 5. BER performance of the FTR fading channel against the average SNR γ̄ for different values of K (m = 10.5 and ∆ = 0.35). V. C ONCLUSION In this paper, we derive new expressions for the PDF and CDF of the instantaneous SNR of the FTR fading channel by using a mixture of gamma distributions. Further, the analytical expression of capacity has been derived. We find that increasing the values of channel parameters m and/or K both help overcome the effects of fading. Moreover, we derived exact and asymptotic expressions of the BER for binary modulation schemes to get better insight into the implications of the model parameters on the BER performance. Our derived results extend the knowledge of the newly proposed FTR fading model, which shows its promising validation for the performance analysis of future wireless systems. A PPENDIX The PDF of the TWDP fading model can be expressed by a mixture of gamma distributions as [14, Eq. (6)] fTWDP (x) = exp(−K) ∞ X Kj j=0 j × X k=0 |   j k   = exp(−K)  ∆ 2 k X k l=0   {z k l    I2l−k (−K∆) tj ∞ X K j tj j=0 October 26, 2017 j! fG x; j + 1, 2σ 2 j!  fG x; j + 1, 2σ 2 , } (21) DRAFT 12 where Iv (·) is the modified Bessel function of the first kind [10, Eq. (8.445)] with the v-th order, fG (x; j + 1, 2σ 2 ) is the PDF of the gamma distribution with the shape parameter ( j + 1) and scale parameter 2σ 2 . In the FTR fading model, ζ is a unit-mean Gamma distributed random variable with the PDF expression (2). From (2) and (21), we can obtain the PDF of the FTR channel as fFTR (x) = Z ∞ fTWDP (x; uK)fζ (u) du 0 j X 2    k m   ∆ fG x; j + 1, 2σ = Γ (m) j=0 j! 2 k k=0   Z ∞ k X k   uj+m−1e−(m+K)u I2l−k (−uK∆) du. × 0 l l=0 | {z } m ∞ X Kj j (22) sk With the help of [15, Eq. (2.15.3.2)], we can derive the last term sk as π(2l−k)i 2 Γ (j + m + 2l − k) (m + K)2 − (K∆)2   (m + K) k−2l  . q × Pj+m−1 2 2 (m + K) − (K∆) sk = e  −(j+m) 2 (23) Substituting (23) into (22), we can obtain (6). Recall that the definition of the CDF is given by Fγ (x) = Pr (γ 6 x), where Pr (·) represents the probability. With the help of [10, Eq. (3.351.1)] and fG (x; j + 1, 2σ 2 ), the CDF expression can be derived as FG x; j + 1, 2σ 2  Z t  x  xj exp − 2 dt 2 j+1 2σ 0 Γ (j + 1) (2σ )   1 x = γ j + 1, 2 . Γ (j + 1) 2σ = (24) Utilizing (24), we can finish the proof by presenting the CDF of FTR fading model for arbitrary m > 0 as (7). R EFERENCES [1] F. Boccardi, R. W. Heath, A. Lozano, and T. L. Marzetta, “Five disruptive technology directions for 5G,” IEEE Commun. Mag., vol. 52, no. 2, pp. 74–80, Feb. 2013. [2] V. W. Wong, R. Schober, D. W. K. Ng, and L.-C. Wang, Key Technologies for 5G Wireless Systems. Cambridge University Press, 2017. October 26, 2017 DRAFT 13 [3] T. S. Rappaport, G. R. Maccartney, M. K. Samimi, and S. Sun, “Wideband millimeter-wave propagation measurements and channel models for future wireless communication system design,” IEEE Trans. Commun., vol. 63, no. 9, pp. 3029–3056, Sep. 2015. [4] M. Peng, Y. Li, T. Q. S. Quek, and C. Wang, “Device-to-device underlaid cellular networks under Rician fading channels,” IEEE Trans. Wireless Commun., vol. 13, no. 8, pp. 4247–4259, Aug. 2014. [5] S. L. Cotton, “Human body shadowing in cellular device-to-device communications: Channel modeling using the shadowed fading model,” IEEE J. Sel. Areas Commun., vol. 33, no. 1, pp. 111–119, Jan. 2015. [6] S. K. Yoo, S. L. Cotton, P. C. Sofotasios, and S. Freear, “Shadowed fading in indoor off-body communication channels: A statistical characterization using the κ-µ/gamma composite fading model,” IEEE Trans. Wireless Commun., vol. 15, no. 8, pp. 5231–5244, Aug. 2016. [7] J. M. Romero-Jerez, F. J. Lopez-Martinez, J. F. Paris, and A. J. Goldsmith, “The fluctuating two-ray fading model: Statistical characterization and performance analysis,” IEEE Trans. Wireless Commun., vol. 16, no. 7, pp. 4420–4432, Jul. 2017. [8] M. Rao, F. J. Lopez-Martinez, M. S. Alouini, and A. Goldsmith, “MGF approach to the analysis of generalized two-ray fading models,” IEEE Trans. Wireless Commun., vol. 14, no. 5, pp. 2548–2561, May. 2015. [9] M. K. Samimi, G. R. MacCartney, S. Sun, and T. S. Rappaport, “28 Ghz millimeter-wave ultrawideband small-scale fading models in wireless channels,” in Proc. IEEE 83rd VTC, 2016, pp. 1–6. [10] I. S. Gradshteyn and I. M. Ryzhik, Table of Integrals, Series, and Products, 7th ed. New York: Academic, 1980. [11] A. Papoulis, Probability, Random Variables and Stochastic Processes. New York, NY, USA: McGraw-Hill, 1994. [12] I. Trigui, A. Laourine, S. Affes, and A. Phenne, “Performance analysis of mobile radio systems over composite fading/shadowing channels with co-located interference,” IEEE Trans. Wireless Commun., vol. 8, no. 7, pp. 3448–3453, Aug. 2009. [13] J. Zhang, M. Matthaiou, Z. Tan, and H. Wang, “Performance analysis of digital communication systems over composite η-µ/gamma fading channels,” IEEE Trans. Veh. Technol., vol. 61, no. 7, pp. 3114–3124, Jul. 2012. [14] N. Y. Ermolova, “Capacity analysis of two-wave with diffuse power fading channels using a mixture of gamma distributions,” IEEE Commun. Lett., vol. 20, no. 11, pp. 2245–2248, Nov. 2016. [15] A. P. Prudnikov, I. U. A. Brychkov, and O. I. Marichev, Integrals and Series, Volume 2: Special Functions. Gordon and Breach, 1986. October 26, 2017 DRAFT
7cs.IT
Inverse system characterizations of the (hereditarily) just infinite property in profinite groups arXiv:1708.08301v1 [math.GR] 28 Aug 2017 Colin D. Reid August 29, 2017 Abstract We give criteria on an inverse system of finite groups that ensure the limit is just infinite or hereditarily just infinite. More significantly, these criteria are ‘universal’ in that all (hereditarily) just infinite profinite groups arise as limits of the specified form. This is a corrected and revised version of [8]. 1 Introduction Notation. In this paper, all groups will be profinite groups, all homomorphisms are required to be continuous, and all subgroups are required to be closed; in particular, all references to commutator subgroups are understood to mean the closures of the corresponding abstractly defined subgroups. For an inverse system Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } of finite groups, we require all the homomorphisms ρn to be surjective. A subscript o will be used to indicate open inclusion, for instance A ≤o B means that A is an open subgroup of B. We use ‘pronilpotent’ and ‘prosoluble’ to mean a group that is the inverse limit of finite nilpotent groups or finite soluble groups respectively, and ‘G-invariant subgroup of H’ to mean a subgroup of H normalized by G. A profinite group G is just infinite if it is infinite, and every nontrivial normal subgroup of G is of finite index; it is hereditarily just infinite if in addition every open subgroup of G is just infinite. At first sight the just infinite property is a qualitative one, like that of simplicity: either a group has nontrivial normal subgroups of infinite index, or it does not. However, it has been shown by Barnea, Gavioli, Jaikin-Zapirain, Monti and Scoppola (see [1], especially Theorem 36) and the present author ([7]) that the just infinite property in profinite groups can be characterized by properties of the lattice of open normal subgroups, and as such may be regarded as a kind of boundedness property on the finite 1 images (see [7, Theorems B1 and B2]); moreover, it suffices to consider any collection of finite images that form an inverse system for the group. Similar considerations apply to the hereditarily just infinite property. The weakness of the characterization given in [7] is that the conditions imposed on the finite images are asymptotic: no correspondence is established between the (hereditarily) just infinite property per se and the structure of any given finite image. In a sense this is unavoidable, as any finite group appears as the image of a hereditarily just infinite profinite group (see Example 6.5). By contrast in [1], a strong ‘periodic’ structure of some just infinite pro-p groups is described, but this structure can only exist for a certain special class of just infinite virtually pro-p groups, those which have a property known as finite obliquity (essentially in the sense of [3]). In the present paper we therefore take a new approach, which is to show the existence of an inverse system with certain specified properties for any (hereditarily) just infinite profinite group, and in turn to show that the specified properties imply the (hereditarily) just infinite property in the limit. The inverse system characterizations in this paper are essentially variations on the following: Theorem 1.1. Let Λ = {(Gn )n>0 , ρn : Gn+1 → Gn } be an inverse system of finite groups. Let An be a nontrivial normal subgroup of Gn and let Pn = ρn (An+1 ) for n > 0. Suppose furthermore, for each n > 0: (i) An+1 > ker ρn ≥ Pn+1 ; (ii) An has a unique maximal Gn -invariant subgroup; (iii) Each normal subgroup of Gn contains Pn or is contained in An (or both). Then G = lim Gn is just infinite. Conversely, every just infinite profinite group is ←− the limit of such an inverse system. A similar characterization applies to hereditarily just infinite groups: see Theorem 5.2. As shown by Wilson in [10], such groups are not necessarily virtually pro-p; we derive one of Wilson’s constructions as a special case. We will also discuss some examples of hereditarily just infinite profinite groups that are not virtually prosoluble, illustrating some features of this class. In particular, the following serves as a source of examples of such groups: Definition 1.2. Let X be a set and let G be a group acting on X, with kernel K. We say G acts subprimitively on X if for every normal subgroup H of G, then H/(H ∩ K) acts faithfully on every H-orbit. Proposition 1.3. Let G be a just infinite profinite group. Suppose there are infinitely many nonabelian chief factors R/S of G for which G permutes the simple factors of R/S subprimitively. Then G is hereditarily just infinite. Remark 1.4. The following classes of permutation groups are all special cases of transitive subprimitive permutation groups: regular permutation groups, primitive permutation groups, quasiprimitive groups in the sense of [5] and semiprimitive groups in the sense of [2]. An intransitive faithful action is subprimitive if and only if the group acts faithfully and subprimitively on every orbit. 2 Acknowledgements My thanks go to Davide Veronelli, who pointed out some errors in the original article and proposed some corrections; the need to fix the errors in the original article was the immediate motivation for this revised article. I also thank John Wilson for showing me a preliminary version of [10]; Charles Leedham-Green for his helpful comments; and Laurent Bartholdi for his suggestion to look at [4] and determine whether the group in question is hereditarily just infinite. 2 Preliminaries Definition 2.1. Let G be a profinite group. A chief factor of G is a quotient K/L of some normal subgroup K of G, such that L E G and there are no normal subgroups M of G satisfying K < M < L. We say two chief factors K1 /L1 and K2 /L2 of G are associated to each other if K1 L2 = K2 L1 ; Ki ∩ L1 L2 = Li (i = 1, 2). This also implies that K1 L2 = K1 K2 . Given a normal subgroup N of G, say N covers the chief factor K/L if N L ≥ K. The association relation is not transitive in general. For instance, if G is the Klein 4-group with subgroups {H1 , H2 , H3 } of order 2, then the pairs of associated chief factors are those of the form {G/Hi , Hj /{1}} for i 6= j. Thus H1 /{1} is associated to G/H2 and G/H2 is associated to H3 /{1}, but H1 /{1} and H3 /{1} are not associated to each other. Nonabelian chief factors however are much better behaved under association. A theory of association classes of nonabelian chief factors is developed in a much more general context in [9]. Parts (i) and (ii) of the following lemma are standard facts about profinite groups and will be used without further comment. Lemma 2.2. Let G be a profinite group. (i) Let K and L be normal subgroups of G such that K > L. Then there exists L ≤ M < K such that K/M is a chief factor of G. (ii) Every chief factor of G is finite. (iii) Let K1 /L1 and K2 /L2 be associated chief factors of G. Then K1 /L1 ∼ = K2 /L2 and CG (K1 /L1 ) = CG (K2 /L2 ). Proof. Given normal subgroups K and L of G such that K > L, then L is an intersection of open normal subgroups of G, so there is an open normal subgroup O of G containing L but not K. Then K ∩ O E G and K ∩ O <o K. In particular, K/(K ∩ O) is a finite normal factor of G. This implies (i) and (ii). For (iii), let H = K1 K2 = K1 L2 = K2 L1 . Since K1 ∩ L1 L2 = L1 , the kernel of the natural homomorphism from K1 to H/L1 L2 is exactly L1 ; since H = K1 L2 , this 3 homomorphism is also surjective. Thus K1 /L1 ∼ = H/L1 L2 . Let T be a subgroup of G. If [H, T ] ≤ L1 L2 then [K1 , T ] ≤ L1 L2 ∩ K1 = L1 , and conversely if [K1 , T ] ≤ L1 then [H, T ] is contained in the normal closure of L1 ∪ [L2 , T ] (since H = K1 L2 ) and thus in L1 L2 . Hence CG (K1 /L1 ) = CG (H/L1 L2 ). Similarly K2 /L2 ∼ = H/L1 L2 and CG (K2 /L2 ) = CG (H/L1 L2 ). We will also need some definitions and results from [7]. Definition 2.3. The cosocle or Mel’nikov subgroup M(G) of G is the intersection of all maximal open normal subgroups of G. Lemma 2.4 (see [7, Lemma 2.2] and its corollary; see also [11]). Let G be a just infinite profinite group, and let H be an open subgroup of G. Then |H : M(H)| is finite. Definition 2.5. Given a profinite group G and subgroup H, we define ObG (H) and Ob∗G (H) as follows: \ ObG (H) := H ∩ {K Eo G | K 6≤ H} \ Ob∗G (H) := H ∩ {K ≤o G | H ≤ NG (K), K 6≤ H}. Note that ObG (H) and Ob∗G (H) have finite index in H if and only if the relevant intersections are finite. Theorem 2.6 ([1, Theorem 36], [7, Theorem A and Corollary 2.6]). Let G be a just infinite profinite group, and let H be an open subgroup of G. Then |G : ObG (H)| is finite. If G is hereditarily just infinite, then |G : Ob∗G (H)| is finite. Corollary 2.7. Let G be a just infinite profinite group and let H be an open subgroup of G. Then K ≤ H for all but finitely many chief factors K/L of G. Proof. By Theorem 2.6, there are only finitely many normal subgroups of G not contained in H. In turn, if K/L is a chief factor of G then L ≥ M(K), so by Lemma 2.4, the quotients of a given open normal subgroup of G can only produce finitely many chief factors of G. 3 Narrow subgroups The key idea in this paper is that of a ‘narrow’ subgroup associated to a chief factor. These are a general feature of profinite groups, but they have further properties that will be useful in establishing the just infinite property. Throughout this section, G will be a profinite group. Definition 3.1. Let 1 < A E G, and define MG (A) to be the intersection of all maximal open G-invariant subgroups of A. Note that M(A) ≤ MG (A) < A. Say A is narrow in G and write A Enar G if there is a unique maximal G-invariant subgroup of A, in other words MG (A) is the maximal G-invariant subgroup of A. 4 Note that if AEnar G, then A/N Enar G/N and MG (A/N ) = MG (A)/N for any N EG such that N < A. Given A Enar G and a chief factor K/L of G, we will say A is associated to K/L to mean A/MG (A) is associated to K/L. Lemma 3.2. Let A and K be normal subgroups of the profinite group G. (i) We have KMG (A) ≥ A if and only if K ≥ A. (ii) Suppose A is narrow in G and that KN ≥ A for some proper G-invariant subgroup of A. Then K ≥ A. Proof. (i) Suppose K  A. Then K ∩ A is contained in a maximal G-invariant subgroup R of A. By the modular law, KMG (A)∩A = MG (A)(K ∩A) ≤ R < A, so KMG (A)  A. The converse is clear. (ii) Since A is narrow in G, the group MG (A) contains every proper G-invariant subgroup of A. In particular, MG (A) ≥ N , so KMG (A) ≥ KN ≥ A and hence K ≥ A by part (i). The existence of narrow subgroups in profinite groups is shown by a compactness argument. Lemma 3.3. Given any chief factor K/L of G, there is a narrow subgroup A of G associated to K/L. Those A Enar G associated to K/L are precisely those narrow subgroups of G contained in K but not L, and it follows in this case that A ∩ L = MG (A). In particular, every nontrivial normal subgroup of G contains a narrow subgroup of G. Proof. Suppose A Enar G and A is associated to K/L. Then KMG (A) ≥ A, so K ≥ A by Lemma 3.2. Also AL ≥ K, so A 6≤ L. Conversely, let A Enar G such that A ≤ K and A 6≤ L. Then AL = K since K/L is a chief factor of G, and clearly then AL = K(A ∩ L) and (A ∩ L)L < AK. To show A ∩ L = MG (A) and that A/MG (A) is associated to K/L, it remains to show that A/A ∩ L is a chief factor of G: this is the case as any G/A ∩ L-invariant subgroup of A/A ∩ L would correspond via the isomorphism theorems to a G/L-invariant subgroup of AL/L = K/L. It remains to show that narrow subgroups with the specified properties exist. Let K(G, K) be the set of normal subgroups of G contained in K and let D = K(G, K) \ K(G, L). Given that K \ L is compact, one sees that the intersection of any descending chain in D is not contained in L, and is thus an element of D. Hence D has a minimal element A by Zorn’s lemma. Now any normal subgroup of G properly contained in A must be contained in L by the minimality of A in D. Thus A ∩ L is the unique maximal G-invariant subgroup of A and so A Enar G. We now define a relation on chief factors which gives the intuition underlying the rest of this paper. Definition 3.4. Given chief factors a = K1 /L1 and b = K2 /L2 , say a ≻nar b if L1 ≥ K2 and MG/L2 (K1 /L2 ) = L1 /L2 (in particular, K1 /L2 Enar G/L2 ). 5 Proposition 3.5. (i) Let K1 /L1 and K2 /L2 be chief factors of G. Let N be a normal subgroup of G that covers K1 /L1 and suppose K1 /L1 ≻nar K2 /L2 . Then N covers K2 /L2 . (ii) The relation ≻nar is a strict partial order. (iii) Suppose K1 /L1 T ≻nar K2 /L2 ≻nar . . . is a descending sequence of open chief factors of G such that i Li = {1}. Then K1 Enar G. Proof. (i) We have MG/L2 (K1 /L2 ) = L1 /L2 , so N L2 /L2 ≥ K1 /L2 by Lemma 3.2, that is, N L2 ≥ K1 . As K2 ≤ K1 , this implies that N covers K2 /L2 . (ii) It is clear that ≻nar is antisymmetric and antireflexive. Suppose K1 /L1 ≻nar K2 /L2 and K2 /L2 ≻nar K3 /L3 . It remains to show that L1 is the unique maximal proper G-invariant subgroup of K1 containing L3 . Suppose there is another such subgroup R. Since MG/L2 (K1 /L2 ) = L1 /L2 and R is not contained in L1 , we must have RL2 = K1 . In particular, RL2 ≥ K2 . Since L2 /L3 = MG/L3 (K2 /L3 ), we have R/L3 ≥ K2 /L3 by Lemma 3.2, that is R ≥ K2 . But then L2 ≤ R, so in fact R = K1 , a contradiction. (iii) It follows from (ii) that K1 /Li Enar G/Li for all i. Suppose there is a maximal proper G-invariant subgroup N of K1 other than L1 . Then N 6≤ L1 , so N Li 6≤ L1 for all i. Since K1 /Li Enar G/Li with MG/Li (K1 /Li ) = L1 /Li , this forces N Li = K1 for all i. It follows by a standard compactness argument that N = K1 , a contradiction. The relation ≻nar can be used to obtain some restrictions on the just infinite images of a profinite group. Theorem 3.6. Let G be a profinite group. (i) Suppose K1 /L1 ≻nar T K2 /L2 ≻nar . . . is a descending sequence of open chief factors of G and let L = i Li . Then there is a normal subgroup K ≥ L of G such that G/K is just infinite and such that for all i, K does not cover Ki /Li . Indeed, it suffices for K ≥ L to be maximal subject to not covering the factors Ki /Li . (ii) Every just infinite image G/K of G arises in the manner described in (i) with K = L. Proof. (i) Let N be the set of all normal subgroups of G which S contain L and which C and let i ∈ N. Then do not cover K /L for any i, let C be a chain in N , let R = i i S RLi = ( C)Li = CLi for some C ∈ C, since Li is already open and in particular of finite index in G; so RLi does not contain Ki , which ensures R ∈ N . Hence N has a maximal element K by Zorn’s lemma. Since K does not cover any of the factors Ki /Li , we have KL1 > KL2 > KL3 > . . . and so |G : K| is infinite. Let P be a normal subgroup of G properly containing K. Then P covers Ki /Li for some i by the maximality of K. Moreover MG/K (Ki /L) = Li L/L by Proposition 3.5 and P ≥ L, so P ≥ Ki by Lemma 3.2. In particular |G : P | ≤ |G : Ki | < ∞. Hence G/K is just infinite. (ii) By Lemma 3.3, there are narrow subgroups of G/K associated to every chief factor of G/K. Let R/S be a chief factor of G such that S ≥ K and let K1 /K be a 6 narrow subgroup of G/K associated to R/S, with MG/K (K1 /K) = L1 /K. Thereafter we choose Ki+1 /K to be a narrow subgroup associated to a chief factor R/S such that S ≥ K and R ≤ Li . It is clear that the chief factors Ki /Li will have the required properties. 4 Characterizations of the just infinite property and control over chief factors Here is a universal inverse limit construction for just infinite profinite groups along the lines of Theorem 1.1, also incorporating some information about chief factors. Theorem 4.1. Let G be a just infinite profinite group. Let C1 , C2 , . . . be a sequence of classes of finite groups, such that G has infinitely many chief factors in Cn for all n. Then G is the limit of an inverse system Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } as follows: Each Gn has a specified nontrivial normal subgroup An such that, setting Pn = ρn (An+1 ): (i) MGn+1 (An+1 ) ≥ ker ρn ≥ Pn+1 ; (ii) Each normal subgroup of Gn contains Pn or is contained in An (or both); (iii) Pn is a minimal normal subgroup of Gn ; (iv) Pn ∈ Cn for all n. Conversely, any inverse system satisfying conditions (i) and (ii) (for some choice of nontrivial normal subgroups An ) for all but finitely many n has a limit that is just infinite. Proof. Suppose that G is just infinite with the specified chief factors. We will obtain an infinite descending chain (Kn )n≥0 of narrow subgroups of G, and then use these to construct the required inverse system. Let K0 = G. Suppose Kn has been chosen, and let L = ObG (MG (Kn )). Then by Theorem 2.6, L is open in G, and hence by Corollary 2.7, all but finitely many chief factors R/S of G satisfy R ≤ L; note also that L is a proper subgroup of Kn . Let R/S be a chief factor such that R ≤ L and R/S ∈ Cn , and let Kn+1 be a narrow subgroup of G associated to R/S. Then Kn+1 ≤ L and Kn+1 /MG (Kn+1 ) ∼ = R/S. Since Kn+1 ≤ L, every normal subgroup of G contains Kn+1 or is contained in MG (Kn ) (or both). Set Gn = G/MG (Kn+1 ), set Pn = Kn+1 /MG (Kn+1 ), set An = Kn /MG (Kn+1 ) and let the maps ρn be the natural quotient maps. The inverse limit of (Gn , ρn ) is then an infinite quotient of G, which is then equal to G since G is just infinite. Given a normal subgroup N/MG (Kn+1 ) of Gn such that N/MG (Kn+1 )  An , then N  Kn , so N ≥ Kn+1 and hence N/MG (Kn+1 ) ≥ Pn , so condition (ii) is satisfied. The other conditions are clear. Now suppose we are given an inverse system satisfying (i) and (ii) for n ≥ n0 > 1, with inverse limit G. Let πn : G → Gn be the surjections associated to the inverse 7 limit. Note that condition (i) ensures that the groups πn−1 (An ) form a descending chain −1 of open normal subgroups of G; since Pn+1 ≤ ker ρn , we see that πn+2 (An+2 ) ≤ ker πn , −1 and consequently the subgroups πn (An ) have trivial intersection. The fact that An is nontrivial ensures that πn−1 (An ) is nontrivial; since the descending chain (πn−1 (An )) has trivial intersection, G must be infinite. Let N be a nontrivial normal subgroup of G. Then there is some n1 ≥ n0 such that for all n ≥ n1 , N is not contained in π −1 (An ). By (ii) it follows that πn (N ) contains Pn ; hence ρn (πn+1 (N ) ∩ An+1 ) = Pn and thus An+1 = (πn+1 (N ) ∩ An+1 ) ker ρn = (πn+1 (N ) ∩ An+1 )MGn+1 (An+1 ), using (i). We conclude by Lemma 3.2 that πn+1 (N ) ≥ An+1 . Hence πn+1 (N ) ≥ ker ρn for all n ≥ n1 , so in fact N ≥ ker πn1 . In particular, N is open in G, showing that G is just infinite. Proof of Theorem 1.1. Let G be a just infinite profinite group and let An and Pn be as obtained in Theorem 4.1. Conditions (i) and (iii) of Theorem 4.1 together imply that An+1 > MGn+1 (An+1 ) = ker ρn and that ker ρn is a maximal Gn+1 -invariant subgroup of An+1 , so An+1 is a narrow normal subgroup of Gn+1 , as required for condition (ii) of the present theorem. The other two conditions are now clear. Thus G is the limit of an inverse system satisfying the given conditions. Conversely, let Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } be an inverse system of finite groups with subgroups An and Pn of Gn satisfying the given conditions, and let G = lim Gn . ←− Conditions (i) and (ii) together of the present theorem imply condition (i) of Theorem 4.1, and condition (iii) of the present theorem is condition (ii) of Theorem 4.1. Thus G is just infinite by Theorem 4.1. Remark 4.2. A similar statement was given in the original published version of this article ([8, Theorem 4.1]). However, the statement and proof given in [8] fail to take sufficient account of the kernels of the maps ρn . We rectify this issue here and in the results derived from Theorem 4.1 by explicitly imposing a condition on ker ρn . If G is pronilpotent, then all chief factors of Gn are central. But if G is not virtually pronilpotent, it could be helpful to replace condition (ii) of Theorem 4.1 with the stronger but easier-to-verify condition that An contains the centralizer of the chief factor Pn /MG (Pn ). Indeed, this can always be arranged, with some inevitable adjustments to the classes Cn . Definition 4.3. Given a profinite group G and a prime p, write Op (G) for the intersection of all normal subgroups of G of p-power index. Lemma 4.4. Let G be a finite group and let p be a prime. Suppose that all chief factors of G of exponent p are central, and that p does not divide the order of the Schur multiplier of any nonabelian composition factor of G. Then Op (G) has no composition factors of order p. 8 Proof. It suffices to show Op (G) < G whenever G has a composition factor of order p, as then one can repeat the argument for Op (G) and obtain the conclusion from the fact that Op (Op (G)) = Op (G). Let N be a normal subgroup of largest order such that Op (N ) < N . Suppose N < G, and let K/N be a minimal normal subgroup of G/N ; note that every G-chief factor of N/Op (N ) is central in G, so K/Op (N ) is an iterated central extension of K/N . If K/N is abelian, then [K, K] ≤ N , so K/Op (N ) is nilpotent. On the other hand, if K/N is nonabelian, then it is a direct power of a nonabelian finite simple group S, such that the Schur multiplier of S has order coprime to p; it follows that K/[K, K]Op (N ) is a nontrivial p-group. In either case Op (K) < K, contradicting the choice of N . We now specify a condition (∗) on classes of finite groups C: (∗) The class C consists of finite characteristically simple groups. For each prime p, if C contains some elementary abelian p-group, then within the class of finite groups, C contains all elementary abelian p-groups and all direct powers of all finite simple groups S such that p divides the Schur multiplier of S. Lemma 4.5. Let G be a just infinite profinite group that is not virtually pronilpotent and let H be an open subgroup of G. Let C be a class of groups satisfying (∗). Let D be the set of chief factors of G belonging to C, and suppose D is infinite. Then KCG (K/L) ≤ H for infinitely many K/L ∈ D. Proof. By Corollary 2.7, K ≤ H for all but finitely many chief factors K/L of G. It thus suffices to assume that, for all but finitely many K/L ∈ D, CG (K/L) is not contained in H, and derive a contradiction. As CG (K/L) is a normal subgroup of G, by Theorem 2.6 there are only finitely many T possibilities for the subgroups CG (K/L) that are not contained in H. Thus R = K/L∈D CG (K/L) has finite index in G. Moreover, given K/L ∈ D such that K ≤ R, then K/L is central in R and in particular abelian. Let N be the smallest G-invariant subgroup of R such that R/N has a G-chief series whose factors are all in D (equivalently, the intersection of all such subgroups). Then R/N is pronilpotent, which means G/N is virtually pronilpotent. As G itself is not virtually pronilpotent, it follows that N has finite index in G, so there is some K/L ∈ D with K ≤ N . As N centralizes all such chief factors, K/L is abelian, say of exponent p, while all nonabelian simple composition factors of N have Schur multipliers of order coprime to p. Thus, Op (N ) < N by Lemma 4.4. As Op (N ) is characteristic in N , it is normal in G. But then R/Op (N ) is an image of R with a G-chief series whose factors are all in D, contradicting the definition of N . Corollary 4.6. Let G be a just infinite profinite group that is not virtually pronilpotent, and let C1 , C2 , . . . be a sequence of classes of finite groups, all accounting for infinitely many chief factors of G. Suppose each class Cn also satisfies (∗). Then G is the limit of an inverse system of the form specified in Theorem 4.1, with the additional condition that CGn (Pn ) < An for all n. Proof. In the construction of the inverse system in Theorem 4.1, we were free to choose any chief factor R/S such that R ≤ L and R/S ∈ Cn+1 . It follows immediately from 9 Corollary 2.7 and Lemma 4.5 that there will be a choice for which CG (R/S) ≤ L and hence CG (K/MG (K)) ≤ L, where K is the associated narrow subgroup, which implies CGn (Pn ) < An in the inverse limit construction. The need for a condition like (∗) becomes clear when one considers an iterated transitive wreath product G of copies of some finite perfect group P with nontrivial centre. Although G is just infinite, has infinitely many abelian chief factors and is not virtually pronilpotent, all abelian chief factors of G are central factors. 5 Characterizations of the hereditarily just infinite property We can adapt Theorem 4.1 (using an idea from [10]) to obtain a universal construction for hereditarily just infinite groups. Definition 5.1. A finite group H is a central product of subgroups {Hi | i ∈ I} if these subgroups generate H, and whenever i 6= j then [Hi , Hj ] = 1. If H is a normal subgroup of a group G, we say H is a basal central product in G if in addition the groups {Hi | i ∈ I} form a conjugacy class of subgroups in G. Say H is centrally indecomposable if it cannot be expressed as a central product of proper subgroups, and basally centrally indecomposable in G if it cannot be expressed as a basal central product in G. Theorem 5.2. Let G be a hereditarily just infinite profinite group. Let C1 , C2 , . . . be a sequence of classes of finite groups, such that G has infinitely many chief factors in Cn for all n. Then G is the limit of an inverse system Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } as follows: Each Gn has a specified nontrivial normal subgroup An such that, setting Pn = ρn (An+1 ): (i) MGn+1 (An+1 ) ≥ ker ρn ≥ Pn+1 ; (ii) Each normal subgroup of Gn contains Pn or is contained in An (or both); (iii) Pn is a minimal normal subgroup of Gn ; (iv) Pn ∈ Cn for all n; (v) In Gn , every normal subgroup containing An is basally centrally indecomposable. Conversely, any inverse system satisfying conditions (i) and (ii) for all but finitely many n and (v) for infinitely many n has a limit that is hereditarily just infinite. Proof. Suppose that G is hereditarily just infinite with the specified chief factors. We will obtain an infinite descending chain (Kn )n≥0 of narrow subgroups of G as in the proof of Theorem 4.1, additionally ensuring that (v) will be satisfied. 10 Suppose that G is not virtually abelian; note that in this case, |H : [H, H]| is finite for every nontrivial normal subgroup H of G. Let K0 = G. Suppose Kn has been chosen for some n ≥ 0; let M = Ob∗G (M(Kn )), and let L be a normal subgroup of G properly contained in [M, M ]. As in the proof of Theorem 4.1, there is a chief factor R/S of G such that R ≤ L and R/S ∈ Cn , and Kn+1 Enar G associated to R/S. Then Kn+1 ≤ L and Kn+1 /MG (Kn+1 ) ∼ = R/S. Set Gn = G/MG (Kn+1 ), set Pn = Kn+1 /MG (Kn+1 ), set An = Kn /MG (Kn+1 ) and let the maps ρn be the natural quotient maps. If instead G is virtually abelian, then it is easy to see that in fact G has a unique largest abelian open normal subgroup N , such that CG (N ) = N ∼ = Zp for some prime p. Note that Cn must contain the cyclic group of order p. Let K0 = N and suppose Kn has been chosen for some n ≥ 0. Then there are open subgroups Ln and Kn+1 of Kn such that for all g ∈ G \ N we have [ObG (M(Kn )), hgi] ≥ Ln and [Ln , hgi] ≥ Kn+1 . (If G = N , we simply take Kn+1 = M(Kn ).) We then define Gn , Pn , An and ρn as before. In both cases, the inverse limit of (Gn , ρn ) is an infinite quotient of G, which is in fact equal to G since G is just infinite. Conditions (i)–(iv) are satisfied as in the proof of Theorem 4.1. Let {πn : G → Gn | n > 0} be the surjections associated to the inverse limit. We now prove by contradiction that (v) is satisfied. Let U be a normal subgroup of Gn containing An , and suppose U is a proper basal central product in Gn : say U is the normal closure of V , where V < U and the distinct Gn -conjugates of V centralize each other. Note that V is normal in U and hence normalized by An ; thus πn−1 (V ) is normalized by Kn . If G is not virtually abelian, then V is not contained in M(Kn ); it follows that πn−1 (V ) ≥ Ob∗G (M(Kn )). By the same argument, πn−1 (gV g −1 ) ≥ Ob∗G (M(Kn )) for every g ∈ G. Thus all Gn -conjugates of V contain the group πn (Ob∗G (M(Kn ))), which is nonabelian as a consequence of the choice of L. If G is virtually abelian, the existence of a nontrivial decomposition ensures that U is not cyclic of prime power order, so πn−1 (U ) 6≤ N . Thus πn−1 (U ) contains Kn and πn−1 (V ) contains some g ∈ G \ N . We then have πn−1 (V ) ≥ [Kn , hgi] ≥ Ln ; indeed πn−1 (hV h−1 ) ≥ Ln for all h ∈ Gn . The choice of Ln ensures that Ln /MG (Kn+1 ) is a noncentral subgroup of hV h−1 for all h ∈ Gn . T In either case we obtain a subgroup of h∈Gn hV h−1 that is not centralized by V , contradicting the hypothesis that the conjugates of V form a basal central decomposition of U . Thus (v) holds for all n > 0. Conversely, suppose we are given an inverse system satisfying (i) and (ii) for all n ≥ n0 > 1, and also (v) for infinitely many n. Let G be the inverse limit and let πn : G → Gn be the surjections associated to the inverse limit. Then G is just infinite by Theorem 4.1. As in the proof of Theorem 4.1, the groups π −1 (An ) for n ≥ n0 form a descending chain of open normal subgroups of G with trivial intersection. If G is not hereditarily just infinite, then it would have a nontrivial subgroup V of infinite index such that the distinct conjugates of V centralize each other: this is clear if G is virtually 11 abelian, and given by [10, 2.1] if G is not virtually abelian. Let U be the normal closure of V in G. Then for all but finitely many n, we see that πn−1 (An ) ≤ U and πn (V ) < πn (U ), so there exists n such that (v) holds, An ≤ πn (U ) and πn (V ) < πn (U ). But then πn (U ) is the normal closure of πn (V ) in Gn , and the distinct conjugates of πn (V ) centralize each other, contradicting (v). From this contradiction, we conclude that G is hereditarily just infinite. We derive a construction from [10] as a special case. (Actually the conclusion is slightly stronger than stated in [10]: the inverse limit is hereditarily just infinite, even if it is virtually abelian.) Theorem 5.3 (See Wilson [10, 2.2]). Let G be the inverse limit of a sequence (Hn )n≥0 of finite groups and surjective homomorphisms φn : Hn ։ Hn−1 . For each n ≥ 1 write Kn = ker φn , and suppose that for all L E Hn such that L  Kn the following assertions hold: (i) Kn < L; (ii) L has no proper subgroup whose distinct Hn -conjugates centralize each other and generate L. Then G is a hereditarily just infinite profinite group. Proof. After relabelling, we may assume that none of the homomorphisms Hn ։ Hn−1 are injective. Set Gn = H2n+2 ; Pn = ker φ2n+2 ; Qn = ker(φ2n+1 φ2n+2 ); An = ker(φ2n φ2n+1 φ2n+2 ). Notice that ρn := φ2n+3 φ2n+4 is a surjective homomorphism from Gn+1 to Gn with kernel Qn+1 . We see that every normal subgroup U of Gn containing An properly contains Pn , and hence by (ii), U is basally centrally indecomposable in Gn . Thus condition (v) of Theorem 5.2 is satisfied. Let M be a maximal Gn+1 -invariant subgroup of An+1 . Then M is not properly contained in Qn+1 ; by considering the quotient H2n+3 of Gn+1 and applying (i), we see that M ≥ Qn+1 . Thus MGn+1 (An+1 ) ≥ ker ρn ; clearly also ker ρn ≥ Pn+1 . Thus condition (i) of Theorem 5.2 is satisfied. Condition (ii) of Theorem 5.2 also follows from condition (i) of the present theorem. Hence by Theorem 5.2, G is hereditarily just infinite. For virtually pronilpotent groups, there is an alternative way to specialize Theorem 4.1 to a characterization of the hereditarily just infinite property, without having to check that a collection of normal subgroups are basally centrally indecomposable. We appeal to some results from [6]. Lemma 5.4. Let G be a profinite group with no nontrivial finite normal subgroups. (i) ([6, Lemma 4]) If G has a (hereditarily) just infinite open subgroup, then G is (hereditarily) just infinite. 12 (ii) ([6, Theorem 2]) If G is pro-p and Φ(G) is just infinite, then G is hereditarily just infinite. This leads naturally to our modified construction. Theorem 5.5. Let Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } be an inverse system of finite groups. Let Fn = Φ(Op (Gn )), let {1} < An E Fn and let Pn = ρn (An+1 ) for n > 0. Suppose that the following conditions hold for all n > 0: (i) MFn+1 (An+1 ) ≥ ker ρn ≥ Pn+1 ; (ii) Each normal subgroup of Fn contains Pn or is contained in An (or both); (iii) Fn+1 = ρ−1 n (Fn ); (iv) Every minimal normal subgroup of G1 is contained in F1 . Then G is hereditarily just infinite and virtually pro-p. Conversely, every hereditarily just infinite virtually pro-p group is the limit of such an inverse system. Proof. Suppose Λ is an inverse system as specified, with inverse limit G. Let F = Φ(Op (G)). By condition (iv), F = lim Fn and |G : F | = |G1 : F1 | < ∞, so F is ←− an open pro-p subgroup of G. Moreover, F is just infinite by Theorem 4.1. Let K be a nontrivial normal subgroup of G. If F ∩ K = {1}, then π1 (F K) = F1 × π1 (K) where π1 : G → G1 is the natural projection. Since ker π1 ≤ F , the group π1 (K) is nontrivial and we have a contradiction to (iv). Thus every nontrivial normal subgroup of G intersects F nontrivially, and is hence infinite; by Lemma 5.4 it follows that G is hereditarily just infinite. Now let G be a hereditarily just infinite virtually pro-p group. Let F = Φ(Op (G)). Then F is open in G and in particular just infinite. The construction of a suitable inverse system is analogous to that in the proof of Theorem 4.1. Choose R1 Enar F such that R1 ≤ M(Ob∗G (F )) and S1 to be the core of MF (R1 ) in G. Thereafter, choose Rn+1 Enar F such that Rn+1 ≤ ObF (MF (Sn )) and set Sn+1 to be the core of MF (Rn+1 ) in G. Set Gn = G/Sn+1 , An = Rn /Sn+1 and Pn = Rn+1 /Sn+1 . Then conditions (i) and (ii) are satisfied for the same reasons as in Theorem 4.1. The choice of S1 ensures conditions (iii) and (iv). 6 Further remarks on nonabelian chief factors Given a narrow normal subgroup A of G, there are some alternative descriptions of MG (A) in the case that A/MG (A) is either central in G or topologically perfect. Proposition 6.1. Let G be a profinite group and let 1 < A E G. (i) We have [A, MG (A)] ≤ M(A). If A/MG (A) is topologically perfect, then MG (A) = M(A). 13 (ii) Suppose A > M(A)[A, G]. Then A Enar G if and only if |A : M(A)[A, G]| is prime and every chief factor of G occurring as a quotient of A is central. If A Enar G then MG (A) = M(A)[A, G]. (iii) If G is pronilpotent, then MG (A) = M(A)[A, G]. Proof. (i) Let K be a normal subgroup of A such that A/K is a nonabelian simple group and let L be the core of K in G. Then A/L is isomorphic to a subdirect product of copies of A/K; since A/K is a nonabelian simple group, in fact A/L is isomorphic to a direct product of copies of A/K, say A/L = F1 × F2 × · · · × Fn where Fi ∼ = A/K. We see that K/L contains all but one of the simple direct factors of A/L, say K/L = F2 × · · · × Fn . Suppose MG (A)  L; then there exists M < A such that M is G-invariant and L < M . Then either F1  M/L, in which case M ≤ K, or else Fi  M/L for i > 1, in which case CG/L (M/L) is a nontrivial G-invariant subgroup of K/L. In either case we have a contradiction to the fact that L is the core of K in G. Thus in fact MG (A) ≤ L and in particular MG (A) ≤ K, showing that A/MG (A) accounts for all nonabelian simple quotients of A. The group A/M(A) is by construction a subdirect product of finite simple groups. From there, it is easily seen that in fact A/M(A) = Z(A/M(A))×P/M(A) where P/M(A) is perfect; indeed P/M(A) is a direct product of finite simple groups. Since A/MG (A) accounts for all nonabelian finite simple quotients, we must have MG (A)∩P ≤ M(A), so MG (A)/M(A) is central in A/M(A) as required. If A/MG (A) is topologically perfect, then there are no G-invariant subgroups N of A such that A/N is an abelian chief factor of G. Since P is characteristic in A and A/P is abelian, it follows that P = A and hence MG (A) = M(A). (ii) Let B = M(A)[A, G]. Then A/B is central in G/B and M(A/B) = 1, so A/B is residually an abelian simple group. If |A : B| is not prime, then A/B is of the form K1 /B ×K2 /B where K1 /B is of prime order and K2 /B is nontrivial. Thus K1 and K2 are proper subgroups of A normalized by G and K1 K2 = A. If instead there is a chief factor A/C of G that is not central, then [A, G] 6< C, so BC = A, but both B and C are proper subgroups of A. In either case A is not narrow in G. Now suppose |A : B| = p and that any chief factor of G of the form A/C is central. Let K < A such that A/K is a chief factor of G. Then A/K is a direct product of simple groups, so K ≥ M(A), and A/K ≤ Z(G/K), so K ≥ [A, G] and hence K ≥ B. Since |A : B| is prime, in fact we must have K = B. Thus every proper G-invariant subgroup of A is contained in B, in other words A Enar G with MG (A) = B. (iii) Suppose G is pronilpotent. Then every chief factor of G is central, so MG (A) ≥ [A, G]; clearly also MG (A) ≥ M(A), so MG (A) ≥ M(A)[A, G]. On the other hand, the quotient V = A/M(A)[A, G] is a central factor of G, such that every Sylow subgroup of V is elementary abelian; it then follows easily that for every nontrivial element v of V , there is some maximal subgroup W of V that does not contain v. Thus the G-invariant quotients of A of prime order separate elements of V , so MG (A) = M(A)[A, G]. We now give an inverse system characterization of a class of hereditarily just infinite groups that are not virtually prosoluble. The class obtained is less general than that 14 given by Theorem 5.2, but the conditions here are easier to check and still provide some interesting examples. Note that the conditions in brackets are automatic, by the positive answer to the Schreier conjecture; Theorem 6.2 has been stated in such a way to avoid using any deep results about finite simple groups. Proposition 1.3 will follow immediately given the positive answer to the Schreier conjecture. Theorem 6.2. Let Λ = {(Gn )n>0 , ρn : Gn+1 ։ Gn } be an inverse system of finite groups. Let An be a normal subgroup of Gn and set Pn = ρn (An+1 ) for n > 0. Suppose the following conditions hold for sufficiently large n: (i) M(An+1 ) = ker ρn ≥ Pn+1 ; (ii) An > CGn (Pn ); (iii) Pn is a direct product of nonabelian simple groups, such that Gn permutes the simple factors of Pn subprimitively by conjugation (and NGn (F )/F CGn (F ) is soluble for each simple factor F of Pn ). Then G = lim Gn is hereditarily just infinite and not virtually prosoluble. Moreover, ←− this construction accounts for all profinite groups G for which the following is true: (∗∗) G is just infinite, and there are infinitely many nonabelian chief factors R/S of G such that the simple factors of R/S are permuted subprimitively by conjugation in G/S (and such that NG/S (F )/F CG/S (F ) is soluble for each simple factor F of R/S). For the proof, we note a characterization of subprimitive actions. Lemma 6.3. Let G be a group acting on a set X. Then the following are equivalent: (i) G acts subprimitively on X; (ii) For every L E K E G, either L acts trivially on X, or L fixes no point in X. Proof. Let N be the kernel of the action of G on X. Suppose G acts subprimitively on X; let L E K E G, and let Y be the set of fixed points of L. Then Y is a K-invariant set; thus if Y is nonempty, then K/(K ∩ N ) acts faithfully on Y . Since L acts trivially on Y , we conclude that L ≤ K ∩ N , so L acts trivially on X. Thus (i) implies (ii). Conversely, suppose that G does not act subprimitively on X. Then there is a normal subgroup K and a K-orbit Y , such that K/(K ∩ N ) does not act faithfully on Y . The fixator L of Y in K is then a subgroup of G that acts nontrivially on X (since K ≥ L > K ∩ N ), has a fixed point in X and satisfies L E K E G. Thus (ii) implies (i). Proof of Theorem 6.2. Suppose Λ is an inverse system as specified, with inverse limit G; let πn : G → Gn be the associated projection map. By renumbering, we may assume that the given conditions hold for all n. Note that conditions (i) and (iii) imply that An is perfect and M(An ) = MGn (An ) for all n > 1. Condition (ii) ensures that Pn 15 is nontrivial; conditions (i) and (iii) then ensure that G has a composition series with infinitely many nonabelian factors, that is, G is infinite and not virtually prosoluble. We claim now that G is hereditarily just infinite. To prove this claim, it suffices to show (given Lemma 5.4) that every open normal subgroup of G is just infinite, that is, given any nontrivial subgroup H of G such that H E K Eo G for some K, then H is open in G. Letting Hn = πn (H), there exists n0 such that Hn is not contained in An , for all n ≥ n0 , so by condition (i), Hn does not centralize Pn . This implies Hn ∩ Pn is a nontrivial subnormal subgroup of Gn , which is therefore insoluble, so H cannot be prosoluble. Thus, the intersection I of the terms in the derived series of H is nontrivial. Clearly I is also normal in K, so without loss of generality we may assume H = I, that is, H is perfect. We can now draw a stronger conclusion about Hn for sufficiently large n: since Hn is perfect and not contained in Pn CGn (Pn ), the quotient Hn /(Hn ∩ Pn CGn (Pn )) is insoluble. This ensures that Hn acts nontrivially on the set Ωn of simple direct factors of Pn . Since Hn E πn (K) E Gn , it follows by Lemma 6.3 that Hn acts with no fixed points on Ωn and hence [Hn , Pn ] = Pn . In the case when H is normal in G, we conclude that Pn ≤ Hn for n sufficiently large. In particular, we must have Pn ≤ πn (K) for n sufficiently large. But then the fact that Hn is normal in πn (K) ensures that Pn normalizes Hn , so Pn ≤ Hn . It then follows that An+1 ≤ Hn+1 ker ρn = Hn+1 MGn+1 (An+1 ), so An+1 ≤ Hn+1 by Lemma 3.2; in particular, ker ρn ≤ Hn+1 for n sufficiently large, ensuring that H is open in G as desired. Conversely, let G be a profinite group satisfying (∗∗). As in previous proofs, we construct a descending chain (Kn ) of open normal subgroups of G. Let K0 = G. Suppose Kn has been chosen. Then M(Kn ) ≤o G by Lemma 2.4 so ObG (M(Kn )) ≤o G by Theorem 2.6. Given Lemma 3.3, we can find Kn+1 Enar G such that Kn+1 ≤ ObG (M(Kn )), Kn+1 /MG (Kn+1 ) is perfect, the simple factors of Kn+1 /MG (Kn+1 ) are permuted subprimitively by conjugation in G/MG (Kn+1 ), and the group of outer automorphisms induced by G on each simple factor is soluble; additionally MG (Kn+1 ) = M(Kn+1 ) by Proposition 6.1. Moreover, we have infinitely many choices for Kn+1 ; suppose that for allTbut finitely many of them, CG (Kn+1 /M(Kn+1 )) 6≤ M(Kn ). Then by Theorem 2.6, D = K CG (K/M(K)) would have finite index, where K ranges over all possible choices for Kn+1 . By Theorem 2.6 again, this would imply in turn that K ≤ D for all but finitely many choices of K, which is absurd given that K/M(K) is perfect and D centralizes K/M(K). We can therefore ensure CG (Kn+1 /M(Kn+1 )) ≤ M(Kn ). Now set Gn = G/M(Kn+1 ), set An = Kn /M(Kn+1 ), set Pn = Kn+1 /M(Kn+1 ) and let the maps ρn be the natural quotient maps Gn+1 → Gn . This produces an inverse system for G with all the required properties. Remark 6.4. A just infinite branch group G can certainly have infinitely many nonabelian chief factors. However, given condition (∗∗), the permutation action of G on the simple factors of a chief factor can only be subprimitive for finitely many of these chief factors. The following shows the flexibility of the conditions in Theorem 6.2. 16 Example 6.5. Let X0 be a finite set with at least two elements, let G−1 be a nontrivial subprimitive subgroup of Sym(X0 ), let S0 , S1 , . . . be a sequence of nonabelian finite simple groups and let F0 , F1 , . . . be a sequence of nontrivial finite perfect groups. Set G0 = S0 ≀X0 G−1 , that is, the wreath product of S0 with G−1 where the wreathing action is given by the natural action of G−1 on X0 . Thereafter Hn is constructed from Gn as Hn = Fn ≀Yn Gn , where the action of Gn on Yn is subprimitive and faithful, and Gn+1 is constructed from Hn as Gn+1 = Sn+1 ≀Xn+1 Hn where the action of Hn on Xn+1 is subprimitive and faithful. Set ρn : Gn+1 → Gn to be the natural quotient map from Sn+1 ≀Xn+1 (Fn ≀Yn Gn ) to Gn for n ≥ 0, and let G be the inverse limit arising from these homomorphisms. For n ≥ 0 set An+1 to be the kernel of the natural projection of Gn+1 onto Hn−1 ; thus An+1 is a direct product of |Xn | copies of Sn+1 ≀Xn+1 (Fn ≀Yn Sn ). We observe that An is perfect and M(An ) = ker ρn−1 . Moreover, Pn is a normal subgroup of G isomorphic to a power of Sn , with Gn permuting the copies of Sn subprimitively and CGn (Pn ) = {1}. Thus G is hereditarily just infinite by Theorem 6.2. Note the following: (i) Every nontrivial finite group can occur as the initial permutation group G−1 . There is also a great deal of freedom in the choice of the groups Fn , as there are general methods to embed a finite group as a ‘large’ subnormal factor of a finite perfect group. For instance if B is a finite group, then B ≀A5 hasQa perfect normal subgroup of the form K ⋊ A5 where K = {f : {1, 2, . . . , 5} → B | 5i=1 f (i) ∈ [B, B]}; clearly B appears as a quotient of K. The groups Fn could thus be chosen so that in the resulting inverse limit G, every finite group appears as a subnormal factor K/L, such that L E K E H E G. (ii) Provided the Sn or Fn are chosen to be ‘universal’ (that is, so that for every finite group F there are infinitely many n such that F embeds into Sn or Fn ), then every countably based profinite group Q embeds Q into every open subgroup of G, because G contains a closed subgroup n Sn × n Fn (take the ‘diagonal’ subgroup at each level of the wreath product). This gives an alternative proof of Theorem A of [10]. (iii) The group constructed by Lucchini in [4] is a special case of the construction under discussion, and indeed an example of the previous observation. This is especially interesting as Lucchini’s paper predates [10], and appears to be the earliest example in the literature of a hereditarily just infinite profinite group that is not virtually pro-p. (It is proven in [4] that the group is just infinite, but the hereditarily just infinite property is not considered.) (iv) There are exactly 2ℵ0 commensurability classes of groups in this family of examples. Consider for instance the set S of nonabelian finite simple groups occurring infinitely many times in a composition series for G. Then S only depends on G up to commensurability, but can be chosen to be an arbitrary nonempty subset of the set of all isomorphism classes of nonabelian finite simple groups. On the other hand there cannot be more than 2ℵ0 examples, since every just infinite profinite 17 group is countably based and there are only 2ℵ0 countably based profinite groups up to isomorphism. (v) There are interesting infinite ascending chains inside this family of examples. For instance, let Tk be the group formed in the inverse limit if one replaces Gk with Sk ≀Xk Sym(Xk ) in the construction and extends from there as before. Then G embeds naturally into Tk as an open subgroup, and if k′ > k then Tk embeds naturally into Tk′ as an open subgroup. Taking the direct limit of the groups Tk , one obtains a totally disconnected, locally compact group T . This group has a simple locally finite abstract subgroup A, formed as the union of the groups Alt(Xk ), where Alt(Xk ) ≤ Sym(Xk ) ≤ Tk . The smallest closed normal subgroup N of T containing A will then be a topologically simple open subgroup of T . We thus obtain a totally disconnected, locally compact, topologically simple group N such that every closed subgroup with open normalizer is open, but also (for a suitable choice of Sn or Fn as in (ii)) such that every identity neighbourhood in N contains a copy of every countably based profinite group as a closed subgroup. References [1] Y. Barnea, N. Gavioli, A. Jaikin-Zapirain, V. Monti and C. M. Scoppola, ‘Pro-p groups with few normal subgroups’, J. Alg. 321 (2009), 429–449. [2] A. Bereczky and A. Maróti, ‘On groups with every normal subgroup transitive or semiregular’, J. Alg. 319 (2008) 1733–1751. [3] G. Klaas, C. R. Leedham-Green and W. Plesken, Linear pro-p groups of finite width, Springer-Verlag Berlin Heidelberg, 1997. [4] A. Lucchini, ‘A 2-generated just-infinite profinite group which is not positively generated’, Israel J. Math. 141 (2004) 119–123. [5] C. E. Praeger, ‘An O’Nan–Scott theorem for finite quasiprimitive permutation groups and an application to 2-arc transitive graphs’, J. London Math. Soc. (2) 47 (1993) 227–239. [6] C. D. Reid, ‘Subgroups of finite index and the just infinite property’, J. Alg. 324 (2010), 2219–2222. [7] C. D. Reid, ‘On the structure of just infinite profinite groups’, J. Alg. 324 (2010), 2249–2261. [8] C. D. Reid, ‘Inverse system characterizations of the (hereditarily) just infinite property in profinite groups’, Bull. LMS vol 44, 3 (2012) 413–425. [9] C. D. Reid and P. R. Wesolek, ‘Chief factors in Polish groups’, arXiv:1509.00719v3 [10] J. S. Wilson, ‘Large hereditarily just infinite groups’, J. Alg. 324 (2010), 248–255. 18 [11] P. A. Zalesskii, ‘Profinite groups admitting just infinite quotients’, Monatsh. Math. 135 (2002), no. 2, 167–171. 19
4math.GR
On rescheduling due to machine disruption while to minimize the total weighted completion time∗ Wenchang Luo1,2 , Taibo Luo2,3 , Randy Goebel2 , and Guohui Lin2 1 2 Faculty of Science, Ningbo University. Ningbo, Zhejiang 315211, China. Department of Computing Science, University of Alberta. Edmonton, Alberta T6G 2E8, Canada. {wenchang,taibo,rgoebel,guohui}@ualberta.ca Business School, Sichuan University. Chengdu, Sichuan 610065, China. 3 arXiv:1701.07498v1 [cs.DS] 25 Jan 2017 Abstract We investigate a single machine rescheduling problem that arises from an unexpected machine unavailability, after the given set of jobs has already been scheduled to minimize the total weighted completion time. Such a disruption is represented as an unavailable time interval and is revealed to the production planner before any job is processed; the production planner wishes to reschedule the jobs to minimize the alteration to the originally planned schedule, which is measured as the maximum time deviation between the original and the new schedules for all the jobs. The objective function in this rescheduling problem is to minimize the sum of the total weighted completion time and the weighted maximum time deviation, under the constraint that the maximum time deviation is bounded above by a given value. That is, the maximum time deviation is taken both as a constraint and as part of the objective function. We present a pseudo-polynomial time exact algorithm and a fully polynomial time approximation scheme, the latter of which is the best possible given that the general problem is NP-hard. 1998 ACM Subject Classification Dummy classification – please refer to http://www.acm.org/ about/class/ccs98-html Keywords and phrases Rescheduling; machine disruption; total weighted completion time; approximation scheme Digital Object Identifier 10.4230/LIPIcs... 1 Introduction In most modern production industries and service systems, various kinds of disruptions will occur, such as order cancellations, new order arrivals, machine breakdown, and labor or material shortages. An ideal scheduling system is expected to effectively adjust an originally planned schedule to account for such disruptions, in order to minimize the effects of the disruption on overall performance. The extent of an alteration to the originally planned schedule, to be minimized, becomes either a second objective function (e.g., to model measurable costs), or is formulated as a constraint to model hard-to-estimate costs, which may be incorporated into to the original objective function. In this paper, we investigate the single machine scheduling problem with the objective to minimize the total weighted completion time. Rescheduling arises because of unexpected machine unavailability, which we represent as an unavailable time interval. This unavailability is revealed to the production planner after the given set of jobs has already been scheduled but processing has not begun. The production planner wishes to reschedule the jobs to ∗ This work was partially supported by NSERC Canada, Brain Canada, NSF China and CSC China. © Wenchang Luo, Taibo Luo, Randy Goebel and Guohui Lin; licensed under Creative Commons License CC-BY Leibniz International Proceedings in Informatics Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl Publishing, Germany XX:2 Rescheduling due to machine disruption minimize the alteration to the originally planned schedule, measured as the maximum time deviation between the original and the new schedules for all jobs. The maximum time deviation is taken both as a constraint and as part of the objective function; that is, the maximum time deviation is bounded above by a given value, and the new objective function is to minimize the sum of the total weighted completion time and the weighted maximum time deviation. 1.1 Problem description and definitions We formally present our rescheduling problem in what follows, including definitions and notation to be used throughout the paper. We are given a set of jobs J = {J1 , J2 , . . . , Jn }, where the job Jj has an integer weight wj and requires an integer non-preemptive processing time pj on a single machine, with the original objective to minimize the total weighted completion time. This problem is denoted Pn as (1 || j=1 wj Cj ) under the three-field classification scheme [4], where Cj denotes the completion time of the job Jj . It is known that the weighted shortest processing time (WSPT) Pn rule gives an optimal schedule for the problem (1 || j=1 wj Cj ). We thus assume that the jobs are already sorted in the WSPT order, that is, wp11 ≤ wp22 ≤ . . . ≤ wpnn , and we denote this order/schedule as π ∗ , referred to as the original schedule (also called the pre-planned schedule, or pre-schedule, in the literature). The rescheduling arises due to a machine disruption: the machine becomes unavailable in the time interval [T1 , T2 ], where 0 ≤ T1 < T2 . We assume, without loss of generality, that this information is known to us at time zero, so no job is yet processed. (Otherwise, one may remove those processed jobs from consideration, and for the partially processed job, either run it to completion and remove it, or stop processing it immediately.) Let σ be a schedule after resolving the machine disruption. That is, no job of J is processed in the time interval [T1 , T2 ] in σ. As in the existing literature, we use the following notation: for each job Jj , Sj (σ): the starting time of the job Jj in the schedule σ; Cj (σ): the completion time of the job Jj in the schedule σ, and thus Cj (σ) = Sj (σ) + pj ; Cj (π ∗ ): the completion time of the job Jj in the original schedule π ∗ ; ∆j (π ∗ , σ) = |Cj (σ) − Cj (π ∗ )|: the time deviation of the job Jj in the two schedules. Let ∆max (π ∗ , σ) , maxnj=1 {∆j (π ∗ , σ)} denote the maximum time deviation for all jobs. When it is clear from the context, we simplify the terms Sj (σ), Cj (σ), ∆j (π ∗ , σ) and ∆max (π ∗ , σ) to Sj , Cj , ∆j and ∆max , respectively. The time deviation of a job measures how much its actual completion time is off the originally planned, and thus it can model the penalties resulted from the delivery time change to the satisfaction of the customers, as well as the cost associated with the rescheduling of resources that are needed before delivery. In our problem, the time deviation is both taken as a constraint, that is ∆max ≤ k for a given upper bound k, and added to the objective Pn function to minimize µ∆max + j=1 wj Cj , for a given balancing factor µ ≥ 0. That is, the goal of rescheduling is to minimize the sum of the weighted maximum time deviation and the total weighted completion time. Thus, our problem is denoted as (1, h1 | ∆max ≤ k | Pn µ∆max + j=1 wj Cj ) under the three-field classification scheme [4], where the first field “1, h1 ” denotes a single machine with a single unavailable time period, the second field “∆max ≤ k” indicates the constraint on the maximum time deviation, and the last field is the objective function. Luo et al. version/27th January 2017 1.2 Related research We next review major research on the variants of the rescheduling problem, inspired by many practical applications. To name a few such applications, Bean et al. [2] investigated an automobile industry application, and proposed a heuristic match-up scheduling approach to accommodate disruptions from multiple sources. Zweben et al. [17] studied the GERRY scheduling and rescheduling system that supports Space Shuttle ground processing, using a heuristic constraint-based iterative repair method. Clausen et al. [3] considered a shipyard application, where the goal for rescheduling is to store large steel plates for efficient access by two non-crossing portal cranes that move the plates to appropriate places. Vieira et al. [12], Aytug et al. [1], Herroelen and Leus [8] and Yang et al. [13] provided extensive reviews of the rescheduling literature, including taxonomies, strategies and algorithms, for both deterministic and stochastic environments. In a seminal paper on rescheduling theory for a single machine, Hall and Potts [7] considered the rescheduling problem required to deal with the arrival of a new set of jobs, which disrupts the pre-planned schedule of the original jobs. Such a problem is motivated by the unexpected arrival of new orders in practical manufacturing systems. First, the set of original jobs has been optimally scheduled to minimize a cost function, typically the maximum lateness or the total completion time; but no job has yet been executed. In this case, promises have been made to the customers based on the schedule. Then an unexpected new set of jobs arrives before the processing starts; the production planner needs to insert the new jobs into the existing schedule seeking to minimize change to the original plan. The measure of change to the original schedule is the maximum or total sequence deviation, or the maximum or total time deviation. For both cases — where the measure of change is modeled only as a constraint, or where the measure of change is modeled both as a constraint and is added to the original cost objective — the authors provide either an efficient algorithm or an intractability proof for several problem variants. Yuan and Mu [15] studied a rescheduling problem similar to the one in [7], but with the objective to minimize the makespan subject to a limit on the maximum sequence deviation of the original jobs; they show that such a solution is polynomial time solvable. Hall et al. [5] considered an extension of the rescheduling problem in [7], where the arrivals of multiple new sets of jobs create repeated disruptions to minimize the maximum lateness of the jobs, subject to a limit on the maximum time deviation of the original jobs; they proved the NP-hardness and presented several approximation algorithms with their worst-case performance analysis. Hall and Potts [6] also studied the case where the disruption is a delayed subset of jobs (or called job unavailability), with the objective to minimize the total weighted completion time, under a limit on the maximum time deviation; they presented an exact algorithm, an intractability proof, a constant-ratio approximation algorithm, and a fully polynomial-time approximation scheme (FPTAS). Hoogeveen et al. [9] studied the case where the disruption is the arrival of new jobs and the machine needs a setup time to switch between processing an original job and processing a new job; their bi-criterion objective is to minimize the makespan and to minimize the maximum (or total) positional deviation or the maximum (or total) time deviation, with certain assumptions on the setup times. They presented a number of polynomial time exact algorithms and intractability proofs for several problem variants. Zhao and Yuan [16] examined the case where the disruption is the arrival of new jobs which are associated with release dates, formulated a bi-objective function to minimize the makespan and to minimize the total sequence deviation, under a limit on the total sequence deviation; they presented a strongly polynomial-time algorithm for finding all Pareto optimal points of the problem. XX:3 XX:4 Rescheduling due to machine disruption Liu and Ro [11] considered the same machine disruption as ours — the machine is unavailable for a period of time — but with the objective to minimize the makespan (or the maximum job lateness) and the weighted maximum time deviation, under a limit on the maximum time deviation; they presented a pseudo-polynomial time exact algorithm, a 2-approximation algorithm, and an FPTAS. Yin et al. [14] studies the rescheduling problem on multiple identical parallel machines with multiple machine disruptions, and the bi-criterion objective is to minimize the total completion time and to minimize the total virtual tardiness (or the maximum time deviation); in addition to hardness results, they presented a twodimensional FPTAS when there is exactly one machine disruption. Among all related research in the above, the work of Liu and Ro [11] is the most relevant to our work in terms of the scheduling environment, and the work of Hall and Potts [6] is the most relevant in terms of the original objective function. 1.3 Our contributions and organization Pn Our problem (1, h1 | ∆max ≤ k | µ∆max + j=1 wj Cj ) includes three interesting special cases, some of which have received attention in the literature: when the given bound k is sufficiently large, the time deviation constraint becomes void and our problem reduces to Pn the total cost problem (1, h1 || µ∆max + j=1 wj Cj ); when the time deviation factor µ = 0, our problem reduces to the constrained rescheduling problem, without the need to minimize the time deviation; and finally, when the given bound k is sufficiently large and the time deviation factor µ = 0, our problem reduces to the classic scheduling problem with a machine Pn unavailability period (1, h1 || j=1 wj Cj ) [10], which is NP-hard. The rest of the paper is organized as follows: In Section 2, we derive structural properties that are associated with the optimal solutions to our rescheduling problem (1, h1 | ∆max ≤ Pn k | µ∆max + j=1 wj Cj ). In Section 3, we present a pseudo-polynomial time exact algorithm. In Section 4, we first develop another slower pseudo-polynomial time exact algorithm solving Pn the special case where µ = 0, this is, the problem (1, h1 | ∆max ≤ k | j=1 wj Cj ). Based on this slower exact algorithm, we present an FPTAS for our general rescheduling problem. The FPTAS is an integration of a linear number of FPTASes. We conclude our paper in the last section, with some final remarks. 2 Preliminaries Firstly, from the NP-hardness of the classic scheduling problem with a machine unavailability Pn period (1, h1 || j=1 wj Cj ) [10], we conclude that our rescheduling problem (1, h1 | ∆max ≤ Pn k | µ∆max + j=1 wj Cj ) is also NP-hard. Recall that we are given a set of jobs J = {J1 , J2 , . . . , Jn }, where each job Jj has a positive weight wj and a positive processing time pj , in the WSPT order, a machine unavailability period [T1 , T2 ] with 0 ≤ T1 < T2 , an upper bound k on the maximum time deviation, and a balancing factor µ ≥ 0. All these wj ’s, pj ’s, T1 , T2 , k are integers, and µ is a rational number. For any feasible schedule σ to the rescheduling problem, from ∆max ≤ k we conclude that for every job Jj , Cj (π ∗ ) − k ≤ Cj (σ) ≤ Cj (π ∗ ) + k. For ease of presentation, we partition σ into two halves, similar to the existing literature: the prefix of the schedule σ with the jobs completed before or at time T1 is referred to as the earlier schedule of σ, and the suffix of the schedule σ with the jobs completed after time T2 is referred to as the later schedule of σ. We assume, without loss of generality, that with the same ∆max , all the jobs are processed as early as possible in σ (to achieve the minimum possible total weighted completion time). Let σ ∗ denote an optimal schedule to the rescheduling problem. Luo et al. version/27th January 2017 2.1 XX:5 Problem setting Let n n pmin , min pj , pmax , max pj , P , j=1 j=1 n X j=1 n pj , wmax , max wj , and W , j=1 n X wj . (1) j=1 Using the original schedule π ∗ = (1, 2, . . . , n), we compute j1 , min{j | Cj (π ∗ ) > T1 }, j2 , min{j | Sj (π ∗ ) ≥ T2 }, (2) i.e., Jj1 is the first job in π ∗ completed strictly after time T1 and Jj2 is the first job in π ∗ starting processing at or after time T2 . One clearly sees that if j1 is void, then no rescheduling is necessary; in the sequel, we always assume that the job Jj1 exists. Nevertheless we note that j2 could be void, which means that all the jobs start processing strictly before time T2 in π ∗ . We may furthermore assume the following relations hold among pmin , P, T1 , T2 and k, to ensure that the rescheduling problem is non-trivial: pmin ≤ T1 < P, and T2 − Sj1 (π ∗ ) ≤ k. (3) For a quick proof, firstly, if T1 < pmin , then no job can be processed before the machine unavailability period and thus the schedule π ∗ remains optimal except that the job processing starts at time T2 instead of time 0; secondly, if T1 ≥ P , then no rescheduling is necessary. Lastly, from the definition of the job Jj1 in Eq. (2), we conclude that at least one job among J1 , J2 , . . . , Jj1 must be completed after time T2 in any feasible rescheduling solution, with its time deviation at least T2 − Sj1 (π ∗ ). Therefore, T2 − Sj1 (π ∗ ) ≤ k, as otherwise no feasible solution exists. 2.2 Structure properties of the optimal schedules There is a very regular property of our target optimal schedules to the rescheduling problem, stated in the following lemma. I Lemma 1. There exists an optimal schedule σ ∗ for the rescheduling problem (1, h1 | Pn ∆max ≤ k | µ∆max + j=1 wj Cj ), in which (a) the jobs in the earlier schedule are in the same order as they appear in π ∗ ; (b) the jobs in the later schedule are also in the same order as they appear in π ∗ . Proof. By contradiction, assume (Ji , Jj ) is the first pair of jobs for which Ji precedes Jj in π ∗ , i.e. pi /wi ≤ pj /wj , but Jj immediately precedes Ji in the earlier schedule of σ ∗ . Let σ 0 denote the new schedule obtained from σ ∗ by swapping Jj and Ji . If Cj (σ 0 ) ≥ Cj (π ∗ ), then Ci (σ 0 ) ≥ Ci (π ∗ ) too, and thus ∆j (σ 0 , π ∗ ) ≤ ∆i (σ 0 , π ∗ ) < ∆i (σ ∗ , π ∗ ) due to pj > 0; if Cj (σ 0 ) < Cj (π ∗ ) and Ci (σ 0 ) ≤ Ci (π ∗ ), then ∆i (σ 0 , π ∗ ) ≤ ∆j (σ 0 , π ∗ ) < ∆j (σ ∗ , π ∗ ) due to pi > 0; lastly if Cj (σ 0 ) < Cj (π ∗ ) and Ci (σ 0 ) > Ci (π ∗ ), then ∆i (σ 0 , π ∗ ) < ∆i (σ ∗ , π ∗ ) and ∆j (σ 0 , π ∗ ) < ∆j (σ ∗ , π ∗ ). That is, σ 0 is also a feasible reschedule. Furthermore, the weighted completion times contributed by Ji and Jj in σ 0 is no more than those in σ ∗ , implying the optimality of σ 0 . It follows that, if necessary, after a sequence of job swappings, we will obtain an optimal reschedule in which the jobs in the earlier schedule are in the same order as they appear in π ∗ . The second part of the lemma can be similarly proved (see the Appendix A). J XX:6 Rescheduling due to machine disruption There are several more properties in the following Lemma 2, which are important to the design and analysis of the algorithms to be presented. Most of these properties also hold for the optimal schedules to a similar makespan rescheduling problem (1, h1 | ∆max ≤ k | µ∆max + Cmax ) [11]. We remark that the makespan is only a part of our objective, and the original schedule for the makespan scheduling problem (1, h1 | ∆max ≤ k | µ∆max + Cmax ) can be arbitrary. However, for our problem, the jobs in π ∗ are in the special WSPT order. Our goal is to compute an optimal schedule satisfying (the properties stated in) Lemmas 1 and 2, and thus we examine only those feasible schedules σ satisfying Lemmas 1 and 2. Recall that we assume, for every feasible schedule σ to the rescheduling problem with the same ∆max , all the jobs are processed as early as possible in σ (to achieve the minimum possible total weighted completion time). However this does not rule out the possibility that the machine would idle. In fact, the machine has to idle for a period of time right before time T1 , if no job can be fitted into this period for processing; also, the machine might choose to idle for a period of time and then proceeds to process a job, in order to obtain a smaller ∆max . In the sequel, our discussion is about the latter kind of machine idling. The good news is that there are optimal schedules in which the machine has at most one such idle time period, as shown in the following Lemma 2. This makes our search for optimal schedules much easier. I Lemma 2. There exists an optimal schedule σ ∗ for the rescheduling problem (1, h1 | Pn ∆max ≤ k | µ∆max + j=1 wj Cj ), in which (a) Cj (σ ∗ ) ≤ Cj (π ∗ ) for each job Jj in the earlier schedule; (b) the machine idles for at most one period of time in the earlier schedule; (c) each job in the earlier schedule after the idle time period is processed exactly ∆max time units earlier than in π ∗ ; (d) the jobs in the earlier schedule after the idle time period are consecutive in π ∗ ; (e) the job in the earlier schedule right after the idle time period has a starting time at or after time T2 in π ∗ ; (f) the machine does not idle in the later schedule; (g) the first job in the later schedule reaches the maximum time deviation among all the jobs in the later schedule. Proof. Item (a) is a direct consequence of Lemma 1, since the jobs in the earlier schedule are in the same order as they appear in π ∗ , which is the WSPT order. Proofs of (b)–(g) are similar to those in [11], where they are proven for an arbitrary original schedule, while the WSPT order is only a special order. For completeness, the proofs are included in the Appendix B. J Among the jobs J1 , J2 , . . . , Jj1 , we know that some of them will be processed in the later schedule of the optimal schedule σ ∗ . By Lemma 1, we conclude that the first job in the later schedule is from J1 , J2 , . . . , Jj1 . We use Ja to denote this job, and consequently (J1 , J2 , . . . , Ja−1 ) remains as the prefix of the earlier schedule. The time deviation of Ja is ∆a = T2 − Sa (π ∗ ) ≤ k (which could be used to further narrow down the candidates for Ja ). I Corollary 3. In an optimal schedule σ ∗ satisfying Lemmas 1 and 2, suppose the job Ja is the first job in the later schedule. For each j = a + 1, a + 2, . . . , j2 − 1, if the job Jj is in the earlier schedule, then its time deviation ∆j is less than ∆a . Proof. From the definition of j2 in Eq. (2), we know that Sj (π ∗ ) < T2 , and therefore its time deviation is ∆j < T2 − Sa (π ∗ ) = ∆a . J Luo et al. version/27th January 2017 3 XX:7 A dynamic programming exact algorithm In this section, we develop an exact algorithm DP-1 for the rescheduling problem (1, h1 | Pn ∆max ≤ k | µ∆max + j=1 wj Cj ), to compute an optimal schedule σ ∗ satisfying Lemmas 1 and 2. The key idea is as follows: By Lemma 2(g), we first guess the job Ja that starts processing at time T2 in σ ∗ , with its time deviation ∆a = T2 − Sa (π ∗ ) ≤ k. From this initial partial schedule,1 our algorithm constructs some feasible full schedules satisfying Lemmas 1 and 2. To guarantee that our algorithm constructs an optimal full schedule in pseudo-polynomial time, we use a “hash” function to map a partial schedule into a quadruple, such that only one partial schedule per quadruple is used in the computation, to be described in detail in the following. At the end, the full schedule with the minimum objective function value is returned as the solution σ ∗ . We notice from Lemmas 1 and 2(a) that the time deviations of the jobs in the earlier schedule of σ ∗ are non-decreasing, with the first (a − 1) ones being 0’s. From the constraint ∆max ≤ k, the last job in the schedule π ∗ that can possibly be in the earlier schedule of σ ∗ is Jj3 with j3 , max{j | Cj (π ∗ ) − k ≤ T1 }. (4) We use Pi to denote the total processing time of the first i jobs in π ∗ : Pi , i X pj , for i = 1, 2, . . . , n. (5) j=1 The exact algorithm DP-1 is a dynamic programming, that sequentially assigns the job Jj+1 to the partial schedules on the first j jobs J1 , J2 , . . . , Jj ; each such partial schedule is described (hashed) as a quadruple (j; `j , ej ; Zj ), where a ≤ j ≤ j3 , no machine idling period in the earlier schedule, `j is the total processing time of the jobs in the earlier schedule, ej is the index of the last job in the earlier schedule, and Zj is the total weighted completion time of the jobs in the partial schedule. Note that only one, though arbitrary, partial schedule is saved by DP-1 for each quadruple. For ease of presentation, we partition the jobs into four subsequences: J1 J2 J3 J4 = (J1 , J2 , . . . , Ja−1 ), = (Ja+1 , Ja+2 , . . . , Jj2 −1 ), = (Jj2 , Jj2 +1 , . . . , Jj3 ), = (Jj3 +1 , Jj3 +2 , . . . , Jn ). (6) From Lemma 1 and Eq. (4), we know that J1 is a prefix of the earlier schedule and J4 is a suffix of the later schedule, and thus DP-1 takes care of only the jobs of J2 ∪ J3 . Let Z(J1 ) denote the total weighted completion time of the jobs in J1 , and Z(J4 ) denote the total weighted completion time of the jobs in J4 by starting the job processing at time 0. The (only) starting partial schedule for DP-1 is described as (a; `a , ea ; Za ) = (a; Pa−1 , a − 1; Z(J1 ) + wa (T2 + pa )), (7) in which the job Ja starts processing at time T2 . In general, given a quadruple (j; `j , ej ; Zj ) with a ≤ j < j3 , that represents a partial schedule on the first j jobs, DP-1 assigns the next 1 In the entire paper, we examine only feasible partial schedules restricted to the considered jobs; these partial schedules can always be completed into certain feasible full schedules. XX:8 Rescheduling due to machine disruption job Jj+1 of J2 ∪ J3 as follows to generate at most three new partial schedules each described as a quadruple (j + 1; `j+1 , ej+1 ; Zj+1 ). Furthermore, if a non-empty machine idling period is inserted in the earlier schedule of a new partial schedule, then the partial schedule is directly completed optimally to a full schedule using Lemma 2(d). Case 1. Jj+1 is added in the later schedule to obtain a partial schedule described as: (j + 1; `j+1 , ej+1 ; Zj+1 ) = (j + 1; `j , ej ; Zj + wj+1 (T2 + Pj+1 − `j )), (8) in which Cj+1 = T2 + Pj+1 − `j . The feasibility holds since ∆j+1 ≤ ∆a by Lemma 2(g). Case 2. If Jj+1 can fit in the earlier schedule, that is `j + pj+1 ≤ T1 and Cj+1 (π ∗ ) − (`j + pj+1 ) ≤ k, then we add Jj+1 in the earlier schedule without inserting a machine idling period to obtain a feasible partial schedule described as: (j + 1; `j+1 , ej+1 ; Zj+1 ) = (j + 1; `j + pj+1 , j + 1; Zj + wj+1 (`j + pj+1 )), (9) in which Cj+1 = `j + pj+1 and ∆j+1 = Cj+1 (π ∗ ) − (`j + pj+1 ). From Corollary 3, for Jj+1 ∈ J2 we have ∆j+1 < ∆a and thus no need for checking the second inequality. Case 3. If `j + pj+1 < T1 and Cj+1 (π ∗ ) − (`j + pj+1 ) > max{∆ej , ∆a }, then we add Jj+1 in the earlier schedule and insert a non-empty machine idling period right before it. The following Lemma 4 states that the exact length of the machine idling period can be determined in O(n − j)-time, and during the same time, the partial schedule is directly optimally completed into a full schedule using Lemma 2(d). Lastly, for every quadruple (j; `j , ej ; Zj ) with j = j3 representing a partial schedule on the first j3 jobs, the algorithm DP-1 completes it by assigning all the jobs of J4 in the later schedule, starting at time T2 + Pj − `j , to obtain a full schedule described as the quadruple     n X (n; `n , en ; Zn ) = n; `j , ej ; Zj + Z(J4 ) +  wi  (T2 + Pj − `j ) , (10) i=j+1 for which the maximum time deviation is ∆max = max{∆en , ∆a } and the objective function value is Ẑn , µ max{∆en , ∆a } + Zn . (11) I Lemma 4. When the job Jj+1 is added in the earlier schedule of a partial schedule described as (j; `j , ej ; Zj ) and a non-empty machine idling period is inserted before it, then (a) the minimum possible length of this period is max{1, Cj+1 (π ∗ ) − (`j + pj+1 ) − k}; (b) the maximum possible length of this period is min{Cj+1 (π ∗ )−(`j +pj+1 )−max{∆ej , ∆a }, T1 − (`j + pj+1 )}; (c) the exact length can be determined in O(n − j)-time; (d) during the same time an optimal constrained full schedule is achieved directly. Proof. 1 is a trivial lower bound given that all job processing times are positive integers. Next, if Cj+1 (π ∗ ) − (`j + pj+1 ) > k, then we cannot process Jj+1 immediately at time `j as this would result in a time deviation greater than the given upper bound k; and the earliest possible starting time is Cj+1 (π ∗ ) − pj+1 − k, leaving a machine idling period of length Cj+1 (π ∗ ) − (`j + pj+1 ) − k. This proves item (a). The maximum possible length for the period is no more than Cj+1 (π ∗ ) − (`j + pj+1 ) − max{∆ej , ∆a }, for otherwise ∆j+1 would be less than max{∆ej , ∆a }. However, ∆j+1 < ∆ej contradicts Lemma 1 and Lemma 2(a) that suggest the jobs in the earlier schedule should Luo et al. version/27th January 2017 have non-decreasing time deviations; ∆j+1 < ∆a contradicts Lemma 2(c) that ∆max ≥ ∆a . Also, since Jj+1 is added to the earlier schedule, the length of the idling period has to be at most T1 − (`j + pj+1 ). This proves item (b). Let L = max{1, Cj+1 (π ∗ ) − (`j + pj+1 ) − k} and U = min{Cj+1 (π ∗ ) − (`j + pj+1 ) − max{∆ej , ∆a }, T1 − (`j + pj+1 )}. For each value i ∈ [L, U ], we 1) start processing Jj+1 at time `j + i, 2) then continuously process succeeding jobs in the earlier schedule until the one won’t fit in, and 3) lastly process all the remaining jobs in the later schedule. This gives a full schedule, denoted as π i , with the total weighted completion time denoted Zni , and the maximum time deviation ∆imax = ∆j+1 = Cj+1 (π ∗ ) − (`j + pj+1 ) − i. Its objective function value is Ẑni , µ∆imax + Zni . It follows that the interval [L, U ] can be partitioned into O(n − j) sub-intervals, such that for all values in a sub-interval say [i1 , i2 ], the jobs assigned to the earlier schedule are identical; and consequently the objective function value Ẑni is a linear function in i, where i1 ≤ i ≤ i2 . It follows that among all these full schedules, the minimum objective function value must be achieved at one of Ẑni1 and Ẑni2 . That is, we in fact do not need to compute the full schedules π i ’s with those i’s such that i1 < i < i2 , and consequently there are only O(n − j) full schedules to be computed. These sub-intervals can be determined as follows: when i = L, let the jobs fit into the earlier schedule after the machine idling period be Jj+1 , Jj+2 , . . . , Jj+s , then the first subinterval is [L, L + T1 − Cj+s ], where Cj+s is the completion time of Jj+s in the full schedule π i ; the second sub-interval is [L + T1 − Cj+s + 1, L + T1 − Cj+s−1 ]; the third sub-interval is [L + T1 − Cj+s−1 + 1, L + T1 − Cj+s−2 ]; and so on, until the last interval hits the upper bound U . The optimal length of the machine idling period is the one i∗ that minimizes Ẑni , among the O(n − j) computed full schedules, and we obtain a corresponding constrained optimal full schedule directly from the partial schedule described as the quadruple (j; `j , ej ; Zj ). J I Theorem 5. The algorithm DP-1 solves the rescheduling problem (1, h1 | ∆max ≤ k | Pn µ∆max + j=1 wj Cj ), with its running time in O(n3 T1 wmax (T2 + P )), where n is the number of jobs, [T1 , T2 ] is the machine unavailable time interval, P is the total job processing time, and wmax is the maximum weight of the jobs. Proof. In the above, we presented the dynamic programming algorithm DP-1 to compute a full schedule for each quadruple (n; `n , en ; Zn ) satisfying Lemmas 1 and 2, under the constraint that the job Ja starts processing at time T2 . The final output schedule is the one with the minimum Ẑn , among all the choices of Ja such that ∆a ≤ k. Its optimality lies in the quadruple representation for the partial schedules and the recurrences we developed in Eqs. (7–10). There are O(j1 ) choices for Ja , and for each Ja we compute a partial schedule for each quadruple (j; `j , ej ; Zj ), where a ≤ j ≤ j3 or j = n, Pa−1 ≤ `j ≤ T1 , a − 1 ≤ ej ≤ j, and Zj ≤ maxj wj (T2 + P ). Since one partial schedule leads to at most three other partial schedules, and each takes an O(1)-time to compute, the overall running time is O(n3 T1 wmax (T2 + P )). J 4 An FPTAS Pn The route to the FPTAS for the rescheduling problem (1, h1 | ∆max ≤ k | µ∆max + j=1 wj Cj ) is as follows: we first consider the special case where µ = 0, that is (1, h1 | ∆max ≤ k | Pn j=1 wj Cj ), where the maximum time deviation is only upper bounded by k but not taken as part of the objective function, and design another exact algorithm, denoted as DP-2, XX:9 XX:10 Rescheduling due to machine disruption using a different dynamic programming recurrence; then we develop from the algorithm DP-2 an FPTAS for the special case; lastly, we use the FPTAS for the special case multiple times to design an FPTAS for the general case. 4.1 Another dynamic programming exact algorithm for µ = 0 In this special case, we have stronger conclusions on the target optimal schedule σ ∗ than those stated in Lemma 2, one of which is that if there is a machine idling period in the earlier schedule of σ ∗ , then ∆max = k. This follows from the fact that we may start processing the jobs after the idling period one time unit earlier, if ∆max < k, to decrease the total weighted completion time. We conclude this in the following lemma. I Lemma 6. There exists an optimal schedule σ ∗ for the rescheduling problem (1, h1 | Pn ∆max ≤ k | j=1 wj Cj ), in which if the machine idles in the earlier schedule then ∆max = k. The new exact algorithm DP-2 heavily relies on this conclusion (and thus it does not work for the general case). DP-2 has a running time complexity worse than DP-1, but it can be readily developed into an FPTAS. The framework of the new algorithm DP-2 is the same, and we continue to use the notations defined in Eqs. (4–6). But now we use a new quadruple (j; `1j , `2j ; Zj ) to describe a partial schedule on the first j jobs, where a ≤ j ≤ j3 , no machine idling period in the earlier schedule, `1j is the maximum job completion time in the earlier schedule, `2j is the maximum job completion time in the later schedule, and Zj is the total weighted completion time of the jobs in the partial schedule. Starting with guessing Ja (from the pool J1 , J2 , . . . , Jj1 ) to be the job started processing at time T2 , such that ∆a = T2 − Sa (π ∗ ) ≤ k, the (only) corresponding partial schedule is described as the quadruple (a; `1a , `2a ; Za ) = (a; Pa−1 , T2 + pa ; Z(J1 ) + wa (T2 + pa )). (12) In general, given a quadruple (j; `1j , `2j ; Zj ) with a ≤ j < j3 representing a partial schedule on the first j jobs, the algorithm DP-2 assigns the next job Jj+1 of J2 ∪ J3 as follows to generate at most three new partial schedules each described as a quadruple (j + 1; `1j+1 , `2j+1 ; Zj+1 ). Furthermore, if a non-empty machine idling period is inserted in the earlier schedule of a new partial schedule, then it is directly completed optimally into a full schedule using Lemma 2(d). Case 1. Jj+1 is added in the later schedule to obtain a partial schedule described as: (j + 1; `1j+1 , `2j+1 ; Zj+1 ) = (j + 1; `1j , `2j + pj+1 ; Zj + wj+1 (`2j + pj+1 )), (13) in which Cj+1 = `2j + pj+1 . The feasibility holds since ∆j+1 ≤ ∆a by Lemma 2(g). Case 2. If Jj+1 can fit in the earlier schedule, that is `1j + pj+1 ≤ T1 and Cj+1 (π ∗ ) − 1 (`j + pj+1 ) ≤ k, then we add Jj+1 in the earlier schedule without inserting a machine idling period to obtain a feasible partial schedule described as: (j + 1; `1j+1 , `2j+1 ; Zj+1 ) = (j + 1; `1j + pj+1 , `2j ; Zj + wj+1 (`1j + pj+1 )), (14) in which Cj+1 = `1j + pj+1 and ∆j+1 = Cj+1 (π ∗ ) − (`1j + pj+1 ). From Corollary 3, for Jj+1 ∈ J2 we have ∆j+1 < ∆a and thus no need for checking the second inequality. Case 3. If `1j + pj+1 < Cj+1 (π ∗ ) − k ≤ T1 , then we add Jj+1 in the earlier schedule and insert a non-empty machine idling period of length Cj+1 (π ∗ ) − (`1j + pj+1 ) − k right before Luo et al. version/27th January 2017 XX:11 it. (That is, start processing Jj+1 at time Cj+1 (π ∗ ) − pj+1 − k.) Then continuously process succeeding jobs up to Jj3 in the earlier schedule, and lastly process all the remaining jobs in the later schedule. This gives a full schedule with the maximum time deviation ∆max = k, described as the quadruple (n; `1n , `2n ; Zn ), where `1n = Cj+1 (π ∗ ) − k + j3 X `2n = `2j + pi , i=j+1 n X pi , and i=j3 +1  Zn = Zj +Z({Jj+1 , . . . , Jj3 })+  j3 X   wi  (Cj+1 (π ∗ )−pj+1 −k)+Z(J4 )+  i=j+1 n X  wi  `2j , i=j+1 where Z({Jj+1 , . . . , Jj3 }) denotes the total weighted completion time of the jobs in {Jj+1 , . . ., Jj3 } by starting the job processing at time 0. Lastly, for every quadruple (j; `1j , `2j ; Zj ) with j = j3 representing a partial schedule on the first j3 jobs, the algorithm DP-2 completes it by assigning all the jobs of J4 in the later schedule, starting at time `2j , to obtain a full schedule described as the quadruple  n X (n; `1n , `2n ; Zn ) = n; `1j , `2j + i=j+1  pi ; Zj + Z(J4 ) +  n X   wi  `2j  , (15) i=j+1 for which the maximum time deviation is guaranteed to be no more than k. I Theorem 7. The algorithm DP-2 solves the rescheduling problem (1, h1 | ∆max ≤ k | Pn 2 2 j=1 wj Cj ) in O(n T1 wmax (T2 + P ) )-time, where n is the number of jobs, [T1 , T2 ] is the machine unavailable time interval, P is the total job processing time, and wmax is the maximum weight of the jobs. Proof. In the above, we see that the dynamic programming algorithm DP-2 computes a full schedule for each quadruple (n; `1n , `2n ; Zn ) satisfying Lemmas 1 and 2 and an extra property that if there is a machine idling period in the earlier schedule then ∆max = k, under the constraint that the job Ja starts processing at time T2 . The final output schedule is the one with the minimum Zn , among all the choices of Ja such that ∆a ≤ k. Similarly to the proof of Theorem 5, the optimality lies in the quadruple representation for the partial schedules and the recurrences we developed in Eqs. (12–15). There are O(j1 ) choices for Ja , and for each Ja we compute all partial schedules described as (j; `1j , `2j ; Zj ), where a ≤ j ≤ n, Pa−1 ≤ `1j ≤ T1 , T2 + pa ≤ `2j ≤ T2 + P , and Zj ≤ maxj wj (T2 + P ). Since one partial schedule leads to at most three other partial schedules, and each takes an O(1)-time to compute, the overall running time is O(n2 T1 wmax (T2 + P )2 ). J We remark that if the purpose is to compute an optimal schedule only, the algorithm DP-2 can be an order faster than the exact algorithm DP-1 in Theorem 5, by dropping the third entry `2j to run in O(n2 T1 wmax (T2 + P ))-time. 4.2 An FPTAS for µ = 0 In this subsection, we convert the exact algorithm DP-2 in the last subsection into an FPTAS by the sparsing technique. We assume the job Ja is scheduled to start processing at time T2 , and we have a positive real value  > 0. The algorithm is denoted as Approx(a, ), which guarantees to return a feasible schedule such that its total weighted completion time is within XX:12 Rescheduling due to machine disruption (1 + ) of the constrained optimum, under the constraint that the job Ja is scheduled to start processing at time T2 . Step 1. Set δ , (1 + /2n). (16) Note that a partial schedule is described as the quadruple (j; `1j , `2j ; Zj ), where a ≤ j ≤ n, `1j = 0 or pmin ≤ `1j ≤ T1 , T2 +pa ≤ `2j ≤ T2 +P , and Z(J1 )+wa (T2 +pa ) ≤ Zj ≤ Z(J )+W T2 , P where W , j wj is the total weight. Let L1 , U 1 (L2 , U 2 ; L3 , U 3 , respectively) denote the above lower and upper bounds on `1j (`2j ; Zj , respectively); let ri , blogδ (U i /Li )c, for i = 1, 2, 3, and split the interval [Li , U i ] into subintervals I1i = [Li , Li δ], I2i = (Li δ, Li δ 2 ], . . . , Irii = (Li δ ri , U i ], for i = 1, 2, 3. We define a three-dimensional box Bi1 ,i2 ,i3 , Ii11 × Ii22 × Ii33 , for (i1 , i2 , i3 ) ∈ ({0} ∪ [r1 ]) × [r2 ] × [r3 ], (17) where I01 , [0, 0] and [r] , {1, 2, . . . , r} for any positive integer r. Each j such that a ≤ j ≤ j3 or j = n is associated with a box Bi1 ,i2 ,i3 , denoted as j-Bi1 ,i2 ,i3 for simplicity, where (i1 , i2 , i3 ) ∈ ({0} ∪ [r1 ]) × [r2 ] × [r3 ]; all these boxes are initialized empty. Step 2. The starting partial schedule is described as (a; `1a , `2a ; Za ) in Eq. (12), which is then saved in the box a-Bi1 ,i2 ,i3 where `1a ∈ Ii11 , `2a ∈ Ii22 , and Za ∈ Ii33 . In general, for each non-empty box j-Bi1 ,i2 ,i3 with a ≤ j < j3 , denote the saved quadruple as (j; `1j , `2j ; Zj ), which describes a partial schedule on the first j jobs such that there is no machine idling period in the earlier schedule, `1j is the maximum job completion time in the earlier schedule, `2j is the maximum job completion time in the later schedule, and Zj is the total weighted completion time of the jobs in the partial schedule. The algorithm Approx(a, ) performs the same as the exact algorithm DP-2 to assign the next job Jj+1 of J2 ∪ J3 to generate at most three new partial schedules each described as a quadruple (j + 1; `1j+1 , `2j+1 ; Zj+1 ). Furthermore, if a non-empty machine idling period is inserted in the earlier schedule of a new partial schedule, then it is directly completed optimally into a full schedule (n; `1n , `2n ; Zn ) using Lemma 2(d). For each resultant (j + 1; `1j+1 , `2j+1 ; Zj+1 ) (the same for (n; `1n , `2n ; Zn )) the algorithm checks whether or not the box (j + 1)-Bi1 ,i2 ,i3 , where `1j+1 ∈ Ii11 , `2j+1 ∈ Ii22 , and Zj+1 ∈ Ii33 , is empty or not; if it is empty, then the quadruple is saved in the box, otherwise the box is updated to save the one having a smaller `1j+1 between the old and the new quadruples. Step 3. For each box n-Bi1 ,i2 ,i3 , where (i1 , i2 , i3 ) ∈ ({0} ∪ [r1 ]) × [r2 ] × [r3 ], if there is a saved quadruple (n; `1n , `2n ; Zn ), then there is a constrained full schedule with the total weighted completion time Zn . Here the constraint is that the job Ja starts processing at time T2 . The algorithm Approx(a, ) scans through all the boxes associated with n, and returns the quadruple having the smallest total weighted completion time, denoted as Zna . The corresponding constrained full schedule can be backtracked. I Theorem 8. Algorithm Approx(a, ) is a (1 + )-approximation for the rescheduling Pn problem (1, h1 | ∆max ≤ k | j=1 wj Cj ) under the constraint that the Ja starts processing at  4  time T2 ; its time complexity is O n3 log T1 log(T2 + P ) log(wmax P + W T2 ) . Luo et al. version/27th January 2017 XX:13 2∗ ∗ Proof. The proof of the performance ratio is done by induction. Assume that (a, `1∗ a , `a , Za ) → 1∗ 2∗ ∗ 1∗ 2∗ ∗ 1∗ 2∗ ∗ (a+1, `a+1 , `a+1 , Za+1 ) → . . . → (j3 , `j3 , `j3 , Zj3 ) → (n, `n , `n , Zn ) is the path of quadruples computed by the exact algorithm in Theorem 7 that leads to the constrained optimal solution Pn for the problem (1, h1 | ∆max ≤ k | j=1 wj Cj ). The induction statement is for each j, a ≤ j ≤ j3 or j = n, there is a quadruple (j; `1j , `2j ; Zj ) saved by the algorithm Approx(a, ), 2 2∗ j ∗ j such that `1j ≤ `1∗ j , `j ≤ `j δ , Zj ≤ Zj δ . The base case is j = a, and the statement holds since there is only one partial schedule on the first a jobs, described as (a, `1a , `1a , Za ) in Eq. (12). We assume the induction statement holds for j, where a ≤ j ≤ j3 , that is, there is a quadruple (j; `1j , `2j ; Zj ) saved by the algorithm Approx(a, ), such that 2 2∗ j ∗ j `1j ≤ `1∗ j , `j ≤ `j δ , and Zj ≤ Zj δ . (18) When j < j3 , from this particular quadruple (j; `1j , `2j ; Zj ), we continue to assign the job Jj+1 ∈ J2 ∪ J3 as in the exact algorithm in Subsection 4.1. In Case 1 where Jj+1 is added in the later schedule to obtain a partial schedule described as in Eq. (13), we have `1j+1 = `1j , `2j+1 = `2j + pj+1 , and Zj+1 = Zj + wj+1 (`2j + pj+1 )). (19) Assume this quadruple falls in the box j-Bi1 ,i2 ,i3 , then the quadruple (j + 1; `ˆ1j+1 , `ˆ2j+1 ; Ẑj+1 ) saved in this box by the algorithm Approx(a, ) must have `ˆ1j+1 ≤ `1j+1 , `ˆ2j+1 ≤ `2j+1 δ, and Ẑj+1 ≤ Zj+1 δ. (20) 2∗ ∗ 1∗ 2∗ ∗ If (j; `1∗ j , `j ; Zj ) leads to (j + 1; `j+1 , `j+1 ; Zj+1 ) also by adding Jj+1 in the later schedule, then we have 1∗ 2∗ 2∗ ∗ ∗ 2∗ `1∗ j+1 = `j , `j+1 = `j + pj+1 , and Zj+1 = Zj + wj+1 (`j + pj+1 )). (21) From Eqs. (18–21) and δ > 1, we have 2∗ j+1 ∗ ˆ2 , and Ẑj+1 ≤ Zj+1 δ j+1 . `ˆ1j+1 ≤ `1∗ j+1 , `j+1 ≤ `j+1 δ (22) Similarly, in Case 2 where Jj+1 is added in the earlier schedule without inserting a machine idling period to obtain a feasible partial schedule described as in Eq. (14), we can 2∗ ∗ 1∗ 2∗ ∗ show that if (j; `1∗ j , `j ; Zj ) leads to (j + 1; `j+1 , `j+1 ; Zj+1 ) also in this way, then there is a 1 2 saved quadruple (j + 1; `ˆ , `ˆ ; Ẑj+1 ) by the algorithm Approx(a, ) such that Eq. (22) j+1 j+1 holds. In Case 3 where `1j + pj+1 < Cj+1 (π ∗ ) − k ≤ T1 , Jj+1 is added in the earlier schedule, and a non-empty machine idling period of length Cj+1 (π ∗ ) − (`1j + pj+1 ) − k is inserted right before it, the algorithm continuously processes succeeding jobs up to Jj3 in the earlier schedule, and lastly process all the remaining jobs in the later schedule. When j = j3 , the algorithm completes the quadruple by assigning all the jobs of J4 in the later schedule, starting at time `2j , to obtain a full schedule described as in Eq. (15). We can similarly 2∗ ∗ 1∗ 2∗ ∗ 1∗ 2∗ ∗ show that if (j; `1∗ j , `j ; Zj ) leads to (n; `n , `n ; Zn ) directly, or if (j; `j , `j ; Zj ) leads to 2∗ ∗ 1∗ 2∗ ∗ (j + 1; `1∗ j+1 , `j+1 ; Zj+1 ), and so on, then eventually to (n; `n , `n ; Zn ), then there is also a 1 ˆ2 ˆ saved quadruple (n; `n , `n ; Ẑn ) by the algorithm Approx(a, ) such that Eq. (22) holds with n replacing j + 1. We therefore finish the proof of the induction statement. Lastly we use the inequality (1 + /2n)n ≤ 1 +  for 0 <  < 1 to bound the ratio δ n . That is, the total weighted completion time of the output full schedule by the algorithm Approx(a, ) is Zna ≤ Zn∗ δ n ≤ (1 + )Zn∗ . XX:14 Rescheduling due to machine disruption For the time complexity, note that for each j such that a ≤ j ≤ j3 or j = n, there are O(r1 r2 r3 ) boxes associated with it; for a saved quadruple (j; `1j , `2j ; Zj ), it takes O(1) time to assign the job Jj+1 , leading to at most three new quadruples (j + 1; `1j+1 , `2j+1 ; Zj+1 ), each is used to update the corresponding box associated with j + 1. It follows that the total running time is O(nr1 r2 r3 ). Note from the definitions of ri ’s, and log δ = log(1 + /2n) ≥ /4n, that O(nr1 r2 r3 ) ⊆ O(n4 /3 log T1 log(T2 + P ) log(wmax P + W T2 )). J Enumerating all possible O(n) choices of Ja , that is calling the algorithm Approx(a, ) O(n) times, the full schedule with the minimum Zna is returned as the final solution. The overall algorithm is denoted as Approx(). I Corollary 9. Algorithm Approx() is a (1 + )-approximation for the problem (1, h1 | Pn 5 ∆max ≤ k | j=1 wj Cj ); its time complexity is O n3 log T1 log(T2 + P ) log(wmax P + W T2 ) . 4.3 An FPTAS for the general case In this subsection, we derive an FPTAS for the general rescheduling problem (1, h1 | Pn ∆max ≤ k | µ∆max + j=1 wj Cj ) by invoking multiple times the approximation algorithm Approx(a, ) for the special case µ = 0. The job Ja starts processing at time T2 . It follows that the maximum time deviation is bounded ∆a ≤ ∆max ≤ k, and we use (1 + ) to split the interval [∆a , k] into subintervals I14 = [∆a , ∆a (1 + )], I24 = (∆a (1 + ), ∆a (1 + )2 ], . . . , Ir44 = (∆a (1 + )r4 , k], where r4 , blog1+ (k/∆a )c. Let ki = ∆a (1 + )i , for i = 1, 2, . . . , r4 , and kr4 +1 = k. Using ki as the upper bound on the maximum time deviation, that is, ki replaces k, our algorithm calls Approx(a, ) to solve Pn the problem (1, h1 | ∆max ≤ ki | j=1 wj Cj ), by returning a constrained full schedule of the total weighted completion time within (1 + ) of the minimum. We denote this full schedule as σ(a, ki ). The final output full schedule is the one of the minimum objective function value among {σ(a, ki ) | 1 ≤ a ≤ j1 , 1 ≤ i ≤ r4 + 1}, which is denoted as σ  with the objective function value Z  . We denote our algorithm as Approxµ (). I Theorem 10. Algorithm Approxµ () is a (1+)-approximation for the general rescheduling Pn problem (1, h1 | ∆max ≤ k | µ∆max + j=1 wj Cj ); its time complexity is  5  O n4 log T1 log(T2 + P ) log(wmax P + W T2 ) log k . Proof. Let σ ∗ denote an optimal schedule for the problem with the objective function value Z ∗ , satisfying Lemmas 1 and 2. Suppose the job starts processing at time T2 in σ ∗ is Ja , and the maximum time deviation in σ ∗ is ∆∗max = k ∗ ≤ k. We thus conclude that σ ∗ is also a constrained optimal schedule for the problem by replacing the upper bound k with k ∗ , i.e., Pn (1, h1 | ∆max ≤ k ∗ | µ∆max + j=1 wj Cj ), under the constraint that Ja starts processing at time T2 . Consider the value ki = ∆a (1 + )i such that ∆a (1 + )i−1 ≤ k ∗ ≤ ∆a (1 + )i . Clearly, for the schedule σ(a, ki ) found by the algorithm Approx(a, ) to the problem Pn (1, h1 | ∆max ≤ ki | j=1 wj Cj ), it has the total weighted completion time Z(σ) ≤ (1 + )Z(σ ∗ ) and the maximum time deviation ∆max (π ∗ , σ) ≤ ki ≤ k ∗ (1 + ). It follows that Z  ≤ µ∆max (π ∗ , σ) + Z(σ) ≤ µk ∗ (1 + ) + (1 + )Z(σ ∗ ) = (1 + )Z ∗ . Luo et al. version/27th January 2017 XX:15 Note that we call the algorithm Approx(a, ) for all possible values of a, and for each a we call the algorithm r4 + 1 = O( 1 log k) times (using the inequality log(1 + ) ≥ 12 ). Thus from Theorem 8 the total running time of the algorithm Approxµ () is in  5  n O log T1 log(T2 + P ) log(wmax P + W T2 ) log k . 4 J 5 Concluding remarks We investigated a rescheduling problem where a set of jobs has already been scheduled to minimize the total weighted completion time on a single machine, but a disruption causes the machine become unavailable for a given time interval. The production planner needs to reschedule the jobs without excessively altering the originally planned schedule. The degree of alteration is measured as the maximum time deviation for all the jobs between the original and the new schedules. We studied a general model where the maximum time deviation is taken both as a constraint and as part of the objective function. We presented a pseudo-polynomial time exact algorithm based on dynamic programming and an FPTAS. We remark that the FPTAS is developed from another slower exact algorithm for the special case where the maximum time deviation is not taken as part of the objective function, which gives us room to properly sample the maximum time deviation. Acknowledgments W.L. was supported by K. C. Wong Magna Found in Ningbo University, the China Scholarship Council (Grant No. 201408330402), and the Ningbo Natural Science Foundation (2016A610078). T.L. was supported by Brain Canada and NSF China (Grant Nos. 61221063 and 71371129). R.G. was supported by NSERC Canada. G.L. was supported by NSERC Canada and NSF China (Grant No. 61672323). XX:16 Rescheduling due to machine disruption References 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 H. Aytug, M. A. Lawley, K. McKay, S. Mohan, and R. Uzsoy. Executing production schedules in the face of uncertainties: A review and some future directions. European Journal of Operational Research, 161:86–110, 2005. J. C. Bean, J. R. Birge, J. Mittenthal, and C. E. Noon. Matchup scheduling with multiple resources, release dates and disruptions. Operations Research, 39:470–483, 1991. J. Clausen, J. Hansen, J. Larsen, and A. Larsen. Disruption management. OR/MS Today, 28:40–43, 2001. R. L. Graham, E. L. Lawler, J. K. Lenstra, and R. Kan. Optimization and approximation in deterministic sequencing and scheduling: A survey. Annuals of Discrete Mathematics, 5:287–326, 1979. N. G. Hall, Z. Liu, and C. N. Potts. Rescheduling for multiple new orders. INFORMS Journal on Computing, 19:633–645, 2007. N. G. Hall and C. N. Potts. Rescheduling for job unavailability. Operations Research, 58:746–755, 2004. N. G. Hall and C. N. Potts. Rescheduling for new orders. Operations Research, 52:440–453, 2004. W. Herroelen and R. Leus. Project scheduling under uncertainty: survey and research potentials. European Journal of Operational Research, 165:289–306, 2005. H. Hoogeveen, C. Lenté, and V. T’kindt. Rescheduling for new orders on a single machine with setup times. European Journal of Operational Research, 223:40–46, 2012. C.-Y. Lee. Machine scheduling with an availability constraint. Journal of Global Optimization, 9:395–416, 1996. Z. Liu and Y. K. Ro. Rescheduling for machine disruption to minimize makespan and maximum lateness. Journal of Scheduling, 17:339–352, 2014. G. E. Vieira, J. W. Herrmann, and E Lin. Rescheduling manufacturing systems: a framework of strategies, policies, and methods. Journal of Scheduling, 6:39–62, 2003. J. Yang, X. Qi, and G. Yu. Disruption management in production planning. Naval Research Logistics, 52:420–442, 2005. Y. Yin, T. C. E. Cheng, and D.-J. Wang. Rescheduling on identical parallel machines with machine disruptions to minimize total completion time. European Journal of Operational Research, 252:737–749, 2016. J. J. Yuan and Y. Mu. Rescheduling with release dates to minimize makespan under a limit on the maximum sequence disruption. European Journal of Operational Research, 182:936–944, 2007. Q. Zhao and J. J. Yuan. Pareto optimization of rescheduling with release dates to minimize makespan and total sequence disruption. Journal of Scheduling, 16:253–260, 2013. M. Zweben, E. Davis, B. Daun, and M. J. Deale. Scheduling and rescheduling with iterative repair. IEEE Transactions on Systems, Man and Cybernetics, 23:1588–1596, 1993. Luo et al. version/27th January 2017 A Proof of Lemma 1 Proof. (Item (b) of Lemma 1) By contradiction, assume (Ji , Jj ) is the first pair of jobs for which Ji precedes Jj in π ∗ , i.e. pi /wi ≤ pj /wj , but Jj immediately precedes Ji in the later schedule of σ ∗ . Let σ 0 denote the new schedule obtained from σ ∗ by swapping Jj and Ji . If Cj (σ 0 ) ≥ Cj (π ∗ ), then Ci (σ 0 ) ≥ Ci (π ∗ ) too, and thus ∆j (σ 0 , π ∗ ) ≤ ∆i (σ 0 , π ∗ ) < ∆i (σ ∗ , π ∗ ) due to pj > 0; if Cj (σ 0 ) < Cj (π ∗ ) and Ci (σ 0 ) ≤ Ci (π ∗ ), then ∆i (σ 0 , π ∗ ) ≤ ∆j (σ 0 , π ∗ ) < ∆j (σ ∗ , π ∗ ) due to pi > 0; lastly if Cj (σ 0 ) < Cj (π ∗ ) and Ci (σ 0 ) > Ci (π ∗ ), then ∆i (σ 0 , π ∗ ) < ∆i (σ ∗ , π ∗ ) and ∆j (σ 0 , π ∗ ) < ∆j (σ ∗ , π ∗ ). That is, σ 0 is also a feasible reschedule. Furthermore, the weighted completion times contributed by Ji and Jj in σ 0 is no more than those in σ ∗ , implying the optimality of σ 0 . If follows that, if necessary, after a sequence of job swappings we will obtain an optimal reschedule in which the jobs in the earlier schedule are in the same order as they appear in π ∗ . J B Proof of Lemma 2 Proof. Item (a) is a direct consequence of Lemma 1, since the jobs in the earlier schedule are in the same order as they appear in π ∗ , which is the WSPT order. That is, for the job Jj in the earlier schedule of σ ∗ , if all the jobs Ji , for i = 1, 2, . . . , j − 1, are also in the earlier schedule, then Cj (σ ∗ ) = Cj (π ∗ ); otherwise, Cj (σ ∗ ) < Cj (π ∗ ). For item (b), assume the machine idles before processing the jobs Jj1 and Jj2 , with Jj1 preceding Jj2 in the earlier schedule. We conclude from Lemma 1 and item (a) that if ∆j2 < ∆j1 ≤ ∆max (or ∆j1 < ∆j2 ≤ ∆max , respectively), then moving the starting time of the job Jj2 (Jj1 , respectively) one unit ahead will maintain the maximum time deviation and decrease the total weighted completion time, which contradicts the optimality of σ ∗ . It follows that we must have ∆j1 = ∆j2 ; in this case, if there is any job Jj with j1 < j < j2 in the later schedule, it can be moved to the earlier schedule to decrease the total weighted completion time, which again contradicts the optimality of σ ∗ . Therefore, there is no job Jj with j1 < j < j2 in the later schedule, which together with ∆j1 = ∆j2 imply that the machine does not idle before processing the job Jj2 . Item (c) is clearly seen for the same reason used in the last paragraph, that firstly their time deviations have to be the same, and secondly if this time deviation is less than ∆max , one can then move their starting time one unit ahead to decrease the total weighted completion time while maintaining the maximum time deviation, thus contradicting the optimality of σ∗ . Item (d) is implies by Item (c), given that all the job processing times are positive. Let the job in the earlier schedule right after the idle time period be Jj . clearly, there is a job Ja with Sa (π ∗ ) < Sj (σ ∗ ) in the later schedule of σ ∗ , due to the machine idling. The time deviation for Ja is ∆a > T2 − Sa (π ∗ ). If Sj (π ∗ ) < T2 , then ∆max = ∆j < T2 − Sj (σ ∗ ) < T2 − Sa (π ∗ ) < ∆a , a contradiction. This proves item (e) that Sj (π ∗ ) ≥ T2 . Item (f) is clearly seen from Lemma 1 and the optimality of σ ∗ , that if the machine idles then it can start processing the jobs after the idling period earlier to decrease the total weighted completion time, while maintaining or even decreasing the maximum time deviation. From item (f) and the second part of Lemma 1, we see that the deviation times of the jobs in the later schedule are non-increasing. Therefore, item (g) is proved. J XX:17
8cs.DS
To appear in IEEE Transactions on Automatic Control Stability of Fluid Queueing Systems with Parallel Servers and Stochastic Capacities arXiv:1604.02008v6 [math.OC] 16 Feb 2018 Li Jin and Saurabh Amin∗ February 19, 2018 Abstract This note introduces a piecewise-deterministic queueing (PDQ) model to study the stability of traffic queues in parallel-link transportation systems facing stochastic capacity fluctuations. The saturation rate (capacity) of the PDQ model switches between a finite set of modes according to a Markov chain, and link inflows are controlled by a state-feedback policy. A PDQ system is stable only if a lower bound on the time-average link inflows does not exceed the corresponding time-average saturation rate. Furthermore, a PDQ system is stable if the following two conditions hold: the nominal mode’s saturation rate is high enough that all queues vanish in this mode, and a bilinear matrix inequality (BMI) involving an underestimate of the discharge rates of the PDQ in individual modes is feasible. The stability conditions can be strengthened for two-mode PDQs. These results can be used for design of routing policies that guarantee stability of traffic queues under stochastic capacity fluctuations. Index terms: Traffic control, queueing systems, stability analysis, stochastic switching systems. 1 Introduction Capacity fluctuations in transportation systems can cause significant efficiency losses to the system operators [1]. In practice, these fluctuations can be frequent and also hard to predict deterministically [2, 3]. Thus, traffic control strategies that assume fixed (or nominal) link capacities may fail to limit the inefficiencies resulting from capacity fluctuations, especially when their intensity and/or frequency is non-negligible. In this note, we introduce a simple fluid queueing model with parallel links (servers) that accounts for stochastically varying capacities of individual links, and investigate its stability under a class of feedback control policies. Our analysis is based on known results on stability of continuous-time Markov processes [4, 5], and properties of piecewise-deterministic Markov processes (PDMPs) [6, 7]. 1 Current literature on control of transportation systems with uncertain link or node capacities either assumes a static (but uncertain) capacity model, or considers time-varying capacities [2, 8, 9]. In the former class of models, the actual capacity is assumed to lie in a known set [9], or is realized according to a given probability distribution [10]. Such models are useful for evaluating the system’s performance against worst-case disturbances. The latter class of models is motivated by situations where the capacity is inherently dynamic. These models can enable more accurate assessment of system performance in comparison to static models. In contrast to the above two classes, the model considered in this note is applicable to situations where the capacity can be modeled as a Markovian process [2, 11, 12]. Since we focus on the behavior of aggregate traffic flows, fluid queueing models are better suited to our objectives than the conventional queueing models (e.g. M/M/1) [2, 13]. Single server fluid queueing systems with stochastically switching saturation rates have been studied previously; see [8, 14, 15]. This line of work focuses on the analysis of the stationary distribution of queue length under a fixed inflow or an open-loop control policy. Some results are also available on feedback-controlled fluid queueing systems with stochastic capacities [2, 16]. However, to the best of our knowledge, stability of parallellink fluid queueing systems with uncertain capacities has not been considered before. In Section 2, we introduce the parallel-link fluid queueing model with a stochastically switching saturation rate vector. This model is called the piecewise-deterministic queueing (PDQ) model, since the saturation rate vector switches between a finite set of values, or modes, according to a Markov chain, while the evolution of queue lengths between mode switches is deterministic. Thus, our model belongs to the class of PDMPs [6]. An advantage of this model is that it can be easily calibrated using commonly available traffic data [3]. Furthermore, since the capacity and the queue lengths can be obtained using modern sensing technologies, this model can be used to design capacity-aware control policies. Our stability notion follows [4, 7] in that a PDQ system is stable if the joint distribution of its state (mode and queue lengths) converges to a unique invariant probability measure. Our analysis involves two assumptions: (i) the mode transition process is ergodic, and (ii) the feedback control policy is bounded and continuous in the queue lengths, and also satisfies a monotonicity condition to ensure that more traffic is routed through links with smaller queues. Under the above-mentioned assumptions, in Section 3, we derive a necessary condition (Theorem 1) and a sufficient condition (Theorem 2) for stability. The necessary condition is that, for every queue, a suitably defined lower bound on the time-average inflow does not exceed the corresponding link’s time-average saturation rate. The sufficiency result requires two conditions: (i) all queues eventually vanish in a “nominal” mode; and (ii) a lower bound on the discharge rate of the system in individual modes verify a bilinear matrix inequality (BMI). Condition (i) essentially ensures the uniqueness of the invariant measure, and Condition (ii) sets a lower bound on the total flow discharged from the system. Theorem 2 also provides an exponential convergence rate towards the invariant measure. The sufficient conditions for stability can be verified in a more straightforward manner in the case when the PDQ system has two modes (Proposition 1). Furthermore, 2 under a mode-responsive control policy the necessary and sufficient conditions for a twomode PDQ coincide (Proposition 2). Finally, in Section 4, we illustrate some applications of our results for designing stabilizing traffic routing policies in parallel-link networks with stochastic capacity fluctuations. 2 Piecewise-Deterministic Queueing System Consider the PDQ system in Figure 1 (left). A constant demand A ≥ 0 of traffic arrives at the system and is allocated P to n parallel servers. The inflow vector F (t) = [F1 (t), . . . , Fn (t)]T ∈ Rn≥0 is such that nk=1 Fk (t) = A for all t ≥ 0. Traffic can be temporarily stored in queueing buffers and discharged downstream. We denote the vector of queue lengths by Q(t) = [Q1 (t), . . . , Qn (t)]T . Let U (t) = [U1 (t), . . . , Un (t)]T denote the vector of stochastic saturation rates, where Uk (t) is the maximum rate at which the k-th server can release traffic at time t. Figure 1: Illustration of a PDQ system with n parallel servers (left) and the mode transition process (right). For the k-th server, if Qk (t) = 0 and Fk (t) ≤ Uk (t), the discharge rate Rk (t), i.e. the rate at which traffic departs from the system through the k-th server, is given by Rk (t) = Fk (t); otherwise Rk (t) = Uk (t). We assume infinite buffer sizes; i.e. Q(t) can take value in the set Q := Rn≥0 . This assumption enables us to account for all traffic arriving at the system and not just the traffic that is ultimately discharged by the system. In our model, the saturation rates of the n servers stochastically switch between a finite set of values. To model this switching process, we introduce the set of modes I of the PDQ system and let m = |I|. We denote the mode of the PDQ system at time t by I(t). Each mode i ∈ I is associated with a fixed saturation rate, denoted by ui = [ui1 , . . . , uin ]T , which is distinct for each mode. The evolution of I(t) is governed by a finite-state Markov process with state space I and constant transition rates {λij ; i, j ∈ I}. We assume that λii = 0 for all i ∈ I. Note that this is without loss of generality, since self-transitions do not change the saturation rate; thus, including them will not affect the PDQ dynamics. Let X νi := λij , (1) j∈I which is the rate at which the system leaves mode i. Given a fixed initial mode I0 ∈ I at t = T0 := 0, let {Tz ; z = 1, 2, . . .} be the epochs at which the mode transitions occur. Let 3 Iz−1 be the mode during [Tz−1 , Tz ) and Sz := Tz − Tz−1 . Then, Sz follows an exponential distribution with the cumulative distribution function (CDF): FSz (s) = 1 − e−νIz−1 s , z = 1, 2 . . . One can capture the transition rates in the m × m  −ν1 λ12 . . .  λ21 −ν2 . . .  Λ :=  .. .. ..  . . . λm1 λm2 . . . matrix:  λ1m λ2m   . ..  . −νm (2) (3) We assume the following about the mode transition process: Assumption 1. The Markov process {I(t); t ≥ 0} is ergodic. This assumption ensures that the process {I(t); t ≥ 0} converges to a unique steadystate distribution, i.e. a row vector p = [p1 , . . . , pm ] satisfying the following: pΛ = 0, |p|= 1, p ≥ 0, (4) where |·| is the 1-norm. We consider that the demand A is distributed across the n servers according to a state-feedback routing policy, which we denote as φ : I × Q → Rn≥0 . A routing policy is admissible if |φ(i, q)|= A for all (i, q) ∈ I × Q. For a given routing policy φ, the vector of discharge rates R(t) is specified by the vector-valued function rφ : I × Q → Rn≥0 with following components:  φk (i, q), q = 0, φk (i, q) ≤ uik , φ rk (i, q) := uik , o.w. k ∈ {1, . . . , n}; (5) i.e., for each t ≥ 0, we have Rk (t) = rkφ (I(t), Q(t)) ≤ Uk (t). Let us define a vector field Dφ : I × Q → Rn as follows: Dφ (i, q) := φ(i, q) − rφ (i, q). (6) Then, the evolution of the hybrid state (I(t), Q(t)) of the PDQ system is specified by the following dynamics: I(0) = i, Q(0) = q, (i, q) ∈ I × Q, Pr{I(t + δ) = j 0 |I(t) = j} = λjj 0 δ + o(δ), j 0 6= j,   dQ(t) = Dφ I(t), Q(t) , dt (7a) (7b) (7c) where δ is an infinitesimal time increment. Henceforth, we consider routing policies that satisfy the following assumption: 4 Assumption 2. The routing policy φ(i, q) = [φ1 (i, q), . . . , φn (i, q)]T is bounded and continuous in q. Furthermore, for k ∈ {1, . . . , n}, φk is non-increasing in qk , and nondecreasing in qh for h 6= k. The assumption of boundedness and continuity ensures that the Markov process {(I(t), Q(t)); t ≥ 0} is right continuous with left limits (RCLL, or càdlàg) [6]. Furthermore, since Q(t) is not reset after mode transitions, Q(t) is necessarily continuous in t. With the RCLL property, following [6, Theorem 5.5], the infinitesimal generator Lφ of a PDQ with an admissible routing policy φ satisfying Assumption 2 is given by T Lφ g(i, q) = Dφ (i, q) ∇q g(i, q)  X  + λij g(j, q) − g(i, q) , (i, q) ∈ I × Q, (8) j∈I where g is any function on I × Q smooth in the continuous argument. The assumption of monotonicity of controlled inflows with respect to queue lengths is practically relevant: more traffic is allocated to servers with smaller queues. In addition, this assumption ensures the existence of the following limits: ϕikh := lim φk (i, qh eh ), h, k ∈ {1, . . . , n}, i ∈ I, qh →∞ (9) where eh is the n-dimensional vector such that the h-th element is 1 and the others are 0. Particularly, the monotonicity of φ also implies that φk (i, q) ≥ ϕikk for all k ∈ {1, . . . , n} and all (i, q) ∈ I × Q. Many practically relevant routing policies satisfy Assumption 2. Examples include: 1. Mode-responsive routing policy: X φmod (i) = 1{j=i} ψkj , k k ∈ {1, . . . , n}, (10) j∈I where 1{·} is the indicator function, and ψki ≥ 0 for k ∈ {1, . . . , n} and i ∈ I. This policy can be viewed as simple re-direction of traffic during disruptions. 2. Piecewise-affine routing policy: n   o X φpwa (q) = min A, θ − α q + α q , kh h k kk k k h6=k k ∈ {1, . . . , n}, + (11) where αkh ≥ 0 for all k, h ∈ {1, . . . , n} and (·)+ indicates the positive part. This policy is an example of a queue-responsive traffic control policy. Note that θk can be interpreted as the “nominal” inflow sent to each server when no queue exists throughout the system, and the linear terms αkh qh as adjustment to these inflows that accounts for the queue lengths. 5 3. Logit routing policy: A exp(γk − βk qk ) Pn φlog , k ∈ {1, . . . , n}, k (q) = h=1 exp(γh − βh qh ) (12) where βk ≥ 0 for k ∈ {1, . . . , n}. This is a classical model of travelers’ route choice. One can interpret βk as sensitivity parameter that reflects travelers’ preference to the queue length in the k-th server, and γk the parameter governing travelers’ preference when every server has a zero queue. Note that the computation of the limiting inflows ϕikh is rather straightforward for the above-mentioned routing policies (see Section 4). Next, we introduce the notion of stability. The transition kernel [4] of a PDQ at time t ≥ 0 is a map Pt from I × Q to the set of probability measures on I × Q. Essentially, for an initial condition (i, q) ∈ I × Q and a measurable set E ⊆ I × Q, we have Pt ((i, q); E) = Pr{(I(t), Q(t)) ∈ E|I(0) = i, Q(0) = q}. One can also consider Pt as an operator acting on probability measures µ on I × Q via Z µPt (E) = Pt ((i, q); E)dµ. (13) I×Q An invariant probability measure [4] of a PDQ system with routing policy φ is a probability measure µφ such that µ φ Pt = µ φ , ∀t ≥ 0. Definition 1 (Stability [5, 7]). The PDQ system with routing policy φ is stable if there exists a probability measure µφ on I ×Q such that, for each initial condition (i, q) ∈ I ×Q, lim kPt ((i, q); ·) − µφ (·)kTV = 0, ∀(i, q) ∈ I × Q, t→∞ (14) where k·kTV is the total variation distance. Furthermore, the PDQ system is exponentially stable if it is stable and there exist constants B > 0 and c > 0, and a norm-like function1 W : I × Q → [1, ∞) such that, for any (i, q) ∈ I × Q, kPt ((i, q); ·) − µφ (·)kTV ≤ BW (i, q)e−ct , ∀t ≥ 0. (15) Finally, the PDQ system is said to be unstable if (14) does not hold. 3 Stability of Feedback-Controlled PDQs In this section, we study the stability of controlled PDQ systems. Our main results are Theorem 1 (a necessary condition for stability) and Theorem 2 (a sufficient condition for stability). 1 Following [4], W is norm-like if W (i, q) → ∞ as kqk→ ∞ for i ∈ I. 6 Theorem 1. Suppose that a PDQ system with n parallel servers is subject to a total demand A ∈ R≥0 and is controlled by an admissible policy φ. If the PDQ system is stable, then X X pi ϕikk ≤ pi uik , k ∈ {1, . . . , n}, (16) i∈I i∈I where pi are given by (4) and ϕikk are given by (9). Proof. Suppose that the PDQ system is stable. For each server k ∈ {1, . . . , n} and for each initial condition (i, q) ∈ I × Q, we obtain from (6) and (7c) that, for all t ≥ 0, Z t  φ φk (I(s), Q(s)) − rk (I(s), Q(s)) ds + qk . Qk (t) = 0 Since limt→∞ qk /t = 0, we have 1 0 = lim t→∞ t Z t  φk (I(s), Q(s)) − rkφ (I(s), Q(s)) ds 0 ! + qk − Qk (t) 1 = lim t→∞ t Z t  φk (I(s), Q(s)) − rkφ (I(s), Q(s)) ds 0 ! − Qk (t) . (17) Since the k-th queue is stable, for each initial condition (i, q) ∈ I×Q, Pr{limt→∞ Q(t) = ∞} = 0 (i.e. non-evanescence, see [4, pp. 524] for details), and we have limt→∞ Qk (t)/t = 0 a.s. Hence, we can rewrite (17) as Z  1 t φk (I(s), Q(s)) − rkφ (I(s), Q(s)) ds = 0, a.s. lim t→∞ t 0 Now we can make two observations. First, by Assumption 2 (monotonicity), we have φk (I(s), Q(s)) ≥ φk (I(s), Qk (s)ek ) I(s) ≥ lim φk (I(s), qk ek ) = ϕkk , ∀s ≥ 0. qk →∞ Secondly, recall that (5) implies rkφ (I(s), Q(s)) ≤ Uk (s) for s ≥ 0. Thus, we have Z  1 t 0 = lim φk (I(s), Q(s)) − rkφ (I(s), Q(s)) ds t→∞ t 0 7 1 ≥ lim t→∞ t Z t  I(s) ϕkk − Uk (s) ds. (18) 0 In addition, for every i ∈ I, let Mi (t) be the amount of time that the PDQ system is in mode i up to time t, i.e.: Z t 1{I(s)=i} ds. Mi (t) = 0 Then, under Assumption 1, we have Mi (t) = pi , a.s. ∀i ∈ I. t→∞ t lim Hence, Z  1 tX 1{I(s)=i} ϕikk ds = lim t→∞ t 0 0 i∈I X Mi (t) X pi ϕikk , a.s. = lim ϕikk = t→∞ t i∈I i∈I 1 lim t→∞ t Z t I(s) ϕkk ds (19) Similarly, we can obtain 1 lim t→∞ t Z t Uk (s)ds = X 0 pi uik , a.s. (20) i∈I Combining (18)–(20), we obtain (16). Theorem 1 provides a way of identifying unstable control policies. As argued in the proof, ϕikk is in fact the lower bound for φk (i, q) for all q ∈ Q. Hence, Theorem 1 essentially states that if the PDQ system is stable, then the (time-average) lower bound of the inflow does not exceed the average saturation rate. m T 1 ] as follows: , . . . , Rmin To introduce our next result, we define Rmin = [Rmin ! X i min{uih , ϕihk } , i ∈ I. (21) Rmin = min uik + k h:h6=k i One can interpret Rmin as a lower bound on the total discharge rate of the n servers in i mode i when at least one of the n servers has a non-zero queue. Our next result uses Rmin to provide a sufficient condition for the stability of feedback-controlled PDQ systems. Theorem 2. Suppose that a PDQ system of n parallel servers is subject to a total demand A ∈ R≥0 and is controlled by an admissible policy φ. Let the elements of the vector Rmin be as defined in (21). Then, the PDQ system is stable if ∃i∗ ∈ I, ∀k ∈ {1, . . . , n}, 8 ∗ φk (i∗ , 0) < uik , (22) and if ∃a = [a1 , . . . , am ]T ∈ Rm >0 , ∃b > 0,   diag(Ae − Rmin )b + Λ a ≤ −e, (23) where e is the m-dimensional vector of 1’s. Furthermore, under the above conditions, there exists a positive constant c = mini∈I 1/(2ai ) such that, for some B > 0,   i b|q| kPt ((i, q); ·) − µφ (·)kTV ≤ B a e + 1 e−ct , ∀(i, q) ∈ I × Q, ∀t ≥ 0, (24) where µφ is the unique invariant probability measure. The proof of Theorem 2 is based on a more general result [4, Theorem 6.1], which we recall here in the setting of PDQ systems. To conclude stability of the PDQ system, [4, Theorem 6.1] requires that the following two conditions hold: (A) For any two initial conditions (i, q), (j, `) ∈ I × Q, there exist δ > 0 and T > 0 such that kPT ((i, q); ·) − PT ((j, `); ·)kTV ≤ 1 − δ. (25) (B) There exist a norm-like function V : I × Q → R≥0 (called the Lyapunov function) and constants c > 0 and d < ∞ such that LV (i, q) ≤ −cV (i, q) + d, ∀(i, q) ∈ I × Q. (26) Condition (A) is required for the uniqueness of the invariant probability measure [17]. Condition (B) is usually referred to as the drift condition, which essentially ensures the existence of invariant probability measures [4, Theorem 4.5]. We are now ready to prove the theorem: Proof of Theorem 2. Suppose that (22) and (23) hold. We verify condition (A) (resp. (B)) using (22) (resp. (23)). Condition (A): Consider any initial condition (i0 , q0 ) ∈ I × Q. First, Assumption 1 ensures that the Markov process {I(t), Q(t); t ≥ 0} recurrently visits the mode i∗ . That is, for any X1 > 0, there exists σ > 0 such that Pr{I(X1 ) = i∗ |I(0) = i0 , Q(0) = q0 } = σ. (27) Furthermore, we can obtain from (7c) that Z |Q(X1 )| = q0 + X1  A− 0 n X k=1 9  rkφ (I(s), Q(s)) ds X1 Z A− ≤ |q0 |+ 0 n X rkφ (I(s), Q(s)) ds k=1 ≤ |q0 |+AX1 . (28) Secondly, in mode i∗ , the vector of queue length Q(t) necessarily converges to q ∗ = 0. To see this, consider mode i∗ and any q ∈ Q. For each k ∈ {1, . . . , n} such that qk = 0, by Assumption 2, we have φk (i∗ , q) ≥ φk (i∗ , 0), and thus ∗ rkφ (i∗ , q) = min{uik , φk (i∗ , q)} ∗ ≥ min{uik , φk (i∗ , 0)} = rkφ (i∗ , 0). (29) Therefore, for each q ∈ Q\{0}, we have n X Dkφ (i∗ , q) (6) = A− k=1 n X rkφ (i∗ , q) k=1 =A− X ∗ uik − ≤ A− ∗ X ≤A −  k∈{1,...,n} (22) < A− ∗  X φ rhφ (i∗ , 0) − rk (i∗ , 0) X uik + h:qh >0 h6=k min n X rkφ (i∗ , 0) k:qk =0  k:qk >0 X uik − k:qk >0 ≤ A − min rkφ (i∗ , q) k:qk =0 k:qk >0 (29) X ∗ uik + rkφ (i∗ , 0) X k:qk =0 rhφ (i∗ , 0)  h6=k (5)(22) = 0. k=1 One can see from (28) and (30) that there exists X2 = A − mink  |q0 |+AX1  P ∗ uik + h6=k rhφ (i∗ , q) such that Q(X1 + X2 ) = 0 if I(t) = i∗ for all t ∈ [X1 , X2 + X2 ). Note that Pr{I(t) = i∗ ; t ∈ [X1 , X1 + X2 )|I(X1 ) = i∗ } = e−νi∗ X2 . Thus, we have Pr{Q(X1 + X2 ) = 0|I(0) = i0 , Q(0) = q0 } ≥ σe−νi∗ X2 > 0, where σ satisfies (27). Hence, we have PX1 +X2 ((i0 , q0 ), {(i∗ , 0)}) ≥ σe−νi∗ X2 . 10 (30) Then, for any T ≥ X1 + X2 , we have PT ((i0 , q0 ), {(i∗ , 0)}) ≥ σe−νi∗ (T −X1 ) . X20 Thus, for arbitrary initial conditions (i, q) and (j, `), there exist σ 0 > 0, X10 > 0, > 0, and T 0 > 0 such that PT 0 ((i, q), {(i∗ , 0)}) ≥ σ 0 e−νi∗ (T 0 −X 0 ) 2 −νi∗ (T 0 −X20 ) PT 0 ((j, `), {(i∗ , 0)}) ≥ σ 0 e which verifies (25) with T = T 0 and δ = σ 0 e−νi∗ (T Condition (B): Consider the Lyapunov function V (i, q) = ai eb|q| , 0 −X 0 ) 2 , , . (i, q) ∈ I × Q, (31) where a1 , . . . , am , and b are positive constants. For each server k, by the definition of ϕikh (9), there necessarily exists Lk < ∞ such that, for all h 6= k, n o n o 1 i i i . (32) min uh , φh (i, Lk ek ) ≥ min uh , ϕhk − 2nb maxj∈I aj Let L = [L1 , . . . , Ln ]T . We claim that the constants 1 , 2 maxj∈I aj d := max|LV (i, L) + cV (i, L)|, c := (33a) (33b) i∈I verify the drift condition (26). Let us prove this claim. Plugging the Lyapunov function defined in (31) into the expression of the infinitesimal generator (8), we obtain LV (i, q) = n  X φk (i, q) −  rkφ (i, q) ai b k=1 ! + X λij (aj − ai ) eb|q| . (34) j∈I Then, to check (26), we need to consider two cases: Case I: q ∈ {ζ ∈ Q : 0 ≤ ζ ≤ L}. Since each such q’s are bounded, V (i, q) is also bounded. Hence, we can verify in a rather straightforward manner that, with c and d given by (33), LV ≤ −cV + d for all i ∈ I and 0 ≤ q ≤ L. Case II: q ∈ Q\{ζ ∈ Q : 0 ≤ ζ ≤ L}. For each such q, there necessarily exists a server k1 such that qk1 > Lk1 . For the k1 -th server, since qk1 > Lk1 ≥ 0, we have rkφ1 (i, q) = uik1 , ∀i ∈ I. 11 (35) For the other servers, i.e. for each h 6= k1 , we have n o (5) φ i rh (i, q) = min uh , φh (i, q) ≥ min{uih , φh (i, qk1 ek1 )} ≥ min{uih , φh (i, Lk1 ek1 )} (32) ≥ min{uih , ϕkh1 (i)} − 1 , ∀i ∈ I, 2nb maxj∈I aj (36a) (36b) where (36a) results from Assumption 2 (monotonicity). Combining (35) and (36b), we can write n o n X X 1 min uih , ϕkh1 (i) − rhφ (i, q) ≥ uik1 + 2b maxj∈I aj h=1 h:h6=k 1 (21) 1 . 2b maxj∈I aj i ≥ Rmin − (37) Then, n  X φk (i, q) −  rkφ (i, q) ai b + X λij (aj − ai ) j∈I k=1  (37) i ≤ A − Rmin + (23) ≤ −1 + 1 2b maxj∈I aj  ai b + X λij (aj − ai ) j∈I 1 1 =− . 2 2 Finally, (34) 1 (33a) (31) LV (i, q) ≤ − eb|q| ≤ −cai eb|q| = −cV. 2 Hence, (26) holds for all i ∈ I, all q ∈ Q\{q : 0 ≤ ζ ≤ L}, and all d ≥ 0. Thus, we have verified that the drift condition (26) holds for all (i, q) ∈ I × Q. Finally, note that we have verified conditions (A) and (B) for the controlled PDQ system. Thus, we obtain from [4, Theorem 6.1] that the PDQ system is exponentially stable. The condition (22) states that there exists a mode i∗ in which every queue decreases to zero. Practically, one can interpret i∗ as a “nominal” or “normal” mode in which the saturation rates are sufficiently high and satisfy (22). This condition leads to Condition (A). The condition (23) essentially imposes a lower bound on the total discharged flow from i the n servers, which is characterized by Rmin . This condition leads to Condition (B). To verify this condition, one needs to determine whether BMI (23) admits positive solutions for a1 , . . . , am and b. This can be done using the known computational methods to solve BMIs (see e.g. [18, 19]). 12 Remark 1. Using the exponential Lyapunov function (31), one can also apply [4, Theorem 4.3] to obtain that, under (23), for each initial condition (i, q) ∈ I × Q, we have Z 1 t lim sup E[e|Q(s)| ]ds < ∞. t t→∞ 0 That is, moments of the queue lengths are bounded. Furthermore, if the system has only two modes, solutions for b and a can be constructed in a more straightforward manner, which motivates the next result. Proposition 1. A PDQ system of n parallel servers with two modes {1, 2} and with an admissible control policy φ is stable if ∗ ∃i∗ ∈ {1, 2}, φk (i∗ , 0) < uik , k ∈ {1, 2}, (38) 1 2 A < p1 Rmin + p2 Rmin , (39) and if i is defined in (21). where Rmin Proof. First, let us define the following quantities  1 2 Dmin = min A − Rmin , A − Rmin ,  1 2 Dmax = max A − Rmin , A − Rmin , 1 2 D = A − (p1 Rmin + p2 Rmin ),  1 , 1, if Dmin = A − Rmin imin = 2, o.w.  1 , 2, if Dmin = A − Rmin imax = 1, o.w.  1 λ12 , if Dmin = A − Rmin , λmin = λ21 , o.w.  1 , λ21 , if Dmin = A − Rmin λmax = λ12 , o.w. (40a) (40b) (40c) (40d) (40e) (40f) (40g) Under (39), we explicitly construct constants aimin , aimax , and b satisfying the BMI (23). Condition (39) implies 1 2 A − p1 Rmin − p2 Rmin = pimin Dmin + pimax Dmax < 0 (41) Since Dmin ≤ Dmax , (41) implies that Dmin < 0. Thus, we only need to consider two cases: In the case that Dmin < 0, Dmax ≤ 0, we can select an arbitrary aimin > maxi {1/λi } and let aimax = 2aimin , b = 13 λmin aimin + 1 . −Dmin aimin (42) It is not hard to see that aimin , aimax , and b are positive and satisfy the BMI (23). In the case that Dmin < 0, Dmax > 0, we let (λ12 + λ21 )D , 2Dmin Dmax −Dmax b + λ12 + λ21 , aimin = det[diag(Ae − Rmin )b + Λ] −Dmin b + λ12 + λ21 aimax = . det[diag(Ae − Rmin )b + Λ] b= (43a) (43b) (43c) Now, we show that these constants are positive. First, note that (39) implies D < 0. Then, since Dmin < 0 and Dmax > 0, and since D < 0, b is positive. Secondly, to see that aimin > 0, note that diag(Ae − Rmin )b + Λ  1 )−λ b(A − Rmin 12 = λ21 λ12 2 )−λ b(A − Rmin 21  , and det[diag(Ae − Rmin )b + Λ]   1 2 = b2 A − Rmin A − Rmin   2 1 − λ12 b A − Rmin − λ21 b A − Rmin   1 2 = b2 A − Rmin A − Rmin − b(λ12 + λ21 )D = b2 Dmin Dmax − b(λ12 + λ21 )D. Again, since Dmin < 0 and Dmax > 0, one can check that the b given in (43a) ensures that det[diag(Ae − Rmin )b + Λ] > 0. In addition, note that (λ12 + λ21 )D 2Dmin Dmax   λ12 + λ21 −pimin Dmin − pimax Dmax = Dmax −2Dmin   λ12 + λ21 −pimin Dmin − pimax Dmin < Dmax −2Dmin λ12 + λ21 λ12 + λ21 = < , 2Dmax Dmax b= which, along with Dmax > 0, implies aimin > 0. Finally, since Dmin < 0, aimax is also positive. From (40d) and (40e), we know that  i 1 a min , if Dmin = A − Rmin , 1 a = imax a , o.w. 14 2  a = 1 , aimax , if Dmin = A − Rmin imin a , o.w. Let a = [a1 , a2 ]T . Then, one can check that a and b satisfy [diag(Ae − Rmin )b + Λ]a = −e, and thus satisfy the BMI (23). In addition, (38) is analogous to (22). Thus, we can conclude from Theorem 2 that the two-mode PDQ system is stable. In comparison to Theorem 2, Proposition 1 provides a simpler criterion (39) for stability of PDQ systems with two modes, since it does not involve solving a BMI. Furthermore, if a PDQ system with two modes is controlled by a mode-responsive routing policy (10), then we can obtain a necessary and sufficient condition for stability: Proposition 2. A system of n parallel servers two modes {1, 2} and with a moderesponsive routing policy φ given by (10) is stable if and only if p1 ψk1 + p2 ψk2 < p1 u1k + p2 u2k , ∀k ∈ {1, . . . , n}. (44) Proof. Since the system is controlled by a mode-responsive policy, the queues in various servers do not interact. Therefore, we can consider the n servers independently. For the k-th server, consider the Lyapunov function Vk (i, qk ) = aik exp(bk qk ), (i, q) ∈ {1, 2} × R≥0 with parameters [a1k , a2k ]T ∈ R2>0 and bk > 0. With this Lyapunov function, one can adapt the proof of Proposition 1 and conclude that the k-th server is stable if (44) holds. To obtain the necessity of (44), first note that the k-th server is unstable if p1 ψk1 + p2 ψk2 > p1 u1k + p2 u2k . Secondly, to argue that the k-th server is unstable if p1 ψk1 + p2 ψk2 = p1 u1k + p2 u2k , (45) one can first assume by contradiction the existence of an invariant probability measure µφ , and then consider µφ (I × {0}) to arrive at a contradiction to (45). In addition, for the setting of Proposition 2, expression for the invariant probability measure µφ has been reported in the literature [15], which makes possible analytical optimization of the routing policy. 4 Illustrative examples In this section, we demonstrate how our results can provide insights for traffic flow routing under stochastic capacity fluctuation. Consider a network of two parallel servers. The total inflow is A = 1. Our results in Section 3 can be applied to obtain stability conditions of this network. We particularly focus on the practically motivated routing policies given in (10)–(12). 15 4.1 A two-mode network Suppose that the network has two modes {1, 2} with symmetric transition rates λ12 = λ21 = 1. Thus, the steady-state probabilities are p1 = p2 = 0.5. The saturation rates in both modes are given as u1 = [1.2, 0.7]T and u2 = [0.2, 0.7]T . Thus, both servers have an average saturation rate of 0.7. 4.1.1 Mode-responsive routing For this two-mode system, the policy given by (10) can be parametrized by two constants ψ11 , ψ12 ∈ [0, 1] (note that admissibility requires ψ1i + ψ2i = 1 for i ∈ {1, 2}). By Proposition 2, the routing policy φmod is stabilizing if and only if 0.3 < (ψ11 + ψ12 )/2 < 0.7, ψ11 ∈ [0, 1], ψ12 ∈ [0, 1]. That is, the PDQ system is stable if and only if the average inflows into each server are less than their respective average saturation rate (note that (ψ11 +ψ12 )/2 > 0.3 is equivalent to (ψ21 + ψ22 )/2 < 0.7). 4.1.2 Piecewise-affine feedback routing Consider the policy given by (11). Admissibility requires α11 = α12 , α21 = α22 , and θ1 + θ2 = 1. Hence, we denote α1 = α11 = α12 and α2 = α21 = α22 . For k = 1, 2 and i ∈ {1, 2}, the expression of the limiting inflows (9) are as follows:  0, if αk > 0, i ϕkk = min{A, θk }, if αk = 0,  1, if αh > 0, i ϕkh = h 6= k. min{A, θk }, if αh = 0, Table 1 shows the necessary condition for stability given by Theorem 1 and the sufficient condition for stability given by Proposition 1. Note that the restriction on θk is stronger Table 1: Stability conditions (two modes, PWA routing). α1 =0 =0 >0 >0 α2 =0 >0 =0 >0 Necessary condition 0.3 ≤ θ1 ≤ 0.7 θ1 ≤ 0.7 θ1 ≥ 0.3 θ1 ∈ R Sufficient condition 0.3 < θ1 < 0.7 0.3 < θ1 < 0.7 θ1 > 0.3 θ1 > 0.3 if αk = 0. The intuition is that, if the routing policy is not responsive to the queue length in a server, then an appropriate selection of the nominal inflow θk is crucial to ensure stability. In addition, the structures of the stability conditions strongly depend on whether αk is zero, but not on the exact magnitude of αk . In this example, the gap between the necessary condition and the sufficient condition mainly results from the condition (22), which requires θ1 > 0.3. 16 4.1.3 Logit routing Now, consider the policy (12). For k = 1, 2, i ∈ {1, 2}, the limiting inflows are ( 0, if βk > 0, ϕikk = A exp(γk ) P2 , if βk = 0, exp(γh ) ( h=1 A, if βh > 0, ϕikh = h 6= k. A exp(γk ) P2 , if βh = 0, exp(γ ) h=1 (46a) (46b) h Again, we can obtain a stability conditions from Theorem 1 and Proposition 1. Table 2 Table 2: Stability conditions (two modes, logit routing). β1 =0 =0 >0 >0 β2 =0 >0 =0 >0 Necessary condition |γ1 − γ2 |≤ log(7/3) γ1 − γ2 ≤ log(7/3) γ1 − γ2 ≥ − log(7/3) γ1 ∈ R, γ2 ∈ R Sufficient condition |γ1 − γ2 |< log(7/3) implies that the constants γk have a stronger impact on stability of the PDQ system than the coefficients βk capturing the sensitivity to queue lengths. Once again, the gap between the necessary condition and the sufficient condition results from (22), which requires |γ1 − γ2 |< log(7/3). 4.2 A three-mode network Suppose that the network has three modes {1, 2, 3} with symmetric transition rates λij = 1 for all i, j ∈ I. Thus, the steady-state probabilities are p1 = p2 = p3 = 1/3. The saturation rates in the three modes are u1 = [1.2, 0.7]T , u2 = [0.7, 0.7]T , and u3 = [0.2, 0.7]T ; i.e. the average saturation rates are equal to those in the two-mode case. The main difference between the analysis in this subsection and that in the previous subsection is that the sufficient conditions for stability below are obtained numerically (in terms of solving the BMI (23)) instead of analytically. 4.2.1 Mode-responsive routing For ease of presentation, we assume that ψk2 = ψk3 for k ∈ {1, 2}. The limiting inflows ϕikh are given by ϕikh = ψki , h ∈ {1, 2}, k ∈ {1, 2}, i ∈ I. Theorem 1 gives a necessary condition for stability: 0.3 ≤ 1/3ψ11 + 2/3ψ12 ≤ 0.7, 17 (47) whose complement is the “Unstable” region in Figure 2. Figure 2 also shows a “Stable” region obtained from Theorem 2; the BMI (23) is solved using YALMIP [19]. In contrast to the two-mode case, there is an “Unknown” region between the “Stable” and “Unstable” regions, due to the gap between the necessary condition (Theorem 1) and the sufficient condition (Theorem 2). 1 Unstable Unknown 0.8 ω2 0.6 0.4 Stable 0.2 Unstable 0 0 0.2 0.4 0.6 0.8 1 ω1 Figure 2: Stability of various (ψ11 , ψ12 ) pairs. 4.2.2 Queue-responsive routing policies For the piecewise-affine routing policy (11) and the logit routing policy (12), Tables 3 Table 3: Stability conditions (three modes, PWA routing). α1 =0 =0 >0 >0 α2 =0 >0 =0 >0 Necessary condition 0.3 ≤ θ1 ≤ 0.7 θ1 ≤ 0.7 θ1 ≥ 0.3 θ1 ∈ R Sufficient condition 0.41 ≤ θ1 ≤ 0.59 0.41 ≤ θ1 ≤ 0.59 θ1 ≥ 0.36 θ1 > 0.3 Table 4: Stability conditions (three modes, logit routing). β1 =0 =0 >0 >0 β2 =0 >0 =0 >0 Necessary condition |γ1 − γ2 |≤ log(7/3) γ1 − γ2 ≤ log(7/3) γ1 − γ2 ≥ − log(7/3) γ1 ∈ R, γ2 ∈ R Sufficient condition |γ1 − γ2 |≤ log 1.7 and 4 show the stability conditions. In comparison to the two-mode case, the necessary conditions are unchanged, but the sufficient conditions in the three-mode case are more restrictive. This indicates that the sufficient condition becomes more restrictive as the number of modes (and thus the number of bilinear inequality constraints) increases. 18 Acknowledgments This work was supported by NSF CNS-1239054 CPS Frontiers, NSF CAREER Award CNS-1453126, and AFRL Lablet-Secure and Resilient Cyber-Physical Systems. We are deeply grateful for the insightful comments from the three anonymous reviewers and the associate editor. References [1] J. Kwon, M. Mauch, and P. Varaiya, “Components of congestion: Delay from incidents, special events, lane closures, weather, potential ramp metering gain, and excess demand,” Transportation Research Record: Journal of the Transportation Research Board, vol. 1959, no. 1, pp. 84–91, 2006. [2] M. D. Peterson, D. J. Bertsimas, and A. R. Odoni, “Models and algorithms for transient queueing congestion at airports,” Management Science, vol. 41, no. 8, pp. 1279– 1295, 1995. [3] L. Jin and S. Amin, “Calibration of a macroscopic traffic flow model with stochastic saturation rates,” in Transportation Research Board 96th Annual Meeting, 2017. [4] S. P. Meyn and R. L. Tweedie, “Stability of Markovian processes III: Foster-Lyapunov criteria for continuous-time processes,” Advances in Applied Probability, pp. 518–548, 1993. [5] B. Cloez, M. Hairer, et al., “Exponential ergodicity for Markov processes with random switching,” Bernoulli, vol. 21, no. 1, pp. 505–536, 2015. [6] M. H. A. Davis, “Piecewise-deterministic Markov processes: A general class of non-diffusion stochastic models,” Journal of the Royal Statistical Society. Series B. Methodological, vol. 46, no. 3, pp. 353–388, 1984. [7] M. Benaı̈m, S. Le Borgne, F. Malrieu, and P.-A. Zitt, “Qualitative properties of certain piecewise deterministic Markov processes,” in Annales de l’Institut Henri Poincaré, Probabilités et Statistiques, vol. 51, pp. 1040–1075, Institut Henri Poincaré, 2015. [8] D. Anick, D. Mitra, and M. M. Sondhi, “Stochastic theory of a data-handling system with multiple sources,” The Bell System Technical Journal, vol. 61, no. 8, pp. 1871– 1894, 1982. [9] G. Como, K. Savla, D. Acemoglu, M. A. Dahleh, and E. Frazzoli, “Robust distributed routing in dynamical networks Part I: Locally responsive policies and weak resilience,” Automatic Control, IEEE Transactions on, vol. 58, no. 2, pp. 317–332, 2013. 19 [10] G. D. Glockner and G. L. Nemhauser, “A dynamic network flow problem with uncertain arc capacities: Formulation and problem structure,” Operations Research, vol. 48, no. 2, pp. 233–242, 2000. [11] M. Baykal-Gürsoy, W. Xiao, and K. Ozbay, “Modeling traffic flow interrupted by incidents,” European Journal of Operational Research, vol. 195, no. 1, pp. 127–138, 2009. [12] L. Jin and S. Amin, “A piecewise-deterministic Markov model of freeway accidents,” in Decision and Control (CDC), 2014 IEEE 53rd Annual Conference on, IEEE, 2014. [13] G. F. Newell, Applications of Queueing Theory, vol. 4. Springer Science & Business Media, 2013. [14] H. Chen and D. D. Yao, “A fluid model for systems with random disruptions,” Operations Research, vol. 40, no. 3-supplement-2, pp. S239–S247, 1992. [15] V. G. Kulkarni, “Fluid models for single buffer systems,” Frontiers in queueing: Models and applications in science and engineering, vol. 321, p. 338, 1997. [16] H. Yu and C. G. Cassandras, “Perturbation analysis of feedback-controlled stochastic flow systems,” IEEE Transactions on Automatic Control, vol. 49, no. 8, pp. 1317– 1332, 2004. [17] J. G. Dai and S. P. Meyn, “Stability and convergence of moments for multiclass queueing networks via fluid limit models,” IEEE Transactions on Automatic Control, vol. 40, no. 11, pp. 1889–1904, 1995. [18] J. G. VanAntwerp and R. D. Braatz, “A tutorial on linear and bilinear matrix inequalities,” Journal of process control, vol. 10, no. 4, pp. 363–385, 2000. [19] J. Löfberg, “YALMIP: A toolbox for modeling and optimization in MATLAB,” in Computer Aided Control Systems Design, 2004 IEEE International Symposium on, pp. 284–289, IEEE, 2004. 20
3cs.SY
arXiv:1509.09314v2 [math.GT] 18 May 2016 TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY OF COCOMPACT CAT(0) SPACES DEVIN MURRAY Abstract. Let X be a proper CAT(0) space and let G be a cocompact group of isometries of X which acts properly discontinuously. Charney and Sultan constructed a quasi-isometry invariant boundary for proper CAT(0) spaces which they called the contracting boundary. The contracting boundary imitates the Gromov boundary for δ-hyperbolic spaces. We will make this comparison more precise by establishing some well known results for the Gromov boundary in the case of the contracting boundary. We show that the dynamics on the contracting boundary is very similar to that of a δ-hyperbolic group. In particular the action of G on ∂c X is minimal if G is not virtually cyclic. We also establish a uniform convergence result that is similar to the π-convergence of Papasoglu and Swenson and as a consequence we obtain a new north-south dynamics result on the contracting boundary. We additionally investigate the topological properties of the contracting boundary and we find necessary and sufficient conditions for G to be δ-hyperbolic. We prove that if the contracting boundary is compact, locally compact or metrizable, then G is δ-hyperbolic. 1. Introduction The Gromov boundary has been a very useful and powerful tool in understanding the structure of δ-hyperbolic groups. The boundary has a large array of nice topological, metric, and dynamical properties that can be used in probing everything from subgroups and splittings to algorithmic properties. It has also played an important role in proving various rigidity theorems. For proper CAT(0) spaces there is a nice visual boundary, but Croke and Kleiner showed that such a boundary is not a quasi-isometry invariant [1]. They constructed two different CAT(0) spaces with non-homeomorphic visual boundaries on which the same group acted geometrically. The visual boundary can still be used to study CAT(0) groups, for instance it can detect products [2, II.9.24], but the failure of quasi-isometry invariance is a serious blow. In [3] Charney and Sultan construct a natural topological space associated to a CAT(0) space, called the contracting boundary, which is a quasi-isometry invariant. One of the many properties that geodesics have in a δ-hyperbolic space is that there is a uniform upper bound on the diameter of the shadow that a ball, which is disjoint from the geodesic, casts on the geodesic. It turns out that this is a very powerful property and the existence of such geodesics in a space has significant consequences for the geometry [4, 5, 6]. Such geodesics are called contracting geodesics. The contracting boundary, ∂c X, of a CAT(0) space X is the set of contracting rays in X up to asymptotic equivalence. It is homeomorphic to the Gromov boundary when X is also δ-hyperbolic and is designed to imitate the Gromov boundary 1 2 DEVIN MURRAY for more general CAT(0) spaces. However, the behavior of the contracting boundary for CAT(0) groups is still not very well understood, so we hope to help lay out the ground work for a program of study to better understand it and its implications for CAT(0) groups. The rank-rigidity conjecture of Ballman and Buyalo says that for sufficiently nice CAT(0) spaces, the non-existence of a periodic contracting axis implies that the space is either a metric product, a symmetric space, or a Euclidean building [7]. Rank-rigidity theorems have been proven for many different classes of spaces including Hadamard manifolds, CAT(0) cube complexes, right angled Artin groups as well some others [8, 9, 10, 11]. In light of these results, the study of CAT(0) groups can often be reduced to the study of CAT(0) groups with a contracting axis. Building off the work of Ballman and Buyalo we show that a CAT(0) group has a contracting axis if and only if the contracting boundary, ∂c X, is non-empty. Thus the contracting boundary is a promising tool for the study of CAT(0) spaces and groups. Several of the rigidity theorems for hyperbolic groups can be proven through a careful study of the dynamics of the action of the group on its boundary [12, 13, 14]. These rigidity theorems become even more striking when further geometric structures are added, such as the Mostow rigidity of finite dimensional hyperbolic manifolds [15]. Our most promising results have been predominantly dynamical. While the topology of the contracting boundary tends to be rather pathological, many of the dynamical properties of the Gromov boundary are shared by the contracting boundary. There are two main dynamics results that we obtain in this paper. The first says that the orbit of any contracting ray is dense. Theorem 4.1. Let G be a group acting geometrically on a proper CAT(0) space. Either G is virtually Z or the G orbit of every point in the contracting boundary is dense. The second dynamics result concerns a more powerful convergence group like property. This is similar to the π-convergence of a CAT(0) group on its visual boundary. Theorem 4.2. Let X be a proper CAT(0) space and G a group acting geometrically on X. If gi is a sequence of elements of G where gi x → γ + for some x ∈ X and γ + ∈ ∂c X, then there is a subsequence such that gi−1 x → γ − for γ − ∈ ∂c X and for any open neighborhood U of γ + in ∂c X and any compact K in ∂c X − γ − there is an n such that gi (K) ⊆ U for i ≥ n. The normal version of π-convergence introduced by Papasoglu and Swenson in [16] and the north-south dynamics due to Hamenstädt in [6] both deal with the visual topology on the visual boundary. Because the topology on the contracting boundary is not the subspace topology these theorems don’t directly apply. Both of these results are well known for the action of a hyperbolic group on its boundary. We will discuss them both in greater detail in section 4. The topology on the contracting boundary is defined as a direct limit of subspaces, ∂cD X, consisting of rays with contracting constant bounded by D. The topology is quite fine and as a result it is more pathological than one would expect from a bordification. While the subspaces ∂cD X are compact and metrizable, we TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 3 prove that the direct limit, ∂c X is not always compact (nor locally compact) for CAT(0) groups, though it is known to be σ-compact [3]. In section 3 we define the topology and discuss some of the basic topological facts about it. One of the powerful tools that is available when studying the Gromov boundary is the family of metrics on it. In section 5 we show that a number of topological properties, including the metrizability of the contracting boundary, characterize when the space is δ-hyperbolic. Theorem 5.1. Let X be a complete proper CAT(0) space with a geometric group action. Then the following are equivalent: (i) (ii) (iii) (iv) X is δ-hyperbolic. ∂c X is compact. ∂c X is locally compact. ∂c X is metrizable. A generalization of the contracting boundary for proper metric spaces, called the Morse boundary, was introduced by Cordes in [17]. It would be interesting to see if any of these results hold true in that more general setting. In particular, it seems like many of the necessary pieces are already known for an analogue of theorem 5.1 for the Morse boundary [17, 18]. 2. Some basics on contracting geodesics For the entirety of this paper we will assume that a geodesic a(t) is an isometric embedding of R into a metric space. For convenience we will often conflate the image of the embedding with the map itself. For the subsequent discussion we may assume that unless stated otherwise all metric spaces are proper and satisfy the CAT(0) inequality. Notation: We will adopt the notation convention that [x, y] represents the unique geodesic between the points x, y ∈ X. For a point x ∈ X and a point α ∈ ∂X we will use half open intervals [x, α) to denote the unique geodesic starting from x which is in the equivalence class of α. When we use double parentheses, (α, β), we will mean a specific bi-infinite geodesic which is in the equivalence class of both α and β, note that it will not be unique. For an infinite geodesic a(t) in X we will use a(∞) to denote the equivalence class of a(t) in ∂X. (Recall that two infinite geodesics are equivalent in ∂X if they are within a bounded neighborhood of one another). Definition 2.1 (Contracting geodesics). A geodesic a(t) is said to be A-contracting for some constant A if for all x, y ∈ X d(x, y) < d(x, πa(t) (x)) =⇒ d(πa(t) (x), πa(t) (y)) < A Contracting geodesics can be thought of as detecting hyperbolic ’directions’ in a CAT(0) space. Another useful, and equivalent, property of hyperbolic like geodesics is that of δ-slimness. This is much closer to the notion of Gromov hyperbolicity. Definition 2.2 (Slim geodesics). A geodesic a(t) is said to be δ-slim if for all y ∈ / a(t) and all z on a(t) there exists a point w on the geodesic [y, z] such that d(πa(t) (y), w) ≤ δ. 4 DEVIN MURRAY It turns out that this property will be much more versatile for our purposes, luckily for us the two notions are equivalent in proper CAT(0) spaces. For a complete proof see [3] and [5]. Lemma 2.3. If a(t) is a contracting geodesic with contracting constant A then a(t) is δA -slim for some δA which depends only on A. The converse is also true, if a(t) is δ slim then it is Φ(δ)-contracting where Φ(δ) depends linearly on δ. I will adopt the convention that Bestvina-Fujiwara used in [5], that all constants will be denoted by Φ(·). Typically the function Φ(·) will be linear in it’s terms. When constants are referenced in later statements the relevant lemma and theorem number will be added as a subscript. Sometimes it will be expedient to drop the terms of Φ if they are clear from context, e.g. lemma 2.3 says that if a(t) is a δ-slim geodesic it is Φ2.3 -contracting. One of the most important facts about the contracting constant of a geodesic is that it is controlled by the contracting constants of near by geodesics. This will very important in the sequel as it will allow us to push contracting geodesics around via isometries and give us fine tuned control on the contracting constants of a target geodesic. Lemma 2.4. If we have two geodesics [a, b] and [a0 , b0 ], where [a, b] is A-contracting, d(a, a0 ) = D, and d(b, b0 ) = D0 then [a0 , b0 ] is Φ(A, D, D0 )-contracting. It suffices to take Φ(A, D, D0 ) = 16A + 28D + 7D0 + 10. A proof for this is in [5]. Though they do not write down the explicit Φ(A, D, D0 ) in their paper it is possible to recover the one above from their work. Another important property of contracting geodesics is that subsegments of a contracting geodesic are contracting. So unless otherwise specified we may assume that if a(t) is A-contracting all subsegments are also A-contracting. Lemma 2.5. If a(t) is a contracting ray with contracting constant A then a subsegment of it is Φ(A)-contracting where Φ(A) = A + 3. Bestvina-Fujiwara prove this in [5] in a slightly more general context. To understand why the contracting constant may have to increase, note that there are balls that don’t intersect the subsegment but do intersect the original contracting ray. The increase can be thought of as making up for some possible differences in the local geometry of the subsegment compared to the original ray. As a converse to the previous lemma, sometimes we will need to piece together two contracting geodesics into a longer geodesic. It is an easy warm up exercise to show that this new geodesic is also contracting. Lemma 2.6. Let a(t) and b(t) be geodesics in a CAT(0) space X. If a(t) is Acontracting, b(t) is B-contracting, and a(0) = b(0) = z then the following hold: (i) If the concatenation of a(t) and b(t) is a geodesic, then it is (A + B)contracting. (ii) For every point x ∈ a(t) and y ∈ b(t), the geodesic [x, y] is a Φ(A, B)contracting geodesic where Φ(A, B) = Φ2.4 (A, 0, δA ) + Φ2.4 (B, δA , 0) is sufficient. (iii) If X is also a proper metric space then the geodesic [x, b(∞)) and (a(∞), b(∞)) are Φ(A, B)-contracting such that Φ(A, B) is as above. TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 5 Proof. (i) Left as an exercise. (ii) If the concatenation of a(t) and b(t) is a geodesic this is obvious by part (i), so assume otherwise. By lemma 2.3 we have that a(t) is δA slim and b(t) is δB slim. We may assume that δA ≥ δB . By the definition of slimness there is a point w on [x, y] which is within 2δA of both of the other sides of the geodesic triangle ∆(x, y, z). By lemma 2.4 the geodesic [x, w] is Φ2.4 (A, 0, 2δA )-contracting and the geodesic [w, y] is Φ2.4 (B, 2δA , 0)-contracting. So by the first part of this lemma [x, y] is contracting with Φ(A, B) = Φ2.4 (A, 0, 2δA ) + Φ2.4 (B, 2δA , 0). (iii) This follows easily from part (ii) by taking a sequence of points yi → b(∞). The uniqueness of infinite rays in proper CAT(0) spaces, lemma 2.4, and Arzela Ascoli implies the statement.  In contrast with geodesics in Euclidean flats the diameter of the projection of any geodesic onto a contracting geodesic is finite. The proof can be found in [3]. Lemma 2.7. If a(t) is a contracting geodesic and b(t) is any other infinite geodesic then the projection of b(t) onto a(t) is of bounded diameter D. In a δ-hyperbolic space geodesics are coarsely determined by their end points on the boundary. For CAT(0) spaces which contain Euclidean flats this is easily seen to be false, if the geodesic happens to be δ-slim however it is true. Lemma 2.8. Let a(t) be a δ-slim bi-infinite geodesic. If b(t) is a bi-infinite geodesic which stays a bounded distance from a(t) then b(t) will be in the 2δ-neighborhood of a(t). Proof. Left as an exercise to the reader.  As a consequence of the bounded projection property for contracting geodesics Charney-Sultan proved in [3] that contracting geodesics have a strong visibility condition. Lemma 2.9 (Visibility). If X is a CAT(0) space and a(t) is a contracting geodesic then if b(t) is any geodesic in X there is a bi-infinite geodesic from b(∞) to a(∞). Lemma 2.10. If X is a proper CAT(0) space and a(t) is a δ slim geodesic in X then for any x ∈ X the distance d(πa(t) (x), [x, a(∞))) ≤ δ. This just extends the concept of δ-slimness. Proof. This is just an application of the δ-slim condition to the sequence of geodesics [x, a(N )] and the Arzelá-Ascoli theorem  This next lemma gives us information about the global geometry when the equivalence class of a contracting ray is fixed by a cocompact group action. This lemma will allow us to rule out the existence of global fixed points in the contracting boundary later on. Lemma 2.11. Let G be some group acting cocompactly by isometries on a CAT(0) space X. If there is some α ∈ ∂X such that G fixes α and some representative of α is contracting, then every ray in X is contracting. 6 DEVIN MURRAY b(∞) b(i) C gi x δA πa(t) (gi x) πa(t) (b(i)) α x P C Figure 1. A globally fixed contracting geodesic Proof. Let b(t) be some ray in X. Pick a representative a(t) of α such that a(0) = b(0) = x. Note that because one of the representatives of α is contracting, all of them are, though the contracting constant will depend on x, so let A be such that a(t) and all subsegments of a(t) are A-contracting. By lemma 2.7 the projection of b(t) onto a(t) is bounded, i.e. there is a P such that d(x, πa(t) (b(i))) ≤ P for all i. By cocompactness we also have a C ≥ 0 and a collection {gi } ⊆ G with d(gi x, b(i)) ≤ C. This implies that d(x, πa(t) (gi x)) ≤ d(x, πa(t) (b(i))) + d(πa(t) (b(i)), πa(t) (gi x)) ≤ P + d(b(i), gi x) ≤P +C Where the second inequality is by the definition of P and the fact that the projection function is non-increasing. Because the gi leave α fixed we have that gi a(t) is the geodesic connecting gi x with α. Since a(t) is contracting, by lemma 2.10 there is a δA so that for all i d(πa(t) (gi x), gi a(t)) ≤ δA . We can then derive the following inequality: d(x, gi a(t)) ≤ P + C + δA Thus, for each i we have that d(b(i), gi x) ≤ C and there is some Ni such that d(x, gi a(Ni )) ≤ P + C + δA . Because all subsegments of gi a(t) are also A-contracting we have that [b(0), b(i)] is close to an A-contracting geodesic and lemma 2.4 then implies that [b(0), b(i)] is TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 7 Φ2.4 (A, C, P + C + δA )-contracting for all i. The geodesic b(t) is then contracting since every initial segment is contracting with the same constant.  Definition 2.12. Let X be a complete CAT(0) space. The angle ∠(α, β) between α, β ∈ ∂X is defined as sup ∠x (α, β) x∈X Where ∠x (α, β) is the Alexandrov angle between the two (unique) geodesics which start at x and are in the equivalence class of α and β. The function ∠(·, ·) defines a metric on ∂X making it a complete metric space. The associated length metric is called the Tits metric and is denoted dT (α, β). For further information on the Tits metric see [2, Chapter II.9]. The following is a result of Ballmann and Buyalo [7, Proposition 1.10] and it supplies us with a rank one isometry for all complete cocompact CAT(0) spaces which have a contracting ray. Proposition 2.13. Suppose the limit set Λ ⊂ ∂X is non-empty then the following are equivalent. (1) X contains a periodic rank-one geodesic. (2) For each ξ ∈ Λ there is an η ∈ Λ with dT (η, ξ) > π. Corollary 2.14. Let X be a complete and proper CAT(0) space and let G act on X geometrically. If X has a contracting ray then there is a rank-1 isometry. Proof. By the strong visibility condition in lemma 2.9, if X has a contracting ray a(t) then it is visible from all points ξ ∈ Λ. The geodesic between a(∞) and any ξ0 ∈ Λ guaranteed by visibility tells us that the Alexandrov angle ∠(a(∞), ξ0 ) = π. To show that the Tits distance is larger than π from any point ξ ∈ Λ, pick a geodesic from a(∞) to ξ inside the Tits boundary ∂X and call it c (note: if no such geodesic exists then dT (a(∞), ξ) = ∞). Now let ξ0 be a point on c separate from a(∞) and ξ. Then we will have that dT (a(∞), ξ) = length(c) ≥ ∠(a(∞), ξ0 ) + ∠(ξ0 , ξ) ≥ π + , note that  > 0 since ξ0 6= ξ. So dT (a(∞), ξ) > π and we have that X has a rank-one periodic geodesic.  We need the following technical fact about geodesics in metric spaces at several points in this paper, we include a proof for the sake of completeness. Lemma 2.15. Let γ(t) be a geodesic in a metric space X and let x be a point in X such that d(x, γ(0)) = t0 , then if the distance d(x, γ(t)) ≤ D then d(x, γ(t0 )) ≤ 2D. Proof. Since d(x, γ(t)) ≤ D let’s let ` be a point such that d(x, γ(`)) ≤ D. There are two cases, ` ≥ t0 or ` < t0 . In the first case if we consider the geodesic triangle defined by γ(0), γ(`), and x, but let’s rewrite ` = t0 + a. The triangle inequality says that t0 + a ≤ D + t0 i.e. a ≤ D. Then considering the triangle defined by the three points γ(t0 + a), γ(t0 ), and x we get a new triangle inequality d(x, γ(t0 )) ≤ a + D ≤ 2D. 8 DEVIN MURRAY In the second case we will again consider the geodesic triangle given by γ(0), γ(`), and x but this time and we will write ` = t0 − a. The triangle inequality fashions us with t0 ≤ D +(t0 −a) or a ≤ D. Considering the triangle defined by γ(t0 −a), γ(t0 ), and x we get the triangle inequality d(x, γ(t0 )) ≤ D + a ≤ 2D.  3. The topology of the contracting boundary The topology of the contracting boundary is very different from that of the visual boundary. Later, in section 5, we will show that the contracting boundary is often not a metric space. In fact, we show it to not even be first-countable. In anticipation of that we will prove some elementary topological facts about the contracting boundary (and limit spaces in general) to facilitate some of the later proofs. First, let’s define the contracting boundary and then we will talk about some of its basic topological properties. Definition 3.1. Let X be a CAT(0) space. Let ∂cD Xx be the set of infinite geodesic rays that start at x and are D-contracting, we shall call this the D-component of the contracting boundary. This is a subspace of the visual boundary of X, ∂Xx , and has the associated topology on it. If D0 ≤ D1 then there is the natural inclusion ∂cD0 Xx ,→ ∂cD1 Xx , so taking all non-negative D we get a directed system. The contracting boundary, denoted ∂c Xx , is the union of all of the D-components with the direct limit topology. The homeomorphism type (but not the contracting constants) of the contracting boundary is independent of the base point x, and so typically this will be suppressed when there is no danger of confusion [3]. One of the basic properties of a direct limit space is that a set in the space is open (respectively closed) if and only if its intersection with each component is open (closed). In fact, this is often taken as the definition. Because the topology of the contracting boundary is so dependent on the topology of the components it will be useful to know how the subspace topology on the components sits inside of the visual topology. The following is lemma 3.3 in [3]. Lemma 3.2. For all D ≥ 0 the D-components of the contracting boundary are closed subsets of the visual boundary. Understanding compact sets in the contracting boundary will be important later in our investigation. It turns out that compact sets in the contracting boundary are closely related to the compact sets of the visual boundary, but are limited by their contracting constants. Lemma 3.3. A set K is compact in ∂c X if and only if K = C ∩ ∂cD X for some compact set C ⊂ ∂X and some D. Proof. ⇐ If K = C ∩ ∂cD X then because C is compact in ∂X and ∂cD X is a closed set in ∂X by 3.2, then K is a closed subset in C and therefore compact in ∂X. Now the topology on ∂c X is defined in such a way so that each of the components ∂cD X are topologically embedded into ∂c X, i.e. compact subsets of ∂cD X will also be compact in ∂c X. So K is a compact set in ∂c X. TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 9 ⇒ Assume that K is a set in ∂c X but that K is not contained in ∂cD X for any D. These assumptions guarantee that there is some sequence of geodesics {ai (t)} in K where ai (t) is Di -contracting and Di → ∞. By possibly passing to a subsequence we may assume that Di > Di−1 and that each ai (t) is not Di−1 -contracting. Let An = {ai (t)}i≥n+1 . Note that for all n and all D, An ∩ ∂cD X is a finite set and therefore closed in each component, so An is closed in ∂c X. The collection O = {∂c X\An } is an open cover of K, but each open set only contains finitely many of the ai (t). Take any finite subcollection of O, it will only cover finitely many of the ai (t) and so it is not a cover, therefore K is not compact. We can then conclude that if K is compact, it is contained in one of the components ∂cD X for some D. Because the topology on ∂c X is finer than that of ∂X any set which is compact in the contracting boundary is compact in the visual boundary. In other words every compact set K in the contracting boundary is of the form K = K ∩ ∂cD X for some D.  We will also want to know when sequences in the contracting boundary converge. It turns out that a sequence converges in the contracting boundary if and only if it converges in the visual boundary and its contracting constants are uniformly bounded above. Lemma 3.4. Let X be a proper CAT(0) metric space. A sequence ai (t) in ∂c Xx converges to a point b(t) ∈ ∂c Xx if and only if the following two conditions hold: (1) There is a uniform K such that for all i ai (t) is K-contracting. (2) In the visual boundary ai (t) → b(t). Proof. ⇐ Since ai (t) are all K-contracting then the set {ai (t), b(t)} ⊆ ∂cM Xx where M is the max of the contracting constant of b(t) and K. The topology on this component is just the subspace topology and thus since the ai (t) → b(t) in the visual boundary the convergence happens in this component as well. Because each of these components are topologically embedded the convergence takes place in ∂c Xx as well. ⇒ Note that the topology on ∂c Xx is finer than that of the subspace topology. i.e. If condition (2) fails then ai (t) will not converge to b(t) in the contracting boundary. Assume (1) fails, this means that for each k ∈ N there is an ik such that aik (t) is not k contracting. Consider the set {aik (t)}, this subsequence is in fact closed in ∂c Xx because only finitely many of them are in each ∂cD Xx and are thus closed in the subspace topology. Thus ai (t) 6→ b(t) in ∂c Xx .  4. The topological dynamics of the action on the boundary The topological dynamics of a group action can be a powerful tool in understanding the global topology. In order to better gain an understanding of the contracting boundary of cocompact CAT(0) spaces we will attempt to exploit some well known results from δ-hyperbolic spaces. Most of the following results are well known dynamical results for the visual boundary of a CAT(0) group which contains a rank-1 isometry and a result of Ballmann and Buyalo’s [7] guarantees this is the case for the cocompact groups 10 DEVIN MURRAY we are considering here. However, the definition of the topology as a direct limit of spaces gives the contracting boundary a much finer topology than the subspace topology would. Because of this different topology we are considering, it is necessary to reprove (and in some cases reword) these dynamics results as none of them will follow as immediate corollaries from the known theorems. For non-elementary hyperbolic groups the orbit of every point in the boundary is dense. This establishes a strong dichotomy, either the group is virtually Z or its boundary has no isolated points. Our first theorem is establishing this result in the case of the contracting boundary, i.e. the contracting boundary either has no isolated points and has a countable dense subset, or the group is virtually cyclic. Theorem 4.1. Let X be a proper CAT(0) space such that G acts geometrically on X. If ∂c X 6= ∅ and G is not virtually cyclic then the orbit of each point in ∂c X is dense. This is very similar to a result of Hamenstädt’s on the limit set when the group contains a rank one isometry [6]. In the spirit of treating the contracting boundary as a replacement of the Gromov boundary for CAT(0) spaces it is natural to ask is whether axial isometries act with North-South Dynamics and if the group G acts as a convergence group action on ∂c X. Because the contracting boundary is not compact the classical formulations of these dynamical properties will have to be reinterpreted somewhat. Theorem 4.2. Let X be a proper CAT(0) space on which G acts geometrically. Let gi be a sequence of isometries in G such that gi x → γ + where γ + ∈ ∂c X, then there is a subsequence of gi ’s where gi−1 x → γ − for some γ − ∈ ∂c X and for every open neighborhood U of γ + and every compact set K ⊆ ∂c X − γ − we have uniform convergence of gi (K) → γ + . This theorem is closer to Papasoglu and Swenson’s π-convergence from [16] than it is to a true convergence action. A corollary of this theorem is that rank-1 isometries act with a version of North-South dynamics on the contracting boundary. Corollary 4.3. Let X be a proper CAT(0) space and let G be a group acting geometrically on it. If g is a rank-1 isometry in G, U is an open neighborhood of g ∞ and K is a compact set in ∂c X − g −∞ then for sufficiently large n, g n (K) ⊆ U . 4.1. Failure of classical north-south dynamics. By classical north-south dynamics we mean the following theorem. Theorem 4.4. If G is a δ-hyperbolic group acting on its Cayley graph X and if g is an infinite order element then for all open sets U and V with g ∞ ∈ U and g −∞ ∈ V then g n (V c ) ⊆ U for large enough n. It is a well established fact that for CAT(0) groups the classical version of northsouth dynamics of axial isometries on the visual boundary fails. In particular, if the isometry is not rank-one whole flats may be fixed by the isometry. Unfortunately, even if g is a rank-1 element of G, this classical version of northsouth dynamics on ∂c X still fails. If a(t) is an axis for g there are open sets U and V of a(∞) and a(−∞) such that g N (∂c X\V ) 6⊆ U for any N . TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 11 Note: This is in direct contrast with the subspace topology on the set of contracting geodesics, (∂csub X). In [6] and [19] it was proven that rank-1 isometries act on the entire visual boundary with north-south dynamics and thus on any subspace containing the end points. For an example of the failure of the classical north-south dynamics of rank-1 isometries on the contracting boundary consider the RAAG, AΓ = ha, b, c | [b, c]i. This is the fundamental group of the Salvetti complex, X (see figure 2), and it’s universal cover, X̃, is a CAT(0) cube complex on which AΓ acts geometrically [20]. Let a(t) be an axis for the loxodromic element a. Let bi (t) be the geodesics following the words a−i bi aaaa · · · . Note that the contracting geodesics bi (t) do not converge to a(−∞) in the contracting boundary. This is because the intersection of the set {bi (t)} with each of the contracting components ∂cD X is a finite set and therefore closed in the subspace topology, and thus {bi (t)} is closed in ∂c X. c b x a Figure 2. The Salvetti complex X of AΓ .  The set V = Ua(−∞) (r, ) ∩ ∂c X \ {bi (t)} is then an open set around a(−∞) but for all N we have aN bN (t) 6∈ Ua(∞) (r0 , 0 ) for all 0 < r0 . 4.2. Proof of Theorem 4.1. The first step in proving this theorem will be to prove an initially weaker result. We will prove that for a cocompact CAT(0) space, the orbit of a point in the contracting boundary is either a singleton or is dense. The proof relies on the observation that the orbit of a bi-infinite geodesic is easier to understand and contains more geometric information than the orbit of an infinite ray. We will take some contracting ray and one of its orbit points and connect the two with a bi-infinite geodesic. It is then reasonably easy show that the orbit of this bi-infinite geodesic is dense in the contracting boundary. Proposition 4.5. If the action of G on X is cocompact and α+ ∈ ∂c X then α+ is globally fixed by G or its orbit is dense in ∂c X. Proof. First note that if there are only two points in ∂c X then the proposition is obvious. Either the orbit is a singleton or it is the entire boundary. So from now on we may assume that |∂c X| > 2 and that α+ isn’t globally fixed. To show that the orbit is dense it suffices to show that for all β ∈ ∂c X there exists a sequence of gi ∈ G such that gi α+ → β. If β ∈ Gα+ then we are done since there is an h such that β = hα+ so the constant sequence gi = h will work. If β is not in the orbit of α+ pick a point distinct from α+ in the orbit and call it α− , i.e. hα+ = α− for some h 6= e. By the visibility of ∂c X there is a geodesic connecting α− to α+ . If we label this geodesic a(t) and pick a base point x = a(0) on it there is also a representative of β, b(t), such that b(0) = x. 12 DEVIN MURRAY gi α+ gi x y C b(i) δA ki (i) gi a(ti ) gi α− δA w α+ x α− Figure 3. Convergence of α translates Note: Since α+ and α− are different elements of the contracting boundary there are two different contracting constants for their representatives a(t)|[0,∞) and a(t)|(−∞,0] , but by Lemma 2.6 we have a uniform contracting constant for all of a(t) and we shall call it A. For the representative, b(t), of β let B be its contracting constant. Since Lemma 2.3 guarantees that a(t) and b(t) are slim, we will denote δA and δB as their slimness constants respectively. To make the following discussion simpler, we will assume that A and B are chosen so that all subsegments (finite or infinite) of either geodesic are also contracting with the same constant. By the cocompactness of the action of G on X there is a uniform C > 0 such that for each i ∈ N there is a gi ∈ G such that d(gi x, b(i)) ≤ C. Since we’ve picked gi so that the orbit of x travels up along b(t) we’d like to say that the geodesic a(t) follows suit, but first we need to pass to a subsequence. Let gi a(t) be the bi-infinite geodesic connecting gi α− to gi α+ with base point gi x. Now note that there is a ti such that gi a(ti ) is the projection of x on gi a(t) (see figure 3). Infinitely many of the ti will be either positive or negative, so by passing to a subsequence we may assume that all the ti have the same sign. In the following argument we will consider the case when the ti ≤ 0. In this case we will prove that gi α+ → β. If instead, the ti > 0 the following argument will go through, mutatis mutandis, to show that gi α− → β. Because α− = hα+ , this tells us gi hα+ → β. Thus, in either case, the orbit of α+ will accumulate on any β ∈ ∂c X. TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 13 Consider the representatives of gi α+ starting from the base point x and denote them ki (t). To show that the sequence ki (t) converges in ∂c X to b(t), lemma 3.4 says we only need the following two conditions: (1) There is a uniform K such that for all i, ki (t) is K-contracting. (2) ki (t) converges to b(t) in the visual boundary ∂X. It turns out that these two ingredients are a direct consequence of the following lemma: Lemma 4.6. For each i we have that d(ki (i), b(i)) ≤ 2(δA + C) Proof of lemma 4.6. For the following discussion see figure 3. We only need to show that the distance from the point b(i) to the geodesic ki (t) is δA + C then applying lemma 2.15 we get the result. Observe that gi a(t) is A contracting and thus there is a point w on the geodesic ki (t) which is within δA of πgi a(t) (x) by lemma 2.10. Recall that πgi a(t) (x) = gi a(ti ) and that ti ≤ 0. By the convexity of the distance function any point along the geodesic gi a|[ti ,∞) (t) will also be within δA of ki (t). In particular, since gi x = gi a(0) ∈ gi a|[ti ,∞) (t) then d(gi x, ki (t)) ≤ δA . Because of how the gi were defined we also have that d(gi x, b(i)) ≤ C. This lets us conclude that d(b(i), ki (t)) ≤ δA + C.  Lemma 4.6 is the key to establish conditions (1) and (2). Proof of condition (1). Since d(ki (i), b(i)) ≤ 2(δA + C), which is independent of i, so by lemma 2.4 there exists a constant independent from i, Φ2.4 such that the geodesic ki |[0,i] (t) is Φ2.4 -contracting. The cocompact constant gives us that d(b(i), gi x) ≤ C so together with lemma 4.6 we have d(ki (i), gi x) ≤ 2δA + 3C. Because gi a|[ti ,∞) (t) is δA -slim, for large enough T the point ki (T ) is within δA of gi a|[ti ,∞) (t). You can apply lemma 2.4 again to all subsegments ki |[i,T ] (t) with large T , thus they are all Φ02.4 -contracting for some Φ02.4 independent of i. This implies that the infinite ray ki |[i,∞) (t) is contracting with the same contracting constant. The concatenation of ki |[0,i] (t) and ki |[i,∞) (t) gives us the entire geodesic ki (t). Lemma 2.6 then tells us that for all i, the ki (t) are (Φ2.4 + Φ02.4 )-contracting.  Proof of condition (2). Recall that the sets Ub(t) (ε, r) = {c(t) | c(0) = x and d(c(r), b(r) < ε} 14 DEVIN MURRAY form a local neighborhood basis for the visual boundary. So for each Ub(t) (ε, r) we need an N such that ki (t) ∈ Ub(t) (ε, r) for i ≥ N .   2r(δA + C) N (ε, r) := max r , ε is just such an N because when i ≥ N (ε, r) we get the following chain of inequalities: r r d(ki (r), b(r)) ≤ d(ki (i), b(i)) ≤ 2(δA + C) ≤ ε i i The first inequality is just a restatement of the convexity of the distance function (and was the reason N (ε, r) is chosen as a max), the second is a result of lemma 4.6 and the final inequality is just a restatement of the definition of N (ε, r). Thus we have that the sequence ki (t) converges to b(t) in the visual boundary.  Establishing conditions (1) and (2) tells us that ki (t) → b(t) in ∂C Xx . Because b(t) was arbitrary this tells us that the orbit Gα+ is dense in ∂c Xx and so the statement of the proposition is proven.  The following corollary will come up later and so we will include it here. It states that the orbits of contracting things which aren’t globally fixed are dense in the visual boundary. Corollary 4.7. If G acts cocompactly on X and α+ ∈ ∂c X isn’t globally fixed by G then its orbit is dense in ∂X. Proof. This is an immediate consequence of the proof of condition (2) in the above. At no point was the contracting constant of b(t) used and so replacing it with a non-contracting geodesic gives the same result. (Note that in this case condition (1) fails).  Proposition 4.5 is the major component of our theorem, but there remains a few loose ends. Here is an outline what remains of the proof. We need to first show that there are enough contracting geodesics in any cocompact CAT(0) space, namely that if the contracting boundary is not empty it contains at least 2 points. Second, we need to show that if there are exactly two points in the contracting boundary the group is virtually cyclic. This will establish our dicotomy, that our group is virtually cyclic or there are strictly more than two points in our contracting boundary. Finally, it will be easy to then show that if there are more than two points in the contracting boundary, none of them are globally fixed. Proposition 4.8. If G acts geometrically on a proper CAT(0) space X then |∂c X| = 2 if and only if G is virtually Z. Proof. ⇒ Let a(t) be a contracting geodesic connecting the two points in ∂c X. Recall that this implies that a(t) is δ-slim for some δ. Because the action of G on X is cocompact there is some C such that for all points x ∈ X there is some gx such that d(gx a(0), x) ≤ C. Because the contracting boundary only contains two points then gx a(t) is a bi-infinite geodesic which is asymptotic to the bi-infinite geodesic TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 15 a(t). By lemma 2.8 we have that d(gx a(t), a(t)) ≤ 2δ so the distance between x and a(t) is bounded by 2δ + C. Thus a(t) is a quasi-surjective quasi-isometric embedding of R, i.e. X is quasi-isometric to the real line, and thus G is QI to Z. It is a standard exercise to show that a group which is QI to Z is virtually cyclic. For a sketch of the proof see [21, pg 10 exercise 1.16] ⇐ If G is virtually Z then it is QI to R. The contracting boundary of a CAT(0) space is a QI invariant, so ∂c X = ∂c R which is two discrete points.  Lemma 4.9. If X is a proper CAT(0) space with a geometric action and ∂c X 6= ∅ then |∂c X| ≥ 2. Proof. Since the contracting boundary is non-empty we have at least one contracting ray a(t), now look at the orbit of a(t), if it is not fixed we’re done since the orbit of a contracting ray is contracting. If it is fixed then by lemma 2.11 every geodesic ray is contracting. So now the only way that we wouldn’t have at least two points in the contracting boundary was if all infinite geodesics were asymptotic. However, if a CAT(0) group is not finite, it contains an infinite order element which has an axis in X, for a proof see [22].  Proposition 4.10 (The Flat Plane Theorem). If a group G is acting geometrically on a CAT(0) space, X, then X is δ-hyperbolic if and only if X contains no Euclidean flats E2 . This is a standard result from [2, III.H.1.5]. Corollary 4.11. Let G act geometrically on a proper CAT(0) space X with nonempty contracting boundary ∂c X. If G fixes a point in ∂c X then G is virtually Z. Proof. Let α ∈ ∂c X be a fixed point. By lemma 2.11 we have that every geodesic in X is contracting. In particular, we have that X cannot contain a Euclidean flat and thus by The Flat Plane Theorem 4.10 X is δ-hyperbolic. Švarc-Milnor then tells us that G is a δ-hyperbolic group. Note that in this case the contracting boundary is the Gromov boundary. Recall that if a δ-hyperbolic group is non-elementary i.e it is neither finite nor virtually cyclic, then it has no globally fixed points in its boundary. This is because it must contain an undistorted free group on two generators and the generators both act by North-South dynamics on the boundary with disjoint fixed points. For a proof of these facts see [21, Chapter 8]. The group G is then virtually Z and so we are done.  4.3. Proof of Theorem 4.2. We will prove theorem 4.2 by proving the easier to state theorem below. Theorem 4.12. Let γ + and γ − be points in the contracting boundary. If there is a sequence of isometries gi such that gi x → γ + and gi−1 x → γ − then for any compact set K in ∂c X − {γ − } and any open neighborhood, U ⊆ ∂c X, of γ + , gi (K) ⊂ U for large enough i. 16 DEVIN MURRAY We can loosen the hypothesis that the gi−1 converge to γ − to obtain theorem 4.2 from theorem 4.12. By a result of Ballman-Buyalo [7] if gi x → γ + then (passing to a subsequence if necessary) the inverses converge to something in the boundary. Because the forward endpoint is contracting it is straightforward to show that the backwards end point must be contracting as well. Because open sets in ∂c X can be much finer than in the visual boundary it is not a priori obvious that there will be any form of North-south dynamics on the contracting boundary. The important observation is that all open sets around γ + have a ”B-contracting core” which contains the set of all B-contracting elements which are nearby to γ + in the visual topology. Because the action by gi coarsely preserves the contracting constants in K, (and because they are already bounded) you can push the set K into the ”core” of U with the dynamics of the visual boundary and establish that it is in fact a subset of U . Note: I think this is not enough to use the ping-pong lemma because compact sets and neighborhoods aren’t compliments of each other like they are with the visual topology. This makes me suspect that there is a decent chance this applies to the Morse boundary (where the ping-pong lemma must fail in general). Because of this I include a proof of a known dynamics result (lemma 4.14) on the visual boundary of a CAT(0) space which I believe will be amenable to generalization onto the Morse boundary. The proof will be broken up into two lemmas in order to simplify the discussion. For the following we will assume that X is a proper CAT(0) space with nonempty contracting boundary and a group of isometries G acting geometrically. Lemma 4.13. Let V be an open set in the contracting boundary containing a point γ, then for each positive constant B there is an r and an , depending only on, B, γ and V such that ∂cB Xx ∩ U (γ, r, ) ⊂ V . Proof. We can do this by contradiction. Assume that for some B no such r and  existed. Then for each n ∈ N we could find an element of ∂cB Xx ∩ U (γ, n, 1) which is not in V . i.e. we have a sequence of geodesics ηn such that ηi ∈ U (γ, n, 1) for all i ≥ n which is no more than B-contracting. Because this is precisely the condition for convergence of a sequence in the contracting boundary laid out in lemma 3.4 we have that ηn → γ but that the ηn are not in V . Because V is a neighborhood of γ this is a contradiction. ⇒⇐  The following lemma is a direct consequence of the π-convergence due to Popasolgu and Swenson in [16]. This lemma should be generalizable to the Morse boundary so we will provide a different proof which does not rely on the Tits-metric and so is likely easier to generalize. Lemma 4.14. Let γ + , γ − be elements in ∂c X and gi be a sequence of group elements such that gi x → γ + and gi−1 x → γ − . For any neighborhoods of γ − and γ + in the visual topology of the form U (γ − , s, ε) and U (γ + , r, ), there is an N such that for all points α in the set ∂c X − U (γ − , s, ε) we have gi (α) ⊂ U (γ + , r, ) for all i ≥ N. Proof. For the sake of simplicity we can assume that the base point x is on a geodesic from γ − to γ + . We will denote the geodesic [x, gi−1 x] by ci (t), since the gi−1 x converge to γ − there is a D such that ci (t) is within D of γ − . Without loss of TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 17 α a(zi ) bi (yi ) gi−1 x ci (pi ) γ− x γ − (wi ) Figure 4. Bounding pi . generality we may assume that D is large enough to also bound the distance from gi x to γ + . Lemma 2.4 then tells us that all the ci (t) are B-contracting for some constant B because the geodesic from γ + to γ − is contracting. Let a(t) denote the parametrized geodesic from x to α and bi (t) be the geodesic from gi−1 x to α. By slimness there are three points, ci (pi ), bi (yi ) and a(zi ), such that the pairwise distance is less than δB (See figure 4). We will show that pi is uniformly bounded for all i. This will in turn imply that the distance from gi−1 x to ci (pi ) diverges as i → ∞. Note that convexity guarantees that there is a point, γ − (wi ), which is at most a distance D from ci (pi ). The uniform bound on pi is inherited from the fact that α is outside of U (γ − , s, ε). The following computation makes this more precise. In particular,  pi ≤ max s(δB + D) + εD , s + D, s + δB ε  Assume this was false. Applying the triangle inequality wi + D ≥ pi > s + D and zi + δB ≥ pi > s + δB i.e. that wi , zi > s. This then gives us the following: pi > s(δB + D) + εD ε pi ε − Dε > s(δB + D) ε s > δB + D pi − D Convexity and the triangle inequality then tells us: ε δB + D d(γ − (wi ), a(zi )) d(γ − (s), a(s)) > ≥ ≥ s pi − D zi s But this is a contradiction because it says that a(t) is in U (γ − , s, ε). So for all i, pi is uniformly bounded above. 18 DEVIN MURRAY α gi (bi (yi )) gi (ci (pi )) x gi x γ + (vi ) γ+ Figure 5. Convergence of the gi (bi (t)). For the next step consider figure 5. Let ki = d(gi−1 x, x) − pi . Because pi is uniformly bounded ki diverges, in particular there is an N be such that for all j≥N   r(δB + D) + D kj > max , r + δB , r + D  This is enough to prove that the geodesic gj (bj (t)) is in the neighborhood U (γ + , r, ). Note that since gj (bj (0)) = gj (gj−1 x) = x, gj (bj (t)) is the representative of gj (α) with base point x, so once we prove this it establishes the lemma. Because gi is an isometry, from above we know that gi (bi (yi )) is within δB of gi (ci (pi )). Note that by convexity gi (ci (pi )) is within D of γ + (vi ) for some vi . We can use the same argument as above with ki in place of pi to obtain that vi , yi > r. Applying our previous argument mutatis mutandis for j ≥ N we obtain the inequalities:  δB + D d(γ + (vj ), gj (bj (yj ))) d(γ + (r), gj (bj (r))) > ≥ ≥ r kj − D yj r Which establishes that gj (bj (t)) is in U (γ + , r, ) for sufficiently large j.  Proof of Theorem 4.2. We may assume that x is on the bi-infinite geodesic γ(t) from γ − to γ + . Let K be a compact set in ∂c X − γ − and U an open set containing γ + in ∂c X. By lemma 3.3 there is a uniform A such that all elements α in K (with basepoint x) are no more than A-contracting. Now because the gi x converge to γ + and the gi−1 x converge to γ − there is a D which bounds the distance of the gi x from γ(t). Let ci (t) denote the geodesic from x to gi x. Because this is a bounded distance from γ(t) we know that it is no more than B-contracting where B depends on the contracting constant of γ(t) and D. By the slimness of ci (t) we then have that there are points on ci (t), the geodesic from x to gi α, and the geodesic from x to γ + , ui , vi and wi respectively, such that the pairwise distances are no greater than δB . This means that the geodesic from x to gi α is composed of two subsegments, [x, vi ] and [vi , gi α), both of which are contracting by lemma 2.4 and their contracting constants depend only on A and B. So there is a C such that every element in gi (K) is no more than C contracting. TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 19 By lemma 4.13 for the contracting constant C there is an r and an  such that ∂cC Xx ∩ U (γ + , r, ) ⊂ U . Because K is a compact set in the contracting boundary by lemma 3.3 there is an s and an ε such that K ⊆ ∂c Xx − U (γ − , s, ε). So applying lemma 4.14, for large enough i we have that gi (K) ⊂ U (γ + , r, ), but we already know that gi (K) ⊂ ∂cC Xx and so gi (K) ⊂ U .  5. A characterization of δ-hyperbolicity One of the ways in which the behavior of the contracting boundary diverges from that of the Gromov boundary is in its local topology. The Gromov boundary comes equipped with a family of visual metrics that induce the same topology on the boundary, making it a compact, complete, metric space. For the contracting boundary this happens only in the rarest of circumstances. It is quite easy to cook up examples of spaces which have non-metrizable contracting boundary. The following is one such example. Consider again our favorite RAAG, AΓ = ha, b, c | [b, c]i, along with the universal cover of its Salvetti complex, X̃. The infinite word w = aaaa · · · corresponds to a 0-contracting geodesic in X̃ which starts at some lift of the natural base point x in X (see figure 2). If we let wij = ai bj aaa · · · , this corresponds to an infinite geodesic starting at the lift of x which is exactly j-contracting (i.e. it is not B-contracting for any B < j). It is clear that for each fixed j the sequences {wij }i∈N converge to w in the contracting boundary. Now if we construct a new sequence by picking an i for each j, i.e. we choose a function f : N → N, then regardless of our choice of f the new sequence {wfj (j) }j∈N will never converge to w. This is because the set {wfj (j) }j∈N is closed in ∂c X̃, as its intersection with each component, ∂cD X̃x , is finite and therefore closed. It is a general fact for all first countable spaces that if you have a countable collection of sequences which all converge to the same point, it is always possible to pick a ’diagonal’ sequence which also converges. i.e. if we have {xji } such that lim xji = x there is always some function f : N → N such that lim xjf (j) = x. i j The proof of this is an elementary exercise in point-set topology. Because this is impossible in the above example we can see that the contracting boundary of X̃ cannot be metrizable. Of course, for some CAT(0) spaces, the contracting boundary is metrizable, any CAT(-1) spaces for instance. It turns out that this is completely generic, the metrizability of the contracting boundary completely characterizes δ-hyperbolicity of cocompact CAT(0) spaces. Theorem 5.1. Assume that there is a group G acting geometrically on a complete proper CAT(0) space, X, with |∂c X| > 2 then the following are equivalent: X is δ-hyperbolic. The contracting constants are bounded i.e. ∂c Xx0 ⊆ ∂cD Xx0 for some D. The map Id : X → X induces a homeomorphism ∂X ∼ = ∂c X. ∂X ⊆ ∂c X i.e. as sets the visual boundary and the contracting boundary are the same. (v) ∂c X is compact. (i) (ii) (iii) (iv) 20 DEVIN MURRAY g n b(t) b(t) kn (t) z x a(−∞) p y gn p a(∞) Figure 6. Periodic isometries coarsely fix contracting constants (vi) ∂c X is locally compact. (vii) ∂c X is first-countable, and in fact metrizable. In order to prove these equivalences we need a bit more fine control over how the contracting constants change under the group action. When there is a rank-one isometry you can say precisely how the contracting constants are changing as you act on a contracting ray. We will make that more precise below, but first we need some notation. Notation: If b(t) is a B-contracting geodesic in some CAT(0) space X then I will denote the minimum of all contracting constants B̃ := min{B | b(t) is B-contracting }. Lemma 5.2. Let g be a rank one isometry of a CAT(0) space X whose axis, a(t), is A-contracting. If b(t) is a B-contracting geodesic with b(0) = a(0) = p, then kn (t) = [p, g n b(∞)) will be a K-contracting geodesic such that Ψ(B̃, A) ≤ K ≤ Φ(A, B) where Ψ(B̃, A) = B̃ − 16A − 77δA − 38 − 3 and Φ(A, B) is as in lemma 2.6. 16 Proof. Consider the geodesics g n b(t) and kn (t). By lemma 2.6, because a(t) is A contracting and b(t) is B contracting, the geodesic kn (t) is at most Φ2.6 (A, B)contracting. Assume for the sake of contradiction that kn (t) is K-contracting with K< B̃ − 16A − 77δA − 38 −3 16 In particular this gives us that K + 3 < B̃−16A−77δA −38 16 Because a(t) is δA -slim then there is an x ∈ kn (t) a y ∈ a(t) and a z ∈ g n b(t) with d(x, y) ≤ δA and d(y, z) ≤ δA . Now because kn (t) is K contracting the subsegment [x, kn (∞)] is K + 3-contracting. The geodesic [z, g n b(∞)] is within the 2δA neighborhood of [x, kn (∞)] so lemma 2.4 gives us an explicit upper bound on the contracting constant for [z, g n b(∞)]. In particular we know that it is at worst Φ2.4 (K + 3, 2δA , 2δA )-contracting where TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 21 Φ2.4 (K + 3, 2δA , 2δA ) = 16(K + 3) + 70δA + 10 Similarly, we can see that [g n p, z] is Φ2.4 (A + 3, 0, δA ) = (16A + 7δA + 10)contracting. Now g n b(t) is the concatatination of [g n p, z] and [z, g n b(∞)) and so we get that it is at most B 0 = Φ2.4 (K +3, 2δA , 2δA )+Φ2.4 (A+3, 0, 2δA )-contracting. Working everything out, the assumption that we made gives us the following inequality: B0 = 16(K + 3) + 16A + 77δA + 38 < 16  B̃−16A−77δA −38 16  + 16A + 77δA + 38 = B̃ But then g n b(t) is B-contracting with B < B̃ which is a contradiction ⇒⇐. So we know that kn (t) is K-contracting where K ≥ Ψ(B̃, A)  Corollary 2.14 provides us with a rank-one axis whenever the contracting boundary is non-empty and so lemma 5.2 gives us fine tuned control over the contracting constants under the action of that rank-one isometry. Remark 5.3. Suppose we have a sequence of contracting geodesics {kn (t)} and another non-contracting geodesic b(t) all with the same base point. If the end points kn (∞) converge to b(∞) in the visual boundary, then the contracting constants for kn (t) are unbounded. We now have all of the ingredients we needed in order to prove the main theorem. Proof of Theorem 5.1. I will first prove the equivalence of (i) through (iv). The equivalence of (v), (vi), and (vii) with the others will then be easier to show. (i) =⇒ (ii) The slim triangle condition for a δ-hyperbolic space is easily seen to imply the slim geodesic condition that we have been using, for an explicit proof see [3]. Because every geodesic is uniformly δ-slim by the hyperbolicity condition they all have uniform contracting constants by lemma 2.3. (ii) =⇒ (iii) Note that because the contracting constants are bounded, the directed system stabilizes i.e. the collection of contracting geodesics has the subspace topology induced from the visual boundary. Thus, if we can prove that every infinite ray is contracting we would be done, since the contracting boundary will then have the same topology as the entire visual boundary. Let b(t) be some geodesic ray in X and pick any a(t) ∈ ∂c X, by corollary 4.7 there is a sequence of {gi } such that gi a(t) → b(t). If b(t) is not contracting then by remark 5.3 the contracting constants of the representatives of gi a(t) that start at x = a(0) are getting worse and worse without bound, contradiction ⇒⇐. (iii) =⇒ (iv) This is obvious. 22 DEVIN MURRAY (iv) =⇒ (i) This follows from The Flat Plane Theorem. i.e. since ∂X ⊆ ∂c X we have that every geodesic in X is contracting, thus there are no non-contracting geodesics. In particular this implies that there are no Euclidean planes embedded in X, but by the above theorem this implies that X is δ-hyperbolic. (iii) =⇒ (v) For a proper CAT(0) space ∂X is compact. (v) =⇒ (vi) This is trivial. (vi) =⇒ (ii) Assume (ii) is false, then I will show that ∂c X is not locally compact. Let α be some element of ∂c X and let U be an arbitrary neighborhood of α. By corollary 2.14 there is some rank-one isometry, g, and by theorem 4.1 we may assume that the forward end point of g is in the interior of U . Let a(t) be an axis of g and let A be its contracting constant. By assumption there is a subset B = {bi (t)} such that the minimal contracting constant of each bi (t) is bounded below by 16(i + 16A + 77δA + 38). Applying theorem 4.1 with the g n as the gi and switching the roles of a(t) and bi (t) we can see that g n bi (∞) converges to a(∞). In particular, for each i there is an n, say ni , such that g ni bi (∞) is in U . Let the geodesics [a(0), g ni bi (∞)) be denoted by ci (t). Applying lemma 5.2 we get that the ci (t) are at least i contracting. Let theTcollection C = {Ci } where Ci = {cj (t)}j≥i . Each set Ci is a closed subset of U and Ci = ∅. The collection {U \ Ci } will then be an open cover of U with no finite refinement and so U is not compact. Since α and U were arbitrary ∂c X is not locally compact. (i) + (iii) =⇒ (vii) The Gromov boundary of a δ-hyperbolic group is metrizable and since the contracting boundary is homeomorphic to the visual boundary we are done. (vii) =⇒ (ii) Assume that (ii) is false, that there is no upper bound on the contracting constants of the contracting boundary. We will show that the contracting boundary is not first countable (and thus not metrizable). As with the example in the introduction to this section it is enough to exhibit a collection {αij } and an α in the contracting boundary such that for each j, αij → α as i → ∞, but the αij are at best j contracting. In particular this means that for any function f : N → N the sequence αfj (j) will not converge to α. This is because the intersection of {αfj (j) } with ∂cD Xx0 will always be finite and thus the set {αfj (j) } is closed. We’ve already seen that the existence of such a sequence contradicts first countability. The construction of the αij ’s aren’t particularly hard in light of lemma 5.2. Since ∂c X is non-empty we have by proposition 2.14 a rank-one isometry g with axis a(t). Now since a(t) is rank-one it has a contracting constant A and is δA slim. We are assuming that there is no upper bound on the contracting constants for geodesics so pick a geodesic bj (t) with a minimal contracting constant B̃j of at least 16j + 16A + 77δA + 38. By lemma 5.2 the geodesics kij (t) = [b(0), g i bj (∞)] will be K-contracting where j ≤ Ψ(B̃j , A) ≤ K ≤ Φ5.2 (A, B̃j ). TOPOLOGY AND DYNAMICS OF THE CONTRACTING BOUNDARY 23 So we have our collection of points in the contracting boundary {kij (∞)}. For each j the geodesics kij (t) have a fixed upper bound on their contracting constants. To get convergence in the visual boundary recall that a rank one isometry acts by north-south dynamics on the visual boundary [6]. Thus lim kij (∞) = a(∞) for each i j in ∂c X and the contracting constants are bounded below by j. This gives us that ∂c X cannot be first countable.  References [1] C. Croke and B. Kleiner, “Spaces with nonpositive curvature and their ideal boundaries,” Topology 39 no. 3, (2000) 549–556. [2] M. Bridson and A. Haefliger, Metric Spaces of Non-positive Curvature, vol. 319 of Grundlehren der Mathematischen Wissenschaften. Springer-Verlag, Heidelberg, 1999. [3] R. Charney and H. Sultan, “Contracting boundaries of CAT(0) spaces,” Journal of Topology (2013) . [4] Y. Algom-Kfir, “Strongly contracting geodesics in outer space,” Geometry and Topology 15 no. 4, (2011) 2181–2233. [5] M. Bestvina and K. Fujiwara, “A characterization of higher rank symmetric spaces via bounded cohomology,” Geometric and Functional Analysis 19 (2009) 11–40. [6] U. Hamenstädt, “Rank-one isometries of proper CAT(0) spaces,” in Discrete Groups and Geometric Structures, K. Dekimple, P. Igodt, and A. Valette, eds., vol. 501 of Contemporary Math. 2009. [7] W. Ballmann and S. Buyalo, “Periodic rank one geodesics in Hadamard spaces,” in Geometric and Probabilistic Structures in Dynamics, vol. 469 of Contemporary Math. 2008. [8] W. Ballmann, “Nonpositively curved manifolds of higher rank,” Annals of Mathematics 122 no. 3, (1985) pp. 597–609. http://www.jstor.org/stable/1971331. [9] P.-E. Caprace and M. Sageev, “Rank rigidity for cat(0) cube complexes,” Geometric and Functional Analysis 21 no. 4, (2011) 851–891. http://dx.doi.org/10.1007/s00039-011-0126-7. [10] J. Behrstock and R. Charney, “Divergence and quasimorphisms of right-angled artin groups,” Mathematische Annalen 352 no. 2, (2012) 339–356. http://dx.doi.org/10.1007/s00208-011-0641-8. [11] P.-E. Caprace and K. Fujiwara, “Rank-one isometries of buildings and quasi-morphisms of kac-moody groups,” Geometric and Functional Analysis 19 no. 5, (2010) 1296–1319. http://dx.doi.org/10.1007/s00039-009-0042-2. [12] E. Freden, “Negatively curved groups have the convergence property,” Annales Academiæ Scientiarum Fennicæ 20 no. 2, (1995) 333–348. [13] D. Gabai, “Convergence groups are fuchsian groups,” Annals of Mathematics 136 no. 3, (1992) 447–510. [14] A. Casson and D. Jungreis, “Convergence groups and seifert fibered 3-manifolds,” Inventiones Mathematicae 118 no. 3, (1994) 441–456. [15] G. Mostow, “Quasi-conformal mappings in n-space and the rigidity of hyperbolic space forms,” Publications Mathematiques de l’Institut des Hautes Etudes Scientifiques 34 no. 1, (1968) 53–104. http://dx.doi.org/10.1007/BF02684590. [16] P. Papasoglu and E. Swenson, “Boundaries and jsj decompositions of cat(0)-groups,” Geometric and Functional Analysis 19 no. 2, (2009) 558–590. http://dx.doi.org/10.1007/s00039-009-0012-8. [17] M. Cordes, “Morse Boundaries of Proper Geodesic Metric Spaces,” ArXiv e-prints (Feb., 2015) , arXiv:1502.04376 [math.GT]. [18] E. Fink, “Hyperbolicity via Geodesic Stability,” ArXiv e-prints (Apr., 2015) , arXiv:1504.06863 [math.MG]. [19] W. Ballmann, Lectures on Spaces of Nonpositive Curvature. Berkhäuser, 1995. [20] R. Charney and M. Davis, “Finite k(π, 1)’s for artin groups,” in Prospects in Topology: Proceedings of a Conference in Honor of William Browder, no. 138, pp. 110–124, Princeton University Press. 1995. 24 DEVIN MURRAY [21] E. Ghys and P. de la Harpe, Sur les Groupes Hyperboliques d’aprés Mikhael Gromov, vol. 83 of Progress in Mathematics. Birkhäuser, 1990. [22] E. L. Swenson, “A cut point theorem for CAT(0) groups,” J. Differential Geom. 53 no. 2, (1999) 327–358. http://projecteuclid.org/euclid.jdg/1214425538.
4math.GR
Sensor Placement for Optimal Kalman Filtering: Fundamental Limits, Submodularity, and Algorithms✩ Vasileios Tzoumas∗, Ali Jadbabaie, George J. Pappas arXiv:1509.08146v3 [math.OC] 31 Jan 2016 Department of Electrical and Systems Engineering, University of Pennsylvania, Philadelphia, PA 19104-6228 USA Abstract In this paper, we focus on sensor placement in linear dynamic estimation, where the objective is to place a small number of sensors in a system of interdependent states so to design an estimator with a desired estimation performance. In particular, we consider a linear time-variant system that is corrupted with process and measurement noise, and study how the selection of its sensors affects the estimation error of the corresponding Kalman filter over a finite observation interval. Our contributions are threefold: First, we prove that the minimum mean square error of the Kalman filter decreases only linearly as the number of sensors increases. That is, adding extra sensors so to reduce this estimation error is ineffective, a fundamental design limit. Similarly, we prove that the number of sensors grows linearly with the system’s size for fixed minimum mean square error and number of output measurements over an observation interval; this is another fundamental limit, especially for systems where the system’s size is large. Second, we prove that the log det of the error covariance of the Kalman filter, which captures the volume of the corresponding confidence ellipsoid, with respect to the system’s initial condition and process noise is a supermodular and non-increasing set function in the choice of the sensor set. Therefore, it exhibits the diminishing returns property. Third, we provide efficient approximation algorithms that select a small number sensors so to optimize the Kalman filter with respect to this estimation error —the worst-case performance guarantees of these algorithms are provided as well. Finally, we illustrate the efficiency of our algorithms using the problem of surface-based monitoring of CO2 sequestration sites studied in Weimer et al. (2008). Keywords: Least-Squares Linear Estimator, Process and Measurement Noise, Minimal Sensor Placement, Greedy Algorithms. 1. Introduction sor measurements (Kailath et al. (2000)) and, as a result, we consider the presence of measurement noise. In this paper, we aim to monitor dynamic, interdependent Specifically, we consider phenomena modelled as linear tiphenomena, that is, phenomena with temporal and spatial corme-variant systems corrupted with process and measurement relations —with the term “spatial” we refer to any kind of internoise. Our first goal is to study how the placement of their sendependencies between the phenomena. For example, the temsors affects the minimum mean square error of their Kalman perature at any point of an indoor environment depends across filter over a finite observation interval (Kailath et al. (2000)). time —temporal correlation— on the temperatures of the adjaMoreover, we aim to select a small number of sensors so to cent points —spatial correlation (Madsen & Holst (1995)). There- minimize the volume of the corresponding confidence ellipsoid fore, these correlations allow to monitor such phenomena usof this estimation error. Thereby, this study is an important dising a reduced number of sensors; this is an important observatinction in the minimal sensor placement literature (Clark et al. tion when operational constraints, such as limited bandwidth (2012); Lin et al. (2013); Olshevsky (2014); Pequito et al. (2014); and communication power, necessitate the design of estimaPasqualetti et al. (2014); Summers et al. (2014); Tzoumas et al. tors using a small number of sensors (Rowaihy et al. (2007); (2015); Matni & Chandrasekaran (2014); Pequito et al. (2015); Hero III & Cochran (2011)). Hence, in this paper we consider Tzoumas et al. (July 2015); Yan et al. (2015); Zhao & Cortés (2015)), to place a few sensors so to monitor this kind of phenomena. To since the Kalman filter is the optimal linear estimator —in the this end, we also account for unknown interdependencies and minimum mean square sense— given a sensor set (Kalman (1960)). inputs in their dynamics (Bertsekas (2005)) and, as a result, we Our contributions are threefold: consider the presence of process noise, i.e., noise that affects directly these dynamics. In addition, we account for noisy senFundamental limits. First, we identify fundamental limits in the design of the Kalman filter with respect to its sensors. In particular, given a fixed number of output measurements over ✩ This paper was not presented at any IFAC meeting. Some of the results in any finite observation interval, we prove that the minimum mean this paper will appear in preliminary form in Tzoumas et al. (2016). ∗ Corresponding author. Tel.: +1 (215) 898 5814; fax: +1 (215) 573 2048. square error of the Kalman filter decreases only linearly as the Email addresses: [email protected] (Vasileios Tzoumas), number of sensors increases. That is, adding extra sensors so to [email protected] (Ali Jadbabaie), reduce this estimation error of the Kalman filter is ineffective, [email protected] (George J. Pappas) Preprint submitted to Elsevier February 2, 2016 a fundamental design limit. Similarly, we prove that the number of sensors grows linearly with the system’s size for fixed minimum mean square error; this is another fundamental limit, especially for systems where the system’s size is large. On the contrary, given a sensor set of fixed cardinality, we prove that the number of output measurements increases only logarithmically with the system’s size for fixed estimation error. Overall, our novel results quantify the trade-off between the number of sensors and that of output measurements so to achieve a specified value for the minimum mean square error. These results are the first to characterize the effect of the sensor set on the minimum mean square error of the Kalman filter. In particular, in Pasqualetti et al. (2014), the authors quantify only the trade-off between the total energy of the consecutive output measurements and the number of its selected sensors. Similarly, in Yan et al. (2015), the authors consider only the maximum-likelihood estimator for the system’s initial condition and only for a special class of stable linear time-invariant systems. Moreover, they consider systems that are corrupted merely with measurement noise, which is white and Gaussian. Finally, they also assume an infinite observation interval, that is, infinite number of consecutive output measurements. Nonetheless, we assume a finite observation interval and study the Kalman estimator both for the system’s initial condition and for the system’s state at the time of the last output measurement. In addition, we consider general linear time-variant systems that are corrupted with both process and measurement noise, of any distribution (with zero mean and finite variance). Overall, our results characterize the effect of the cardinality of the sensor set on the minimum mean square error of the Kalman filter, that is, the optimal linear estimator. Algorithms. Third, we consider two problems of sensor placement so to optimize the log det of the error covariance of the Kalman filter with respect to the system’s initial condition and process noise of Kalman estimator —henceforth, we refer to this error as log det error. First, we consider the problem of designing an estimator that guarantees a specified log det error and uses a minimal number of sensors —we refer to this problem as P1 . Second, we consider the problem of designing an estimator that uses at most r sensors and minimizes the log det error —we refer to this problem as P2 . Naturally, P1 and P2 are combinatorial, and in particular, they involve the minimization of the supermodular log det error. Because the minimization of a general supermodular function is NP-hard (Feige (1998)), we provide efficient approximation algorithms for their general solution, along with their worst-case performance guarantees. Specifically, we first provide an efficient algorithm for P1 that returns a sensor set that satisfies the estimation guarantee of P1 and has cardinality up to a multiplicative factor from the minimum cardinality sensor sets that meet the same estimation bound. More importantly, this multiplicative factor depends only logarithmically on the problem’s P1 parameters. Next, we provide an efficient algorithm for P2 that returns a sensor set of cardinality l ≥ r (l is chosen by the designer) and achieves a near optimal value for increasing l. Specifically, for l = r, it achieves a worst-case approximation factor 1 − 1/e.2 In comparison, the related literature has focused either a) on only the optimization of the log det error for special cases of systems with zero process noise, or b) on heuristic algorithms that provide no worst-case performance guarantees, or c) on static phenomena. In particular, in Joshi & Boyd (2009), the authors minimize the log det error for the case where there is no process noise in the system’s dynamics —we assume both process and measurement noise. Moreover, to this end they use convex relaxation techniques that provide no performance guarantees. Furthermore, in Dhingra et al. (2014) and Munz et al. (2014), the authors design an H2 -optimal estimation gain with a small number of non-zero columns. To this end, they also use convex relaxation techniques that provide no performance guarantees. In addition, in Belabbas (2015), the author designs an output matrix with a desired norm so to minimize the minimum mean square error of the corresponding Kalman estima- Submodularity. Second, we identify properties for the log det of the error covariance of the Kalman filter, which captures the volume of the corresponding confidence ellipsoid, with respect to the system’s initial condition and process noise over a finite observation interval as a sensor set function —the design of an optimal Kalman filter with respect to the system’s initial condition and process noise implies the design of an optimal Kalman filter with respect to the system’s state. Specifically, we prove that it is a supermodular and non-increasing set function in the choice of the sensor set. In Krause et al. (2008), the authors study sensor placement counterexample in the context of sensor scheduling that the minimum mean for monitoring static phenomena with only spatial correlations. square error of the Kalman filter with respect to the system’s state is not in To this end, they prove that the mutual information between general a supermodular set function. We can extend this counterexample in the the chosen and non-chosen locations is submodular. Notwithcontext of minimal sensor placement as well: the minimum mean square error of the Kalman with respect to the system’s state is not in general a supermodular standing, we consider dynamic phenomena with both spatial set function with respect to the choice of the sensor set. and temporal correlations, and as a result, we characterize as 2 Such algorithms, that involve the minimization of supermodular set submodular a richer class of estimation performance metrics. functions, are also used in the machine learning (Krause & Guestrin), path Furthermore, in the sensor scheduling literature (Gupta et al. planning for information acquisition (Singh et al. (2009); Atanasov et al. (2014)), leader selection (Clark et al. (2012, 2014b,a)), sensor scheduling (2006)), the log det of the error covariance of the Kalman filter (Shamaiah et al. (2010); Jawaid & Smith (2015); Zhang et al. (2015)), achas been proven submodular but only for special cases of systuator placement (Olshevsky (2014); Summers et al. (2014); Tzoumas et al. tems with zero process noise (Shamaiah et al. (2010); Jawaid & Smith (2015); Tzoumas et al. (July 2015,D); Zhao & Cortés (2015)) and sensor place(2015)); in contrast, we consider the presence of process noise, ment in static phenomena (Krause et al. (2008); Jiang et al. (2015)) literature. Their popularity is due to their simple implementation —they are and prove our result for the general case. 1 1 In greedy algorithms— and provable worst-case approximation factors, that are the best one can achieve in polynomial time for several classes of functions (Nemhauser & Wolsey (1978); Feige (1998)). Jawaid & Smith (2015); Zhang et al. (2015), the authors prove with a 2 where xk ∈ Rn (n ∈ N) is the state vector, yk ∈ Rc (c ∈ [n]) the output vector, wk the process noise and vk the measurement noise —without loss of generality, the input vector in (1) is assumed zero. The initial condition is x0 . tor; nonetheless, the author does not minimize the number of selected sensors. Finally, in Das & Kempe (2008), the authors consider the problem of sensor placement for monitoring static phenomena with only spatial correlation. To this end, they place a small number of sensors so to minimize a worst-case estimation error of an aggregate function, such as the average. In contrast, we consider dynamic phenomena with both spatial and temporal correlations, and we minimize the log det error of the Kalman filter; as a result, we do not focus on a worst-case estimation error, and we can efficiently estimate any function. Overall, in this paper we optimize the log det error for the general case of dynamic systems and, at the same time, we provide worst-case performance guarantees for the corresponding algorithms. The remainder of this paper is organized as follows. In Section 2, we introduce our model, and our estimation and sensor placement framework, along with our sensor placement problems. In Section 3, we provide a series of design and performance limits and characterize the properties of the Kalman estimator with respect to its sensor set; in Section 4, we prove that the log det estimation error of the Kalman filter with respect to the system’s initial condition and process noise is a supermodular and non-increasing set function in the choice of the sensor set; and in Section 5, we provide efficient approximation algorithms for selecting a small number of sensors so to design an optimal Kalman filter with respect to its log det error —the worst-case performance guarantees of these algorithms are provided as well. Finally, in Section 6, we illustrate our analytical findings, and test the efficiency of our algorithms, using simulation results from an integrator chain network and the problem of surface-based monitoring of CO2 sequestration sites studied in Weimer et al. (2008). Section 7 concludes the paper. Assumption 1 (For all k ≥ 0, the initial condition, the process noise and the measurement noise are uncorrelated random variables). x0 is a random variable with covariance C(x0 ) ≻ 0. Moreover, for all k ≥ 0, C(wk ) ≻ 0 and C(vk ) = σ 2 I, where σ > 0. Finally, for all k, k ′ ≥ 0 such that k 6= k ′ , x0 , wk and vk , as well as, wk , wk′ , vk and vk′ , are uncorrelated.3 Moreover, for k ≥ 0, consider the vector of measurements ȳk , the vector of process noises w̄k and the vector of measurement noises v̄k , defined as follows: ȳk ≡ (y0⊤ , y1⊤ , . . . , yk⊤ )⊤ , w̄k ≡ (w0⊤ , w1⊤ , . . . , wk⊤ )⊤ , and v̄k ≡ (v0⊤ , v1⊤ , . . . , vk⊤ )⊤ , respectively; the vector ȳk is known, while the w̄k and v̄k are not. Definition 1 (Observation interval and its length). The interval [0, k] ≡ {0, 1, . . . , k} is called the observation interval of (1). Moreover, k + 1 is its length. Evidently, the length of an observation interval [0, k] equals the number of measurements y0 , y1 , . . . , yk . In this paper, given an observation interval [0, k], we consider the minimum mean square linear estimators for xk′ , for any k ′ ∈ [0, k] (Kailath et al. (2000)). In particular, (1) implies ȳk = Ok zk−1 + v̄k , ⊤ ⊤ ⊤ where Ok is the c(k+1)×n(k+1) matrix [L⊤ 0 C0 , L1 C1 , . . . , ⊤ ⊤ ⊤ Lk Ck ] , L0 the n × n(k + 1) matrix [I, 0], Li , for i ≥ 1, the n× n(k + 1) matrix [Ai−1 · · · A0 , Ai−1 · · · A1 , . . . , Ai−1 , I, 0], ⊤ ⊤ and zk−1 ≡ (x⊤ 0 , w̄k−1 ) . As a result, the minimum mean square linear estimate of zk−1 is the ẑk−1 ≡ E(zk−1 )+C(zk−1 ) −1 Ok⊤ Ok C(zk−1 )Ok⊤ + σ 2 I (ȳk − Ok E(zk−1 ) − E(v̄k )); its error covariance is  Σzk−1 ≡ E (zk−1 − ẑk−1 )(zk−1 − ẑk−1 )⊤ 2. Problem Formulation Notation. We denote the set of natural numbers {1, 2, . . .} as N, the set of real numbers as R, and the set {1, 2, . . . , n} as [n], where n ∈ N. Given a set X , |X | is its cardinality. Matrices are represented by capital letters and vectors by lower-case letters. For a matrix A, A⊤ is its transpose and Aij its√element located at the i−th row and j−th column. kAk2 ≡ A⊤ A is its spectral norm, and λmin (A) and λmax (A) its minimum and maximum eigenvalues, respectively. Moreover, if A is positive semi-definite or positive definite, we write A  0 and A ≻ 0, respectively. Furthermore, I is the identity matrix —its dimension is inferred from the context; similarly for the zero matrix n 0. Finally, for a random  variable x ∈ R , E(x) is its expected value, and C(x) ≡ E [x − E(x)] [x − E(x)]⊤ its covariance. The rest of our notation is introduced when needed. = C(zk−1 ) − C(zk−1 )Ok⊤ −1 Ok C(zk−1 )Ok⊤ + σ 2 I Ok C(zk−1 )  mmse(zk−1 ) ≡ E (zk−1 − ẑk−1 )⊤ (zk−1 − ẑk−1 )  = tr Σzk−1 . (4) As a result, the corresponding minimum mean square linear estimator of xk′ , for any k ′ ∈ [0, k], is x̂k′ = Lk′ ẑk−1 , (since xk′ = Lk′ zk−1 ), with minimum mean square error  mmse(xk′ ) ≡ tr Lk′ Σzk−1 L⊤ k′ . For k ≥ 0, we consider the linear time-variant system yk = Ck xk + vk , (3) and its minimum mean square error 2.1. Model and Estimation Framework xk+1 = Ak xk + wk , (2) (5) (6) 3 This assumption is common in the related literature (Joshi & Boyd (2009)), and it translates to a worst-case scenario for the problem we consider in this paper. (1) 3 In particular, the recursive implementation of (5) results to the Kalman filtering algorithm (Bertsekas (2005)). In this paper, in addition to the minimum mean square error of x̂k′ , we also consider per (5) the estimation error metric that is related to the η-confidence ellipsoid of zk−1 − ẑk−1 (Joshi & Boyd (2009)). Specifically, this is the minimum volume ellipsoid that contains zk−1 − ẑk−1 with probability η, that (η) and is, the Eǫ ≡ {z : z ⊤ Σzk−1 z ≤ ǫ}, where ǫ ≡ Fχ−1 2 Objective 1 (Fundamental limits in optimal sensor placement). Given an observation interval [0, k], i ∈ {0, k} and a desired mmse(xi ), identify fundamental limits in the design of the sensor set. As an example of a fundamental limit, we prove that the number of sensors grows linearly with the system’s size for fixed estimation error mmse(xi ) —this is clearly a major limitation, especially when the system’s size is large. This result, as well as, the rest of our contributions with respect to Objective 1, is presented in Section 3. n(k+1) Fχ2n(k+1) is the cumulative distribution function of a χ-squared random variable with n(k + 1) degrees of freedom (Venkatesh (2012)). Therefore, the volume of Eǫ ,   (ǫπ)n(k+1)/2 det Σ1/2 vol(Eǫ ) ≡ zk−1 , Γ (n(k + 1)/2 + 1) Objective 2 (log det estimation error as a sensor set function). Given an observation interval [0, k], identify properties of the  log det Σzk−1 as a sensor set function. (7) We addressthis objective in Section 4, where we prove that log det Σzk−1 is a supermodular and non-increasing set function with respect to the choice of the sensor set —the basic definitions of supermodular set functions are presented in that section as well. where Γ(·) denotes the Gamma function (Venkatesh (2012)), quantifies the estimation’s error of ẑk−1 , and as a result, for any k ′ ∈ [0, k], of x̂k′ as well, since per (5) the optimal estimator for zk−1 defines the optimal estimator for xk′ . Henceforth, we consider the logarithm of (7),  (8) log vol(Eǫ ) = β + 1/2 log det Σzk−1 ; Objective 3 (Algorithms for optimal sensor placement). Given an observation interval [0, k], identify a sensor set S that solves either the minimal sensor placement problem: β is a constant that depends only on n(k + 1) and ǫ, in accor dance to (7), and as a result, we refer to the log det Σzk−1 as the log det estimation error of the Kalman filter of (1): minimize S⊆[n] subject to Definition 2 (log det estimation error of the Kalman filter). Given an observation interval [0, k], the log det Σzk−1 is called the log det estimation error of the Kalman filter of (1). |S|  log det Σzk−1 ≤ R; (P1 ) or the cardinality-constrained sensor placement problem for minimum estimation error:  minimize log det Σzk−1 S⊆[n] (P2 ) subject to |S| ≤ r. In the following paragraphs, we present our sensor placement framework, that leads to our sensor placement problems. 2.2. Sensor Placement Framework In this paper, we study among others the effect of the selected sensors in (1) on mmse(x0 ) and mmse(xk ). Therefore, this translates to the following conditions on Ck , for all k ≥ 0, in accordance with the minimal sensor placement literature (Olshevsky (2014)). That is, with P1 we design an estimator that guarantees a specified error and uses a minimal number of sensors, and with P2 an estimator that uses at most r sensors and minimizes  log det Σzk−1 . The corresponding algorithms are provided in Section 5. Assumption 2 (C is a full row-rank constant zero-one matrix). For all k ≥ 0, Ck = C ∈ Rc×n , where C is a zero-one constant matrix. Specifically, each row of C has one element equal to one, and each column at most one, such that C has rank c. 3. Fundamental Limits in Optimal Sensor Placement In this section, we present our contributions with respect to Objective 1. In particular, given any finite observation interval, we prove that the minimum mean square error decreases only linearly as the number of sensors increases. That is, adding extra sensors so to reduce the minimum mean square estimation error of the Kalman filter is ineffective, a fundamental design limit. Similarly, we prove that the number of sensors grows linearly with the system’s size for fixed minimum mean square error; this is another fundamental limit, especially for systems where the system’s size is large. On the contrary, given a sensor set of fixed cardinality, we prove that the length of the observational interval increases only logarithmically with the system’s size for fixed minimum mean square error. Overall, our novel results quantify the trade-off between the number of sensors and In particular, when for some i, Cij is one, the j-th state of xk is measured; otherwise, it is not. Therefore, the number of non-zero elements of C coincides with the number of placed sensors in (1). Definition 3 (Sensor set and sensor placement). Consider a C per Assumption 2 and define S ≡ {i : i ∈ [n] and Cji = 1, for some j ∈ [r]}; S is called a sensor set or a sensor placement and each of its elements a sensor. 2.3. Sensor Placement Problems We introduce three objectives, that we use to define the sensor placement problems we consider in this paper. 4 at least as large as their harmonic mean, using (12), that of output measurements so to achieve a specified value for the minimum mean square error. To this end, given i ∈ {0, k}, we first determine a lower and upper bound for mmse(xi ).4 mmse(x0 ) ≥ Theorem 1 (A lower and upper bound for the estimation error with respect to the number of sensors and the length of the observation interval). Consider a sensor set S, any finite observation interval [0, k], and a non-zero σ. Moreover, let µ ≡ maxm∈[0,k] kAm k2 and assume µ 6= 1. Finally, denote the maximum diagonal element of C(x0 ), C(x0 )−1 , and C(wk′ ), 2 among all k ′ ∈ [0, k], as σ02 , σ0−2 , and σw , respectively. Given i ∈ {0, k}, |S| 1 − nσ 2 li  ≤ mmse(xi ) ≤ nui , / (1 − µ2 ) + σ 2 σ0−2 (9) n2 σ 2  . tr Õk + nσ 2 σ0−2  2(k+1) n|S| 1−µ , and as a result, the lower bound in (9) for mmse(x0 ) 1−µ2 follows. Next, we prove the upper bound in (9), using (18), which is proved in the proof of Proposition 1, and (6) for k ′ = 0: Ok + σ 2 C(zk−1 )−1  σ 2 C(zk−1 )−1 , and as a result, from Propo−1 sition 8.5.5 of Bernstein (2009), Ok + σ 2 C(zk−1 )−1   2 σ −2 C(zk−1 ). Hence, mmse(x0 ) ≤ tr L0 C(zk−1 )L⊤ 0 ≤ nσ0 . Finally, to derive the lower and upper bounds for mmse(xk ), observe that mmse(x0 ) ≤ mmse(zk−1 ) and mmse(zk−1 ) ≤ 2 n(k + 1) max(σ02 , σw ) —the proof follows using similar steps as above. Then, from Theorem 1 of Fang et al. (1994),  λmin L⊤ k Lk mmse(zk−1 ) ≤mmse(xk ) ≤  λmax L⊤ k Lk mmse(zk−1 ).  where l0 = 1, u0 = σ02 , lk = λmin L⊤ k Lk and uk = (k + 2 2 1)λmax L⊤ k Lk max(σ0 , σw ). Proof. We first prove the lower bound in (9): observe first that mmse(x0 ) ≥ mmse(x0 )w· =0 , where mmse(x0 )w· =0 is the minimum mean square error of x0 when the process noise wk in (1) is zero for all k ≥ 0. To express mmse(x0 )w· =0 in a closed form similar to (15), note that in this case (2) becomes   ⊤ ⊤ ⊤ ⊤ ȳk = Õk x0 + v̄k , where Õk ≡ C0⊤ , Φ⊤ 1 C1 , . . . , Φk Ck and Φm ≡ Am−1 · · · A0 , for m > 0, and Φm ≡ I, for m = 0. Thereby, from Corollary E.3.5 of Bertsekas (2005), the mini· =0 , has mum mean square linear estimate of x0 , denoted as x̂w k0 error covariance  · =0 ⊤ · =0 · =0 ) )(x0 − x̂w ≡ E (x0 − x̂w Σw k0 k0 k0 and minimum mean square error  · =0 mmse(x0 )w· =0 ≡ tr Σw k0  −1  2 ⊤ 2 −1 = σ tr Õk Õk + σ C(x0 )  −1  , ≡ σ 2 tr Õk + σ 2 C(x0 )−1 tr Õk + σ 2 C(x0 )−1  ≥ Now, for i ∈ [n], let I (i) be the n × n matrix where Iii is one, (j, k) 6= (i, i). Then, tr(Õk )  =  all P P Pwhile Ijk is zero, for n k k ⊤ (i) ⊤ ⊤ = tr Φm I Φm ; i=1 si tr m=0 Φm C CΦm  P m=0  P k k ⊤ (i) ⊤ (i) = Φ I Φ ≤ nλ now, tr Φ I Φ m max m m=0 m m=0 m Pk Pk 2 (i) ⊤ (i) nk m=0 Φm I Φm k2 ≤ n m=0 kΦm k2 , because kI k2 = 1, and from the definition of Φm and Proposition 9.6.1 of Bernstein Pk Pn 2(k+1) 2 (2009), m=0 kΦm k22 ≤ 1−µ . Therefore, tr(Õk ) ≤ i=1 si n 1−µ 1−µ2 1− µ2(k+1) = C(x0 ) − C(x0 )Õk⊤  −1 Õk C(x0 )Õk⊤ + σ 2 I Õk C(x0 ), n2 σ 2  The combination of these inequalities completes the proof. The upper bound corresponds to the case where no sensors have been placed (C = 0). On the other hand, the lower bound corresponds to the case where |S| sensors have been placed. As expected, the lower bound in (9) decreases as the number of sensors or the length of the observational interval increases; the increase of either should push the estimation error downwards. Overall, this lower bound quantifies fundamental performance limits in the design of the Kalman estimator: first, this bound decreases only inversely proportional to the number of sensors. Therefore, the estimation error of the optimal linear estimator decreases only linearly as the number of sensors increases. That is, adding extra sensors so to reduce the minimum mean square estimation error of the Kalman filter is ineffective, a fundamental design limit. Second, this bound increases linearly with the system’s size. This is another fundamental limit, especially for systems where the system’s size is large. Finally,  , these scaling extend to L for fixed and non-zero λmin L⊤ k k the mmse(xk ) as well, for any finite k. (10) (11) (12) where we deduce (11) from (10) using the Woodbury matrix identity (Corollary 2.8.8 of Bernstein (2009)), and (12) from (11) using the notation Õk ≡ Õk⊤ Õk . In particular, Õk is the Pk−1 ⊤ ⊤ observability matrix Õk = m=0 Φm Ck Ck Φm of (1) (Chen (1998)).  −1  2 2 −1 Hence, mmse(x0 ) ≥ σ tr Õk + σ C(x0 ) , and Corollary 1 (Trade-off among the number of sensors, estimation error and the length of the observation interval). Consider any finite observation interval [0, k], a non-zero σ, and for i ∈ {0, k}, that the desired value for mmse(xi ) is α (α > 0). Moreover, let µ ≡ maxm∈[0,k] kAm k2 and assume µ 6= 1. Finally, denote the maximum diagonal element of C(x0 )−1 as σ0−2 . Any since the arithmetic mean of a finite set of positive numbers is 4 The extension of Theorem 1 to the case µ = 1 is straightforward, yet notationally involved; as a result, we omit it. 5 sensor set S that achieves mmse(xi ) = α satisfies: |S| ≥ nσ 2 li /α − σ 2 σ0−2  1 − µ2 . 1 − µ2(k+1) We now give the definition of a supermodular set function, as well as, that of an non-decreasing set function —we follow Wolsey (1982) for this material. Denote as 2[n] the power set of [n]. (13) Definition 4 (Submodularity and supermodularity). A function h : 2[n] 7→ R is submodular if for any sets S and S ′ , with S ⊆ S ′ ⊆ [n], and any a ∈ / S′,  where l0 = 1 and lk = λmin L⊤ k Lk . The above corollary shows that the number of sensors increases as the minimum mean square error or the number of output measurements decreases. More importantly, it shows that the number of sensors increases linearly with the system’s size for fixed minimum mean square error. This is again a fundamental design limit, especially when the system’s size is large.5 h(S ∪ {a}) − h(S) ≥ h(S ′ ∪ {a}) − h(S ′ ). A function h : 2[n] 7→ R is supermodular if (−h) is submodular. An alternative definition of a submodular function is based on the notion of non-increasing set functions. Corollary 2 (Trade-off among the length of the observation interval, estimation error and the number of sensors). Consider any finite observation interval [0, k], a sensor set S, a non-zero σ, and for i ∈ {0, k}, that the desired value for mmse(xi ) is α (α > 0). Moreover, let µ ≡ maxm∈[0,k] kAm k2 and assume µ 6= 1. Finally, denote the maximum diagonal element of C(x0 )−1 as σ0−2 . Any observation interval [0, k] that achieves mmse(xi ) = α satisfies:   log 1 − nσ 2 li /α − σ 2 σ0−2 (1 − µ2 )/|S| k≥ − 1, (14) 2 log (µ)  where l0 = 1 and lk = λmin L⊤ k Lk . Definition 5 (Non-increasing and non-decreasing set function). A function h : 2[n] 7→ R is a non-increasing set function if for any S ⊆ S ′ ⊆ [n], h(S) ≥ h(S ′ ). Moreover, h is a nondecreasing set function if (−h) is a non-increasing set function. Therefore, a function h : 2[n] 7→ R is submodular if, for any a ∈ [n], the function ha : 2[n]\{a} 7→ R, defined as ha (S) ≡ h(S ∪ {a}) − h(S), is a non-increasing set function. This property is also called the diminishing returns property. The first major result of this section follows, where we let Ok ≡ Ok⊤ Ok , given an observation interval [0, k]. As expected, the number of output measurements increases as the minimum mean square error or the number of sensors decreases. Moreover, in contrast to our comments on Corollary 1 and the number of sensors, Corollary 2 indicates that the number of output measurements increases only logarithmically with the system’s size for fixed error and number of sensors. On the other hand, it also decreases logarithmically with the number of sensors, and this is our final design limit result. In the following paragraphs, we prove that the log det error of the Kalman filter is a supermodular and non-increasing set function in the choice of the sensor set. Then, we use this result to provide efficient algorithms for the solution of P1 and P2 . Proposition 1 (Closed formula for the log det error as a sensor set function). Given an observation interval [0, k] and non-zero σ, irrespective of Assumption 2,  log det Σzk−1 =  2n(k + 1) log (σ) − log det Ok + σ 2 C(zk−1 )−1 . (15) Proof. From (3), Σzk−1 = C(zk−1 ) − C(zk−1 )Ok⊤ −1 Ok C(zk−1 )Ok⊤ + σ 2 I Ok C(zk−1 ) −1 = σ −2 Ok⊤ Ok + C(zk−1 )−1 −1 , = σ 2 Ok + σ 2 C(zk−1 )−1 4. Submodularity in Optimal Sensor Placement In this section, we present our contributions with respect to Objective 2. In particular, we first derive a closed formula for log det Σzk−1 and then prove that it is a supermodular and non-increasing set function in the choice of the sensor set. This implies that the greedy algorithms for the solution of P1 and P2 return efficient approximate solutions (Feige (1998); Nemhauser & Wolsey (1978)). In Section 5, we use this supermodularity result, and known results from the literature on submodular function maximization (Nemhauser & Wolsey (1988)), to provide efficient algorithms for the solution of P1 and P2 . (16) (17) (18) where we deduce (17) from (16) using the Woodbury matrix identity (Corollary 2.8.8 of Bernstein (2009)), and (18) from (17) using the fact that Ok = Ok⊤ Ok .  Therefore, the log det Σzk−1 depends on the sensor set through Ok . Now, the main result of this section follows, where we make explicit the dependence of Ok on the sensor set S. Theorem 2 (The log det error is a supermodular and non-increasing set function with respect to the choice of the sensor set). Given an observation interval [0, k], the  log det Σzk−1 , S =  2n(k + 1) log (σ) − log det Ok,S + σ 2 C(zk−1 )−1 :  fixed and non-zero λmin L⊤ k Lk , the comments of this paragraph extend to the mmse(xk ) as well, for any finite k —on the other  hand, if ⊤ λmin L⊤ k Lk varies with the system’s size, since λmin Lk Lk ≤ 1, the number of sensors can increase sub-linearly with the system’s size for fixed mmse(xk ). 5 For S ∈ 2[n] 7→ R 6 is a supermodular and non-increasing set function with respect to the choice of the sensor set S. erty: its rate of reduction with respect to newly placed sensors decreases as the cardinality of the already placed sensors increases. On the one hand, this property implies another fundamental design limit, in accordance to that of Theorem 1: adding new sensors, after a first few, becomes ineffective for the reduction of the estimation error. On the other hand, it also implies that greedy approach for solving P1 and P2 is effective (Nemhauser & Wolsey (1978); Feige (1998)). Thereby, we next use the results from the literature on submodular function maximization (Nemhauser & Wolsey (1988)) and provide efficient algorithms for P1 and P2 . Proof. For i ∈ [n], let I (i) be the n × n matrix where Iii is one, while Ijk is zero, for all (j, k) 6= (i, i). Also, let C̄ ≡ σ 2 C(zk−1 )−1 . Now, to prove that the log det Σzk−1 , S is non-increasing, observe that Ok,S = n X m=1 sm k X j=0 (m) Lj L⊤ j I = n X sm Ok,{m} , (19) m=1 Then, for any S1 ⊆ S2 ⊆ [n], (19) and Ok,{1} , Ok,{2} , . . ., Ok,{n}  0 imply Ok,S1  Ok,S2 , and as a result, Ok,S1 + C̄  Ok,S2 + C̄. Therefore,  from Theorem 8.4.9 of Bernstein (2009), log det Ok,S1 + C̄  log det Ok,S2 + C̄ , and as a result, log det Σzk−1 is non-increasing.  set Next, to prove that log det Σzk−1 is a supermodular  function, it suffices to prove that log det Ok,S + C̄ is a submodular one. In particular, recall that a function h : 2[n] 7→ R is submodular if and only if, for any a ∈ [n], the function ha : 2[n]\{a} 7→ R, where ha (S) ≡ h(S ∪ {a}) − h(S), is a non-increasing set function. Therefore, to prove that h(S) = log det(Ok,S + C̄) is submodular, we may prove that the ha (S) is a non-increasing set function. To this end, we follow the proof of Theorem 6 in Summers et al. (2014): first, observe that 5. Algorithms for Optimal Sensor Placement In this section, we present our contributions with respect to Objective 3: P1 and P2 are combinatorial, and in Section 4 we proved that they involve the minimization of the supermodular set function log det error. In particular, because the minimization of a general supermodular function is NP-hard (Feige (1998)), in this section we provide efficient approximation algorithms for the general solution of P1 , and P2 , along with their worst-case performance guarantees. Specifically, we first provide an efficient algorithm for P1 that returns a sensor set that satisfies the estimation bound of P1 and has cardinality up to a multiplicative factor from the minimum cardinality sensor sets that meet the same estimation bound. More importantly, this multiplicative factor depends only logarithmically on the problem’s P1 parameters. Next, we provide an efficient algorithm for P2 that returns a sensor set of cardinality l ≥ r (l is chosen by the designer) and achieves a near optimal value for increasing l. To this end, we first present a fact from the supermodular functions minimization literature that we use so to construct an approximation algorithm for P1 —we follow Wolsey (1982) for this material. In particular, consider the following problem, which is of similar structure to P1 , where h : 2[n] 7→ R is a supermodular and non-increasing set function: ha (S) = log det(Ok,S∪{a} + C̄) − log det(Ok,S + C̄) = log det(Ok,S + Ok,{a} + C̄) − log det(Ok,S + C̄). Now, for any S1 ⊆ S2 ⊆ [n] and t ∈ [0, 1], define O(t) ≡ C̄+ Ok,S1 +t(Ok,S2 −Ok,S1 ) and h̄(t) ≡ log det O(t) + Ok,{a} − log det (O(t)) ; it is h̄(0) = ha (S1 ) and h̄(1) = ha (S2 ). More over, since d log det(O(t)))/dt = tr O(t)−1 dO(t)/dt (cf. equation (43) in Petersen & Pedersen (2012)), i  h −1 dh̄(t) = tr O(t) + Ok,{a} − O(t)−1 Ok,21 , dt where Ok,21 ≡ Ok,S2 − Ok,S1 . From Proposition 8.5.5 of minimize |S| −1 S⊆[n] (P) Bernstein (2009), O(t) + Ok,{a}  O(t)−1 , because O(t) ≻ subject to h(S) ≤ R. 0 for all t ∈ [0, 1], since C̄ ≻ 0, Ok,S1  0, and Ok,S2  Ok,S1 . Thereby, from Corollary 8.3.6 of Bernstein (2009), The following greedy algorithm has been proposed for its   approximate solution, for which, the subsequent fact is true. −1 O(t) + Ok,{a} − O(t)−1 Ok,21  0. Algorithm 1 Approximation Algorithm for P. As a result, dh̄(t)/dt ≤ 0, and Input: h, R. Output: Approximate solution for P. Z 1 dh̄(t) S←∅ ha (S2 ) = h̄(1) = h̄(0) + dt ≤ h̄(0) = ha (S1 ). dt while h(S) > R do 0 ai ← a′ ∈ arg maxa∈[n]\S (h(S) − h(S ∪ {a})) Therefore, ha (S) is a non-increasing set function, and the proof S ← S ∪ {ai } is complete. end while The above theorem states that for any finite observation interval, the log det error of the Kalman filter is a supermodular and non-increasing set function with respect to the choice of the sensor set. Hence, it exhibits the diminishing returns prop- Fact 1. Denote as S ⋆ a solution to P and as S0 , S1 , . . . the sequence of sets picked by Algorithm 1. Moreover, let l be the 7 smallest index such that h(Sl ) ≤ R. Then, at most n(k + 1) matrices must be computed so that the   arg max log det Σzk−1 , S − log det Σzk−1 , S ∪ {a} l h([n]) − h(∅) ≤ 1 + log . |S ⋆ | h([n]) − h(Sl−1 ) a∈[n]\S can be computed. Furthermore, O(n) time is required to find a maximum element between n available. Therefore, the computational complexity of Algorithm 2 is O(n2 (nk)3 ). For several classes of submodular functions, this is the best approximation factor one can achieve in polynomial time (Feige (1998)). Therefore, we use this result to provide the approximation Algorithm 2 for P  1 , where we make explicit the dependence of log det Σzk−1 on the selected sensor set S. Moreover, its performance is quantified with Theorem 3. Therefore, Algorithm 2 returns a sensor set that meets the estimation bound of P1 . Moreover, the cardinality of this set is up to a multiplicative factor of Fi from the minimum cardinality sensor sets that meet the same estimation bound —that is, Fi is a worst-case approximation guarantee for Algorithm 2. Additionally, Fi depends only logarithmically on the problem’s P1 parameters. Finally, the dependence of Fi on n, R and 2 ) is expected from a design perspective: increasing max(σ02 , σw the network size n, requesting a better estimation guarantee by decreasing R, or incurring a noise of greater variance, should all push the cardinality of the selected sensor set upwards. From a computational perspective, the matrix inversion is the only intensive procedure of Algorithm 2 —and it is necessary for computing the minimum mean square error of x̂i . In particular, it requires O((nk)3 ) time if we use the Gauss-Jordan elimination decomposition, since Ok in (15) is an n(k + 1) × n(k +1) matrix. On the other hand, we can speed up this procedure using the Coppersmith-Winograd algorithm (Coppersmith & Winogr (1987)), which requires O(n2.376 ) time for n × n matrices. Alternatively, we can use numerical methods, which efficiently compute an approximate inverse of a matrix even if its size is of several thousands (Reusken (2001)). Moreover, we can speed up Algorithm 2 using the method proposed in Minoux (1978), which avoids the computation of log det(Σzk−1 , S) − log det(Σzk−1 , S ∪ {a}) for unnecessary choices of a towards the computation of the   arg max log det Σzk−1 , S − log det Σzk−1 , S ∪ {a} . Algorithm 2 Approximation Algorithm for P1 .  For h(S) = log det Σzk−1 , S , where S ⊆ [n], Algorithm 2 is the same as Algorithm 1. Theorem 3 (A Submodular Set Coverage Optimization for P1 ). Denote a solution to P1 as S ⋆ and the selected set by Algorithm 2 as S. Moreover, denote the maximum diagonal element 2 , of C(x0 ) and C(wk′ ), among all k ′ ∈ [0, k], as σ02 and σw respectively. Then,  log det Σzk−1 , S ≤ R, (20)   log det Σzk−1 , ∅ − log det Σzk−1 , [n] |S|  ≤ 1 + log |S ⋆ | R − log det Σzk−1 , [n] ≡ Fi , (21)  2 where log det Σzk−1 , ∅ ≤ n(k+1) log max(σ02 , σw ). Finally, the computational complexity of Algorithm 2 is O(n2 (nk)3 ). Proof. Let S0 , S1 , . . . be the sequence of sets selected by Algo rithm 2 and l the smallest index such that log det Σzk−1 , Sl ≤ R. Therefore, Sl is the set that Algorithm 2 returns, and this proves (20). Moreover, from Fact 1,   log det Σzk−1 , ∅ − log det Σzk−1 , [n] l  . ≤ 1 + log |S ⋆ | log det Σzk−1 , Sl−1 − log det Σzk−1 , [n]  Now, l is the first time that  log det Σzk−1 , Sl ≤ R, and a result log det Σzk−1 , Sl−1 > R. This implies (21).  Furthermore, log det Σzk−1 , ∅ = log det Czk−1 , and so from the geometric-arithmetic mean inequality, a∈[n]\S Next, we develop our approximation algorithm for P2 . To this end, we first present a relevant fact from the supermodular functions minimization literature —we follow Wolsey (1982) for this material. In particular, consider the following problem, which is of similar structure to P2 , where h : 2[n] 7→ R is a supermodular, non-increasing and non-positive set function: minimize  tr(Czk−1 ) log det Czk−1 ≤ n(k + 1) log n(k + 1) 2 n(k + 1) max(σ02 , σw ) ≤ n(k + 1) log n(k + 1) S⊆[n] subject to h(S) (P ′ ) |S| ≤ r. Algorithm 3 has been proposed for its approximate solution, where l ≥ r, for which, the subsequent fact is true. 2 = n(k + 1) log max(σ02 , σw ). Fact 2. Denote as S ⋆ a solution to P ′ and as S0 , S1 , . . . , Sl the sequence of sets picked by Algorithm 3. Then, for all l ≥ r,   h(Sl ) ≤ 1 − e−l/r h(S ⋆ ). Finally, with respect to the computational complexity of Algorithm 2, note that the while loop is repeated for at most n times. Moreover, the complexity to compute the determinant of an n(k + 1) × n(k + 1) matrix, using Gauss-Jordan elimination decomposition, is O((nk)3 ) (this is also the complexity to multiply two such matrices). Additionally, the determinant of In particular, for l = r, h(Sl ) ≤ (1 − 1/e) h(S ⋆ ). 8 Thus, Algorithm 3 constructs a solution of cardinality l instead of r and achieves an approximation factor 1 − e−l/r instead of 1 − 1/e. For example, for l = r, 1 − 1/e ∼ = .63, while for l = 5r, 1 − e−l/r ∼ = .99; that is, for l = 5r, Algorithm 3 returns an approximate solution that although violates the cardinality constraint r, it achieves a value for h that is near to the optimal one. Moreover, for several classes of submodular functions, this is the best approximation factor one can achieve in polynomial time (Nemhauser & Wolsey (1978)). Therefore, we use this result to provide the approximation Algorithm 4 forP2 , where we make explicit the dependence of log det Σzk−1 on the selected sensor set S. Theorem 4 quantifies its performance. 1 2 3 4 5 Figure 1: A 5-node integrator chain. 6. Examples and Discussion 6.1. Integrator Chain Network We first illustrate the efficiency of Algorithms 2 and 4 using the integrator chain in Fig. 1, where for all i ∈ [5], Aii is −1, Ai+1,i is 1, and the rest of the elements of A are 0. We run Algorithm 2 for k ← 5, C(x0 ), C(wk′ ), C(vk′ ) ← I, for all k ′ ∈ [0, k], and R ← log det(Σz4 , {2, 4}). The algorithm returned the sensor set {3, 5}. Specifically, {3, 5} is the best such set, as it follows by comparing the values of log det(Σz4 , ·) for all sets of cardinality at most two using MATLAB R : for all i ∈ [5], log det(Σz4 , {i}) > R, while for all i, j ∈ [5] such that {i, j} = 6 {3, 5}, log det(Σz4 , {i, j}) > log det(Σz4 , {3, 5}). Therefore, any singleton set does not satisfy the bound R, while {3, 5} not only satisfies it, it also achieves the smallest log det error among all other sets of cardinality two. Hence, {3, 5} is the optimal minimal sensor set to achieve the error bound R. Similarly, Algorithm 2 returned the optimal minimal sensor set for every other value of R in the feasible region of P1 , [log det(Σz4 , [5]), log det(Σz4 , ∅)]. We also run Algorithm 4 for k ← 5, C(x0 ), C(wk′ ), C(vk′ ) ← I, for all k ′ ∈ [0, k], and r being equal to 1, 2, . . . , 5, respectively. For all values of r the chosen set coincided with the one of the same size that also minimizes log det(Σz4 , ·). Thereby, we again observe optimal performance from our algorithms. Finally, by increasing r from 0 to 5, the corresponding minimum value of log det(Σz4 , ·) decreases only linearly from 0 to −31. This is in agreement with Theorem 1, since for any M ∈ Rm×m , log det(M ) ≤ tr(M ) − m (Lemma 6, Appendix D in Weimer (2010)), and as a result, for M equal to Σzk−1 , Algorithm 4 Approximation Algorithm for P2 .  For h(S) = log det Σzk−1 , S , where S ⊆ [n], Algorithm 4 is the same as Algorithm 3. Theorem 4 (A Submodular Set Coverage Optimization for P2 ). Denote a solution to P2 as S ⋆ and the sequence of sets picked by Algorithm 4 as S0 , S1 , . . . , Sl . Moreover, denote the maximum diagonal element of C(x0 ) and C(wk′ ), among all k ′ ∈ 2 [0, k], as σ02 and σw , respectively. Then, for all l ≥ r,   log det Σzk−1 , Sl ≤ (1−e−l/r ) log det Σzk−1 , S ⋆ + (22)  e−l/r log det Σzk−1 , ∅ ,  2 where log det Σzk−1 , ∅ ≤ n(k+1) log max(σ02 , σw ). Finally, the computational complexity of Algorithm 2 is O(n2 (nk)3 ).   Proof. log det Σzk−1 , S − log det Σzk−1 , ∅ is a supermodular, non-increasing and non-positive set function. Thus, from Fact 2 we derive (22).  2 That log det Σzk−1 , ∅ ≤ n(k + 1) log max(σ02 , σw ), as well as, the computational complexity of Algorithm 4, follows as in the proof of Theorem 3. log det(Σzk−1 ) ≤ mmse(zk−1 ) − n(k + 1), (23) while, for any k ≥ 0, mmse(x0 ) ≤ mmse(zk−1 ). Algorithm 4 returns a sensor set of cardinality l ≥ r, and achieves a near optimal value for increasing l. Moreover, the 2 dependence of its approximation level on n, r and max(σ02 , σw ) is expected from a design perspective: increasing the network size n, requesting a smaller sensor set by decreasing r, or incurring a noise of greater variance should all push the quality of the approximation level downwards. Finally, from a computational perspective, our comments on Algorithm 2 apply here as well. 6.2. CO2 Sequestration Sites We now illustrate the efficiency of Algorithms 2 and 4 using the problem of surface-based monitoring of CO2 sequestration sites introduced in Weimer et al. (2008), for an instance that includes 81 possible sensor placement locations. Moreover, we exemplify the fundamental design limit presented in Theorem Algorithm 3 Approximation Algorithm for P ′ . Input: h, l. Output: Approximate solution for P ′ . S ← ∅, i ← 0 while i < l do ai ← a′ ∈ arg maxa∈[n]\S (h(S) − h(S ∪ {a})) S ← S ∪ {ai }, i ← i + 1 end while 9 Output of Algorithm 1 xk+1 = Ak xk , yk = [C, 0] xk + vk , Output of Algorithm 2 0 0 −10 −10 Achieved logdet error Error bound R 1, that the estimation error of the optimal linear estimator decreases only linearly as the number of sensors increases. CO2 sequestration sites are used so to reduce the emissions of CO2 from the power generation plans that burn fossil fuels. In particular, the problem of monitoring CO2 sequestration sites is important due to potential leaks, which we need to identify using a set of sensors. Specifically, since these sites cover large areas, power and communication constrains necessitate the minimal sensor placement for monitoring these leaks, as we undertake next: following Weimer et al. (2008), we consider a) that the sequestration sites form an 9×9 grid (81 possible sensor locations), and b) the onset of constant unknown leaks. Then, for all k ≥ 0, the CO2 concentration between the sequestration sites is described with the linear time-variant system −20 −30 −40 −50 −60 −20 −30 −40 −50 −60 0 20 40 60 80 Achieved number of sensors (24) 0 20 40 60 80 Number of sensors r Figure 2: Outputs of Algorithms 2 and 4 for the CO2 sequestration sites application of Section 6.2: In the left plot, the output of Algorithm 2 is depicted for k ← 100, C(x̄0 ), C(vk′ ) ← I, for all k ′ ∈ [0, k], and R that ranged from log det(Σz99 , [81]) ∼ = −62 to log det(Σz99 , ∅) = 0 with step size ten. In the right plot, the output of Algorithm 4 is depicted for k ← 100, C(x̄0 ), C(vk′ ) ← I, for all k ′ ∈ [0, k], as well, and r that ranged from 0 to 81 with step size ten. ⊤ ⊤ 81 where xk ≡ (d⊤ is the vector of the CO2 k , lk ) , dk ∈ R concentrations in the grid, and lk ∈ R81 is the vector of the corresponding leaks rates; Ak describes the dependence of the CO2 concentrations among the adjacent sites in the grid, and with relation to the occurring leaks —it is constructed as in the Appendix C of Weimer (2010); finally, C ∈ R81×81 is as in Assumption 2. Hence, we run Algorithms 2 and 4 so to efficiently estimate x0 of (24) using a small number of sensors. In particular, we run Algorithm 2 for k ← 100, C(x0 ), C(vk′ ) ← I, for all k ′ ∈ [0, k], and R that ranged from log det(Σz99 , [81]) ∼ = −62 to log det(Σz99 , ∅) = 0 with step size ten —since in (24) the process noise is zero, z99 = x0 . The corresponding number of sensors that Algorithm 2 achieved with respect to R is shown in the left plot of Fig. 2: as R increases the number of sensors decreases, as one would expect when the estimation error bound of P1 is relaxed. For the same values for k, C(x0 ) and C(vk′ ), for all k ′ ∈ [0, k], we also run Algorithm 4 for r that ranged from 0 to 81 with step size ten. The corresponding achieved values for Problem P2 with respect to r are found in the right plot of Fig. 2: as the number of available sensors r increases the minimum achieved value also decreases, as expected by the monotonicity and supermodularity of log det(Σz99 , ·). At the same plot, we compared these values with the achieved minimums over a random sample of 80, 000 sensor sets for the various r (10, 000 distinct sets for each r, where r ranged from 0 to 81 with step size ten): the achieved minimum random values were larger or at most equal to those of Algorithm 4. Therefore, we observe effective performance from Algorithm 4. Now, to compare the outputs of Algorithms 2 and 4, for error bounds R larger than −20 Algorithm 2 returns a sensor set that solves P1 , yet does not minimize the log det(Σz99 , ·); notwithstanding, the difference in the achieved value with respect to the output of Algorithm 4 is small. Moreover, for R less than −20, Algorithm 2 returns a sensor set that not only satisfies this bound; it also minimizes log det(Σz99 , ·). Overall, both Algorithms 2 and 4 outperform the theoretical guarantees of Theorems 3 and 4, respectively. Finally, as in the example of Section 6.1, the minimum value of log det(Σz99 , ·) —right plot of Fig. 2— decreases only linearly from 0 to −62 as the number of sensors r increases from 0 to 81. This is in agreement with Theorem 1, in relation to (23) and the fact that z99 = x0 . Specifically, both the example of this section and that of Section 6.1 exemplify the fundamental design limit presented in Theorem 1, that the estimation error of the optimal linear estimator decreases only linearly as the number of sensors increases. That is, adding extra sensors so to reduce the minimum mean square estimation error of the Kalman filter is ineffective, a fundamental design limit. 7. Concluding Remarks We considered a linear time-variant system and studied the properties of its Kalman estimator given an observation interval and a sensor set. Our contributions were threefold. First, in Section 3 we presented several design limits. For example, we proved that the minimum mean square error decreases only linearly as the number of sensors increases. That is, adding extra sensors so to reduce the minimum mean square estimation error of the Kalman filter is ineffective, a fundamental design limit. Similarly, we proved that the number of sensors grows linearly with the system’s size for fixed minimum mean square error; this is another fundamental limit, especially for systems where the system’s size is large. Second, in Section 4 we proved that the log det estimation error of the system’s initial condition and process noise is a supermodular and non-increasing set function with respect to the choice of the sensor set. Third, in Section 5, we used this result to provide efficient approximation algorithms for the solution of P1 and P2 , along with their worst-case performance guarantees. For example, for P1 , we provided an efficient algorithm that returns a sensor set that has cardinality up to a multiplicative factor from that of the corresponding optimal solutions; more importantly, this factor depends only 10 logarithmically on the problem’s parameters. For P2 , we provided an efficient algorithm that returns a sensor set of cardinality l ≥ r and achieves a near optimal value for increasing l. Finally, in Section 6, we illustrated our analytical findings, and tested the efficiency of our algorithms, using simulation results from an integrator chain network and the problem of surface-based monitoring of CO2 sequestration sites studied in Weimer et al. (2008) —another application that fits the context of minimal sensor placement for effective monitoring is that of thermal control of indoor environments, such as large offices and buildings (Oldewurtel (2011); Sturzenegger (2014)). Our future work is focused on extending the results of this paper to the problem of sensor scheduling. Hero III, A. O., & Cochran, D. (2011). Sensor management: Past, present, and future. IEEE Sensors Journal, 11, 3064–3075. Jawaid, S. T., & Smith, S. L. (2015). Submodularity and greedy algorithms in sensor scheduling for linear dynamical systems. Automatica, 61, 282–288. Jiang, C., Chai Soh, Y., & Li, H. (2015). Sensor placement by maximal projection on minimum eigenspace for linear inverse problem. arXiv preprint arXiv: 1506.00747, . Joshi, S., & Boyd, S. (2009). Sensor selection via convex optimization. IEEE Transactions on Signal Processing, 57, 451–462. Kailath, T., Sayed, A. H., & Hassibi, B. (2000). Linear estimation volume 1. Prentice Hall Upper Saddle River, NJ. Kalman, R. E. (1960). A new approach to linear filtering and prediction problems. Journal of Fluids Engineering, 82, 35–45. Krause, A., & Guestrin, C. (). Beyond convexity: Submodularity in machine learning, . Krause, A., Singh, A., & Guestrin, C. (2008). Near-optimal sensor placements in gaussian processes: Theory, efficient algorithms and empirical studies. The Journal of Machine Learning Research, 9, 235–284. Lin, F., Fardad, M., & Jovanovic, M. R. (2013). Design of optimal sparse feedback gains via the alternating direction method of multipliers. IEEE Transactions on Automatic Control, 58, 2426–2431. Madsen, H., & Holst, J. (1995). Estimation of continuous-time models for the heat dynamics of a building. Energy and Buildings, 22, 67 – 79. Matni, N., & Chandrasekaran, V. (2014). Regularization for design. In IEEE 53rd Annual Conference on Decision and Control (CDC) (pp. 1111–1118). Minoux, M. (1978). Accelerated greedy algorithms for maximizing submodular set functions. In Optimization Techniques (pp. 234–243). Springer. Munz, U., Pfister, M., & Wolfrum, P. (2014). Sensor and actuator placement for linear systems based on h2 and h∞ optimization. IEEE Transactions on Automatic Control, 59, 2984–2989. Nemhauser, G. L., & Wolsey, L. A. (1978). Best algorithms for approximating the maximum of a submodular set function. Mathematics of operations research, 3, 177–188. Nemhauser, G. L., & Wolsey, L. A. (1988). Integer and Combinatorial Optimization. New York, NY, USA: Wiley-Interscience. Oldewurtel, F. (2011). Stochastic model predictive control for energy efficient building climate control. Ph.D. thesis Eidgenössische Technische Hochschule ETH Zürich, Switzerland. Olshevsky, A. (2014). Minimal controllability problems. IEEE Transactions on Control of Network Systems, 1, 249–258. Pasqualetti, F., Zampieri, S., & Bullo, F. (2014). Controllability metrics, limitations and algorithms for complex networks. IEEE Transactions on Control of Network Systems, 1, 40–52. Pequito, S., Kar, S., & Aguiar, A. (2015). A framework for structural input/output and control configuration selection in large-scale systems. IEEE Transactions on Automatic Control, PP, 1–1. Pequito, S., Ramos, G., Kar, S., Aguiar, A. P., & Ramos, J. (2014). On the Exact Solution of the Minimal Controllability Problem. arXiv preprint arXiv: 1401.4209, . Petersen, K. B., & Pedersen, M. S. (2012). The matrix cookbook. Reusken, A. (2001). Approximation of the determinant of large sparse symmetric positive definite matrices. SIAM J. Matrix Anal. Appl., 23, 799–818. Rowaihy, H., Eswaran, S., Johnson, M., Verma, D., Bar-Noy, A., Brown, T., & La Porta, T. (2007). A survey of sensor selection schemes in wireless sensor networks. In Defense and Security Symposium (pp. 65621A–65621A). International Society for Optics and Photonics. Shamaiah, M., Banerjee, S., & Vikalo, H. (2010). Greedy sensor selection: Leveraging submodularity. In 49th IEEE Conference on Decision and Control (CDC), (pp. 2572–2577). Singh, A., Krause, A., Guestrin, C., & Kaiser, W. J. (2009). Efficient informative sensing using multiple robots. Journal of Artificial Intelligence Research, (pp. 707–755). Sturzenegger, D. C. T. (2014). Model Predictive Building Climate Control - Steps Towards Practice. Ph.D. thesis Eidgenössische Technische Hochschule ETH Zürich, Switzerland. Summers, T. H., Cortesi, F. L., & Lygeros, J. (2014). On submodularity and controllability in complex dynamical networks. arXiv preprint arXiv:1404.7665, . Tzoumas, V., Jadbabaie, A., & Pappas, G. J. (2016). Sensor placement for optimal kalman filtering: Fundamental limits, submodularity, and algorithms. In American Control Conference (ACC). To appear. Acknowledgements This work was supported in part by TerraSwarm, one of six centers of STARnet, a Semiconductor Research Corporation program sponsored by MARCO and DARPA, in part by AFOSR Complex Networks Program and in part by AFOSR MURI CHASE. References References Atanasov, N., Le Ny, J., Daniilidis, K., & Pappas, G. J. (2014). Information acquisition with sensing robots: Algorithms and error bounds. In IEEE International Conference on Robotics and Automation (ICRA) (pp. 6447– 6454). Belabbas, M.-A. (2015). Geometric methods for optimal sensor design. arXiv preprint arXiv: 1503.05968, . Bernstein, D. S. (2009). Matrix mathematics: theory, facts, and formulas. Princeton University Press. Bertsekas, D. P. (2005). Dynamic Programming and Optimal Control, Vol. I. (3rd ed.). Athena Scientific. Chen, C.-T. (1998). Linear System Theory and Design. (3rd ed.). New York, NY, USA: Oxford University Press, Inc. Clark, A., Alomair, B., Bushnell, L., & Poovendran, R. (2014a). Minimizing convergence error in multi-agent systems via leader selection: A supermodular optimization approach. IEEE Transactions on Automatic Control, 59, 1480–1494. Clark, A., Bushnell, L., & Poovendran, R. (2012). On leader selection for performance and controllability in multi-agent systems. In IEEE 51st Annual Conference on Decision and Control (CDC) (pp. 86–93). Clark, A., Bushnell, L., & Poovendran, R. (2014b). A supermodular optimization framework for leader selection under link noise in linear multi-agent systems. IEEE Transactions on Automatic Control, 59, 283–296. Coppersmith, D., & Winograd, S. (1987). Matrix multiplication via arithmetic progressions. In Proceedings of the nineteenth annual ACM symposium on Theory of computing (pp. 1–6). Das, A., & Kempe, D. (2008). Sensor selection for minimizing worst-case prediction error. In Information Processing in Sensor Networks, 2008. IPSN’08. International Conference on (pp. 97–108). Dhingra, N. K., Jovanovic, M. R., & Luo, Z.-Q. (2014). An admm algorithm for optimal sensor and actuator selection. In IEEE 53rd Annual Conference on Decision and Control (CDC) (pp. 4039–4044). Fang, Y., Loparo, K., Feng, X. et al. (1994). Inequalities for the trace of matrix product. IEEE Transactions on Automatic Control,, 39, 2489–2490. Feige, U. (1998). A threshold of ln n for approximating set cover. J. ACM, 45, 634–652. Gupta, V., Chung, T. H., Hassibi, B., & Murray, R. M. (2006). On a stochastic sensor selection algorithm with applications in sensor scheduling and sensor coverage. Automatica, 42, 251–260. 11 Tzoumas, V., Jadbabaie, A., & Pappas, G. J. (December 2015). Minimal reachability problems. In 54th IEEE Conference on Decision and Control (CDC). Tzoumas, V., Rahimian, M. A., Pappas, G. J., & Jadbabaie, A. (2015). Minimal actuator placement with bounds on control effort. IEEE Transactions on Control of Network Systems, . In press. Tzoumas, V., Rahimian, M. A., Pappas, G. J., & Jadbabaie, A. (July 2015). Minimal actuator placement with optimal control constraints. In Proceedings of the American Control Conference (pp. 2081 – 2086). Venkatesh, S. (2012). The Theory of Probability: Explorations and Applications. Cambridge University Press. Weimer, J. E. (2010). Large-scale multiple-source detection using wireless sensor networks. Ph.D. thesis Carnegie Mellon University Pittsburgh, PA, USA. Weimer, J. E., Sinopoli, B., & Krogh, B. H. (2008). A relaxation approach to dynamic sensor selection in large-scale wireless networks. In Distributed Computing Systems Workshops, 2008. ICDCS’08. 28th International Conference on (pp. 501–506). Wolsey, L. A. (1982). An analysis of the greedy algorithm for the submodular set covering problem. Combinatorica, 2, 385–393. Yan, G., Tsekenis, G., Barzel, B., Slotine, J.-J., Liu, Y.-Y., & Barabási, A.-L. (2015). Spectrum of controlling and observing complex networks. Nature Physics, (pp. 779–786). Zhang, H., Ayoub, R., & Sundaram, S. (2015). Sensor selection for optimal filtering of linear dynamical systems: Complexity and approximation. In IEEE Conference on Decision and Control (CDC). Zhao, Y., & Cortés, J. (2015). Gramian-based reachability metrics for bilinear networks. arXiv preprint arXiv:1509.02877, . 12
3cs.SY
Message Passing for Optimization and Control of Power Grid: Model of Distribution System with Redundancy Lenka Zdeborová1 , Aurélien Decelle1,2 , and Michael Chertkov1 1 arXiv:0904.0477v3 [cond-mat.stat-mech] 27 Jul 2009 2 Center for Nonlinear Studies and Theoretical Division, LANL, Los Alamos, NM 87545 Université Paris-Sud & CNRS, LPTMS, UMR8626, Bât. 100, Université Paris-Sud 91405 Orsay cedex (Dated: March 17, 2018) We use a power grid model with M generators and N consumption units to optimize the grid and its control. Each consumer demand is drawn from a predefined finite-size-support distribution, thus simulating the instantaneous load fluctuations. Each generator has a maximum power capability. A generator is not overloaded if the sum of the loads of consumers connected to a generator does not exceed its maximum production. In the standard grid each consumer is connected only to its designated generator, while we consider a more general organization of the grid allowing each consumer to select one generator depending on the load from a pre-defined consumer-dependent and sufficiently small set of generators which can all serve the load. The model grid is interconnected in a graph with loops, drawn from an ensemble of random bipartite graphs, while each allowed configuration of loaded links represent a set of graph covering trees. Losses, the reactive character of the grid and the transmission-level connections between generators (and many other details relevant to realistic power grid) are ignored in this proof-of-principles study. We focus on the asymptotic limit, N → ∞ and N/M → D = O(1) > 1, and we show that the interconnects allow significant expansion of the parameter domains for which the probability of a generator overload is asymptotically zero. Our construction explores the formal relation between the problem of grid optimization and the modern theory of sparse graphical models. We also design heuristic algorithms that achieve the asymptotically optimal selection of loaded links. We conclude discussing the ability of this approach to include other effects, such as a more realistic modeling of the power grid and related optimization and control algorithms. I. INTRODUCTION The existing power grid is complex and far from being optimized. The anticipated installation of small-scale distributed generators and storage devices, as well as the addition of many ancillary backup lines and control devices at both transmission and distribution levels, imply that the main future challenges will require intelligent planning, optimization and control of this ever growing grid. This optimized and efficient grid of the future, that incorporates new hardware and concepts such as renewable generation and distributed storage, has been labeled ”smart grid” [1, 2]. Accounting for many important details of the power distribution and transmission is not feasible without much simplification. Simplified models must identify the significant effects, extracting and analyzing and later probing each of them separately and in combinations. (See, e.g. related review articles [3, 4, 5].) We adopt this ”discovery though simplification” approach and focus in this paper on improving the functioning and control of the electric grid on the power distribution level. Specifically, our prime focus is on preventing overloads of the power generation units caused by fluctuations in the demand by efficiently utilizing ancillary lines. This approach is justified in the context of a city-scale transmission system, in which many significant loads and generators are in geometric proximity of each other and the cost of building new ancillary lines is not prohibitive. We assume that shedding excess load is not an option and we consider the possibility of redistributing the load via a system of interconnects over a larger grid than what is used under normal (no overload) conditions. Fundamentally, we ask the following question: can an intelligent arrangement of O(M) ancillary lines among a system of M generators, each serving D customers, possibly reduce the probability of a generator failure from a finite number to zero in the limit of M → ∞ and D = O(1)? In fact, an assumption that a drastic improvement is possible stems from basic information-theoretic intuition: any finite error probability can be reduced to zero via properly introduced redundancy [6]. We show that adding interconnects to the power system is related to adding redundancy to the information system, in the sense that achieving the asymptotic overload-free distribution is indeed a possibility for an idealized grid. The model of power line considered in the paper mimics how the ancillary power lines are operated on the distribution level power grid. A city-scale power grid has an intervene loopy structure, however these loops are typically used for ancillary (backup and/or maintenance) purposes and operators aim at avoiding running current over loops. We adopt this strategy and assume that the system contain (or may be built with) many switches and that it is operated in the manner that for each given configuration of the pre-installed on-off switches the currents flow over trees, i.e. subgraphs of the full loopy distribution graph without loops. We also assume that the lines are sufficiently short (kilometers, not hundreds or thousand of kilometers), and thus thermal losses are not important and reactive parts of line impedances can be ignored. These assumptions correspond to the so-called DC approximation [7]. Combination of the loop-free structure of power flows (for any given configuration of switches) with DC approximation allows to model electricity delivery as an abstract commodity flow [8]. For completeness of our description, let us also note that some other effects of realistic power flows are ignored in our first publication on this emerging subject. Thus, we do not consider back flows (consumers turned into distributed generators) and for that matter we do not discuss at all the entire 2 scale up (transmission level) structure of the grid, inhomogeneities and spatio-temporal correlations in loads and generation, and all economy, pricing and regulation effects [9]. In essence, our main task here consists in establishing the existence of fundamental limits, and bounds on the idealized asymptotic failure-free regime, and followed by developing efficient and simple algorithm controlling switching in the grid. To solve our model we use the cavity method and its computational realization via population dynamics, introduced in the statistical physics of disordered systems [10, 11] and recently adapted to the analysis of Shannon (phase) transitions in constraint satisfaction [12] and error-correction [13, 14]. This method explores the famous fact that the Bethe-Peierls [15, 16] or Belief Propagation [17, 18] (BP) scheme exactly solves probabilistic models on graphs without loops (a tree). The method allows to evaluate the ensemble average over configurations of allowed discrete switchings on the grid balancing load with generation. We study how the number of allowed solutions scale with the size of the grid, and identify a transition (in the space of model parameters) from a satisfiable (SAT) domain, in which the number of solutions is exponentially large (in the system size) and where BP algorithm finds a valid solution easily, to an unsatisfiable (UNSAT) domain in which the number of valid solutions is with high probability zero (thus load shedding would be required). Assuming that the two ways communications between consumers and generators exists we design a stochastic local search algorithm, coined WalkGrid, that is able to find optimal configuration of switches almost anywhere in the SAT phase. We also utilize aforementioned BP analysis and develop a BP-based message passing scheme for efficient search of SAT configuration of switches. Generally, WalkGrid outperforms the BP-based algorithm almost anywhere in the SAT phase. Note however that one useful feature of BP (not readily available in WalkGrid) consists in its ability to count number of available SAT solutions, and thus have a direct algorithmic test of the distance to failure, i.e. distance to the SAT-UNSAT transition. The material in the manuscript is organized as follows. We introduce our model of the distribution grid in Section II. The Belief Propagation method is detailed in Section III. We describe population dynamics algorithms and present SAT-UNSAT transition results in IV. Control algorithms are explained in Section V. Section VI summarizes our approach and proposes extensions of the study for future explorations relevant to intelligent optimization and control of the power grid. II. GRID MODEL Consider M sources/generators each connected to D distinct consumers, so that the total number of consumers is MD. Greek/Latin indices will be reserved for generators/consumers. For simplicity we assume that each generator has a maximum production rate of unity, i.e. y = (0 ≤ yα ≤ 1|α = 1, · · · , M), though inhomogeneities in the production can be easily incorporated into our approach. The configuration of loads, x = (xi > 0|i = 1, · · · , N), is drawn from an assumed known distribution with support on the interval (0, 1). Our enabling example is the flat-box ensemble with a fraction ε of customers dropped off from the network, i.e. drawing no electricity at all,  1/∆, |x − x̄| < ∆/2 P (x) = ∏[(1 − ε)p(xi ) + εδ(xi )], p(x) = (1) 0, otherwise i The mean consumption then is (1 − ε)x, and ∆ is the width of the part of the distribution, correspondent to nonzero demand. We require that the consumption of each individual customer is non-negative 1 , i.e. 2x̄ ≥ ∆, (2) and we assume that under normal conditions, i.e. when demand is not excessive, there is always enough power produced in the network to supply electricity to all consumers, i.e. (1 − ε)x̄ ≤ 1 M = . N D (3) In our ”standard” model of the grid each consumer is assigned to strictly one generator, while each generator feeds exactly D consumers. This corresponds to a graph decomposed into M simple trees, where M is the number of generators. To guarantee in this standard case that a generator is always SAT, i.e. it is capable of supplying electricity to all of its customers, one requires   ∆ D x̄ + ≤ 1. (4) 2 1 This assumption is not crucial and can be easily removed, allowing consumers not only to consume but also to generate electricity. The inclusion of this capability potentially has a far reaching consequences because it allows distributed generation. We postpone our discussion of this interesting possibility to future publications. 3 M R 1 R 0 R 1 R 2 R 3 (a) R = 0, 1, 2, 3. Graph samples. Ancillary connections to (b) R = 1. Three valid (SAT) configurations (shown in black, foreign generators/consumers are shown in color. the rest is in gray) for a sample graph shown in Fig. 1a. FIG. 1: (Color online) Illustration of the bipartite graph construction of our grid with D = 3. This later condition will be challenged below, in the sense that we will show that by adding ancillary lines one does not need to impose (4), but instead have a weaker condition, thus extending the domain of the asymptotically failure-free generation. To achieve this improvement we consider an interconnected grid built from the standard/separated one by adding ancillary lines between consumers and generators. For our quantitative analysis we choose a random graph drawn in the following way. First, D consumers are connected to every producer. Second, we choose R consumers from each producer and connect them to a second producer in such a way that every producer is connected to D + R consumers. Of these D + R connections D − R go to singly connected consumers and 2R to doubly connected consumers. So that a total of NR/D consumers are connected to two generators and N(1 − R/D) are connected to one generator. See Fig. 1 for illustration. The choice of the two parameter (R, D) graph ensemble is used for simplicity. Our analysis method is valid for any random network as long as it is bipartite and locally tree-like, meaning that the length of the shortest loop going through a random node is O(log N). We say that given configuration of loads x = (xi |i = 1, · · · , N) is SAT (satisfiable) if there exists a matching σ = (σiα = 0, 1|{i, α} ∈ G ), where G is the bi-partite graph accounting for all generators, consumers and lines, such that the following set of conditions are simultaneously satisfied ∀i ∈ G : ∑ σiα = 1, (5) α∈∂i ∀α ∈ G : ∑ σiα xi ≤ 1 , (6) i∈∂α where ∂i, resp. ∂α, stand for all the nodes to which i, resp. a, is connected. If the reverse is true, i.e. there exists no valid σ with all Eqs. (5,6) satisfied, we say that x is UNSAT (unsatisfiable). First, we aim to solve the decision problem: is x is SAT or UNSAT? Furthermore, if x is SAT, we would like to find at least one valid solution, σ. Both problems can be stated for a given graph or, alternatively, can be considered ”in average” for ensemble of graphs. We describe the ”average” solution of the former problem in Sections IV and the algorithmic solution of the latter in Section V. Both Sections will be preceded by a preparatory discussion of the BP approach in Section III. Related models have been studied in the context of resource allocation. One example is the problem of online advertising known as AdWords, in particular its uniform off-line version [19, 20, 21]. The main difference between our model and the model for budget-constrained advertising problem is that condition (6) is replaced by the maximization of the total revenue ∑α min[1, ∑i∈∂α σiα xi ]. This relaxation translates into allowing one to shed loads, that is not an option in our setting. Discussion of the BP-based approaches to the AdWords problem and their methodology in [22] is very much related to ours. Of other models developed in Computer Sciences, the one most similar to ours is the so-called off-line weighted balls-into-bins games (sometimes called balanced loading) [23, 24]. The off-line version of the balls-into-bins games is known to be polynomial in the non-weighted case (i.e. for a special discrete choice of the distribution (1)), as in that case it can be mapped into a maxflow (min-cut) problem [25]. On the other hand the general (weighted) version on a fully connected graph (every customer being possibly connected to every generator) is equivalent to the NP-complete bin packing problem (number partitioning in the case of two generators). We are not aware of any computational complexity results for the case of bounded number of consumers per generator. Therefore, and given that the max-flow mapping of [25] does not generalize to the most general version of Eq. (1), we conjecture that computationally the general problem described by Eq. (1) is NP-hard. 4 III. BELIEF PROPAGATION In the asymptotic limit of an infinite system, for which N → ∞ while D and R are O(1), the interconnected grid is locally tree-like. Therefore, the Bethe-Peierls (Belief Propagation) BP approach for evaluating the generalization of (4) is expected to be asymptotically exact (in a sense to be clarified later in this text). This Section describes details of the BP approach We introduce the following set of marginal probabilities: • ψα→i is the probability that generator α is satisfied given that the edge (i, α), connecting α with his consumer-neighbor on 1 G , is in the active state, i.e. σiα = 1. • ψα→i is the probability that generator α is satisfied given that the edge (i, α), where (i, α) ∈ G1 , is inactive, i.e. σiα = 0. 0 • χi→α is the probability that i is satisfied (i.e. it is connected to exactly one generator) given that the edge (i, α), where 1 (i, α) ∈ G1 , is active, i.e. σiα = 1. • χi→α is the probability that i is satisfied (i.e. it is connected to exactly one generator) given that the edge (i, α), where 0 (i, α) ∈ G1 , is inactive, i.e. σiα = 0. BP relates these marginal probabilities to each other assuming that the relations are graph local, i.e. as if the graph would contain no loops. The resulting Belief Propagation (BP) equations are χi→α = 1 1 β→i ∏ ψ0 , Z i→α β∈∂i\α (7) χi→α = 0 1 γ→i β→i ∑ ψ1 ∏ ψ0 , Z i→α β∈∂i\α γ∈∂i\α,β (8) ψα→i = 1 ψα→i = 0 1 Z α→i 1 Z α→i θ(1 − xi − ∑ σ∂α\iα ={0,1}|∂α \i| σ∂α\iα ={0,1}|∂α \i| ∑ ∏ j→α χσ jα , (9) j∈∂α\i j∈∂α\i θ(1 − ∑ σ jα x j ) ∑ σ jα x j ) ∏ j→α χσ jα , (10) j∈∂α\i j∈∂α\i where ∂i \ α is a standard notation for the set of generator nodes linked to consumer i, however excluding generator α, and similarly ∂α \ i stands for the set of consumer nodes linked to generator α excluding consumer i. In Eqs. (7-10), Z i→α and Z α→i are normalizations ensuring that, χi→α + χi→α = 1 and ψα→i + ψα→i = 1. The θ(·) is the step function enforcing the generation 1 0 1 0 constraints. It is unity if the argument is positive and zero otherwise. The probability for the link/edge (i, α) to be active, stated in terms of the related ψ and χ, is p(i, α) = i→α ψα→i 1 χ1 , i→α + ψα→i χi→α ψα→i 1 χ1 0 0 (11) where ∑α∈∂i p(i, α) = 1. Note, for the sake of completeness, that the BP equations can be derived in the spirit of [26] as conditions for a fixed-point (minimum) of a functional of marginal probabilities (beliefs), the so-called Bethe free energy functional. The Bethe entropy, defined as the logarithm of the number of possible SAT configurations (and also equal to the Bethe free energy evaluated at the solution of the previously mentioned BP equations), is SBethe = ∑ log(Z α ) + ∑ log(Z i ) − ∑ log(Z iα ) , i α Zα = ∑ σ∂α Zi = ∑ ψα→i ∏ 1 α∈∂i ∑ σiα xi ) ∏ χi→α σiα , θ(1 − ={0,1}|∂α | (12) (i,α) i∈∂α β→i ψ0 , (13) i∈∂α (14) β∈∂i\α i→α i→α Z iα = ψα→i + ψα→i . 1 χ1 0 χ0 (15) The entropy SBethe is extensive, O(N), and self-averaging, i.e. the distribution of SBethe is concentrated around its mean value with dispersion being o(N) at N → ∞. 5 IV. AVERAGE BETHE ENTROPY VIA POPULATION DYNAMICS Fixed point of the BP Eqs. (7-10) and the corresponding entropy (15) can be obtained by solving Eqs. (7-10) iteratively for a given instance of the problem. Repeating these simulations many times for different instances of the graph and load ensembles one can also calculate the average Bethe entropy. However, the average behavior, corresponding to the limits of the infinite graph, can be obtained more efficiently via the population dynamics technique. This technique offers a computationally efficient sampling from the distribution of the marginal probabilities χσ on infinite random graphs and subsequent evaluation of the average Bethe entropy. Below we give a very brief exposition of the population dynamics approach applied to our model. The interested reader is referred to [11, 27] for further details. In population dynamics, we create a pool of N p components, each characterized by the (χ0 , χ1 , x) vector with x drawn from the original distribution of demands (1) and the initial χ selected arbitrarily. Messages leaving the generator and entering the consumer connected to a single generator will always be kept fixed to χ1 = 1, χ0 = 0, while other messages will be updated iteratively, so that at any new sweep a new pool is derived from the old one. A sweep consists of the following step repeated O(N p ) times (each time one of the N p components is updated). A step consists of choosing a random number xi , D − R random numbers x j , and 2R random elements from the pool representing the incoming messages χ, and computing the message ψ based on Eqs. (9,10). Then we replace a random element of the pool by the vector (ψ1 , ψ0 , xi ), in accordance with Eqs. (7-8), thus guaranteeing that χ1 = ψ0 and χ0 = ψ1 . We repeat this sweep procedure many times until convergence is achieved. To compute the average Bethe entropy we apply similar procedure of sampling from the resulting pool and thus averaging all the terms in Eq. (15). Implementing the population dynamics method we observed three possible outcomes (a) SAT phase: The Bethe entropy is positive suggesting that the number of SAT configuration (valid redistribution of the demand over the generators) is exponential in the system size 2 . (b) UNSAT phase, type 1: The Bethe entropy is negative, suggesting that there is almost surely no valid redistribution of demand over the generators. (c) UNSAT phase, type 2: A contradiction is encountered in the BP equations, formally correspondent to zero values for the normalizations in (7-10). We conclude that the demand is incompatible with the graph and respective generator assignment. Fig. 2 shows results of the population dynamics simulations, with lines connecting the marks indicating the boundaries of the respective SAT and UNSAT phases. These boundaries are established by fixing ∆ and traversing different values of x̄ starting from SAT phase moving towards UNSAT phase and catching the value where the UNSAT conditions are first time observed. We observe a significant improvement of the SAT/UNSAT threshold from what Eq. (4) suggests. Recall that in the R = 0 case the SAT/UNSAT threshold is described by (4). Similar upper bound can be derived for cases R ≥ 1. Then for any given R, one can find (with high probability) a place on a very large network where all consumers connected to two generators (which are neighbors trough one of the consumers) have demands near to the maximum value x + ∆/2. Then at least D − R + 1 of these loads have to be connected to one generator and hence ∆ (D − R + 1)(x + ) ≤ 1 . 2 (16) Note that (16) is identical to (4) for R = 1. Moreover, to observe an improvement in the condition (4) at ε = 0 one needs to require existence of such configuration of loads that a set of (D + 1) consumers connected to one producer and drawing the minimal amount of electricity does not overload the generator, i.e. ∆ (D + 1)(x − ) ≤ 1 . (17) 2 To conclude, this study of the average Bethe entropy shows that the network with added ancillary lines is able to withstand larger fluctuations in the demand, ∆, than the naive network, in which every consumer has a pre-designed provider independently of the current demand. This effect is amplified with increasing R. At this point it is also appropriate to recall that the SAT-UNSAT transition is actually an abrupt transition only in the sense of the asymptotic N → ∞ limit. Thus for large finite N the generator failure probability is small but finite at any point of the SAT domain. ε=0: 2 This is the case unless the so called replica symmetry breaking takes place in our model. We have done a local stability check of the BP solution and have not seen any indication for a break down of the replica symmetry. Note also that this stability is also equivalent to convergence of the underlying BP algorithm for an individual realization of the graph and the loads. 6 D=3, !=0 0.6 R=3 R=2 R=1 R=0 0.5 D=4, !=0.1 0.6 distribution width distribution width 0.7 0.4 0.3 0.2 0.1 0 0.5 R=4 R=3 R=2 R=1 R=0 0.4 0.3 0.2 0.1 0 0 0.05 0.1 0.15 0.2 0.25 mean 0.3 0.35 0.4 0 0.05 0.1 0.15 mean 0.2 0.25 0.3 FIG. 2: (Color online) Results of the population dynamics shown in the (x̄, ∆) plane for D = 3, 4, where (1 − ε)x̄ is the distribution mean and ∆ is the distribution widths. The population dynamics was done with NP = 1000 for D = 4 and N p = 10000 for D = 3. The triangular region (black full lines) correspond to conditions (2), (3) and (17), and encloses the interesting region of parameters. The colored lines with data points separate SAT and UNSAT domains lying on the bottom-left and top-right off the lines respectively. Different colors/lines/markers correspond to different values of R = 0, · · · , D. Note that the curves for R = 0 and R = 1 (dashed without markers) are identical, due to condition (16). We observe that the performance improves with increasing R ≥ 2 (the number of ancillary lines) and the grid tolerates larger values of ∆ (fluctuations in the demand). The abrupt change in slope of the curve corresponding to R = 2 (full red line with x marks) in the right part of the figure is due to condition (16). Note that if condition (2) is removed (see e.g. discussion in the footnote preceding the equation) our description still remains valid, thus resulting in the colored lines with markers extending smoothly beyond their crossings with the tilted black curve. V. CONTROL ALGORITHMS In this Section we discuss the problem of calculating a valid load-to-generators assignment for a given graph and given configuration of loads. We designed two heuristic methods to identify SAT configuration of switches. Our first algorithm, coined WalkGrid, is an adaptation of the WalkSAT [28, 29], which is a stochastic local search heuristic solver for the K-satisfiability problem. The WalkGrid algorithm is very fast and shows flawless performance in discovering a valid configuration almost anywhere in the SAT region. Our second algorithm corresponds to solving BP equations. The BP scheme, designed in the spirit of [12], is used to find most biased/stressed link and then proceeds with decimation towards a valid configuration [12]. Our implementation of the BP-decimation is so far slower and a bit less efficient than performance shown by the WalkGrid algorithm. To this point, let us note that there exists a more efficient way of using BP to find valid configurations - the reinforcement strategy [30, 31], which is fully distributed, linear in the number of consumers and typically outperforms decimation. The reinforcement strategy has been implemented in [22] for a related online advertising problem. However, we had a difficulty to find an implementation of the reinforcement which would work efficiently in our problem. A. WalkGrid WalkGrid is a stochastic local search algorithm inspired and closely related to its K-SAT ancestor called WalkSAT [28, 29]. It can also be viewed as a Monte-Carlo-like algorithm which in order to gain speed violates the detailed balance condition (not needed here as we are not interested in sampling, but are rather focused on a local search). Our implementation works as follows 7 WALK G RID 1 Assign each value of σ 0 or 1 randomly (but such that ∀i ∈ G : ∑α∈∂i σiα = 1); 2 repeat Pick a random power generator α which shows an overload, and denote the value of the overload, δ; 3 Choose a random consumer i connected to the generator α, i.e. σiα = 1; 4 Pick an arbitrary other generator which is not overloaded and consider switching connection from (iα) to (iβ). 5 if (in the result of this switch α is relieved from being overloaded 6 and β either remains under the allowed load or it is overloaded but by the amount less than δ) 7 Accept the move, i.e. disconnect i from α and connect it to β thus setting σiβ = 1, σiα = 0. 8 else With probability p connect consumer i to β instead of α; 9 until Solution found or number of iterations exceeds MTmax . The WalkGrid algorithm depends on two parameters: the maximum number of iterations Tmax , and the temperature-like (greediness) parameter p. The parameter p needs to be optimized, just as in the original WalkSAT solver. 1 p=0.18, Tmax=20000 10000 WalkGrid success rate WalkGrid median time D=3, R=2, !=0.2 1000 100 M=1000 M=2000 M=20000 10 0.288 0.29 0.292 0.294 0.296 0.298 0.3 D=3,R=2,!=0.2 p=0.18, Tmax=2000 0.8 0.6 0.4 M=1000 M=10000 M=100000 av. entropy 0 0.29 0.292 0.294 0.296 0.298 0.2 mean consumption 0.3 0.302 mean consumption FIG. 3: (Color online) Performance of the WalkGrid algorithm. The data are for networks with M producers, and R = 2, D = 3, ∆ = 0.2, ε = 0. The temperature-like parameter and the maximum number of iterations are set to p = 0.18 and Tmax = 2000 respectively. The average (median) is over 100 instances for M up to 20k, and 20 instances for M = 100k. Left: The median running time plotted against the average consumption x. Right: The percentage of cases where solution was found in less than Tmax = 2000 iteration. The Bethe entropy based (asymptotic) curve is drawn dashed for comparison (the actual value for the curve is not related to the success rate), suggesting that in the limit of N → ∞ valid configurations exist up to x ≈ 0.30. Note that in the separated case (of R = 0), valid configurations exist only at x ≤ 1/D − ∆/2 ≈ 0.23. Fig. 3 shows performance of the WalkGrid algorithm. The running time of this algorithm scales close to linear with the system size, it is thus relatively easy to resolve fast network with many thousands of nodes. Whereas for R = 2, D = 3, ∆ = 0.2 the separated architecture requires x ≤ 0.233, the WalkGrid algorithm is able to find valid configurations up to x ≈ 0.296, while our theoretical analysis suggests that valid configurations should exist up to x ≈ 0.301. B. Belief-Propagation decimation In the BP-based decimation algorithm one updates Eqs. (7-10) iteratively, thus passing messages from generators to consumers and back. After fixed number of steps the most biased consumer is chosen and the more probable value for its consumption is assigned, the graph is reduced and the procedure is repeated. Note that updating Eqs. (7-8) takes 22R steps per message thus making the algorithm exponential in R. However, building new connections is expensive and one should realistically assume that actual R is any case not very large. As far as the scaling in N goes, the algorithm is quadratic in the number of consumers. 1 2 3 4 5 D ECIMATION repeat Update BP messages on every edge according to (7-10) n times. Compute the marginals (11). Choose the most biased edge iα and assign is the more probable values; Simplify the formula, cutting off the assigned edge from the graph; until Solution or contradiction is found; 8 D=3, R=2, !=0 distribution width 0.7 BP theory WalkGrid 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.05 0.1 0.15 0.2 0.25 mean 0.3 0.35 0.4 FIG. 4: (Color online) Performance of the WalkGrid algorithm for D = 3, R = 2, ε = 0 and different values of the distribution width ∆. Bellow the blue (dashed) line the WalkGrid algorithm is able to find solution on more than 50% (average over 20 trials) of graphs with 105 generators. The red (full) line corresponds to the theoretical boundary separating SAT and UNSAT domains respectively. The algorithm performance is illustrated in Fig. 5 where the percentage of success in the BP-based decimation is shown. These data average over 50 random instances from the R = 2, D = 3 ensemble with variance in consumption ∆ = 0.2 and varying mean consumption. For such a set of parameters the separated network would be able to achieve x ≤ 1/3 − 0.1, whereas with two consumers per producer connected to two producers the mean consumption increases to x ≈ 0.30. 1 M=200 M=2000 entropy success rate 0.8 0.6 0.4 R=2,D=3 0.2 0 0.27 !=0.2 0.28 0.29 0.3 0.31 mean consumption 0.32 FIG. 5: (Color online) Performance of the BP-based decimation algorithm. The data are for networks with M producers, n = 5 (five iteration per a cycle of the decimation procedure) and R = 2, D = 3, ∆ = 0.2, ε = 0. Average over 50 random instances is taken and the fraction of successful runs is plotted against the mean consumption x. The Bethe entropy based (asymptotic) curve is drawn dashed for comparison (the actual value for the curve is not related to the success rate), suggesting that in the limit of N → ∞ valid configurations exist up to x ≈ 0.30. Note that in the separated case (of R = 0), valid configurations exist only at x ≤ 1/D − ∆/2 ≈ 0.23. VI. SUMMARY AND PATH FORWARD This manuscript reports a first study of the power distribution networks with transition from the SAT regime, in which shedding of loads is avoidable, to the UNSAT regime, where shedding is the only available option for balancing the demand. We have shown that a significant enlargement of the SAT-domain is possible employing ancillary connections between power consumers and generators. Even though our model represents a gross oversimplification over the actual power grid, it offers a significant step forward in providing a framework and guidance for analysis of more involved and realistic problems. The general approach we pursued in this study is based on recent developments in the field of graphical models that merges statistical physics, computer science, optimization theory and information theory [13, 14]. The BP approach is asymptotically exact on infinite sparse graphs 9 and as such is useful for the asymptotic (capacity/phase-transition style) analysis. The BP scheme also provides heuristic tools for graphical models on finite sparse graphs that can be used for algorithmic optimization and control of the power grid. We tested this BP approach, and also developed in parallel another an apparently more efficient alternative to BP called WalkGrid. This algorithm finds valid configuration of switching practically anywhere inside the SAT phase. Note, that the two algorithms, BP and WalkGrid, are truly complementary and there utility for practical problems in power networks are yet to be explored. It is important to emphasize that many generalizations of our model are very straightforward and can be used directly within the framework presented here. This includes implementing different probability distributions for demands (as long as the distribution support is bounded), and non-uniformity for both generator and consumer levels, i.e. varying production caps for generators and introducing distinct distributions of demands for different consumers. Also the network itself can be easily extended in many ways from the simplified case, parameterized by R and D, that we discussed in the manuscript. Our equations are straightforwardly valid for every bipartite locally tree-like random network. Another case, which allows very natural and straightforward generalization for all the statements made in this manuscript, corresponds to breaking the equivalence between different edges in the graph and thus assigning nonuniform weights to them. These weights may e.g. represent cost of construction, geographical length, proxy for losses, cost of exploitation, etc. There are many other more realistic extensions of our model associated with the description, optimization and control of power grids which can benefit from utilizing a graphical model approach of the kind discussed in this paper, even though actual implementation may prove to be more involved. We conclude listing some of these more interesting but difficult problems that we plan to address in the future, based on the general method sketched in this manuscript: A. Most important generalization of our approach would be to account for losses, impedances and the reactive character of AC electrical systems. Obviously this will require incorporating in our statistical SAT-UNSAT framework Kirchhoff’s circuit laws [7, 32]. B. Generators in a real grid are interconnected on higher (still power distribution, but also power generation) levels. In combination with item [A], this represents a major challenge for extending our approach. However, we still believe that posing the joint optimization and control problem in terms of a complex graphical model and then addressing capacity/transition as well as algorithmic issues with the host of BP-related techniques is a feasible and exciting path forward. C. The joint optimization setting, mentioned in item [B], may also include various additional factors associated with economic policies (e.g. prices, incentives, etc) [9, 33], government regulations and load/generation forecasting. These complications can be accounted for in the form of extra soft or hard constraints. This united framework should also take advantage of the progress made in developing optimal power flow solutions [34, 35]. D. Our consideration in this paper was purely static, thus ignoring important transients. Constructing dynamical (discrete and continuous time) models that also accounts for all the aforementioned problems, is an important future task. It is also important to notice that the graphical model approach can in fact be extended to the dynamic framework, see e.g. [36], thus suggesting yet another intriguing future opportunity. E. An essential part of statistical studies of the power grid focuses on estimating probabilities and mitigating very costly and dangerous large scale outages [37, 38]. The graphical model framework this manuscript describes allows an extension which can analyze rare events of special interest, such as dangerous but rare configurations of the channel noise and degrading performance of Low-Density-Parity-Check codes [39, 40]. We plan to extend this approach to the analysis of outages and their cascading through the grid. VII. ACKNOWLEDGMENTS We thank Florent Krzakala, David Gamarnik and Scott Backhaus for very stimulating and critical comments, and all members of LANL study group on ”Optimization and Control Theory for Smart Grids” for many discussions. The work at LANL was carried out under the auspices of the National Nuclear Security Administration of the U.S. Department of Energy at Los Alamos National Laboratory under Contract No. DE-AC52-06NA25396. [1] [2] [3] [4] [5] The smart grid: An introduction (2008), http://www.oe.energy.gov/1165.htm. Smart grid at wikipedia, http://en.wikipedia.org/wiki/Smart grid. S. Massoud Amin and B. Wollenberg, Power and Energy Magazine, IEEE 3, 34 (2005). M. Ilic, Proceedings of the IEEE 95, 1060 (2007). S. Amin, Power and Energy Magazine, IEEE 6, 48 (2008). 10 [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] C. Shannon, The Bell System Technical Journal 27, 379423, 623656 (1948). A. J. Wood and B. F. Wollenberg, Power Generation Operation And Control (New York, 1996), 2nd ed. T. H. Cormen, C. E. Leiserson, and R. L. Rivest, Introduction to algorithms (MIT Press ; New York : McGraw-Hill, 1990). R. Baldick and W. Hogan, in University of California Energy Institute (2001). M. Mézard and G. Parisi, J. Physique 46, L771 (1985). M. Mézard and G. Parisi, Eur. Phys. J. B 20, 217 (2001). M. Mezard, G. Parisi, and R. Zecchina, Science 297, 812 (2002), http://www.sciencemag.org/cgi/reprint/297/5582/812.pdf. T. Richardson and R. Urbanke, Modern Coding Theory (Cambridge University Press, 2008). M. Mezard and A. Montanari, Information, Physics, and Computation (Oxford University Press, 2009). H. Bethe, Proceedings of Royal Society of London A 150, 552 (1935). H. Peierls, Proceedings of Cambridge Philosophical Society 32, 477 (1936). R. Gallager, Low density parity check codes (MIT PressCambridhe, MA, 1963). J. Pearl, Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference (Morgan Kaufmann Publishers, Inc., 1988). B. Lehmann, D. Lehmann, and N. Nisan, in In ACM conference on electronic commerce (2001), pp. 18–28. N. Andelman and Y. Mansour, in In 9th Scandinavian Workshop on Algorithm Theory (SWAT (2004), pp. 26–38. Y. Azar, B. Birnbaum, A. Karlin, C. Mathieu, and C. Nguyen, in Lecture Notes in Computer Science 5125 (Springer, 2008), p. 186. F. Altarelli, A. Braunstein, J. Realpe-Gomez, and R. Zecchina, J. Stat. Mech. p. P07002 (2009). K. Talwar and U. Wieder, in STOC ’07: Proceedings of the thirty-ninth annual ACM symposium on Theory of computing (ACM, New York, NY, USA, 2007), pp. 256–265, ISBN 978-1-59593-631-8. P. Berenbrink, T. Friedetzky, Z. Hu, and R. Martin, Theor. Comput. Sci. 409, 511 (2008), ISSN 0304-3975. P. Sanders, S. Egner, and J. Korst, in SODA ’00: Proceedings of the eleventh annual ACM-SIAM symposium on Discrete algorithms (Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2000), pp. 849–858, ISBN 0-89871-453-2. J. Yedidia, W. Freeman, and Y. Weiss, Generalized belief propagation (Cambridge, MA, MIT Press, 2001), vol. 13, pp. 689–695. L. Zdeborová, Acta Physica Slovaca 59, 169 (2009). B. Selman, H. A. Kautz, and B. Cohen, in Proc. 12th AAAI (AAAI Press, Menlo Park, CA, USA, 1994), pp. 337–343. J. Ardelius and E. Aurell, Phys. Rev. E 74, 037702 (2006). J. Chavas, C. Furtlehner, M. Mézard, and R. Zecchina, J. Stat. Mech. p. P11016 (2005). A. Braunstein and R. Zecchina, Physical Review Letters 96, 030201 (2006). B. Bollobas, Modern Graph Theory (Springer, 1998). R. Walawalkar, S. Blumsack, J. Apt, and S. Fernands, Energy Policy 36, 3692 (2008), ISSN 0301-4215. M. Huneault and F. Galiana, Power Systems, IEEE Transactions on 6, 762 (1991). K. Pandya and S. Joshi, Journal of Theoretical and Applied Technology pp. 450–457 (2008). F. Hutter, B. Ng, and R. Dearden, Incremental thin junction trees for dynamic bayesian networks (2004), http://www.eecs.harvard.edu/b̃mng/papers/tud tr04-itjt.pdf. I. Dobson, B. A. Carreras, V. E. Lynch, and D. E. Newman, Chaos 17, 026103 (2007). P. Hines and S. Talukdar, in Proc. of the International Conference on Infrastructure Systems, Rotterdam (2008), http://www.cems.uvm.edu/p̃hines/pdfs/2008/Hines 2008 nginfras.pdf. V. Chernyak, M. Chertkov, M. G. Stepanov, and B. Vasic, Phys. Rev. Lett. 93, 198702 (2004). M. Chertkov and M. Stepanov, Information Theory, IEEE Transactions on 54, 1514 (2008).
5cs.CE
1 Vehicle Tracking in Wide Area Motion Imagery via Stochastic Progressive Association Across Multiple Frames (SPAAM) arXiv:1709.06035v1 [cs.CV] 18 Sep 2017 Ahmed Elliethy, Student Member, IEEE and Gaurav Sharma, Fellow, IEEE Abstract—Vehicle tracking in Wide Area Motion Imagery (WAMI) relies on associating vehicle detections across multiple WAMI frames to form tracks corresponding to individual vehicles. The temporal window length, i.e., the number M of sequential frames, over which associations are collectively estimated poses a trade-off between accuracy and computational complexity. A larger M improves performance because the increased temporal context enables the use of motion models and allows occlusions and spurious detections to be handled better. The number of total hypotheses tracks, on the other hand, grows exponentially with increasing M , making larger values of M computationally challenging to tackle. In this paper, we introduce SPAAM an iterative approach that progressively grows M with each iteration to improve estimated tracks by exploiting the enlarged temporal context while keeping computation manageable through two novel approaches for pruning association hypotheses. First, guided by a road network, accurately co-registered to the WAMI frames, we disregard unlikely associations that do not agree with the road network. Second, as M is progressively enlarged at each iteration, the related increase in association hypotheses is limited by revisiting only the subset of association possibilities rendered open by stochastically determined dis-associations for the previous iteration. The stochastic disassociation at each iteration maintains each estimated association according to an estimated probability for confidence, obtained via a probabilistic model. Associations at each iteration are then estimated globally over the M frames by (approximately) solving a binary integer programming problem for selecting a set of compatible tracks. Vehicle tracking results obtained over test WAMI datasets indicate that our proposed approach provides significant performance improvements over state of the art alternatives. Index Terms—Wide area motion imagery, vehicle tracking, association hypotheses pruning, binary integer programming, vector road network I. I NTRODUCTION ERIAL photography has come a long way since 1858, when the first documented aerial photograph was captured from onboard a balloon in France by Gaspard-Félix Tournachon [2]. Today satellite, aircraft, drone, and balloon based A A. Elliethy is with the Department of Electrical and Computer Engineering, University of Rochester, Rochester, NY 14627, USA (e-mail: [email protected]). G. Sharma is with the Department of Electrical and Computer Engineering, Department of Computer Science, and Department of Biostatistics and Computational Biology, University of Rochester, Rochester, NY 14627, USA (e-mail: [email protected]). A preliminary version of part of the research presented in this paper appears in [1]. Color versions of one or more of the figures in this paper are available in the electronic version of this manuscript. aerial still-images are commonplace. Additionally, newer platforms offer motion imagery with rich spatio-temporal information that enables a host of new applications. We focus particularly on urban area wide area motion imagery (WAMI) that offers high resolution image sequences covering large field of view (city-scale) within each frame, at temporal rates of 1-2 frames per second (fps) [3]–[5]. In this setting, we consider the problem of tracking the many vehicles present in the field of view. Tracking is an extensively researched problem (see [6] for recent survey). Our discussion focuses specifically on methods applicable in the WAMI setting, which poses a number of unique challenges. Typically vehicles span only few pixels and there is little spatial detail discriminating individual vehicles from each other based on appearance. Therefore, vehicles are usually represented only by their spatial locations. Moreover, the potentially large number of vehicles included within the spatial coverage of typical WAMI frames make tracking computationally demanding. The difficulty of the problem is compounded by the relatively low 1-2 fps (in contrast with typical 30 fps full motion video) temporal resolution in WAMI, due to which the spatial extent of a vehicle in adjacent frames does not typically overlap and can in fact be a fair distance apart. Further complexity and challenges are introduced by spurious and missed detections caused by imperfections in the models used for detecting vehicles against the background and due to occlusions of vehicles by over-bridges, trees, buildings, etc. The aforementioned challenges mandate specific approaches for vehicle tracking in WAMI. Specifically, tracking is performed by first detecting the spatial locations of vehicles (for instance, based on their movement relative to the background) and then forming vehicle tracks by associating detections that are presumed to correspond to the same vehicle over the set of WAMI frames. To obtain the associations, hypothesis tracks are first assigned costs that penalize deviation from a motion model that typifies the common behavior of moving vehicles. Detections are then associated into tracks with the objective of minimizing the total cost for the tracks, under the constraint that a vehicle detection is assigned to at most one track. The size of the temporal context, i.e. the number of (adjoining) frames, used in formulating the motion model poses an inherent trade-off. Costs that assess the plausibility of the vehicle motion postulated by a hypothesis track are better assessed using motion models over a larger temporal context. However, the number of possible tracks increases 2 exponentially with the number of frames, which makes it challenging to estimate the set of tracks with minimum total cost for a larger temporal context. Existing tracking techniques handle the complexity introduced by the larger temporal context by one of two common approaches. The first approach solves the minimum cost tracking problem exactly but with a simplified track cost that is decomposable into a sum of independent costs for pairwise associations between detections in adjacent frames that make up the track. A network is formed by arranging the detections as nodes and feasible associations between detections in adjacent frames as edges with corresponding costs. Network paths consisting of a sequence of connected edges then correspond to a feasible track whose cost is the sum of the costs of the edges in the path. The tracking problem is then posed as a minimum cost maximum flow estimation problem, which is solved exactly using one of several network flow optimization algorithms [7]–[11]. Online tracking algorithms [12], [13] that build the tracks progressively are also frequently based on the simplified cost approach. A bipartite graph is constructed for each pair of successive frames, and pairwise associations across the frames are estimated by finding the minimum cost bipartite matching. Simplified pairwise independent costs are also the basis of hierarchical track estimation methods [14]– [17]. Hierarchical approaches first estimate short tracklets, then hierarchically link estimated tracklets together to form longer tracks. In [14]–[16], the Hungarian algorithm [18] is used to estimate pairwise associations to estimate tracklets with minimum cost. In [17], a network flow based algorithm is employed for both estimating tracklets and to link them using novel learnt tracklet discriminative metrics. In the WAMI setting, vehicle detections are only represented by their spatial locations, therefore it is beneficial to use costs based on motion models, such as constant velocity/acceleration, which rely on larger spatial context and do not meaningfully map to (independent) pairwise association costs that are required for the aforementioned algorithms. The second class of approaches tackles the complexity introduced by the larger temporal context by utilizing efficient methods to solve the minimum cost tracking problem approximately, without limiting the focus to independent pairwise decomposable costs. A number of iterative and/or hierarchical techniques are representative of the recent developments in this category. In [19], [20], an approximate solution to the tracking problem is obtained by iteratively re-estimating pairwise associations between two successive frames while keeping other associations fixed. In each iteration, effective “costs” for the pairwise associations being re-estimated are obtained by collapsing the costs over the associations that are kept fixed and the pairwise associations are re-estimated either as binary variables via the Hungarian algorithm [19] or as real-valued “soft” assignments computed via a rank-one tensor factorization [20] which are finalized upon completion of the iterations. Motion models over larger temporal context can be utilized in the aforementioned approximate methods. The computational tractability obtained through the approximate approaches is, however, at a cost; the methods only ensure convergence to locally optimal solutions to the minimum cost tracking problem. Furthermore, because each iteration updates only the associations between adjacent frames often the methods converge to a weak local optima and the benefit of the cost over the larger temporal context is not fully realized. Alternative approaches, specifically focusing on a constant velocity motion model in a three frame context are proposed in [21], [22]. In [21], tracklets are first estimated over a sliding three frame context using an approximate combinatorial optimization technique, consistent tracklets between adjacent three frame windows are merged and an enlarged four frame context is used to resolve conflicts; finally a min-cost network flow based global optimization is used to link together tracklets with the objective of overcoming fragmentation due to longterm occlusions. This bottom-up procedure suffers from the limitation that errors introduced in the tracklet estimation stage cannot be corrected in subsequent steps. To better maintain the global temporal context, the approach in [22] forms an auxiliary network whose nodes represent ordered pairs of possible associations of detections from adjacent frames. The nodes are joined together by links with costs determined by the constant velocity model for each link’s 3-frame context. Because the same detection is replicated multiple times in the nodes formed by the ordered pairs, the minimum cost tracking formulation on the auxiliary network requires consistency constraints to ensure each detection is assigned only to one track. While the problem formulation does not directly correspond to the well-studied network flow problem due to these constraints, an approximate solution can be obtained by iteratively using network flow optimization techniques in combination with Lagrangian relaxation [23]. The constraints are mapped to costs included in the objective function using Lagrange multipliers that are progressively adapted through the iterations to provide a final solution consistent with the constraints. The work in [24] considers an alternative auxiliary network based formulation where combinatorial expansion of the local context allows alternative constant velocity costs to be computed between nodes separated by a number of intervening frames. Using a shortest path algorithm iteratively in a greedy fashion, tracks are then estimated one at time followed by elimination of nodes from the network that have been consumed by estimated tracks (which ensures that nodes are used only in at most one estimated track). The advantage of global context in these methods comes at the cost of considerable increase in complexity because of the increased size of the auxiliary network compared with the network used in the traditional network flow formulation of tracking with decomposable costs. In particular, for the large scale of WAMI tracking problems, these approaches are not directly applicable1. In this paper, we propose SPAAM an alternative computationally-efficient, hierarchical, and iterative approach for solving the WAMI tracking problem over a relatively large temporal context without requiring track costs that are decomposable as a sum of independent pairwise association costs. 1 To solve a tracking problem over N frames with D detections per frame, the technique in [22] generates an auxiliary network with (N − 1)D 2 nodes and (N − 2)D 3 edges compared with N × D nodes and (N − 1)D 2 edges in the traditional flow networks. 3 In each SPAAM iteration, the entire set of available WAMI frames are partitioned into smaller temporal windows of contiguous frames over which associations are first estimated; associations are then hierarchically linked across the windows to obtain the overall associations over the entire set of WAMI frames. The temporal windows are expanded in successive iterations to benefit from a larger temporal context. To handle the relatively large temporal windows, two innovations are proposed to limit the number of association hypotheses and to render the approach computationally tractable for the relatively large number of tracks observed in WAMI. First, guided by a pixel accurate co-registered road network (RN) with the WAMI frames, we disregard unlikely associations that do not agree with the RN; only association hypotheses that link road reachable locations in adjacent frames are considered. Second, as the temporal window size is increased with progressing iterations, the associated increase in association hypotheses is limited by revisiting only a subset of associations. This is accomplished by: (a) stochastically preserving/dissolving associations established at the previous iteration such that the probability of preservation matches the estimated confidence probability that the association is correct, and (b) for the current iteration, maintaining the preserved associations and estimating only the associations remaining open. The confidence of every pairwise association is estimated via a probabilistic model and the estimation of open associations at each iteration is formulated as a binary integer programming (BIP) problem. In comparison with existing techniques, the proposed SPAAM approach provides two key advantages. First, because the proposed approach is not constrained to using costs that are decomposable as a sum of independent pairwise association costs, it can use more meaningful costs for the WAMI setting based on models for vehicular motion. Second, because SPAAM dissolves the (predominantly) low confidence associations and estimates remaining open associations collectively over a larger temporal context, instead of simply re-estimating the associations between an adjacent pair of frames, the method invariably overcomes the local minima problem that plagues prior methods that allowed more general costs. Results obtained with SPAAM demonstrate a significant improvement over the alternative methods benchmarked. This paper is organized as follows. Section II presents the formulation for the problem of estimating vehicle detection associations over multiple WAMI frames. Section III explains our proposed stochastic progressive multi-frame data association approach. Results and a comparison against alternative methods are presented in Section IV, followed by a discussion in Section V. We conclude the paper in Section VI. II. M ULTI - FRAME ASSOCIATION ESTIMATION PROBLEM FORMULATION Consider the problem of tracking individual vehicles over a set I = {Ii }N i=1 of N WAMI frames, where the WAMI frames in I are co-registered with a vector road network defined in a common reference2 coordinate system R (for example 2 Specifically, we use a 2D Cartesian map coordinate system obtained via azimuthal orthographic map projection (AOMP) [25] of the spherical latitude and longitude coordinates. N M I R Di zji G vji Vi V (G) εia,b E(G) s(G) e(G) P (G) G ϑ (a, b) P A  C vji t ℓ w k (.)(t) (.)(t,ℓ) Total number of WAMI frames Size of temporal window Sequence of N WAMI frames I1 , I2 , . . . , IN . A common coordinate system for all frames in I Number of vehicle detections (VDs) in the ith WAMI frame The location of the j th VD detected in the ith WAMI frame represented in the coordinate system R Trellis graph Node in the trellis graph that G represents the VD zji Set of nodes in the ith frame Set of nodes of G Trellis graph (directed) edge that links node vai to vbi+1 Set of edges of G First frame index represented in G Last frame index represented in G Set of paths that can be represented on G Edge induced sub-graph Minimum travel distance from a to b on the road network Track Adjacency set Set of all nodes reachable from vji on the road network Iteration index Hierarchy level index Temporal window index Track index Value of a variable in the tth iteration Value of a variable at the ℓth hierarchy level in the tth iteration Key notation/symbols used in the paper using [26], [27]). We adopt a tracking by detection paradigm: vehicle locations are detected in the individual frames and the goal is to associate the detections of a vehicle over the entire set of WAMI frames to form a track per vehicle. Frame Ii contains Di vehicle detections (VDs) and zji = (xij , yji ) denotes the spatial location of the j th VD in the ith frame in the coordinate system R. To describe the problem and the solution approach, we use a 2D trellis graph G constructed as follows for a temporal window of WAMI frames, whose starting and ending frame numbers we denote by s(G) and e(G), respectively. Along the horizontal axis, nodes in the trellis graph G lie along T (G) = (e(G) − s(G)) + 1 discrete positions corresponding to the frame instances from s(G) through e(G) arranged in increasing order from left to right. At the horizontal position for frame  i, along ithe vertical axis, Di + 1 distinct nodes are placed. For j = 1, 2, . . . Di , the Vi = v0i , v1i , . . . , vD i node vji represents the j th VD in the ith frame (at spatial location zji in R) and v0i represents a dummy node that is introduced to account for missed-detections and for identifying spurious detections (as described later). Edges are introduced in the trellis graph linking nodes across adjacent frames3 that can correspond to detections of the same vehicle, or that link a VD to a dummy node. We denote by εia,b the (directed) edge  that links vai with vbi+1 and by A vai the adjacency set for vai that contains all VD nodes in the (i + 1)th frame linked with  vai . In the absence of additional information, A vai contains all other nodes in the (i + 1)th frame. In practice, however, physical considerations rule  out a number of possibilities and the adjacency set A vai is much smaller than the full set 3 The trellis graph is characterized by the property that the only permitted edges are those that link nodes across adjacent temporal locations. 4 R z R z11 R z z22 I1 v01 v11 R 2 1 1 2 z51 z13 z31 z41 z23 z 2 3 I1 I2 z z z34 3 3 3 4 I3 v21 v31 v41 z14 z24 z 4 4 I2 v02 v12 v22 v32 I4 v51 I3 v03 v13 v23 v33 I4 v04 v14 v24 v43 v44 I1 v01 v11 v21 v31 v41 Multi−frame association v34 v51 G (a) I2 v02 v12 v22 I3 v03 v13 v23 v33 I4 v04 v14 v24 v34 v32 v43 v44 G (b) Fig. 1: A schematic illustration of the problem formulation via an example. The input comprises an N = 4 frame WAMI sequence I = {I1 , I2 , I3 , I4 } that is co-registered in a common reference coordinate system R. Frame Ii has Di VDs, with the location of the j th VD denoted by zji . A trellis graph G is obtained by associating discrete horizontal locations with the frames (in sequence) and arranging nodes vertically at the ith horizontal position to represent the VDs in the corresponding frame. Node vji represents the VD at location zji , for j = 1, 2, . . . Di and a dummy node v0i is introduced to handle missed/spurious detections. The VDs in adjacent frames that can correspond to the same vehicle are connected by directed edges as shown in (a). A hypothesis vehicle track is represented on G by a path that consists of consecutive sequence of nodes from frame s(G) = 1 to frame e(G) = 4. The goal in tracking is to estimate the best consistent subset of paths on P (G) out of the set of all possible paths, or to equivalently estimate the best edge induced sub-graph G ∗ from G such that any non-dummy node in the sub-graph must belong to exactly  one path (track) as shown in (b). Note that, dummy nodes are used for missed-detections  as shown in the path v41 , v02 , v33 , v24 ∈ P (G ∗ ), and for identifying spurious detections as shown in v51 , v02 , v03 , v04 ∈ P (G ∗ ). th of nodes in the (i + 1) frame. For example, no edges are permissible between VD nodes whose spatial locations are further apart than the maximal distance that a vehicle can traSe(G) verse in the inter-frame interval. The sets V (G) = i=s(G) Vi o n  and E (G) = εia,b vbi+1 ∈ A vai , vai ∈ Vi , vbi+1 ∈ Vi+1 represent the complete set of nodes and edges, respectively, in the graph G. An example trellis graph for a temporal window starting at frame s(G) = 1 and ending at frame e(G) = 4 is shown in Fig. 1 (a). Within the temporal support   of G, a vehicle track is repree(G) s(G)+1 s(G) of , . . . , vζ k sented as a sequence Pk = vζ k , vζ k s(G) ζik s(G)+1 e(G) nodes ∈ {0, 1, . . . , Di } corresponding to the locations of a (single) vehicle in the frames. Specifically, ζik ∈ Pk implies that the vehicle track passes through the location zji if j 6= 0 and that the vehicle is not detected in the ith frame if j = 0. Alternatively,  to simplify notation, we also denote the track s(G) s(G)+1 e(G) as Pk = vks(G) , vks(G)+1 , . . . , vke(G) at the cost of some precision. Because only vehicle locations are available in our setting, for estimating tracks, we proceed as follows. We denote by P (G) the set of all feasible tracks on G and for each feasible track Pk ∈ P (G), we assign a cost C (Pk ) that assesses the plausibility of the vehicle movement predicated by the track. The cost decreases monotonically as the corresponding vehicle movement becomes more plausible. The objective of our tracking problem is then formulated as the task of estimating the best, i.e. minimum total cost, consistent subset of tracks from P (G), where “‘consistent” means that every non-dummy node belongs to exactly one track. In the graph formulation, the problem of estimating the best consistent subset of tracks is equivalent to the problem of selecting the minimum-cost feasible edge-induced sub-graph G ∗ from the set F (G) of all feasible edge-induced sub-graphs of G. A feasible edgeinduced sub-graph G ∈ F (G) is a graph that has the same set of nodes of G, i.e. V (G ) = V (G), but has a subset of edges from G such that any non-dummy node in V (G ) belongs to exactly one track in G as illustrated in the example shown in Fig. 1 (b). Formally, a feasible edge-induced sub-graph G ∈ F (G) is defined by the constraints X χP(G ) (Pk ) χPk (vji ) = 1, ∀vji ∈ V (G ) , j 6= 0, (1) Pk ∈P(G) V (G ) = V (G) , where, for any set A, χA (·) is the indicator function, defined as ( 1 if x ∈ A, χA (x) := (2) 0 if x ∈ / A. Our tracking problem is then formulated as G ∗ = arg min ψ (G ) , (3) X (4) G ∈F (G) where ψ (G ) = C (Pk ) . Pk ∈P(G ) We model the global cost C of a track Pk as exponentiated weighted sum of metrics that penalize (a) motion irregularities, (b) road network dis-agreement, and (c) number of dummy nodes along the track. The metrics comprise (non-independent) pairwise association costs estimated over the local context associated with every pairwise association εiki ,ki+1 in the track Pk . Specifically, the cost of the track Pk is defined as in (5), where: 5  C (Pk ) = − exp − • • •       X σm Γ εiki ,ki+1 + σd Rd εiki ,ki+1 + σθ Rθ εiki ,ki+1 e(G) Lp (Pk ) i=s(G) σm , σd , σθ , and σg are nonnegative weighting factors, Lp (Pk ) is the length of Pk excluding dummy nodes, i.e., Lp(Pk ) =  |{vki i |vki i ∈ Pk , ki 6= 0}|, Γ εiki ,ki+1 is a motion irregularity penalty defined as       Γm εiki ,ki+1 + Γθ εiki ,ki+1 Γ εiki ,ki+1 = 1 − , (6) 2     where Γm εiki ,ki+1 and Γθ εiki ,ki+1 are normalized measures (in the rage [0, 1]) that quantify the similarity, in magnitude and direction, respectively, of the velocity for the ith frame with the velocities for other frames in a temporal window of (2W + 1) frames centered about the ith frame. The computation of these terms is illustrated th using Fig. 2. The velocity  at the j frame is computed − zkj j /∆t where ∆t is the interas vkj j = zkj+1 j+1 frame duration, and inspired by [20], the magnitude and direction similarity terms are obtained as Γm  εiki ,ki+1  1 = 2W W X m=−W, W 6=0 2 vki i vki i 2 vki−m i−m + vki−m i−m Γθ • εiki ,ki+1  1 = 2W W X m=−W, W 6=0 D vki i , vki−m i−m vki i E vki−m i−m . (5)   is a Le εiki ,ki+1 = χ{0} (ki+1 ) indicates whether vki+1 i+1 dummy node or not. The exponentiation in (5) moderates the cost for each component and the overall cost for a hypothesis track is in the interval [−1, 0). Also, the form of (5) ensures that tracks rated poorly for any one of the penalty terms also have an overall low cost. • zki+1 +1 i zki i 1 1 zki i ki dik dik+1 +1 i zki+2 +2 i i i vki i rki i 2W + 1 Fig. 2: Schematic illustrating the metrics used for modeling the cost of a track Pk . 2, (7)    σg Le εiki ,ki+1 , + T (G) (8)   The term Γθ εiki ,ki+1 represents the average of cosines of the angles between the direction of the velocity vector vki i and the directions of the other velocity vectors in the temporal window. If the motion of the track is  smooth within the temporal window, both Γm εiki ,ki+1     and Γθ εiki ,ki+1 are close to one and Γ εiki ,ki+1 is close to zero. For tracks with dummy nodes, velocities are computed between actual VD locations that become adjacent once  nodes are skipped.  the dummy  i Rd εki ,ki+1 and Rθ εiki ,ki+1 are costs penalizing, respectively, the distance and direction disagreement with the road network, computed using the  factors illustrated in Fig. 2. Specifically, Rd εiki ,ki+1 = diki /rki i is the distance diki of the VD location zki i to the nearest point on the center line of the road, normalized through division by the factor rki i that represents the number of lanes on that   i road, and Rθ εki ,ki+1 = 1 − cos θki i , where θki i is the angle between the velocity vector vkj j and the road (in the direction of travel) at the nearest point center line   on the   of the road. The terms Rd εiki ,ki+1 and Rθ εiki ,ki+1 are set to zero when vki i represents a dummy node. III. S TOCHASTIC PROGRESSIVE ASSOCIATION MULTI - FRAMES (SPAAM) ACROSS To track the vehicles in the WAMI image sequence I, we wish to solve (3). For our proposed cost and typical number of frames, this multi-frame association problem is computationally intractable. In particular, the constrained minimization problem in (3) is an instance of BIP, which is N P -complete in its general form [28]. Although, a multi-clique formulation of the data association has been proposed and solved in the BIP framework for relatively small numbers of tracks [29], [30], these methodologies do not scale to the large number of vehicles seen in WAMI data. SPAAM, the approach proposed in this paper, solves (3) approximately in a computationally tractable manner. Operating iteratively and hierarchically, SPAAM estimates associations between adjacent vehicle detection nodes in the trellis graph G to form the estimated vehicle tracks. The tth iteration first estimates associations over non-overlapping windows of M (t) frames each and then hierarchically computes associations across windows. The window size M (t) is progressively enlarged with successive iterations. To keep the complexity from rapidly growing with the increase in window size in successive iterations, only a subset of stochastically determined associations are revisited at each iteration after the first iteration. Specifically, estimated tracks at each iteration are assessed to evaluate a confidence probability for each postulated pairwise association between vehicle detection nodes and, prior to the next iteration, pairwise associations are stochastically retained with a probability matching the estimated confidence probability and disassociated otherwise. 6 The next iteration then only considers prospective associations for the vehicle detection nodes that were stochastically disassociated while using the larger temporal context and maintaining the associations that were stochastically retained. By this process, SPAAM limits less-useful re-evaluations of association decisions that already have a high confidence and focuses available computation primarily on determining remaining associations with the benefit of a larger temporal context. A road network, accurately co-registered with the WAMI frames in I, provides useful spatial context for SPAAM allowing prospective associations to further be limited to roadreachable pairs of vehicle detection nodes and allowing track costs that exploit knowledge of the road topology and direction of travel. An example shown in Fig. 3 illustrates the first two iterations of SPAAM where the detection nodes are shown overlaid on a sequence of co-registered frames to establish the spatial and temporal context. Having summarized SPAAM at a high-level in the preceding paragraph, we next describe in detail the steps involved in the tth iteration, relying on the trellis graph formulation developed in Section II. To facilitate explanation, we use an illustrative example shown in Fig. 4 that also uses the trellis graph representation. At the start of tth iteration, an estimated set th of tracks is available from the (t − 1) iteration as an edge induced subgraph G (t−1) of the graph G. For each edge  εiki ,ki+1 ∈ E G (t−1) , we estimate a confidence probability P i (ki − ki+1 ) for the pairwise association  between nodes (t−1) vki i and vki+1 on a path P ∈ P G . We consider two k i+1 alternatives for estimating these confidence probabilities that are detailed in Appendix A. With the estimated probabilities we have a version of G (t−1) where each edge is annotated with a confidence probability for the corresponding association, as indicated in the top row in the example of Fig. 4. Based on P i (ki − ki+1 ), the edge (≡ pairwise association) εiki ,ki+1 is stochastically retained or discarded by updating the  adjacency set A(t,0) vki i for the node vki i for the tth iteration. Specifically independent Bernoulli random variables ηki i are generated: with ηki i taking a value of 1 with probability of P i (ki − ki+1 ) and 0 otherwise, and the set of disassociated nodes at the next stage of the trellis and the adjacency set are, respectively, updated as o   n (t,0) i (t−1) i = 0 , (9) and η ∈ E G |ε Di+1 = vki+1 ki ki ,ki+1 i+1 (  if ηki i = 1, vki+1 i+1  A(t,0) vki i = (10) if ηki i = 0, C vki i where C vki i is a set of disassociated nodes in the (i + 1)th frame that can be reached from vki i given the road network, defined as  C vji = o n i+1 i+1 i+1  j = 0,  v0 , v1 , . . . vDi+1   i+1 S o nv0    v i+1 |ϑ v i , v i+1  ≤ τ and v i+1 ∈ D(t,0) otherwise,  j j j j i+1 (11) M (1) = 3 R z11 R R z21 z12 z13 z31 t=1 z33 z22 z23 I1 I2 IN I3 M (2) = 4 R z11 R R z21 R z12 z13 t=2 z31 z33 z14 z24 z22 z23 z34 I1 I2 I3 I4 IN Fig. 3: An example illustrating the first two iterations of SPAAM. The variable t indicates the iteration number and for each t the rectangular boxes arranged horizontally represent successive WAMI frames, each in the common reference coordinate system R with the road network overlaid (as black curves with direction of travel indicated by arrows). Detected vehicle locations associated within same track are shown in a single color hue with the saturation indicating the pairwise association confidence. The first iteration in the upper row computes associations over M (1) = 3 frame windows and hierarchically determines associations across the windows to obtain associations over the entire temporal support N to form tracks. The tracks are then assessed to evaluate a confidence probability for each pairwise association. In the second iteration shown in the lower row, pairwise associations are stochastically retained with a probability matching the estimated confidence probability and dissolved otherwise. The hierarchical process for estimating associations is then repeated but using a M (2) = 4 frame temporal window. The process continues for further iterations (not shown). where ϑ (u1 , u2 ) is the minimum distance of travel on the road network from u1 to u2 , and τ is a threshold that is determined based on the maximum distance a vehicle can travel between successive WAMI frames. Note that, the minimum distance of travel ϑ (u1 , u2 ) is determined by the shortest route on the road network between the two locations u1 and u2 , which is estimated in our current implementation4 by Dijkstra’s shortest path algorithm [31]. As a result of the aforementioned steps, the association be4 Note that, the minimum distance of travel between every two points on the road network can be precomputed and stored in a look-up table for efficiency (with locations suitably quantized). 7 th tween vki i and vki+1 estimated in the (t − 1) iteration is disi+1  associated5 with probability 1 − P i (ki − ki+1 ) . The proposed stochastic dis-association yields adjacency sets A(t,0) (.) that contain a significantly smaller number of nodes than those obtained by naively considering all nodes in the next frame or those obtained by considering the VDs that are spatially close. This is illustrated via an example in Fig. 5 which highlights the fact that the combined use of the aligned road network and the stochastic disassociation in SPAAM significantly reduces the number of association hypotheses to be considered compared with an approach based on spatial distances alone. After completion of the stochastic disassociation step, the tth iteration of SPAAM continues with the hierarchical estimation of tracks. This process is schematically illustrated using the trellis graph representation starting in the second row of Fig. 4 with l denoting the hierarchy level, which starts with value of 0 in the second row and increments in subsequent rows. At the ℓth level of the hierarchy, the temporal support of I is partitioned into disjoint temporal windows, each having q ℓ M (t) temporally adjacent frames. For the wth temporal window comprising frames (w − 1)q ℓ M (t) + 1 through wq ℓ M (t) , (t,ℓ) a corresponding trellis graph Gw is obtained using all the nodes from G over this temporal window and links between nodes defined by the adjacency set A(t,ℓ) (a) for each node (t,ℓ) a in the graph Gw . For the 0th level of  the hierarchy, the  (t,ℓ−1) (t,0) adjacency sets A (a) for nodes a ∈ V Gm are as defined in (10) and for the higher levels of the hierarchy (l > 0), these sets are defined later in this section. Tracks over each temporal window w are then estimated by solving the optimization in (3) over the temporal window, i.e., by (t,ℓ) determining the optimal edge induced sub-graph Gw from (t,ℓ) Gw as (t,ℓ) (12) Gw = arg min  ψ (G ) ,  Algorithm 1: Stochastic progressive association across multiple frames (SPAAM) 1 2 3 4 5 6 7 Input : Vehicle detections Z for N WAMI frames Output: Vehicletracks  T̂ S (0) M (1) ← M ; V G (0) ← N ; i=1 Vi ; Initialize G for t = 1 to max iter do (t) (t) ℓmax ← log N/M ; log q Estimate pairwise association confidence   P i (ki − ki+1 ) , ∀εiki ,ki+1 ∈ E G (t−1) (Appendix A);    Update adjacency set A(t,0) vki i , ∀vki i ∈ V G (t−1) using (10); (t) for ℓ = 0 to ℓmax do N for w = 1 to qℓ M (t) do (t,ℓ) to construct Gw :  (t,ℓ) Sew (t,ℓ) V Gw ← (t,ℓ) Vi ; 9 i=sw if ℓ 6= 0 then (t,ℓ) (t,ℓ) for i = sw to ew do for a = 1 to Di+1 do if i mod q ℓ−1M (t) = 0 then A(t,ℓ) vai ← A(t,0) vai ; else j  k m ← i/ q ℓ−1 M (t) ;  i+1 i i A(t,ℓ)  va ← {vb |εa,b ∈ (t,ℓ−1) E Gm }; end end end end   (t,ℓ) E Gw ← n  o  (t,ℓ) i+1 i εa,b vb ∈ A(t,ℓ) vai , vai , vbi+1 ∈ V Gw ; 10 11 12 13 14 15 16 17 18 19 20 21 22 (t,ℓ) G ∈F Gw where ψ(.) is as defined in (4).  As shown in Fig. 4, w ranges from 1 through N/ qℓ M (t) , and the temporal extent of the (t,ℓ) (t,ℓ) graph Gw spans s Gw = (w − 1)q ℓ M (t) + 1 through   (t,ℓ) e Gw = wq ℓ M (t) . The adjacency sets for all nodes a ∈ G are then updated for the next level of the hierarchy as we show in Fig. 4; within each temporal segment used at the current hierarchy level estimated edges are maintained, whereas across segments the results from the stochastic disassociation are used. Specifically, if i is a positive multiple of q ℓ M (t) , we set  (t,ℓ+1) i vai . Otherwise, we set A(t,ℓ+1) vai A va = A(t,0)  i+1 where vbi+1 is the node at frame as the singleton set vb (i + 1) estimated to associate with node a in the corresponding temporal segment at level ℓ of the hierarchy; formally     (t,ℓ) εia,b ∈ E Gm where m = i/ q ℓ M (t) . (t,ℓ ) The edge induced sub-graph G1 max estimated at the final  (t) final hierarchy level ℓmax = log N/ M (t) log q becomes 5 Note that, for a track that starts with trailing dummy nodes at iteration (t), we disassociate the association from the last dummy node in the trailing dummy nodes to the first non-dummy VD node of the track at iteration (t+1). Similarly, for a track that ends with trailing dummy nodes at iteration (t), we disassociate the association from the last non-dummy VD node to the first dummy node in the trailing dummy nodes at iteration (t + 1). (t,ℓ) (t,ℓ) ℓ (t) ← wq ℓ M (t) ; sw ← (w − w  1)q M  + 1; e (t,ℓ) (t,ℓ) Obtain V Gw and E Gw 8 (t,ℓ) Estimate Gw 23 26 27 28 using (12); end 24 25 (t,ℓ) from Gw end (t) (t,ℓmax ) G (t) ← G1 end   T̂ ← P G (t) ; ; M (t+1) ← M (t) + 1; the estimated edge induced subgraph G (t) at the end of the tth iteration defining the estimates of the optimal paths and associations upon completion of the tth iteration. The edge induced subgraph G (t) then forms the starting point for the (t + 1)th iteration. The overall SPAAM algorithm is summarized6 in Algorithm 1. IV. E XPERIMENTAL RESULTS To evaluate tracking performance, we use three test sequences with distinct characteristics chosen from two WAMI data sets: (a) CorvusEye dataset that is recorded using the CorvusEye 1500 Wide-Area Airborne System [37] over the 6 The decomposed BIP problem (line 23 of Algorithm) can be solved using a variety of integer linear programming solvers such as [32]–[36]. 8 High confidence association Low confidence association I1 G( t I2 RN compatible hypothesis association Estimated association in current iteration Vehicle detection I3 1) G (t;0) 1 G (t;0) 2 G G (t;0) 3 (t;0) 7 G (t;0) 8 G (t;0) 9 `=0 M (t) G (t;0) 1 G G (t;1) 1 G (t;0) 2 (t;1) 2 G G (t;1) 3 (t;0) 3 `=1 qM (t) G1( t;1) G (t;2) 1 (t;1) 2 G G3( t;1) `=2 qM 2 (t) G( ) t Fig. 4: Hierarchical estimation of tracks in the tth iteration of SPAAM. At the start of the tth iteration, a confidence probability is estimated for every pairwise association (edge) in G (t−1) . Associations from G (t−1) are retained or dissolved based on the estimated confidence probabilities. Remaining associations are then hierarchically estimated in a common framework aimed at minimizing (3). At the ℓ = 0th level of the hierarchy, the trellis graph is partitioned into windows of length M (t) and for each (t,ℓ) trellis graph Gw over the wth temporal window associations are estimated with the objective of minimizing (3). Subsequent levels of the hierarchy (l > 0) estimate associations for temporal windows formed by groups of q adjacent windows from hierarchy level (l − 1) using the same methodology: preserving retained associations and estimating remaining associations with the objective of minimizing (3). Upon completion of the hierarchical estimation process for the tth iteration of SPAAM, the set of retained and estimated associations define the edge induced subgraph G (t) that summarizes the estimated tracks and forms the input for the next iteration. Rochester, NY region, and (b) Wright-Patterson Air Force Base (WPAFB) 2009 dataset [38], which was recorded over the WPAFB, OH region. Fig. 6 depicts a frame from each sequence of the three sequences that we label as “Seq1”, “Seq2” and “Seq3”. “Seq1” uses a region from the CorvusEye dataset that contains forked one-way roads with different directions and also several occluders (bridges, trees, etc.). “Seq2” and “Seq3” correspond to two different regions from the WPAFB dataset. Both “Seq2” and “Seq3” cover regions that are free from occluders, however, “Seq2” contains only two-way roads, “Seq3” has only one-way roads. All test sequences comprise 60 ground truth labeled frames7 . For the vector road map, we use OpenStreetMap (OSM) [39], which provides each road in the road network in a vector format along with properties of each road such as type (highway, residential, etc), one or two-way traffic, number of lanes, etc. We use the method in [26] for co-registering the WAMI 7 The detection locations that form the inputs to the algorithm, along with the aligned road network, and labeled ground truth tracks of the three sequences are available at http://www.ece.rochester.edu/∼ gsharma/VisDataAnalGeoSpat/ frames to the vector road map. We obtain the VDs via the background subtraction method used in [13]. We set M (1) = 3 in all experiments and we use the Gurobi optimizer [32] for solving (12). The Gurobi optimizer relaxes the integer restrictions in the binary constraints in (1) and uses a linearprogramming based branch-and-bound algorithm for obtaining a solution8 . For all experiments, the parameters in (5) are set to empirically determined values of σm = 12.5, σd = 0.02, σθ = 100, σg = 2.8, and W = 2. Several methods are benchmarked. Two instances of the proposed method are considered: SPAAM-M and SPAAMEM, which, respectively, estimate the confidence of pairwise associations using the marginalization in (13) or the EM approach in (16). We compare the proposed SPAAM instances with the multi-data association, iterative conditional modes like method (MDA-ICM) of [19]. The MDA-ICM method does not require per association independent additive costs for tracks and is used with the same cost function as SPAAM (defined in (5)) allowing for a fair comparison of 8 More information about the algorithm used by the Gurobi optimizer can be found at http://www.gurobi.com/resources/getting-started/mip-basics 9 z11 z12 z22 z13 z21 z23 z14 z31 z41 z34 z32 z33 z24 I1 v01 I2 v02 I3 v03 I4 v11 v12 v13 v14 v21 v22 v23 v24 v41 z43 v33 v31 v32 v43 v04 v34 v44 R z11 z12 z22 z13 z21 z23 z14 z31 z41 z34 z32 z33 z24 I2 v02 I3 v03 v04 v11 v12 v13 v14 v21 v22 v23 v24 v33 v31 v41 z43 v32 (a) Spatial distan e v43 v34 v44 R z11 z21 z12 z22 z23 z13 z41 z14 z31 z34 z33 z32 z24 z43 I1 v01 I2 v02 I3 v03 I4 v04 v11 v12 v13 v14 v21 v22 v23 v24 v33 v34 v43 v44 v31 v41 v32 z44 z44 z44 I4 I1 v01 (b) Road network ( ) Sto hasti dis-asso iation + road network Fig. 5: An example comparing alternative strategies for generating association hypotheses for a four frame WAMI sequence I1 , I2 , I3 , and I4 at the first hierarchy level (ℓ = 0) in the tth iteration. Distinct colors identify the VDs detected in a single WAMI frame and hypothesis associations are represented by directed edges in a corresponding trellis graph. Sub-figure (a) illustrates a situation where the adjacency set for each node and the graph G are formed without using the road network. In this situation, as a specific example, note that there are three nodes (plus the dummy node) that are spatially close with v33 ,  so the adjacency set A(t,0) v33 determined purely based on distance contains 4 nodes. Sub-figure (b) illustrates the situation where the adjacency set for each node and the graph G are formed by using the aligned road network. The  graph is sparser and the adjacency sets for each node are smaller than in Fig. 5 (a). Specifically, for example, A(t,0) v33 will contains only two nodes because v24 is the only node within a reasonable road travel distance from v33 . Sub-figure (c) illustrates that the proposed stochastic disassociation approach where the confidence of estimated pairwise associations is represented by widths of the directed lines. The proposed approach further reduces the adjacency set for each node, specifically, in this example the  association between v33 and v24 is maintained from the previous iteration and therefore, A(t,0) v33 contains only one node. the techniques without differences induced by the underlying cost function. The methods are also compared against an online tracking method OT proposed in [12] that considers a pre-aligned road network when estimating the frame-to-frame VDs associations. The tracks estimated by the online tracking method also serve as the initialization for all of the iterative methods, specifically, the different instances of SPAAM and for MDA-ICM. We quantify tracking performance with reference to labeled ground-truth tracks by the widely adopted measures defined in [40] which are (1) the total number of ID switches (IDS↓)9 for estimated tracks compared to the ground truth, (2) the number of mostly tracked (MT↑) vehicles, i.e., the vehicles for which estimated tracks include over 80% of the detections in the ground truth, (3) the number of mostly lost (ML↓), i.e., the vehicles for which estimated tracks include under 20% of the detections in the ground truth, (4) the number of partially tracked (PT↓), i.e., the vehicles for which estimated tracks include below 80% and over 20% of the detections in the ground truth, and (5) the number of track fragments (Frag↓), where a fragment is defined as a part of vehicle track with length less than 80% of the length of the corresponding ground truth track. In addition to these measures, we report the Multiple Object Tracking Accuracy (MOTA↑) defined in [41] (with cs = 1). Table I enumerates these metrics for the tracks estimated for the three WAMI datasets using the four methods: OT method in [12], the two proposed instances of SPAAM (SPAAM-M and SPAAM-EM), and the MDA-ICM method [19]. The results in the table indicate that the proposed 9↑ and ↓ indicate that higher and lower is better, respectively. SPAAM instances and the MDA-ICM method both improve upon the OT method that serves as the initialization for both these methods. However, the improvement offered by the proposed SPAAM instances is much larger than that for the MDA-ICM method. Overall, both the proposed SPAAM instances (SPAAM-M and SPAAM-EM) perform significantly better than the MDA-ICM method. Table II lists the execution times for the two proposed SPAAM instances (SPAAM-M and SPAAM-EM) and for the MDA-ICM method along with the corresponding number of iterations. From the table it can be seen that the proposed SPAAM instances have much lower execution times. Thus the proposed SPAAM approach offers performance gains in both tracking accuracy and in execution time. V. D ISCUSSION The performance of the OT method is hampered by the fact that it minimizes a cost function that is a sum of independent costs for pairwise associations between adjacent frames. In situations like WAMI vehicle tracking, where only vehicle detection locations are available, such cost functions are fundamentally limited because they do not allow the use of a larger temporal context for assessing plausibility of (postulated) vehicle movements. As a result, although OT method minimizes its cost function via the estimation of associations from frame to frame in temporal sequence, the limitations of the cost function make it prone to tracking errors. The MDA-ICM and proposed SPAAM methods, use a cost function that is better suited for WAMI vehicle tracking by using a larger temporal context to assess vehicular movements. This allows them to improve upon the performance of the OT method, even though 10 (a) “Seq1” (b) “Seq2” ( ) “Seq3” Fig. 6: Test sequences used in our evaluation. Each test sequence contains 60 frames and we show the first frame from “Seq1”, “Seq2”, and “Seq3”, in (a), (b), and (c) respectively. All roads in “Seq1” and “Seq3” are one-way roads, while roads in “Seq2” are two-way roads. Seq 1 2 3 Method OT MDA-ICM SPAAM-M SPAAM-EM OT MDA-ICM SPAAM-M SPAAM-EM OT MDA-ICM SPAAM-M SPAAM-EM MT↑ 73 81 85 80 94 95 97 97 53 51 54 54 ML↓ 11 15 14 16 2 3 3 3 0 1 0 0 PT 55 43 40 43 6 4 2 2 1 2 0 0 IDS↓ 292 164 110 82 311 257 101 60 112 86 40 27 Frag↓ 384 211 176 144 360 290 128 83 138 101 59 39 MOTA↑ 0.854994 0.91953 0.946249 0.959503 0.884093 0.902187 0.961854 0.977017 0.932051 0.944871 0.974878 0.983806 TABLE I: Comparison of tracking performance metrics for four different tracking algorithms on the three different WAMI sequences (datasets). The metrics include mostly tracked (MT), mostly lost (ML), partly tracked (PT), ID switches (IDS), fragments (Frag), and multiple object tracking object accuracy (MOTA). See text for definitions of the metrics: the annotations ↑ and ↓ next to a metric in the table indicate whether a higher or lower value is better, respectively. The four methods compared include: the OT method in [12], the two alternative proposed SPAAM instances (SPAAM-M and SPAAM-EM) and the MDA-ICM method in [19]. While both the MDA-ICM method and the proposed SPAAM instances (SPAAM-M and SPAAM-EM) improve upon the OT method, the performance metrics for the proposed SPAAM instances (SPAAM-M and SPAAM-EM) are significantly better than those for the MDA-ICM method, despite the fact that both use the same cost function and initialization. the methods are not able to guarantee that a global minimum of the cost function is achieved. To further understand the differences between the MDA-ICM and the proposed SPAAM approach, it is instructive to compare the evolution of the (common) cost function for these methods with the progression of iterations. Figure 7 shows the total cost for tracks estimated using the proposed SPAAM instances (SPAAM-M and SPAAM-EM) and the MDA-ICM method as a function Seq 1 2 3 SPAAM-EM Iters Time 6 0.1490 6 0.2003 6 0.0833 SPAAM-M Iters Time 6 0.1479 6 0.2142 6 0.0235 MDA-ICM Iters Time 23 26.8306 13 6.1653 22 3.4917 TABLE II: Execution time (in hours) for the two proposed SPAAM instances (SPAAM-M and SPAAM-EM) and for the MDA-ICM method along with the number of corresponding iterations (Iters). All algorithms are executed on a computer with an Intel R CoreTM i7-6700HQ CPU with 8 cores, operating at 2.60 GHz, having 12 GB of main memory, and running the Ubuntu 16.04 LTS operating system. The proposed SPAAM instances have much lower execution times. of the iteration number for these methods. In each step of its iterative process, the MDA-ICM method re-estimates all of the associations across temporally adjacent frames to improve the global cost, while keeping all other associations fixed. This approach guarantees that the iterations improve monotonically assuring convergence of the MDA-ICM approach to a local minimum, a property it inherits from the iterative conditional modes (ICM) [42] approach on which it is based. While the approach ensures computational tractability, it cannot avoid getting trapped in poor local minima in the vicinity of the initialization. On the other hand, via the stochastic disassociation and progressive enlargement of temporal context, the SPAAM approach revisits (predominantly) low confidence associations collectively with the benefit of additional information available from the enlarged context. Thus, even though SPAAM does not guarantee monotonic convergence, it is better at avoiding local minima and, as demonstrated in the results, typically offers a significant improvement in tracking accuracy. To highlight the benefit of stochastic dis-association and the progressive enlargement of the temporal window sizes in SPAAM, we consider SPAAM–, a deliberately de-featured version of proposed approach that estimates all of the associations in single iteration using a fixed temporal window size. 11 -2 -3 SPAAM-EM SPAAM-M MDA-ICM -2.5 SPAAM-EM SPAAM-M MDA-ICM -3.5 -3 -4 -3.5 -4.5 -4 -5 -4.5 -5.5 1500 1000 -5 500 -6 0 5 10 15 20 0 2 4 6 8 10 12 0 (a) “Seq1” (b) “Seq2” 3 4 5 6 Fig. 7: The total cost of the estimated tracks with progression of iterations for the proposed SPAAM instances (SPAAM-M and SPAAM-EM) and for the MDA-ICM method in [19] for: (a) “Seq1” and (b) “Seq2”. The methods use a common cost function and a common initialization. The MDA-ICM technique demonstrates monotonic improvement of the cost with iterations, whereas SPAAM-M and SPAAM-EM do not exhibit monotonic improvement. However, with the progression of iterations, SPAAM-M and SPAAM-EM achieve a lower total cost than MDA-ICM, which results in a better set of estimated tracks. Fig. 8: Execution time (in seconds) for different temporal window sizes for SPAAM-M, SPAAM-EM, and the de-featured variant SPAAM– that estimates all associations afresh. “Seq1” was used for obtaining these execution times. The figure illustrates the key advantages of the SPAAM-M and SPAAMEM approaches: with progressive enlargement of the temporal window size the computation increases only modestly, whereas the execution time increases exponentially with increasing window size for SPAAM–. The hardware configuration used for these experiments is identical to that specified in Table II. The SPAAM– approach is obtained  in Algorithm 1 by setting max iterations = 1 and E G (0) = φ. Fig. 8 compares the execution times required for estimation of tracks for “Seq1” using the proposed SPAAM-M, SPAAM-EM, and the defeatured variant SPAAM– with different temporal window sizes10 . The figure shows that the execution time for the SPAAM– increases exponentially with the increase in the size of the temporal window used for estimating the associations. On the other hand, the SPAAM-M and SPAAM-EM approaches experience only a small increase in the execution time with progressive enlargement of the temporal window sizes because, with high probability, they maintain pairwise associations already estimated in previous iteration with high confidence in the previous iteration and revisit only the low confidence associations. Thus, the number of association hypotheses has a limited increase with the enlargement of the temporal window size, which is reflected as a corresponding small increase in the execution time seen in the figure. Finally, we note that although this paper focused specifically on the problem of vehicle tracking in WAMI, the SPAAM approach is more general and may offer a useful framework for other trellis graph association problems where: (a) it is beneficial to use cost functions that use a larger temporal context that disallows a pairwise independent cost decomposition and (b) one can assess confidence of associations. Exploration of such alternatives is beyond the scope of the present paper but would make interesting future work. SPAAM allows the use of effective cost functions that assess the regularity of vehicular motion over a multi-frame window while simultaneously maintaining computational tractability. These dual objectives are achieved via a strategy of estimating tracks hierarchically over progressively increasing window lengths. As the window is enlarged, high confidence estimated associations are predominantly maintained and low confidence associations are predominantly dissolved, and tracks are reestimated with the larger temporal context. The stochastic approach to maintaining/dissolving associations reduces the computation required for larger windows while allowing the tracks to be improved through the incorporation of additional information provided by the larger context. The combination of SPAAM with information provided by a co-registered road network allows the proposed method to tackle the challenges of scale and limited spatial detail in WAMI tracking. Results obtained over three test sequences that represent different tracking scenarios show a significant performance improvement for the proposed approach compared with three state of the art alternative methods. ACKNOWLEDGMENT We thank Bernard Brower of Harris Corporation for making available the CorvusEye [37] WAMI datasets used in this research. A PPENDIX VI. C ONCLUSION The stochastic progressive association across multiple frames (SPAAM) framework proposed in this paper provides a novel, computationally-efficient, iterative, and accurate approach for estimating vehicular tracks in WAMI. Specifically, 10 For SPAAM-M and SPAAM-EM these are the corresponding iteration execution time. Confidence for pairwise associations is estimated via two alternative probabilistic modeling approaches. The first, uses an energy model to transform costs for tracks into probabilities, followed by approximate marginalization to estimate the probability of an association. The second approach uses a two component mixture model for motion features. Parameters for the model are obtained using semi-supervised expectation 12 maximization (EM) and the association probability is estimated as the posterior probability of the corresponding mixture component. Energy model based marginalization for pairwise association confidence estimation An energy model [43] can be used to coherently extend the costs we already use into a corresponding probabilistic model. Specifically, the probability of an edge induced sub-graph G ∈ F (G) can be modeled as P (G ) = Z1G e−ψ(G ) , where P ZG = e−ψ(G ) is partition function that ensures probaG ∈F (G) bilities sum to 1. The minimization in (3) is then equivalent to a maximum a posterior (MAP), or minimum energy, estimate. With the probabilistic model, the confidence P̄ i (a − b) of a pairwise association that associates vai with vbi+1 can be estimated as the marginal probability of inclusion Pof the edge εia,b in the sub-graph. Formally, P̄ i (a − b) = P (G ) . G ∈F (G), εia,b ∈E(G ) The above marginalization is intractable because of the dependency introduced by the feasibility constraints. Therefore, we approximate P̄ i (a − b) by X 1 P i (a − b) = i e−C(Pk ) , (13) Za Pk ∈P(G), i va ,vbi+1 ∈Pk where Zai = P P e−C(Pk ) is a normalization i+1 i ) Pk ∈P(G), vm ∈A(va i i+1 va ,vm ∈Pk constant. The above approximation is reasonable for the following reasons that are apparent from (13). First, vai must be  i associated with only one of the VDs in A va , and therefore, P P i (a − m) = 1. Second, associating vai with vbi is i+1 i) vm ∈A(va more probable than associating with vci if the sum of the costs of the tracks that contain the pairwise association between vai and vbi is smaller than the tracks that contain the pairwise association between vai and vci . Semi-supervised EM based mixture model To estimate the confidence of a pairwise association εia,b that i+1 associates vai with temporally b , we i  fea local    first estimate h v i tures fa,b = Γm εia,b , Γθ εia,b , Rd εia,b , Rθ εia,b for the pairwise association, then we model the distribution of i fa,b as a two component Gaussian mixture model (GMM) [43]. One mixture component corresponds to the case when vai associates with vbi+1 (denoted as vai → vbi+1 ), while the other component corresponds to the case when vai does not associate with vbi+1 . To indicate which mixture component is responsible for the pairwise association, we associate the pairwise association with a binary latent variable cia,b , where ( 1 if vai → vbi+1 , cia,b = 0 otherwise. The confidence of the pairwise association is then approximated by the posterior probability that cia,b = 1 given the i computed features fa,b . Specifically, the two GMM components are parametrized by the corresponding means µr and covariances Σr of the features, where r ∈ {0, 1}. Also, cia,b is assumed to be  Bernoulli with parameter γ = p cia,b = 1 . Thus, the GMM is parametrized by θ = {γ, µ0 , µ1 , Σ0 , Σ1 }. The likelihood i of fa,b is 1  X  i i p fa,b |θ = p fa,b , cia,b = r |θ , (14) r=0 where    i i , cia,b = r |θ = p cia,b = r |θ p fa,b p fa,b cia,b = r, θ ,  i = γ r (1 − γ)1−r N fa,b |µr , Σr . (15) The confidence of the pairwise association is then computed as   i P i (a − b) = p cia,b = 1 fa,b , θ̂ ,   i p fa,b , cia,b = 1 θ̂ (16) = 1  , P i , ci p fa,b = r θ̂ a,b r=0 n where θ̂ = γ̂, µˆ0 , µˆ1 , Σ̂0 , Σ̂1 o are the estimated parameters of the GMM. We estimate θ̂ using the EM framework [44] through a semi-supervised approach. The semi-supervised approach exploits available ground truth training data (for example from [38]). Let G̃ be a ground truth trellis graph11 that is constructed from the ground truth tracks such that every ground truth track represents a path in G̃. Then, the EM framework estimates θ̂ by Y  θ̂ = arg max p εia,b , cia,b = 1 |θ × θ εia,b ∈E (G̃ ) Y  i |θ . (17) p fa,b εia,b ∈E(G ) under the assumption that the pairwise associations are conditionally independent12. R EFERENCES [1] A. Elliethy and G. Sharma, “Vehicle tracking in wide area motion imagery : A facility location motivated combinatorial approach,” in Proc. IEEE Intl. Conf. Acoustics Speech and Sig. Proc., March 5-9, 2017, New Orleans, Mar. 2017, pp. 1932–1936. [2] J. Hawkes, Aerial: The Art of Photography From the Sky. Hove, UK: Rotovision, 2003. [3] K. Palaniappan, R. M. Rao, and G. Seetharaman, “Wide-area persistent airborne video: Architecture and challenges,” in Distributed Video Sensor Networks. Springer, 2011, pp. 349–371. 11 Note that the ground truth trellis graph is constructed using ground truth   tracks in different dataset, i.e., V (G ) = 6 V G̃ . 12 Note that θ̂ can be also estimated through an unsupervised approach, for   which E G̃ = φ. To identify the mixture component that is corresponds to vai → vbi+1 case, the estimated covariances of the two Gaussian components are compared and the component that has smaller parameter variance is selected. 13 [4] E. Blasch, G. Seetharaman, S. Suddarth, K. Palaniappan, G. Chen, [30] A. Dehghan, S. M. Assari, and M. Shah, “GMMCP tracker: Globally H. Ling, and A. Basharat, “Summary of methods in wide-area motion optimal generalized maximum multi clique problem for multiple object imagery (WAMI),” in Proc. SPIE, vol. 9089, 2014, pp. 90 890C– tracking,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog., 2015, 90 890C–10. pp. 4091–4099. [5] R. Porter, A. Fraser, and D. Hush, “Wide-area motion imagery,” IEEE [31] D. Medhi and K. Ramasamy, Network Routing: Algorithms, Protocols, and Architectures. San Francisco, CA, USA: Morgan Kaufmann Sig. Proc. Mag., vol. 27, no. 5, pp. 56–65, Sept 2010. Publishers Inc., 2007. [6] W. Luo, J. Xing, X. Zhang, X. Zhao, and T.-K. Kim, “Multiple object [32] “Gurobi optimizer,” 2015. [Online]. Available: tracking: A literature review,” arXiv preprint arXiv:1409.7618, 2014. http://www.gurobi.com/products/gurobi-optimizer [7] L. Zhang, Y. Li, and R. Nevatia, “Global data association for multi[33] “Gnu Linear Programming Kit (GLPK),” accessed July 2017. [Online]. object tracking using network flows,” in IEEE Intl. Conf. Comp. Vision, Available: https://www.gnu.org/software/glpk/ and Pattern Recog., June 2008, pp. 1–8. [34] “Solving Constraint Integer Programs (SCIP),” accessed July 2017. [8] J. Berclaz, F. Fleuret, E. Turetken, and P. Fua, “Multiple object tracking [Online]. Available: http://scip.zib.de/ using k-shortest paths optimization,” IEEE Trans. Pattern Anal. Mach. [35] “CPLEX optimizer,” accessed July 2017. [Online]. Available: Intel., vol. 33, no. 9, pp. 1806–1819, 2011. https://www-01.ibm.com/software/commerce/optimization/cplex-optimizer/ [9] H. Pirsiavash, D. Ramanan, and C. C. Fowlkes, “Globally-optimal greedy algorithms for tracking a variable number of objects,” in IEEE [36] “Coin-or branch and cut (Cbc),” accessed July 2017. [Online]. Available: https://projects.coin-or.org/Cbc Intl. Conf. Comp. Vision, and Pattern Recog., 2011, pp. 1201–1208. [37] “CorvusEyeTM 1500 Data Sheet,” http://www.exelisinc.com/solutions/corvuseye1500/Doc [10] V. Chari, S. Lacoste-Julien, I. Laptev, and J. Sivic, “On pairwise costs for [38] “AFRL WPAFB 2009 data set,” https://www.sdms.afrl.af.mil. network flow multi-object tracking,” in IEEE Intl. Conf. Comp. Vision, [39] “OpenStreetMap,” http://www.openstreetmap.org, accessed Mar. 2016. and Pattern Recog., June 2015, pp. 5537–5545. [40] B. Wu and R. Nevatia, “Tracking of multiple, partially occluded humans [11] P. Lenz, A. Geiger, and R. Urtasun, “FollowMe: Efficient online minbased on static body part detection,” in IEEE Intl. Conf. Comp. Vision, cost flow tracking with bounded memory and computation,” in IEEE and Pattern Recog., vol. 1, 2006, pp. 951–958. Intl. Conf. Comp. Vision., Dec 2015, pp. 4364–4372. [41] R. Kasturi, D. Goldgof, P. Soundararajan, V. Manohar, J. Garofolo, [12] J. Xiao, H. Cheng, H. Sawhney, and F. Han, “Vehicle detection and R. Bowers, M. Boonstra, V. Korzhova, and J. Zhang, “Framework for tracking in wide field-of-view aerial video,” in IEEE Intl. Conf. Comp. performance evaluation of face, text, and vehicle detection and tracking Vision, and Pattern Recog., June 2010, pp. 679–684. in video: Data, metrics, and protocol,” IEEE Trans. Pattern Anal. Mach. [13] V. Reilly, H. Idrees, and M. Shah, “Detection and tracking of large Intel., vol. 31, no. 2, pp. 319–336, Feb 2009. number of targets in wide area surveillance,” in Proc. European Conf. [42] J. Besag, “On the statistical analysis of dirty pictures,” Journal of the Computer Vision, ser. Lecture Notes in Computer Science, 2010, vol. Royal Statistical Society. Series B (Methodological), pp. 259–302, 1986. 6313, pp. 186–199. [43] C. M. Bishop, Pattern Recognition and Machine Learning. New York, [14] C. Huang, B. Wu, and R. Nevatia, “Robust object tracking by hierNY: Springer, 2006. archical association of detection responses,” in Proc. European Conf. [44] A. P. Dempster, N. M. Laird, and D. B. Rubin, “Maximum likelihood Computer Vision. Springer, 2008, pp. 788–801. from incomplete data via the EM algorithm,” Journal of the royal [15] M. Hofmann, M. Haag, and G. Rigoll, “Unified hierarchical multi-object statistical society. Series B (methodological), pp. 1–38, 1977. tracking using global data association,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog. Workshops, Jan 2013, pp. 22–28. [16] J. Liu, P. Carr, R. T. Collins, and Y. Liu, “Tracking sports players with context-conditioned motion models,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog., June 2013, pp. 1830–1837. [17] B. Wang, G. Wang, K. L. Chan, and L. Wang, “Tracklet association by online target-specific metric learning and coherent dynamics estimation,” IEEE Trans. Pattern Anal. Mach. Intel., vol. PP, no. 99, pp. 1–1, 2016. [18] H. W. Kuhn, “The Hungarian method for the assignment problem,” Naval Res. Logistics Quart., vol. 2, no. 1-2, pp. 83–97, 1955. [19] R. T. Collins, “Multitarget data association with higher-order motion models,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog., 2012, pp. 1744–1751. [20] X. Shi, H. Ling, J. Xing, and W. Hu, “Multi-target tracking by rank-1 tensor approximation,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog., June 2013, pp. 2387–2394. [21] A. A. Butt and R. T. Collins, “Multiple target tracking using frame triplets,” in Asian Conf. on Comp. Vision. Springer, 2012, pp. 163– 176. [22] ——, “Multi-target tracking by Lagrangian relaxation to min-cost network flow,” in IEEE Intl. Conf. Comp. Vision, and Pattern Recog., June 2013. [23] C. R. Reeves, Modern heuristic techniques for combinatorial problems. John Wiley & Sons, Inc., 1993. [24] N. Ukita and A. Okada, “High-order framewise smoothness-constrained globally-optimal tracking,” Computer Vision and Image Understanding, vol. 153, pp. 130 – 142, 2016, special issue on Visual Tracking. [25] J. P. Snyder, Map projections–A working manual. US Government Printing Office, 1987, vol. 1395. [26] A. Elliethy and G. Sharma, “Automatic registration of vector road maps with wide area motion imagery by exploiting vehicle detections,” IEEE Trans. Image Proc., vol. 25, no. 11, pp. 5304 – 5315, Nov. 2016. [27] ——, “Vector road map registration to oblique wide area motion imagery by exploiting vehicles movements,” in IS&T Electronic Imaging: Video Surveillance and Transportation Imaging Applications, San Francisco, California, 2016, pp. VSTIA–520.1–8. [Online]. Available: http://ist.publisher.ingentaconnect.com/contentone/ist/ei/2016/00002016/00000003/art00008 [28] C. H. Papadimitriou and K. Steiglitz, Combinatorial Optimization: Algorithms and Complexity. Courier Corporation, 2013. [29] A. R. Zamir, A. Dehghan, and M. Shah, “GMCP-tracker: Global multiobject tracking using generalized minimum clique graphs,” in Proc. European Conf. Computer Vision. Springer, 2012, pp. 343–356.
1cs.CV
Journal of Automated Reasoning manuscript No. (will be inserted by the editor) A Formal C Memory Model for Separation Logic arXiv:1509.03339v1 [cs.LO] 10 Sep 2015 Robbert Krebbers Received: n/a Abstract The core of a formal semantics of an imperative programming language is a memory model that describes the behavior of operations on the memory. Defining a memory model that matches the description of C in the C11 standard is challenging because C allows both high-level (by means of typed expressions) and low-level (by means of bit manipulation) memory accesses. The C11 standard has restricted the interaction between these two levels to make more effective compiler optimizations possible, on the expense of making the memory model complicated. We describe a formal memory model of the (non-concurrent part of the) C11 standard that incorporates these restrictions, and at the same time describes low-level memory operations. This formal memory model includes a rich permission model to make it usable in separation logic and supports reasoning about program transformations. The memory model and essential properties of it have been fully formalized using the Coq proof assistant. Keywords ISO C11 Standard · C Verification · Memory Models · Separation Logic · Interactive Theorem Proving · Coq 1 Introduction A memory model is the core of a semantics of an imperative programming language. It models the memory states and describes the behavior of memory operations. The main operations described by a C memory model are: – – – – Reading a value at a given address. Storing a value at a given address. Allocating a new object to hold a local variable or storage obtained via malloc. Deallocating a previously allocated object. Robbert Krebbers ICIS, Radboud University Nijmegen, The Netherlands Aarhus University, Denmark E-mail: [email protected] 2 Robbert Krebbers Formalizing the C11 memory model in a faithful way is challenging because C features both low-level and high-level data access. Low-level data access involves unstructured and untyped byte representations whereas high-level data access involves typed abstract values such as arrays, structs and unions. This duality makes the memory model of C more complicated than the memory model of nearly any other programming language. For example, more mathematically oriented languages such as Java and ML feature only high-level data access, in which case the memory can be modeled in a relatively simple and structured way, whereas assembly languages feature only low-level data access, in which case the memory can be modeled as an array of bits. The situation becomes more complicated as the C11 standard allows compilers to perform optimizations based on a high-level view of data access that are inconsistent with the traditional low-level view of data access. This complication has lead to numerous ambiguities in the standard text related to aliasing, uninitialized memory, end-of-array pointers and type-punning that cause problems for C code when compiled with widely used compilers. See for example the message [42] on the standard committee’s mailing list, Defect Reports #236, #260, and #451 [26], and the various examples in this paper. Contribution. This paper describes the CH2 O memory model, which is part of the the CH2 O project [35, 36, 30, 31, 34, 32, 37, 33]. CH2 O provides an operational, executable and axiomatic semantics in Coq for a large part of the non-concurrent fragment of C, based on the official description of C as given by the C11 standard [27]. The key features of the CH2 O memory model are as follows: – Close to C11. CH2 O is faithful to the C11 standard in order to be compiler independent. When one proves something about a given program with respect to CH2 O, it should behave that way with any C11 compliant compiler (possibly restricted to certain implementation defined choices). – Static type system. Given that C is a statically typed language, CH2 O does not only capture the dynamic semantics of C11 but also its type system. We have established properties such as type preservation of the memory operations. – Proof infrastructure. All parts of the CH2 O memory model and semantics have been formalized in Coq (without axioms). This is essential for its application to program verification in proof assistants. Also, considering the significant size of CH2 O and its memory model, proving metatheoretical properties of the language would have been intractable without the support of a proof assistant. Despite our choice of using Coq, we believe that nearly all parts of CH2 O could be formalized in any proof assistant based on higher-order logic. – Executable. To obtain more confidence in the accuracy of CH2 O with respect to C11, the CH2 O memory model is executable. An executable memory model allows us to test the CH2 O semantics on example programs and to compare the behavior with that of widely used compilers [37, 33]. – Separation logic. In order to reason about concrete C programs, one needs a program logic. To that end, the CH2 O memory model incorporates a complex permission model suitable for separation logic. This permission system, as well as the memory model itself, forms a separation algebra. – Memory refinements. CH2 O has an expressive notion of memory refinements that relates memory states. All memory operations are proven invariant under A Formal C Memory Model for Separation Logic 3 this notion. Memory refinements form a general way to validate many commonsense properties of the memory model in a formal way. They also open the door to reasoning about program transformations, which is useful if one were to use the memory model as part of a verified compiler front-end. This paper is an extended version of previously published conference papers at CPP [30] and VSTTE [32]. In the time following these two publications, the memory model has been extended significantly and been integrated into an operational, executable and axiomatic semantics [37, 33]. The memory model now supports more features, various improvements to the definitions have been carried out, and more properties have been formally proven as part of the Coq development. Parts of this paper also appear in the author’s PhD thesis [33], which describes the entire CH2 O project including its operational, executable and axiomatic semantics, and metatheoretical results about these. Problem. The C11 standard gives compilers a lot of freedom in what behaviors a program may have [27, 3.4]. It uses the following notions of under-specification: – Unspecified behavior: two or more behaviors are allowed. For example: the execution order of expressions. The choice may vary for each use of the construct. – Implementation defined behavior: like unspecified behavior, but the compiler has to document its choice. For example: size and endianness of integers. – Undefined behavior: the standard imposes no requirements at all, the program is even allowed to crash. For example: dereferencing a NULL pointer, or signed integer overflow. Under-specification is used extensively to make C portable, and to allow compilers to generate fast code. For example, when dereferencing a pointer, no code has to be generated to check whether the pointer is valid or not. If the pointer is invalid (NULL or a dangling pointer), the compiled program may do something arbitrary instead of having to exit with a NullPointerException as in Java. Since the CH2 O semantics intends to be a formal version of the C11 standard, it has to capture the behavior of any C compiler, and thus has to take all under-specification seriously (even if that makes the semantics complex). Modeling under-specification in a formal semantics is folklore: unspecified behavior corresponds to non-determinism, implementation defined behavior corresponds to parametrization, and undefined behavior corresponds to a program having no semantics. However, the extensive amount of underspecification in the C11 standard [27, Annex J], and especially that with respect to the memory model, makes the situation challenging. We will give a motivating example of subtle underspecification in the introduction of this paper. Section 3 provides a more extensive overview. Motivating example. A drawback for efficient compilation of programming languages with pointers is aliasing. Aliasing describes a situation in which multiple pointers refer to the same object. In the following example the pointers p and q are said to be aliased. int x; int *p = &x, *q = &x; 4 Robbert Krebbers The problem of aliased pointers is that writes through one pointer may effect the result of reading through the other pointer. The presence of aliased pointers therefore often disallows one to change the order of instructions. For example, consider: int f(int *p, int *q) { int z = *q; *p = 10; return z; } When f is called with pointers p and q that are aliased, the assignment to *p also affects *q. As a result, one cannot transform the function body of f into the shorter *p = 10; return (*q);. The shorter function will return 10 in case p and q are aliased, whereas the original f will always return the original value of *q. Unlike this example, there are many situations in which pointers can be assumed not to alias. It is essential for an optimizing compiler to determine where aliasing cannot occur, and use this information to generate faster code. The technique of determining whether pointers can alias or not is called alias analysis. In type-based alias analysis, type information is used to determine whether pointers can alias or not. Consider the following example: short g(int *p, short *q) { short z = *q; *p = 10; return z; } Here, a compiler is allowed to assume that p and q are not aliased because they point to objects of different types. The compiler is therefore allowed to transform the function body of g into the shorter *p = 10; return (*q);. The peculiar thing is that the C type system does not statically enforce the property that pointers to objects of different types are not aliased. A union type can be used to create aliased pointers to different types: union int_or_short { int x; short y; } u = { .y = 3 }; int *p = &u.x; // p points to the x variant of u short *q = &u.y; // q points to the y variant of u return g(p, q); // g is called with aliased pointers p and q The above program is valid according to the rules of the C11 type system, but has undefined behavior during execution of g. This is caused by the standard’s notion of effective types [27, 6.5p6-7] (also called strict-aliasing restrictions) that assigns undefined behavior to incorrect usage of aliased pointers to different types. We will inline part of the function body of g to indicate the incorrect usage of aliased pointers during the execution of the example. union int_or_short { int x; short y; } u = { .y = 3 }; int *p = &u.x; // p points to the x variant of u short *q = &u.y; // q points to the y variant of u // g(p, q) is called, the body is inlined short z = *q; // u has variant y and is accessed through y -> OK *p = 10; // u has variant y and is accessed through x -> bad The assignment *p = 10 violates the rules for effective types. The memory area where p points to contains a union whose variant is y of type short, but is accessed through a pointer to variant x of type int. This causes undefined behavior. A Formal C Memory Model for Separation Logic 5 Effective types form a clear tension between the low-level and high-level way of data access in C. The low-level representation of the memory is inherently untyped and unstructured and therefore does not contain any information about variants of unions. However, the standard treats the memory as if it were typed. Approach. Most existing C formalizations (most notably Norrish [45], Leroy et al. [39, 40] and Ellison and Roşu [19]) use an unstructured untyped memory model where each object in the formal memory model consists of an array of bytes. These formalizations therefore cannot assign undefined behavior to violations of the rules for effective types, among other things. In order to formalize the interaction between low-level and high-level data access, and in particular effective types, we represent the formal memory state as a forest of well-typed trees whose structure corresponds to the structure of data types in C. The leaves of these trees consist of bits to capture low-level aspects of the language. The key concepts of our memory model are as follows: – Memory trees (Section 6.3) are used to represent each object in memory. They are abstract trees whose structure corresponds to the shape of C data types. The memory tree of struct S { short x, *r; } s = { 33, &s.x } might be (the precise shape and the bit representations are implementation defined): structS 1000010000000000 EEEEEEEEEEEEEEEE ································ The leaves of memory trees contain permission annotated bits (Section 6.2). Bits are represented symbolically: the integer value 33 is represented as its binary representation 1000010000000000, the padding bytes as symbolic indeterminate bits E (whose actual value should not be used), and the pointer &s.x as a sequence of symbolic pointer bits. The memory itself is a forest of memory trees. Memory trees are explicit about type information (in particular the variants of unions) and thus give rise to a natural formalization of effective types. – Pointers (Section 6.1) are formalized using paths through memory trees. Since we represent pointers as paths, the formal representation contains detailed information about how each pointer has been obtained (in particular which variants of unions were used). A detailed formal representation of pointers is essential to describe effective types. – Abstract values (Definition 6.4) are trees whose structure is similar to memory trees, but have base values (mathematical integers and pointers) on their leaves. The abstract value of struct S { short x, *r; } s = { 33, &s.x } is: structS 33 • Abstract values hide internal details of the memory such as permissions, padding and object representations. They are therefore used in the external interface of the memory model and throughout the operational semantics. 6 Robbert Krebbers Memory trees, abstract values and bits with permissions can be converted into each other. These conversions are used to define operations internal to the memory model. However, none of these conversions are bijective because different information is materialized in these three data types: Abstract values Permissions Padding Variants of union Mathematical values X X Memory trees Bits with permissions X always E X X X This table indicates that abstract values and sequences of bits are complementary. Memory trees are a middle ground, and therefore suitable to describe both the lowlevel and high-level aspects of the C memory. Outline. This work presents an executable mathematically precise version of a large part of the (non-concurrent) C memory model. – Section 3 describes some challenges that a C11 memory model should address; these include end-of-array pointers, byte-level operations, indeterminate memory, and type-punning. – Section 4 describes the types of C. Our formal development is parametrized by an abstract interface to characterize implementation defined behavior. – Section 5 describes the permission model using a variant of separation algebras that is suitable for formalization in Coq. The permission model is built compositionally from simple separation algebras. – Section 6 contains the main part of this paper, it describes a memory model that can accurately deal with the challenges posed in Section 3. – Section 7 demonstrates that our memory model is suitable for formal proofs. We prove that the standard’s notion of effective types has the desired effect of allowing type-based alias analysis (Section 7.1), we present a method to reason compositionally about memory transformations (Section 7.2), and prove that the memory model has a separation algebra structure (Section 7.4). – Section 8 describes the Coq formalization: all proofs about our memory model have been fully formalized using Coq. As this paper describes a large formalization effort, we often just give representative parts of definitions. The interested reader can find all details online as part of our Coq formalization at: http://robbertkrebbers.nl/research/ch2o/. 2 Notations This section introduces some common mathematical notions and notations that will be used throughout this paper. Definition 2.1 We let N denote the type of natural numbers (including 0), let Z denote the type of integers, and let Q denote the type of rational numbers. We let i | j denote that i ∈ N is a divisor of j ∈ N. A Formal C Memory Model for Separation Logic 7 Definition 2.2 We let Prop denote the type of propositions, and let bool denote the type of Booleans whose elements are true and false. Most propositions we consider have a corresponding Boolean-valud decision function. In Coq we use type classes to keep track of these correspondences, but in this paper we leave these correspondences implicit. Definition 2.3 We let option A denote the option type over A, whose elements are inductively defined as either ⊥ or x for some x ∈ A. We implicitly lift operations to operate on the option type, and often omit cases of definitions that yield ⊥. This is formally described using the option monad in the Coq formalization. Definition 2.4 A partial function f from A to B is a function f : A → option B. Definition 2.5 A partial function f is called a finite partial function or a finite map if its domain dom f := {x | ∃y ∈ B . f x = y} is finite. The type of finite partial functions is denoted as A →fin B. The operation f [x := y] yields f with the value y for argument x. Definition 2.6 We let A × B denote the product of types A and B. Given a pair (x, y) ∈ A × B, we let (x, y)1 := x and (x, y)2 := y denote the first and second projection of (x, y). Definition 2.7 We let list A denote the list type over A, whose elements are inductively defined as either ε or x ~x for some x ∈ A and ~x ∈ list A. We let xi ∈ A denote the ith element of a list ~x ∈ list A (we count from 0). Lists are sometimes denoted as [ x0 , . . . , xn−1 ] ∈ list A for x0 , . . . , xn−1 ∈ A. We use the following operations on lists: – We often implicitly lift a function f : A0 → · · · → An point-wise to the function f : list A0 → · · · → list An . The resulting list is truncated to the length of the smallest input list in case n > 1. – We often implicitly lift a predicate P : A0 → An−1 → Prop to the predicate P : list A0 → · · · → list An−1 → Prop that guarantees that P holds for all (pairs of) elements of the list(s). The lifted predicate requires all lists to have the same length in case n > 1. – We let |~x| ∈ N denote the length of ~x ∈ list A. – We let ~x[i, j) ∈ list A denote the sublist xi . . . xj−1 of ~x ∈ list A. – We let xn ∈ list A denote the list consisting of n times x ∈ A. – We let (~xy ∞ )[i, j) ∈ list A denote the sublist xi . . . xj−1 of ~x ∈ list A which is padded with y ∈ A in case ~x is too short. # » ∈ list (A × B) denote – Given lists ~x ∈ list A and ~ y ∈ list B with |~x| = |~y|, we let xy the point-wise pairing of ~x and ~y. 3 Challenges This section illustrates a number of subtle forms of underspecification in C by means of example programs, their bizarre behaviors exhibited by widely used C compilers, and their treatment in CH2 O. Many of these examples involve delicacies due to the interaction between the following two ways of accessing data: – In a high-level way using arrays, structs and unions. 8 Robbert Krebbers – In a low-level way using unstructured and untyped byte representations. The main problem is that compilers use a high-level view of data access to perform optimizations whereas both programmers and traditional memory models expect data access to behave in a concrete low-level way. 3.1 Byte-level operations and object representations Apart from high-level access to objects in memory by means of typed expressions, C also allows low-level access by means of byte-wise manipulation. Each object of type τ can be interpreted as an unsigned char array of length sizeof(τ ), which is called the object representation [27, 6.2.6.1p4]. Let us consider: struct S { short x; short *r; } s1 = { 10, &s1.x }; unsigned char *p = (unsigned char*)&s1; On 32-bits computing architectures such as x86 (with _Alignof(short*)= 4), the object representation of s1 might be: padding x 01010000 p 00000000 p + 1 EEEEEEEE EEEEEEEE r •••••••• •••••••• •••••••• •••••••• p + 2 The above object representation contains a hole due to alignment of objects. The bytes belonging such holes are called padding bytes. Alignment is the way objects are arranged in memory. In modern computing architectures, accesses to addresses that are a multiple of a word sized chunk (often a multiple of 4 bytes on a 32-bits computing architecture) are significantly faster due to the way the processor interacts with the memory. For that reason, the C11 standard has put restrictions on the addresses at which objects may be allocated [27, 6.2.8]. For each type τ , there is an implementation defined integer constant _Alignof(τ ), and objects of type τ are required to be allocated at addresses that are a multiple of that constant. In case _Alignof(short*)= 4, there are thus two bytes of padding in between the fields of struct S. An object can be copied by copying its object representation. For example, the struct s1 can be copied to s2 as follows: struct S { short x; short *r; } s1 = { 10, &s1.x }; struct S s2; for (size_t i = 0; i < sizeof(struct S); i++) ((unsigned char*)&s2)[i] = ((unsigned char*)&s1)[i]; In the above code, size_t is an unsigned integer type, which is able to hold the results of the sizeof operator [27, 7.19p2]. Manipulation of object representations of structs also involves access to padding bytes, which are not part of the high-level representation. In particular, in the example the padding bytes are also being copied. The problematic part is that padding bytes have indeterminate values, whereas in general, reading an indeterminate value A Formal C Memory Model for Separation Logic 9 has undefined behavior (for example, reading from an uninitialized int variable is undefined). The C11 standard provides an exception for unsigned char [27, 6.2.6.1p5], and the above example thus has defined behavior. Our memory model uses a symbolic representation of bits (Definition 6.19) to distinguish determinate and indeterminate memory. This way, we can precisely keep track of the situations in which access to indeterminate memory is permitted. 3.2 Padding of structs and unions The following excerpt from the C11 standard points out another challenge with respect to padding bytes [27, 6.2.6.1p6]: When a value is stored in an object of structure or union type, including in a member object, the bytes of the object representation that correspond to any padding bytes take unspecified values. Let us illustrate this difficulty by an example: struct S { char x; char y; char z; }; void f(struct S *p) { p->x = 0; p->y = 0; p->z = 0; } On architectures with sizeof(struct S) = 4, objects of type struct S have one byte of padding. The object representation may be as follows: x y z padding p Instead of compiling the function f to three store instructions for each field of the struct, the C11 standard allows a compiler to use a single instruction to store zeros to the entire struct. This will of course affect the padding byte. Consider: struct S s = { 1, 1, 1 }; ((unsigned char*)&s)[3] = 10; f(&s); return ((unsigned char*)&s)[3]; Now, the assignments to fields of s by the function f affect also the padding bytes of s, including the one ((unsigned char*)&s)[3] that we have assigned to. As a consequence, the returned value is unspecified. From a high-level perspective this behavior makes sense. Padding bytes are not part of the abstract value of a struct, so their actual value should not matter. However, from a low-level perspective it is peculiar. An assignment to a specific field of a struct affects the object representation of parts not assigned to. None of the currently existing C formalizations describes this behavior correctly. In our tree based memory model we enforce that padding bytes always have an indeterminate value, and in turn we have the desired behavior implicitly. Note that if the function call f(&s) would have been removed, the behavior of the example program remains unchanged in CH2 O. 10 Robbert Krebbers 3.3 Type-punning Despite the rules for effective types, it is under certain conditions nonetheless allowed to access a union through another variant than the current one. Accessing a union through another variant is called type-punning. For example: union int_or_short { int x; short y; } u = { .x = 3 }; printf("%d\n", u.y); This code will reinterpret the bit representation of the int value 3 of u.x as a value of type short. The reinterpreted value that is printed is implementation defined (on architectures where shorts do not have trap values). Since C11 is ambiguous about the exact conditions under which type-punning is allowed1 , we follow the interpretation by the GCC documentation [20]: Type-punning is allowed, provided the memory is accessed through the union type. According to this interpretation the above program indeed has implementation defined behavior because the variant y is accessed via the expression u.y that involves the variable u of the corresponding union type. However, according to this interpretation, type-punning via a pointer to a specific variant of a union type yields undefined behavior. This is in agreement with the rules for effective types. For example, the following program has undefined behavior. union int_or_short { int x; short y; } u = { .x = 3 }; short *p = &u.y; printf("%d\n", *p); We formalize the interpretation of C11 by GCC by decorating pointers and lvalues to subobjects with annotations (Definition 6.4). When a pointer to a variant of a union is stored in memory, or used as the argument of a function, the annotations are changed to ensure that type-punning no longer has defined behavior via that pointer. In Section 7.1 we formally establish that this approach is correct by showing that a compiler can perform type-based alias analysis (Theorem 7.2 on page 51). 3.4 Indeterminate memory and pointers A pointer value becomes indeterminate when the object it points to has reached the end of its lifetime [27, 6.2.4] (it has gone out of scope, or has been deallocated). Dereferencing an indeterminate pointer has of course undefined behavior because it no longer points to an actual value. However, not many people are aware that using an indeterminate pointer in pointer arithmetic and pointer comparisons also yields undefined behavior. Consider: int *p = malloc(sizeof(int)); assert (p != NULL); free(p); 1 The term type-punning merely appears in a footnote[27, footnote 95]. There is however the related common initial sequence rule [27, 6.5.2.3], for which the C11 standard uses the notion of visible. This notion is not clearly defined either. A Formal C Memory Model for Separation Logic 11 int *q = malloc(sizeof(int)); assert (q != NULL); if (p == q) { // undefined, p is indeterminate due to the free *q = 10; *p = 14; printf("%d\n", *q); // p and q alias, expected to print 14 } In this code malloc(sizeof(int)) yields a pointer to a newly allocated memory area that may hold an integer, or yields a NULL pointer in case no memory is available. The function free deallocates memory allocated by malloc. In the example we assert that both calls to malloc succeed. After execution of the second call to malloc it may happen that the memory area of the first call to malloc is reused: we have used free to deallocate it after all. This would lead to the following situation in memory: p result of malloc • q • Both GCC (version 4.9.2) or Clang (version 3.5.0) use the fact that p and q are obtained via different calls to malloc as a license to assume that p and q do not alias. As a result, the value 10 of *q is inlined, and the program prints the value 10 instead of the naively expected value 14. The situation becomes more subtle because when the object a pointer points to has been deallocated, not just the argument of free becomes indeterminate, but also all other copies of that pointer. This is therefore yet another example where high-level representations interact subtly with their low-level counterparts. In our memory model we represent pointer values symbolically (Definition 6.4), and keep track of memory areas that have been previously deallocated. The behavior of operations like == depends on the memory state, which allows us to accurately capture the described undefined behaviors. 3.5 End-of-array pointers The way the C11 standard deals with pointer equality is subtle. Consider the following excerpt [27, 6.5.9p6]: Two pointers compare equal if and only if [...] or one is a pointer to one past the end of one array object and the other is a pointer to the start of a different array object that happens to immediately follow the first array object in the address space. End-of-array pointers are peculiar because they cannot be dereferenced, they do not point to any value after all. Nonetheless, end-of-array are commonly used when looping through arrays. int a[4] = { 0, 1, 2, 3 }; int *p = a; while (p < a + 4) { *p += 1; p += 1; } 12 Robbert Krebbers The pointer p initially refers to the first element of the array a. The value p points to, as well as p itself, is being increased as long as p is before the end-of-array pointer a + 4. This code thus increases the values of the array a. The initial state of the memory is displayed below: a 0 1 2 p 3 a + 4 End-of-array pointers can also be used in a way where the result of a comparison is not well-defined. In the example below, the printf is executed only if x and y are allocated adjacently in the address space (typically the stack). int x, y; if (&x + 1 == &y) printf("x and y are allocated adjacently\n"); Based on the aforementioned excerpt of the C11 standard [27, 6.5.9p6], one would naively say that the value of &x + 1 == &y is uniquely determined by the way x and y are allocated in the address space. However, the GCC implementers disagree2 . They claim that Defect Report #260 [26] allows them to take the derivation of a pointer value into account. In the example, the pointers &x + 1 and &y are derived from unrelated objects (the local variables x and y). As a result, the GCC developers claim that &x + 1 and &y may compare unequal albeit being allocated adjacently. Consider: int compare(int *p, int *q) { // some code to confuse the optimizer return p == q; } int main() { int x, y; if (&x + 1 == &y) printf("x and y are adjacent\n"); if (compare(&x + 1, &y)) printf("x and y are still adjacent\n"); } When compiled with GCC (version 4.9.2), we have observed that the string x and y are still adjacent is being printed, wheras x and y are adjacent is not being printed. This means that the value of &x + 1 == &y is not consistent among different occurrences of the comparison. Due to these discrepancies we assign undefined behavior to questionable uses of end-of-array pointers while assigning the correct defined behavior to pointer comparisons involving end-of-array pointers when looping through arrays (such as in the first example above). Our treatment is similar to our extension of CompCert [34]. 3.6 Sequence point violations and non-determinism Instead of having to follow a specific execution order, the execution order of expressions is unspecified in C. This is a common cause of portability problems because 2 See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61502 A Formal C Memory Model for Separation Logic 13 a compiler may use an arbitrary execution order for each expression, and each time that expression is executed. Hence, to ensure correctness of a C program with respect to an arbitrary compiler, one has to verify that each possible execution order is free of undefined behavior and gives the correct result. In order to make more effective optimizations possible (for example, delaying of side-effects and interleaving), the C standard does not allow an object to be modified more than once during the execution of an expression. If an object is modified more than once, the program has undefined behavior. We call this requirement the sequence point restriction. Note that this is not a static restriction, but a restriction on valid executions of the program. Let us consider an example: int x, y = (x = 3) + (x = 4); printf("%d %d\n", x, y); By considering all possible execution orders, one would naively expect this program to print 4 7 or 3 7, depending on whether the assignment x = 3 or x = 4 is executed first. However, x is modified twice within the same expression, and thus both execution orders have undefined behavior. The program is thereby allowed to exhibit any behavior. Indeed, when compiled with gcc -O2 (version 4.9.2), the compiled program prints 4 8, which does not correspond to any of the execution orders. Our approach to non-determinism and sequence points is inspired by Norrish [44] and Ellison and Roşu [19]. Each bit in memory carries a permission (Definition 5.5) that is set to a special locked permission when a store has been performed. The memory model prohibits any access (read or store) to objects with locked permissions. At the next sequence point, the permissions of locked objects are changed back into their original permission, making future accesses possible again. It is important to note that we do not have non-determinism in the memory model itself, and have set up the memory model in such a way that all non-determinism is on the level of the small-step operational semantics. 4 Types in C This section describes the types used in the CH2 O memory model. We support integer, pointer, function pointer, array, struct, union and void types. More complicated types such as enum types and typedefs are defined by translation [37, 33]. This section furthermore describes an abstract interface, called an implementation environment, that describes properties such as size and endianness of integers, and the layout of structs and unions. The entire CH2 O memory model and semantics will be parametrized by an implementation environment. 4.1 Integer representations This section describes the part of implementation environments corresponding to integer types and the encoding of integer values as bits. Integer types consist of a rank (char, short, int . . . ) and a signedness (signed or unsigned). The set of available ranks as well as many of their properties are implementation defined. We therefore abstract over the ranks in the definition of integer types. 14 Robbert Krebbers Definition 4.1 Integer signedness and integer types over ranks k ∈ K are inductively defined as: si ∈ signedness ::= signed | unsigned τi ∈ inttype ::= si k The projections are called rank : inttype → K and sign : inttype → signedness. Definition 4.2 An integer coding environment with ranks K consists of a total order (K, ⊆) of integer ranks having at least the following ranks: char ⊂ short ⊂ int ⊂ long ⊂ long long and ptr rank. It moreover has the following functions: char bits : N≥8 char signedness : signedness endianize : K → list bool → list bool deendianize : K → list bool → list bool rank size : K → N>0 Here, endianize k and deendianize k should be inverses, endianize k should be a permutation, rank size should be (non-strictly) monotone, and rank size char = 1. Definition 4.3 The judgment x : τi describes that x ∈ Z has integer type τi . −2char bits∗rank size k−1 ≤ x < 2char x : signed k bits∗rank size k−1 0 ≤ x < 2char bits∗rank x : unsigned k size k The rank char is the rank of the smallest integer type, whose unsigned variant corresponds to bytes that constitute object representations (see Section 3.1). Its bit size is char bits (called CHAR_BIT in the standard library header files [27, 5.2.4.2.1]), and its signedness char signedness is implementation defined [27, 6.2.5p15]. The rank ptr rank is the rank of the integer types size_t and ptrdiff_t, which are defined in the standard library header files [27, 7.19p2]. The type ptrdiff_t is a signed integer type used to represent the result of subtracting two pointers, and the type size_t is an unsigned integer type used to represent sizes of types. An integer coding environment can have an arbitrary number of integer ranks apart from the standard ones char, short, int, long, long long, and ptr rank. This way, additional integer types like those describe in [27, 7.20] can easily be included. The function rank size gives the byte size of an integer of a given rank. Since we require rank size to be monotone rather than strictly monotone, integer types with different ranks can have the same size [27, 6.3.1.1p1]. For example, on many implementations int and long have the same size, but are in fact different. The C11 standard allows implementations to use either sign-magnitude, 1’s complement or 2’s complement signed integers representations. It moreover allows integer representations to contain padding or parity bits [27, 6.2.6.2]. However, since all current machine architectures use 2’s complement representations, this is more of a historic artifact. Current machine architectures use 2’s complement representations because these do not suffer from positive and negative zeros and thus enjoy unique representations of the same integer. Hence, CH2 O restricts itself to implementations that use 2’s complement signed integers representations. A Formal C Memory Model for Separation Logic 15 Integer representations in CH2 O can solely differ with respect to endianness (the order of the bits). The function endianize takes a list of bits in little endian order and permutes them accordingly. We allow endianize to yield an arbitrary permutation and thus we not just support big- and little-endian, but also mixed-endian variants. Definition 4.4 Given an integer type τi , the integer encoding functions list bool and ( )τi : list bool → Z are defined as follows: : τi : Z → x : si k := endianize k (x as little endian 2’s complement) ~ si k := of little endian 2’s complement (deendianize k β) ~ (β) Lemma 4.5 The integer encoding functions are inverses. That means: 1. We have (x : τi )τi = x and |x : τi | = rank size τi provided that x : τi . ~ = rank size τi . ~ and (β) ~ τ : τi provided that |β| ~ τ : τi = β 2. We have (β) i i 4.2 Definition of types We support integer, pointer, function pointer, array, struct, union and void types. The translation that we have described in [37, 33] translates more complicated types, such as typedefs and enums, into these simplified types. This translation also alleviates other simplifications of our simplified definition of types, such as the use of unnamed struct and union fields. Floating point types and type qualifiers like const and volatile are not supported. All definitions in this section are implicitly parametrized by an integer coding environment with ranks K (Definition 4.2). Definition 4.6 Tags t ∈ tag (sometimes called struct/union names) and function names f ∈ funname are represented as strings. Definition 4.7 Types consist of point-to types, base types and full types. These are inductively defined as: τp , σp ∈ ptrtype ::= τ | any | ~τ → τ τb , σb ∈ basetype ::= τi | τp ∗ | void τ, σ ∈ type ::= τb | τ [n] | struct t | union t The three mutual inductive parts of types correspond to the different components of the memory model. Addresses and pointers have point-to types (Definitions 6.8 and 6.10), base values have base types (Definition 6.40), and memory trees and values have full types (Definitions 6.25 and 6.46). The void type of C is used for two entirely unrelated purposes: void is used for functions without return type and void* is used for pointers to objects of unspecified type. In CH2 O this distinction is explicit in the syntax of types. The type void is used for function without return value. Like the mathematical unit type it has one value called nothing (Definition 6.39). The type any∗ is used for pointers to objects of unspecified type. Unlike more modern programming languages C does not provide first class functions. Instead, C provides function pointers which are just addresses of executable 16 Robbert Krebbers code in memory instead of closures. Function pointers can be used in a way similar to ordinary pointers: they can be used as arguments and return value of functions, they can be part of structs, unions and arrays, etc. The C language sometimes allows function types to be used as shorthands for function pointers, for example: void sort(int *p, int len, int compare(int,int)); The third argument of sort is a shorthand for int (*compare)(int,int) and is thus in fact a function pointer instead of a function. We only have function pointer types, and the third argument of the type of the function sort thus contains an additional ∗: [ (signed int)∗, signed int, (signed int → signed int)∗ ] → void. Struct and union types consist of just a name, and do not contain the types of their fields. An environment is used to assign fields to structs and unions, and to assign argument and return types to function names. Definition 4.8 Type environments are defined as: Γ ∈ env := (tag →fin list type) × (funname →fin (list type × type)). (types of struct/union fields) (types of functions) The functions domtag : env → Pfin (tag) and domfunname : env → Pfin (funname) yield the declared structs and unions, respectively the declared functions. We implicitly treat environments as functions tag →fin list type and funname →fin (list type × type) that correspond to underlying finite partial functions. Struct and union names on the one hand, and function names on the other, have their own name space in accordance with the C11 standard [27, 6.2.3p1]. Notation 4.9 We often write an environment as a mixed sequence of struct and union declarations t : ~τ , and function declarations f : (~τ , τ ). This is possible because environments are finite. Since we represent the fields of structs and unions as lists, fields are nameless. For example, the C type struct S1 { int x; struct S1 *p; } is translated into the environment S1 : [ signed int, struct S1∗ ]. Although structs and unions are semantically very different (products versus sums, respectively), environments do not keep track of whether a tag has been used for a struct or a union type. Structs and union types with the same tag are thus allowed. The translator in [37, 33] forbids the same name being used to declare both a struct and union type. Although our mutual inductive syntax of types already forbids many incorrect types such as functions returning functions (instead of function pointers), still some ill-formed types such as int[0] are syntactically valid. Also, we have to ensure that cyclic structs and unions are only allowed when the recursive definition is guarded through pointers. Guardedness by pointers ensures that the sizes of types are finite and statically known. Consider the following types: A Formal C Memory Model for Separation Logic 17 struct list1 { int hd; struct list1 tl; }; struct list2 { int hd; struct list2 *p_tl; }; /* illegal */ /* legal */ The type declaration struct list1 is illegal because it has a reference to itself. In the type declaration struct list2 the self reference is guarded through a pointer type, and therefore legal. Of course, this generalizes to mutual recursive types like: struct tree { int hd; struct forest *p_children; }; struct forest { struct tree *p_hd; struct forest *p_tl; }; Definition 4.10 The following judgments are defined by mutual induction: – The judgment Γ ⊢∗ τp describes point-to types τp to which a pointer may point: Γ ⊢∗ ~τ Γ ⊢∗ any Γ ⊢∗ τ Γ ⊢b τb Γ⊢τ Γ ⊢∗ τb Γ ⊢∗ ~τ → τ Γ ⊢∗ struct t n,0 Γ ⊢∗ τ [n] Γ ⊢∗ union t – The judgment Γ ⊢b τb describes valid base types τb : Γ ⊢∗ τp Γ ⊢b τi Γ ⊢b τp ∗ Γ ⊢b void – The judgment Γ ⊢ τ describes valid types τ : Γ ⊢b τb Γ ⊢ τb Γ⊢τ n,0 Γ ⊢ τ [n] t ∈ domtag Γ t ∈ domtag Γ Γ ⊢ struct t Γ ⊢ union t Definition 4.11 The judgment ⊢ Γ describes well-formed environments Γ. It is inductively defined as: ⊢ Γ Γ ⊢ ~τ ~τ , ε t < domtag Γ ⊢∅ ⊢ Γ Γ ⊢∗ ~τ Γ ⊢∗ τ ⊢ t : ~τ , Γ f < domfunname Γ ⊢ f : (~τ , τ ), Γ Note that Γ ⊢ τ does not imply ⊢ Γ. Most results therefore have ⊢ Γ as a premise. These premises are left implicit in this paper. In order to support (mutually) recursive struct and union types, pointers to incomplete struct and union types are permitted in the judgment Γ ⊢∗ τp that describes types to which pointers are allowed, but forbidden in the judgment Γ ⊢ τ of validity of types. Let us consider the following type declarations: struct S2 { struct S2 x; }; struct S3 { struct S3 *p; }; /* illegal */ /* legal */ Well-formedness ⊢ Γ of the environment Γ := S3 : [ struct S3∗ ] can be derived using the judgments ∅ ⊢∗ struct S3, ∅ ⊢b struct S3∗, ∅ ⊢ struct S3∗, and thus ⊢ Γ. The environment S2 : [ struct S2 ] is ill-formed because we do not have ∅ ⊢ struct S2. The typing rule for function pointers types is slightly more delicate. This is best illustrated by an example: union U { int i; union U (*f) (union U); }; 18 Robbert Krebbers This example displays a recursive self reference to a union type through a function type, which is legal in C because function types are in fact pointer types. Due to this reason, the premises of Γ ⊢∗ ~τ → τ are Γ ⊢∗ ~τ and Γ ⊢∗ τ instead of Γ ⊢ ~τ and Γ ⊢ τ . Well-formedness of the above union type can be derived as follows: ⊢Γ ∅ ⊢∗ union U ∅ ⊢∗ union U ∅ ⊢∗ union U → union U ∅ ⊢b (union U → union U)∗ ∅ ⊢b signed int ∅ ⊢ signed int ∅ ⊢ (union U → union U)∗ ⊢ U : [ signed int, (union U → union U)∗ ], Γ In order to define operations by recursion over the structure of well-formed types (see for example Definition 6.45, which turns a sequence of bits into a value), we often need to perform recursive calls on the types of fields of structs and unions. In Coq we have defined a custom recursor and induction principle using well-founded recursion. In this paper, we will use these implicitly. Affeldt et al. [1, 2] have formalized non-cyclicity of types using a complex constraint on paths through types. Our definition of validity of environments (Definition 4.11) follows the structure of type environments, and is more easy to use (for example to implement the aforementioned recursor and induction principle). There is a close correspondence between array and pointer types in C. Arrays are not first class types, and except for special cases such as initialization, manipulation of arrays is achieved via pointers. We consider arrays as first class types so as to avoid having to make exceptions for the case of arrays all the time. Due to this reason, more types are valid in CH2 O than in C11. The translator in [37, 33] resolves exceptional cases for arrays. For example, a function parameter of array type acts like a parameter of pointer type in C11 [27, 6.7.6.3]3 . void f(int a[10]); The corresponding type of the function f is thus (signed int)∗ → void. Note that the type (signed int)[10] → void is also valid, but entirely different, and never generated by the translator in [37, 33]. 4.3 Implementation environments We finish this section by extending integer coding environments to describe implementation defined properties related the layout of struct and union types. The author’s PhD thesis [33] also considers the implementation-defined behavior of integer operations (such as addition and division) and defines inhabitants of this interface corresponding to actual computing architectures. Definition 4.12 A implementation environment with ranks K consists of an integer coding environment with ranks K and functions: sizeof Γ : type → N alignof Γ : type → N fieldsizesΓ : list type → list N 3 The array size is ignored unless the static keyword is used. In case f would have the prototype void f(int a[static 10]), the pointer a should provide access to an array of at least 10 elements [27, 6.7.6.3]. The static keyword is not supported by CH2 O. A Formal C Memory Model for Separation Logic 19 These functions should satisfy: sizeof Γ (τp ∗) , 0 sizeof Γ (si k) = rank size k sizeof Γ void , 0 sizeof Γ (τ [n]) = n ∗ sizeof Γ τ sizeof Γ (struct t) = Σ fieldsizesΓ ~τ if Γ t = ~τ sizeof Γ τi ≤ zi and |~τ | = |~z| if fieldsizesΓ ~τ = ~z, for each i < |~τ | sizeof Γ τi ≤ sizeof Γ (union t) if Γ t = ~τ , for each i < |~τ | alignof Γ τ | alignof Γ (τ [n]) alignof Γ τi | alignof Γ (struct t) if Γ t = ~τ , for each i < |~τ | alignof Γ τi | alignof Γ (union t) if Γ t = ~τ , for each i < |~τ | alignof Γ τ | sizeof Γ τ if Γ ⊢ τ alignof Γ τi | offsetof Γ ~τ i if Γ ⊢ ~τ , for each i < |~τ | Here, we let offsetof Γ ~τ i denote Σj<i (fieldsizesΓ ~τ )j . The functions sizeof Γ , alignof Γ , and fieldsizesΓ should be closed under weakening of Γ. Notation 4.13 Given an implementation environment, we let: bitsizeof Γ τ := sizeof Γ τ · char bits bitoffsetof Γ τ j := offsetof Γ τ j · char bits fieldbitsizesΓ τ := fieldsizesΓ τ · char bits We let sizeof Γ τ specify the number of bytes out of which the object representation of an object of type τ constitutes. Objects of type τ should be allocated at addresses that are a multiple of alignof Γ τ . We will prove that our abstract notion of addresses satisfies this property (see Lemma 6.18). The functions sizeof Γ , alignof Γ correspond to the sizeof and _Alignof operators [27, 6.5.3.4], and offsetof Γ corresponds to the offsetof macro [27, 7.19p3]. The list fieldsizesΓ ~τ specifies the layout of a struct type with fields ~τ as follows: sizeof Γ τ0 sizeof Γ τ1 τ0 τ1 (fieldsizesΓ ~τ )0 (fieldsizesΓ ~τ )1 offsetof Γ ~τ 0 offsetof Γ ~τ 1 offsetof Γ ~τ 2 5 Permissions and separation algebras Permissions control whether memory operations such as a read or store are allowed or not. In order to obtain the highest level of precision, we tag each individual bit in memory with a corresponding permission. In the operational semantics, permissions have two main purposes: – Permissions are used to formalize the sequence point restriction which assigns undefined behavior to programs in which an object in memory is modified more than once in between two sequence points. 20 Robbert Krebbers – Permissions are used to distinguish objects in memory that are writable from those that are read-only (const qualified in C terminology). In the axiomatic semantics based on separation logic, permissions play an important role for share accounting. We use share accounting for subdivision of permissions among multiple subexpressions to ensure that: – Writable objects are unique to each subexpression. – Read-only objects may be shared between subexpressions. This distinction is originally due to Dijkstra [16] and is essential in separation logic with permissions [11]. The novelty of our work is to use separation logic with permissions for non-determinism in expressions in C. Share accounting gives rise to a natural treatment of C’s sequence point restriction. Separation algebras as introduced by Calcagno et al. [13] abstractly capture common structure of subdivision of permissions. We present a generalization of separation algebras that is well-suited for C verification in Coq and use this generalization to build the permission system and memory model compositionally. The permission system will be constructed as a telescope of separation algebras: perm := L(C(Q)) | {z } non-const qualified + Q |{z} const qualified Here, Q is the separation algebra of fractional permissions, C is a functor that extends a separation algebra with a counting component, and L is a functor that extends a separation algebra with a lockable component (used for the sequence point restriction). This section explains these functors and their purposes. 5.1 Separation logic and share accounting Before we will go into the details of the CH2 O permission system, we briefly introduce separation logic. Separation logic [47] is an extension of Hoare logic that provides better means to reason about imperative programs that use mutable data structures and pointers. The key feature of separation logic is the separating conjunction P ∗ Q that allows one to subdivide the memory into two disjoint parts: a part described by P and another part described by Q. The separating conjunction is most prominent in the frame rule. {P } s {Q} {P ∗ R} s {Q ∗ R} This rule enables local reasoning. Given a Hoare triple {P } s {Q}, this rule allows one to derive that the triple also holds when the memory is extended with a disjoint part described by R. The frame rule shows its merits when reasoning about functions. There it allows one to consider a function in the context of the memory the function actually uses, instead of having to consider the function in the context of the entire program’s memory. However, already in derivations of small programs the use of the frame rule can be demonstrated4 : 4 Contrary to traditional separation logic, we do not give local variables a special status of being stack allocated. We do so, because in C even local variables are allowed to have pointers to them. A Formal C Memory Model for Separation Logic 21 {x → 7− 0} x:=10 {x → 7− 10} {y → 7− 0} y:=12 {y → 7− 12} {x → 7− 0 ∗ y → 7− 0} x:=10 {x → 7− 10 ∗ y → 7− 0} {x → 7− 10 ∗ y → 7− 0} y:=12 {x → 7− 10 ∗ y → 7− 12} {x → 7− 0 ∗ y → 7− 0} x:=10; y:=12 {x → 7− 10 ∗ y → 7− 12} The singleton assertion a 7− → v denotes that the memory consists of exactly one object with value v at address a. The assignments are not considered in the context of the entire memory, but just in the part of the memory that is used. The key observation that led to our separation logic for C, see also [31, 33], is the correspondence between non-determinism in expressions and a form of concurrency. Inspired by the rule for the parallel composition [46], we have rules for each operator ⊚ that are of the following shape. {P1 } e1 {Q1 } {P2 } e2 {Q2 } {P1 ∗ P2 } e1 ⊚ e2 {Q1 ∗ Q2 } The intuitive idea of this rule is that if the memory can be subdivided into two parts in which the subexpressions e1 and e2 can be executed safely, then the expression e1 ⊚e2 can be executed safely in the whole memory. Non-interference of the side-effects of e1 and e2 is guaranteed by the separating conjunction. It ensures that the parts of the memory described by P1 and P2 do not have overlapping areas that will be written to. We thus effectively rule out expressions with undefined behavior such as (x = 3) + (x = 4) (see Section 3.6 for discussion). Subdividing the memory into multiple parts is not a simple operation. In order to illustrate this, let us consider a shallow embedding of assertions of separation logic P, Q : mem → Prop (think of mem as being the set of finite partial function from some set of object identifiers to some set of objects. The exact definition in the context of CH2 O is given in Definition 6.26). In such a shallow embedding, one would define the separating conjunction as follows: P ∗ Q := λm . ∃m1 m2 . m = m1 ∪ m2 ∧ P m1 ∧ Q m2 . The operation ∪ is not the disjoint union of finite partial functions, but a more fine grained operation. There are two reasons for that. Firstly, subdivision of memories should allow for partial overlap, as long as writable objects are unique to a single part. For example, the expression x + x has defined behavior, but the expressions x + (x = 4) and (x = 3) + (x = 4) have not. We use separation logic with permissions [11] to deal with partial overlap of γ memories. That means, we equip the singleton assertion a 7− → v with a permission γ. The essential property of the singleton assertion is that given a writable permission γw there is a readable permission γr with: γw (a 7−−→ v) ↔ γr γr (a 7−→ v) ∗ (a 7−→ v). The above property is an instance of a slightly more general property. We consider a binary operation ∪ on permissions so we can write: γ1 ∪γ2 (a 7−−−−→ v) ↔ γ1 γ2 (a 7−→ v) ∗ (a 7−→ v). 22 Robbert Krebbers Secondly, it should be possible to subdivide array, struct and union objects into subobjects corresponding to their elements. For example, in the case of an array int a[2], the expression (a[0] = 1) + (a[1] = 4) has defined behavior, and we should be able to prove so. The essential property of the singleton assertion for an array [ y0 , . . . , yn−1 ] value is: γ (a 7− → array [ v0 , . . . , vn−1 ]) ↔ γ γ (a[0] 7− → v0 ) ∗ · · · ∗ (a[n − 1] 7− → vn−1 ). This paper does not describe the CH2 O separation logic and its shallow embedding of assertions. These are described in the author’s PhD thesis [33]. Instead, we consider just the operations ∪ on permissions and memories. 5.2 Separation algebras As shown in the previous section, the key operation needed to define a shallow embedding of separation logic with permissions is a binary operation ∪ on memories and permissions. Calcagno et al. introduced the notion of a separation algebra [13] so as to capture common properties of the ∪ operation. A separation algebra (A, ∅, ∪) is a partial cancellative commutative monoid (see Definition 5.1 for our actual definition). Some prototypical instances of separation algebras are: – Finite partial functions (A →fin B, ∅, ∪), where ∅ is the empty finite partial function, and ∪ the disjoint union on finite partial functions. – The Booleans (bool, false, ∨). – Boyland’s fractional permissions ([0, 1]Q , 0, +) where 0 denotes no access, 1 denotes writable access, and 0 < < 1 denotes read-only access [11, 12]. Separation algebras are also closed under various constructs (such as products and finite functions), and complex instances can thus be built compositionally. When formalizing separation algebras in the Coq proof assistant, we quickly ran into some problems: – Dealing with partial operations such as ∪ is cumbersome, see Section 8.3. – Dealing with subset types (modeled as Σ-types) is inconvenient. – Operations such as the difference operation \ cannot be defined constructively from the laws of a separation algebra. In order to deal with the issue of partiality, we turn ∪ into a total operation. Only in case x and y are disjoint, notation x ⊥ y, we require x ∪ y to satisfy the laws of a separation algebra. Instead of using subsets, we equip separation algebras with a predicate valid : A → Prop that explicitly describes a subset of the carrier A. Lastly, we explicitly add a difference operation \. Definition 5.1 A separation algebra consists of a type A, with: – – – – An element ∅ : A A predicate valid : A → Prop Binary relations ⊥, ⊆ : A → A → Prop Binary operations ∪, \ : A → A → A Satisfying the following laws: A Formal C Memory Model for Separation Logic 1. 2. 3. 4. 5. 6. 7. 8. If If If If If If If If 23 valid x, then ∅ ⊥ x and ∅ ∪ x = x x ⊥ y, then y ⊥ x and x ∪ y = y ∪ x x ⊥ y and x ∪ y ⊥ z, then y ⊥ z, x ⊥ y ∪ z, and x ∪ (y ∪ z) = (x ∪ y) ∪ z z ⊥ x, z ⊥ y and z ∪ x = z ∪ y, then x = y x ⊥ y, then valid x and valid (x ∪ y) x ⊥ y and x ∪ y = ∅, then x = ∅ x ⊥ y, then x ⊆ x ∪ y x ⊆ y, then x ⊥ y \ x and x ∪ y \ x = y Laws 1–4 describe the traditional laws of a separation algebra: identity, commutativity, associativity and cancellativity. Law 5 ensures that valid is closed under the ∪ operation. Law 6 describes positivity. Laws 7 and 8 fully axiomatize the ⊆ relation and \ operation. Using the positivity and cancellation law, we obtain that ⊆ is a partial order in which ∪ is order preserving and respecting. In case of permissions, the ∅ element is used to split objects of compound types (arrays and structs) into multiple parts. We thus use separation algebras instead of permission algebras [47], which are a variant of separation algebras without an ∅ element. Definition 5.2 The Boolean separation algebra bool is defined as: valid x := True ∅ := false x ⊥ y := ¬x ∨ ¬y x ∪ y := x ∨ y x ⊆ y := x → y x \ y := x ∧ ¬y In the case of fractional permissions [0, 1]Q the problem of partiality and subset types already clearly appears. The ∪ operation (here +) can ‘overflow’. We remedy this problem by having all operations operate on pre-terms (here Q) and the predicate valid describes validity of pre-terms (here 0 ≤ ≤ 1). Definition 5.3 The fractional separation algebra Q is defined as: valid x := 0 ≤ x ≤ 1 ∅ := 0 x ⊥ y := 0 ≤ x, y ∧ x + y ≤ 1 x ∪ y := x + y x ⊆ y := 0 ≤ x ≤ y ≤ 1 x \ y := x − y The version of separation algebras by Klein et al. [29] in Isabelle also models ∪ as a total operation and uses a relation ⊥. There are some differences: – We include a predicate valid to prevent having to deal with subset types. – They have weaker premises for associativity (law 3), namely x ⊥ y, y ⊥ z and x ⊥ z instead of x ⊥ y and x ∪ y ⊥ z. Ours are more natural, e.g. for fractional permissions one has 0.5 ⊥ 0.5 but not 0.5 + 0.5 ⊥ 0.5, and it thus makes no sense to require 0.5 ∪ (0.5 ∪ 0.5) = (0.5 ∪ 0.5) ∪ 0.5 to hold. – Since Coq (without axioms) does not have a choice operator, the \ operation cannot be defined in terms of ∪. Isabelle has a choice operator. Dockins et al. [17] have formalized a hierarchy of different separation algebras in Coq. They have dealt with the issue of partiality by treating ∪ as a relation instead of a function. This is unnatural, because equational reasoning becomes impossible and one has to name all auxiliary results. Bengtson et al. [6] have formalized separation algebras in Coq to reason about object-oriented programs. They have treated ∪ as a partial function, and have not defined any complex permission systems. 24 Robbert Krebbers 5.3 Permissions We classify permissions using permission kinds. Definition 5.4 The lattice of permission kinds (pkind, ⊆) is defined as: Writable Readable Locked Existing ⊥ The order k1 ⊆ k2 expresses that k1 allows fewer operations than k2 . This organization of permissions is inspired by Leroy et al. [40]. The intuitive meaning of the permission kinds is as follows: – Writable. Writable permissions allow reading and writing. – Readable. Read-only permissions allow solely reading. – Existing. Existence permissions [11] are used for objects that are known to exist but whose value cannot be used. Existence permissions are essential because C only permits pointer arithmetic on pointers that refer to objects that have not been deallocated (see Section 3.4 for discussion). – Locked. Locked permissions are used to formalize the sequence point restriction. When an object is modified during the execution of an expression, it is temporarily given a locked permission to forbid any read/write accesses until the next sequence point. For example, in (x = 3) + *p; the assignment x = 3 locks the permissions of the object x. Since future read/write accesses to x are forbidden, accessing *p results in undefined in case p points to x. At the sequence point ;, the original permission of x is restored. Locked permissions are different from existence permissions because the operational semantics can change writable permissions into locked permissions and vice versa, but cannot do that with existing permissions. – ⊥. Empty permissions allow no operations. In our separation logic we do not only have control which operations are allowed, but also have to deal with share accounting. – We need to subdivide objects with writable or read-only permission into multiple parts with read-only permission. For example, in the expression x + x, both subexpressions require x to have at least read-only permission. – We need to subdivide objects with writable permission into a part with existence permission and a part with writable permission. For example, in the expression *(p + 1) = (*p = 1), the subexpression *p = 1 requires *p to have writable permission, and the subexpression *(p + 1) requires *p to have at least existence permission so as to perform pointer arithmetic on p. When reassembling subdivided permissions (using ∪), we need to know when the original permission is reobtained. Therefore, the underlying permission system needs to have more structure, and cannot consist of just the permission kinds. A Formal C Memory Model for Separation Logic (0, 1) 25 Locked Writable ♦(0, 1) 1 Readable Readable Existing ♦(0, 0) ⊥ 0 Figure 1 The CH2 O permission system. Definition 5.5 CH2 O permissions perm are defined as: Lockable SA γ ∈ perm Counting SA := L(C(Q)) | {z } non-const qualified where L(A) := {, ♦} × A and C(A) := Q × A. Fractional SA + Q |{z} const qualified The author’s PhD thesis [33] gives the exact definition of the separation algebra operations on permissions by defining these one by one for the counting separation algebra C, the lockable separation algebra L, and the separation algebra on sums +. This section gives a summary of the important aspects of the permission system. We combine fractional permissions to account for read-only/writable permissions with counting permissions to account for the number of existence permissions that have been handed out. Counting permissions have originally been introduced by Bornat et al. [11]. The annotations {, ♦} describe whether a permission is locked  or not ♦. Only writable permission have a locked variant. Const permissions are used for objects declared with the const qualifier. Modifying an object with const permissions results in undefined behavior. Const permissions do not have a locked variant or a counting component as they do not allow writing. Figure 1 indicates the valid predicate by the areas marked green and displays how the elements of the permission system project onto their kinds. The operation ∪ is defined roughly as the point-wise addition and \ as point-wise subtraction. We will define an operation 12 : perm → perm to subdivide a writable or read-only permission into read-only permissions.   ♦(0.5 · x, 0.5 · y) if γ = ♦(x, y) 1 γ := 0.5 · x if γ = x ∈ Q 2  γ otherwise, dummy value Given a writable or read-only permission γ, the subdivided read-only permission enjoys 12 γ ⊥ 21 γ and 12 γ ∪ 21 γ = γ. The existence permission token := ♦(−1, 0) is used in combination with the \ operation to subdivide a writable permission γ into a writable permission γ \ token and an existence permission token. We have γ ∪ (γ \ token) = γ by law 8 1 2γ 26 Robbert Krebbers of separation algebras. Importantly, only objects with ♦(0, 1) permission can be deallocated, whereas objects with γ \ token permission cannot (see Definition 6.58) because expressions such as (p == p) + (free(p),0) have undefined behavior. 5.4 Extended separation algebras We extend separation algebras with a split operation permissions in our memory model. 1 2 and predicates to distinguish Definition 5.6 An extended separation algebra extends a separation algebra with: – Predicates splittable, unmapped, exclusive : A → Prop – A unary operation 12 : A → A Satisfying the following laws: 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. If x ⊥ x, then splittable (x ∪ x) If splittable x, then 12 x ⊥ 21 x and 12 x ∪ 12 x = x If splittable y and x ⊆ y, then splittable x If x ⊥ y and splittable (x ∪ y), then 12 (x ∪ y) = 21 x ∪ 12 y unmapped ∅, and if unmapped x, then valid x If unmapped y and x ⊆ y, then unmapped x If x ⊥ y, unmapped x and unmapped y, then unmapped (x ∪ y) exclusive x iff valid x and for all y with x ⊥ y we have unmapped y Not both exclusive x and unmapped x There exists an x with valid x and not unmapped x The 21 -operation is partial, but described by a total function whose result 21 x is only meaningful if splittable x holds. Law 11 ensures that splittable permissions are infinitely splittable, and law 12 ensures that 12 distributes over ∪. The predicates unmapped and exclusive associate an intended semantics to elements of a separation algebra. Let us consider fractional permissions to indicate the intended meaning of these predicates. Definition 5.7 The fractional separation algebra Q is extended with: splittable x := 0 ≤ x ≤ 1 unmapped x := x = 0 1 x := 0.5 · x 2 exclusive x := x = 1 Remember that permissions will be used to annotate each individual bit in memory. Unmapped permissions are on the bottom: they do not allow their bit to be used in any way. Exclusive permissions are on the top: they are the sole owner of a bit and can do anything to that bit without affecting disjoint bits. Fractional permissions have exactly one unmapped element and exactly one exclusive element, but in the CH2 O permission system this is not the case. The elements of the CH2 O permission system are classified as follows: unmapped X exclusive X Examples Writable and Locked permissions Readable permissions The ∅ permission and Existing permissions A Formal C Memory Model for Separation Logic 27 In order to abstractly describe bits annotated with permissions we define the E (perm) in the memory model tagged separation algebra TTt (A). In its concrete use Tbit (Definition 6.21), the elements (γ, b) consist of a permission γ ∈ perm and bit b ∈ bit. We use the symbolic bit E that represents indeterminate storage to ensure that bits with unmapped permissions indeed have no usable value. Definition 5.8 Given a separation algebra A and a set of tags T with default tag t ∈ T , the tagged separation algebra TTt (A) := A × T over A is defined as: valid (x, y) := valid x ∧ (unmapped x → y = t) ∅ := (∅, t) ′ ′ (x, y) ⊥ (x , y ) := x ⊥ x′ ∧ (unmapped x ∨ y = y ′ ∨ unmapped x′ ) ∧ (unmapped x → y = t) ∧ (unmapped x′ → y ′ = t) (x, y) ∪ (x′ , y ′ ) := ( (x ∪ x′ , y ′ ) if y = t (x ∪ x′ , y) otherwise splittable (x, y) := splittable x ∧ (unmapped x → y = t) 1 1 (x, y) := ( x, y) 2 2 unmapped (x, y) := unmapped x ∧ y = t exclusive (x, y) := exclusive x The definitions of the omitted relations and operations are as expected. 6 The memory model This section defines the CH2 O memory model whose external interface consists of operations with the following types: lookupΓ : addr → mem → option val forceΓ : addr → mem → mem insertΓ : addr → mem → val → mem writableΓ : addr → mem → Prop lockΓ : addr → mem → mem unlock : lockset → mem → mem allocΓ : index → val → bool → mem → mem dom : mem → Pfin (index) freeable : addr → mem → Prop free : index → mem → mem Notation 6.1 We let mhaiΓ := lookupΓ a m and mha := viΓ := insertΓ a v m. Many of these operations depend on the typing environment Γ which assigns fields to structs and unions (Definition 4.8). This dependency is required because these operations need to be aware of the layout of structs and unions. 28 Robbert Krebbers The operation mhaiΓ yields the value stored at address a in memory m. It fails with ⊥ if the permissions are insufficient, effective types are violated, or a is an end-ofarray address. Reading from (the abstract) memory is not a pure operation. Although it does not affect the memory contents, it may affect the effective types [27, 6.5p6-7]. This happens for example in case type-punning is performed (see Section 3.3). This impurity is factored out by the operation forceΓ a m. The operation mha := viΓ stores the value v at address a in memory m. A store is only permitted in case permissions are sufficient, effective types are not violated, and a is not an end-of-array address. The proposition writableΓ a m describes the side-conditions necessary to perform a store. After a successful store, the operation lockΓ a m is used to lock the object at address a in memory m. The lock operation temporarily reduces the permissions to Locked so as to prohibit future accesses to a. Locking yields a formal treatment of the sequence point restriction (which states that modifying an object more than once between two sequence points results in undefined behavior, see Section 3.6). The operational semantics accumulates a set Ω ∈ lockset of addresses that have been written to (Definition 6.54) and uses the operation unlock Ω m at the subsequent sequence point (which may be at the semicolon that terminates a full expression). The operation unlock Ω m restores the permissions of the addresses in Ω and thereby makes future accesses to the addresses in Ω possible again. The author’s PhD thesis [33] describes in detail how sequence points and locks are treated in the operational semantics. The operation allocΓ o v µ m allocates a new object with value v in memory m. The object has object identifier o < dom m which is non-deterministically chosen by the operation semantics. The Boolean µ expresses whether the new object is allocated by malloc. Accompanying allocΓ , the operation free o m deallocates a previously allocated object with object identifier o in memory m. In order to deallocate dynamically obtained memory via free, the side-condition freeable a m describes that the permissions are sufficient for deallocation, and that a points to a malloced object. 6.1 Representation of pointers Adapted from CompCert [41, 40], we represent memory states as finite partial functions from object identifiers to objects. Each local, global and static variable, as well as each invocation of malloc, is associated with a unique object identifier of a separate object in memory. This approach separates unrelated objects by construction, and is therefore well-suited for reasoning about memory transformations. We improve on CompCert by modeling objects as structured trees instead of arrays of bytes to keep track of padding bytes and the variants of unions. This is needed to faithfully describe C11’s notion of effective types (see page 4 of Section 1 for an informal description). This approach allows us to describe various undefined behaviors of C11 that have not been considered by others (see Sections 3.1 and 3.3). In the CompCert memory model, pointers are represented as pairs (o, i) where o is an object identifier and i is a byte offset into the object with object identifier o. Since we represent objects as trees instead of as arrays of bytes, we represent pointers as paths through these trees rather than as byte offsets. A Formal C Memory Model for Separation Logic 29 Definition 6.2 Object identifiers o ∈ index are elements of a fixed countable set. In the Coq development we use binary natural numbers, but since we do not rely on any properties apart from countability, we keep the representation opaque. We first introduce a typing environment to relate the shape of paths representing pointers to the types of objects in memory. Definition 6.3 Memory typing environments ∆ ∈ memenv are finite partial functions index →fin (type × bool). Given a memory environment ∆: 1. An object identifier o has type τ , notation ∆ ⊢ o : τ , if ∆ o = (τ, β) for a β. 2. An object identifier o is alive, notation ∆ ⊢ o alive, if ∆ o = (τ, false) for a τ . Memory typing environments evolve during program execution. The code below is annotated with the corresponding memory environments in red. short x; ∆1 = {o1 7→ (signed short, false)} int *p; ∆2 = {o1 7→ (signed short, false), o2 → 7 (signed int∗, false)} p = malloc(sizeof(int)); ∆3 = {o1 7→ (signed short, false), o2 → 7 (signed int∗, false), o3 → 7 (signed int, false)} free(p); ∆4 = {o1 7→ (signed short, false), o2 → 7 (signed int∗, false), o3 → 7 (signed int, true)} Here, o1 is the object identifier of the variable x, o2 is the object identifier of the variable p and o3 is the object identifier of the storage obtained via malloc. Memory typing environments also keep track of objects that have been deallocated. Although one cannot directly create a pointer to a deallocated object, existing pointers to such objects remain in memory after deallocation (see the pointer p in the above example). These pointers, also called dangling pointers, cannot actually be used. Definition 6.4 References, addresses and pointers are inductively defined as: τ [n] struct t union t r ∈ refseg ::= ֒−−→ i | ֒−−−→ i | ֒−−−→q i with q ∈ {◦, •} ~r ∈ ref := list refseg a ∈ addr ::= (o : τ, ~r, i)σ>∗ σp p ∈ ptr ::= NULL σp | a | f τ~ 7→τ References are paths from the top of an object in memory to some subtree of that object. The shape of references matches the structure of types: τ [n] – The reference ֒−−→ i is used to select the ith element of a τ -array of length n. struct t – The reference ֒−−−→ i is used to select the ith field of a struct t. union t – The reference ֒−−−→q i is used to select the ith variant of a union t. References can describe most pointers in C but cannot account for end-of-array pointers and pointers to individual bytes. We have therefore defined the richer notion of addresses. An address (o : τ, ~r, i)σ>∗ σp consists of: 30 Robbert Krebbers – An object identifier o with type τ . – A reference ~r to a subobject of type σ in the entire object of type τ . – An offset i to a particular byte in the subobject of type σ (note that one cannot address individual bits in C). – The type σp to which the address is cast. We use a points-to type in order to account for casts to the anonymous void* pointer, which is represented as the points-to type any. This information is needed to define, for example, pointer arithmetic, which is sensitive to the type of the address. In turn, pointers extend addresses with a NULL pointer NULL σp for each type σp , and function pointers f τ~ 7→τ which contain the name and type of a function. Let us consider the following global variable declaration: struct S { union U { signed char x[2]; int y; } u; void *p; } s; The formal representation of the pointer (void*)(s.u.x + 2) is: struct S union U signed char[2] (os : struct S, ֒−−−→ 0 ֒−−−→• 0 ֒−−−−−−−→ 0, 2)signed char>∗ any . Here, os is the object identifier associated with the variable s of type struct S. struct S union U signed char[2] The reference ֒−−−→ 0 ֒−−−→• 0 ֒−−−−−−−→ 0 and byte-offset 2 describe that the pointer refers to the third byte of the array s.u.x. The pointer refers to an object of type signed char. The annotation any describes that the pointer has been cast to type void*. union s The annotations q ∈ {◦, •} on references ֒−−−→q i describe whether type-punning is allowed or not. The annotation • means that type-punning is allowed, i.e. accessing another variant than the current one has defined behavior. The annotation ◦ means that type-punning is forbidden. A pointer whose annotations are all of the shape ◦, and thereby does not allow type-punning at all, is called frozen. Definition 6.5 The freeze function | |◦ : refseg → refseg is defined as: τ [n] τ [n] | ֒−−→ i |◦ := ֒−−→ i struct t struct t | ֒−−−→ i |◦ := ֒−−−→ i union t union t | ֒−−−→q i |◦ := ֒−−−→◦ i A reference segment r is frozen, notation frozen r, if | r |◦ = r. Both | |◦ and frozen are lifted to references, addresses, and pointers in the expected way. Pointers stored in memory are always in frozen shape. Definitions 6.32 and 6.41 describe the formal treatment of effective types and frozen pointers, but for now we reconsider the example from Section 3.3: union U { int x; short y; } u = { .x = 3 }; short *p = &u.y; printf("%d\n", *p); // Undefined printf("%d\n", u.y); // OK A Formal C Memory Model for Separation Logic 31 Assuming the object u has object identifier ou , the pointers &u.x, &u.y and p have the following formal representations: union U &u.x: (ou : union U, ֒−−−→• 0, 0)signed int>∗ signed int &u.y: (ou : union U, ֒−−−→• 1, 0)signed short>∗ signed short p: (ou : union U, ֒−−−→◦ 0, 0)signed short>∗ signed short union U union U These pointers are likely to have the same object representation on actual computing architectures. However, due to effective types, &u.y may be used for typepunning but p may not. It is thus important that we distinguish these pointers in the formal memory model. The additional structure of pointers is also needed to determine whether pointer subtraction has defined behavior. The behavior is only defined if the given pointers both point to an element of the same array object [27, 6.5.6p9]. Consider: struct S { int a[3]; int b[3]; } s; s.a - s.b; // Undefined, different array objects (s.a + 3) - s.b; // Undefined, different array objects (s.a + 3) - s.a; // OK, same array objects Here, the pointers s.a + 3 and s.b have different representations in the CH2 O memory model. The author’s PhD thesis [33] gives the formal definition of pointer subtraction. We will now define typing judgments for references, addresses and pointers. The judgment for references Γ ⊢ ~r : τ ֌ σ states that σ is a subobject type of τ which can be obtained via the reference ~r (see also Definition 7.1). For example, int[2] is struct S a subobject type of struct S { int x[2]; int y[3]; } via ֒−−−→ 0. Definition 6.6 The judgment Γ ⊢ ~r : τ ֌ σ describes that ~r is a valid reference from τ to σ. It is inductively defined as: Γ ⊢ ~r : τ ֌ σ[n] σ[n] Γ⊢ε:τ ֌τ Γ ⊢ ~r : τ ֌ struct t Γ t = ~σ i<n Γ ⊢ ~r ֒−−→ i : τ ֌ σ i < |~σ | Γ ⊢ ~r : τ ֌ union t struct t Γ t = ~σ i < |~σ| union t Γ ⊢ ~r ֒−−−→ i : τ ֌ σi Γ ⊢ ~r ֒−−−→q i : τ ֌ σi The typing judgment for addresses is more involved than the judgment for references. Let us first consider the following example: int a[4]; Assuming the object a has object identifier oa , the end-of-array pointer a+4 could be represented in at least the following ways (assuming sizeof (signed int) = 4): signed int[4] (oa : signed int[4], ֒−−−−−−→ 0, 16)signed int>∗ signed int signed int[4] (oa : signed int[4], ֒−−−−−−→ 3, 4)signed int>∗ signed int 32 Robbert Krebbers In order to ensure canonicity of pointer representations, we let the typing judgment for addresses ensure that the reference ~r of (o : τ, ~r, i)σ>∗ σp always refers to the first element of an array subobject. This renders the second representation illegal. Definition 6.7 The relation τ >∗ σp , type τ is pointer castable to σp , is inductively defined by τ >∗ τ , τ >∗ unsigned char, and τ >∗ any. Definition 6.8 The judgment Γ, ∆ ⊢∗ a : σp describes that the address a refers to type τp . It is inductively defined as: offset ~r = 0 ∆⊢o:τ Γ⊢τ Γ ⊢ ~r : τ ֌ σ i ≤ sizeof Γ σ · size ~r sizeof Γ σp | i Γ, ∆ ⊢ (o : τ, ~r, i)σ>∗ σp : σp σ >∗ σp Here, the helper functions offset, size : ref → N are defined as: offset ~r := ( τ [n] i if ~r = ~r2 ֒−−→ i 0 otherwise size ~r := ( τ [n] n if ~r = ~r2 ֒−−→ i 1 otherwise We use an intrinsic encoding of syntax, which means that terms contain redundant type annotations so we can read off types. Functions to read off types are named typeof and will not be defined explicitly. Type annotations make it more convenient to define operations that depend on types (such as offset and size in Definition 6.8). As usual, typing judgments ensure that type annotations are consistent. The premises i ≤ sizeof Γ σ · size ~r and sizeof Γ σp | i of the typing rule ensure that the byte offset i is aligned and within range. The inequality i ≤ sizeof Γ σ · size ~r is non-strict so as to allow end-of-array pointers. Definition 6.9 An address (o : τ, ~r, i)σ>∗ σp is called strict, notation Γ ⊢ a strict, in case it satisfies i < sizeof Γ σ · size ~r. The judgment τ >∗ σp does not describe the typing restriction of cast expressions. Instead, it defines the invariant that each address (o : τ, ~r, i)σ>∗ σp should satisfy. Since C is not type safe, pointer casting has τ >∗ σp as a run-time side-condition: int x, *p void *q = int *q1 = short *q2 short *q3 = &x; (void*)p; (int*)q; = (short*)p; = (short*)q; // // // // OK, signed int >∗ any OK, signed int >∗ signed int Statically ill-typed Undefined behavior, signed int ≯∗ signed short Definition 6.10 The judgment Γ, ∆ ⊢∗ p : σp describes that the pointer p refers to type τp . It is inductively defined as: Γ ⊢∗ σp Γ, ∆ ⊢∗ NULL σp : σp σ[n] Γ, ∆ ⊢ a : σp Γ, ∆ ⊢∗ a : σp Γ f = (~τ , τ ) Γ, ∆ ⊢∗ f τ~ 7→τ : ~τ → τ Addresses (o : τ, ~r ֒−−→ j, i)σ>∗ σp that point to an element of τ [n] always have their reference point to the first element of the array, i.e. j = 0. For some operations we use the normalized reference which refers to the actual array element. A Formal C Memory Model for Separation Logic 33 Definition 6.11 The functions index : addr → index, ref Γ : addr → ref, and byteΓ : addr → N obtain the index, normalized reference, and normalized byte offset. index (o : τ, ~r, i)σ>∗ σp := o ref Γ (o : τ, ~r, i)σ>∗ σp := setoffset (i ÷ sizeof Γ σ) ~r byteΓ (o : τ, ~r, i)σ>∗ σp := i mod (sizeof Γ σ) Here, the function setoffset : N → ref → ref is defined as: setoffset j ~r := ( τ [n] r~2 ֒−−→ j r τ [n] if ~r = ~r2 ֒−−→ i otherwise Let us display the above definition graphically. Given an address (o : τ, ~r, i)σ>∗ σp , the normalized reference and normalized byte offset are as follows: ref Γ a byteΓ a ~r i For end-of-array addresses the normalized reference is ill-typed because references cannot be end-of-array. For strict addresses the normalized reference is well-typed. Definition 6.12 The judgment ∆ ⊢ p alive describes that the pointer p is alive. It is inductively defined as: ∆ ⊢ (index a) alive ∆ ⊢ NULL σp alive ∆ ⊢ a alive ∆ ⊢ f τ~ 7→τ alive The judgment ∆ ⊢ o alive on object identifiers is defined in Definition 6.3. For many operations we have to distinguish addresses that refer to an entire object and addresses that refer to an individual byte of an object. We call addresses of the later kind byte addresses. For example: int x, *p = &x; // p is not a byte address unsigned char *q = (unsigned char*)&x; // q is a byte address Definition 6.13 An address (o : τ, ~r, i)σ>∗ σp is a byte address if σ , σp . To express that memory operations commute (see for example Lemma 6.36), we need to express that addresses are disjoint, meaning they do not overlap. Addresses do not overlap if they belong to different objects or take a different branch at an array or struct. Let us consider an example: union { struct { int x, y; } s; int z; } u1, u2; 34 Robbert Krebbers The pointers &u1 and &u2 are disjoint because they point to separate memory objects. Writing to one does not affect the value of the other and vice versa. Likewise, &u1.s.x and &u1.s.y are disjoint because they point to different fields of the same struct, and as such do not affect each other. The pointers &u1.s.x and &u1.z are disjoint because they point to overlapping objects and thus do affect each other. Definition 6.14 Disjointness of references ~r1 and ~r2 , notation ~r1 ⊥ ~r2 , is inductively defined as: | ~r1 |◦ = | ~r2 |◦ i,j σ[n] σ[n] ~r1 ֒−−→ i ~r3 ⊥ ~r2 ֒−−→ j ~r4 | ~r1 |◦ = | ~r2 |◦ struct t i,j struct t ~r1 ֒−−−→ i ~r3 ⊥ ~r2 ֒−−−→ j ~r4 Note that we do not require a special case for | ~r1 |◦ , | ~r2 |◦ . Such a case is implicit because disjointness is defined in terms of prefixes. Definition 6.15 Disjointness of addresses a1 and a2 , notation a1 ⊥Γ a2 , is inductively defined as: index a1 = index a2 ref Γ a1 ⊥ ref Γ a2 a1 ⊥Γ a2 index a1 , index a2 a1 ⊥Γ a2 both a1 and a2 are byte addresses index a1 = index a2 | ref Γ a1 |◦ = | ref Γ a2 |◦ byteΓ a1 , byteΓ a2 a1 ⊥Γ a2 The first inference rule accounts for addresses whose object identifiers are different, the second rule accounts for addresses whose references are disjoint, and the third rule accounts for addresses that point to different bytes of the same subobject. Definition 6.16 The reference bit-offset bitoffsetΓ : refseg → N is defined as: τ [n] bitoffsetΓ (֒−−→ i) := i · bitsizeof Γ τ union t bitoffsetΓ (֒−−−→q i) := 0 struct t bitoffsetΓ (֒−−−→ i) := bitoffsetof Γ ~τ i where Γ t = ~τ Moreover, we let bitoffsetΓ a := Σi (bitoffsetΓ (ref Γ a)i ) + byteΓ a · char bits. Disjointness implies non-overlapping bit-offsets, but the reverse implication does not always hold because references to different variants of unions are not disjoint. For example, given the declaration union { struct { int x, y; } s; int z; } u, the pointers corresponding to &u.s.y and &u.z are not disjoint. Lemma 6.17 If Γ, ∆ ⊢ a1 : σ1 , Γ, ∆ ⊢ a2 : σ2 , Γ ⊢ {a1 , a2 } strict, a1 ⊥Γ a2 , and index a1 , index a2 , then either: 1. bitoffsetΓ a1 + bitsizeof Γ σ1 ≤ bitoffsetΓ a2 , or 2. bitoffsetΓ a2 + bitsizeof Γ σ2 ≤ bitoffsetΓ a1 . Lemma 6.18 (Well-typed addresses are properly aligned) If Γ, ∆ ⊢ a : σ, then (alignof Γ σ · char bits) | bitoffsetΓ a. A Formal C Memory Model for Separation Logic 35 6.2 Representation of bits As shown in Section 3.1, each object in C can be interpreted as an unsigned char array called the object representation. On actual computing architectures, the object representation consists of a sequence of concrete bits (zeros and ones). However, so as to accurately describe all undefined behaviors, we need a special treatment for the object representations of pointers and indeterminate memory in the formal memory model. To that end, CH2 O represents the bits belonging to the object representations of pointers and indeterminate memory symbolically. Definition 6.19 Bits are inductively defined as: b ∈ bit ::= E | 0 | 1 | (ptr p)i . Definition 6.20 The judgment Γ, ∆ ⊢ b describes that a bit b is valid. It is inductively defined as: β ∈ {0, 1} Γ, ∆ ⊢ E Γ, ∆ ⊢ β Γ, ∆ ⊢∗ p : σp frozen p i < bitsizeof Γ (σp ∗) Γ, ∆ ⊢ (ptr p)i A bit is either a concrete bit 0 or 1, the ith fragment bit (ptr p)i of a pointer p, or the indeterminate bit E. Integers are represented using concrete sequences of bits, and pointers as sequences of fragment bits. Assuming bitsizeof (signed int∗) = 32, a pointer p : signed int will be represented as the bit sequence (ptr p)0 . . . (ptr p)31 , and assuming bitsizeof (signed int) = 32 on a little-endian architecture, the integer 33 : signed int will be represented as the bit sequence 1000010000000000. The approach using a combination of symbolic and concrete bits is similar to Leroy et al. [40] and has the following advantages: – Symbolic bit representations for pointers avoid the need to clutter the memory model with subtle, implementation defined, and run-time dependent operations to decode and encode pointers as concrete bit sequences. – We can precisely keep track of memory areas that are uninitialized. Since these memory areas consist of arbitrary concrete bit sequences on actual machines, most operations on them have undefined behavior. – While reasoning about program transformations one has to relate the memory states during the execution of the source program to those during the execution of the target program. Program transformations can, among other things, make more memory defined (that is, transform some indeterminate E bits into determinate bits) and relabel the memory. Symbolic bit representations make it easy to deal with such transformations (see Section 7.2). – It vastly decreases the amount of non-determinism, making it possible to evaluate the memory model as part of an executable semantics [37, 33]. – The use of concrete bit representations for integers still gives a semantics to many low-level operations on integer representations. A small difference with Leroy et al. [40] is that the granularity of our memory model is on the level of bits rather than bytes. Currently we do not make explicit use of this granularity, but it allows us to support bit-fields more faithfully with respect to the C11 standard in future work. Objects in our memory model are annotated with permissions. We use permission annotations on the level of individual bits, rather than on the level of bytes or entire objects, to obtain the most precise way of permission handling. 36 Robbert Krebbers Definition 6.21 Permission annotated bits are defined as: E b ∈ pbit := Tbit (perm) = perm × bit. In the above definition, T is the tagged separation algebra that has been defined in Definition 5.8. We have spelled out its definition for brevity’s sake. Definition 6.22 The judgment Γ, ∆ ⊢ b describes that a permission annotated bit b is valid. It is inductively defined as: Γ, ∆ ⊢ b valid γ b = E in case unmapped γ Γ, ∆ ⊢ (γ, b) 6.3 Representation of the memory Memory trees are abstract trees whose structure corresponds to the shape of data types in C. They are used to describe individual objects (base values, arrays, structs, and unions) in memory. The memory is a forest of memory trees. Definition 6.23 Memory trees are inductively defined as: # » b | arrayτ w ~ | structt w~ w ∈ mtree ::= baseτb ~ b | uniont (i, w, ~ b) | uniont ~b. The structure of memory trees is close to the structure of types (Definition 4.7) and thus reflects the expected semantics of types: arrays are lists, structs are tuples, and unions are sums. Let us consider the following example: struct S { union U { signed char x[2]; int y; } u; void *p; } s = { .u = { .x = {33,34} }, .p = s.u.x + 2 }; The memory tree representing the object s with object identifier os may be as follows (permissions are omitted for brevity’s sake, and integer encoding and padding are subject to implementation defined behavior): structS unionU any∗: (ptr p)0 (ptr p)1 . . . (ptr p)31 .0 array signed char: 10000100 EEEEEEEEEEEEEEEE 01000100 struct S union U signed char[2] p = (os : struct S, ֒− −−− → 0 ֒−−−→• 0 ֒−−−−−−−→ 0, 2)signed char>∗ any The representation of unions requires some explanation. We considered two kinds of memory trees for unions: ~ represents a union whose variant is i. Unions of – The memory tree uniont (i, w, b) variant i can only be accessed through a pointer to variant i. This is essential for effective types. The list ~b represents the padding after the element w. A Formal C Memory Model for Separation Logic 37 – The memory tree uniont ~b represents a union whose variant is yet unspecified. Whenever the union is accessed through a pointer to variant i, the list ~ b will be interpreted as a memory tree of the type belonging to the ith variant. The reason that we consider unions uniont ~ b with unspecific variant at all is that in some cases the variant cannot be known. Unions that have not been initialized do not have a variant yet. Also, when a union object is constructed byte-wise through its object representation, the variant cannot be known. Although unions are tagged in the formal memory, actual compilers implement untagged unions. Information about variants should thus be internal to the formal memory model. In Section 7.2 we prove that this is indeed the case. The additional structure of memory trees, namely type annotations, variants of unions, and structured information about padding, can be erased by flattening. Flattening just appends the bytes on the leaves of the tree. Definition 6.24 The flatten operation ( ) : mtree → list pbit is defined as: b baseτb ~b := ~ # » arrayτ w ~ := w0 . . . w|w|−1 ~ ~b|w|−1 structt w~b := (w0 ~b0 ) . . . (w|w|−1 ) ~ ~ uniont (j, w, ~ b) := w ~ b uniont ~ b := ~b The flattened version of the memory tree representing the object s in the previous example is as follows: 10000100 01000100 EEEEEEEE EEEEEEEE (ptr p)0 (ptr p)1 . . . (ptr p)31 Definition 6.25 The judgment Γ, ∆ ⊢ w : τ describes that the memory tree w has type τ . It is inductively defined as: Γ ⊢b τb Γ, ∆ ⊢ ~ b |~b| = bitsizeof Γ τb Γ, ∆ ⊢ baseτb ~b : τb ∀i . (Γ, ∆ ⊢ ~bi Γ, ∆ ⊢ w ~ :τ |w| ~ =n,0 Γ, ∆ ⊢ arrayτ w ~ : τ [n] Γ t = ~τ Γ, ∆ ⊢ w ~ : ~τ ~ bi all E |~bi | = (fieldbitsizesΓ ~τ )i − bitsizeof Γ τi ) # » Γ, ∆ ⊢ structt w~b : struct t ~b all E Γ t = ~τ i < |~τ | Γ, ∆ ⊢ w : τi Γ, ∆ ⊢ ~b ~ bitsizeof Γ (union t) = bitsizeof Γ τi + |b| ¬unmapped (w ~ b) Γ, ∆ ⊢ uniont (i, w, ~ b) : union t Γ t = ~τ Γ, ∆ ⊢ ~ b |~b| = bitsizeof Γ (union t) Γ, ∆ ⊢ uniont ~b : union t Although padding bits should be kept indeterminate (see Section 3.1), padding bits are explicitly stored in memory trees for uniformity’s sake. The typing judgment ensures that the value of each padding bit is E and that the padding thus only have a permission. Storing a value in padding is a no-op (see Definition 6.35). b) The side-condition ¬unmapped (w ~b) in the typing rule for a union uniont (i, w, ~ of a specified variant ensures canonicity. Unions whose permissions are unmapped cannot be accessed and should therefore be in an unspecified variant. This condition is essential for the separation algebra structure, see Section 7.4. 38 Robbert Krebbers Definition 6.26 Memories are defined as: m ∈ mem := index →fin (mtree × bool + type). Each object (w, µ) in memory is annotated with a Boolean µ to describe whether it has been allocated using malloc (in case µ = true) or as a block scope local, static, or global variable (in case µ = false). The types of deallocated objects are kept to ensure that dangling pointers (which may remain to exist in memory, but cannot be used) have a unique type. Definition 6.27 The judgment Γ, ∆ ⊢ m describes that the memory m is valid. It is defined as the conjunction of: 1. For each o and τ with m o = τ we have: (a) ∆ ⊢ o : τ , (b) ∆ 0 o alive, and (c) Γ ⊢ τ . 2. For each o, w and µ with m o = (w, µ) we have: (a) ∆ ⊢ o : τ , (b) ∆ ⊢ o alive, (c) Γ, ∆ ⊢ w : τ , and (d) not w all (∅, E). The judgment ∆ ⊢ o alive on object identifiers is defined in Definition 6.3. Definition 6.28 The minimal memory typing environment m ∈ memenv of a memory m is defined as: m := λo . ( (τ, true) if m o = τ (typeof w, false) if m o = (w, µ) Notation 6.29 We let Γ ⊢ m denote Γ, m ⊢ m. Many of the conditions of the judgment Γ, ∆ ⊢ m ensure that the types of m match up with the types in the memory environment ∆ (see Definition 6.3). One may of course wonder why do we not define the judgment Γ ⊢ m directly, and even consider typing of a memory in an arbitrary memory environment. Consider: int x = 10, *p = &x; Using an assertion of separation logic we can describe the memory induced by the above program as x 7− → 10 ∗ p 7− → &x. The separation conjunction ∗ describes that the memory can be subdivided into two parts, a part for x and another part for p. When considering p 7− → &x in isolation, which is common in separation logic, we have a pointer that refers outside the part itself. This isolated part is thus not typeable by Γ ⊢ m, but it is typeable in the context of a the memory environment corresponding to the whole memory. See also Lemma 7.26. In the remaining part of this section we will define various auxiliary operations that will be used to define the memory operations in Section 6.5. We give a summary of the most important auxiliary operations: newγΓ : type → mtree for γ : perm for f : mtree → mtree ( )[ ]Γ : mem → addr → option mtree ( )[ /f ]Γ : mem → addr → mem Intuitively these are just basic tree operations, but unions make their actual definitions more complicated. The indeterminate memory tree newγΓ τ consists of A Formal C Memory Model for Separation Logic 39 indeterminate bits with permission γ, the lookup operation m[a]Γ yields the memory tree at address a in m, and the alter operation m[a/f ]Γ applies the function f to the memory tree at address a in m. The main delicacy of all of these operations is that we sometimes have to interpret bits as memory trees, or reinterpret memory trees as memory trees of a different type. Most notably, reinterpretation is needed when type-punning is performed: union int_or_short { int x; short y; } u = { .x = 3 }; short z = u.y; This code will reinterpret the bit representation of a memory tree representing an int value 3 as a memory tree of type short. Likewise: union int_or_short { int x; short y; } u; ((unsigned char*)&u)[0] = 3; ((unsigned char*)&u)[1] = 0; short z = u.y; Here, we poke some bytes into the object representation of u, and interpret these as a memory tree of type short. We have defined the flatten operation w that takes a memory tree w and yields its bit representation already in Definition 6.24. We now define the operation which goes in opposite direction, called the unflatten operation. Definition 6.30 The unflatten operation ( )τΓ : list pbit → mtree is defined as: (~b)τΓb := baseτb ~b τ [n] (~b)Γ := arrayτ ((~b[0, s) )τΓ . . . (~b[(n−1)s, ns) )τΓ ) where s := bitsizeof Γ τ ~  (b[0, s ) )τ0 ~bE 0 Γ [s0 , z0 ) t  := structt . . . (~b)struct Γ τn−1 ~ E ~ (b[zn−1 , zn−1 +sn−1 ) )Γ b[zn−1 +sn−1 , zn ) t (~b)union Γ where Γ t = ~τ , n := |~τ |, si := bitsizeof Γ τi and zi := bitoffsetof Γ ~τ i ~ := uniont b Here, the operation ( )E : pbit → pbit is defined as (x, b)E := (x, E). Now, the need for uniont ~b memory trees becomes clear. While unflattening a bit sequence as a union, there is no way of knowing which variant of the union the bits constitute. The operations ( ) and ( )τΓ are neither left nor right inverses: – We do not have (w)τΓ = w for each w with Γ, ∆ ⊢ w : τ . Variants of unions are destroyed by flattening w. b for each ~ b with |~b| = bitsizeof Γ τ either. Padding bits – We do not have (~b)τΓ = ~ E become indeterminate due to ( ) by unflattening. In Section 7.2 we prove weaker variants of these cancellation properties that are sufficient for proofs about program transformations. 40 Robbert Krebbers Definition 6.31 Given a permission γ ∈ perm, the operation newγΓ : type → mtree that yields the indeterminate memory tree is defined as: newγΓ τ := ((γ, E)bitsizeof Γ τ )τΓ . The memory tree newγΓ τ that consists of indeterminate bits with permission γ is used for objects with indeterminate value. We have defined newγΓ τ in terms of the unflattening operation for simplicity’s sake. This definition enjoys desirable structural properties such as newγΓ (τ [n]) = (newγΓ τ )n . We will now define the lookup operation m[a]Γ that yields the subtree at address a in the memory m. The lookup function is partial, it will fail in case a is end-of-array or violates effective types. We first define the counterpart of lookup on memory trees and then lift it to memories. Definition 6.32 The lookup operation on memory trees ( )[ ]Γ : mtree → ref → option mtree is defined as: w[ε]Γ := w τ [n] (arrayτ w)[( ~ ֒−−→ i) ~r]Γ := wi [~r]Γ # » struct t (structt w~ b)[(֒−−−→ i) ~r]Γ := wi [~r]Γ   if i = j w[~r]Γ union t ~ (uniont (j, w, b))[(֒−−−→q i) ~r]Γ := ((w ~ b)[0, s) )τΓi [~r]Γ if i , j, q = •, exclusive (w ~ b)  ⊥ if i , j, q = ◦ where Γ t = ~τ and s = bitsizeof Γ τi union t (uniont ~b)[(֒−−−→q i) ~r]Γ := (~b[0, bitsizeof Γ τi ) )τΓi [~r]Γ if Γ t = ~τ , exclusive ~ b union s The lookup operation uses the annotations q ∈ {◦, •} on ֒−−−→q i to give a formal semantics to the strict-aliasing restrictions [27, 6.5.2.3]. – The annotation q = • allows a union to be accessed via a reference whose variant is unequal to the current one. This is called type-punning. – The annotation q = ◦ allows a union to be accessed only via a reference whose variant is equal to the current one. This means, it rules out type-punning. Failure of type-punning is captured by partiality of the lookup operation. The behavior of type-punning of uniont (j, w, ~ b) via a reference to variant i is described by the conversion ((w ~b)[0, bitsizeof Γ τi ) )τΓi . The memory tree w is converted into bits and reinterpreted as a memory tree of type τi . Definition 6.33 The lookup operation on memories ( )[ ]Γ : mem → addr → option mtree is defined as: m[a]Γ := ( char ((w[ref Γ a]Γ )[i, j) )unsigned Γ w[ref Γ a]Γ if a is a byte address if a is not a byte address provided that m (index a) = (w, µ). In omitted cases the result is ⊥. In this definition we let i := byteΓ a · char bits and j := (byteΓ a + 1) · char bits. A Formal C Memory Model for Separation Logic 41 We have to take special care of addresses that refer to individual bytes rather than whole objects. Consider: struct S { int x; int y; } s = { .x = 1, .y = 2 }; unsigned char z = ((unsigned char*)&s)[0]; In this code, we obtain the first byte ((unsigned char*)&s)[0] of the struct s. This is formalized by flattening the entire memory tree of the struct s, and selecting the appropriate byte. The C11 standard’s description of effective types [27, 6.5p6-7] states that an access (which is either a read or store) affects the effective type of the accessed object. This means that although reading from memory does not affect the memory contents, it may still affect the effective types. Let us consider an example where it is indeed the case that effective types are affected by a read: short g(int *p, short *q) { short z = *q; *p = 10; return z; } int main() { union int_or_short { int x; short y; } u; // initialize u with zeros, the variant of u remains unspecified for (size_t i = 0; i < sizeof(u); i++) ((unsigned char*)&u)[i] = 0; return g(&u.x, &u.y); } In this code, the variant of the union u is initially unspecified. The read *q in g forces its variant to x, making the assignment *p to variant y undefined. Note that it is important that we also assign undefined behavior to this example, a compiler may assume p and q to not alias regardless of how g is called. We factor these side-effects out using a function forceΓ : addr → mem → mem that updates the effective types (that is the variants of unions) after a successful lookup. The forceΓ function, as defined in Definition 6.5, can be described in terms of the alter operation m[a/f ]Γ that applies the function f : mtree → mtree to the object at address a in the memory m and update variants of unions accordingly to a. To define forceΓ we let f be the identify. Definition 6.34 Given a function f : mtree → mtree, the alter operation on memory trees ( )[ /f ]Γ : mtree → ref → mtree is defined as: w[ε/f ]Γ := f w τ [n] (arrayτ w)[( ~ ֒−−→ i) ~r/f ]Γ := arrayτ (w[i ~ := wi [~r/f ]Γ ]) # » # » struct t (structt w~ b)[(֒−−−→ i) ~r/f ]Γ := structt ((w~ b)[i := wi [~r/f ]Γ ~bi ]) ( uniont (i, w[~r/f ]Γ , ~ b) if i = j union t (uniont (i, w, ~ b))[(֒−−−→q j) ~r/f ]Γ := τi E ~ ~ uniont (i, (((wb)[0, s) )Γ )[~r/f ]Γ , (w b)[s, z) ) if i , j union t bE[s, z) ) b)[(֒−−−→q i) ~r/f ]Γ := uniont (i, ((~b[0, s) )τΓi )[~r/f ]Γ , ~ (uniont ~ In the last two cases we have Γ t = ~τ , s := bitsizeof Γ τi and z := bitsizeof Γ (union t). The result of w[~r/f ]Γ is only well-defined in case w[~r]Γ , ⊥. 42 Robbert Krebbers Definition 6.35 Given a function f : mtree → mtree, the alter operation on memories ( )[ /f ]Γ : mem → addr → mem is defined as: m[a/f ]Γ := ( m[(index a) := (w[ref Γ a/f ]Γ , µ)] m[(index a) := (w[ref Γ a/f ]Γ , µ)] if a is a byte address if a is not a byte address provided that m (index a) = (w, µ). In this definition we let: char w f w := (w[0, i) f (w[i, j) )unsigned w [j, bitsizeof Γ (typeof w)) )typeof Γ Γ where i := byteΓ a · char bits and j := (byteΓ a + 1) · char bits. The lookup and alter operation enjoy various properties; they preserve typing and satisfy laws about their interaction. We list some for illustration. Lemma 6.36 (Alter commutes) If Γ, ∆ ⊢ m, a1 ⊥Γ a2 with: – Γ, ∆ ⊢ a1 : τ1 , m[a1 ]Γ = w1 , and Γ, ∆ ⊢ f1 w1 : τ1 , and – Γ, ∆ ⊢ a2 : τ2 , m[a2 ]Γ = w2 , and Γ, ∆ ⊢ f2 w2 : τ2 , then we have: m[a2 /f2 ]Γ [a1 /f1 ]Γ = m[a1 /f1 ]Γ [a2 /f2 ]Γ . Lemma 6.37 If Γ, ∆ ⊢ m, m[a]Γ = w, and a is not a byte address, then: (m[a/f ]Γ )[a]Γ = f w. A variant of Lemma 6.37 for byte addresses is more subtle because a byte address can be used to modify padding. Since modifications of padding are masked, a successive lookup may yield a memory tree with more indeterminate bits. In Section 7.2 we present an alternative lemma that covers this situation. We conclude this section with a useful helper function that zips a memory tree and a list. It is used in for example Definitions 6.58 and 7.22. Definition 6.38 Given a function f : pbit → B → pbit, the operation that zips the leaves fˆ : mtree → list B → mtree is defined as: y) b) ~ y := baseτb (f ~b ~ fˆ (baseτb ~ fˆ (arrayτ w) ~ ~ y := arrayτ (fˆ w0 ~ y[0, s0 ) . . . fˆ wn−1 ~y[sn−1 , sn ) ) where n := |w| ~ and si := Σj<i |wj |   fˆ w0 ~y[0, s0 ) f ~ b0 ~ y[s0 , z0 ) # »  fˆ (structt w~ b) y~ := structt . . . ˆ ~ f wn−1 ~y[zn−1 , zn−1 +sn−1 ) f bn−1 ~y[zn−1 +sn−1 , zn ) where n := |w|, ~ si := |wi |, and zi := Σj<i |wi ~bi | fˆ (uniont (i, w, ~ b)) ~ y := uniont (i, fˆ w ~y[0, |w|) , f ~ b ~y[|w|, |w ~b|) ) b) ~ y := uniont (f ~ b ~y) fˆ (uniont ~ A Formal C Memory Model for Separation Logic 43 6.4 Representation of values Memory trees (Definition 6.23) are still rather low-level and expose permissions and implementation specific properties such as bit representations. In this section we define abstract values, which are like memory trees but have mathematical integers and pointers instead of bit representations as leaves. Abstract values are used in the external interface of the memory model. Definition 6.39 Base values are inductively defined as: vb ∈ baseval ::= indet τb | nothing | intτi x | ptr p | byte ~b. While performing byte-wise operations (for example, byte-wise copying a struct containing pointer values), abstraction is broken, and pointer fragment bits have to reside outside of memory. The value byte ~b is used for this purpose. Definition 6.40 The judgment Γ, ∆ ⊢b vb : τb describes that the base value vb has base type τb . It is inductively defined as: Γ ⊢b τb τb , void Γ, ∆ ⊢b indet τb : τb Γ, ∆ ⊢ ~b Γ, ∆ ⊢∗ p : σp x : τi Γ, ∆ ⊢b nothing : void |~b| = char bits Γ, ∆ ⊢b intτi x : τi Not ~b all in {0, 1} Not ~b all E Γ, ∆ ⊢b byte ~b : unsigned char Γ, ∆ ⊢b ptr p : σp ∗ The side-conditions of the typing rule for byte ~b ensure canonicity of representations of base values. It ensures that the construct byte ~b is only used if ~b cannot be represented as an integer intunsigned char x or indet (unsigned char). In Definition 6.44 we define abstract values by extending base values with constructs for arrays, structs and unions. In order to define the operations to look up and store values in memory, we define conversion operations between abstract values and memory trees. Recall that the leaves of memory trees, which represent base values, are just sequences of bits. We therefore first define operations that convert base values to and from bits. These operations are called flatten and unflatten. Definition 6.41 The flatten operation ( ) indet τb Γ Γ : baseval → list bit is defined as: := Ebitsizeof Γ τb nothing Γ := Ebitsizeof Γ void intτi x Γ := x : τi ptr p Γ := (ptr | p |◦ )0 . . . (ptr | p |◦ )bitsizeof Γ (typeof p∗)−1 byte ~b The operation Γ := ~b : τi : Z → list bool is defined in Definition 4.4. 44 Robbert Krebbers Definition 6.42 The unflatten operation ( )Γτb : list bit → baseval is defined as: (~b)void := nothing Γ  ~ τ  intτi (β) i τi ~ ~ (b)Γ := byte b  indet τ i ( ptr p σ ∗ (~b)Γp := indet (σp ∗) ~ if ~b is a {0, 1} sequence β if τi = unsigned char, not ~b all in {0, 1}, and not ~b all E otherwise if ~b = (ptr p)0 . . . (ptr p)bitsizeof Γ (σp ∗)−1 and typeof p = σp otherwise The operation ( )τi : list bool → Z is defined in Definition 4.4. The encoding of pointers is an important aspect of the flatten operation related to our treatment of effective types. Pointers are encoded as sequences of frozen pointer fragment bits (ptr | p |◦ )i (see Definition 6.5 for the definition of frozen pointers). Recall that the flatten operation is used to store base values in memory, whereas the unflatten operation is used to retrieve them. This means that whenever a pointer p is stored and read back, the frozen variant | p |◦ is obtained. Lemma 6.43 For each Γ, ∆ ⊢b vb : τb we have (vb Γ )τΓb = | vb |◦ . Freezing formally describes the situations in which type-punning is allowed since a frozen pointer cannot be used to access a union of another variant than its current one (Definition 6.32). Let us consider an example: union U { int x; short y; } u = { .x = 3 }; short *p = &u.y; // a frozen version of the pointer &u.y is stored printf("%d", *p); // type-punning via a frozen pointer -> undefined Here, an attempt to type-punning is performed via the frozen pointer p, which is formally represented as: union U (ou : union U, ֒−−−→◦ 1, 0)signed short>∗ signed short . The lookup operation on memory trees (which will be used to obtain the value of *p from memory, see Definitions 6.32 and 6.58) will fail. The annotation ◦ prevents a union from being accessed through an address to another variant than its current one. In the example below type-punning is allowed: union U { int x; short y; } u = { .x = 3 }; printf("%d", u.y); Here, type-punning is allowed because it is performed directly via u.y, which has not been stored in memory, and thus has not been frozen. Definition 6.44 Abstract values are inductively defined as: v ∈ val ::= vb | arrayτ ~v | structt ~v | uniont (i, v) | uniont ~v . The abstract value uniont ~v represents a union whose variant is unspecified. The values ~v correspond to interpretations of all variants of union t. Consider: A Formal C Memory Model for Separation Logic 45 union U { int x; short y; int *p; } u; for (size_t i = 0; i < sizeof(u); i++) ((unsigned char*)&u)[i] = 0; Here, the object representation of u is initialized with zeros, and its variant thus remains unspecified. The abstract value of u is5 : unionU [ intsigned int 0, intsigned short 0, indet (signed int∗) ] Recall that the variants of a union occupy a single memory area, so the sequence ~v of a union value uniont ~v cannot be arbitrary. There should be a common bit sequence representing it. This is not the case in: unionU [ intsigned int 0, intsigned short 1, indet (signed int∗) ] The typing judgment for abstract values guarantees that ~v can be represented by a common bit sequence. In order to express this property, we first define the unflatten operation that converts a bit sequence into an abstract value. Definition 6.45 The unflatten operation ( )τΓ : list bit → val is defined as: (~b)τΓb := (~b)τΓb (the right hand side is Definition 6.41 on base values) τ [n] (~b)Γ := arrayτ ((~b[0, s) )τΓ . . . (~b[(n−1)s, ns) )τΓ ) where s := bitsizeof Γ τ τ t := structt ((~b[0, s0 ) )τΓ0 . . . (~b[zn−1 , zn−1 +sn−1 ) )Γn−1 ) (~b)struct Γ t (~b)union Γ where Γ t = ~τ , n := |~τ |, si := bitsizeof Γ τi and zi := bitoffsetof Γ ~τ i τ := uniont ((~b[0, s0 ) )τΓ0 . . . (~b[0, sn−1 ) )Γn−1 ) where Γ t = ~τ , n := |~τ | and si := bitsizeof Γ τi Definition 6.46 The judgment Γ, ∆ ⊢ v : τ describes that the value v has type τ . It is inductively defined as: Γ, ∆ ⊢b vb : τb Γ, ∆ ⊢ vb : τb Γ t = ~τ Γ, ∆ ⊢ ~v : ~τ Γ, ∆ ⊢ structt ~v : struct t Γ t = ~τ Γ, ∆ ⊢ ~v : ~τ Γ, ∆ ⊢ ~v : τ |~v | = n , 0 Γ, ∆ ⊢ arrayτ ~v : τ [n] Γ t = ~τ i < |~τ | Γ, ∆ ⊢ v : τi Γ, ∆ ⊢ uniont (i, v) : union t Γ, ∆ ⊢ ~b ∀i . (vi = (~b[0, bitsizeof Γ τi ) )τΓi ) Γ, ∆ ⊢ uniont ~v : union t Γ The flatten operation ( ) : val → list bit, which converts an abstract value v into a bit representation v Γ , is more difficult to define (we need this operation to define the conversion operation from abstract values into memory trees, see Definition 6.49). Since padding bits are not present in abstract values, we have to insert these. Also, in order to obtain the bit representation of an unspecified uniont ~v value, we have to construct the common bit sequence ~b representing ~v . The typing judgment guarantees that such a sequence exists, but since it is not explicit in the value uniont ~v , we have to reconstruct it from ~v . Consider: 5 Note that the C11 standard does not guarantee that the NULL pointer is represented as zeros, thus u.p is not necessarily NULL. 46 Robbert Krebbers union U { struct S { short y; void *p; } x1; int x2; }; Assuming sizeof Γ (signed int) = sizeof Γ (any∗) = 4 and sizeof Γ (signed short) = 2, a well-typed union U value of an unspecified variant may be: v = unionU [ structS [ intsigned short 0, ptr p ], intsigned int 0 ]. The flattened versions of the variants of v are: v Γ structS [ intsigned short 0, ptr p ] Γ intsigned int 0 Γ = 0...0 0...0 0...0 0...0 v Γ = 0 . . . 0 0 . . . 0 0 . . . 0 0 . . . 0 (ptr p)0 . . . (ptr p)31 = 0 . . . 0 0 . . . 0 E . . . E E . . . E (ptr p)0 . . . (ptr p)31 This example already illustrates that so as to obtain the common bit sequence of v we have to insert padding bits and “join” the padded bit representations. Definition 6.47 The join operation on bits ⊔ : bit → bit → bit is defined as: E ⊔ b := b b ⊔ E := b Definition 6.48 The flatten operation ( ) vb Γ := vb Γ arrayτ ~v Γ := v0 Γ structt ~v Γ uniont (i, v) Γ := (v0 . . . v|~v|−1 Γ E∞ ) [0, z0 ) Γ b ⊔ b := b. : val → list bit is defined as: Γ . . . (vn−1 Γ E∞ )[0, zn−1 ) where Γ t = ~τ , n := |~τ |, and zi := bitoffsetof Γ ~τ i uniont ~v Γ := (v Γ E∞ )[0, bitsizeof Γ (union t)) := F|~v|−1 i=0 (vi Γ E∞ )[0, bitsizeof Γ (union t)) The operation ofvalΓ : list perm → val → mtree, which converts a value v of type τ into a memory tree ofvalΓ ~γ v, is albeit technical fairly straightforward. In principle it is just a recursive definition that uses the flatten operation vb Γ for base values vb Γ and the flatten operation uniont ~v for unions uniont ~v of an unspecified variant. The technicality is that abstract values do not contain permissions, so we have to merge the given value with permissions. The sequence ~γ with |~γ | = bitsizeof Γ τ represents a flattened sequence of permissions. In the definition of the memory store mha := viΓ (see Definition 6.58), we convert v into the stored memory tree ofvalΓ ~γ v where γ constitutes the old permissions of the object at address a. A Formal C Memory Model for Separation Logic 47 Definition 6.49 The operation ofvalΓ : list perm → val → mtree is defined as: #» ofvalΓ ~γ (vb ) := basetypeof vb γb where ~b := vb Γ ofvalΓ ~γ (arrayτ ~v ) := arrayτ (ofvalΓ ~γ[0, s) v0 . . . ofvalΓ ~γ[(n−1)s, ns) vn−1 ) where s := bitsizeof Γ τ and n := |~v |   ofvalΓ ~γ[0, s0 ) v0 ~γ[sE 0 , z0 )   ofvalΓ ~γ (structt ~v ) := structt . . . ofvalΓ ~γ[zn−1 , zn−1 +sn−1 ) vn−1 ~γ[zE n−1 +sn−1 , zn ) where Γ t = ~τ , n := |~τ |, si := bitsizeof Γ τi and zi := bitoffsetof Γ ~τ i E ofvalΓ ~γ (uniont (i, v)) := uniont (i, ofvalΓ ~γ[0, s) v, ~γ[s, bitsizeof Γ (union t)) ) where s := bitsizeof Γ (typeof v) #» ofvalΓ ~γ (uniont ~v ) := uniont γb where ~b := uniont ~v Γ Converting a memory tree into a value is as expected: permissions are removed and unions are interpreted as values corresponding to each variant. Definition 6.50 The operation tovalΓ : mtree → val is defined as: #» tovalΓ (baseτb γb) := (~b)τΓb tovalΓ (arrayτ w) ~ := arrayτ (tovalΓ w0 . . . tovalΓ w|w|−1 ) ~ # » tovalΓ (structt w~ b) := structt (tovalΓ w0 . . . tovalΓ w|w|−1 ) ~ ~ tovalΓ (uniont (i, w, b)) := uniont (i, tovalΓ w) #» t tovalΓ (uniont γb) := (~b)union Γ The function tovalΓ is an inverse of ofvalΓ up to freezing of pointers. Freezing is intended, it makes indirect type-punning illegal. Lemma 6.51 Given Γ, ∆ ⊢ v : τ , and let ~γ be a flattened sequence of permissions with |~γ | = bitsizeof Γ τ , then we have: tovalΓ (ofvalΓ ~γ v) = | v |◦ . The other direction does not hold because invalid bit representations will become indeterminate values. struct S { int *p; } s; for (size_t i = 0; i < sizeof(s); i++) ((unsigned char*)&s)[i] = i; // s has some bit representation that does not constitute a pointer struct S s2 = s; // After reading s, and storing it, there are no guarantees about s2, // whose object representation thus consists of Es We finish this section by defining the indeterminate abstract value newΓ τ , which consists of indeterminate base values. The definition is similar to its counterpart on memory trees (Definition 6.31). 48 Robbert Krebbers Definition 6.52 The operation newΓ : type → val that yields the indeterminate value is defined as: newΓ τ := (Ebitsizeof Γ τ )τΓ . Lemma 6.53 If Γ ⊢ τ , then: tovalΓ (newγΓ τ ) = newΓ τ and ofvalΓ (γ bitsizeof Γ τ ) (newΓ τ ) = newγΓ τ. 6.5 Memory operations Now that we have all primitive definitions in place, we can compose these to implement the actual memory operations as described in the beginning of this section. The last part that is missing is a data structure to keep track of objects that have been locked. Intuitively, this data structure should represent a set of addresses, but up to overlapping addresses. Definition 6.54 Locksets are defined as: Ω ∈ lockset := Pfin (index × N). Elements of locksets are pairs (o, i) where o ∈ index describes the object identifier and i ∈ N a bit-offset in the object described by o. We introduce a typing judgment to describe that the structure of locksets matches up with the memory layout. Definition 6.55 The judgment Γ, ∆ ⊢ Ω describes that the lockset Ω is valid. It is inductively defined as: for each (o, i) ∈ Ω there is a τ with ∆ ⊢ o : τ and i < bitsizeof Γ τ Γ, ∆ ⊢ Ω Definition 6.56 The singleton lockset { }Γ : addr → lockset is defined as: {a}Γ := {(index a, i) | bitoffsetΓ a ≤ i < bitoffsetΓ a + bitsizeof Γ (typeof a)}. Lemma 6.57 If Γ, ∆ ⊢ a1 : σ1 and Γ, ∆ ⊢ a2 : σ2 and Γ ⊢ {a1 , a2 } strict, then: a1 ⊥Γ a2 implies {a1 }Γ ∩ {a2 }Γ = ∅. Definition 6.58 The memory operations are defined as: mhaiΓ := tovalΓ w if m[a]Γ = w and ∀i . Readable ⊆ kind (w)i forceΓ a m := m[(index a) := (w[ref Γ a/λw′ . w′ ]Γ , µ)] if m (index a) = (w, µ) mha := viΓ := m[a/λw . ofvalΓ (w 1 ) v]Γ writableΓ a m := ∃w . m[a]Γ = w and ∀i . Writable ⊆ kind (w)i lockΓ a m := m[a/λw . apply lock to all permissions of w]Γ unlock Ω m := {(o, (fˆ w ~y, µ)) | m o = (w, µ)} ∪ {(o, τ ) | m o = τ } where f (γ, b) true := (unlock γ, b) f (γ, b) false := (γ, b), and ~ y := ((o, 0) ∈ Ω) . . . ((o, |bitsizeof Γ (typeof w)| − 1) ∈ Ω) A Formal C Memory Model for Separation Logic 49 allocΓ o v µ m := m[o := (ofvalΓ (♦(0, 1)bitsizeof Γ (typeof v) ) v, µ)] τ [n] freeable a m := ∃o τ σ n w . a = (o : τ, ֒−−→ 0, 0)τ >∗ σ , m o = (w, true) and all w have the permission ♦(0, 1) free o m := m[o := typeof w] if m o = (w, µ) The lookup operation mhaiΓ uses the lookup operation m[a]Γ that yields a memory tree w (Definition 6.33), and then converts w into the value tovalΓ w. The operation m[a]Γ already yields ⊥ in case effective types are violated or a is an end-of-array address. The additional condition of mhaiΓ ensures that the permissions allow for a read access. Performing a lookup affects the effective types of the object at address a. This is factored out by the operation forceΓ a m which applies the identity function to the subobject at address a in the memory m. Importantly, this does not change the memory contents, but merely changes the variants of the involved unions. The store operation mha := viΓ uses the alter operation m[a/λw . ofvalΓ (w1 ) v]Γ on memories (Definition 6.35) to apply λw . ofvalΓ (w 1 ) v to the subobject at address a. The stored value v is converted into a memory tree while retaining the permissions w 1 of the previously stored memory tree w at address a. The definition of lockΓ a m is straightforward. In the Coq development we use a map operation on memory trees to apply the function lock (Definition 5.5) to the permission of each bit of the memory tree at address a. The operation unlock Ω m unlocks a whole lockset Ω, rather than an individual address, in memory m. For each memory tree w at object identifier o, it converts Ω to a Boolean vector ~y = ((o, 0) ∈ Ω) . . . ((o, |bitsizeof Γ (typeof w)| − 1) ∈ Ω) and merges w with ~y (using Definition 6.38) to apply unlock (Definition 5.5) to the permissions of bits that should be unlocked in w. We show some lemmas to illustrate that the operations for locking and unlocking enjoy the intended behavior: Lemma 6.59 If Γ, ∆ ⊢ m and Γ, ∆ ⊢ a : τ and writableΓ a m, then we have: locks (lockΓ a m) = locks m ∪ {a}Γ . Lemma 6.60 If Ω ⊆ locks m, then locks (unlock Ω m) = locks m \ Ω. Provided o < dom m, allocation allocΓ o v µ m extends the memory with a new object holding the value v and full permissions ♦(0, 1). Typically we use v = newΓ τ for some τ , but global and static variables are allocated with a specific value v. The operation free o m deallocates the object o in m, and keeps track of the type of the deallocated object. In order to deallocate dynamically obtained memory via free, the side-condition freeable a m describes that the permissions are sufficient for deallocation, and that a points to the first element of an malloced array. All operations preserve typing and satisfy the expected laws about their interaction. We list some for illustration. Fact 6.61 If writableΓ a m, then there exists a value v with ahmiΓ = v. Lemma 6.62 (Stores commute) If Γ, ∆ ⊢ m and a1 ⊥Γ a2 with: – Γ, ∆ ⊢ a1 : τ1 , writableΓ a1 m, and Γ, ∆ ⊢ v1 : τ1 , and – Γ, ∆ ⊢ a2 : τ2 , writableΓ a2 m, and Γ, ∆ ⊢ v2 : τ2 , 50 Robbert Krebbers then we have: mha2 := v2 iΓ ha1 := v1 iΓ = mha1 := v1 iΓ ha2 := v2 iΓ . Lemma 6.63 (Looking up after storing) If Γ, ∆ ⊢ m and Γ, ∆ ⊢ a : τ and Γ, ∆ ⊢ v : τ and writableΓ a m and a is not a byte address, then we have: (mha := viΓ )haiΓ = | v |◦ . Storing a value v in memory and then retrieving it, does not necessarily yield the same value v. It intentionally yields the value | v |◦ whose pointers have been frozen. Note that the above result does not hold for byte addresses, which may store a value in a padding byte, in which case the resulting value is indeterminate. Lemma 6.64 (Stores and look ups commute) If Γ, ∆ ⊢ m and a1 ⊥Γ a2 and Γ, ∆ ⊢ a2 : τ2 and writableΓ a2 m and Γ, ∆ ⊢ v2 : τ2 , then we have: mha1 iΓ = v1 implies (mha2 := v2 iΓ )ha1 iΓ = v1 . These results follow from Lemma 6.36, 6.37 and 6.51. 7 Formal proofs 7.1 Type-based alias analysis The purpose of C11’s notion of effective types [27, 6.5p6-7] is to make it possible for compilers to perform typed-based alias analysis. Consider: short g(int *p, short *q) { short x = *q; *p = 10; return x; } Here, a compiler should be able to assume that p and q are not aliased because they point to objects with different types (although the integer types signed short and signed int may have the same representation, they have different integer ranks, see Definition 4.2, and are thus different types). If g is called with aliased pointers, execution of the function body should have undefined behavior in order to allow a compiler to soundly assume that p and q are not aliased. From the C11 standard’s description of effective types it is not immediate that calling g with aliased pointers results in undefined behavior. We prove an abstract property of our memory model that shows that this is indeed a consequence, and that indicates a compiler can perform type-based alias analysis. This also shows that our interpretation of effective types of the C11 standard, in line with the interpretation from the GCC documentation [20], is sensible. Definition 7.1 A type τ is a subobject type of σ, notation τ ⊆Γ σ, if there exists some reference ~r with Γ ⊢ ~r : σ ֌ τ . For example, int[2] is a subobject type of struct S { int x[2]; int y[3]; } and int[2][2], but not of struct S { short x[2]; }, nor of int(*)[2]. A Formal C Memory Model for Separation Logic 51 Theorem 7.2 (Strict-aliasing) Given Γ, ∆ ⊢ m, frozen addresses a1 and a2 with ∆, m ⊢ a1 : σ1 and ∆, m ⊢ a2 : σ2 and σ1 , σ2 , unsigned char, then either: 1. We have σ1 ⊆Γ σ2 or σ2 ⊆Γ σ1 . 2. We have a1 ⊥Γ a2 . 3. Accessing a1 after accessing a2 and vice versa fails. That means: (a) (forceΓ a2 m)ha1 iΓ = ⊥ and (forceΓ a1 m)ha2 iΓ = ⊥, and (b) mha2 := v1 iΓ ha1 iΓ = ⊥ and mha1 := v2 iΓ ha2 iΓ = ⊥ for all stored values v1 and v2 . This theorem implies that accesses to addresses of disjoint type are either nonoverlapping or have undefined behavior. Fact 6.61 accounts for a store after a lookup. Using this theorem, a compiler can optimize the generated code in the example based on the assumption that p and q are not aliased. Reconsider: short g(int *p, short *q) { short x = *q; *p = 10; return x; } If p and q are aliased, then calling g yields undefined behavior because the assignment *p = 10 violates effective types. Let m be the initial memory while executing g, and let ap and aq be the addresses corresponding to p and q, then the condition writableΓ ap (forceΓ aq m) does not hold by Theorem 7.2 and Fact 6.61. 7.2 Memory refinements This section defines the notion of memory refinements that allows us to relate memory states. The author’s PhD thesis [33] shows that the CH2 O operational semantics is invariant under this notion. Memory refinements form a general way to validate many common-sense properties of the memory model in a formal way. For example, they show that the memory is invariant under relabeling. More interestingly, they show that symbolic information (such as variants of unions) cannot be observed. Memory refinements also open to door to reason about program transformations. We demonstrate their usage by proving soundness of constant propagation and by verifying an abstract version of memcpy. Memory refinements are a variant of Leroy and Blazy’s notion of memory extensions and injections [41]. A memory refinement is a relation m1 ⊑fΓ m2 between a source memory state m1 and target memory state m2 , where: 1. The function f : index → option (index × ref) is used to rename object identifiers and to coalesce multiple objects into subobjects of a compound object. 2. Deallocated objects in m1 may be replaced by arbitrary objects in m2 . 3. Indeterminate bits E in m1 may be replaced by arbitrary bits in m2 . 4. Pointer fragment bits (ptr p)i that belong to deallocated pointers in m1 may be replaced by arbitrary bits in m2 . 5. Effective types may be weakened. That means, unions with a specific variant in m1 may be replaced by unions with an unspecified variant in m2 , and pointers with frozen union annotations ◦ in m1 may be replaced by pointers with unfrozen union annotations • in m2 . The key property of a memory refinement m1 ⊑fΓ m2 , as well as of Leroy and Blazy’s memory extensions and injections, is that memory operations are more defined on the target memory m2 than on the source memory m1 . For example, if a lookup succeeds on m1 , it also succeed on m2 and yield a related value. 52 Robbert Krebbers The main judgment m1 ⊑Γf :∆1 7→∆2 m2 of memory refinements will be built using a series of refinement relations on the structures out of which the memory consists (addresses, pointers, bits, memory trees, values). All of these judgments should satisfy some basic properties, which are captured by the judgment ∆1 ⊑f∆ ∆2 . Definition 7.3 A renaming function f : index → option (index×ref) is a refinement, notation ∆1 ⊑f∆ ∆2 , if the following conditions hold: 1. 2. 3. 4. 5. If If If If If f o1 f o1 f o1 f o1 f o1 = (o, ~r1 ) and f o2 = (o, ~r2 ), then o1 = o2 or ~r1 ⊥ ~r2 (injectivity). = (o2 , ~r), then frozen ~r. = (o2 , ~r) and ∆1 ⊢ o1 : σ, then ∆2 ⊢ o2 : τ and Γ ⊢ ~r : τ ֌ σ for a τ . = (o2 , ~r) and ∆2 ⊢ o2 : τ , then ∆1 ⊢ o1 : σ and Γ ⊢ ~r : τ ֌ σ for a σ. = (o2 , ~r) and ∆1 ⊢ o1 alive, then ∆2 ⊢ o2 alive. The renaming function f : index → option (index×ref) is the core of all refinement judgments. It is used to rename object identifiers and to coalesce multiple source objects into subobjects of a single compound target object. struct t struct t Consider a renaming f with f o1 = (o1 , ֒−−−→ 0) and f o2 = (o1 , ֒−−−→ 1), and an environment Γ with Γ t = [ τ1 , τ2 ]. This gives rise to following refinement: o1 o1 o2 o3 struct t ⊑fΓ τ1 τ2 τ1 τ3 τ2 Injectivity of renaming functions guarantees that distinct source objects are coalesced into disjoint target subobjects. In the case of Blazy and Leroy, the renaming functions have type index → option (index × N), but we replaced the natural number by a reference since our memory model is structured using trees. Since memory refinements rearrange the memory layout, addresses should be rearranged accordingly. The judgment a1 ⊑Γf :∆1 7→∆2 a2 : τp describes how a2 is obtained by renaming a1 according to the renaming f , and moreover allows frozen union annotations ◦ in a1 to be changed into unfrozen ones • in a2 . The index τp in the judgment a1 ⊑Γf :∆1 7→∆2 a2 : τp corresponds to the type of a1 and a2 . The judgment for addresses is lifted to the judgment for pointers in the obvious way. The judgment for bits is inductively defined as: p1 ⊑Γf :∆1 7→∆2 p2 : σp β ∈ {0, 1} β ⊑Γf :∆1 7→∆2 β Γ, ∆2 ⊢ b E ⊑Γf :∆1 7→∆2 b i < bitsizeof Γ (σp ∗) frozen p2 (ptr p1 )i ⊑Γf :∆1 7→∆2 (ptr p2 )i Γ, ∆1 ⊢ a : σ (ptr Γ, ∆2 ⊢ b ∆1 0 a alive a)i ⊑Γf :∆1 7→∆2 b The last two rules allow indeterminate bits E, as well as pointer fragment bits (ptr a)i belonging to deallocated storage, to be replaced by arbitrary bits b. A Formal C Memory Model for Separation Logic 53 The judgment is lifted to memory trees following the tree structure and using the following additional rule: ~b1 all E b2 w1 ~b1 ⊑Γf :∆1 7→∆2 ~ Γ t = ~τ Γ, ∆ ⊢ w1 : τi bitsizeof Γ (union t) = bitsizeof Γ τi + |~b1 | ¬unmapped (w1 ~b1 ) ~ 1 ) ⊑f :∆1 7→∆2 uniont ~ uniont (i, w1 , b b2 : union t Γ This rule allows a union that has a specific variant in the source to be replaced by a union with an unspecified variant in the target. The direction seems counter intuitive, but keep in mind that unions with an unspecified variant allow more behaviors. Lemma 7.4 If w1 ⊑Γf :∆1 7→∆2 w2 : τ , then Γ, ∆1 ⊢ w1 : τ and Γ, ∆2 ⊢ w2 : τ . This lemma is useful because it removes the need for simultaneous inductions on both typing and refinement judgments. We define m1 ⊑fΓ m2 as m1 ⊑Γf :m1 7→m2 m2 , where the judgment m1 ⊑Γf :∆1 7→∆2 m2 is defined such that if f o1 = (o2 , ~r), then: o2 o1 implies ∃ w2 τ with ~r and w1 ⊑Γf :∆1 7→∆2 w2 : τ . w1 w2 The above definition makes sure that objects are renamed, and possibly coalesced into subobjects of a compound object, as described by the renaming function f . In order to reason about program transformations modularly, we show that memory refinements can be composed. Lemma 7.5 Memory refinements are reflexive for valid memories, that means, if Γ, ∆ ⊢ m, then m ⊑Γid:∆7→∆ m where id o := (o, ε). Lemma 7.6 Memory refinements compose, that means, if m1 ⊑Γf :∆1 7→∆2 m2 and ′ ′ m2 ⊑Γf :∆2 7→∆3 m3 , then m1 ⊑Γf ◦f :∆1 7→∆3 m3 where: ′ (f ◦ f ) o1 := ( (o3 , r~2 ~r3 ) ⊥ if f o1 = (o2 , ~r2 ) and f ′ o2 = (o3 , ~r3 ) otherwise All memory operations are preserved by memory refinements. This property is not only useful for reasoning about program transformations, but also indicates that the memory interface does not expose internal details (such as variants of unions) that are unavailable in the memory of a (concrete) machine. Lemma 7.7 If m1 ⊑Γf :∆1 7→∆2 m2 and a1 ⊑Γf :∆1 7→∆2 a2 : τ and m1 ha1 iΓ = v1 , then there exists a value v2 with m2 ha2 iΓ = v2 and v1 ⊑Γf :∆1 7→∆2 v2 : τ . Lemma 7.8 If m1 ⊑Γf :∆1 7→∆2 m2 and a1 ⊑Γf :∆1 7→∆2 a2 : τ and v1 ⊑Γf :∆1 7→∆2 v2 : τ and writableΓ m1 a1 , then: 54 Robbert Krebbers 1. We have writableΓ m2 a2 . 2. We have m1 ha1 := v1 iΓ ⊑Γf :∆1 7→∆2 m2 ha2 := v2 iΓ . As shown in Lemma 6.63, storing a value v in memory and then retrieving it, does not necessarily yield the same value v. In case of a byte address, the value may have been stored in padding and therefore have become indeterminate. Secondly, it intentionally yields the value | v |◦ in which all pointers are frozen. However, the widely used compiler optimization of constant propagation, which substitutes values of known constants at compile time, is still valid in our memory model. Lemma 7.9 If Γ, ∆ ⊢ v : τ , then | v |◦ ⊑∆ Γ v : τ. Theorem 7.10 (Constant propagation) If Γ, ∆ ⊢ m and Γ, ∆ ⊢ a : τ and Γ, ∆ ⊢ v : τ and writableΓ a m, then there exists a value v ′ with: mha := viΓ haiΓ = v ′ and v ′ ⊑∆ Γ v : τ. Copying an object w by an assignment results in it being converted to a value tovalΓ w and back. This conversion makes invalid representations of base values indeterminate. Copying an object w byte-wise results in it being converted to bits w and back. This conversion makes all variants of unions unspecified. The following theorem shows that a copy by assignment can be transformed into a byte-wise copy. Theorem 7.11 (Memcpy) If Γ, ∆ ⊢ w : τ , then: ∆ τ ofvalΓ (w1 ) (tovalΓ w) ⊑∆ Γ w ⊑Γ (w)Γ : τ. Unused reads cannot be removed unconditionally in the CH2 O memory model because these have side-effects in the form of uses of the forceΓ operation that updates effective types. We show that uses of forceΓ can be removed for frozen addresses. Theorem 7.12 If Γ, ∆ ⊢ m and mhaiΓ , ⊥ and frozen a, then forceΓ a m ⊑∆ Γ m. 7.3 Reasoning about disjointness In order to prove soundness of the CH2 O axiomatic semantics, we were often in need to to reason about preservation of disjointness under memory operations [33]. This section describes some machinery to ease reasoning about disjointness. We show that our machinery, as originally developed in [31], extends to any separation algebra. Definition 7.13 Disjointness of a list ~x, notation ⊥ ~x, is defined as: 1. ⊥ ε S 2. If ⊥ ~x and x ⊥ ~x, then ⊥ (x ~x) Notice that ⊥ ~x is stronger than having xi ⊥ xj for each i , j. For example, using fractional permissions, we do not have⊥ [ 0.5, 0.5, 0.5 ] whereas 0.5 ⊥ 0.5 clearly holds. Using disjointness of lists we can for example state the associativity law (law 3 of Definition 5.1) in a symmetric way: Fact 7.14 If ⊥ (x y z), then x ∪ (y ∪ z) = (x ∪ y) ∪ z. A Formal C Memory Model for Separation Logic 55 We define a relation ~x1 ≡⊥ ~x2 that expresses that ~x1 and ~x2 behave equivalently with respect to disjointness. Definition 7.15 Equivalence of lists ~x1 and ~x2 with respect to disjointness, notation ~x1 ≡⊥ ~x2 , is defined as: ~x1 ≤⊥ ~x2 := ∀x .⊥ (x ~x1 ) → ⊥ (x ~x2 ) ~x1 ≡⊥ ~x2 := ~x1 ≤⊥ ~x2 ∧ ~x2 ≤⊥ ~x1 It is straightforward to show that ≤⊥ is reflexive and transitive, is respected by concatenation of lists, and is preserved by list containment. Hence, ≡⊥ is an equivalence relation, a congruence with respect to concatenation of lists, and is preserved by permutations. The following results (on arbitrary separation algebras) allow us to reason algebraically about disjointness. Fact 7.16 If ~x1 ≤⊥ ~x2 , then ⊥ ~x1 implies ⊥ ~x2 . Fact 7.17 If ~x1 ≡⊥ ~x2 , then ⊥ ~x1 iff ⊥ ~x2 . Theorem 7.18 We have the following algebraic properties: ∅ ≡⊥ ε x1 ∪ x2 ≡⊥ x1 x2 [ provided that x1 ⊥ x2 ~x ≡⊥ ~x provided that ⊥ ~x x2 ≡⊥ x1 (x2 \ x1 ) provided that x1 ⊆ x2 In Section 7.4 we show that we have similar properties as the above for the specific operations of our memory model. 7.4 The memory as a separation algebra We show that the CH2 O memory model is a separation algebra, and that the separation algebra operations interact appropriately with the memory operations that we have defined in Section 6. In order to define the separation algebra relations and operations on memories, we first define these on memory trees. Memory trees do not form a separation algebra themselves due to the absence of a unique ∅ element (memory trees have a distinct identity element newτΓ for each type τ , see Definition 6.31). The separation algebra of memories is then defined by lifting the definitions on memory trees to memories (which are basically finite functions to memory trees). Definition 7.19 The predicate valid : mtree → Prop is inductively defined as: valid ~ b b) valid (baseτb ~ valid w valid ~b valid w ~ valid (arrayτ w) ~ b) ¬unmapped (w ~ valid (uniont (i, w, ~ b)) #» valid ~b # » ~ valid (structt wb) valid w ~ valid ~b valid (uniont ~b) 56 Robbert Krebbers Fact 7.20 If Γ, ∆ ⊢ w : τ , then valid w. The valid predicate specifies the subset of memory trees on which the separation algebra structure is defined. The definition basically lifts the valid predicate from the b) memory leaves to the trees. The side-condition ¬unmapped (w ~b) on uniont (i, w, ~ trees ensures canonicity, unions whose permissions are unmapped cannot be accessed and are thus kept in unspecified variant. Unmapped unions uniont ~ b can be combined with other unions using ∪. The rationale for doing so will become clear in the context of the separation logic in the author’s PhD thesis [33]. Definition 7.21 The relation ⊥ : mtree → mtree → Prop is inductively defined as: ~b1 ⊥ ~b2 ~ baseτb b1 ⊥ baseτb ~b2 w1 ⊥ w2 w ~1 ⊥ w ~2 arrayτ w ~ 1 ⊥ arrayτ w ~2 #» # #» ~ b1 ⊥ ~ b2 w ~1 ⊥ w ~2 » # » structt w1 ~b1 ⊥ structt w2 ~ b2 ~ b1 ⊥ ~b2 ¬unmapped (w1 ~b1 ) ¬unmapped (w2 ~b2 ) ~ 1 ) ⊥ uniont (i, w2 , ~ uniont (i, w1 , b b2 ) ~b1 ⊥ ~b2 w1 ~ b1 ⊥ ~b2 valid w1 ¬unmapped (w1 ~ b1 ) unmapped ~b2 b2 uniont ~b1 ⊥ uniont ~ b2 uniont (i, w1 , ~ b1 ) ⊥ uniont ~ ~b1 ⊥ w2 ~b2 unmapped ~ b1 valid w2 ¬unmapped (w2 ~ b2 ) uniont ~b1 ⊥ uniont (i, w2 , ~ b2 ) Definition 7.22 The operation ∪ : mtree → mtree → mtree is defined as: b2 ) := baseτb (~b1 ∪ ~ b1 ∪ baseτb ~b2 baseτb ~ arrayτ w ~ 1 ∪ arrayτ w ~2 # » # := arrayτ (w ~1 ∪ w ~ 2) » # » # » structt w1 ~ b1 ∪ structt w2 ~b2 uniont (i, w1 , ~ b1 ) ∪ uniont (i, w2 , ~ b2 ) := structt (w1 ~b1 ∪ w2 ~ b2 ) := uniont (i, w1 ∪ w2 , ~ b1 ∪ ~b2 ) uniont ~ b1 ∪ uniont ~ b1 ~ ~ uniont (i, w1 , b1 ) ∪ uniont b2 b1 ∪ uniont (i, w2 , ~ b2 ) uniont ~ := uniont (~b1 ∪ ~b2 ) ˆ ~b2 := uniont (i, w1 , ~ b1 ) ∪ ˆ ~b1 := uniont (i, w2 , ~ b2 ) ∪ ˆ ~b is a modified version of the memory tree w in which the In the last two clauses, w ∪ elements on the leaves of w are zipped with ~b using the ∪ operation on permission annotated bits (see Definitions 6.38 and 5.8). The definitions of valid, ⊥ and ∪ on memory trees satisfy all laws of a separation algebra (see Definition 5.1) apart from those involving ∅. We prove the cancellation law explicitly since it involves the aforementioned side-conditions on unions. Lemma 7.23 If w3 ⊥ w1 and w3 ⊥ w2 then: w3 ∪ w1 = w1 ∪ w2 implies w1 = w2 . A Formal C Memory Model for Separation Logic 57 Proof By induction on the derivations w3 ⊥ w1 and w3 ⊥ w2 . We consider one case: uniont (i, w3 , ~ b3 ) ⊥ uniont (i, w1 , ~ b1 ) uniont (i, w3 , ~ b3 ) ⊥ uniont ~b2 ~ 3 ) ∪ uniont (i, w1 , b ~ 1 ) = uniont (i, w3 , ~ uniont (i, w3 , b b3 ) ∪ uniont ~b2 uniont (i, w1 , ~ b1 ) = uniont ~b2 b1 = w3 ~ b3 ∪ ~b2 by assumption, and therefore w1 ~b1 = ~b2 Here, we have w3 ~b3 ∪ w1 ~ by the cancellation law of a separation algebra. However, by assumption we also have ¬unmapped (w1 ~b1 ) and unmapped ~ b2 , which contradicts w1 ~ b1 = ~ b2 . Definition 7.24 The separation algebra of memories is defined as: valid m := ∀o w µ . m o = (w, µ) → (valid w and not w all (∅, E)) m1 ⊥ m2 := ∀o . P m1 m2 o m1 ∪ m2 := λo . f m1 m2 o P : mem → mem → index → Prop and f : mem → mem → index → option mtree are defined by case analysis on m1 o and m2 o: m1 o m2 o (w1 , µ) (w1 , µ) (w1 , µ) ⊥ ⊥ (w2 , µ) τ1 ⊥ ⊥ τ2 ⊥ ⊥ otherwise P m1 m2 o f m1 m2 o w1 ⊥ w2 , not w1 all (∅, E) and not w2 all (∅, E) (w1 ∪ w2 , µ) valid w1 and not w1 all (∅, E) (w1 , µ) valid w2 and not w2 all (∅, E) (w2 , µ) True τ1 True τ2 True ⊥ False ⊥ The definitions of the omitted relations and operations are as expected. The emptiness conditions ensure canonicity. Objects that solely consist of indeterminate bits with ∅ permission are meaningless and should not be kept at all. These conditions are needed for cancellativity. Fact 7.25 If Γ, ∆ ⊢ m, then valid m. Lemma 7.26 If m1 ⊥ m2 , then: Γ, ∆ ⊢ m1 ∪ m2 iff Γ, ∆ ⊢ m1 and Γ, ∆ ⊢ m2 . Notice that the memory typing environment ∆ is not subdivided among m1 and m2 . Consider the memory state corresponding to int x = 10, *p = &x: ox 7→ w, op 7→ • = ox 7→ w ∪ op 7→ • Here, w is the memory tree that represents the integer value 10. The pointer on the right hand side is well-typed in the memory environment ox 7→ w, op 7→ • of the whole memory, but not in op 7→ •. We prove some essential properties about the interaction between the separation algebra operations and the memory operations. These properties will be used in the soundness proof of the separation logic in the author’s PhD thesis [33]. 58 Robbert Krebbers Lemma 7.27 (Preservation of lookups) If Γ, ∆ ⊢ m1 and m1 ⊆ m2 , then: m1 haiΓ = v implies m2 haiΓ = v writableΓ a m1 implies writableΓ a m2 The relation ⊆ is part of a separation algebra, see Definition 5.1. We have m1 ⊆ m2 iff there is an m3 with m1 ⊥ m3 and m2 = m1 ∪ m3 . Lemma 7.28 (Preservation of disjointness) If Γ, ∆ ⊢ m then: m ≤⊥ forceΓ a m if Γ, ∆ ⊢ a : τ and mhaiΓ , ⊥ m ≤⊥ mha := viΓ if Γ, ∆ ⊢ a : τ and writableΓ a m m ≤⊥ lockΓ a m if Γ, ∆ ⊢ a : τ and writableΓ a m m ≤⊥ unlock Ω m if Ω ⊆ locks m The relation ≤⊥ is defined in Definition 7.15. If m ≤⊥ m′ , then each memory that is disjoint to m is also disjoint to m′ . As a corollary of the above lemma and Fact 7.16 we obtain that m1 ⊥ m2 implies disjointness of the memory operations: forceΓ a m1 ⊥ m2 m1 ha := viΓ ⊥ m2 lockΓ a m1 ⊥ m2 unlock Ω m1 ⊥ m2 Lemma 7.29 (Unions distribute) If Γ, ∆ ⊢ m and m1 ⊥ m2 then: forceΓ a (m1 ∪ m2 ) = forceΓ a m1 ∪ m2 (m1 ∪ m2 )ha := viΓ = m1 ha := viΓ ∪ m2 lockΓ a (m1 ∪ m2 ) = lockΓ a m1 ∪ m2 unlock Ω (m1 ∪ m2 ) = unlock Ω m1 ∪ m2 if Γ, ∆ ⊢ a : τ and m1 haiΓ , ⊥ if Γ, ∆ ⊢ {a, v} : τ and writableΓ a m1 if Γ, ∆ ⊢ a : τ and writableΓ a m1 if Ω ⊆ locks m1 Memory trees and memories can be generalized to contain elements of an arbitrary separation algebra as leaves instead of just permission annotated bits [32]. These generalized memories form a functor that lifts the separation algebra structure on the leaves to entire trees. We have taken this approach in the Coq development, but for brevity’s sake, we have refrained from doing so in this paper. 8 Formalization in Coq Real-world programming language have a large number of features that require large formal descriptions. As this paper has shown, the C programming language is not different in this regard. On top of that, the C semantics is very subtle due to an abundance of delicate corner cases. Designing a semantics for C and proving properties about such a semantics therefore inevitably requires computer support. For these reasons, we have used the Coq proof assistant [15] to formalize all definitions and theorems in this paper. Although Coq does not guarantee the absence of mistakes in our definitions, it provides a rigorous set of checks on our definitions. Already Coq’s type checking of definitions provides an effective sanity check. On top of that, we have used Coq to prove all metatheoretical results stated in this paper. Last but not least, using Coq’s program extraction facility we have extracted an exploration tool to test our memory model on small example programs [37, 33]. A Formal C Memory Model for Separation Logic 59 8.1 Overloaded typing judgments Type classes are used to overload notations for typing judgments (we have 25 different typing judgments). The class Valid is used for judgments without a type, such as ⊢ Γ and Γ, ∆ ⊢ m. Class Valid (E A : Type) := valid: E → A → Prop. Notation " X { Γ }" := (valid Γ). Notation " X { Γ }*" := (Forall ( X {Γ})). We use product types to represent judgments with multiple environments such as Γ, ∆ ⊢ m. The notation X{Γ}* is used to lift the judgment to lists. The class Typed is used for judgments such as Γ, ∆ ⊢ v : τ and Γ, ∆, ~τ ⊢ e : τlr . Class Typed (E T V : Type) := typed: E → V → T → Prop. Notation "Γ ⊢ v : τ " := (typed Γ v τ ). Notation "Γ ⊢* vs :* τ s" := (Forall2 (typed Γ) vs τ s). 8.2 Implementation defined behavior Type classes are used to parametrize the whole Coq development by implementation defined parameters such as integer sizes. For example, Lemma 6.51 looks like: Lemma to_of_val ‘{EnvSpec K} Γ ∆ γs v τ : X Γ → (Γ,∆) ⊢ v : τ → length γs = bit_size_of Γ τ → to_val Γ (of_val Γ γs v) = freeze true v. The parameter EnvSpec K is a type class describing an implementation environment with ranks K (Definition 4.12). Just as in this paper, the type K of integer ranks is a parameter of the inductive definition of types (see Definition 4.1) and is propagated through all syntax. Inductive signedness := Signed | Unsigned. Inductive int_type (K: Set) := IntType { sign: signedness; rank: K }. The definition of the type class EnvSpec is based on the approach of Spitters and van der Weegen approach [55]. We have a separate class Env for the operations that is an implicit parameter of the whole class and all lemmas. Class Env (K: Set) := { env_type_env :> IntEnv K; size_of : env K → type K → nat; align_of : env K → type K → nat; field_sizes : env K → list (type K) → list nat }. Class EnvSpec (K: Set) ‘{Env K} := { int_env_spec :>> IntEnvSpec K; size_of_ptr_ne_0 Γ τp : size_of Γ (τp .*) , 0; size_of_int Γ τi : size_of Γ (intT τi ) = rank_size (rank τi ); ... }. 60 Robbert Krebbers 8.3 Partial functions Although many operations in CH2 O are partial, we have formalized many such operations as total functions that assign an appropriate default value. We followed the approach presented in Section 5.2 where operations are combined with a validity predicate that describes in which case they may be used. For example, part (2) of Lemma 7.29 is stated in the Coq development as follows: Lemma mem_insert_union ‘{EnvSpec K} Γ ∆ m1 m2 a1 v1 τ1 : X Γ → X {Γ,∆} m1 → m1 ⊥ m2 → (Γ,∆) ⊢ a1 : TType τ 1 → mem_writable Γ a1 m1 → (Γ,∆) ⊢ v1 : τ1 → <[a1:=v1]{Γ}>(m1 ∪ m2) = <[a1:=v1]{Γ}>m1 ∪ m2. Here, m1 ⊥ m2 is the side-condition of m1 ∪ m2, and mem_writable Γ a1 m1 the side-condition of <[a1:=v1]{Γ}>m1. Alternatives approaches include using the option monad or dependent types, but our approach proved more convenient. In particular, since most validy predicates are given by an inductive definition, various proofs could be done by induction on the structure of the validy predicate. The cases one has to consider correspond exactly to the domain of the partial function. Admissible side-conditions, such as in the above example <[a1:=v1]{Γ}>m1 ⊥ m2 and mem_writable Γ a1 (m1 ∪ m2), do not have to be stated explicitly and follow from the side-conditions that are already there. By avoiding the need to state admissible side-conditions, we avoid a blow-up in the number of side-conditions of many lemmas. We thus reduce the proof effort needed to use such a lemma. 8.4 Automation The proof style deployed in the CH2 O development combines interactive proofs with automated proofs. In this section we describe some tactics and forms of proof automation deployed in the CH2 O development. Small inversions. Coq’s inversion tactic has two serious shortcomings on inductively defined predicates with many constructors. It is rather slow and its way of controlling of names for variables and hypotheses is deficient. Hence, we are often using the technique of small inversions by Monin and Shi [43] that improves on both shortcomings. Solving disjointness. We have used Coq’s setoid machinery [54] to enable rewriting using the relations ≤⊥ and ≡⊥ (Definition 7.15). Using this machinery, we have implemented a tactic that automatically solves entailments of the form: H0 : ⊥ ~x0 , . . . , Hn : ⊥ ~xn−1 ⊢ ⊥ ~x where ~x and ~xi (for i < n) are arbitrary Coq expressions built from ∅, ∪ and This tactic works roughly as follows: S . 1. Simplify hypotheses using Theorem 7.18. 2. Solve side-conditions by simplification using Theorem 7.18 and a solver for list containment (implemented by reflection). A Formal C Memory Model for Separation Logic 61 3. Repeat these steps until no further simplification is possible. 4. Finally, solve the goal by simplification using Theorem 7.18 and list containment. This tactic is not implemented using reflection, but that is something we intend to do in future work to improve its performance. First-order logic. Many side-conditions we have encountered involve simple entailments of first-order logic such as distributing logical quantifiers combined with some propositional reasoning. Coq does not provide a solver for first-order logic apart from the firstorder tactic whose performance is already insufficient on small goals. We have used Ltac to implemented an ad-hoc solver called naive_solver, which performs a simple breath-first search proof search. Although this tactic is inherently incomplete and suffers from some limitations, it turned out to be sufficient to solve many uninteresting side-conditions (without the need for classical axioms). 8.5 Overview of the Coq development The Coq development of the memory model, which is entirely constructive and axiom free, consists of the following parts: Component Sections LOC Support library (lists, finite sets, finite maps, etc.) Types & Integers Permissions & separation algebras Memory model Refinements Memory as separation algebra Total Section Section Section Section Section Section 12 524 1 928 1 811 8 736 4 046 3 844 32 889 2 4 5 6 7.2 7.4 9 Related work The idea of using a memory model based on trees instead of arrays of plain bits, and the idea of using pointers based on paths instead of offsets, has already been used for object oriented languages. It goes back at least to Rossie and Friedman [51], and has been used by Ramananandro et al. [48] for C++. Furthermore, many researchers have considered connections between unstructured and structured views of data in C [56, 14, 2, 21] in the context of program logics. However, a memory model that combines an abstract tree based structure with low-level object representations in terms of bytes has not been explored before. In this section we will describe other formalization of the C memory model. Norrish (1998) Norrish has formalized a significant fragment of the C89 standard using the proof assistant HOL4 [44, 45]. He was the first to describe non-determinism and sequence points formally. Our treatment of these features has partly been based on his work. Norrish’s formalization of the C type system has some similarities with our type system: he has also omitted features that can be desugared and has proven type preservation. 62 Robbert Krebbers Contrary to our work, Norrish has used an unstructured memory model based on sequences of bytes. Since he has considered the C89 standard in which effective types (and similar notions) were not introduced yet, his choice is appropriate. For C99 and beyond, a more detailed memory model like ours is needed, see also Section 3 and Defect Report #260 and #451 [26]. Another interesting difference is that Norrish represents abstract values (integers, pointers and structs) as sequences of bytes instead of mathematical values. Due to this, padding bytes retain their value while structs are copied. This is not faithful to the C99 standard and beyond. Leroy et al. (2006) Leroy et al. have formalized a significant part of C using the Coq proof assistant [38, 39]. Their part of C, which is called CompCert C, covers most major features of C and can be compiled into assembly (PowerPC, ARM and x86) using a compiler written in Coq. Their compiler, called CompCert, has been proven correct with respect to the CompCert C and assembly semantics. The goal of CompCert is essentially different from CH2 O’s. What can be proven with respect to the CompCert semantics does not have to hold for any C11 compiler, it just has to hold for the CompCert compiler. CompCert is therefore in its semantics allowed to restrict implementation defined behaviors to be very specific (for example, it uses 32 bits ints since it targets only 32-bits computing architectures) and allowed to give a defined semantics to various undefined behaviors (such as sequence point violations, violations of effective types, and certain uses of dangling pointers). The CompCert memory model is used by all languages (from C until assembly) of the CompCert compiler [41, 40]. The CompCert memory is a finite partial function from object identifiers to objects. Each local, global and static variable, and invocation of malloc is associated with a unique object identifier of a separate object in memory. We have used the same approach in CH2 O, but there are some important differences. The paragraphs below discuss the relation of CH2 O with the first and second version of the CompCert memory model. Leroy and Blazy (2008) In the first version of the CompCert memory model [41], objects were represented as arrays of type-annotated fragments of base values. Examples of bytes are thus “the 2nd byte of the short 13” or “the 3rd byte of the pointer (o, i)”. Pointers were represented as pairs (o, i) where o is an object identifier and i the byte offset into the object o. Since bytes are annotated with types and could only be retrieved from memory using an expression of matching type, effective types on the level of base types are implicitly described. However, this does not match the C11 standard. For example, Leroy and Blazy do assign the return value 11 to the following program: struct S1 { int x; }; struct S2 { int y; }; int f(struct S1 *p, struct S2 *q) { p->x = 10; q->y = 11; return p->x; } int main() { union U { struct S1 s1; struct S2 s2; } u; A Formal C Memory Model for Separation Logic 63 printf("%d\n", f(&u.s1, &u.s2)); } This code strongly resembles example [27, 6.5.2.3p9] from the C11 standard, which is stated to have undefined behavior6 . GCC and Clang optimize this code to print 10, which differs from the value assigned by Leroy and Blazy. Apart from assigning too much defined behavior, Leroy and Blazy’s treatment of effective types also prohibits any form of “bit twiddling”. Leroy and Blazy have introduced the notion of memory injections in [41]. This notion allows one to reason about memory transformations in an elegant way. Our notion of memory refinements (Section 7.2) generalize the approach of Leroy and Blazy to a tree based memory model. Leroy et al. (2012) The second version of CompCert memory model [40] is entirely untyped and is extended with permissions. Symbolic bytes are only used for pointer values and indeterminate storage, whereas integer and floating point values are represented as numerical bytes (integers between 0 and 28 − 1). We have extended this approach by analogy to bit-representations, representing indeterminate storage and pointer values using symbolic bits, and integer values using concrete bits. This choice is detailed in Section 6.2. As an extension of CompCert, Robert and Leroy have formally proven soundness of an alias analysis [50]. Their alias analysis is untyped and operates on the RTL intermediate language of CompCert. Beringer et al. [7] have developed an extension of CompCert’s memory injections to reason about program transformations in the case of separate compilation. The issues of separate compilation are orthogonal to those that we consider. Appel et al. (2014) The Verified Software Toolchain (VST) by Appel et al. provides a higher-order separation logic for Verifiable C, which is a variant of CompCert’s intermediate language Clight [3]. The VST is intended to be used together with the CompCert compiler. It gives very strong guarantees when done so. The soundness proof of the VST in conjunction with the correctness proof of the CompCert compiler ensure that the proven properties also hold for the generated assembly. In case the verified program is compiled with a compiler different from CompCert, the trust in the program is still increased, but no full guarantees can be given. That is caused by the fact that CompCert’s intermediate language Clight uses a specific evaluation order and assigns defined behavior to many undefined behaviors of the C11 standard. For example, Clight assigns defined behavior to violations of effective types and sequence point violations. The VST inherits these defined behaviors from CompCert and allows one to use them in proofs. Since the VST is linked to CompCert, it uses CompCert’s coarse permission system on the level of the operational semantics. Stewart and Appel [3, Chapter 42] have introduced a way to use a more fine grained permission system at the level of the separation logic without having to modify the Clight operational semantics. Their approach shows its merits when used for concurrency, in which case the memory model contains ghost data related to the conditions of locks [23, 24]. 6 We have modified the example from the standard slightly in order to trigger optimizations by GCC and Clang. 64 Robbert Krebbers Besson et al. (2014) Besson et al. have proposed an extension of the CompCert memory model that assigns a defined semantics to operations that rely on the numerical values of uninitialized memory and pointers [8]. Objects in their memory model constitute of lazily evaluated values described by symbolic expressions. These symbolic expressions are used to delay the evaluation of operations on uninitialized memory and pointer values. Only when a concrete value is needed (for example in case of the controlling expression of an if-then-else, for, or while statement), the symbolic expression is normalized. Consider: int x, *p = &x; int y = ((unsigned char*)p)[1] | 1; // y has symbolic value "2nd pointer byte of p" | 1 if (y & 1) printf("one\n"); // unique normalization -> OK if (y & 2) printf("two\n"); // no unique normalization -> bad The value of ((unsigned char*)p)[1] | 1 is not evaluated eagerly. Instead, the assignment to y stores a symbolic expression denoting this value. During the execution of the first if statement, the actual value of y & 1 is needed. In this case, y & 1 has the value 1 for any possible numerical value of ((unsigned char*)p)[1]. As a result, the string one is printed. The semantics of Besson et al. is deterministic by definition. Normalization of symbolic expressions has defined behavior if and only if the expression can be normalized to a unique value under any choice of numeral values for pointer representations and uninitialized storage. In the second if statement this is not the case. The approach of Besson et al. gives a semantics to some programming techniques that rely on the numerical representations of pointers and uninitialized memory. For example, it gives an appropriate semantics to pointer tagging in which unused bits of a pointer representation are used to store additional information. However, as already observed by Kang et al. [28], Besson et al. do not give a semantics to many other useful cases. For example, printing the object representation of a struct, or computing the hash of a pointer value, is inherently non-deterministic. The approach of Besson et al. assigns undefined behavior to these use cases. The goal of Besson et al. is inherently different from ours. Our goal is to describe the C11 standard faithfully whereas Besson et al. focus on de facto versions of C. They intentionally assign defined behavior to many constructs involving uninitialized memory that are clearly undefined according to the C11 standard, but that are nonetheless faithfully compiled by specific compilers. Ellison and Roşu (2012) Ellison and Roşu [19, 18] have developed an executable semantics of the C11 standard using the K-framework7 . Their semantics is very comprehensive and describes all features of a freestanding C implementation [27, 4p6] including some parts of the standard library. It furthermore has been thoroughly tested against test suites (such as the GCC torture test suite), and has been used as an oracle for compiler testing [49]. Ellison and Roşu support more C features than we do, but they do not have infrastructure for formal proofs, and thus have not established any metatheoretical properties about their semantics. Their semantics, despite being written in a formal framework, should more be seen as a debugger, a state space search tool, or possibly, 7 This work has been superseded by Hathhorn et al. [22], which is described below. A Formal C Memory Model for Separation Logic 65 as a model checker. It is unlikely to be of practical use in proof assistants because it is defined on top of a large C abstract syntax and uses a rather ad-hoc execution state that contains over 90 components. Similar to our work, Ellison and Roşu’s goal is to exactly describe the C11 standard. However, for some programs their semantics is less precise than ours, which is mainly caused by their memory model, which is less principled than ours. Their memory model is based on CompCert’s: it is essentially a finite map of objects consisting of unstructured arrays of bytes. Hathhorn et al. (2015) Hathhorn et al. [22] have extended the work of Ellison and Roşu to handle more underspecification of C11. Most importantly, the memory model has been extended and support for the type qualifiers const, restrict and volatile has been added. Hathhorn et al. have extended the original memory model (which was based on CompCert’s) with decorations to handle effective types, restrictions on padding and the restrict qualifier. Effective types are modeled by a map that associates a type to each object. Their approach is less fine-grained than ours and is unable to account for active variants of unions. It thus does not assign undefined behavior to important violations of effective types and in turn does not allow compilers to perform optimizations based on type-based alias analysis. For example: // Undefined behavior in case f is called with aliased // pointers due to effective types int f(short *p, int *q) { *p = 10; *q = 11; return *p; } int main() { union { short x; int y; } u = { .y = 0 }; return f(&u.x, &u.y); } The above program has undefined behavior due to a violation of effective types. This is captured by our tree based memory model, but Hathhorn et al. require the program to return the value 11. When compiled with GCC or Clang with optimization level -O2, the compiled program returns the value 10. Hathhorn et al. handle restrictions on padding bytes in the case of unions, but not in the case of structs. For example, the following program returns the value 1 according to their semantics, whereas it has unspecified behavior according to the C11 standard [27, 6.2.6.1p6] (see also Section 3.2): struct S { char a; int b; } s; ((unsigned char*)(&s))[1] = 1; s.a = 10; // Makes the padding bytes of ’s’ indeterminate return ((unsigned char*)(&s))[1]; The restrictions on paddings bytes are implicit in our memory model based on structured trees, and thus handled correctly. The above examples provide evidence that a structured approach, especially combined with metatheoretical results, is more reliable than depending on ad-hoc decorations. Kang et al. (2015) Kang et al. [28] have proposed a memory model that gives a semantics to pointer to integer casts. Their memory model uses a combination of 66 Robbert Krebbers numerical and symbolic representations of pointer values (whereas CompCert and CH2 O always represent pointer values symbolically). Initially each pointer is represented symbolically, but whenever the numerical representation of a pointer is needed (due to a pointer to integer cast), it is non-deterministically realized. The memory model of Kang et al. gives a semantics to pointer to integer casts while allowing common compiler optimizations that are invalid in a naive low-level memory model. They provide the following motivating example: void g(void) { ... } int f(void) { int a = 0; g(); return a; } In a concrete memory model, there is the possibility that the function g is able to guess the numerical representation of &a, and thereby access or even modify a. This is undesirable, because it prevents the widely used optimization of constant propagation, which optimizes the variable a out. In the CompCert and CH2 O memory model, where pointers are represented symbolically, it is guaranteed that f has exclusive control over a. Since &a has not been leaked, g can impossibly access a. In the memory model of Kang et al. a pointer will only be given a numerical representation when it is cast to an integer. In the above code, no such casts appear, and g cannot access a. The goal of Kang et al. is to give a unambiguous mathematical model for pointer to integer casts, but not necessarily to comply with C11 or existing compilers. Although we think that their model is a reasonable choice, it is unclear whether it is faithful to the C11 standard in the context of Defect Report #260 [26]. Consider: int x = 0, *p = 0; for (uintptr_t i = 0; ; i++) { if (i == (uintptr_t)&x) { p = (int*)i; break; } } *p = 15; printf("%d\n", x); Here we loop through the range of integers of type uintptr_t until we have found the integer representation i of &x, which we then assign to the pointer p. When compiled with gcc -O2 (version 4.9.2), the generated assembly no longer contains a loop, and the pointers p and q are assumed not to alias. As a result, the program prints the old value of x, namely 0. In the memory model of Kang et al. the pointer obtained via the cast (int*)i is exactly the same as &x. In their model the program thus has defined behavior and is required to print 15. We have reported this issue to the GCC bug tracker8 . However it unclear whether the GCC developers consider this a bug or not. Some developers seem to believe that this program has undefined behavior and that GCC’s optimizations are thus justified. Note that the cast (intptr_t)&x is already forbidden by the type system of CH2 O. 8 See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65752 . A Formal C Memory Model for Separation Logic 67 10 Conclusion In this paper we have given a formal description of a significant part of the nonconcurrent C11 memory model. This formal description has been used in [37, 33] as part of an an operational, executable and axiomatic semantics of C. On top of this formal description, we have provided a comprehensive collection of metatheoretical results. All of these results have been formalized using the Coq proof assistant. It would be interesting to investigate whether our memory model can be used to help the standard committee to improve future versions of the standard. For example, whether it could help to improve the standard’s prose description of effective types. As indicated on page 4 of Section 1, the standard’s description is not only ambiguous, but also does not cover its intent to enable type-based alias analysis. The description of our memory model is unambiguous and allows one to express intended consequences formally. We have formally proven soundness of an abstract version of type-based alias analysis with respect to our memory model (Theorem 7.2). An obvious direction for future work is to extend the memory model with additional features. We give an overview of some features of C11 that are absent. – Floating point arithmetic. Representations of floating point numbers and the behaviors of floating point arithmetic are subject to a considerable amount of implementation defined behavior [27, 5.2.4.2.2]. First of all, one could restrict to IEEE-754 floating point arithmetic, which has a clear specification [25] and a comprehensive formalization in Coq [10]. Boldo et al. have taken this approach in the context of CompCert [9] and we see no fundamental problems applying it to CH2 O as well. Alternatively, one could consider formalizing all implementation defined aspects of the description of floating arithmetic in the C11 standard. – Bitfields. Bitfields are fields of struct types that occupy individual bits [27, 6.7.2.1p9]. We do not foresee fundamental problems adding bitfields to CH2 O as bits already constitute the smallest unit of storage in our memory model. – Untyped malloc. CH2 O supports dynamic memory allocation via an operator allocτ e close to C++’s new operator. The allocτ e operator yields a τ ∗ pointer to storage for an τ -array of length e. This is different from C’s malloc function that yields a void* pointer to storage of unknown type [27, 7.22.3.4]. Dynamic memory allocation via the untyped malloc function is closely related to unions and effective types. Only when dynamically allocated storage is actually used, it will receive an effective type. We expect one could treat malloced objects as unions that range over all possible types that fit. – Restrict qualifiers. The restrict qualifier can be applied to any pointer type to express that the pointers do not alias. Since the description in the C11 standard [27, 6.7.3.1] is ambiguous (most notably, it is unclear how it interacts with nested pointers and data types), formalization and metatheoretical proofs may provide prospects for clarification. – Volatile qualifiers. The volatile qualifier can be applied to any type to indicate that its value may be changed by an external process. It is meant to prevent compilers from optimizing away data accesses or reordering these [27, footnote 134]. Volatile accesses should thus be considered as a form of I/O. – Concurrency and atomics. Shared-memory concurrency and atomic operations are the main omission from the C11 standard in the CH2 O semantics. 68 Robbert Krebbers Although shared-memory concurrency is a relatively new addition to the C and C++ standards, there is already a large body of ongoing work in this direction, see for example [53, 5, 52, 57, ?]. These works have led to improvements of the standard text. There are still important open problems in the area of concurrent memory models for already small sublanguages of C [4]. Current memory models for these sublanguages involve just features specific to threads and atomic operations whereas we have focused on structs, unions, effective types and indeterminate memory. We hope that both directions are largely orthogonal and will eventually merge into a fully fledged C11 memory model and semantics. Acknowledgments. I thank my supervisors Freek Wiedijk and Herman Geuvers for their helpful suggestions. I thank Xavier Leroy, Andrew Appel, Lennart Beringer and Gordon Stewart for many discussions on the CompCert memory model, and the anonymous reviewers for their feedback. This work is financed by the Netherlands Organisation for Scientific Research (NWO), project 612.001.014. References 1. R. Affeldt and N. Marti. Towards formal verification of TLS network packet processing written in C. In PLPV, pages 35–46, 2013. 2. R. Affeldt and K. Sakaguchi. An Intrinsic Encoding of a Subset of C and its Application to TLS Network Packet Processing. JFR, 7(1), 2014. 3. A. W. Appel, editor. Program Logics for Certified Compilers. Cambridge University Press, 2014. 4. M. Batty, K. Memarian, K. Nienhuis, J. Pichon-Pharabod, and P. Sewell. The Problem of Programming Language Concurrency Semantics, 2015. To appear in ESOP. 5. M. Batty, S. Owens, S. Sarkar, P. Sewell, and T. Weber. Mathematizing C++ concurrency. In POPL, pages 55–66, 2011. 6. J. Bengtson, J. B. Jensen, F. Sieczkowski, and L. Birkedal. Verifying Object-Oriented Programs with Higher-Order Separation Logic in Coq. In ITP, volume 6898 of LNCS, pages 22–38, 2011. 7. L. Beringer, G. Stewart, R. Dockins, and A. W. Appel. Verified Compilation for SharedMemory C. In ESOP, volume 8410 of LNCS, pages 107–127, 2014. 8. F. Besson, S. Blazy, and P. Wilke. A Precise and Abstract Memory Model for C Using Symbolic Values. In APLAS, volume 8858 of LNCS, pages 449–468, 2014. 9. S. Boldo, J.-H. Jourdan, X. Leroy, and G. Melquiond. A Formally-Verified C Compiler Supporting Floating-Point Arithmetic. In ARITH, pages 107–115, 2013. 10. S. Boldo and G. Melquiond. Flocq: A Unified Library for Proving Floating-Point Algorithms in Coq. In ARITH, pages 243–252, 2011. 11. R. Bornat, C. Calcagno, P. W. O’Hearn, and M. J. Parkinson. Permission Accounting in Separation Logic. In POPL, pages 259–270, 2005. 12. J. Boyland. Checking Interference with Fractional Permissions. In SAS, volume 2694 of LNCS, pages 55–72, 2003. 13. C. Calcagno, P. W. O’Hearn, and H. Yang. Local Action and Abstract Separation Logic. In LICS, pages 366–378, 2007. 14. E. Cohen, M. Moskal, S. Tobies, and W. Schulte. A Precise Yet Efficient Memory Model For C. ENTCS, 254:85–103, 2009. 15. Coq Development Team. The Coq Proof Assistant Reference Manual, 2015. Available at https://coq.inria.fr/doc/. 16. E. W. Dijkstra. Cooperating sequential processes. In Programming Languages: NATO Advanced Study Institute, pages 43–112. Academic Press, 1968. 17. R. Dockins, A. Hobor, and A. W. Appel. A Fresh Look at Separation Algebras and Share Accounting. In APLAS, volume 5904 of LNCS, pages 161–177, 2009. 18. C. Ellison. A Formal Semantics of C with Applications. PhD thesis, University of Illinois, 2012. A Formal C Memory Model for Separation Logic 69 19. C. Ellison and G. Roşu. An executable formal semantics of C with applications. In POPL, pages 533–544, 2012. 20. GCC. The GNU Compiler Collection. Website, available at http://gcc.gnu.org/. 21. D. Greenaway, J. Lim, J. Andronick, and G. Klein. Don’t Sweat the Small Stuff: Formal Verification of C Code Without the Pain. In PLDI, pages 429–439, 2014. 22. C. Hathhorn, C. Ellison, and G. Roşu. Defining the Undefinedness of C. In PLDI, pages 336–345, 2015. 23. A. Hobor. Oracle Semantics. PhD thesis, Princeton University, 2008. 24. A. Hobor, A. W. Appel, and F. Z. Nardelli. Oracle Semantics for Concurrent Separation Logic. In ESOP, volume 4960 of LNCS, pages 353–367, 2008. 25. IEEE Computer Society. 754-2008: IEEE Standard for Floating Point Arithmetic. IEEE, 2008. 26. ISO. WG14 Defect Report Summary. Website, available at http://www.open-std.org/jtc1/sc22/wg14/www/docs/ . 27. ISO. ISO/IEC 9899-2011: Programming languages – C. ISO Working Group 14, 2012. 28. J. Kang, C.-K. Hur, W. Mansky, D. Garbuzov, S. Zdancewic, and V. Vafeiadis. A Formal C Memory Model Supporting Integer-Pointer Casts. In PLDI, 2015. 29. G. Klein, R. Kolanski, and A. Boyton. Mechanised Separation Algebra. In ITP, volume 7406 of LNCS, pages 332–337, 2012. 30. R. Krebbers. Aliasing restrictions of C11 formalized in Coq. In CPP, volume 8307 of LNCS, 2013. 31. R. Krebbers. An Operational and Axiomatic Semantics for Non-determinism and Sequence Points in C. In POPL, pages 101–112, 2014. 32. R. Krebbers. Separation algebras for C verification in Coq. In VSTTE, volume 8471 of LNCS, pages 150–166, 2014. 33. R. Krebbers. The C standard formalized in Coq. PhD thesis, Radboud University, 2015. Manuscript accepted by the committee, available online at http://robbertkrebbers.nl/research/thesis_draft.pdf. 34. R. Krebbers, X. Leroy, and F. Wiedijk. Formal C semantics: CompCert and the C standard. In ITP, volume 8558 of LNCS, pages 543–548, 2014. 35. R. Krebbers and F. Wiedijk. A Formalization of the C99 Standard in HOL, Isabelle and Coq. In CICM, volume 6824 of LNCS, pages 297–299, 2011. 36. R. Krebbers and F. Wiedijk. Separation Logic for Non-local Control Flow and Block Scope Variables. In FoSSaCS, volume 7794 of LNCS, pages 257–272, 2013. 37. R. Krebbers and F. Wiedijk. A Typed C11 Semantics for Interactive Theorem Proving. In CPP, pages 15–27, 2015. 38. X. Leroy. Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In POPL, pages 42–54, 2006. 39. X. Leroy. Formal verification of a realistic compiler. CACM, 52(7):107–115, 2009. 40. X. Leroy, A. W. Appel, S. Blazy, and G. Stewart. The CompCert Memory Model, Version 2. Research report RR-7987, INRIA, 2012. Revised version available as Chapter 32 of [3]. 41. X. Leroy and S. Blazy. Formal verification of a C-like memory model and its uses for verifying program transformations. JAR, 41(1):1–31, 2008. 42. N. Maclaren. What is an Object in C Terms?, 2001. Mailing list message, available at http://www.open-std.org/jtc1/sc22/wg14/9350. 43. J. Monin and X. Shi. Handcrafted Inversions Made Operational on Operational Semantics. In ITP, volume 7998 of LNCS, pages 338–353, 2013. 44. M. Norrish. C formalised in HOL. PhD thesis, University of Cambridge, 1998. 45. M. Norrish. Deterministic Expressions in C. In ESOP, volume 1576 of LNCS, pages 147–161, 1999. 46. P. W. O’Hearn. Resources, Concurrency and Local Reasoning. In CONCUR, volume 3170 of LNCS, pages 49–67, 2004. 47. P. W. O’Hearn, J. C. Reynolds, and H. Yang. Local Reasoning about Programs that Alter Data Structures. In CSL, volume 2142 of LNCS, pages 1–19, 2001. 48. T. Ramananandro, G. Dos Reis, and X. Leroy. Formal verification of object layout for C++ multiple inheritance. In POPL, pages 67–80, 2011. 49. J. Regehr, Y. Chen, P. Cuoq, E. Eide, C. Ellison, and X. Yang. Test-case reduction for C compiler bugs. In PLDI, pages 335–346, 2012. 50. V. Robert and X. Leroy. A Formally-Verified Alias Analysis. In CPP, volume 7679 of LNCS, pages 11–26, 2012. 70 Robbert Krebbers 51. J. G. Rossie and D. P. Friedman. An Algebraic Semantics of Subobjects. In OOPSLA, pages 187–199, 1995. 52. J. Sevcı́k, V. Vafeiadis, F. Z. Nardelli, S. Jagannathan, and P. Sewell. CompCertTSO: A Verified Compiler for Relaxed-Memory Concurrency. JACM, 60(3):22, 2013. 53. P. Sewell, S. Sarkar, S. Owens, F. Z. Nardelli, and M. O. Myreen. x86-TSO: a rigorous and usable programmer’s model for x86 multiprocessors. CACM, 53(7):89–97, 2010. 54. M. Sozeau. A New Look at Generalized Rewriting in Type Theory. JFR, 2(1), 2010. 55. B. Spitters and E. van der Weegen. Type Classes for Mathematics in Type Theory. Mathematical Structures in Computer Science, 21(4):795–825, 2011. 56. H. Tuch, G. Klein, and M. Norrish. Types, bytes, and separation logic. In POPL, pages 97–108, 2007. 57. V. Vafeiadis, T. Balabonski, S. Chakraborty, R. Morisset, and F. Z. Nardelli. Common compiler optimisations are invalid in the C11 memory model and what we can do about it. In POPL, pages 209–220, 2015.
6cs.PL
Query Complexity of Tournament Solutions Palash Dey Indian Institute of Science, Bangalore arXiv:1611.06189v3 [cs.DS] 25 Jan 2017 January 26, 2017 Abstract A directed graph where there is exactly one edge between every pair of vertices is called a tournament. Finding the “best” set of vertices of a tournament is a well studied problem in social choice theory. A tournament solution takes a tournament as input and outputs a subset of vertices of the input tournament. However, in many applications, for example, choosing the best set of drugs from a given set of drugs, the edges of the tournament are given only implicitly and knowing the orientation of an edge is costly. In such scenarios, we would like to know the best set of vertices (according to some tournament solution) by “querying” as few edges as possible. We, in this paper, precisely study this problem for commonly used tournament solutions: given an oracle access to the edges of a tournament T , find f(T ) by querying as few edges as possible, for a tournament solution f. We first show that the set of Condorcet non-losers in a tournament can be found by querying 2n − ⌊log n⌋ − 2 edges only and this is tight in the sense that every algorithm for finding the set of Condorcet non-losers needs to query at least 2n − ⌊log n⌋ − 2 edges in the worst case, where n is the number of vertices in the input tournament. We then move on to study other popular tournament solutions and show that any algorithm for finding the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, the Banks set, and the top cycle must query Ω(n2 ) edges in the worst case. On the positive side, we are able to circumvent our strong query complexity lower bound results by proving that, if the size of the top cycle of the input tournament is at most k, then we can find all the tournament solutions mentioned above by querying O(nk + n log n/log(1−1/k)) edges only. 1 Introduction Many scenarios in multiagent systems can often be modeled and analyzed using tournaments [Mou86, BBFH14]. An important example of such scenarios is voting where we have a set of alternatives and a set of votes which are linear orders over the set of alternatives. A important tournament to consider in this context is defined by the majority relation induced by the set of votes. In the majority relation, an alternative x is preferred over another alternative y if x is preferred over y in a majority of the votes. Indeed, many important voting rules, like Copeland for example, are defined using the tournament induced by the majority relation of the input set of votes. Other 1 than voting, tournaments have found many applications in multi-criteria decision analysis [AR+ 86, BMP+ 06], zero-sum games [FR95, DLB96], coalitional games [BH10], argumentation theory [Dun95, Dun07], biology [CH07], etc. Formally, a tournament is defined as a set of alternatives along with an irreflexive, antisymmetric, and total relation, called dominance relation, on the set alternatives. An equivalent and often more convenient view of a tournament is as a directed graph on the alternatives where, between every pair of vertices (which corresponds to the alternatives), there is exactly one edge. A tournament solution takes a tournament as input and outputs a subset of the vertices. Tournament and tournament solutions are important mathematical tools in any general situation where we have to make a choice from a set of alternatives solely based on pairwise comparisons. 1.1 Motivation We often have situations where the input tournament is given “implicitly” – the vertices of the tournament are given explicitly and we have to query for an edge to know its orientation. Moreover, knowing the orientation of an edge of the tournament can often be costly. For example, we can think of an application where we have a set of drugs for a particular disease and we want to know the “best” (according to some tournament solution) set of drugs. A natural dominance relation in this context would be to define a drug x to dominate another drug y if the probability that the drug x cures the disease is more than the corresponding probability for the drug y. Since these probabilities are often not known a priori, estimating them often requires extensive lab experiments as well as clinical trials. Hence, we would like to make as few queries as possible to know the best set of drugs. More generally, we can think of any tournament based voting rules like Copeland in an election scenario. A tournament based voting rule chooses winners solely based on the tournament induced by the pairwise majority relation between the alternatives. However, in many applications of voting in multiagent systems, recommender systems [PHG00] for example, the number of voters is huge and consequently, learning the majority relation is costly. Hence, we would like to learn the set of most popular items (according to the tournament solution under consideration) with the smallest number of queries possible. Motivated by these applications, we study, for a tournament solution f, the problem of finding f(T ) of an input tournament T by querying smallest number of edges possible. A query for an edge, in our model, reveals the orientation of the edge in the input tournament. Finding the query complexity of various graph properties has drawn significant attention in literature. In the most general setting, the input is a directed graph on n vertices and one has to find whether the input graph satisfies some property we are concerned with, by asking a minimum number of queries. A query is a question of the form: “Is there an edge from a vertex x to another vertex y?” The query complexity of a property is the worst case number of queries that must be made to know whether the input graph has that property. A graph property, in this context, is called evasive if its query complexity is n(n − 1), that is, one has to query all possible edges of the input digraph to test the property in the worst case. Karp conjectured that every monotone and nontrivial graph property is evasive. A graph property is monotone if it continues 2 to hold even after adding more edges and nontrivial if it holds for some but not all graphs. A substantial amount of research effort has provided increasingly better query complexity lower bounds for monotone and nontrivial properties, although Karp’s conjecture remained open [KSS84, Kin88, RV76, Ros73, CKS01, Kul13, KT10]. In the case of tournaments (where there is exactly one edge between every pair of vertices), Balasubramanian et al. [BRS97] showed (rediscovered by Procaccia [Pro08]) that a Condorcet winner – a vertex with n − 1 outgoing edges – can be found, if it exists, with 2n − ⌊log n⌋ − 2 queries and this query complexity upper bound is tight in the worst case. This further motivates us to study the query complexity of other commonly used tournament solutions. 1.2 Our Contribution In this paper, we prove tight bounds on the query complexity of commonly used tournament solutions. Our specific contributions in this paper are as follows. – We show that the query complexity of the problem of finding the set of Condorcet non-losers is 2n − ⌊log n⌋ − 2 [Observation 3.1]. – We show that any algorithm for finding the Copeland set, the Slater set, and the Markov set in a tournament has query complexity (n2 ) [Theorem 3.1]. We remark that Goyal et al. [GJR17] also discovered this result independently (and in parallel) around same time. – We prove that any algorithm for finding the bipartisan set [Theorem 3.2], the uncovered set [Theorem 3.3], the Banks set [Theorem 3.4], and the top cycle [Theorem 3.5] has query complexity Ω(n2 ). – We complement the our strong query complexity lower bounds above by showing that, if the tournament T has a top cycle of size at most k, then the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, the Banks set, and the top cycle of a tournament T can be found using O(nk + n log n/log(1−1/k)) queries [Theorem 4.1 and 4.2]. 1.3 Related Work The work of Balasubramanian et al. [BRS97] (rediscovered by Procaccia [Pro08]) is the closest predecessor of our work where he shows that the query complexity of Condorcet winner in tournaments is 2n − ⌊log n⌋ − 2. There have been several other works in the literature which study the query complexity of various problems in tournaments. For example, Noy and Naor use comparison-based sorting algorithms to find feedback sets and Hamiltonian paths in tournaments [BNN90]. There have been works in computational social choice theory on communication complexity of different voting rules [CS02] and query complexity of preference elicitation in various domains [Con09, DM16a, DM16b, Dey16]. However, the querying model in the above works is completely different from ours and consequently, neither the results nor the 3 techniques involved in these works are directly applicable to our work; a query in the works above asks: “Does a voter v prefer an alternative x over another alternative y?” 2 Preliminaries For a positive integer ℓ, we denote the set {1, 2, . . . , ℓ} by [ℓ]. For a finite set X and a positive integer ℓ, we denote the set of all subsets of X of size ℓ by Pℓ (X ) and the set of all probability distributions on X by ∆(X ). Tournaments. A tournament T = (V, E) is a directed graph on a set V of n vertices such that, for any two vertices u, v ∈ V, either (u, v) ∈ E or (v, u) ∈ E but not both. If not mentioned otherwise, we denote the number of voters by n. We call any subgraph of a tournament a partial tournament. We call a tournament balanced if the in-degree and out-degree of every vertex are the same. A tournament T defines a relation ≻T on the set of vertices V: u ≻T v if (u, v) ∈ T . Alternatively, any irreflexive, antisymmetric, and total relation ≻ on a set V defines a tournament T = (V, E) where (u, v) ∈ E if u ≻ v. When there is no possibility of confusion, we drop T from the subscript of ≻. We call the relation ≻T associated with a tournament T the dominance relation of T . We say a vertex u dominates or defeats another vertex v if u ≻T v. Let us define the dominion D(v) of a vertex v as D(v) = {u ∈ V ∶ v ≻ u} and D(v) is called the dominators of v. Given a tournament T , let A(T ) be its adjacency matrix. We call the matrix G(T ) = A(T ) − A(T )t the skew-adjacency matrix of T , where A(T )t is the transpose of A(T ). A vertex v is called the Condorcet winner of a tournament if the out-degree of v is n − 1; alternatively, a vertex v is the Condorcet winner if v ≻ u for every u ∈ V ∖ {v}. Given a set V, we denote the set of all tournaments over V by T(V). A tournament solution f ∶ ∪∣V∣>0 T(V) → 2V ∖ {∅} is a function that takes a tournament as input and selects a nonempty set of vertices as output. Examples of commonly used tournament solutions are as follows [MBC+ 16, Chapter 3]. Condorcet non-loser: The Condorcet non-loser set of a tournament is the set of all vertices which has at least one outgoing edge. Copeland set: The Copeland set of a tournament is the set of vertices with maximum out-degree. Slater set: Given a tournament T = (V, ≻), let us denote the maximal element of V according to a strict linear order > on V by max(>). The Slater score of a strict linear order > over V with respect to tournament T = (V, ≻) is ∣ > ∩ ≻ ∣ where > ∩ ≻= {(x, y) ∈ V ×V ∶ x > y, x ≻ y}. A strict linear order is a Slater order if it has maximum Slater score. Then the Slater set is defined as SL(T ) = {max(>) : > is a Slater order for T }. Markov set: Given a tournament T = (V, E), we define a Markov chain M(T ) as follows. The states of the Markov chain M(T ) are the vertices of T and the transition probabilities are determined by the dominance relation: in every step, stay in the current state v with probability ∣D(v)∣/∣T ∣−1, and move to state u with probability 1/∣T ∣−1 for all u ∈ D(v). The Markov set is the the set of vertices that have maximum probability in the unique stationary distribution of M(T ). Formally, the transition matrix of the Markov chain is defined as. Q= 1 (A(T )t + diag(CO)) ∣T ∣ − 1 4 where diag(CO) is the diagonal matrix of the Copeland scores. Markov set MA(T ) of a tournament T is then given by MA(T ) = arg maxa∈V {p(a) ∶ p ∈ ∆(V), Qp = p}. Bipartisan set: Bipartisan set generalizes the notion of Condorcet winner to lotteries over the vertices of the tournament. Interestingly, for every tournament T = (V, E), there exists a unique maximal lottery [MBC+ 16]. That is, there exists a probability distribution p ∈ ∆(V) such that, for the skew-adjacency matrix G(T ) = (gab )a,b∈V of T , ∑a,b∈V p(a)q(b)gab ⩾ 0 for all q ∈ ∆(V) which is, by convexity, equivalent to the following condition. ∑ p(a)gab ⩾ 0 for all b ∈ V (1) a∈V Let pT denote the unique maximal lottery of T . Then the bipartisan set BP(T ) of T is defined as the support of pT . That is, BP(T ) = {a ∈ V ∶ pT (a) > 0} Uncovered set: Given a tournament T =(V,≻), we say a vertex v ∈ V covers another vertex u ∈ V if D(u) ⊆ D(v) and is denoted by vCu. We observe that vCu implies v ≻ u and is equivalent to D̄(v) ⊆ D̄(u). The uncovered set UC(T ) of a tournament T is given by the set of maximal elements of the covering relation C. That is, UC(T ) = {v ∈ V ∶ uCv for no u ∈ V} Banks set: A sub-tournament of a tournament T = (V, E) is an induced subgraph of T . The Banks set BA(T ) is the set of maximal elements of all the maximal transitive sub-tournaments of T . Top cycle: A non-empty subset of vertices B ⊆ V is called dominant in a tournament T = (V, ≻) if x ≻ y for every x ∈ B and y ∈ V ∖ B. Dominant sets are linearly ordered via set inclusion and the top cycle returns the unique smallest dominant set. A tournament solution is called neutral if the output does not depend on the names of the input set of vertices. All the tournament solutions discussed above are neutral. Essential States in a Markov Chain. A state i in a finite Markov chain is called essential if for every state j that is reachable from i, the state i is also reachable from j. A state is called inessential if it is not essential. A well known fact from probability theory is that, π(i) = 0 for every inessential state i, where π is a stationary distribution of the Markov chain. Hence, every vertex whose corresponding state in the Markov chain is inessential, does not belong to the Markov set of that tournament. We refer the reader to [Bré13] for a more detailed discussion on Markov chains. Query Model. Given a tournament T = (V, E) on n vertices, a query for a pair of vertices {x, y} ∈ P2 {V} reveals whether (x, y) ∈ E or (y, x) ∈ E. The query complexity of an algorithm is the maximum number of queries the algorithm makes in the worst case. The query complexity of a tournament solution f is the minimum query complexity of any algorithm for computing f. 5 3 Query Complexity Lower Bounds of Tournament Solutions We begin with the following observation which gives us the query complexity of the Condorcet non-loser set of tournaments. Observation 3.1 The query complexity of the Condorcet non-loser set in tournaments is equal to the query complexity of the Condorcet winner in tournaments. Hence, the query complexity of the Condorcet non-loser set in tournaments is 2n − ⌊log n⌋ − 2. Proof: Given a tournament T = (V, E), let us define another tournament T = {V, E}, where E = {(x, y) ∶ (y, x) ∈ E}. Now the result follows from the observation that a vertex v is a Condorcet non-loser in T if and only if v is not the Condorcet winner in T . Now the 2n − ⌊log n⌋ − 2 query complexity of the Condorcet non-loser set follows from the 2n − ⌊log n⌋ − 2 query complexity of the Condorcet winner in tournaments [BRS97]. ◻ We next consider the query complexity of the Slater set of tournaments. The following result provides a necessary condition for a vertex to belong to the Slater set of a tournament. We will use it to prove query complexity lower bound of the Slater set. Lemma 3.1 Suppose the out-degree of a vertex v ∈ V in a tournament T = (V, E) on n vertices is strictly less than (n−1)/2. Then v does not belong to the Slater set of T . −−−−→ Proof: Let V ∖ {v} be any arbitrary order on the vertices in V ∖ {v}. Now the result −−−−→ −−−−→ follows from the observation that ∣(v ≻ V ∖ {v}) ∩ E∣ < ∣(V ∖ {v} ≻ v) ∩ E∣. ◻ Let us consider the tournament Treg = (V, E) on n vertices V = {ai ∶ i ∈ [n]}. We assume n to be an odd integer. In Treg , vertex ai defeats ai+j (mod n) for every i ∈ [n] and j ∈ [(n−1)/2]. We will use the tournament Treg crucially in our proofs of the query complexity lower bounds of the Copeland set, the Slater set, and the Markov set. The following result is immediate from the definition of neutral tournament solutions. Lemma 3.2 Given the tournament Treg as input, every neutral tournament solution outputs the set of all vertices in Treg . u,v Suppose there exists an edge from a vertex u to another vertex v in Treg . Let Treg be the tournament which is the same as Treg except the edge from u to v is reversed, u,v that is, Treg = Treg ∪ {(v, u)} ∖ {(u, v)}. The following lemma will be used crucially in our proofs of the query complexity lower bounds of the Copeland set, the Slater set, and the Markov set. u,v Lemma 3.3 The Copeland set, the Slater set, and the Markov set of Treg do not contain u. Proof: Copeland set: For the Copeland set, the result follows from the observation that u,v u is no longer a vertex with highest out-degree in Treg . 6 Slater set: For the Slater set, the result follows immediately from Lemma 3.1 since u,v the out-degree of u is strictly smaller than (n−1)/2 in Treg . Markov set: If possible, let us assume that the stationary distribution of the Markov u,v u,v chain M(Treg ) associated with the tournament Treg be π such that π(a) = p for every a ∈ [n] ∖ {u, v}. Then we have the following. 2 = π(v) n+1 n−3 = π(u) p n−1 π(u) + (n − 2)p + π(v) = 1 p + π(u) (2) (3) (4) u,v We first observe that, since the Markov chain M(Treg ) is ergodic, it has a unique stationary distribution. Now, since there exists an unique solution to the equations u,v above, the stationary distribution π of M(Treg ) is indeed of the form we assumed (that is, π(a) = p for every a ∈ [n] ∖ {u, v}). We observe that equation 3 shows that π(u) < p u,v is {v}. ◻ and equation 2 shows that p < π(v). Hence, the Markov set of Treg We now prove that any algorithm for finding the Copeland set, the Slater set, and the Markov set must query every edge in the input tournament in the worst case. Theorem 3.1 Any algorithm for finding the Copeland set, the Slater set, and the Markov set of tournaments has query complexity (n2 ). Proof: Let us consider the tournament Treg . We observe that, due to Lemma 3.2, the Copeland set, the Slater set, and the Markov set of Treg is the set of all vertices. Let us now consider the oracle which answers the queries according to Treg . We claim that any algorithm for finding the Copeland set, the Slater set, and the Markov set of tournaments must query all the (n2 ) edges of Treg . Suppose not, then there exists an edge from u to v in Treg for some vertices u and v that the algorithm does not query. Let T̂ be the partial tournament of Treg containing the edges that the algorithm queries. If the output of the algorithm does not contain u, then the oracle completes T̂ to Treg and thus the algorithm does not output correctly since the output should contain all the vertices. On the other hand, if the output of the algorithm contains u then the oracle completes T̂ by directing the edge between u and v from v to u and directing the rest of the edges as in Treg . Again the algorithm outputs wrongly due to Lemma 3.3. ◻ We now present our query complexity lower bound for the bipartisan set of tournaments. Before embarking on the query complexity lower bound of the bipartisan set, let us prove a few structural results for the bipartisan set which we will use crucially later. The following result for the bipartisan set is well known [GLM93, FR95]. Lemma 3.4 In a tournament T = (V, ≻), suppose a vertex u covers another vertex v, that is, u ≻ w whenever v ≻ w for every w ∈ V. Then v does not belong to the bipartisan set of T. 7 The following result shows that, in the tournaments where every vertex has the same number of incoming edges as the number of outgoing edges, the bipartisan set is the set of all vertices. Lemma 3.5 Let T be a tournament on n vertices where the in-degree and out-degree of every vertex is (n−1)/2. Then the only maximal lottery of T is the uniform distribution over the set of all vertices of T and thus the bipartisan set of T is the set of all vertices. Proof: We observe that the uniform distribution over all the vertices satisfy Equation (1) for the tournament T , since the average of the entries in every column of the skew-symmetric matrix G of the tournament T is 0. Now the result follows from the fact that the maximal lottery in every tournament is unique [MBC+ 16]. ◻ In the next lemma, we formalize the intuition that, if a (A, V∖A) cut in a tournament has a majority of its edges from V ∖ A to A and A is balanced, then the bipartisan set of the tournament must include at least one vertex from V ∖ A. Lemma 3.6 Let T = (V1 ∪ V2 , E) be a tournament such that there exist at most ∣V1 ∣⋅∣V2∣/2 − 1 edges from V1 to V2 and the in-degrees and out-degrees of all the vertices in the subtournament T [V1 ] of T induced on V1 are exactly ∣V1 ∣−1/2. Then the bipartisan set of T must include at least one vertex from V2 . Proof: Let p⋆ ∈ ∆(V1 ∪ V2 ) be the maximal lottery of T and V = V1 ∪ V2 . If possible, let us assume that p⋆ (v) = 0 for every v ∈ V2 . Let q ∈ ∆(V2 ) be the uniform distribution on V2 and G = (gab )a,b∈V the skew-adjacency matrix of T . We first claim that p⋆ cannot be the uniform distribution on V1 . Indeed, otherwise we have ∑a,b∈V p⋆ (a)q(b)gab < 0 (since a strict majority of the edges between V1 and V2 are from V2 to V1 ) which contradicts the fact that p⋆ is the maximal lottery of T . We now consider the sub-tournament T [V1 ] of T induced on V1 . Due to Lemma 3.5, the only maximal lottery of T [V1 ] is the uniform distribution on V1 . Hence, since p⋆ is not the uniform distribution over V1 , there exists a distribution q′ ∈ ∆(V1 ) such that ∑a,b∈V1 p⋆ (a)q′ (b)gab < 0. However, this contradicts our assumption that p⋆ is the maximal lottery of T . Hence, the bipartisan set of T must include at least one vertex from V2 . ◻ We now have all the ingredients to present our query complexity lower bound result for the bipartisan set. Theorem 3.2 The query complexity of the bipartisan set of a tournament is Ω(n2 ). Proof: Let n be an odd integer. We consider a partial tournament T = (A ∪ B, E) where A = {ai ∶ i ∈ [n]}, B = {bi ∶ i ∈ [n]}, and E = {(ai , ai+j (mod n) ), (bi , bi+j (mod n) ) ∶ i ∈ [n], 1 ⩽ j ⩽ (n−1)/2}. The oracle answers the queries of the algorithm as follows. If a query comes for an edge between vertices ai and aj or bi and bj for any i, j ∈ [n], then the oracle answers according to T . If a query comes for an edge between ai and bj for any i, j ∈ [n], then the oracle says that the edge is oriented from ai to bj . We now claim that the algorithm must query at least n2/2 edges between A and B. Suppose not, then, if the output of the algorithm contains any vertex from B, then the oracle orients every 8 edge between A and B, from A to B, thereby ensuring that the output of the algorithm is wrong due to Lemma 3.4. On the other hand, if the output of the algorithm does not contain any vertex from B, then the oracle orients all the edges between A and B that are not queried, from B to A, thereby ensuring that the output of the algorithm is again wrong due to Lemma 3.6. Hence, the algorithm must query at least n2/2 edges between A and B and thus the query complexity of the bipartisan set is Ω(n2 ). ◻ We now show that the query complexity of the uncovered set is Ω(n2 ). Theorem 3.3 The query complexity of the uncovered set of a tournament is Ω(n2 ). Proof: Consider a partial tournament T = (A ∪ B ∪ {x}, E) where A = {ai ∶ i ∈ [n]}, B = {bi ∶ i ∈ [n]} and E = {(ai , x), (x, bi ) ∶ i ∈ [n]}. Let us consider the following oracle. Let us define the partial tournament T ′ to be the graph on A ∪ B ∪ {x} consisting of all the answers of the oracle till now. Hence, to begin with, T ′ does not have any edge. The oracle answers the queries for any edge in T according to T . For any query of the form {ai , aj } or {bi , bj }, the oracle answers arbitrarily but consistently. For a query {ai , bj } for some i, j ∈ [n], if ai defeats bk for every k ∈ [n] ∖ {j} in T ′ , then the oracle answers that bj defeats ai ; otherwise oracle answers that ai defeats bj . We claim that any algorithm for finding the uncovered set of tournaments must query for the pair {ai , bj } for every i, j ∈ [n]. Suppose not, then there exists a pair {ai , bj } which the algorithm does not query. Notice that, by the design of the oracle, ai defeats bk in T ′ for every k ∈ [n] such that {ai , bk } has been queried by the algorithm. For every pair {ak , bℓ } with k, ℓ ∈ [n], k ≠ i and {ak , bℓ } has not been queried, the oracle orients the edge from bℓ to ak . The oracle also orients all the edges from ai to bk for every k ∈ [n] ∖ {j}. Now, if the output of the algorithm contains x, then the oracle orients the edge {ai , bj } from ai to bj . Notice that, in this case, x is covered by ai and thus x should not be in the uncovered set and hence the output of the algorithm is wrong. On the other hand, if the output of the algorithm does not contain x, then the oracle orients the edge {ai , bj } from bj to ai . In this case, x is not covered by any other vertex and thus x belongs to the uncovered set. Hence, the algorithm outputs incorrectly in both the cases thereby proving the result. ◻ Next we consider the Banks set and show its query complexity to be Ω(n2 ). Theorem 3.4 The query complexity of the Banks set of a tournament is Ω(n2 ). Proof: Consider a partial tournament T = (A ∪ B ∪ {x}, E), where A = {ai ∶ i ∈ [n]}, B = {bi ∶ i ∈ [n]}, and E = {(ai , x), (x, bi ), (bi , bj ) ∶ i, j ∈ [n], i > j}. Let us consider the following oracle. Let us define the partial tournament T ′ to be the graph on A ∪ B ∪ {x} consisting of all the answers of the oracle till now. Hence, to begin with, T ′ does not have any edge. The oracle answers the queries for any edge in T according to T . For any query of the form {ai , aj } or {bi , bj }, the oracle answers arbitrarily but consistently. For a query {ai , bj } for some i, j ∈ [n], if ai defeats bk for every k ∈ [n] ∖ {j} in T ′ , then the oracle answers that bj defeats ai ; otherwise oracle answers that ai defeats bj . We claim that the algorithm must query for the pair {ai , bj } for every i, j ∈ [n]. Suppose not, then there exists a pair {ai , bj } which the algorithm does 9 not query. Notice that, by the design of the oracle, ai defeats bk in T ′ for every k ∈ [n] such that {ai , bk } has been queried by the algorithm. For every pair {ak , bℓ } with k, ℓ ∈ [n], k ≠ i and {ak , bℓ } has not been queried, the oracle orients the edge from ak to bℓ . The oracle also orients all the edges not in T ′ between ai and bk from ai to bk for every k ∈ [n] ∖ {j}. Now if the output of the algorithm contains x, then the oracle orients the edge between ai and bj from ai to bj . We claim that x can not be the maximum vertex of any maximal transitive sub-tournament T ′′ of T . To see this, we first observe that the sub-tournament T ′′ must have all the vertices in B and no vertex from A. Indeed, otherwise either x is not the maximum vertex of T ′′ (if any vertex from A is there in T ′′ ) or T ′′ is not a maximal transitive sub-tournament (if any vertex from B is not there in T ′′ ). However, such a sub-tournament is not a maximal transitive sub-tournament since ai can be added to T ′′ without violating transitivity. Hence x does not belong to the Banks set of the resulting tournament and thus the algorithm’s output is wrong. On the other hand, suppose the output of the algorithm does not contain x. Then the oracle orients the edge between ai and bj from bj to ai . In this case, the sub-tournament of T induced on B ∪{x} is a maximal sub-tournament where x is the maximum vertex and thus x belongs to the Banks set of the resulting tournament. Hence, the algorithm outputs incorrectly in both the cases thereby proving the result. ◻ We now show that the query complexity of the top cycle of tournaments is Ω(n2 ). Theorem 3.5 The query complexity of the top cycle of a tournament is Ω(n2 ). Proof: We consider a partial tournament T = (A ∪ B, E) where A = {ai ∶ i ∈ [n]}, B = {bi ∶ i ∈ [n]}, and E = {(ai , ai+1 (mod n) ), (bi , bi+1 (mod n) ) ∶ i ∈ [n]}. The oracle answers the queries of the algorithm as follows. If a query comes for the edge between vertices ai and aj or bi and bj for any i, j ∈ [n], then the oracle answers according to T if the edge is present in T , and arbitrarily but consistently otherwise. If a query comes for an edge between ai and bj for any i, j ∈ [n], then the oracle says that the edge is oriented from ai to bj . Now we claim that the algorithm must query all the n2 edges between A and B. Suppose not, then there exist ai and bj for some i, j ∈ [n] such that the algorithm has not queried for the edge between ai and bj . Now if the output of the algorithm does not contain any vertex from B, then the oracle orients the edge between ai and bj from bj to ai . Notice that, in this case the top cycle of the resulting tournament T contains at least one vertex bj ∈ B and thus the algorithm does not output correctly in this case. On the other hand, if the output of the algorithm contains any vertex from B, then the oracle orients all the edges between A and B from A to B. In this case, the top cycle of the resulting tournament is A and thus the algorithm again fails to output correctly. Hence, the algorithm must make Ω(n2 ) queries. ◻ 4 Results for Tournaments with Small Top Cycle It turns out that, if we a priori know that the size of the top cycle in the input tournament is at most k, then there is an algorithm for finding the top cycle with much less number of queries. 10 Theorem 4.1 Suppose we know that the top cycle of the input tournament T is of size at most k. Then there exists an algorithm for finding the top cycle of T with query complexity O(nk + n log n/log(1−1/k)). Proof: We first partition the set of vertices V into ⌈n/2k⌉ subsets Vi , i ∈ ⌈n/2k⌉, each of size at most 2k. For each partition, we query all pair of vertices. We notice that, in each set Vi of the partition, there must exist at least one vertex vi with in-degree at least k (for every k larger than some small constant) and consequently vi does not belong to the top cycle of T for every i ∈ ⌈n/2k⌉. We delete the vertex vi from Vi for every i ∈ ⌈n/2k⌉, thereby deleting ⌈n/2k⌉ vertices in total. The now iterate the same process on the remaining set of vertices. The first iteration takes O((n/k)k2 ) = O(nk) queries. From the next iteration onwards, we can manage with only n queries per iteration by partitioning the vertices cleverly: since we have deleted exactly one vertex from each set of the partition we can add one vertex to each set of the partition by “breaking” some of the sets from the partition. We now observe that, in every set, we now need to compare the new vertex with the rest of the vertices thereby requiring at most n − k queries in total. Since, each iteration decreases the size of the tournament by a factor of Ω(1 − 1/k), after O(log n/log(1−1/k)) iterations, we have O(k) vertices in the tournament where we can find the top cycle using O(k2 ) = O(nk) queries. Hence, the query complexity of our algorithm is O(nk + n log n/log(1−1/k)). The correctness of the algorithm follows from the fact that whenever we remove a vertex v from the tournament, v does not belong to the top cycle of T . ◻ The following result gives relationship between the top cycle of a tournament and other tournament solutions like the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, and the Banks set. Lemma 4.1 Let T be a tournament whose top cycle is C. Then the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, and the Banks set of T are the same as the corresponding solutions for the tournament T (C). Proof: Copeland set, bipartisan set, uncovered set: Follows from the observation that every vertex in C covers every vertex in V ∖ C and Lemma 3.4. Markov set: All the states corresponding to the vertices in V ∖ C are inessential and thus do not belong to the Markov set of T . Slater set: We observe that, in the Slater order ≻ of the tournament T , every vertex in C must be preferred over every vertex in V ∖ C. If not, then let there be a vertex a ∈ C and b ∈ V ∖ C such that a immediately follows b in ≻. Then by swapping the positions of the vertices a and b in ≻, we can strictly decrease the disagreement of ≻ with T thereby contradicting that ≻ is a Slater order of T . Banks set: Follows from the fact that every maximal element of every maximal sub-tournament of T belongs to C. ◻ Lemma 4.1 and Theorem 4.1 immediately give the the following query complexity upper bound for the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, and the Banks set when we a priori know that the size of the top cycle of the input tournament is at most k. 11 Theorem 4.2 Suppose we know that the top cycle of the input tournament T is of size at most k. Then there exists an algorithm for finding the Copeland set, the Slater set, the Markov set, the bipartisan set, the uncovered set, and the Banks set of T with query complexity O(nk + n log n/log(1−1/k)). Proof: We first find the top cycle C of T using Theorem 4.1. This step requires O(nk + n log n/log(1−1/k)) queries. Next, we query for all the pair of vertices in C and output the corresponding solution of T (C). The correctness of the algorithm follows immediately from Lemma 4.1. Since the second step requires O(k2 ) = O(nk) queries, the query complexity of our algorithm is O(nk + n log n/log(1−1/k)). ◻ 5 Conclusion and Future Directions We have shown that, for finding many common tournament solutions, one has to query, in the worst case, almost entire set of edges in the tournament. On the positive side, we have exhibited an important structural property, in terms of the top cycle of the tournament being small, which substantially reduces the query complexity of common tournament solutions. An immediate future direction of research is to study query complexity for other tournament solutions like the minimal covering set, the minimal extending set, the minimal TC-retentive set, the tournament equilibrium set, etc. Finding other structural properties of the tournament that can be leveraged to reduce the query complexity of common tournament solutions is another important direction of future research. Acknowledgement: Palash Dey gratefully acknowledges all the useful discussions with Neeldhara Misra during the course of the work. References [AR+ 86] Kenneth J Arrow, Hervé Raynaud, et al. Social choice and multicriterion decision-making. MIT Press Books, 1, 1986. [BBFH14] Felix Brandt, Markus Brill, Felix Fischer, and Paul Harrenstein. Minimal retentive sets in tournaments. Soc. Choice Welf., 42(3):551–574, 2014. [BH10] Felix Brandt and Paul Harrenstein. Characterization of dominance relations in finite coalitional games. Theor. Decis., 69(2):233–256, 2010. [BMP+ 06] Denis Bouyssou, Thierry Marchant, Marc Pirlot, Alexis Tsoukiàs, and Philippe Vincke. Evaluation and decision models with multiple criteria: Stepping stones for the analyst, volume 86. Springer Science & Business Media, 2006. 12 [BNN90] Amotz Bar-Noy and Joseph Naor. Sorting, minimal feedback sets, and hamilton paths in tournaments. SIAM J. Discrete Math., 3(1):7–20, 1990. [Bré13] Pierre Brémaud. Markov chains: Gibbs fields, Monte Carlo simulation, and queues, volume 31. Springer Science & Business Media, 2013. [BRS97] R. Balasubramanian, Venkatesh Raman, and G. Srinivasaragavan. Finding scores in tournaments. J. Algorithms, 24(2):380–394, 1997. [CH07] Irène Charon and Olivier Hudry. A survey on the linear ordering problem for weighted or unweighted tournaments. 4OR, 5(1):5–60, 2007. [CKS01] Amit Chakrabarti, Subhash Khot, and Yaoyun Shi. Evasiveness of subgraph containment and related properties. SIAM J. Comput., 31(3):866– 875, 2001. [Con09] Vincent Conitzer. Eliciting single-peaked preferences using comparison queries. J. Artif. Intell. Res., 35:161–191, 2009. [CS02] Vincent Conitzer and Tuomas Sandholm. Vote elicitation: Complexity and strategy-proofness. In Eighteenth National Conference on Artificial Intelligence (AAAI), pages 392–397, 2002. [Dey16] Palash Dey. Recognizing and eliciting weakly single crossing profiles on trees. CoRR, abs/1611.04175, 2016. [DLB96] John Duggan and Michel Le Breton. Dutta’s minimal covering set and shapley’s saddles. J. Econ. Theory, 70(1):257–265, 1996. [DM16a] Palash Dey and Neeldhara Misra. Elicitation for preferences single peaked on trees. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 215– 221, 2016. [DM16b] Palash Dey and Neeldhara Misra. Preference elicitation for single crossing domain. In Proc. Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI 2016, New York, NY, USA, 9-15 July 2016, pages 222– 228, 2016. [Dun95] Phan Minh Dung. On the acceptability of arguments and its fundamental role in nonmonotonic reasoning, logic programming and n-person games. Artif Intel, 77(2):321–357, 1995. [Dun07] Paul E Dunne. Computational properties of argument systems satisfying graph-theoretic constraints. Artif Intel, 171(10):701–729, 2007. [FR95] David C Fisher and Jennifer Ryan. Tournament games and positive tournaments. J. Graph Theory, 19(2):217–236, 1995. 13 [GJR17] Dishant Goyal, Varunkumar Jayapaul, and Venkatesh Raman. Elusiveness of finding degrees. To appear in Proc. Third International Conference on Algorithms and Discrete Applied Mathematics (CALDAM), February 13 - 18, 2017, Goa, India., 2017. [GLM93] Laffond G., Jean-Franois Laslier, and Le Breton M. The bipartisan set of a tournament game. GEB, 5(1):182–201, 1993. [Kin88] Valerie King. Lower bounds on the complexity of graph properties. In Proc. twentieth annual ACM symposium on Theory of computing, pages 468–476. ACM, 1988. [KSS84] Jeff Kahn, Michael Saks, and Dean Sturtevant. A topological approach to evasiveness. Combinatorica, 4(4):297–306, 1984. [KT10] Torsten Korneffel and Eberhard Triesch. An asymptotic bound for the complexity of monotone graph properties. Combinatorica, 30(6):735–743, 2010. [Kul13] Raghav Kulkarni. Evasiveness through a circuit lens. In Proc. 4th Conference on Innovations in Theoretical Computer Science, ITCS ’13, pages 139–144, New York, NY, USA, 2013. ACM. [MBC+ 16] Hervé Moulin, Felix Brandt, Vincent Conitzer, Ulle Endriss, Jérôme Lang, and Ariel D Procaccia. Handbook of Computational Social Choice. Cambridge University Press, 2016. [Mou86] H Moulin. Choosing from a tournament. Soc. Choice Welf., 3:271–291, 1986. [PHG00] David M. Pennock, Eric Horvitz, and C. Lee Giles. Social choice theory and recommender systems: Analysis of the axiomatic foundations of collaborative filtering. In Proc. Seventeenth AAAI, July 30 - August 3, 2000, Austin, Texas, USA., pages 729–734, 2000. [Pro08] Ariel D Procaccia. A note on the query complexity of the condorcet winner problem. Inform. Process. Lett., 108(6):390–393, 2008. [Ros73] Arnold L Rosenberg. On the time required to recognize properties of graphs: A problem. ACM SIGACT News, 5(4):15–16, 1973. [RV76] Ronald L Rivest and Jean Vuillemin. On recognizing graph properties from adjacency matrices. Theor Comput Sci, 3(3):371–384, 1976. 14
8cs.DS
SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS 1 Neural networks catching up with finite differences in solving partial differential equations in higher dimensions arXiv:1712.05067v1 [cs.NE] 14 Dec 2017 V.I. Avrutskiy Abstract—Fully connected multilayer perceptrons are used for obtaining numerical solutions of partial differential equations in various dimensions. Independent variables are fed into the input layer, and the output is considered as solution’s value. To train such a network one can use square of equation’s residual as a cost function and minimize it with respect to weights by gradient descent. Following previously developed method, derivatives of the equation’s residual along random directions in space of independent variables are also added to cost function. Similar procedure is known to produce nearly machine precision results using less than 8 grid points per dimension for 2D case. The same effect is observed here for higher dimensions: solutions are obtained on low density grids, but maintain their precision in the entire region. Boundary value problems for linear and nonlinear Poisson equations are solved inside 2, 3, 4, and 5 dimensional balls. Grids for linear cases have 40, 159, 512 and 1536 points and for nonlinear 64, 350, 1536 and 6528 points respectively. In all cases maximum error is less than 8.8 · 10−6 , and median error is less than 2.4 · 10−6 . Very weak grid requirements enable neural networks to obtain solution of 5D linear problem within 22 minutes, whereas projected solving time for finite differences on the same hardware is 50 minutes. Method is applied to second order equation, but requires little to none modifications to solve systems or higher order PDEs. Index Terms—Neural networks, partial differential equations, nonlinear Poisson equation, 5D boundary value problem. I. I NTRODUCTION ARTIAL differential equations have an enormous number of applications and are fundamental for predictions of many natural phenomena. Sometimes pencil and paper are enough to obtain their solutions as closed-form expressions or infinite series but in most cases numerical methods are the only remedy. A vast number of those were developed [3], [6], [8], [10], [25], [26]. Operating with fixed resources, they all have to use some finite way to describe functions they are trying to find. Either by values on a grid or by set of simple functions defined inside minute volumes, numerical methods are looking for a suitable finite set of real, or rather, rational parameters that can be used to construct a solution. This paper describes a solving method that represents functions using neural networks. Here is an example of how one can look like:  ! X X X  2 1 u(x) = Wk3 σ  Wkj σ Wji σ Wi0 · x  P k j i V.I. Avrutskiy is with the Department of Aeromechanics and Flight Engineering of Moscow Institute of Physics and Technology, Institutsky lane 9, Dolgoprudny, Moscow region, 141700, e-mail: [email protected] This particular expression represents a real valued function u of one argument x. Here σ is a special kind of nonlinear scalar mapping that is applied to each component of its input independently. For example, x is first multiplied by a vector (matrix of a single column) Wi0 and then each component 1 goes through σ. The result is then multiplied by matrix Wji and again nonlinear σ is applied. Process is repeated as many times as there are layers in a network1 . This one has four of them. Numbers of neurons in hidden layers set ranges for i, j and k. Numerical parameters are represented by weights matrices: 1 2 Wi0 , Wji , Wkj , Wk3 and they can be tuned by methods like gradient descent [4], [23]. Functions of this class are able to represent arbitrary mappings in various dimensions [7], [12], [13], [16], as well as their derivatives [5], [12]. II. BACKGROUND Feedforward neural networks are able to solve partial differential equations [15], [17], [18] by weights minimization technique that uses the equation itself as a cost function, so, if it reaches small enough values, one can conclude that the equation holds within some error margin. The input of such network is considered as a vector of independent variables and the output as value of solution. All necessary derivatives of output with respect to input and of cost function with respect to weights can be calculated by the extended backpropagation procedure [2]. Including boundary conditions into cost function itself usually does not produce very accurate results [24], so a process of function substitution is required [18]. For brevity, 2D case will be described, however, generalization is straightforward. Consider a boundary value problem for partial differential equation written for function u(x, y): U (x, y, u, ux , uy , ...) = 0 in a region Γ with boundary ∂Γ and condition: u|∂Γ = f A new function v is introduced by relation: u(x, y) = v(x, y) · φ(x, y) + f 1 Although in applications vectors of thresholds are added before each nonlinear mapping. Here they are omitted for brevity. © 2017 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS where φ is known and carefully chosen to be smooth, vanish on ∂Γ: φ|∂Γ = 0 to have reasonable normal derivative on the boundary: ∂φ ∂n ∼1 ∂Γ and to behave on Γ “as simply as possible”. The complete set of requirements for such functions has not yet been formulated. After writing the equation for v(x, y), one can notice that boundary condition turns into: v|∂Γ < ∞ It seems that it’s not necessary to account for that during the weights minimization since neural networks do not converge to infinite valued functions if there is a finite solution nearby. In applications φ is usually chosen as the simplest analytical expression that vanishes on boundary and has maximum value equal to 1, which is reached at a single point inside region Γ. ∂φ Condition ∂n ∼ 1 is imposed to exclude situations when said derivative is too small. Otherwise, v near the boundary would ∂u , which is have to be too large in order to produce correct ∂n expected to be of the order of 1. In trivial cases, like boundary problem inside a sphere of radius 1, one can choose: φ = 1 − r2 After substitution, the equation for v(x, y) can be written as whole procedure is described in [2]. One can mention a few features of the neural network approach: • Derivatives are calculated analytically, so numerical effects can only be brought by rounding errors and/or incorrect discretization of the cost function’s measure µ, that can happen when grids have large spacing. • The solution is obtained as a neural network, which is a smooth closed-form expression. It exists naturally in the entire region rather than on finite set of points. This allows to modify the grid during the training as much as necessary without algorithm forgetting solution’s values in points that were removed. • Parallelization is trivial: dense grids can be split into parts and processed by different computational nodes, which would only have to synchronize few megabytes of weights data during each step regardless of the grid size. • Training is based on matrix multiplications and its careful implementation allows to achieve very high hardware efficiency on modern GPUs [2]. III. M ETHOD ’ S EXTENSION Previously described approach is more or less standard for direct solving of partial differential equations with neural networks, although no papers prior to [2] formulated it in a form that was suitable for networks of arbitrary topology. In the same study the method was enhanced by adding extra terms to cost function. Namely, for equation: V (x, y, v, vx , vy , ...) = 0 Minimization will use cost function e = V 2 . A set of grid points (xi , yi ), i ∈ 1...N inside the region Γ is generated as a matrix X with two rows and N columns. All derivatives that ∂ ∂ are encountered in V for v like ∂x , ∂y and so on have to be ∂ calculated for X. For example, ∂x X is a matrix with the first row elements equal to 1 and the second row ones equal to 0, ∂ vice versa for ∂y X. All higher derivatives of X are zero. Said set of matrices: ∂ ∂ X, X, ... X, ∂x ∂y is propagated forward from one layer to another, and when the final layer is reached, an output set is obtained: vi , ∂ ∂ vi ≡ vxi , vi ≡ vyi , ... ∂x ∂y All of its members are matrices of size 1 × N . Cost function is discretized as: N E= µ (e) ' x,y∈Γ 1X 2 V (xi , yi , vi , vxi , vyi , ...) N i=1 Extended backward pass requires calculating derivatives of E with respect to each element of the output matrices: ∂E ∂E ∂E , , , ... ∂vi ∂vxi ∂vyi and these derivatives are gathered in matrices of the same size 1 × N . They are propagated backward in order to obtain gradient of E with respect to the weights of each layer. The 2 V (x, y, v, vx , ...) = 0 one can write a trivial consequence: ∂ V =0 ∂x and include it into cost e = V 2 + Vx2 . Applying operators ∂ ∂ ∂2 ∂2 , , , ∂x ∂y ∂x2 ∂y 2 to V and adding the corresponding terms to e for 2D case allowed to increase precision and avoid overfitting to such a degree that solving boundary value problem on a grid of 59 points inside a unit circle produced 2 · 10−5 accurate result for the entire region, whereas training with no extra terms could only achieve accuracy of 2 · 10−3 [1]. In this paper additional derivatives up to the fourth order are calculated along two directions ξ and ζ, which are random orthonormal vectors in space of independent variables. Since the cost function now includes terms like Vξ2 and Vζ2 , which depend on vξ and vζ ∂ and so on, it is necessary to initialize matrices like ∂ξ X and ∂ ∂ζ X at the input layer of the network. Using coordinates in (x, y) basis: ξ = (a1 , a2 ), ζ = (b1 , b2 ) one can write: ∂ ∂ ∂ = a1 + a2 ∂ξ ∂x ∂y ∂ ∂ and similarly for ∂ζ . Therefore, ∂ξ X is a linear combination ∂ ∂ ∂ of ∂x X and ∂y X with coefficients a1 and a2 , and so is ∂ζ X, SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS 2 ∂ but with b1 and b2 . Higher order terms like ∂ξ 2 X are all zeros. Those extra matrices are used by forward pass to calculate derivatives vξ , vζ , vξξ and others on the output layer of the perceptron. Forward propagation works independently for every grid point (xi , yi ), and each point with index i is represented by ith columns of all matrices initialized at the input layer. Noting ∂ ∂ X and ∂ζ X are coordinates of vectors ξ that columns of ∂ξ and ζ in x, y basis, one can conclude that different points can have different and, more importantly, random directions ξi and ζi . To implement that, one can generate 2N uniformly distributed unit vectors, split them into pairs, run GramSchmidt process on each pair, and then write one vector to ∂ ∂ ∂ξ X and another to ∂ζ X. For 2D case ξi and ζi form a basis in the input space that is randomly rotated from point to point. For higher dimensions it is possible to include more directional ∂ ∂ and ∂ζ , derivatives that will not be a linear combination of ∂ξ but since ξ and ζ are different in each point, all directions of the input space are somewhat covered. Using one direction instead of two was found to produce less accurate results, and using three directions did not bring much improvement in higher dimensions. In all cases training is split into three phases that use extra derivatives up to fourth order. Cost functions are built using the following terms: V0 = V V2 = V3 = 2 Vξξξ + 2 Vζζ + 2 Vζζζ A. Renormalization For certain functions derivatives of various orders have vastly different magnitude. For example, sin 10x has values of the order of 1 and its nth derivative with respect to x is of the order of 10n . If solution of a partial differential equation demonstrates similar properties, backpropagation will mostly minimize high order terms without proper attention to low order ones. Such cases require normalization. For each grid point the largest derivative along additional direction is spotted: Mξ = max(vξ , vxξ , vxxξ , vξξ , vxξξ , vxxξξ , ...) p If Mξ > 4, vector ξ is divided by k Mξ , where k is the order of the largest derivative with respect to ξ. Similar procedure is done for ζ. Renormalization requires one forward pass and is usually done once after each portion of epochs rint . Note that even if solution does not produce derivatives of various magnitude, neural network can still exhibit this behavior somewhere along the training. IV. R ESULTS To have non trivial analytical solutions, against which one could verify numerical results, formulas ua for those solutions were first picked and then substituted into linear: 4u = g and nonlinear Poisson equation: V1 = Vξ2 + Vζ2 2 Vξξ 3 4u + u2 = h to find the corresponding source terms g and h that would produce them. In all cases equations are solved inside ndimensional ball of radius 1 with vanishing boundary condition: Γ:r<1 2 2 V4 = Vξξξξ + Vζζζζ The first phase uses terms from 0 to 4. The second one uses terms from 0 to 3 and the last one from 0 to 2. Cost functions can be written as: s X es = Vj j=0 for s = 4, 3 and 2. They spawn a considerable amount of matrices that one should propagate. For example, 5D Poisson equation itself requires 2 derivatives for each dimension, 10 in total: ∂2 ∂ , 2 , j ∈ {1...5} (1) ∂xj ∂xj Then 8 additional operators are casted: ∂ ∂2 ∂3 ∂4 , , , ∂ξ ∂ξ 2 ∂ξ 3 ∂ξ 4 (2) ∂ ∂2 ∂3 ∂4 , , , ∂ζ ∂ζ 2 ∂ζ 3 ∂ζ 4 (3) Results of (2), (3), their combinations with (1) and function values themselves constitute to a total number of 99 different matrices. For s = 3 it’s 77 and for s = 2 it’s 55. u|∂Γ = 0 which is then simplified by function substitution: u = v · (1 − r2 ) After numerical solutions are obtained for v, functions u are calculated using them and compared against analytical expressions ua on dense enough sets of random points distributed uniformly inside Γ. Maximum and median values of absolute error ε = |u − ua | are calculated. Grids are comprised of two parts. Surface part contains equidistant points from ∂Γ with angular distance θ. Internal part is a regular grid, which is generated in three steps. At first, a Cartesian grid with spacing λ inside [−1, 1]n is created. Two random vectors in Rn are then chosen, and the grid is rotated from one to another. Finally, it is shifted along each direction by random value from interval [− λ4 , λ4 ], and after that all points with r > 1 are excluded. Training is based on RProp [22] procedure with parameters η+ = 1.2, η− = 0.5. Weights are forced to stay in [−20, 20] interval, no min/max bonds for steps are imposed. Initial steps ∆0 are set to 2 · 10−4 , unless otherwise stated. Weights for neurons are initialized [9], [11] with random values from range SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS √ ±2/ s, where s is the number of senders. Thresholds are initialized in range ±0.1. All layers, but input and output, are nonlinear with activation function: 1 σ(x) = 1 + exp(−x) The procedure is implemented according to [2] with no intermediate load/saves and run on Google Cloud instance with Nvidia Tesla P100 using 32 bit precision. All training points are processed in one batch. During the training original equation’s residual U0 = V0 is monitored, and its root mean squared is calculated for grid points. Training phases are thoroughly described for 2D case and applied without changes to higher dimensions. After figuring out grid requirements and network topologies all solutions were obtained from the first try. A. Two dimensions Analytical solution is written as: u(x1 , x2 ) = 10 (1 − r2 )(x1 + sin x2 + x21 + x2 cos x1 ) 17 r2 = x21 + x22 Ratio 10 17 is introduced, so that umax − umin ' 1. Source term for linear equation is:  10 −x21 − x22 + 1 sin x2 − g =− 17 40 − x1 (2x1 − x2 sin x1 + 1) + 17  10 + −x21 − x22 + 1 (2 − x2 cos x1 ) − 17 40 − x2 (cos x1 + cos x2 ) − 17  40 2 − x1 + x1 + sin x2 + x2 cos x1 17 and for nonlinear equation is:  10 h=− −x21 − x22 + 1 sin x2 − 17 40 − x1 (2x1 − x2 sin x1 + 1) + 17  10 + −x21 − x22 + 1 (2 − x2 cos x1 ) − 17 40 − x2 (cos x1 + cos x2 ) − 17  40 2 − x1 + x1 + sin x2 + x2 cos x1 + 17   100 + −x21 − x22 + 1 2 x21 + x1 + sin x2 + 289 2 + x2 cos x1 In both cases new function v is introduced: u(x1 , x2 ) = v(x1 , x2 ) · (1 − x21 − x22 ) Linear equation turns into: (1 − x21 − x22 )4v ∂v ∂v − 4x1 − 4x2 − 4v = g ∂x1 ∂x2 4 and nonlinear into: ∂v ∂v − 4x2 − ∂x1 ∂x2 − (1 − x21 − x22 )2 v 2 − 4v = h (1 − x21 − x22 )4v − 4x1 (5) Boundary conditions are now trivial: v|∂Γ < ∞ Neural network is a fully connected perceptron with the following layer structure: 2, 96, 96, 96, 96, 96, 96, 1 1) Linear 2D equation: Surface grid contains 13 points of a circle with θ = π6 . Internal grid has spacing λ = 13 and contains 27 points, the total number is 40 (see Fig. 1). The first training phase uses e4 and lasts for 2000 epochs with rint = 200. After the first 1000 epochs, steps ∆ are reset back to 2 · 10−4 . RMS of equation’s residual at the end: V̄0 = 4 · 10−4 . The second phase uses e3 , ∆0 = 2 · 10−5 and lasts for 2000 epochs with rint = 200. At the end of it V̄0 = 1.3 · 10−4 . The third phase uses e2 , ∆0 = 2 · 10−5 and lasts for 2000 epochs with rint = 200. The final RMS of the residual: V̄0 = 4 · 10−5 . u(x1 , x2 ) is obtained in 114 seconds on grid of 40 points and tested on 4000 points against the analytical solution with the following results: εmax = 3.5 · 10−6 , εmedian = 6.8 · 10−7 2) Nonlinear 2D equation: Surface grid contains 17 points of a circle with θ = π8 . Internal grid has spacing λ = 14 and contains 47 points, the total number is 64. The first training phase uses e4 , lasts for 3000 epochs and is split into 5 intervals. The first one contains 160 epochs, rint = 15. The second has 340 epochs and rint = 50. The third is 500 epochs and rint = 50. The fourth is 1000, rint = 50 and the final one is another 1000 epochs with rint = 100. Steps ∆ are reset back to 2 · 10−4 at the end of each interval but the last one. At the end of this phase V̄0 = 4 · 10−2 . The second phase uses e3 , ∆0 = 2 · 10−5 and lasts for 2000 epochs with rint = 200. At the end of it V̄0 = 1 · 10−3 . The third phase uses e2 , ∆0 = 2·10−5 and lasts 2000 epochs with rint = 200. The final RMS of the residual V̄0 = 1 · 10−4 . u(x1 , x2 ) is obtained in 180 seconds on grid of 64 points and tested on 4000 points against the analytical solution with the following results: εmax = 8 · 10−6 , εmedian = 2.4 · 10−6 B. Three dimensions Analytical solutions is written as: 3 u(x1 , x2 , x3 ) = (1 − r2 )(x1 + sin x2 + x23 + x2 cos x1 ) 5 r2 = x21 + x22 + x23 Substitution of function is implemented in a similar manner: (4) u(x1 , x2 , x3 ) = v(x1 , x2 , x3 ) · (1 − r2 ) SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS 5 C. Four dimensions Analytical solutions is written as: 7 u(x1 , x2 , x3 , x4 ) = (1 − r2 )(x1 + sin x2 + x23 + x4 cos x4 ) 9 2 r = x21 + x22 + x23 + x24 1.0 0.5 Substitution is similar: u(x1 , x2 , x3 , x4 ) = v(x1 , x2 , x3 , x4 ) · (1 − r2 ) 0.0 Neural network is a fully connected perceptron with the following layer structure: 4, 148, 148, 148, 148, 148, 148, 1 -0.5 -1.0 -1.0 0.0 -0.5 0.5 1.0 Fig. 1. 2D grid for linear Poisson equation. In higher dimensions the same spacing is used. Equations and corresponding sources g and h are obtained by exactly the same procedure as in two-dimensional case. Results are similar and for brevity they are omitted. Neural network is a fully connected perceptron with the following layer structure: 3, 96, 96, 96, 96, 96, 96, 1 1) Linear 3D equation: Surface grid contains 51 points of a sphere with θ = π6 . Internal grid has spacing λ = 13 and contains 108 points, the total number is 159. The first phase is the same as phase 1 of 2D Linear case. At the end of it V̄0 = 1.5 · 10−3 . The second phase is the same as phase 2 of 2D Linear case and it ends with V̄0 = 3 · 10−4 . The third phase is the same as phase 3 of 2D Linear case and the final V̄0 = 1.3 · 10−4 . u(x1 , x2 , x3 ) is obtained in 226 seconds on grid of 159 points and tested on 35000 points against the analytical solution with the following results: εmax = 6.5 · 10 −6 , εmedian = 1.4 · 10 −6 1) Linear 4D equation: Surface grid contains 154 points of a 3-sphere with θ = π6 . Internal grid has spacing λ = 31 and contains 358 points, the total number is 512. Phase 1 (see phase 1 of 2D Linear): V̄0 = 1.5 · 10−3 . Phase 2 (see phase 2 of 2D Linear): V̄0 = 3.3 · 10−4 . Phase 3 (see phase 3 of 2D Linear): V̄0 = 1.7 · 10−4 . u(x1 , x2 , x3 , x4 ) is obtained in 560 seconds on grid of 512 points and tested on 500,000 points against the analytical solution with the following results: εmax = 6.5 · 10−6 , εmedian = 9.7 · 10−7 2) Nonlinear 4D equation: Surface grid contains 357 points of a 3-sphere with θ = π8 . Internal grid has spacing λ = 41 and contains 1179 points, the total number is 1536. Phase 1 (see phase 1 of 2D Nonlinear): V̄0 = 5 · 10−2 . Phase 2 (see phase 2 of 2D Nonlinear): V̄0 = 1.2 · 10−3 . Phase 3 (see phase 3 of 2D Nonlinear): V̄0 = 2.5 · 10−4 . u(x1 , x2 , x3 , x4 ) is obtained in 1160 seconds on grid of 1536 points and tested on 500,000 points against the analytical solution with the following results: εmax = 8.6 · 10−6 , εmedian = 1.2 · 10−6 D. Five dimensions Analytical solutions is written as: 7 u(x1 , x2 , x3 , x4 , x5 ) = (1−r2 )(x1 +sin x2 +x23 +x4 cos x5 ) 9 r2 = x21 + x22 + x23 + x24 + x25 Substitution is as usual: u(x1 , x2 , x3 , x4 , x5 ) = v(x1 , x2 , x3 , x4 , x5 ) · (1 − r2 ) Neural network is a fully connected perceptron with the following layer structure: 2) Nonlinear 3D equation: Surface grid contains 87 points of a sphere with θ = π8 . Internal grid has spacing λ = 41 and contains 265 points, the total number is 343. The first phase is the same as phase 1 of 2D Nonlinear case and it leaves V̄0 = 3.2 · 10−2 . The second phase is the same as phase 2 of 2D Nonlinear case and it ends with V̄0 = 6 · 10−4 . The third phase is the same as phase 3 of 2D Nonlinear case and the final V̄0 = 1.8 · 10−4 . u(x1 , x2 , x3 ) is obtained in 380 seconds on grid of 343 points and tested on 35000 points against the analytical solution with the following results: 1) Linear 5D equation: Surface grid contains 399 points of a 4-sphere with θ = π6 . Internal grid has spacing λ = 31 and contains 1137 points, the total number is 1536. Phase 1 (see phase 1 of 2D Linear): V̄0 = 1.5 · 10−3 . Phase 2 (see phase 2 of 2D Linear): V̄0 = 3.2 · 10−4 . Phase 3 (see phase 3 of 2D Linear): V̄0 = 2.1 · 10−4 . u(x1 , x2 , x3 , x4 , x5 ) is obtained in 1280 seconds on grid of 1536 points and tested on 5,000,000 points against the analytical solution with the following results: εmax = 8.2 · 10−6 , εmedian = 1.9 · 10−6 εmax = 8.7 · 10−6 , εmedian = 1.2 · 10−6 5, 160, 160, 160, 160, 160, 160, 1 SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS 2) Nonlinear 5D equation: Surface grid contains 1217 points of a 4-sphere with θ = π8 . Internal grid has spacing λ = 14 and contains 5311 points, the total number is 6528. Phase 1 (see phase 1 of 2D Nonlinear): V̄0 = 3.2 · 10−2 . Phase 2 (see phase 2 of 2D Nonlinear): V̄0 = 2 · 10−3 . Phase 3 (see phase 3 of 2D Nonlinear): V̄0 = 3.3 · 10−4 . u(x1 , x2 , x3 , x4 , x5 ) is obtained in 5000 seconds on grid of 6528 points and tested on 5,000,000 points against the analytical solution with the following results: 6 Note that for other dimensions instead of 10 one should put 2n. This result is confirmed for low dimensions by solving (7) numerically with no terms of  omitted. One can argue that since neural network is solving another equation - the one that is written for v, its discretization error v is different. Closer look reveals that terms of v related to Laplacian indeed become ∼ 18 times smaller, however the most part of the error now comes from the first order derivatives (see (4), (5)): εmax = 8.8 · 10−6 , εmedian = 1.5 · 10−6 4xi Leading terms of v for those: V. C ATCHING UP WITH F INITE D IFFERENCES Linear Poisson equations will be considered in this section. For estimation of time required to solve those with classical methods, a simple 2n + 1 point stencil in n dimensions is considered. For example, in 2D case it states: 1 (u(x1 + h, x2 ) + u(x1 − h, x2 ) − 2u(x1 , x2 ))+ h2 1 + 2 (u(x1 , x2 + h) + u(x1 , x2 − h) − 2u(x1 , x2 ))+ h h2 ∂ 4 u ∂ 4 u + ( 4+ ) + O(h4 ) 12 ∂x1 ∂x42 4u = In 5D it gives the following discretization error: = h2 ∂ 4 u ∂ 4 u ∂ 4 u ∂ 4 u ∂ 4 u ( + + + + ) + O(h4 ) 12 ∂x41 ∂x42 ∂x43 ∂x44 ∂x45 For analytical solution ua (x1 , x2 , x3 , x4 , x5 ) it turns into: 7 2 = h −24 − 8x4 x5 sin x5 + 8x2 cos x2 − 108  − x21 + x22 + x23 + x24 + x25 − 13 ·  · (sin x2 + x4 cos x5 ) + O(h4 ) 4u = h discretization results in solving: 4e u=h− The difference Ψ between analytical and discrete solutions can be obtained using the following equation: (7) with vanishing boundary condition: Ψ|∂Γ = 0 For constant  it can be readily solved:  Ψ = − (1 − x21 − x22 − x23 − x24 − x25 ) 10 which gives: || max |u − u e| ∼ 10 xi 4h2 ∂ 3 v ∼ 0.5h2 6 ∂x3i The later equivalence is due to the third derivatives of the analytical solution: 7 (x1 + sin x2 + x23 + x4 cos x4 ) 9 being of the order of 7/9. To make sure that the ratio of 3 between v and  is not a significant advantage for a neural network, the term x23 in va was replaced with x33 /2. This increases discretization error for v by three times. After neural network solution was recalculated, the effect of that on precision turned out to be subtle and was fully compensated by setting rint = 20 for the first 1000 epochs of phase 1 and extending said phase for another 500 epochs. This increased total running time by 10%. However, all those changes also produced even better final result: va = εmax = 6.5 · 10−6 , εmedian = 1.13 · 10−6 For estimation this whole expression can be reduced to the first term: 7 · 24 2 ∼ h ' 1.6 · h2 (6) 108 Now instead of original equation: 4(u − u e) = 4Ψ =  ∂v ∂xi Using established estimations for  and setting maximum allowed error to δ = 10−5 , the grid spacing for the second order finite difference scheme can be written as: r 10δ ∼ 0.008 1.6 It results in 1255 ' 3·1010 points for each unit of 5D volume. Solution is obtained in the region Γ, which is a ball of radius 1. Its volume is: 8π 2 ' 5.26 15 Therefore, to cover internal part of Γ 1.6 · 1011 points are needed. The lower bond for the size of the external part can be calculated using similar considerations: 4D surface of 5D sphere has a measure of: 8π 2 ' 26.3 3 And it should at least be uniformly covered by points with the same spacing, which gives: 1254 · 26.3 ' 6.4 · 109 (8) This value is about 5% of the internal one and is going to be omitted. After discretization a linear system is to be solved. Its number of variables is equal to that of the grid points. Matrix SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS 4 log t 2 0 Net -2 FD -4 2 3 4 5 Dimensions Fig. 2. Base 10 logarithms of solving time using neural network and projected running time for the second order finite difference scheme. for such system is 2n + 1 = 11 diagonal. Solving time will be extrapolated using the data from H. Liu et al. [20]. They investigated performance of parallel AMG solvers run on Nvidia Tesla C2070 for various matrices and different implementations. Apart from relatively fast solution times [14], [19], [21] they use similar hardware, which eases the task of extrapolation. Tesla C2070 achieves 515 GFLOPS as it was used in double precision mode. In this paper Tesla P100 is operating with single precision for which it delivers 9340 GFLOPS. To make some room for estimation error one can consider that AMG solvers can run on single precision just as well. Therefore, the total ratio between theoretical computational powers is 18. The most similar matrix is P 3D7P 100. It was created by similar 7 point stencil for 3D Poisson equation on 1003 grid. The least processing time mentioned for this matrix is 0.34 seconds. Using linear extrapolation, one can write an approximate running time for solving 5D linear Poisson equation: 1 1.6 · 1011 ' 3000sec 18 1003 Estimation does not account for a fact that P 3D7P 100 is 7 diagonal, and the matrix to be solved is 11 diagonal. Similarly, for lower dimensions one can find: t5D = 0.34sec · t4D ' 23sec t3D ' 0.15sec t2D ' 0.001sec Plots of solving time against the number of dimensions can be seen on Fig. 2. VI. C ONCLUSION Neural network method was applied to boundary value problems for linear and nonlinear Poisson equations inside 2, 3, 4 and 5 dimensional unit balls. It’s based on direct approximation of functions by multilayer perceptrons: independent variables are fed into input layer, and solution’s values are obtained at the output. Procedure was improved by considering, in addition to equation itself, it’s trivial consequences, 7 obtained by differentiation. Prior to enhancements the method was mostly fringe and used as a proof of concept. With the additional cost terms and hardware efficient implementation it was able to compete with a second order finite difference scheme in solving 5D boundary value problem. For 4D cases and lower, classical method was far more effective. In higher dimensions neural networks managed to get ahead due to their ability to operate on grids with spacing as low as 1/3 provided solution’s derivatives up to 6th were of the order of 1. Even though it was compared against the simplest second order scheme, one can imagine some hard times trying to apply high order stencils to a grid that has no more than 6 points in each direction. Therefore, regardless of the order, the minimal number of points per dimension will probably always stay lower for neural networks so there is always a high dimensional task, for which finite differences are slower. One can also mention a decrease in memory complexity: if obtained on a grid, 5D solution would utilize at least 640GB of memory whereas neural network required about 2GB during the training and 640KB to store the result. This gap is mostly due to ineffective usage of resources by classical methods. For example, values of 1255 grid can easily describe 125 completely different solutions of 4D equations, whereas training a 5D neural network to represent such a mess would probably not end very well. On the other hand for functions that do not change too fast almost any grid representation is a waste of memory since a set of independent values has too many degrees of freedom. From this point of view neural networks can provide much more efficient representation, which matters for higher dimensions. ACKNOWLEDGMENT Author is extremely grateful to his scientific advisor E.A. Dorotheyev for help and enormous amount of support during this research. Special thanks are due to Y.N. Sviridenko, A.M. Gaifullin, I.A. Avrutskaya and I.V. Avrutskiy without whom this work would be impossible. R EFERENCES [1] V.I. Avrutskiy. Avoiding overfitting of multilayer perceptrons by training derivatives. arXiv preprint, available 1 Jan 2018. [2] V.I. Avrutskiy. Enhancing approximation abilities of neural networks by training derivatives. arXiv preprint arXiv:1712.04473, 2017. [3] Francesco Bassi and Stefano Rebay. A high-order accurate discontinuous finite element method for the numerical solution of the compressible navier–stokes equations. Journal of computational physics, 131(2):267– 279, 1997. [4] Arthur Earl Bryson. Applied optimal control: optimization, estimation and control. CRC Press, 1975. [5] Pierre Cardaliaguet and Guillaume Euvrard. Approximation of a function and its derivative with a neural network. Neural Networks, 5(2):207–220, 1992. [6] Alexandre Joel Chorin. Numerical solution of the navier-stokes equations. Mathematics of computation, 22(104):745–762, 1968. [7] George Cybenko. Approximation by superpositions of a sigmoidal function. Mathematics of Control, Signals, and Systems (MCSS), 2(4):303–314, 1989. [8] Robert Eymard, Michaël Gutnic, and Danielle Hilhorst. The finite volume method for richards equation. Computational Geosciences, 3(3):259–294, 1999. [9] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pages 249–256, 2010. SUBMITTED TO IEEE TRANSACTIONS ON NEURAL NETWORKS AND LEARNING SYSTEMS [10] Ernst Hairer, Christian Lubich, and Gerhard Wanner. Geometric numerical integration: structure-preserving algorithms for ordinary differential equations, volume 31. Springer Science & Business Media, 2006. [11] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015. [12] Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251–257, 1991. [13] Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989. [14] Marcin Krotkiewski and Marcin Dabrowski. Efficient 3d stencil computations using cuda. Parallel Computing, 39(10):533–548, 2013. [15] Manoj Kumar and Neha Yadav. Multilayer perceptrons and radial basis function neural network methods for the solution of differential equations: a survey. Computers & Mathematics with Applications, 62(10):3796–3811, 2011. [16] Vera Kurkova. Kolmogorov’s theorem and multilayer neural networks. Neural networks, 5(3):501–506, 1992. [17] IE Lagaris, A Likas, and DI Fotiadis. Artificial neural network methods in quantum mechanics. Computer Physics Communications, 104(1-3):1– 14, 1997. [18] Isaac E Lagaris, Aristidis Likas, and Dimitrios I Fotiadis. Artificial neural networks for solving ordinary and partial differential equations. IEEE Transactions on Neural Networks, 9(5):987–1000, 1998. [19] Hui Liu, Zhangxin Chen, and Bo Yang. Accelerating preconditioned iterative linear solvers on gpu. International Journal of Numerical Analysis and Modelling: Series B, 5(1-2):136–146, 2014. [20] Hui Liu, Bo Yang, and Zhangxin Chen. Accelerating algebraic multigrid solvers on nvidia gpus. Computers & Mathematics with Applications, 70(5):1162–1181, 2015. [21] Stoyan Markov, Peicho Petkov, Damyan Grancharov, and Georgi Georgiev. High performance poisson equation solver for hybrid cpu/gpu systems. 2013. [22] Martin Riedmiller and Heinrich Braun. A direct adaptive method for faster backpropagation learning: The rprop algorithm. In Neural Networks, 1993., IEEE International Conference on, pages 586–591. IEEE, 1993. [23] David E Rumelhart, Geoffrey E Hinton, Ronald J Williams, et al. Learning representations by back-propagating errors. Cognitive modeling, 5(3):1, 1988. [24] Yazdan Shirvany, Mohsen Hayati, and Rostam Moradian. Multilayer perceptron neural networks with novel unsupervised training method for numerical solution of the partial differential equations. Applied Soft Computing, 9(1):20–29, 2009. [25] Gordon D Smith. Numerical solution of partial differential equations: finite difference methods. Oxford university press, 1985. [26] Allen Taflove and Susan C Hagness. Computational electrodynamics: the finite-difference time-domain method. Artech house, 2005. 8
9cs.NE
Unions of Orthogonal Arrays and their aberrations via Hilbert bases arXiv:1801.00591v1 [math.ST] 2 Jan 2018 Roberto Fontana and Fabio Rapallo Abstract We generate all the Orthogonal Arrays (OAs) of a given size n and strength t as the union of a collection of OAs which belong to an inclusion-minimal set of OAs. We derive a formula for computing the (Generalized) Word Length Pattern of a union of OAs that makes use of their polynomial counting functions. In this way the best OAs according to the Generalized Minimum Aberration criterion can be found by simply exploring a relatively small set of counting functions. The classes of OAs with 5 binary factors, strength 2, and sizes 16 and 20 are fully described. 1 Introduction Design of Experiments plays a central role in several fields of applied Statistics, from Biology to Engineering, from Computer Science to Economics. The need of efficient experimental designs has led to the definition of several criteria for the choice of the design points. All such criteria aim to produce the best estimates of the relevant parameters for a given sample size. Here we limit our attention to fractional factorial designs together with the Generalized Minimum Aberration (GMA) criterion. In the framework of factorial experiments, Generalized Word-Length Pattern (GWLP) is an important tool for comparing fractional factorial designs. First introduced for regular fractions, GWLP has been generalized for non-regular multilevel designs by Xu and Wu [17]. Since the GWLP does not depend on the coding of the factor levels, Pistone and Rogantin [14] use the complex coding of the factor levels Roberto Fontana Department of Mathematical Sciences, Politecnico di Torino, corso Duca degli Abruzzi 24, 10124 Torino, Italy, e-mail: [email protected] Fabio Rapallo Department of Sciences and Technological Innovation, Università del Piemonte Orientale, viale Teresa Michel 11, 15121 Alessandria, Italy, e-mail: [email protected] 1 2 Roberto Fontana and Fabio Rapallo to express the basis of the polynomial complex functions over a design, and in particular of the counting function. Using this coding, the coefficients of the counting function are closely related with the aberrations and the GWLP. Moreover, the coefficients of the counting function can be expressed in terms of the counts of the levels appearing in each simple or interaction term. As general references for GWLP and its properties, the reader can refer to, e.g., [11], [4] and [13]. In practice, the GWLP is used to discriminate among different designs through the Generalized Minimum Aberration (GMA) criterion: given two designs F1 and F2 with m factors, the corresponding GWLPs are two vectors AFi = (A0 (Fi ) = 1, A1 (Fi ), . . . , Am (Fi )) i = 1, 2 . The GMA criterion consists in the sequential minimization of such GWLPs: F1 is better than F2 if there exists j such that A0 (F1 ) = A0 (F2 ), . . . , A j (F1 ) = A j (F2 ) and A j+1 (F1 ) < A j+1 (F2 ). The GMA criterion is usually applied to Orthogonal Arrays (OA), see [11]. In this work we use results from Combinatorics and Algebraic Geometry to ease the computation of the GWLP. The connection between the GWLP and the geometric structure of the design points is studied in [9], but we adopt here a different point of view. In particular, we show that the set of all OAs with given strength form are the points with integer entries of a cone defined through linear constraints. This allows us to write each OA as the union of elements of the Hilbert basis of the cone. Moreover, we show that the GWLP of the union of two or more fractions can be computed from the counting functions of such fractions. The computation of the Hilbert basis is done through combinatorial algorithms and its complexity increases fast with the number of factors and the number of factor levels. Thus, we illustrate explicit computations for relatively small designs. Nevertheless, the theory presented here can have also a theoretical interest and may be the basis of further developments. 2 Fractions, counting functions and aberration In this section, for ease in reference, we present some relevant results of the algebraic theory of Orthogonal Fractional Factorial Designs and we express the aberration of fractional designs using the coefficients of the polynomial counting function. This presentation is based on [7]. The interested reader can find further information, including the proofs of the propositions, in [8] and [15]. Unions of Orthogonal Arrays and their aberrations via Hilbert bases 3 2.1 Fractions of a full factorial design Let us consider an experiment which includes m factors D j , j = 1, . . . , m. Let us code the s j levels of the factor D j by the s j -th roots of the unity (s ) (s ) j D j = {ω0 j , . . . , ωs j −1 },  √ (s ) where ωk j = exp −1 2sπj k , k = 0, . . . , s j − 1, j = 1, . . . , m. The full factorial design with complex coding is D = D1 × · · · D j · · · × Dm . We denote its cardinality by #D, #D = ∏mj=1 s j . Definition 1. A fraction F is a multiset (F∗ , f∗ ) whose underlying set of elements F∗ is contained in D and f∗ is the multiplicity function f∗ : F∗ → N that for each element in F∗ gives the number of times it belongs to the multiset F . We recall that the underlying set of elements F∗ is the subset of D that contains all the elements of D that appear in F at least once. We denote the number of elements of a fraction F by #F , with #F = ∑ζ ∈F∗ f∗ (ζ ). In order to use polynomials to represent all the functions defined over D, including multiplicity functions, we define • X j , the j-th component function, which maps a point ζ = (ζ1 , . . . , ζm ) of D to its j-th component, X j : D ∋ (ζ1 , . . . , ζm ) 7−→ ζ j ∈ D j . The function X j is a simple term or, by abuse of terminology, a factor. • X α = X1α1 · . . . · Xmαm , α ∈ L = Zs1 × · · · × Zsm i.e., the monomial function X α : D ∋ (ζ1 , . . . , ζm ) 7→ ζ1α1 · . . . · ζmαm . The function X α is an interaction term. We observe that {X α : α ∈ L = Zs1 × · · · × Zsm } is a basis of all the complex functions defined over D. We use this basis to represent the counting function of a fraction according to the following definition. Definition 2. The counting function R of a fraction F is a complex polynomial defined over D so that for each ζ ∈ D, R(ζ ) equals the number of appearances of ζ in the fraction. A 0 − 1 valued counting function is called an indicator function of a single-replicate fraction F . We denote by cα the coefficients of the representation of R on D using the monomial basis {X α , α ∈ L}: R(ζ ) = ∑ cα X α (ζ ), ζ ∈ D, cα ∈ C . α ∈L With Prop. 1 from [15], we link the orthogonality of two interaction terms with the coefficients of the polynomial representation of the counting function. We denote by z the complex conjugate of the complex number z. 4 Roberto Fontana and Fabio Rapallo Proposition 1. If F is a fraction of a full factorial design D, R = ∑α ∈L cα X α is its counting functionand [α − β ] is the m-tuple made  by the componentwise difference in the rings Zs j , [α1 − β1]s1 , . . . , [αm − βm ]sm , then 1 1. the coefficients cα are given by cα = #D ∑ζ ∈F X α (ζ ); 1 α 2. the term X is centered on F i.e., #F ∑ζ ∈F X α (ζ ) = 0 if, and only if, cα = c[−α ] = 0; 3. the terms X α and X β are orthogonal on F if and only if, c[α −β ] = 0. We now define projectivity and, in particular, its relationship with Orthogonal Arrays. Given I = {i1 , . . . , ik } ⊂ {1, . . . , m}, i1 < . . . < ik and ζ = (ζ1 , . . . , ζm ) ∈ D we define the projection πI (ζ ) as πI (ζ ) = ζI ≡ (ζi1 , . . . , ζik ) ∈ Di1 × . . . × Dik . Definition 3. A fraction F factorially projects onto the I-factors, I = {i1 , . . . , ik } ⊂ {1, . . . , m}, i1 < . . . < ik , if the projection πI (F ) is a multiple full factorial design, i.e., the multiset (Di1 × . . . × Dik , f∗ ) where the multiplicity function f∗ is constant over Di1 × . . . × Dik . Definition 4. A fraction F is a (mixed) Orthogonal Array (OA) of strength t if it factorially projects onto any I-factors with #I = t. Proposition 2. A fraction factorially projects onto the I-factors, I = {i1 , . . . , ik } ⊂ {1, . . . , m}, i1 < . . . < ik , if and only if, all the coefficients of the counting function involving the I-factors only are 0. Prop. 2 can be immediately stated for mixed orthogonal arrays. Proposition 3. A fraction is an OA of strength t if and only if all the coefficients cα , α 6= 0 ≡ (0, . . . , 0) of the counting function up to the order t are 0. 2.2 GWLP and aberrations Using the polynomial counting function, [3] provides the following definition of the GWLP AF = (A0 (F ), . . . , Am (F )) of a fraction F of the full factorial design D. Definition 5. The Generalized Word-Length Pattern (GWLP) of a fraction F of the full factorial design D is a the vector AF = (A0 (F ), A1 (F ), . . . , Am (F )), where A j (F ) = ∑ aα j = 0, . . . , m , |α |0 = j aα =  kcα k2 c0 2 , (1) Unions of Orthogonal Arrays and their aberrations via Hilbert bases 5 |α |0 is the number of non-null elements of α , kzk2 is the norm of the complex number z, and c0 := c(0,...,0) = #F /#D. We refer to aα as the aberration of the interaction X α . In Prop. 4 we provide a formula to compute aα , and consequently A j (F ), j = 1, . . . , m, given a fraction F ⊆ D. Notice that A0 (F ) = 1 for all F . Moreover, in the case of binary designs, the coefficients of the counting function are real numbers and therefore the aberrations in Eq. (1) are simply  2 cα . aα = c0 Given a fraction F of the full factorial design D, let us consider its counting function R = ∑α ∈L cα X α . From item 1 of Prop. 1 the coefficients cα are given by cα = 1 #D ∑ X α (ζ ) ζ ∈F or equivalently cα = 1 #D ∑ R(ζ )X α (ζ ) . ζ ∈D To make the notation easier we use vectors and matrices and we make the nonrestrictive hypothesis that both the runs ζ of the full factorial design D and the multiindexes of L = Zs1 × · · · × Zsm are considered in lexicographic order. We obtain cα = 1 T 1 T Y Xα , X Y= #D α #D h α i where Xα is the column vector [ζ α : ζ ∈ D], X α is the column vector ζ : ζ ∈ D Y is the column vector [R(ζ ) : ζ ∈ D] and the exponent T denotes the transpose of a matrix. The square of the norm of a complex number z can be computed as zz. It follows that kcα k22 = cα cα and therefore we get T (#D)2 kcα k22 = (Y T X α )(X α Y ) = Y T X α Xα T Y . As in [5], we refer to Y as the counting vector of a fraction. 2.3 Counting vector and aberrations Here we present some properties of the aberrations and some results about the relationships between the aberrations and the counting vector of a fraction. The results are adapted to the complex coding for multilevel factors. 6 Roberto Fontana and Fabio Rapallo Proposition 4. Given a fraction F it holds: 1. aα = (Y T X α Xα T Y )/(#F )2 ; 2. Su(X α Xα T ) = 0, α 6= 0 where Su(A) is the sum of all the elements of the matrix A; 3. ∑mj=0 A j (F ) = ∑α ∈L aα = (#D ∑ζ ∈D Y [ζ ]2 )/(#F )2 ; −1 4. if Y [ζ ] ∈ {0, 1}, ζ ∈ D then ∑m i=0 Ai (F ) = #D/#F ≡ c0 . Proof. 1. From the definition of aα we get aα =  kcα k2 c0 2 = Y T X α Xα T Y (1/#D)2Y T X α Xα T Y = . (#F /#D)2 (#F )2 2. Let us consider the full factorial design D. Its counting vector is 1, i.e., the column vector with all the components equal to 1. The coefficients of its counting function are c0 = 1 and cα = 0 for all α 6= 0. We get aα = 0 for all α 6= 0. It follows that the sum of all the elements of the matrix X α Xα T is Su(X α Xα T ) = 1T X α Xα T 1 = (#D)2 aα = 0, α 6= 0 . 3. The sum of all the terms of the generalized word-length pattern is m Y T X α Xα T Y = (#F )2 α ∈L ∑ A j (F ) = ∑ aα = ∑ α ∈L j=0 = YT Y T XX T Y ∑α ∈L (X α Xα T )Y = = (#F )2 (#F )2 = #D ∑ζ ∈D Y (ζ )2 #DY T Y = , (#F )2 (∑ζ ∈D Y (ζ ))2 where X is the orthogonal matrix whose columns are Xα , α ∈ L. 4. It follows from item 3. by observing that Y [ζ ] ∈ {0, 1}, ζ ∈ D ⇒ Y [ζ ]2 = Y [ζ ] and then ∑ζ ∈D Y [ζ ]2 = #F . ⊓ ⊔ From items 3. and 4. of Prop. 4 we obtain that, for a given size n, the total aberration of a single-replicate fraction F1 (with counting vector Y1 ) will be less than the total aberration of a fraction F2 (with counting vector Y2 ) that admits replications. In fact, we get m ∑ A j (F1 ) = j=0 and #D , n m ∑ A j (F2 ) = j=0 #D ∑ζ ∈D Y2 [ζ ]2 n2 #D #D ∑ζ ∈D Y2 [ζ ]2 ≤ n n n because, given n, ∑ζ ∈D Y2 [ζ ]2 ≥ n. Unions of Orthogonal Arrays and their aberrations via Hilbert bases 7 Now, as in [10], let us consider the special case of OAs of size n and strength t (or equivalently with resolution t + 1), with m = t + 1 factors. Using the standard notation, we denote this class of OAs by OA(n, s1 . . . sm , m − 1). We can state the following proposition. Proposition 5. Let F ∈ OA(n, s1 . . . sm , m − 1). Then Am (F ) = #D ∑ζ ∈D Y [ζ ]2 − n2 . n2 If F is a single-replicate OA (i.e. Y [ζ ] ∈ {0, 1}, ζ ∈ D) then Am (F ) = #D − n . n Proof. Let us consider F ∈ OA(n, s1 . . . sm , m − 1). Then A0 (F ) = 1, A1 (F ) = · · · = Am−1 (F ) = 0 . From item 3. of Prop. 4 we get m Am (F ) = m−1 ∑ A j (F ) − ∑ A j (F ) = j=0 j=0 = #D ∑ζ ∈D Y [ζ ]2 #D ∑ζ ∈D Y [ζ ]2 − (#F )2 −1 = . 2 (#F ) (#F )2 In the special case Y [ζ ] ∈ {0, 1}, ζ ∈ D we get Am (F ) = #D − #F . #F ⊓ ⊔ We obtain a lower bound for Am (F ) as in Theorem 5 of [10]. Proposition 6. Let F ∈ OA(n, s1 . . . sm , m − 1). Then Am (F ) ≥ r(#D − r) , n2 where q and r are the quotient and the remainder when n is divided by #D, n = q#D + r (and q = 0 when n < #D). Proof. From Prop. 5 we know that Am (F ) = #D ∑ζ ∈D Y [ζ ]2 − n2 . n2 8 Roberto Fontana and Fabio Rapallo If we divide n by #D we can write n = q#D + r. The counting vector Ỹ that minimizes ∑ζ ∈D Y [ζ ]2 must be defined as ( q + 1 if ζ ∈ Br Ỹ [ζ ] = q if ζ ∈ D − Br where Br is any subset of D with r points. We obtain ∑ Ỹ [ζ ]2 = #Dq2 + 2rq + r . ζ ∈D It follows that Am (F ) ≥ #D(#Dq2 + 2rq + r) − (q#D + r)2 . (q#D + r)2 By simple algebra we obtain Am (F ) ≥ r(#D − r) . (#F )2 ⊓ ⊔ When we consider m > t + 1 factors a lower bound for At+1 (F ) can be obtained m by summing up all the lower bounds that are obtained using Prop. 6 for all the t+1 subsets of t + 1 factors of D1 , . . . , Dm . 3 The counting function of the union of fractions In this section we analyze the behavior of the aberrations (and thus of the GWLP) of a fraction obtained by merging two or more fractions. In particular we focus on OAs which can be expressed as the union of other OAs. First, it is worth noting that given a fraction F with counting function R(ζ ), we can consider a fraction ν F obtained by replicating ν times each design point of F . In such a case, it is immediate to check that the counting function of ν F is simply ν R(ζ ), and therefore all aberrations remain unchanged: (vR) aα (R) = aα , for all α ∈ L . In the following proposition we consider the union of k fractions, k ≥ 2. Proposition 7. Let us consider fractions F1 , . . . , Fk with n1 , . . . , nk design points, (i) respectively. Let us denote by Ri = ∑α ∈L cα the counting function of Fi , i = 1, . . . , k, by F the union F = F1 ∪ · · · ∪ Fk , by R = ∑ki=1 Ri the counting function of F and by n the size of F , n = n1 + . . . + nk . Unions of Orthogonal Arrays and their aberrations via Hilbert bases 9 The j-th element of the GWLP of F is k n2i (#D)2 (i ) (i ) Ai (Fi ) + 2 2 ∑ ∑ Re(cα1 cα2 ), j = 0, . . . , m . 2 n n i1 <i2 |α | = j i=1 A j (F ) = ∑ (2) 0 (R) Proof. Let us consider k = 2, i.e. F = F1 ∪ F2 . The aberration aα is (R) aα = (1) (2) (1) (2) (kcα + cα k2 )2 (c0 + c0 )2 . We obtain (1) (2) (1) (2) (1) (2) (kcα + cα k2 )2 = (kcα k2 )2 + (kcα k2 )2 + 2 Re(cα cα ) = n2 2 (2) n1 2 (1) (1) (2) ) aα + ( ) aα + 2 Re(cα cα ) = =( #D #D  1  2 (1) (2) (1) (2) = n1 aα + n22aα + 2(#D)2 Re(cα cα ) 2 (#D) (i) where aα refers to Fi , i=1,2. We also obtain (1) (2) (c0 + c0 )2 = ( It follows (R) aα = and A j (F ) = n1 n2 2 n2 . + ) = #D #D (#D)2  1  2 (1) (1) (2) 2 (2) 2 n a + n a + 2(#D) Re(c c ) α α α α 1 2 n2 (R) ∑ aα = =  n 2 |α |0 = j 1 n A j (F1 ) +  n 2 2 n  #D A j (F2 ) + 2 n 2 ∑ (1) (2) Re(cα cα ) |α |0 = j for j = 0, 1, . . . , m. The generalization of this formula to the case k > 2 is straightforward. ⊓ ⊔ In case of two-level designs, cα ∈ R and thus Eq. 2 becomes k n2i (#D)2 (i ) (i ) A (F ) + 2 i i ∑ cα1 cα2 , j = 0, . . . , m . 2 n2 i1∑ <i2 |α | = j i=1 n A j (F ) = ∑ 0 (i ) (i ) The term ∑|α |0 = j cα1 cα2 can be viewed as a kind of covariance between the coefficients of order j of the two counting functions Ri1 and Ri2 . 10 Roberto Fontana and Fabio Rapallo To illustrate the use of Prop. 7 on a very small example, let us consider the two regular fractions of the 23 design, whose union is the full-factorial: F1 = X1 X2 X3 = −1 1 R1 = (1 − X1X2 X3 ) ; 2 F2 = X1 X2 X3 = +1 1 R1 = (1 + X1X2 X3 ) . 2 In this case we have A0 (F1 ) = 1, A1 (F1 ) = A2 (F1 ) = 0, A3 (F1 ) = 1 ; A0 (F2 ) = 1, A1 (F2 ) = A2 (F2 ) = 0, A3 (F2 ) = 1 . As expected we obtain A0 (F ) = 1, A1 (F ) = A2 (F ) = 0 and  2  2  2 4 4 8 (1) (2) A3 (F ) = A3 (F1 ) + A3 (F2 ) + 2 c111 c111 = 0 8 8 4 (1) (2) because c111 = −1/2 and c111 = 1/2. 4 The Hilbert basis for Orthogonal Arrays In this section we define the set OA(•, D,t) of all the OAs with strength t of the full design D and we study its combinatorial and geometric properties. With respect to the standard notation, we allow the cardinality to vary, because our study will concern the union of two or more OAs, and thus we use the symbol • in place of the cardinality of the fraction. In the case of binary designs, this set has already been considered in [2], where the reader can find also a simple and comprehensive summary of the basic definitions from Combinatorics used here. The generalization to mixed-level designs can be found in [6]. As a preliminary remark, notice that to the set OA(•, D,t) can be associated in a natural way the set of the corresponding counting functions. With as slight abuse of notation, we use the same notation for both these sets. Lemma 1. The set OA(•, D,t) can be written in the form OA(•, D,t) = C ∩ N#D (3) where C is a polyhedral cone in R#D . Proof. Recall that a subset of Rk is a cone if for all x, y ∈ C and for all λ , µ ∈ R we have λ x + µ y ∈ C, and it is a polyhedral cone if in addition it can be written in the form n o C = x ∈ Rk : Ax ≥ 0 . (4) Unions of Orthogonal Arrays and their aberrations via Hilbert bases 11 In this setting it is enough to define the matrix A in such a way all the t-marginals of x are constant (i.e., the difference of any two elements in a t-marginal is equal to 0). ⊓ ⊔ In Combinatorics, objects like OA(•, D,t) expressed as the lattice points of a cone as in Eq. (3) are widely studied. See, e.g., Chapter 6 in [12] for a general introduction to semigroups, lattice ideals, and Hilbert bases. In this paper, we focus on the notion of Hilbert basis of a lattice, and we specialize its definition. Definition 6. A Hilbert basis of OA(•, D,t) is an inclusion-minimal finite set of Orthogonal Arrays B1 , . . . , Br such that each Orthogonal Array F ∈ OA(•, D,t) is F = c1 B1 + · · · + cr Br with coefficients c1 , . . . , cr ∈ N. Under mild conditions, which are satisfied by OA(•, D,t), the Hilbert basis exists and is unique. The Hilbert basis of OA(•, D,t) depends on the matrix A in Eq. (4), which in turn depends on the t-marginals of the Orthogonal Arrays. Thus, we have a different Hilbert basis for different D and t. From the computational point of view, there are specific algorithms to efficiently compute Hilbert bases. Such algorithms are available by means of specialized software. Currently, two choices are available: 4ti2, see [16], and the more recent package normaliz, see [1]. For our purpose, the use of one or the other software is equivalent. In our examples, we have used 4ti2, but the use of both these software is very easy. It is enough to input the matrix A defining the polyhedral cone and the software returns the corresponding Hilbert basis. Using the elements of the Hilbert basis, we can build all Orthogonal Arrays of any given sample size. As noticed in the Introduction, the limitation of our approach is due to the fact the computation of Hilbert bases is very intensive and the computational cost grows very fast when the full design becomes large. Therefore, the computations are limited to relatively small cases, which are to be considered as illustrative examples. 5 Computations We consider OAs of strength 2 for 5 factors, each with 2 levels, OA(•, 25 ,t). The Hilbert Basis for this problem contains 26, 142 different elements which can be classified according to their size as reported in Table 1. First, we focus on the OAs with size equal to 16. There are 162 OAs of size 16 in the Hilbert Basis. The remaining 16-run OAs can be generated considering all possible unions of two OAs of size equal 8. We denote  such OAs as (8 + 8)-run OAs. There are 60 8-run OAs and therefore 60 + 60 2 = 1, 830 possibly different 12 Roberto Fontana and Fabio Rapallo Table 1 The elements of the Hilbert basis for OA(•, 25 , 2) classified with respect to their sample size. size N 8 12 16 20 24 28 32 36 60 224 162 960 7680 8384 5760 2912 (8 + 8)-run OAs. We find 1, 770 different (8 + 8)-run OAs. The classification of the 162 + 1, 770 = 1, 932 OAs of size 16 according to the values of A3 (F ) is reported in Table 2. Table 2 Distribution of OA(16, 25 , 2) with respect to A3 (F ). type 0 16-run 2 (8 + 8)-run 10 0.25 0.5 A3 (F ) 0.75 1 1.5 2 Total 80 0 0 240 80 0 0 240 0 60 162 1, 770 0 1, 220 From Table 2 we immediately see that there are 12 designs with A3 (F ) = 0. We can choose the best design(s) among these 12 fractions. We find 2 OAs of the 16-run type for which A1 (F ) = A2 (F ) = A3 (F ) = A4 (F ) = 0 and A5 (F ) = 1. As a second example, we consider OAs with 20 runs. There are 960 OAs of size 20 in the Hilbert Basis. The remaining 20-run OAs can be generated by considering all possible unions of two OAs, one of size 8 and one of size 12. We denote such OAs as (8 + 12)-run OAs. There are 60 8-run OAs and 224 12-run OAs and therefore 60 · 224 = 13, 440 possibly different (8 + 12)-run OAs. We find 9, 792 different (8 + 12)run OAs. The classification of the 960 + 9, 792 = 10, 752 OAs of size 20 according to the values of A3 (F ) is reported in Table 3. Table 3 Distribution of OA(20, 25 , 2) with respect to A3 (F ). type 0.4 20-run 480 (8 + 12)-run 1, 632 A3 (F ) 0.72 1.04 Total 0 4, 800 960 9, 792 480 3, 360 Unions of Orthogonal Arrays and their aberrations via Hilbert bases 13 If we proceed as we did for OAs of size 16, focusing on the 2, 112 OAs with A3 = 0.4, we find 192 GMA-optimal OAs. These are of the (8 + 12)-run type and their Word Length Pattern is A1 (F ) = A2 (F ) = 0, A3 (F ) = 0.4, A4 (F ) = 0.2 and A5 (F ) = 0. Acknowledgements Both authors are partially supported by a INdAM GNAMPA 2017 project. References 1. Bruns, W., Ichim, B., Römer, T., Sieg, R., Söger, C.: Normaliz. algorithms for rational cones and affine monoids. Available at https://www.normaliz.uni-osnabrueck.de 2. Carlini, E., Pistone, G.: Hilbert bases for Orthogonal Arrays. J. Stat. Theory Pract. 1(3–4), 299–309 (2007) 3. Cheng, S.W., Ye, K.Q.: Geometric isomorphism and minimum aberration for factorial designs with quantitative factors. Ann. Statist. 32(5), 2168–2185 (2004) 4. Dey, A., Mukerjee, R.: Fractional Factorial Plans. John Wiley & Sons, New York (2009) 5. Fontana, R.: Counting vectors for orthogonal fractional factorial design generation. AIP Conference Proceedings 1368(1), 327–330 (2011) 6. Fontana, R.: Algebraic generation of minimum size orthogonal fractional factorial designs: an approach based on integer linear programming. Comput. Stat. 28(1), 241–253 (2013) 7. Fontana, R.: Generalized minimum aberration mixed-level orthogonal arrays: A general approach based on sequential integer quadratically constrained quadratic programming. Commun. Stat. Theory Methods 46(9), 4275–4284 (2017) 8. Fontana, R., Pistone, G., Rogantin, M.P.: Classification of two-level factorial fractions. J. Statist. Plann. Inference 87(1), 149–172 (2000) 9. Fontana, R., Rapallo, F., Rogantin, M.P.: Aberration in qualitative multilevel designs. J. Statist. Plann. Inference 174, 1–10 (2016) 10. Grömping, U., Xu, H.: Generalized resolution for orthogonal arrays. Ann. Statist. 42(3), 918– 939 (2014) 11. Hedayat, A.S., Sloane, N.J.A., Stufken, J.: Orthogonal Arrays: Theory and Applications. Springer New York, New York (2012) 12. Miller, E., Sturmfels, B.: Combinatorial Commutative Algebra. Springer, New York (2006) 13. Mukerjee, R., Wu, C.F.J.: A Modern Theory of Factorial Design. Springer, New York (2007) 14. Pistone, G., Rogantin, M.P.: Indicator function and complex coding for mixed fractional factorial designs. J. Statist. Plann. Inference 138(3), 787–802 (2008) 15. Pistone, G., Rogantin, M.P.: Indicator function and complex coding for mixed fractional factorial designs. J. Statist. Plann. Inference 138(3), 787–802 (2008) 16. 4ti2 team: 4ti2—a software package for algebraic, geometric and combinatorial problems on linear spaces. Available at www.4ti2.de 17. Xu, H., Wu, C.F.J.: Generalized minimum aberration for asymmetrical fractional factorial designs. Ann. Statist. 29(4), 1066–1077 (2001)
10math.ST
Backtracking Regression Forests for Accurate Camera Relocalization arXiv:1710.07965v1 [cs.CV] 22 Oct 2017 Lili Meng1 , Jianhui Chen2 , Frederick Tung2 , James J. Little2 , Julien Valentin3 , Clarence W. de Silva1 Abstract— Camera relocalization plays a vital role in many robotics and computer vision tasks, such as global localization, recovery from tracking failure, and loop closure detection. Recent random forests based methods directly predict 3D world locations for 2D image locations to guide the camera pose optimization. During training, each tree greedily splits the samples to minimize the spatial variance. However, these greedy splits often produce uneven sub-trees in training or incorrect 2D-3D correspondences in testing. To address these problems, we propose a sample-balanced objective to encourage equal numbers of samples in the left and right sub-trees, and a novel backtracking scheme to remedy the incorrect 2D3D correspondence predictions. Furthermore, we extend the regression forests based methods to use local features in both training and testing stages for outdoor RGB-only applications. Experimental results on publicly available indoor and outdoor datasets demonstrate the efficacy of our approach, which shows superior or on-par accuracy with several state-of-theart methods. I. INTRODUCTION Camera relocalization plays a critical role in robotics and augmented reality (AR), especially in indoor environments where GPS is not available. Light-weight and affordable visual sensors make camera relocalization algorithms an appealing alternative to GPS or other expensive sensors. Recent consumer robotics products such as iRobot 980 and Dyson 360 eyes are already equipped with visual simultaneous localization and mapping (SLAM) techniques, enabling them to effectively navigate in complex environments. In order to insert virtual objects in an image sequence (i.e., in AR applications), camera poses have to be estimated in a visually acceptable way. Random forests based methods are among the first machine learning methods for camera relocalization [1], [2], [3]. In these methods, the forest is trained to directly predict correspondences from image pixels to points in the scene’s 3D world coordinate. These correspondences are then used for camera pose estimation based on an efficient RANSAC algorithm without an explicit 3D model of the scene, which is very attractive when a 3D model is not available. The latest work [4], [5] extends these random forests based methods to test with just RGB images. However, depth images are still 1 Lili Meng and Clarence W. de Silva are with the Department of Mechanical Engineering, The University of British Columbia, Vancouver, Canada. {lilimeng,desilva}@mech.ubc.ca 2 Jianhui Chen, Frederick Tung and James J. Little are with the Department of Computer Science, The University of British Columbia, Vancouver, Canada. {jhchen14,ftung,little}@cs.ubc.ca 3 Julien Valentin is with PerceptiveIO Inc. United States. [email protected] The authors would like to thank Jamie Shotton, Torsten Sattler and Alex Kendall for helpful discussions. Balanced node Leaf node Unbalanced node Backtracking path … … Fig. 1: Decision tree using two split objectives and a backtracking method. The split nodes are illustrated as the pie charts which show the percentage of samples in the left and right sub-trees. In this five-level tree, the first two levels are split using the sample-balanced objective, while the rest of the levels are split using the unbalanced objectives (i.e., the spatial-variance objective). In testing, our method backtracks the tree to find the optimal prediction. necessary to get 3D world coordinate labels in the training stage. In the training stage of these random forests based methods, each tree greedily splits the samples to minimize the spatial variance. However, these greedy splits usually produce uneven left and right sub-trees, or incorrect 2D3D correspondences in the test. To address this problem, we propose a sample-balanced objective to encourage equal numbers of samples in the left and right sub-trees, and a novel backtracking scheme to remedy the incorrect 2D-3D correspondences caused by greedy splitting. We demonstrate the efficacy of our methods through evaluations on publicly available indoor and outdoor datasets. Some recent methods based on deep learning [6], [7], [8] overcome the challenges of using depth images for camera relocalization, extending their application to outdoor scenes. These methods train a convolutional neural network to regress the 6-DOF camera pose from a single RGB image in an end-to-end manner in real time. However, even integrating LSTM units on the CNN output [8], these methods still lead to much lower accuracy compared with methods based on random forests [1] in indoor scenes and local-feature based methods [9] in outdoor scenes in general. To eliminate the dependency on depth images while ensuring high accuracy, we integrate local features in the random forests, broadening the application of random forests methods to outdoor scenes for the first time while achieving the best accuracy against several strong state-of-the-art baselines. To summarize, our main contributions in this work are as follows: • We propose a sample-balanced objective that encourages equal numbers of samples in the sub-trees, increasing prediction accuracy while reducing training time. • We propose a novel backtracking scheme to remedy incorrect 2D-3D correspondence predictions caused by greedy splitting, further improving prediction accuracy. • We integrate local features in the regression forests, enabling the use of RGB-only images for both training and testing. The elimination of the dependence on depth images broadens the scope of application from indoor to outdoor scenes. II. R ELATED W ORK Camera relocalization is one of the fundamental computer vision and robotics problems. It has been widely studied in the context of large scale global localization [10], [11], [6], recovery from tracking failure [12], [13], loop closure detection in visual SLAM [14], global localization in mobile robotics [15], [16], and sports camera calibration [17], [5], [18]. Methods based on local features, keyframes, random forests and deep learning are four general categories of camera relocalization, although other successful variants and hybrid methods [19] exist. Local feature based approaches Local feature based methods [15], [10] usually match the descriptors extracted from the incoming frame and the descriptors from frames in the database. The 3D locations of the frames in world coordinates are also stored together with their descriptors. Then the combination of the perspective-three-point [20] and RANSAC [21] is usually employed to determine the camera pose. The local features, such as commonly used SIFT [22], can represent the image local properties, so they are more robust to viewpoint changes as long as a sufficient number of keypoints can be recognized. However, these methods require a large database of descriptors and efficient retrieval methods. Much recent work has focused on efficiency [9], scalability [23], and learning of feature detection, description, and matching [24]. Keyframe based approaches Methods based on keyframes [25], [26] hypothesize an approximate camera pose by computing whole-image similarity between a query image and keyframes. For example, randomized ferns encode an RGB-D image as a string of binary codes, which have been used to recover from tracking failure [13] and loop closure in SLAM [14]. However, these keyframe-based methods provide inaccurate matches when the query frame is significantly different from the stored keyframes. Random forests based approaches Approaches based on random forests have gained interest since the introduction of scene coordinate regression forests (SCRF) [1]. Random forests are used as regression for camera relocalization so we also refer to them as regression forests. These approaches first employ a regression forest to learn an estimate of each 2D image pixel’s corresponding 3D point in the scene’s world coordinates. Then the camera pose optimization is conducted by an adapted version of preemptive RANSAC. A hybrid discriminative-generative learning architecture is proposed in [2] to overcome the many local optima problem of non-convex optimization in SCRF. A method to train and exploit uncertainty from regression forests for accurate camera relocalization is presented in [3]. [5], [27], [4] extended the random forest based methods to use RGB images at test time, while depth images are still needed to get ground truth labels. [27] proposed multiple accurate initial solutions and defined a navigational structure over the solution space that can be used for efficient gradient-free local search. However, it needs an explicit 3D model as the auxiliary of the RGB image at test time. Only RGB pixel comparison features are used in the forest in [5], eliminating the dependency on the depth image at test time. Furthermore, it integrates random RGB features and sparse feature matching in an efficient and accurate way, allowing the method to be applied for fast sports camera calibration in highly dynamic scenes. SCRF has been extended [28] for online camera relocalization by adapting a pre-trained forest to a new scene on the fly. Deep learning based approaches Deep learning has led to rapid progress and impressive performance on a variety of computer vision tasks, such as visual recognition and object detection [29]. There are emerging works [6], [7], [8] for the camera relocalization task. PoseNet [6] trains a convolutional neural network to regress the 6-DOF camera pose from a single RGB image in an end-to-end manner in real time. Bayesian PoseNet [7] applies an uncertainty framework to the PoseNet by averaging Monte Carlo dropout samples from the posterior Bernoulli distribution of the Bayesian ConvNet’s weights. Besides the 6-D pose, it also estimates the model’s relocalization uncertainty. To improve the PoseNet accuracy, geometric loss function is explored in [30] and LSTM units are used on the CNN output to capture the contextual information. However, these deep learning based methods have much lower overall accuracy compared with random forests based methods in indoor scenes and local feature based methods in outdoor scenes. Moreover, high-end GPU dependency and high power consumption make these deep learning based methods less favorable for energy sensitive applications such as mobile robots. III. M ETHOD We model the world coordinate prediction problem as a regression problem: m̂p = fr (I, D, p|θ ) (1) where I is an RGB image, D is an optional depth image, p ∈ R2 is a 2D pixel location in the image I, mp ∈ R3 is the corresponding 3D scene coordinate of p, and θ is the model parameter. In training, {p, mp } are paired training data. In testing, the 3D world location m̂p is predicted by the model θ . Then, the camera parameters are estimated using predicted image-world correspondences in a RANSAC framework. The novelty of our method lies in both the regression forest training and prediction. First, besides the spatialvariance objective, we add a sample-balanced split objective in the training stage. This objective function encourages Dataset Indoor RGB-D Outdoor RGB Split Random SIFT Feature Types Backtrack Local descriptor Random WHT SIFT SIFT Algorithm 1 Decision Tree Prediction with Backtracking TABLE I: Image features. We use random features [1], SIFT features [22] and Walsh-Hadamard transform (WHT) features [32] for indoor and outdoor camera relocalization. equal numbers of samples in the left and right sub-trees. It decreases the correlation between individual trees so that the generalization error of the whole forest drops [31]. In practice, it acts as a regularization term in the training and thus improving the prediction accuracy. Second, we present a novel backtracking technique in prediction. The backtracking searches the tree again using a priority queue and decreases the chance of falling in a local minimum. A. Weak Learner Model A regression forest is an ensemble of decision trees T independently trained to minimize a regression error (e.g., 3D location error). Each tree is a binary tree consisting of split nodes and leaf nodes. Each split node i represents a weak learner parameterized by θi = {φi , τi } where φi is one dimension in features and τi is a threshold. In training, the decision tree optimizes the parameters θi of each node from the root node and recursively processes the child nodes until the leaf nodes by optimizing a chosen objective function as follows: ( h(p; θi ) = 0, if fφi (p) ≤ τi , go to the left subset SiL go to the right subset SiR (2) fφi (p) represents a general feature that is associated with pixel location p, the weak learner model can use various features according to application scenarios. Table I shows image features that are used in our method. More details on the image features are provided in Sec. IV where more context information is available. 1, if fφi (p) > τi , B. Training Objectives Our regression forest uses two objectives. At upper levels of a tree, we use a sample-balanced objective: Qb (Sn , θ ) = abs(|SnL | − |SnR |) |SnL | + |SnR | (3) where abs(.) represents the absolute value operator and |S| represents the size of set S. This objective penalizes uneven splitting. The sample-balanced objective has two advantages. First, it is faster as it only counts the number of samples in sub-trees. Second, it produces more accurate predictions in practice which is shown in experiments in Sec. IV. When the tree depth is larger than a threshold Lmax , we use the spatial-variance objective: Qv (Sn , θ ) = with V (S) = |Snd (θ )| ∑ |Sn | V (Snd (θ )) d∈{L,R} 1 ∑ km − m̄k22 |S| m∈S (4) Input: A decision tree T , testing sample S, maximum number of leaf nodes to examine Nmax Output: Predicted label and minimum feature distance 1: procedure T REE P REDICTION (T, S, Nmax ) 2: count ← 0 3: PQ ← empty priority queue 4: R ← 0/ . the prediction result 5: call T RAVERSE T REE(S, T, PQ, R) 6: while PQ not empty and count < Nmax do 7: T ← top of PQ 8: call T RAVERSE T REE(S, T, PQ, R) 9: end while 10: return R 11: end procedure 12: procedure T RAVERSE T REE (S, T, PQ, R) 13: if T is a leaf node then 14: dist ← distance(T. f eature, S. f eature) . e.g., L2 norm 15: if R is 0/ or dist < R.dist then 16: {R.label, R.dist} ← {T.label, dist} . update 17: end if 18: count = count + 1 19: else 20: splitDim ← T.splitDim 21: splitValue ← T.splitValue 22: if S(splitDim) < splitValue then 23: closestNode ← T.le f t 24: otherNode ← T.right 25: else 26: closestNode ← T.right 27: otherNode ← T.le f t 28: end if 29: add otherNode to PQ 30: call T RAVERSE T REE(S, closestNode, PQ, R) 31: end if 32: end procedure where m̄ is the mean of m in S and subset Snd is conditioned on the split parameter θ . The value Lmax is experimentally set. At the end of training, our method stores the weak learner parameters θi in each split node. In a leaf node, our method not only stores a mean vector of 3D positions but also a mean vector of local patch descriptors. The local patch descriptor will be used to choose the optimal predictions in a backtracking process described in Sec.III-C. C. Backtracking in Regression Forests Prediction In the test phase, a regression tree greedily predicts 3D locations by comparing the feature value and the split values in the split nodes. Because the comparison is conducted on a single dimension at a time, making mistakes is inevitable. To mitigate this drawback, we propose a backtracking scheme to find the optimal prediction within time budget using a priority queue. The priority queue stores the sibling nodes that are not visited along the path when a testing sample travels from the root node to the leaf node. The priority queue is ordered by increasing distance to the split value of each internal node. The backtracking continues until a predefined number Nmax of leaf nodes are visited. Algorithm 1 illustrates the detailed procedure of our backtracking technique. Fig. 1 illustrates the idea of using two objectives and the backtracking in a five-level decision tree. The first two levels use the sample-balanced objective while the next two levels use the spatial-variance objective. In the testing, the backtacking checks multiple leaf nodes to find the optimal prediction. D. Camera Pose Optimization When depth images are available (i.e., indoor application), we use the Kabsch algorithm [33] to estimate camera poses. Otherwise, we use the solvePnPRansac method from OpenCV. Because predictions from the regression forests may still have large errors, we use the preemptive RANSAC method [34] to remove outliers. IV. E VALUATIONS In this section, we evaluate our method on publicly available indoor and outdoor datasets against several strong stateof-the-art methods. A. Indoor Camera Relocalization Dataset: The 4 Scenes dataset was introduced by Valentin et al.[27] to push the boundaries of RGB-D and RGB camera relocalization. The recorded environments are significantly larger than the 7 Scenes dataset [1] (14 − 79m3 versus 2 − 6m3 ). This large environment is more practical for the application of indoor robot localization. The scenes were captured by a Structure.io depth sensor with an iPad RGB camera. Both cameras have been calibrated and temporally synchronized. The RGB image sequences were recorded at a resolution of 1296 × 968 pixels, and the depth resolution is 640 × 480. We re-sampled the RGB images to the depth image resolution to align these images. The ground truth camera poses were from BundleFusion [35], which is a realtime globally consistent 3D reconstruction system. We use the training/testing dataset splitting from [27]. Baselines and Error Metric: We use four state-of-theart methods as our baselines: SIFT+PnP, ORB+PnP, Random+SIFT [5], Multiscale Navigation Graph (MNG) [27]. The SIFT+PnP and ORB+PnP are based on matching local features, and the results are from [27]. These methods have to store a large database of descriptors. Random+SIFT [5] uses both random feature and sparse feature but in two separate steps. The sparse feature is used as a post-processing in this method. Our method is different from this method by simultaneously using both random feature and sparse features within the framework of regression forests. The multiscale navigation graph (MNG) method [27] estimates the camera pose by maximizing the photo-consistency between the query frame and the synthesized image which is conditioned on the camera pose. At test time, the MNG method requires the trained model (retrieval forests) and the 3D model of the scene. We report the percentage of test frames for which the estimated camera pose is essentially ‘correct’. A pose is correct when it is within 5cm translational error and 5o angular error of the ground truth. This accuracy is sufficient for camera relocation in restarting the camera tracking system and virtual reality [1]. Image Features on RGB-D Images: For the indoor dataset, we use random features and Walsh-Hadamard transform (WHT) features [32]. Random features and WHT features do not require expensive feature detection so they can speed up the process. They also provide a sufficient number of robust features in texture-less areas, which is important for indoor camera relocalization. In our method, random features are used for splitting decision trees in internal nodes, while WHT features are used to describe local patches in leaf nodes. The random features are based on pairwise pixel comparison as in [1], [3]: fφ (p) = I(p, c1 ) − I(p + δ , c2 ) D(p) (5) where δ is a 2D offset and I(p, c) indicates an RGB pixel lookup in channel c. The D(p) is a depth lookup. The φ contains feature response parameters {δ , c1 , c2 }. The WHT features that we use contain 20 components for each RGB channel, thus our total feature dimension is 60 for all the three channels. Main Results and Analysis: We present the main camera relocalization results in Table II. Besides our final method BTBRF, we also report the results of the unbalanced regression forest (UBRF) which does not use the sample-balanced objective, and the balanced regression forest (BRF) which uses both the sample-balanced objective and the spatialvariance objective in training but does not use backtracking in testing. In this dataset, sparse baselines do a reasonable job and the SIFT feature method is better than the ORB feature method. Our method using RGB-only images at test time achieves higher accuracy than SIFT+PnP, ORB+PnP, and Random+Sparse, and is less accurate than the MNG method. However, the MNG method needs an explicit 3D model to render synthetic images to refine the pose while our method does not need. Moreover, the MNG method needs a large number of synthetic images (9 times of the original training images) for data augmentation while the present method does not need that. Our method using RGB-D images at test time considerably outperforms all the baselines in accuracy for camera relocalization. To demonstrate that the improvement is indeed from the sample-balanced objective and backtracking, we compare the world coordinate prediction accuracy from our UBRF, BRF and BTBRF. Fig. 2 shows the accumulated percentage of predictions within error thresholds for four sequences. For a particular threshold, the higher the percentage, the more accurate the prediction is. The figure clearly shows Sequence Training Test Frame numbers training test — — — — Spatial Extent Kitchen Living Bed Kitchen Living Luke Floor5a Floor5b Gates362 Gates381 Lounge Manolis Average 744 1035 868 768 725 1370 1001 1391 2981 2949 925 1613 — 33m3 30m3 14m3 21m3 42m3 53m3 38m3 79m3 29m3 44m3 38m3 50m3 — 357 493 244 230 359 624 497 415 386 1053 327 807 — ORB+PnP RGB-D RGB SIFT+PnP RGB-D RGB 66.39% 41.99% 71.72% 63.91% 45.40% 54.65% 28.97% 56.87% 49.48% 43.87% 61.16% 60.10% 53.7% 71.43% 56.19% 72.95% 71.74% 56.19% 70.99% 38.43% 45.78% 67.88% 62.77% 58.72% 72.86% 62.2% Baselines Random+SIFT RGB-D RGB MNG RGB-D RGB+3D model BTBRF RGB-D RGB Our Results UBRF BRF RGB-D RGB-D RGB-D RGB-D BTBRF RGB-D RGB-D 85.7% 71.6% 66.4% 76.7% 66.6% 83.3% 66.2% 71.1% 51.8% 52.3% 64.2% 76.0% 69.3% 77.1% 69.6% 60.8% 82.9% 62.5% 39.3% 50.3% 58.5% 82.1% 51.4% 59.6% 68.5% 63.6% 82.6% 81.7% 71.6% 80.0% 65.3% 50.5% 68.0% 83.2% 88.9% 73.9% 74.6% 87.2% 75.6% 92.7% 95.1% 82.8% 86.2% 99.7% 84.6% 89.9% 98.9% 96.7% 92.9% 94.8% 98.0% 92.7% 70.3% 60.0% 65.7% 76.7% 52.2% 46.0% 49.5% 56.4% 67.7% 54.6% 54.0% 65.1% 59.9% 88.2% 90.5% 81.3% 85.7% 92.3% 71.5% 85.7% 92.3% 90.4% 82.3% 91.4% 93.9% 87.1% TABLE II: Camera relocalization results for the indoor dataset. We show the percentage of correct frames (within 5cm translational and 5◦ angular error) of our method on 4 Scenes dataset against four state-of-the-art methods: ORB+PnP, SIFT+PnP, Random+SIFT [5], and MNG [27]. The best performance is highlighted. 0.8 0.7 Percentage 0.6 0.5 0.4 0.3 0.2 Un-balanced Balanced Balanced + Backtracking 0.1 0 0 0.1 0.2 0.3 0.4 Un-balanced Balanced Balanced + Backtracking 0.5 0 0.1 0.2 0.3 0.4 Un-balanced Balanced Balanced + Backtracking 0.5 0 0.1 0.2 0.3 0.4 Un-balanced Balanced Balanced + Backtracking 0.5 0 0.1 0.2 0.3 Error threshold (m) Error threshold (m) Error threshold (m) Error threshold (m) (a) Apt1/living (b) Apt2/living (c) Office1/gates362 (d) Office2/5a 0.4 0.5 Fig. 2: Impact of the sample-balanced objective and backtracking on scene points prediction accuracy. These figures show the accumulated percentage of predictions within a sequence of inlier thresholds. Please note this accuracy is not the final camera pose accuracy. The proposed method with the sample-balanced objective (red lines) consistently has a higher percentage of inliers compared with the unbalanced objective (blue lines). Backtracking (green lines) further improves prediction accuracy. The maximum number of backtracking leaves is 16 here. Scene King’s College Old Hospital Shop Facade St Mary’s Church Average Spatial Extent 140x40m 50x40m 35x25m 80x60m Active Search (VSfM) [9] 0.67m, 0.52◦ 1.29m, 0.79◦ 0.17m, 0.53◦ 0.29m, 0.55◦ 0.61m, 0.60◦ Active Search (COLMAP)[9] 0.57m, 0.70◦ 0.52m, 1.12◦ 0.12m, 0.41◦ 0.22m, 0.62◦ 0.36m, 0.71◦ PoseNet [6] 1.92m, 2.31m, 1.46m, 2.65m, 2.08m, 5.40◦ 5.38◦ 8.08◦ 8.48◦ 6.83◦ Bayesian PoseNet[7] 1.74m, 4.06◦ 2.57m, 5.14◦ 1.25m, 7.54◦ 2.11m, 8.38◦ 1.92m, 6.28◦ CNN+ LSTM[8] 0.99m, 3.65◦ 1.51m, 4.29◦ 1.18m, 7.44◦ 1.52m, 6.68◦ 1.30m, 5.52◦ BTBRF (Ours) 0.39m, 0.36◦ 0.30m, 0.41◦ 0.15m, 0.31◦ 0.20m, 0.40◦ 0.27m, 0.39◦ TABLE III: Camera relocalization results for the outdoor Cambridge landmarks dataset. We show median performance for our method against four state-of-the-art methods: Active Search with [9] with Visual SfM and with COLMAP [36] for reconstruction, PoseNet [6], Bayesian PoseNet [7], and CNN+LSTM [8]. that our method with the sample-balanced objective and the backtracking technique is consistently better than the method without the sample-balanced objective and without backtracking. We analyze the influences of the backtracking number Nmax . Fig. 3 shows the camera relocalization accuracy against different Nmax . The accuracy is significantly improved within the first (about) 10 leaf nodes and saturates after that. Because the processing time linearly increases with the backtracking number, a small number of Nmax is preferred. B. Outdoor Camera Relocalization Dataset: The Cambridge landmarks dataset [6] is used to evaluate the developed method. It consists of data in a large scale outdoor urban environment. Scenes are recorded by a smart phone RGB camera at 1920 × 1080 resolution. The dataset also contains the structure-from-motion (SfM) models reconstructed with all images to get the ground truth camera pose. The dataset exhibits motion blur, moving pedestrians and vehicles, and occlusion, which pose great challenges for camera relocalization. Correct frames percentage 1 0.95 0.9 Apt1/living Apt2/living Office2/5a Office1/gates362 Mean 0.85 0 5 10 15 20 25 30 Backtracking leaf node numbers Fig. 3: Camera relocalization accuracy vs. backtracking leaf node numbers. The camera relocalization performance increases with more backtracking leaf nodes though eventually levels out. Baselines and Error Metric: Four state-of-the-art methods are used as the baselines: Active Search [9], PoseNet [6], Bayesian PoseNet [7], and CNN+LSTM [8]. Active Search employs a prioritized matching step that first considers features more likely to yield 2D-to-3D matches and then terminates the correspondence search once enough matches have been found. PoseNet trains a ConvNet as a pose regressor to estimate the 6-DOF camera pose from a single RGB image. Bayesian PoseNet improved the accuracy of PoseNet through an uncertainty framework by averaging Monte Carlo dropout samples from the posterior Bernoulli distribution of the Bayesian ConvNet’s weights. CNN+LSTM [8] uses a CNN to learn feature representations and LSTM units on the CNN output in spatial coordinates to capture the contextual information. The median translational error and rotational error are used here as in previous work [6], [7], [8] for fair comparison. Image Features on RGB Images: We use SIFT features [22] as local feature descriptors for the outdoor camera relocalization. Because the BTBRF method has to store the mean vector of feature descriptors in leaf nodes, 64dimension SIFT features are used to decrease the trained model size. In training, the 3D points of the SfM model are first projected to their corresponding images using ground truth camera poses. Then, SIFT features are associated with their corresponding 3D world coordinates using the nearest neighbor (between SIFT feature 2D locations and projected 2D locations) within a threshold (1 pixel). In testing, SIFT features are detected from images. Their 3D locations are predicted by the regression forests. Dubious correspondences (feature distance > 0.5) are removed before the preemptive RANSAC. Main Results and Analysis: Table III shows the median camera relocalization errors for the present method and the baseline methods. The results of PoseNet and Bayesian PoseNet are from the original papers. The results of active search and CNN+LSTM are from [8]. The present method considerably outperforms all these baselines for all scenes in terms of median translational and rotational errors. It is about an order of magnitude improvement in accuracy compared with PoseNet, five times as accurate as CNN+LSTM and twice as accurate as Active Search using the same visual SfM [37] reconstruction. Timings are not directly compared here as all these baselines are implemented on different highend GPUs while our current implementation is on a single CPU core. To gain some insight into how backtracking helps to improve the accuracy, Fig. 4 plots the camera relocalization accuracy against backtracking leaf node numbers. It shows that the camera relocalization errors significantly decrease within about 5 backtracking leaf nodes, which indicates that the relocalization accuracy can be improved by backtracking only a small number of leaf nodes. C. Qualitative Results Fig. 5 shows examples of qualitative results of our method in indoor scenes. In Fig. 5 (a), the estimated camera trajectory and the ground truth trajectory are highly overlapped in the scene, illustrating the accuracy of predicted camera locations. In Fig. 5 (b), several camera frusta show the accuracy of estimated camera orientation. These results show that the estimated camera poses are accurate in both location and orientation. Fig. 6 shows the qualitative results for the King’s College scene. The camera poses are uniformly sampled every ten frames to improve the visualization. D. Implementation Details The proposed method is implemented with C++ using OpenCV on an Intel 3GHz i7 CPU, 16GB memory Mac system. The node is available online 1 . The parameter settings for regression forest are: tree number T = 5; 500 (indoor) and 300 (outdoor) training images per tree; 5,000 randomly sampled pixels per training image (indoor); the number of SIFT features per image varies from around 500 to 1,500 (outdoor); the maximum depth of tree is 25; the maximum backtracking leaves is 16. For the test, the present unoptimized implementation takes approximately 1 second (indoor) and 2 seconds (outdoor) on a single CPU core. Most of the time is on the backtracking and the camera pose optimization part. It should be noted that the current implementation is not optimized for speed and no GPU is used, which makes it possible to speed up with more engineering effort and GPU implementation [38]. E. Limitations At the moment, the proposed BTBRF method has two limitations that should be improved in the future. First, it has to store mean local patch descriptors in leaf nodes, which increases the trained model size. Second, the time complexity of the backtracking is proportional to the value of Nmax , making the prediction process slower than the conventional regression forests method. We would like to look for ways of adaptively setting the value of Nmax to avoid unnecessary backtracking. 1 https://github.com/LiliMeng/btrf Median rotational error (degrees) Median translational error (meters) 1.2 Kings Old Hospital Shop Facade St Marys 1 0.8 0.6 0.4 0.2 0 0 5 10 15 Number of backtracking leaf nodes 20 1.8 Kings Old Hospital Shop Facade St Marys 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 0 0 5 10 15 20 Number of backtracking leaf nodes (b) (a) Fig. 4: Effect of backtracking leaf node numbers on camera relocalization accuracy on Cambridge landmarks dataset. (a) median translational error vs. backtracking leaf numbers (b) median rotational error vs. backtracking leaf numbers. Both median translational and rotational errors decrease with more backtracking leaf nodes though eventually level out. (a) (b) Fig. 5: Qualitative results for indoor dataset (from office2/gates381). Best viewed in color. The ground truth is in red and our estimated camera pose is in green. (a) camera trajectories. (b) several evenly sampled camera frusta are shown for visualization. Our method produces accurate camera locations and orientations. Note: the 3D model is only for visualization purposes and it is not used for our camera relocalization. Fig. 6: Qualitative results for the outdoor dataset Cambridge landmarks, King’s College. Best viewed in color. The camera poses are evenly sampled every ten frames for visualization. Camera frusta with hollow green frames show ground truth camera poses, while red ones with light opacity show our estimated camera poses. V. C ONCLUSIONS In this paper, we proposed a sample-balanced objective and a backtracking scheme to reduce the effect of greedy splitting and improve the accuracy for camera relocalization. The proposed methods are applicable to regression forests both for RGB-D and RGB camera relocalization, showing state-of-the-art accuracy in publicly available datasets. Furthermore, we integrated local features in regression forests, advancing regression forests based methods to use RGB-only images for both training and test, and broadening the application to outdoor scenes while achieving the best accuracy against several strong state-of-the-art baselines. For future work, implementing on a parallel computation architecture will make the current work more efficient. Moreover, it will be interesting to integrate our camera relocalization to an autonomous robot navigation system [39] . VI. ACKNOWLEDGEMENT The authors would like to thank The Institute for Computing, Information and Cognitive Systems (ICICS) Member Support Fund in University of British Columbia, Canada. R EFERENCES [1] J. Shotton, B. Glocker, C. Zach, S. Izadi, A. Criminisi, and A. Fitzgibbon, “Scene coordinate regression forests for camera relocalization in RGB-D images,” in CVPR, 2013. [2] A. Guzman-Rivera, P. Kohli, B. Glocker, J. Shotton, T. Sharp, A. Fitzgibbon, and S. Izadi, “Multi-output learning for camera relocalization,” in CVPR, 2014. [3] J. Valentin, M. Nießner, J. Shotton, A. Fitzgibbon, S. Izadi, and P. H. Torr, “Exploiting uncertainty in regression forests for accurate camera relocalization,” in CVPR, 2015. [4] E. Brachmann, F. Michel, A. Krull, M. Ying Yang, S. Gumhold, and c. Rother, “Uncertainty-driven 6D pose estimation of objects and scenes from a single RGB image,” in CVPR, 2016. [5] L. Meng, J. Chen, F. Tung, J. J. Little, and C. W. de Silva, “Exploiting random RGB and sparse features for camera pose estimation,” in BMVC, 2016. [6] A. Kendall, M. Grimes, and R. Cipolla, “PoseNet: A convolutional network for real-time 6-DOF camera relocalization,” in ICCV, 2015. [7] A. Kendall and R. Cipolla, “Modelling uncertainty in deep learning for camera relocalization,” in ICRA, 2016. [8] F. Walch, C. Hazirbas, L. Leal-Taixé, T. Sattler, S. Hilsenbeck, and D. Cremers, “Image-based localization with spatial LSTMs,” arXiv preprint arXiv:1611.07890, 2016. [9] T. Sattler, B. Leibe, and L. Kobbelt, “Efficient & effective prioritized matching for large-scale image-based localization,” IEEE Trans on PAMI, 2016. [10] D. Nister and H. Stewenius, “Scalable recognition with a vocabulary tree,” in CVPR, 2006. [11] A. Torii, R. Arandjelovic, J. Sivic, M. Okutomi, and T. Pajdla, “24/7 place recognition by view synthesis,” in CVPR, 2015. [12] G. Klein and D. Murray, “Parallel tracking and mapping for small AR workspaces,” in Mixed and Augmented Reality., 2007. [13] B. Glocker, J. Shotton, A. Criminisi, and S. Izadi, “Real-time RGB-D camera relocalization via randomized ferns for keyframe encoding,” Visualization and Computer Graphics, IEEE Trans. on, 2015. [14] T. Whelan, S. Leutenegger, R. F. Salas-Moreno, B. Glocker, and A. J. Davison, “Elasticfusion: Dense SLAM without a pose graph,” RSS, 2015. [15] S. Se, D. G. Lowe, and J. J. Little, “Vision-based global localization and mapping for mobile robots,” Robotics, IEEE Trans. on, 2005. [16] M. Cummins and P. Newman, “Appearance-only SLAM at large scale with FAB-MAP 2.0,” IJRR, 2011. [17] J. Chen and J. J. Little, “Where should cameras look at soccer games: Improving smoothness using the overlapped hidden markov model,” Computer Vision and Image Understanding, vol. 159, pp. 59–73, 2017. [18] J. Chen and P. Carr, “Mimicking human camera operators,” in WACV, 2015. [19] A. Rubio, M. Villamizar, L. Ferraz, A. Penate-Sanchez, A. Ramisa, E. Simo-Serra, A. Sanfeliu, and F. Moreno-Noguer, “Efficient monocular pose estimation for complex 3d models,” in ICRA, 2015. [20] X.-S. Gao, X.-R. Hou, J. Tang, and H.-F. Cheng, “Complete solution classification for the perspective-three-point problem,” PAMI, IEEE Trans. on, 2003. [21] M. A. Fischler and R. C. Bolles, “Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography,” Communications of the ACM, 1981. [22] D. G. Lowe, “Distinctive image features from scale-invariant keypoints,” IJCV, 2004. [23] G. Schindler, M. Brown, and R. Szeliski, “City-scale location recognition,” in CVPR, 2007. [24] V. Lepetit and P. Fua, “Keypoint recognition using randomized trees,” IEEE trans on PAMI, 2006. [25] A. P. Gee and W. W. Mayol-Cuevas, “6D relocalisation for RGBD cameras using synthetic view regression.” in BMVC, 2012. [26] J. Engel, T. Schöps, and D. Cremers, “LSD-SLAM: Large-scale direct monocular SLAM,” in ECCV, 2014. [27] J. Valentin, A. Dai, M. Nießner, P. Kohli, P. Torr, S. Izadi, and C. Keskin, “Learning to navigate the energy landscape,” in 3DV, 2016. [28] T. Cavallari, S. Golodetz, N. A. Lord, J. Valentin, L. Di Stefano, and P. H. Torr, “On-the-fly adaptation of regression forests for online camera relocalisation,” in CVPR, 2017. [29] J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You only look once: Unified, real-time object detection,” in CVPR, 2016. [30] A. Kendall and R. Cipolla, “Geometric loss functions for camera pose regression with deep learning,” in CVPR, 2017. [31] L. Breiman, “Random forests,” Machine learning, 2001. [32] Y. Hel-Or and H. Hel-Or, “Real-time pattern matching using projection kernels,” PAMI, IEEE Trans. on, 2005. [33] W. Kabsch, “A solution for the best rotation to relate two sets of vectors,” Acta Crystallographica Section A: Crystal Physics, Diffraction, Theoretical and General Crystallography, 1976. [34] D. Nistér, “Preemptive RANSAC for live structure and motion estimation,” Machine Vision and Applications, 2005. [35] A. Dai, M. Nießner, M. Zollöfer, S. Izadi, and C. Theobalt, “Bundlefusion: Real-time globally consistent 3D reconstruction using on-the-fly surface re-integration,” ACM Trans. on Graphics, 2017. [36] J. L. Schönberger and J.-M. Frahm, “Structure-from-motion revisited,” in CVPR, 2016. [37] C. Wu et al., “VisualSFM: A visual structure from motion system,” 2011. [38] T. Sharp, “Implementing decision trees and forests on a GPU,” in ECCV, 2008. [39] C. Wang, L. Meng, S. She, I. M. Mitchell, T. Li, F. Tung, W. Wan, M. Q. H. Meng, and C. de Silva, “Autonomous mobile robot navigation in uneven and unstructured indoor environments,” in IROS, 2017.
1cs.CV
IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 1 LETTER Bounded-Choice Statements for User Interaction in Imperative Programming arXiv:1308.1246v2 [cs.PL] 23 Nov 2015 Keehang KWON† , Member, Jeongyoon SEO† , and Daeseong KANG†† , Nonmembers SUMMARY Adding versatile interactions to imperative programming – C, Java and Android – is an essential task. Unfortunately, existing languages provide only limited constructs for user interaction. These constructs are usually in the form of unbounded quantification. For example, existing languages can take the keyboard input from the user only via the read(x)/scan(x) statement. Note that the value of x is unbounded in the sense that x can have any value. This statement is thus not useful for applications with bounded inputs. To support bounded choices, we propose new bounded-choice statements for user interation. Each input device (keyboard, mouse, touchpad, . . .) naturally requires a new bounded-choice statement. To make things simple, however, we focus on a bounded-choice statement for keyboard – kchoose – to allow for more controlled and more guided participation from the user. We illustrate our idea via CBI , an extension of the core C with a new bounded-choice statement for the keyboard. key words: interactions, bounded choices, read. 1. Introduction Adding versatile interactions to imperative programming – C, Java, Android, etc. – has become an essential task. Unfortunately, existing languages provide only limited constructs for user interaction. These constructs are usually in the form of unbounded quantification. For instance, the keyboard input statement that has been used in Java-like languages is restricted to the read/scan statement. The read statement is of the form read(x); G, where G is a statement and x can have any value. Hence, it is a form of an unbounded quantified statement. However, in many situations, the system requires a form of bounded-choice interactions; the user is expected to choose one among many alternatives. Examples include most interactive systems such as airline ticketing systems. The use of bounded-choice interactions is thus essential in representing most interactive systems. For this purpose, this paper proposes a bounded-choice approach to user interaction. Each input device naturally requires a new bounded-choice statement. To make things simple, however, we focus only on the keyboard device. It is straightforward to adjust our idea to other input devices such as mouse and touchpad. Manuscript received January 1, 2003. Manuscript revised January 1, 2003. Final manuscript received January 1, 2003. † The authors are with Computer Eng., DongA University. email:[email protected] †† The author is with Electronics Eng., DongA University. Toward this end, we propose a new bounded keyboard input statement kchoose(G1 , . . . , Gn ), where each Gi is a statement. This has the following execution semantics: ex(P, kchoose(G1 , . . . , Gn )) ← ex(P, Gi ) , where i is chosen (i.e., a keyboard input) by the user and P is a set of procedure definitions. The notation S ← R denotes the reverse implication, i.e., R → S. In the above definition, the system requests the user to choose i via the keyboard and then proceeds with executing Gi . If i is not among {1, . . . , n}, then we assume that the system does nothing. It can be easily seen that our new statement has many applications in representing most interactive systems. The following C-like code example reads a variable named emp from the keyboard, whose value represents an employee’s name. read(emp); switch (emp) { case tom: age = 31; break; case kim: age = 40; break; case sue: age = 22; break; default: age = 0; } In the above, the system requests the user to type in a particular employee. Note that the above code is based on unbounded quantification and is thus very awkward. It is also error-prone because the user may type in an invalid value. The above application obviously requires a bounded-choice interaction rather than one based on unbounded quantification. Our kchoose statement provides such a bounded-choice interaction for keyboard and is useful to avoid this kind of human error. Hence, instead of the above code, consider the statement print(“Enter 1 for tom, 2 for kim and 3 for sue:”); kchoose( emp = tom; age = 31, emp = kim; age = 40, emp = sue; age = 22 ); This program expresses the task of the user choosing IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 2 one among three employees. Note that this program is much easier and safer to use. The system now requests the user to select one (by typing 1,2,3) among three employees. After it is selected, the system sets his age as well. Generally speaking, the kchoose statement is designed to directly encode most interactive objects which require the user to choose one among several possible tasks. Hence, there is a rich realm of applications for this statement. For example, as we will see later in Section 3, the ATM machine requires the user to select one among 1) balance checking, 2) cash withdrawal, and 3) cash deposit. Hence, it can be directly encoded via the kchoose statement. It is easy to observe that kchoose statement can be built from the read-switch combination. For example, the above example can be rewritten in the following way. print(“Enter 1 for tom, 2 for kim and 3 for sue:”); read(n); switch (n) { case 1: emp = tom; age = 31; break; case 2: emp = kim; age = 40; break; case 3: emp = sue; age = 22; break; default: } It is then tempting to conclude that the kchoose construct is not needed because it can be built from the read-switch combination. However, this view is quite misleading. Without it, the resulting codes would be low-level for the following reasons: • The programmer must manually allocate a variable for the read construct. • The programmer must specify the numbering sequence in the switch statement. • The programmer must specify the default part. As a consequence, these codes are cumbersome, errorprone, difficult to read, and reason about. The kchoose construct should rather be seen as a well-designed, high-level abstraction for boundedchoice interaction and the read-switch combination should be seen as its low-level implementation. The advantage of the use of this construct becomes evident when an application has a long sequence of interactions with the user. Therefore, the need for this construct is clear. To our knowledge, this kind of construct has never been proposed before in imperative languages. This is quite surprising, given the ubiquity of boundedchoice interaction in interactive applications. The kchoose construct can be implemented in many ways. One way to implement the kchoose construct is via preprocessing, i.e., via transformation to plain C-like code. That is, kchoose(G1 , . . . , Gn ) is transformed to the following: int k; read(k); switch (k) { case 1: G′1 ; break; case 2: G′2 ; break; .. . case n: G′n ; break; default: } Here, k is a new, local storage, and G′1 , . . . , G′n are obtained from G1 , . . . , Gn via the same transformation. This paper focuses on the minimum core of C. This is to present the idea as concisely as possible. The remainder of this paper is structured as follows. We describe CBI , an extension of core C with a new boundedchoice statement for the keyboard in Section 2. In Section 3, we present an example of CBI . Section 5 concludes the paper. 2. The Language The language is core C with procedure definitions. It is described by G- and D-formulas given by the syntax rules below: G ::= true | A | x = E | G; G | read(x); G | kchoose(G1 , . . . , Gn ) D ::= A = G | ∀x D In the above, A in D represents a head of an atomic procedure definition of the form p(x1 , . . . , xn ) where x1 , . . . , xn are parameters. A in G represents a procedure call of the form p(t1 , . . . , tn ) where t1 , . . . , tn are actual arguments. A D-formula is called a procedure definition. In the transition system to be considered, G-formulas will function as the main statement, and a set of D-formulas enhanced with the machine state (a set of variable-value bindings) will constitute a program. Thus, a program is a union of two disjoint sets, i.e., {D1 , . . . , Dn }∪θ where each Di is a D-formula and θ represents the machine state. Note that θ is initially set to an empty set and will be updated dynamically during execution via the assignment statements. We will present an interpreter via a proof theory [1], [5]–[7]. Note that this interpreter alternates between the execution phase and the backchaining phase. In the execution phase (denoted by ex(P, G, P ′ )) it tries to execute a main statement G with respect to a program P and produce a new program P ′ by reducing G to simpler forms until G becomes an assignment statement or a procedure call. The rules (6), (7),(8) and (9) deal with this phase. If G becomes a procedure call, the interpreter switches to the backchaining mode. This is encoded in the rule (3). In the backchaining mode (denoted by bc(D, P, A, P ′ )), the interpreter tries to solve LETTER 3 a procedure call A and produce a new program P ′ by first reducing a procedure definition D in a program P to its instance (via rule (2)) and then backchaining on the resulting definition (via rule (1)). To be specific, the rule (2) basically deals with argument passing: it eliminates the universal quantifier x in ∀xD by picking a value t for x so that the resulting instantiation, written as [t/x]D, matches the procedure call A. The notation S seqand R denotes the sequential execution of two tasks. To be precise, it denotes the following: execute S and execute R sequentially. It is considered a success if both executions succeed. Similarly, the notation S parand R denotes the parallel execution of two tasks. To be precise, it denotes the following: execute S and execute R in any order. Thus, the execution order is not important here. It is considered a success if both executions succeed. The notation S choose R denotes the selection between two tasks. To be precise, it denotes the following: the machine selects and executes one between S and R. It is considered a success if the selected one succeeds. As mentioned in Section 1, the notation S ← R denotes reverse implication, i.e., R → S. Definition 1. Let G be a main statement and let P be a program. Then the notion of executing hP, Gi successfully and producing a new program P ′ – ex(P, G, P ′ ) – is defined as follows: (1) bc((A = G1 ), P, A, P1 ) ← ex(P, G1 , P1 ). % A matching procedure for A is found. (2) bc(∀xD, P, A, P1 ) ← bc([t/x]D, P, A, P1 ). % argument passing (3) ex(P, A, P1 ) ← (D ∈ P parand bc(D, P, A, P1 )). % a procedure call (4) ex(P, true, P). % True is always a success. (5) ex(P, x = E, P ⊎ {hx, E ′ i}) ← eval(P, E, E ′ ). % the assignment statement. Here, ⊎ denotes a set union but hx, V i in P will be replaced by hx, E ′ i. (6) ex(P, G1 ; G2 , P2 ) ← (ex(P, G1 , P1 ) seqand ex(P1 , G2 , P2 )). % sequential composition (7) ex(P, read(x); G, P1 ) ← ex(P ⊎{hx, kbdi}, G, P1 ). where kbd is the keyboard input and ⊎ denotes a set union but hx, V i in P will be replaced by hx, kbdi. (8) ex(P, kchoose(G1 , . . . , Gn ), P1 ) ← ((read the keyboard input i) seqand (i ∈ {1, . . . , n} seqand ex(P, Gi , P1 )) choose (i 6∈ {1, . . . , n} seqand (P1 == P))) If ex(P, G, P1 ) has no derivation, then the machine returns the failure. The rule (8) deals with bounded-choice interaction. To execute kchoose(G1 , . . . , Gn ) successfully, the machine does the following: (1) It reads and saves the keyboard input value i in some temporary storage. (2) Then it tries the first branch of the form i ∈ {1, . . . , n} seqand ex(P, Gi , P1 ). That is, it first checks whether i is legal, i.e., among {1, . . . , n}. The machine then executes Gi . (3) If the first branch fails, the machine tries the second branch of the form i 6∈ {1, . . . , n} seqand (P1 == P). That is, it first checks whether i is illegal, i.e., not among {1, . . . , n}. If it is illegal, then it means that it is the user, not the machine, who failed to do his job. Therefore, the machine sets P1 to P and returns the success. As an example of our language, the following G-formula kchoose( emp = tom; age = 31, emp = kim; age = 40, emp = sue; age = 22 ); expresses the task of the user choosing one among three employees. More examples are shown in Section 3. As mentioned earlier, the kchoose construct is a well-designed, high-level abstraction for boundedchoice interaction which is quite common to user interaction. As for its implementation, it can be bolted into the language as a basic statement or it can be supported via preprocessing. C++ macro code for some initial implementation of kchoose is available under http://www.researchgate.net/publication/ 282331184†. 3. Examples As an example, consider the following statement that performs ATM transaction. The types of ATM transaction are 1) balance checking, 2) cash withdrawal, and 3) cash deposition. An example of this class is provided by the following code where the program P is of the form: deposit() = print(“type 1 for $1 and 2 for $5:”); kchoose(amount = $1,amount = $5); . . . withdraw() = print(“type 1 for $1 and 2 for $5:”); kchoose(amount = $1,amount = $5); . . . balance() = . . . † Unfortunately, C++ has little support for variadic macros such as kchoose. For this reason, the current implementation supports only a limited number of arguments (up to 5, to be precise). We plan to improve this implementaton in the future. IEICE TRANS. ??, VOL.Exx–??, NO.xx XXXX 200x 4 we require is an implementation of this ATM machine using seven major procedures (deposit, withdrawal, balance, password processing, etc). Overall, there are five occurrences of bounded-choice interactions in the program. • For each language, we analyze five best implementations of the program by Computer Science undergraduate students in our Software Engineering classes. • Two different aspects are investigated, namely program length and programming effort. and the goal G is of the form: print(“type 1 for balance,2 for withdraw,3 for deposit”); kchoose(balance(), withdraw(), deposit()); In the above, the execution basically proceeds as follows: the machine asks the user to choose one among three procedures. If the user choose the withdrawal by typing 2, then the machine will ask the user again to choose the amount of the withdrawal. Then the execution will go on. Note that our code is very concise compared to the traditional one. As a second example, our language makes it possible to customize the amount for tuition via interaction with the user. The following C-like code displays the amount of the tuition, based on the user’s field of study. read(major); switch (major) { case english: tuition = $2,000; break; case medical: tuition = $4,000; break; case liberal: tuition = $2,200; break; default: tuition = 0; } print(tuition); The above code obviously requires a form of boundedchoice interaction rather than unbounded quantification and can thus be greatly simplified using the kchoose statement. This is shown below: print(“type 1 for english,2 for medical,3 for liberal:”); kchoose( major = english; tuition = $2,000, major= medical; tuition = $4,000, major = liberal; tuition = $2,200); print(tuition); Program length The following table shows the numbers of lines of five programs containing a statement, a declaration, or a delimiter such as a closing brace. C CBI program lines average line (127,130,135,142,154) (113,115,123,129,132) 137.6 122.4 We see that C codes are typically 10% longer than CBI . Work time and productivity The following table shows the total work time for designing, writing, and testing the program as measured by us in the classes. C CBI programming hours average hour (1.6,1.8,2.4,2.5,2.8) (1.2,1.4,1.5,1.6,2.1) 2.2 1.5 As we see, CBI takes less than 70% as long as C. This program expresses the task of the user choosing one among three majors. Note that this program is definitely better than the above: it is concise, much easier to read/write/use, and less error-prone. The system now requests the user to select one (by typing 1,2 or 3) among three majors. After it is selected, the system displays the amount of the tuition. 4. Empirical Study This section provides some empirical study comparing two languages, namely C and CBI . It has the following features: • The same program is considered for each language. A typical ATM machine in Korea has a sequence of 3 interactions for cash deposit, 4 for cash withdrawal, and 2 for checking balance. The program 5. Conclusion In this paper, we have extended core C by adding a bounded-choice statement. This extension allows kchoose(G1 , . . . , Gn ), where each Gi is a statement. This statement makes it possible for the core C to model decision steps from the user. The kchoose(G1 , . . . , Gn ) construct allows only a simple form of user input, i.e., natural numbers. A more flexible form of user input can be obtained using a parameterized kchoose statement of the form kchoose(c1 : G1 , . . . , cn : Gn ), where c1 , . . . , cn are (pairwise disjoint) strings. The semantics is that if some string ci is typed, then Gi will be executed. Thus, the latter allows the user to type more symbolic names rather than just numbers. We plan to investigate this possibility in the future. LETTER 5 Although we focused on the keyboard input, it is straightforward to extend our idea to the mouse input, which plays a central role in smartphone applications. For example, the statement mchoose(button1 : G1 , . . . , buttonn : Gn ) where each button is a graphic component located at some area can be adopted. The idea is that if buttoni is clicked, then Gi will be executed. It can be easily seen that this statement will greatly simplify smartphone programming. We plan to compare our construct to another popular approach: the monad construct in functional languages. We also plan to connect our execution model to Japaridze’s elegant Computability Logic [2], [3], which has many interesting applications (for example, see [4]) in information technology. 6. Acknowledgements We thank the anonymous reviewer for several helpful comments including the parameterized kchoose statement. This work was supported by Dong-A University Research Fund. References [1] G. Kahn, “Natural Semantics”, In the 4th Annual Symposium on Theoretical Aspects of Computer Science, LNCS vol. 247, 1987. [2] G. Japaridze, “Introduction to computability logic”, Annals of Pure and Applied Logic, vol.123, pp.1–99, 2003. [3] G. Japaridze, “Sequential operators in computability logic”, Information and Computation, vol.206, No.12, pp.1443-1475, 2008. [4] K. Kwon, S. Hur and M. Park, “Improving Robustness via Disjunctive Statements in Imperative Programming”, IEICE Transations on Information and Systems, vol.E96-D,No.9, pp.2036-2038, September, 2013. [5] J. Hodas and D. Miller, “Logic Programming in a Fragment of Intuitionistic Linear Logic”, Information and Computation, vol.110, No.2, pp.327-365, 1994. [6] D. Miller, G. Nadathur, F. Pfenning, and A. Scedrov, “Uniform proofs as a foundation for logic programming”, Annals of Pure and Applied Logic, vol.51, pp.125–157, 1991. [7] D. Miller, G. Nadathur, Programming with higher-order logic, Cambridge University Press, 2012.
6cs.PL
arXiv:1612.08454v1 [math.AC] 26 Dec 2016 INVERTIBILITY OF IDEALS IN PRÜFER EXTENSIONS CARMELO ANTONIO FINOCCHIARO AND FRANCESCA TARTARONE Abstract. Using the general approach to invertibility for ideals in ring extensions given by Knebush-Zhang in [9], we investigate about connections between faithfully flatness and invertibility for ideals in rings with zero divisors. 1. Introduction It is well-known that in an integral domain D the invertible ideals (i.e. ideals I for which there exists an ideal J such that IJ = D) are exactly the nonzero finitely generated ideals that are also locally principal ([3]). In many cases, like for Noetherian domains, the hypothesis ”finitely generated” can be omitted. For these domains the invertible ideals are exactly the nonzero locally principal ideals (fact that is not true in general as it is shown by numerous examples). In [6] the authors investigate about domains in which fathfully flat ideals are projective. We recall that in integral domains the notion of projective ideal is equivalent to the one of invertible ideal ([9, §2, Proposition 2.3]). In general an invertible ideal is projective but not conversely. Since in integral domains locally principal ideals coincide with the faithfully flat ideals ([1, Theorem 8]), the question posed in [6] on the equivalence between fathfully flat and projective ideals leads to study domains in which nonzero locally principal ideals are invertible. To this regard, S. Bazzoni in [2] conjectured that Prüfer domains for which the equivalence “invertible ideal ⇔ locally principal ideal” holds are exactly the ones with the finite character, i.e. each nonzero element of the domain belongs to finitely many maximal ideals. This conjecture was first proved in [8] and then it was extended to a larger class of domains using the more general concepts of t-ideal and t-finite character (see, for instance, [5]). The notion of ideal, in this context, is the one of fractional ideal; so it is related to the quotient field K of the integral domain D (we recall that a fractional ideal I is a D-submodule of K such that there exists d ∈ D \ (0) for which dI ⊂ D). Our aim in this paper is to study the interplay among the concepts of invertible, faithfully flat and flat ideal in unitary rings A with respect to any their ring extension B. In this context we will generalize, for instance, the Bazzoni’s conjecture about invertibility of ideals in Prüfer domains, to the so-called Prüfer extensions introduced by M. Knebush and D. Zhang in [9]. Key words and phrases. Manis valuation, invertible ideal, flatness. 2010 Mathematics Subject Classification. Primary: 13A15, 13A18, 13F05, 54A20. The first named author was supported by a Post Doc Grant from the University of Technology of Graz (Austrian Science Fund (FWF): P 27816). 1 2 CARMELO ANTONIO FINOCCHIARO AND FRANCESCA TARTARONE 2. flatness in ring extensions Let A ⊆ B be a ring extension and let S be an A-submodule of B. Following [9], we say that S is B-regular if SB = B. Moreover, S is B-invertible if there exists an A-submodule U of B such that SU = A. By [9, §2, Remark 1.10], if S is B-invertible, then it is B-regular and finitely generated, and U is uniquely determined; precisely U = [A :B S] := [A : S] := {x ∈ B : xS ⊆ A}. More generally, given two A-submodules S, T of B, we set [S :B T ] := [S : T ] := {x ∈ B : xT ⊆ S}. It is well-known that a B-regular A-submodule S of B is B-invertible if and only if it is finitely generated and locally principal [9, §2, Proposition 2.3]. This fact generalizes the characterization of invertible ideals in integral domains [3, II §5, Theorem 4]. From now on the term ideal will always mean an integral ideal. Proposition 2.1. Let A ⊆ B be a ring extension and let a be an ideal of A. Then, the following conditions are equivalent. (i) a is B-invertible. (ii) a is B-regular, finitely generated and flat. Proof. (i)=⇒(ii). We need only to show that a is flat, i.e., that for any ideal b of A the canonical map f : a ⊗ b −→ a is injective. By assumption, there are elements n X αi zi . Take now elements α1 , . . ., αn ∈ a and z1 , . . ., zn ∈ [A : a] such that 1 = i=1 a1 , . . ., am ∈ a, b1 , . . ., bm m m X X aj bj = 0. Then we a ⊗ b ) := ∈ b such that f ( j j j=1 j=1 have m X j=1 aj ⊗ b j = m X j=1 aj n X i=1 αi zi ! ⊗ bj = n X i=1   m n X X   αi ⊗ (aj zi )bj = αi ⊗ 0 = 0, j=1 i=1 and this proves that f is injective. (ii)=⇒(i). It suffices to show that a is locally principal. Assume there is a maximal ideal m of A such that the finitely generated and flat ideal aAm of Am is not principal. By [10, Lemma 2.1], we have aAm mAm = aAm , thus Nakayama’s Lemma implies aAm = 0. On the other hand, the fact that a is B-regular implies Bm = aBm = (aAm )Bm = 0, a contradiction. The proof is now complete.  Propositon 2.1 generalizes what is already known for ideals in integral domains (an ideal is invertible if and only if it is flat and finitely generated [11]). Moreover, note that, with the same notation of Proposition 2.1, a B-invertible ideal of A is also projective [9, Chapter 2, Proposition 2.3]. Remark 2.2. Let A be a ring. (a) If a is a faithfully flat ideal of A, then a is locally principal. As a matter of fact, let m be a maximal ideal of A. If aAm is not principal, then aAm = aAm mAm , by [10, Lemma 2.1]. Thus (0) = aAm /amAm = (a/am)(A−m) = Am ⊗A (a/am) = Am ⊗A (A/m⊗A a) = (Am ⊗A A/m)⊗A a INVERTIBILITY OF IDEALS IN PRÜFER EXTENSIONS 3 and, since a is faithfully flat, we have that A/m = Am ⊗A A/m = (0), which is a contradiction. (b) A locally principal ideal of a ring is not necessarily faithfully flat. For example, let p 6= q be two fixed prime integers and let A := Z/pqZ. We claim that the principal ideal i := pA of A is flat but not faithfully flat. Indeed, the equality A = i ⊕ qA shows that i is projective and a fortiori flat. Moreover, i = i2 and, since i is a maximal ideal of A, it follows that i is not faithfully flat by [3, Chapter 1, Section 3, Proposition 1]. In Remark 2.2 (b) it is easy to check that the ideal pA is not regular (p itself is a zero divisor). In the next result we will see that if we assume the B-regularity of an ideal in an extension B of A, then a locally principal ideal is faithfully flat. Proposition 2.3. Let A ⊆ B be a ring extension and let a be a B-regular ideal of A. Then, the following conditions are equivalent. (i) a is faithfully flat. (ii) a is locally principal. Proof. (i)=⇒(ii) is Remark 2.2(a). (ii)=⇒(i). Since a is B-regular, for any maximal ideal m of A, the principal ideal aAm is generated by an invertible element of BA−m . Thus aAm is BA−m -invertible and, a fortiori, a flat Am -module. This proves that a is flat. Let m be a maximal ideal of A. If am = a, then amAm = aAm and, since aAm is BA−m -invertible, mAm = Am , a contradiction. Thus am 6= a, for any maximal ideal m of A. By [3, Chapter 1, Section 3, Proposition 1], a is faithfully flat.  3. Ring extensions with the finite character Definition 3.1. Let A ⊆ B be a ring extension. We say that the ring extension A ⊆ B has the finite character if any B-regular ideal a of A is contained in only finitely many maximal ideals (i.e., the set V (a) ∩ Max(A) is finite where, as usual, V (a) is the set of the prime ideals of A containing a). It easily follows by definition that a ring extension A ⊆ B has the finite character if and only if any B-regular finitely generated ideal a of A is contained in only finitely many maximal ideals of A. It is easy to see that if A is an integral domain and B is the quotient field of A, then A ⊆ B has the finite character if and only if A has the finite character. Let (Ω, ≤) be a partially ordered set. We denote by Max≤ (Ω) the (possibly empty) set of all maximal elements of Ω. Two elements x, y ∈ Ω are said to be comaximal if there does not exist an element m ∈ Ω such that x, y ≤ m. A subset S of Ω is said to be comaximal if any two elements x, y ∈ S are comaximal. In the following Theorem 3.2, T. Dumitrescu and M. Zafrullah give conditions on Ω under which the set of maximal elements greater than a fixed element a ∈ Ω is finite. This result will be useful in the following to characterize ring extensions A ⊆ B with the finite character (see Corollary 3.3). Theorem 3.2. ([4, Theorem 15]) Let (Ω, ≤) be a partially ordered set and let Γ be a nonempty subset of Ω. Assume that the following properties hold. (a) For any x ∈ Ω there exists a maximal element m ∈ Ω such that x ≤ m. 4 CARMELO ANTONIO FINOCCHIARO AND FRANCESCA TARTARONE (b) If a1 , a2 ∈ Γ, b ∈ Ω and a1 , a2 ≤ b, there is an element a ∈ Γ such that a1 , a2 ≤ a ≤ b. (c) If b1 , b2 ∈ Ω are comaximal elements, there are comaximal elements a1 , a2 ∈ Γ such that ai ≤ bi , for i = 1, 2. Then, the following conditions are equivalent. (i) For any a ∈ Γ, the set {x ∈ Max≤ (Ω) : x ≥ a} is finite. (ii) For any a ∈ Γ, any comaximal subset of Γ consisting of elements ≥ a is finite. Corollary 3.3. Let A ⊆ B be a ring extension. Then, the following conditions are equivalent. (i) The ring extension A ⊆ B has the finite character. (ii) For any finitely generated and B-regular ideal a of A, each collection of mutually comaximal finitely generated and B-regular ideals containing a is finite. Proof. Set Ω := {a ( A : a is a B-regular ideal of A} Γ := {a ∈ Ω : a is finitely generated} and order Ω by the inclusion ⊆. Now, we claim that assumptions (a), (b) and (c) of Theorem 3.2 are satisfied by Ω and Γ. Condition (a) follows immediately by the equality Max⊆ (Ω) = Max(A) ∩ Ω, whose proof is straightforward. Now, let a1 , a2 ∈ Γ and let b ∈ Ω such that a1 , a2 ⊆ b. Thus a := a1 + a2 is a proper finitely generated B-regular ideal of A such that a1 , a2 ⊆ a ⊆ b, and this proves condition (b). Now, take comaximal elements b1 , b2 ∈ Ω. Then, the B-regular ideal b1 + b2 cannot belong to Ω, i.e., b1 + b2 = A. Pick elements β1 ∈ b1 , β2 ∈ b2 such that 1 = β1 + β2 . On the other hand, since b1 , b2 are B-regular, there are elements β11 , . . ., β1n ∈ b1 , β21 , . . ., β2m ∈ b2 such that (β11 , . . ., β1n )B = (β21 , . . ., β2m )B = B. := (β1 , β11 , . . ., β1n )A ⊆ b1 , b′2 := (β2 , β21 , . . ., β2m )A ⊆ b2 are Then the ideals finitely generated, comaximal and B-regular. This shows that also assumption (c) in Theorem 3.2 is satisfied. The conclusion is now clear.  b′1 Proposition 3.4. Let A ⊆ B be a ring extension with the finite character. Then every B-regular and locally finitely generated ideal of A is finitely generated. Proof. Let a be a B-regular and locally finitely generated ideal of A. By Bregularity, there exists a finitely generated ideal a0 ⊆ a that is itself B-regular. By the finite character of the extension A ⊆ B, the set Max(A) ∩ V (a0 ) is finite, say Max(A) ∩ V (a0 ) = {m1 , . . ., mr , mr+1 , . . ., ms }, where Max(A) ∩ V (a) = {m1 , . . ., mr }. For any i = 1, . . ., r, there is a finitely generated ideal ai ⊆ a such that aAmi = ai Ami . For j = r + 1, . . ., s pick an e lement ai ∈ a − mi . Now consider the (finitely generated) ideal b := a0 +a1 +. . .+ar +(ar+1 , . . ., as )A of A. We claim that a = b. To prove this, it suffices to show the equality locally. If m ∈ Max(A) − V (a), then it is easy to infer that aAm = bAm = Am . If m = mi , for some i = 1, . . ., r, then ai Ami ⊆ bAmi ⊆ aAmi = ai Ami , that is aAmi = bAmi = ai Ami . The proof is now complete.  The following result is an immediate consequence of Propositions 2.1, 2.3 and 3.4. Corollary 3.5. Let A ⊆ B be a ring extension with the finite character. Then, every B-regular and locally principal ideal of A is B-invertible. INVERTIBILITY OF IDEALS IN PRÜFER EXTENSIONS 5 Lemma 3.6. Let A ⊆ B be a ring extension and let F be a collection of parwise comaximal B-invertible ideals of A containing a fixed ideal a of A. Consider the ideal ) ( n Y bi ⊆ a, for some b1 , . . ., bn ∈ F i := iF := a ∈ A : a i=1 of A. Then, the following properties hold. (a) If i is finitely generated, then there is a finite subset G := {b1 , . . ., bn } of F such that ) ( n Y bi ⊆ a i= a∈A:a i=1 (b) If m is a maximal ideal of A, we have ( aAm if m + b, for any b ∈ F iAm = [a : b0 ]Am if b0 is the unique ideal in F contained in m Proof. The idea of the argument we are giving will follow, mutatis mutandis, the pattern of [5, Lemma 1.10]. Q If i := (x1 , . . ., xn )A and Fi ⊆ F is a finite set of ideals such that xi b∈Fi b ⊆ a, Sn then it suffices to take G := i=1 Fi . Thus (a) is clear. (b). Let m be a maximal ideal of A. First, assume that none of the ideals in F is contained in m. Since clearly a ⊆ i, it is enough to prove that iAm ⊆ aAm . x Consider a fraction s ∈ iAm , with x ∈ i, let s ∈ A − m, and let b1 , . . ., bn ∈ F be Qn such that x i=1 bi ⊆ a. For i = 1, . . ., n choose elements bi ∈ bi − m. Then Qn x i=1 bi x = Qn ∈ aAm s s i=1 bi Now assume that there is an ideal b0 ∈ F such that b0 ⊆ m. The fact that the ideals in F are pairwise comaximal implies that b * m, for any b ∈ F − {b0 }. Since b0 is B-invertible and a ⊆ b0 , it follows easily that [a : b0 ] ⊆ i. Let x, s, b1 , . . ., bn be as before. If b0 6= bi , for any i = 1, . . ., n, then the same argument given above shows that xs ∈ aAm ⊆ [a : b0 ]Am . Assume now that b0 = bi , for some i. Set (Q if {b1 , . . ., bn } − {b0 } 6= ∅ j6=i bj p := 1 otherwise where, as before, bj ∈ bj − m, for j 6= i. Thus xpb0 ⊆ a, that is x xp = ∈ [a : b0 ]Am s sp The proof is now complete.  4. Prüfer extensions In this section we use terminology and notation of [9]. For the reader convenience, we give the basic definitions that are used in the following. Let R be a ring, (Γ, ≤) be a (additive) totally ordered abelian group and ∞ ∈ /Γ be an element satisfying, by convention, γ < ∞, γ ± ∞ := ∞, for any γ ∈ Γ. A Manis valuation on R is a map v : R → Γ ∪ {∞} satisfying the following conditions: • v(R) − {∞} is a group. • v(rs) = v(r) + v(s), for each r, s ∈ R. 6 CARMELO ANTONIO FINOCCHIARO AND FRANCESCA TARTARONE • v(r + s) ≥ min{v(r), v(s)}, for each r, s ∈ R. • v(0) = ∞. A Manis valuation subring A of R is a subring of R for which there exists a Manis valuation v on R with A = Av := {r ∈ R : v(r) ≥ 0}. Moreover, p := {r ∈ R : v(r) > 0} is a prime ideal of Av and (Av , pv ) is called a R-Manis pair (or a Manis pair in R). For the reader convenience, we recall now the notion of generalized localization of a ring in an extension. Let A ⊆ B be a ring extension, and let p be a prime ideal of A. Let j : B −→ BA\p denote the usual localization map. Then the generalized localization of A at p in B is the subring A[p] := j −1 (Ap ) of B ([9, p. 18]). If A is an integral domain with quotient field K (in this case K plays the role of B) and p is a prime ideal of A, then the generalized localization of A at p in K is the usual localization Ap . Definition 4.1. ([9]) Let A ⊆ B be a ring extension. We say that A is weakly surjective in B if Am = BA−m , for any maximal ideal m of A such that mB 6= B. We say that A is Prüfer in B or that A ⊆ B is a Prüfer extension if (A[m] , m[m] ) is a Manis pair in B, for any maximal ideal m of A. We observe that in the case A is an integral domain and B is its quotient field, the ring extension A ⊆ B is always weakly surjective. We recall that one of the many characterizations of Prüfer domains says that an integral domain is Prüfer if and only if every nonzero finitely generated ideal is invertible ([7]). The following theorem is a natural extension of the above result. Theorem 4.2. ([9, Chapter 2, Theorem 2.1]) For a ring extension A ⊆ B, the following conditions are equivalent. (i) A is Prüfer in B. (ii) A is weakly surjective in B and every finitely generated and B-regular ideal of A is B-invertible. Definition 4.3. Let A ⊆ B be a ring extension. We say that A is almost Prüfer in B (or that A ⊆ B is an almost Prüfer extension) if every finitely generated B-regular ideal of A is B-invertible. As it is shown in the following Example 4.4, the weakly surjectivity of an extension A ⊆ B and the property that every finitely generated and B-regular ideal of A is B-invertible are independent. Example 4.4. Let K be a field. Identify K with a subring of K 2 via the diagonal embedding x 7→ (x, x). Then K is almost Prüfer on K 2 , but it is not Prüfer in K 2 , since K is not weakly surjective in K 2 , as it is easily seen. Example 4.4 shows that the class of Prüfer ring extensions is properly contained in the class of almost Prüfer extensions. In Proposition 2.3 we show that, given a ring extension A ⊆ B, a B-regular ideal of A is faithfully flat if and only if it is locally principal. Thus, we extend and prove Bazzoni’s conjecture to almost Prüfer ring extensions. We will see that in the following Theorem the weakly surjective property of a ring extension A ⊆ B is not needed to prove the statement. Thus, in this case, the notion of Prüfer extension is too strong and we deal with almost Prüfer extensions. INVERTIBILITY OF IDEALS IN PRÜFER EXTENSIONS 7 Theorem 4.5. Let A ⊆ B be an almost Prüfer extension. Then, the following conditions are equivalent. (i) Every B-regular and locally principal ideal of A is B-invertible. (ii) The extension A ⊆ B has the finite character. Proof. The implication (ii)=⇒(i) is Corollary 3.5 and holds without requiring that A ⊆ B is almost Prüfer. (i)=⇒(ii). Let a be a finitely generated and B-regular ideal of A, and let F be a collection of mutually comaximal finitely generated and B-regular ideals of A containing a. In view of Corollary 3.3, it suffices to prove that F is finite. Consider the ideal of A defined in Lemma 3.6: ) ( n Y bi ⊆ a, for some b1 , . . ., bn ∈ F . iF := x ∈ A : x i=1 First note that iF is B-regular, since a is B-regular and a ⊆ iF . Since A ⊆ B is an almost Prüfer extension, a and all ideals in F are B-invertible. In particular, for any ideal b ∈ F , the ideal [a : b] is B-invertible. Keeping in mind Lemma 3.6(b), it follows that the B-regular ideal iF is locally principal and thus, by condition (i), it is B-invertible and, a fortiori, finitely generated. By Lemma 3.6(a), Qn we can pick finitely many ideals b1 , . . ., bn ∈ F such that iF = {x ∈ A : x i=1 bi ⊆ a}. If F = {b1 , . . ., bn } we have done. Otherwise, take a (B-invertible) ideal b ∈ FQ − {b1 , . . ., bn }. Since a[A : b]b = a, we have a[A : b] ⊆ iF , and Qnthus a[A : n ⊆ a. Since a is B-invertible, last inclusion implies [A : b] i=1 bn ⊆ A, b] i=1 biQ n and thus i=1 bi ⊆ b. Since b is comaximal with each bi , there is an ideal c ⊆ b such that n n Y Y bi + c ⊆ b + c ⊆ b ⊆ A. (b + bi ) = A= i=1 i=1 This shows that F − {b1 , . . ., bn } ⊆ {A}. Thus F is finite and, by Corollary 3.3, the result is completely proved.  Let A be a commutative ring with identity and let T (A) be the total quotient ring of A. An element a ∈ A is said to be regular if it is not a zero divisor, and an ideal of A is said to be regular if it contains a regular element. Recall that A is a Prüfer ring if every finitely generated regular ideal of A is invertible. Clearly, an ideal a of A is regular if and only if a is T (A)-regular; a is invertible if and only if a is T (A)-invertible; and the extension A ⊆ T (A) has the finite character if and only if every regular element of A is contained in only finitely many maximal ideals of A (i.e., A has the finite character). Thus, by Theorem 4.5, we have Corollary 4.6. Let A be a Prüfer ring. Then every regular locally principal ideal of A is invertible if and only if A has the finite character. The authors would like to thank the referee for her/his careful reading and for some substantial comments. References [1] D.D. Anderson and D.F. Anderson, Some remarks on cancellation ideals, Math. Japon, 29 no. 6 (1984), 879–886. [2] S. Bazzoni, Class semigroups of Prüfer domains, J. Algebra 184 (1996), 613-631. [3] N. Bourbaki, Commutative Algebra Chaptes 1–7, Springer, 1989. 8 CARMELO ANTONIO FINOCCHIARO AND FRANCESCA TARTARONE [4] T. Dumistrescu and M. Zafrullah, Characterizing domains of finite ∗-character, J. Pure Appl. Algebra, 214 (2010), 2087–2091. [5] C. A. Finocchiaro, G. Picozza, F. Tartarone, Star-invertibility and t-finite character in integral domains, J. Algebra Appl. 10 (2011), no. 4, 755–769. [6] S. Glaz and W.V. Vasconcelos, Flat ideals II, Manuscripta Math. 22 no.4 (1977), 325–341. [7] R. Gilmer, Multiplicative Ideal Theory, Queen’s Papers in Pure and Applied Mathematics, vol. 90, Queen’s University, Kingston, Ontario, Canada, 1992. [8] W.C. Holland, J. Martinez, W.Wm. McGovern and M.Tesemma, Bazzoni’s Conjecture, J. Algebra 320 (2008), 1764-1768. [9] M. Knebush and D. Zhang, Manis valuations and Prüfer extensions I, Lecture Notes in Mathematics 1791, Springer, 2002. [10] J. Sally and V. Vasconcelos, Flat ideals I, Comm. Algebra 3(6) (1975), 531–543. [11] V. Vasconcelos, On Finitely Generated Flat Modules, Trans. Amer. Math. Soc. 138(6) (1969), 505-512. (Carmelo Antonio Finocchiaro) Institute of Analysis and Number Theory, University of Technology, 8010 Graz, Kopernikusgasse 24 - Austria E-mail address: [email protected] (Francesca Tartarone) Dipartimento di Matematica, Università degli studi Roma Tre, Largo San Leonardo Murialdo 1, 00146 Roma, Italy E-mail address: [email protected]
0math.AC
A review of change point detection methodsI C. Truonga,b,∗, L. Oudrec , N. Vayatisa,b a CMLA, ENS Cachan, CNRS, Université Paris-Saclay, 94235, Cachan, France G, University Paris Descartes, CNRS, 75006 Paris, France c L2TI, University Paris 13, 93430 Villetaneuse, France arXiv:1801.00718v1 [cs.CE] 2 Jan 2018 b Cognac Abstract In this work, methods to detect one or several change points in multivariate time series are reviewed. They include retrospective (off-line) procedure such as maximum likelihood estimation, regression, kernel methods, etc. In this large area of research, applications are numerous and diverse; many different models and operational constraints (on precision, complexity,...) exist. A formal framework for change point detection is introduced to give sens to this significant body of work. Precisely, all methods are described as a collection of three elements: a cost function, a search method and a constraint on the number of changes to detect. For a given method, we detail the assumed signal model, the associated algorithm, theoretical guarantees (if any) and the application domain. This approach is intended to facilitate prototyping of change point detection methods: for a given segmentation task, one can appropriately choose among the described elements to design an algorithm. Keywords: change point detection, signal segmentation, review, non-parametric method, signal processing 1. Introduction Segmenting time series is central to a wide range of applications. Many real-world data streams are made of consecutive regimes separated by an abrupt change. In such situations, the underlying model producing the data switches multiple times. Some regimes can be of no use or even interfere with signal processing algorithms. This particular issue arises in contexts ranging from speech recognition to medical monitoring [22, 28, 33, 72, 107]. 2. General setting Before reviewing methods from the literature, the change point detection problem is formally introduced, especially the general setting and the methodology developed in this work. To ease notations, we make the following shorthands: I This work was supported by a public grant as part of the Investissement d’avenir project, reference ANR-11-LABX0056-LMH, LabEx LMH. ∗ Corresponding author y0..t? 1 yt? ..t? 1 2 yt? ..T 2 ? ? Figure 1: Signal example y = {yt }100 t=1 with two change points t1 and t2 . - for a given signal y = {yt }Tt=1 , the (b − a)-sample long sub-signal {yt }bt=a+1 (1 ≤ a < b ≤ T ) is simply denoted ya..b ; the complete signal is therefore y = y0..T ; - a set of indexes is denoted by a bold letter: t = {t1 , t2 , . . . } ⊂ {1, . . . , T }, and its cardinal is |t|; - for a set of indexes t = {t1 , . . . , tK }, the dummy indexes t0 := 0 and tK+1 := T are implicitly available; - for a given index (of a change point) t (1 ≤ t ≤ T ), the associated fraction (of a change point) is τ := t/T ∈ (0, 1]; - a set of fractions is denoted by a bold greek letter: τ = {τ1 , τ2 , . . . }, and its cardinal is |ττ |. Notations are illustrated on Figure 1. 2.1. Problem statement In the the offline or retrospective change point detection framework, we consider a nonstationary random process y = {y1 , . . . , yT } that takes value in Rd (d ≥ 1). The signal y is assumed to be piecewise stationary, meaning that some characteristics of the process change abruptly at some unknown instants t?1 < t?2 < · · · < t?K . The corresponding segmentation is t? = {t?1 , . . . , t?K ? }. In other words, the sub-signals yt?k ..t?k+1 are homogeneous. ? ? Further assume that there exists a set τ ? = {τ1? , . . . , τK change point fractions such ? } of K that t?k = bT τk? c. (1) Change point detection consists in estimating those instants t?k when a particular realization of y is observed. A change point detection algorithm returns an estimated segmentation, usually denoted t̂ = {t̂1 , t̂2 , . . . } with 1 ≤ t̂1 < t̂2 < · · · ≤ T . Note that the number of changes K ? is not necessarily known and must sometimes be estimated. Quality of a change point detection method is measured by the distance between an estimation and the true change point index, normalized by the number T of samples: ∀k, |t̂k − t?k |/T (2) Ideally, an algorithm should have this error decreasing to zero when the number T of samples is growing to infinity. This property is called asymptotic consistency. This notion is formally introduced in the context of change point detection. 2 Definition 1 (Asymptotic consistency). A change point detection algorithm is said to be asymptotically consistent if the estimated segmentation t̂ is such that |t̂| = K ? and p max k=1,...,K ? |t̂k − t?k |/T −→ 0. (3) where the t̂k are the elements of t̂ in ascending order. Remark 1. In Definition 1, the change point fractions are consistent, and not the indexes themselves. Distances |t̂k − t?k | between true change point indexes and their estimated counterparts do not converge to 0, even for simple models [6, 7, 17, 26, 30, 129]. As a result, consistency results in the literature only deal with change point fractions. 2.2. Methodology In this work, we consider a general class of algorithms which encompasses a large part of the literature [2, 4–7, 9, 18, 22, 24, 25, 27, 33, 44, 49, 54, 58, 65–67, 70, 72, 72, 78, 81, 90, 99, 100, 117, 118]. Those methods adhere to or are an approximation of a general format where a suitable contrast function V (·) is minimized. The contrast function is expressed as a sum of segment costs: K X V (t, y) := c(ytk ..tk+1 ) (4) k=0 where c(·) is a cost function which measures goodness-of-fit of the sub-signal ytk ..tk+1 = t {yt }tk+1 to a specific model. The cost function can for instance be the sum of squared residuals k +1 after a linear fit [18]: its value is expected to be low on “homogeneous” sub-signals (here, linear sub-signals) and large on sub-signals that are not well-approximated by the linear model (e.g. if they contain one or more breaks). The sum of costs V (t, y) is denoted V (t) when it is obvious from the context that it refers to the signal y. Change point detection methods aim at minimizing V (·) under certain constraints. They mostly fall into two categories, depending on whether the number of change points is fixed: - if K is fixed, the change point estimation t̂ is the minimizer of the discrete optimization problem min V (t); (5) |t|=K - if K is not fixed, the change point estimation t̂ is the minimizer of the discrete optimization problem min V (t) + pen(t) (6) t where pen(t) is an appropriate measure of the complexity of a segmentation t. Under this methodology, a change point detection procedure consists in setting the three following elements: • choosing the relevant cost function c(·) (4) to measure homogeneity in the sub-signals, which is related to the type of change to detect; 3 • solving the discrete optimization problems (5) and (6), exactly or appropriately; • constraining the number of change points, by fixing it to K (5) or penalizing it with pen(·) (6). The remainder of this chapter is organized as follows. Cost functions from the literature are first presented in Section 3. Then Section 4 describes search methods that solve the change point detection problem with a known number of segments. After, search methods when K is unknown are presented in Section 5. Section 6 lists other types of methods from the literature. All methods are summarized in Section 7 and the main algorithms are detailed in pseudo-code in Section 9. 3. Cost functions We first present the main cost functions used in the literature. They are related to the assumed underlying model. In the following, the cost functions’ are applied on the general sub-signal ya..b for 1 ≤ a < b ≤ T . (Certain cost functions might require the sub-signal ya..b to contain strictly more than one sample, i.e. b − a ≥ 2.) 3.1. Piecewise i.i.d. signals We first describe the general parametric model where the signal y is modelled by a i.i.d. variables with piecewise constant distribution. This formulation encompasses a large number of change point models [1, 14, 32–34, 72, 81, 99, 100, 115, 125]. Assume that y1 , . . . , yT are independent random variables, with probability distribution f (yt |θ) depending on the vector-valued parameter θ. This parameter θ represents a quantity of interest whose value changes abruptly at unknown instants that are to be estimated. Formally, assume that there exists a set of true change points t? = {t?1 , . . . } and that yt ∼ K X f (·|θk )1(t?k < t ≤ t?k+1 ). (7) i=0 In this context, change point detection is performed through maximum likelihood estimation. The related cost function is the negative log-likelihood and is given by b X ci.i.d. (ya..b ) := − sup θ log f (yt |θ). (8) t=a+1 Choice of a distribution is motivated by prior knowledge on the data. Historically, the Gaussian distribution was often used to model mean and scale shifts [5, 82, 85, 91, 123]. A large part of the literature then evolved towards other parametric distributions, most notably resorting to distributions from the general exponential family [48, 50, 99]. Example 1 (Mean-shifts for normal data). The mean-shift model is one of the most studied model in the change point detection literature [35, 96, 101, 108, 123]. Let y1 , . . . , yT be a sequence of independent normal random variables with piecewise constant mean and constant variance. In this context, the cost function ci.i.d. (·) (8) becomes cL2 (ya..b ) := b X t=a+1 4 2 kyt − ȳa..b k2 (9) where ȳa..b is the empirical mean of the sub-signal ya..b . This cost function is also referred to as the quadratic error loss. It has been applied for instance on DNA array data [50], geology signals [33]. Example 2 (Mean-shifts and scale-shifts for normal data). A natural extension to the meanshift model is to allow the variance to abruptly change as well. Let y1 , . . . , yT be a sequence of independent normal random variables with piecewise constant mean and variance. In this context, the cost function ci.i.d. (·) (8) becomes b a..b cΣ (ya..b ) := log det Σ (10) b a..b is the empirical covariance matrix of the sub-signal ya..b . This cost function can be where Σ used to detect changes in the first two moments of random (not necessarily Gaussian) variables, even though it is the Gaussian likelihood that is plugged in ci.i.d. (·) [72, 89]. It has been applied for instance on stock market time series [89] and biomedical data [33]. Example 3 (Count data). Let y1 , . . . , yT be a sequence of independent Poisson distributed random variables with piecewise constant rate parameter. The cost function cPoisson (·) associated with this model is cPoisson (ya..b ) := −(b − a)ȳa..b log ȳa..b (11) where ȳa..b is the empirical mean of the sub-signal ya..b . This model has been applied for instance to model count data [36, 82]. Theoretically, change point detection verifies consistency properties as a maximum likelihood estimation method. Indeed, it has been shown that, “under extremely general conditions” [89], the estimated optimal change point fractions converge in probability to the true ones as the number grows to infinity. Change point detection with the cost function ci.i.d. is asymptotically consistent (Definition 1). Note that the change point indexes t̂k are not consistently estimated: only the change point fractions t̂k /T are. In fact, the estimated indexes do not converge in probability to the true change point indexes [18, 90]. Remark 2. A slightly more general model can be formulated by letting the distribution function f (·|θ) change over over time. This can in particular model the presence of unwanted changes in the statistical properties of the signal (for instance in the statistical structure of the noise [89]). The function f (·|θ) is replaced in (7) by a sequence of distribution functions ft (·|θ) which are not assumed to be identical for all indexes t. Changes in the functions ft are considered nuisance parameters and we are only interested in the variations of the parameter θ. Nevertheless, similar properties (about estimation consistency) are obtained in the context of (7) or its generalization, “under extremely general conditions” [90]. We refer the reader to [89, 90] for theoretical results in this context. To sum up, parametric cost functions of the form (8) are useful because there are theoretical consistency guarantees [18, 75, 90]. In addition, they can accommodate a wide range of situations. However, if the data are not well approximated by any of the available parametric distributions, change point detection performance is greatly impacted, motivating the use of other models [1, 55, 63, 79, 113]. 3.2. Linear model Linear models have been introduced and extensively studied in the context of change point detection by a series of important contributions [6–8, 10–16, 16, 111]. Both the theoretical and 5 algorithmic aspects of linear models are tackled in those papers. Linear models are used when there exists a linear relationship between variables that changes abruptly at some unknown instants. There are often referred to as “structural changes” in the related literature [6–8]. This formulation generalizes several well-known models such as the autoregressive (AR) model [2, 13], multiple regressions [8, 10], etc. Mathematically, the signal y is regarded as a (univariate) response variable; two signals of covariates x = {xt }Tt=1 and z = {zt }Tt=1 are introduced, respectively Rp -valued and Rq -valued. Assume that a true underlying set t? = {t?1 , . . . , t?K } of change points exists. The general linear model [111, 115] is given by: ∀ t, t?k < t ≤ t?k+1 , yt = x0t uk + zt0 v + εt (k = 0, . . . , K) (12) where the v ∈ Rq and uk ∈ Rp are unknown regression parameters and εt is noise. In this model (12), also known as a partial structural change model: the linear relationship between y and x changes abruptly, while the linear relationship between y and z is constant. The pure structural change model is obtained by removing the term zt0 v from Equation 12. The related cost function is based on the least-squares residuals and is given by: clinear (ya..b ) := b X min p u∈R ,v∈Rq (yt − x0t u − zt0 v)2 . (13) t=a+1 A closed-form formula exists as it is a simple least-square regression. Theoretically, the estimated change points asymptotically converge in probability to the true change points (Definition 1) under mild assumptions on the distribution on the covariates (xt , zt ), distribution of the noise εt and the minimal distance between two change points t?k+1 −t?k (see [111] for details). Additional asymptotic properties are also provided [16, 111, 115], for instance the asymptotic distribution of the change point locations and the limiting distribution of V (t̂K ) (which can be used to design a statistical test). Remark 3 (Least absolute deviation). The cost function (13) is sometimes replaced by the sum of the absolute deviations [7, 11]: clinear,L1 (ya..b ) := min p u∈R ,v∈Rq b X |yt − x0t u − zt0 v|. (14) t=a+1 Theoretically, asymptotic consistency of change point estimates still holds. Using this cost also provides better performance for certain noise distributions [72, 99]. (Nevertheless, the least square function is more efficient for a zero-mean Gaussian i.i.d. noise.). However, practically, it is computationally intensive to solve this minimization problem. Practically, this model is often applied on economic and financial data [6–8]. More recently, this model has for instance been used to show that the predictive linear model of stock returns can change abruptly [110]. In addition, breaks in the “comovement” of several economic parameters of the G-7 growth have been investigated using the linear model [43]. In [14], it has been applied on panel data. Example 4 (Autoregressive model). Piecewise autoregressive models falls into the general formulation of linear models. Indeed, by setting xt = [yt−1 , yt−2 , . . . , yt−p ] in the linear model (12) and 6 removing the term zt0 v (yielding a pure structural change model), the signal y is in effect piecewise autoregressive with order p. The resulting cost function, denoted cAR (·) is able to detect shifts in the autoregressive coefficients of a process [13, 31]. Piecewise autoregressive processes are a special case of time-varying ARMA processes. Theoretical consistency guarantees hold even if the noise εt is correlated, for instance a movingaverage process [13, 115]. Therefore, in practice, change point detection can be applied on full ARMA processes. The piecewise autoregressive model has been applied on piecewise weakly stationarity signals, such as EEG/ECG time series [115], functional magnetic resonance imaging (fMRI) time series [104] and speech recognition tasks [2]. 3.3. Kernel change point detection Change point detection can be performed on a high-dimensional mapping of the original signal, implicitly defined by a kernel function [4, 42, 59, 62]. This technique is central to many machine learning developments such as support vector machine or clustering [56, 120]. The original signal y is mapped onto a reproducing Hilbert space (RKHS) H associated with a kernel function k(·, ·) : Rd × Rd → R. The related mapping function φ : R → H is implicitly defined by φ(yt ) = k(yt , ·) ∈ H and hφ(ys )|φ(yt )iH = k(ys , yt ) (15) for any samples ys , yt ∈ Rd . The RKHS norm k·kH is also implicitly defined by 2 kφ(yt )kH = k(yt , yt ). (16) Intuitively, the signal is expected to become piecewise constant once mapped to this highdimensional (possibly infinite dimensional) feature space H. This is for instance true for a signal of independent random variables with piecewise constant distribution (described in (7)), under some assumptions on the kernel k(·, ·) (see Remark 4). The objective is then to detect meanshifts in the embedded signal. The related cost function measures the “average scatter” [59] and is given by b X 2 ckernel (ya..b ) := kφ(yt ) − µ̄a..b kH (17) t=a+1 where µ̄a..b ∈ H is the empirical mean of the embedded signal {φ(yt )}bt=a+1 . Thanks to the well-known “kernel trick”, the explicit computation of the mapped data samples is not required. Indeed, after simple algebraic manipulations, the kernel cost function (17) can be rewritten: b X 1 k(ys , yt ). ckernel (ya..b ) = k(yt , yt ) − b − a s,t=a+1 t=a+1 b X (18) Any kernel can be plugged into this expression [56, 57], but the most common kernel is the Gaussian kernel (or radial basis function): crbf (ya..b ) := (b − a) − b X 1 2 exp(−γ kys − yt k ) b − a s,t=a+1 (19) where γ > 0 is the so-called bandwidth parameter. Using the linear kernel in this context is formally equivalent to using the quadratic error loss cL2 (·) described in Example 1 for piecewise constant signals. 7 Remark 4 (Probability measures and RKHS embeddings). Under certain conditions on the kernel k(·, ·), the mapping φ(·) transforms piecewise i.i.d. signals into piecewise constant signals (in the feature space H). Here, we assume that the kernel k(·, ·) is translation invariant, meaning that k(ys , yt ) = ψ(ys −yt ) ∀s, t, where ψ is a bounded continuous positive definite function on Rd [126, Assumption 1]. Let P denote a probability distribution defined over Rd . Then there exists a unique element µP ∈ H [126, Theorem 7], called the mean embedding (of P), such that µP = EX∼P [φ(X)]. (20) In addition, the mapping P 7→ µP is injective. In other words, µP = µQ ⇐⇒ P = Q. (21) where Q denotes a probability distribution defined over Rd . Intuitively, it follows from Equation 20 that any Rd -valued random variable X ∼ P is mapped by φ(·) to a H-valued random variable with mean equal to µP , the mean embedding of P. Moreover, because this mean embedding is injective, two random variables with different distributions are mapped to two random variables with different means. To put it another way, a piecewise i.i.d. signal is mapped by φ(·) to a random signal with piecewise constant mean. As a consequence, distribution changes in the original space are transformed into mean-shifts in the feature space H. Theoretically, the asymptotic consistency of the change point estimates has not been proven in the literature (except if the kernel is linear). A result on the convergence of the sum of costs V (t̂K ) to V (t? ) can be found in [4]. To sum-up, kernel change point detection is a non-parametric and model-free method. It can be used in the general setting where the signal to segment is piecewise i.i.d. without prior knowledge on the form of the underlying distribution. This method was shown to be competitive in many different settings without much tuning. For instance, the cost function (17) was applied on physiological data streams such as the Brain-Computer Interface (BCI) [59] and on a video time series segmentation task [4]. 3.4. Mahalanobis-type metric The quadratic error loss (9), adapted for detecting mean-shifts (Examples 1), can be replaced by a Mahalanobis-type pseudo-metric. In the context of change point detection, it has been used along with a metric learning algorithm [87] to adapt the metric to the considered signal. This is also a common occurrence in clustering methods [40, 64, 133]. Formally, for any symmetric positive semi-definite matrix M ∈ Rd×d , the associated pseudometric k·kM is given by: 2 kyt − ys kM := (yt − ys )0 M (yt − ys ) (22) for any two samples ys , yt . The resulting cost function is defined as follows: cM (ya..b ) := b X t=a+1 8 2 kyt − ȳa..b kM (23) where ȳa..b is the empirical mean of the sub-signal ya..b . Original, the metric matrix M was set equal to the inverse of the covariance matrix, yielding the Mahalanobis metric [98]: b −1 M =Σ (24) b is the empirical covariance matrix of the signal y. where Σ Intuitively, measuring distances with the pseudo-norm k·kM is equivalent to applying a linear transformation on the data and using the regular (Euclidean) norm k·k . Indeed, decomposing the matrix M = U 0 U yields: 2 2 kyt − ys kM = kU yt − U ys k . (25) The matrix M (or equivalently U ) must be designed to better highlight the change points to detect [87]. Using a Mahalanobis-type metric only involves linear treatments of the samples. One way to introduce non-linearity is to combine it with a kernel-based transformation. Practically, for a given kernel function k(·, ·) : Rd × Rd 7→ R and its associated mapping φ(·) : Rd 7→ H onto the RKHS H, the Mahalanobis-type metric k·kH,M in the feature space H is defined by 2 kφ(ys ) − φ(yt )kH,M = (φ(ys ) − φ(yt ))0 M (φ(ys ) − φ(yt )) (26) where M is a (possibly infinite dimensional) symmetric positive semi-definite matrix defined on H. The resulting cost function is given by b X cH,M (ya..b ) := 2 kyt − ȳa..b kH,M (27) t=a+1 3.5. Summary of cost functions Name c(ya..b ) Parameters Pb ci.i.d. (8) − supθ cL2 (9) Pb cΣ (10) b a..b log det Σ cPoisson (11) t=a+1 t=a+1 log f (yt |θ) kyt − ȳa..b k22 −(b − a)ȳa..b log ȳa..b clinear (13) minu∈Rp ,v∈Rq clinear,L1 (14) minu∈Rp ,v∈Rq Pb ckernel (17) ȳa..b : empirical mean of ya..b b a..b : empirical covariance of ya..b Σ Pb cAR (Example 4) θ: changing parameter; density function: f (·|θ) minu∈Rp Pb t=a+1 t=a+1 (yt t=a+1 Pb t=a+1 (yt k(yt , yt ) − 1 b−a ȳa..b : empirical mean of ya..b − x0t u)2 1 b−a Pb (b − a) − cM (23) Pb kyt − cH,M (27) Pb kyt − ȳa..b k2H,M t=a+1 − zt0 v)2 |yt − x0t u − zt0 v| crbf (19) t=a+1 − x0t u s,t=a+1 ȳa..b k2M Pb s,t=a+1 xt ∈ Rp , zt ∈ Rq : covariates xt ∈ Rp , zt ∈ Rq : covariates xt = [yt−1 , yt−2 , . . . , yt−p ]: lagged samples k(ys , yt ) exp(−γ kys − yt k2 ) k(·, ·) : Rd × Rd 7→ R: kernel function γ > 0: bandwidth parameter M ∈ Rd×d : positive semi-definite matrix M : positive semi-definite matrix (in the feature space H) Table 1: Summary of cost functions A summary of the described cost functions is displayed in Table 1. 9 4. Search methods with a fixed K We now present the algorithmic methods to solve (exactly or approximately) the discrete change point detection optimization problem (5) when the number of change points to detect is fixed to K. Denote by t̂K (y) the minimizer of the contrast function V (·) that contains K change points. Namely, t̂K (y) := arg min V (t, y). (28) |t|=K The optimal change point set t̂K (y) is denoted t̂K when it is obvious from the context that it refers to the signal y. 4.1. Optimal detection Change point detection with a known number of changes K (5) is a discrete optimization problem over the set of  indexes of {1, . . . , T }. The set of all possible combinations of indexes −1 has a cardinal of TK : this makes an exhaustive search impossible. However, a more efficient method based on dynamic programming is available. Historically, it was introduced for a nonrelated problem [23] and later applied to change point detection [18, 58, 75]. In the following, the dynamic programming change point detection method is referred to as Opt. Practically, dynamic programming relies on the additive nature of the objective function V (·). Roughly, it consists in recursively solving sub-problems and rests on the following observation: min V (t, y = y0..T ) = |t|=K min K X 0=t0 <t1 <···<tK <tK+1 =T = min t≤T −K = min t≤T −K  c(y0..t ) +  c(y0..t ) + c(ytk ..tk+1 ) k=0 K−1 X min t=t0 <t1 <···<tK−1 <tK =T  c(ytk ..tk+1 ) (29) k=0  min V (t, yt..T ) |t|=K−1 Intuitively, Equation 29 means that the first change point of the optimal segmentation is easily computed if the optimal partitions with K − 1 elements of all sub-signals {ys }Tt are known. The complete partition is then computed by recursively applying this observation. Note that Opt solves exactly the change point detection problem (5) (when K is known). When combined with the quadratic error cost function (Example 1), the complexity of Opt is O(KT 2 ) [18, 76]. More complex cost functions increase computational complexity. The detailed algorithm can be found in Section 9 (Algorithm 1). The optimal change point detection method Opt is applied on biological sequences (EEG recordings in [88, 90], tree growth monitoring [58] for instance) and financial time-series [89]. Since its algorithmic complexity is quadratic, signals on which Opt is applied are relatively short with around a hundred samples. 4.1.1. Extensions Several extensions have been proposed in the literature to reduce the computational burden of Opt. The proposed methods still find the optimal set of change points t̂K . 10 - The “pruned optimal dynamic programming” procedure [118] is an extension of Opt that relies on a pruning rule to discard indexes that can never be change points. Thanks to this trick, the set of potential change point indexes is reduced. All described cost functions can be plugged into this method. As a result, longer signals can be handled, for instance long array-based DNA copy number data (up to 106 samples, with the quadratic error cost function) [118]. However, worst case complexity remains of the order of O(KT 2 ). - The “forward dynamic programming” is described in [58]. While Opt only computes the optimal partition which minimizes the sum of costs V (·), the “forward dynamic programming” computes the top L (L ≥ 1) most probable partitions (with lowest sum of costs). The algorithm is detailed for cost functions of the form (8), which detect change in the distribution of piecewise i.i.d. random variables. The computational complexity is O(LKT 2 ) where L is the number of computed partitions. This procedure is designed as a diagnostic tool: change points present in many of the top partitions are considered very likely, while change points present in only a few of the top partitions might not be as relevant. Thanks to “forward dynamic programming”, insignificant change points are trimmed and overestimation of the number of change point is corrected [58], at the expense of a higher computational burden. It is applied to tree growth monitoring time series [58] that are relatively short with around a hundred samples. 4.2. Window sliding Window-sliding algorithm (referred to as Win in the following) is a fast approximate alternative to Opt. This scheme relies on single change point detection procedures and extends it to find multiple change points. Algorithmically, two adjacent windows slide along the signal. The discrepancy between the first window and the second window is computed. For a given cost function c(·), the discrepancy between two sub-signals is of the form d(ya..t , yt..b ) = c(ya..b ) − c(ya..t ) − c(yt..b ) (1 ≤ a < t < b ≤ T ). (30) When the two windows cover dissimilar segments, the discrepancy reaches large values and a change point is detected. Methods from the literature also use discrepancy measures that stem from a two-sample test setting (see Remark 5). The two standpoints are often equivalent: for instance, using cL2 , ci.i.d. or ckernel is respectively equivalent to applying a Student t-test, a generalized likelihood ratio (GLR) test and a kernel Maximum Mean Discrepancy (MMD) test [56, 57]. Certain homogeneity tests however are not derived from a well-designed cost function. In the context of single change point detection, examples of such tests include rankbased procedures [38, 94, 97], kernel Fisher discriminants [62, 63, 103], density ratio [74], etc. Remark 5 (Two-sample test). A two-sample test (or homogeneity test) is a statistical hypothesis testing procedure designed to assess whether two populations of samples are identical in distribution. Formally, consider two sets of i.i.d. Rd -valued random samples {xt }t and {zt }t . Denote by Px the distribution function of the xt and by Pz , the distribution function of the zt . A two-sample test procedure compares the two following hypotheses: H0 : Px = Pz H1 : Px 6= Pz . 11 (31) Original Signal Discrepancy Curve Peak Detection Figure 2: Schematic view of Win A general approach is to consider a probability (pseudo)-metric d(·, ·) on the space of probability distributions on Rd . Well-known examples of such a metric include the Kullback-Leibler divergence, the Kolmogorov-Smirnov distance, the Maximum Mean Discrepancy (MMD), etc. Observe that, under the null hypothesis, d(Px , Pz ) = 0. The testing procedure consists in computing the bx and P bz and rejecting H0 for “large” values of the statistics d(P bx , P bz ). empirical estimates P This is a general formulation which is difficult because it relies on a consistent estimation of arbitrary distributions from a finite number of samples. Additional assumptions can be made on the distribution functions that yield simpler problems: for instance, Gaussian assumption [22, 32, 33], exponential family assumption [50, 114], etc. In the more complex non-parametric setting, the distributions are only assumed to be continuous. They are not directly estimated; instead, the statistics bx , P bz ) is computed [38, 57, 63, 95]. d(P In the context of single change point detection, the two-sample test setting is adapted to assess whether a distribution change has occurred at some instant in the input signal. Practically, for a given index t, the homogeneity test is performed on the two populations {ys }s≤t and {ys }s>t . The estimated change point location is given by b•≤t , P b•>t ) t̂ = arg max d(P (32) t b•≤t and P b•>t are the empirical distributions of respectively {ys }s≤t and {ys }s>t . where P In the offline setting, the complete discrepancy curve is computed and a peak search procedure is performed to find change point indexes. The Win algorithm is detailed in Algorithm 4; a schematic view is displayed on Figure 2. The main benefits of Win are its low complexity (linear when used with cL2 ) and ease of implementation. In addition, any single change point detection method can be plugged into this scheme. An extensive literature is available in which asymptotic distributions of the discrepancy (for several cost functions) [32, 57, 63, 94, 97]; this is useful to find suitable thresholds in the peak search procedure. Nevertheless, Win is often unstable because the single change point 12 Step 0 Step 1 Step 2 Figure 3: Schematic example of BinSeg detection is performed on small regions (the window), lowering its statistical power [47, 59, 73]. Win has been applied in numerous settings with many different cost functions. For instance, it has been applied on biological signals [28, 47, 63, 73, 131], on network data [94, 97], on speech time series [1, 42, 63] and on financial time series [22, 34, 78]. 4.3. Binary segmentation Binary segmentation (referred to as BinSeg in the following) is a well-known fast and approximate alternative to Opt [123]. In the context of change point detection, BinSeg is one of the most used methods because of its conceptual simplicity and ease of implementation [33, 81, 106]. BinSeg is a greedy sequential algorithm: at each iteration k ≥ 1, detection of a single change point is performed and an estimate t̂(k) is produced. (In the following, the superscript ·(k) refers to k-th step of a sequential algorithm.) The first change point estimate t̂(1) is given by t̂(1) := arg min c(y0..t ) + c(yt..T ) . (33) 1≤t<T −1 V (t = {t}) This operation is “greedy”, in the sense that it searches the change point that lowers the most the sum of costs. The signal is then split in two at the position of t̂(1) ; the same operation is repeated on the resulting sub-signals until no further change point is detected. Formally, after k steps of BinSeg, the next change point estimate t̂(k+1) belongs to one of the k +1 sub-segments of the original signal and given by t̂(k+1) := arg min V ({t̂(1) , . . . , t̂(k) } ∪ {t}). t∈{ / t̂(1) ,...,t̂(k) } 13 (34) Since the number of change points K is known, BinSeg needs K steps to estimate the indexes. The greedy detection step (33) can be formulated as a two-sample testing procedure (see Remark 5). The two standpoints are often equivalent but certain homogeneity tests however are not derived from a well-designed cost function (see comments in Section 4.2). A schematic view of the algorithm is displayed on Figure 3; an implementation can be found in Section 9 (Algorithm 2). The complexity of BinSeg is O(T log T ) for the quadratic error loss cL2 (9). Theoretically, BinSeg is proven to produce asymptotically consistent estimates under the meanshift model (Example 1) with the quadratic error cL2 (9) [9, 130]. A more recent result states that BinSeg is only consistent when the minimum spacing between any two adjacent changepoints is of order greater than T 3/4 [52]. In general, BinSeg’s output is only an approximation of the optimal estimates (the output of Opt). As argued in [9, 81], the issue is that the estimated change points t̂(k) are not estimated from homogeneous segments and each estimate depends on the previous ones. Change points that are close are imprecisely detected especially [72]. Applications of BinSeg range from financial time series [9, 32, 33, 52, 92] to context recognition for mobile devices [67] and array-based DNA copy number data [106, 112]. 4.3.1. Extensions Several extensions of BinSeg have been proposed to improve detection accuracy. Indeed, small segments tend to be overlooked by BinSeg [9, 106]. However, these adaptation often come at the expense of implementation ease. - Circular binary segmentation [106] is a well-known extension of BinSeg. This method is also a sequential detection algorithm that splits the original at each step. Instead of searching for a single change point in each sub-signal, circular binary segmentation searches two change points. Within each treated sub-segment, it assumes a so-called “epidemic change model”: the parameter of interest shifts from one value to another at the first change point and returns to the original value at the second change point. The algorithm is dubbed “circular” because, under this model, the sub-segment has its two ends (figuratively) joining to form a circle. Practically, this method is used to detect changes in the mean of array-based DNA copy number data [86, 106, 132] (with the quadratic error cost function 9). A faster version of the original algorithm is described in [128]. - Another extension of BinSeg is the wild binary segmentation algorithm [52]. In a nutshell, a single point detection is performed on multiple intervals with start and end points that are drawn uniformly. Small segments are likely to contain at most one change but have lower statistical power, while the opposite is true for long segments. After a proper weighting of the change score to account for the differences on sub-signals’ length, the algorithm returns the most “pronounced” ones, i.e. those that lower the most the sum of costs. An important parameter of this method is the number of random sub-segments to draw; its calibration is discussed Wild binary search is used to detect mean-shifts of univariate piecewise constant signals (up to 2000 samples) [52]. 4.4. Bottom-up segmentation Bottom-up segmentation is the natural counterpart of BinSeg. It is referred to as BotUp in the following. This algorithm is also a sequential segmentation method that approximates the 14 Step 0 Steps 1, 2, . . . step 8 step 1 step 4 step 2 step 3 step 5 step 7 step 6 Result Figure 4: Schematic view of BotUp exact change point detection [34, 51, 77]. Contrary to BinSeg, BotUp starts by splitting the original signal in many small sub-signals and sequentially merges them until there remain only K change points. At every step, all potential change points (indexes separating adjacent sub-segments) are ranked by the discrepancy between the segments they separate. Change points with the lowest discrepancy are then deleted, meaning that the segments they separate are merged. Recall that (see Section 4.2 and Equation 30), for a given cost function c(·), the discrepancy between two sub-signals is of the form d(ya..t , yt..b ) = c(ya..b ) − c(ya..t ) − c(yt..b ) (1 ≤ a < t < b ≤ T ). (35) It is related to the decrease in the sum of costs V (·) the change point is responsible for. As is the case for BinSeg, two-sample tests (Remark 5) can also be used to provide a similar measure of discrepancy (Equation 32). BotUp is often dubbed a “generous” method, by opposition to BinSeg, which is “greedy” [77]. A schematic view of the algorithm is displayed on Figure 4; an implementation can be found in Section 9 (Algorithm 3). Its benefits are its linear computational complexity (in the number of samples T , for the quadratic error cost) and conceptual simplicity. However, several downsides exist. First, if a true change point does not belong to the original set of indexes, BotUp never considers it. Moreover, in the first iterations, the merging procedure (35) can be unstable because it is performed on small segments, for which statistical significance is smaller. In the literature, BotUp is somewhat less studied than its counterpart, BinSeg: no theoretical convergence study is available. It has been applied on speech time series to detect mean and scale shifts [34]. Besides, the authors of [77] have found that BotUp outperforms BinSeg on ten different data sets such as physiological signals (ECG), financial time-series (exchange rate), industrial monitoring (water levels), etc. 15 5. Search methods with a penalty We now present the strategies to estimate the number and locations of change points when their number K is unknown. In particular, we provide insights on how to choose the penalty function pen(·) and the penalty level β, and then on how to solve the related optimization problem (6). 5.1. l0 penalty The l0 penalty (or linear penalty) is arguably the most popular choice of penalty [81]. First introduced in [68] and later in [134, 135], it was then studied under more general assumptions [24–26]. Formally, the l0 penalty is denoted by penl0 and is given by penl0 (t) := β|t| (36) where β > 0 controls the trade-off between complexity and goodness-of-fit. Intuitively, it balances the decrease of the sum of costs V (·) that arises when more and more change points are allowed. This formulation generalizes several popular criterion from the literature such as BIC and AIC (see Example 5). Example 5 (Bayesian Information Criterion (BIC) and Akaike Information Criterion (AIC)). The well-known BIC and AIC criteria are special cases of the l0 penalty (36). Assume a piecewise i.i.d. model for the signal y (see Section 3.1). Upon setting c = ci.i.d. , the constrained likelihood which leads to BIC can be formulated for a given set of change points t as follows: 2V (t) + p log T |t| (37) where p is the dimension of the parameter space (p = 1 for a univariate change in mean, p = 2 for a univariate change in mean and scale,...). BIC is therefore equivalent to the linearly penalized change point detection (36) upon setting β = p/2 log T : penBIC (t) := p log T |t| 2 (38) Similarly, under the mean-shift model (with fixed variance), with c = cL2 , the BIC penalty [121, 134] is (39) penBIC,L2 (t) := σ 2 log T |t|. The same holds for AIC, for which penAIC,L2 (t) := σ 2 |t|. (40) AIC is a generalization of the also well-known Mallows’ Cp [101]. Theoretically, consistency of the change point estimates can be proven in certain situations. The most studied model is the mean-shift model for which the estimated number of change points and change point fractions converge in probability asymptotically under various assumptions: • in the noiseless setting, if the penalty value β converges at an appropriate rate to zero [26], • if the noise is Gaussian white noise and pen = penBIC,L2 [134], 16 • if the noise is a second order stationary process (with appropriately decreasing autocorrelation function) and the penalty level β is slowly diverging to infinity (slower than T ) [90, 91]. A recent result states the consistency of the linearly penalized change point estimates for c = ckernel for penalty values β converging to 0 at the speed of 1/T [55]. Theoretical results for other cost functions (most notably ci.i.d. ) only deals with the convergence of the sum of costs to its true value [134, 135]; no results are available about the consistency of the change point estimates. 5.1.1. Implementation A naive heuristics to solve the linearly penalized change point detection is to apply Opt for K = 1, . . . , Kmax for a sufficiently large Kmax . Then choose among the computed partitions the one that minimizes the penalized problem. This approach would prove computational cumbersome because of the quadratic complexity of the resolution method Opt. Fortunately a faster method exists with far lower complexity. The algorithm Pelt (Pruned Exact Linear Time) was introduced to find the exact solution of (6) with pen = penl0 [81]. This approach considers each sample sequentially and, thanks to an explicit pruning rule, may or may not discard it from the set of potential change points. This results in a considerable speed-up: under the assumption that regime lengths are randomly drawn from a uniform distribution, the complexity of Pelt is of the order O(T ). However, as argued in [52], this set-up is unrealistic as it produces shorts segments. Nevertheless, in practice, this method is orders of magnitude faster than the naive heuristics previously described [69, 81]. The detailed algorithm can be found in Section 9 (Algorithm 5). An extension of Pelt is described in [65] to solve the linearly penalized change point detection for a range of penalty values [βmin , βmax ]. When using Pelt, the only parameter to calibrate is the penalty level β. Small values encourage partitions with many change points, while large values make Pelt sensitive only to significant changes. Theoretical results (in an asymptotic setting) suggest that β should at least depend on the number of samples and the dimension of the signal. BIC, AIC and Mallow’s Cp (see Example 5) are statistical procedures to set the value of the penalty. However, in practice, numerical experiments have demonstrated that they significantly overestimate the number of change points [58, 69, 135] There are also several heuristics in the literature. In [92, 112] Opt is applied several times on one training signal to find a suitable β that can be used to segment new signals, An adapted cross-validation procedure is described in [3] and [25] proposes another method based on the slope heuristics. A different route is taken by [69]. They propose a supervised procedure: the chosen penalty value is the one that minimizes the segmentation error on an annotated set of signals. However, it requires to perform several times the optimal change point detection Opt on each signal, which proves to be computationally heavy. The main application of Pelt is DNA sequence data [69, 70, 135, 137] (with the cost function cL2 . It has also been applied to financial time-series [92] and oceanographic data [81], where the exact penalized change point has be shown to outperform faster heuristics like BinSeg. 17 5.2. l1 penalty To further lower the computational cost of change point detection with a linear penalty, an alternative formulation has been proposed in which the l0 penalty is relaxed to a l1 penalty [60, 129]. The same reasoning is central to many developments in machine learning, for instance sparse regression, compressive sensing, sparse PCA, dictionary learning [64]. In numerical analysis and image denoising, this penalty is also known as the total variation regularizer [61, 122, 129]. This strategy has been introduced to detect mean-shifts in piecewise constant signals with Gaussian noise (see Example 1); the related function is cL2 . Under this setting, the change point optimization problem (6) is rewritten as follows: min V (t) + β t |t| X ȳtk−1 ..tk − ȳtk ..tk+1 1 (41) k=1 where ȳtk−1 ..tk is the empirical mean of sub-signal ytk−1 ..tk . The l1 is then given by penl1 (t) := β |t| X ȳtk−1 ..tk − ȳtk ..tk+1 1 . (42) k=1 In [60, 129], the authors show that it is in fact equivalent to a convex optimization problem (known in other contexts as total variation denoising). Introduce the matrices Y := [y1 , . . . , yT ]0 ∈ RT ×d and S ∈ RT ×T −1 given by ( 1 if i > j, Sij := (43) 0 if i ≤ j. Let Ȳ and S̄ denote the matrices obtained from Y and S by centering each column. Then the change point detection problem (41) with l1 penalty is equivalent to min ∆∈R(T −1)×d Ȳ − S̄∆ 2 + β TP −1 t=1 k∆t,• k1 . (44) k∆k1,1 The estimated change point indexes are the support rows (i.e. the rows that are non-zero) of ∆. The matrix ∆ is the “jump matrix”: it contains the locations and the amplitudes of the mean-shifts of the signal S̄∆. This problem (44) is an instance of the well-known Lasso (for “least absolute shrinkage and selection operator”) regression [64, 127] with design matrix S̄. Intuitively, the l1 penalty shrinks many coefficients to zero, which in this context means that it favours piecewise constant approximations of y. The higher the penalty value β is, the less change points are allowed. Algorithmically, the optimization is carried out with the least-angle regression (Lars) [45]. This method has a complexity of O(T log T ), where an upper bound on the number of change points is known. From a theoretical standpoint, the estimated change point fractions are asymptotically consistent [61]. This result is proven for an appropriately converging sequence of penalty values β. 18 In particular, the number of change points is also correctly estimated (asymptotically). This consistency property is obtained even though the design matrix S̄ does not verify classical assumptions from the Lasso regression framework (such as the irrepresentable condition) [61]. In practice, there is no method to calibrate the regularization parameter β. Only a “trial and error” or cross-validation procedures are used in the literature [2, 129]. The l1 penalized change point detection has been extended to deal with changes in autoregressive coefficients of a piecewise stationary signal [2] (the related cost function is cAR , see Example 4). In [129] the l1 regularization (44) is replaced with a l2 penalty (the so-called Tikhonov regularization). The consistent of the first change point index is proven as the dimension d of the signal diverges to infinity (for a fixed number of samples T ). To summarize, l1 penalty was introduced to detect mean-shifts when the number of change points is unknown. It was later extended to deal with abruptly changing autoregressive coefficients. Main applications include array-based DNA copy number data [70, 129] and speech signals [2]. 5.3. Other penalties Several other penalty functions an be found in the literature. In general, they stem from theoretical considerations, under the mean-shift model with the cost function cL2 , and are complex to use in practice. The modified BIC criterion [137] is a penalty which depends not only on the number of change points but also on the lengths of their distances from each other: |t|+1 penmBIC (t) := 3|t| log T + X k=0 log( tk+1 − tk ). T (45) The second term of penmBIC favours evenly spaced change points; it reaches its maximum when indexes are close to each other, for instance t1 = 1, t2 = 2, . . . In practice, the associated change point detection problem is not tractable and therefore this penalty is approximated by the linear penalty penl0 . In [93], a model selection procedure for univariate piecewise constant signals leads to the following function: |t| + 1 2 |t| + 1 penLeb (t) := σ (a1 log + a2 ) (46) T T where a1 and a2 are real constants to calibrate and σ 2 is the noise variance. To perform the associated change point detection task, one must find the optimal partitions with fixed size K = 1, 2, . . . , Kmax for a sufficiently large Kmax , then find among the computed partitions the one that minimizes the penalized sum of costs. To tune the constants a1 and a2 , the authors propose to use cross-validation. In the situation when the penalty pen(·) only depends on the cardinal of t and is concave, the penalty can be replaced by a linear penalty function penl0 with a suitable penalty value β [81]. As a consequence, for this class of penalty functions, change point detection can be performed using Pelt. 6. Bayesian methods Bayesian methods are an important of the change point detection literature. Those methods can accommodate prior knowledge on the change point location distribution. They are widely 19 used in certain areas such as speech recognition [116], brain imaging [114], video segmentation [109] and bioinformatics [21, 44, 48]. Bayesian methods generally assume an unobserved discrete state variable st (t = 1, . . . , T ) which controls the model producing the data.. Change points are indexes where the hidden variable st goes from one state to another. The signal y is assumed to be piecewise i.i.d. such that yt ∼ f (·|θst ) (47) where f (·|θ) is the probability distribution of an observation characterized by the parameter θ, θi are emission parameters for an observation in state i. The joint probability of the observations is given by T Y P(y, [s1 , . . . , sT ]) = f (yt |θst ). (48) t=1 Bayesian algorithms differ from each other by the prior that is assumed on the state variable st distribution and the method that is used to compute the state sequence which best “explains” the observations. A well studied Bayesian method is the Hidden Markov Model (HMM). General overviews can be found in [29, 116]. The state variable is assumed to be a Markov chain, meaning that the value of st only depends on its previous value st−1 . This probabilistic description is entirely summarized by a transition matrix A such that Aij = P(st = j|st−1 = i). (49) The HMM is defined by three parameters: the transition matrix A, the emission probabilities f (·|θi ) and the initial state probabilities P(s1 = θi ). Change point detection in this context amounts to finding the maximum a posteriori (MAP) state sequence ŝ1 , . . . , ŝT . Computations are usually performed using the Viterbi algorithm or by random sampling methods (such as Monte Carlo Markov Chain, MCMC [46, 48]) if prior distributions on the parameters are provided. Benefits of HMM include state-of-the-art performances on certain applications such as speech processing [29, 104] and the ability to model any piecewise i.i.d. signal. They are also wellunderstood methods with many available implementations. However, HMM rely on several assumptions that are not verified in many contexts: observations are assumed independent, the emission distribution is parametric, usually a Gaussian mixture, the Markov assumption is not adapted to long segments, for instance. Several related algorithms are developed to overcome those limitations. Switching linear dynamic models have greater descriptive power than independent emissions [109]. They are applied to the complex task of visual tracking. However the calibration step is significantly more burdensome as there many parameters to tune. The Markov assumption can be relaxed and semi-Markov models are considered [102]. SemiMarkov processes keep track of the length of the current segment and are more suited to model state variables with few change points. Developed by [82] with strong connections to [36], Dirichlet process hidden Markov models are well adapted to perform change point detection. The number of states is implicitly computed and sampling from the posteriori distribution is made computationally easy. 20 7. Summary Table The literature review is summarized in Table 2. When applicable, each publication is associated with a search method (such as Opt, Pelt, BinSeg or Win); this is a rough categorization rather than an exact implementation. We provide a guide to assess computational complexity. Quadratic methods are the slowest and have only one star while linear methods are given three stars. Algorithms for which the number of change points is an explicit input parameter work under the “known K” assumption. Algorithms that can be used even if the number of change points is unknown work under the “unknown K” assumption. (Certain methods can accommodate both situations.) Some methods are implemented and available online. A detailed summary of libraries can be found in Table 3. 21 - ckernel Pelt Bayesian Opt Opt Opt Opt Bayesian Opt Opt Opt BinSeg Opt Win Cappé et al. [29], Rabiner [116] Basseville and Nikiforov [22] Bai [6], Bai and Perron [18] Bai [7] Lavielle [88] Chib [36] Bai [13] Birgé and Massart [24, 25] Bai and Perron [16] Olshen et al. [106], Venkatraman and Olshen [128] Lebarbier [93] Desobry et al. [42] HHI BinSeg Opt BinSeg Bayesian Pelt Pelt Pelt Frick et al. [50] Ko et al. [82] Garreau and Arlot [55] Haynes et al. [65] Chakar et al. [31] Pelt Hocking et al. [69] Fryzlewicz [52] Lasso Lajugie et al. [87] Opt Arlot et al. [4] 3 3 - 3 3 3 3 3 cL 2 cL 2 cM ci.i.d. ci.i.d. ckernel , crbf any c(·) cAR HII HHI HII HHI HHH HII HHH HHI HHH HII Table 2: Summary table of literature review. 3 3 3 3 3 3 3 3 3 HHH HHI 3 cAR - HHH 3 ckernel , crbf Killick et al. [81] Angelosante and Giannakis [2] Lasso Pelt Vert and Bleakley [129] - - Lasso Harchaoui and Lévy-Leduc [60] HHI HHH - - cL , cΣ 2 cL 2 cL 2 any c(·) Opt Bai [14] 3 HHH 3 - Win 3 - Win Kawahara [74] Lévy-Leduc and Roueff [94], Lung-Yut-Fong et al. [97] - HHH 3 3 Win Harchaoui et al. [63] HHI HII - cL 2 - 3 3 ckernel , crbf Opt Pelt HHH Harchaoui and Cappé [59] 3 HHH HII 3 3 3 - - HII 3 HII HII - - 3 - - - 3 - 3 - - - 3 - - - - - - - - - - 3 - - - - - - HHI HII - HHI 3 3 - - 3 3 - - - - - 3 Package HHH HHI 3 - HHH HII 3 - - - - - 3 Scalability (w.r.t. T ) Zhang and Siegmund [137] cL 2 cL 2 cL 2 cL 2 ci.i.d. cAR ci.i.d. , cL 2 clinear,L 2 clinear,L 1 cAR cL 2 cL 2 ci.i.d. BinSeg Yao [134] No Known K Yes Sen and Srivastava [123], Vostrikova [130] Cost function Search method Publication Dirichlet process exponential distributions family supervised method to learn a suitable metric supervised method to learn a penalty level (penl ) 0 univariate signal Tikhonov regularization total variation regression (penl ) 1 Tikhonov regularization single change point dissimilarity measure (rank-based), see Remark 5 dissimilarity measure (density ratio), see Remark 5 dissimilarity measure (Fisher discriminant), see Remark 5 modified BIC dissimilarity measure (one-class SVM), see Remark 5 model selection model selection Dirichlet process single change point single change point single change point HMM Bayesian information criterion (BIC) Additional information 8. Conclusion In this work, we have reviewed numerous methods to perform change point detection, organized within a common framework. Precisely, all methods are described as a collection of three elements: a cost function, a search method and a constraint on the number of changes to detect. For a given method, we detail the assumed signal model, the associated algorithm, theoretical guarantees (if any) and the application domain. As was shown above, contributions to this large area of research are diverse: they encompass many different models and operational constraints such precision, complexity, etc. The formal framework for change point detection was introduced to give sens to this significant body of work. This approach is intended to facilitate prototyping of change point detection methods: for a given segmentation task, one can appropriately choose among the described elements to design an algorithm. Most detection procedures described above are available within the Python language from ruptures (ctruong.perso.math.cnrs.fr/ruptures). The same framework is used to implement the algorithms. Because of the approach adopted in this work, many methods were left off this review. The reader can find more information in the literature, for instance on Bayesian methods [48, 100], an in-depth theoretical survey [72] and numerical comparisons in controlled settings [44]. 9. Algorithms Algorithm 1 Algorithm Opt Input: signal {yt }Tt=1 , cost function c(·), number of regimes K ≥ 2. for all (u, v), 1 ≤ u < v ≤ T do Initialize C1 (u, v) ← c({yt }vt=u ). end for for k = 2, . . . , K − 1 do for all u, v ∈ {1, . . . , T }, v − u ≥ k do Ck (u, v) ← min Ck−1 (u, t) + C1 (t + 1, v) u+k−1≤t<v end for end for Initialize L, a list with K elements. Initialize the last element: L[K] ← T . Initialize k ← K. while k > 1 do s ← L(k) t? ← arg min Ck−1 (1, t) + C1 (t + 1, s) k−1≤t<s L(k − 1) ← t? k ←k−1 end while Remove T from L Output: set L of estimated breakpoint indexes. 23 Link Type(s) of change wbsts [83, 84] Name Language R cran.r- project. org/package= wbsts Change in 2nd order stationary structure [105] trend [113] R cran.r- project. org/package= trend Single shift in trend Opt strucchange [136] R cran.r- project. org/package= strucchange Shifts in mean and in linear model Opt SeqCBS [124] R cran.r- project. org/package= SeqCBS Mean-shifts in Poisson processes SegCorr [41] R cran.r- project. org/package= SegCorr Shifts in mean and scale cpm [119] R cran.r- project. org/package= cpm Change in Gaussian, exponential, Bernoulli random variables, and general distribution change Win, BinSeg not [20] R cran.r- project. org/package= not Mean-shifts in univariate signals (with different types of noise) BinSeg factorcpt [37] R cran.r- project. org/package= factorcpt Mean-shifts with factor analysis BinSeg ecp [71] R cran.r- project. org/package= ecp Distribution changes changepoint [80] R cran.r- project. org/package= changepoint Mean and scale shifts in univariate signals breakfast [53] R cran.r- project. org/package= breakfast Mean-shifts in univariate signals bcp [46] R cran.r- project. org/package= bcp Bayesian counterpart Algorithm(s) BinSeg [52, 83] BinSeg [106] Opt BinSeg, BotUp Pelt BinSeg [50–52] of Bayesian strucchange changepoint.np [66] R cran.r- project. org/package= changepoint.np Change in distribution (based on empirical distribution function) Pelt Segmentor3IsBack [39] R cran.r- project. org/package= Segmentor3IsBack Distribution changes for Gaussian, Poisson, exponential, negative binomial variables Opt wbs [19] R cran.r- project. org/package= wbs Mean-shifts in univariate signals AR1seg [30, 31] R cran.r- project. org/package= AR1seg Mean-shifts in AR(1) processes Table 3: Summary of available libraries for change point detection. 24 BinSeg [52] Opt Algorithm 2 Algorithm BinSeg Input: signal {yt }Tt=1 , cost function c(·), stopping criterion. Initialize L ← { }. . Estimated breakpoints. repeat k ← |L|. . Number of breakpoints t0 ← 0 and tk+1 ← T . Dummy variables. if k > 0 then Denote by ti (i = 1, . . . , k) the elements (in ascending order) of L, i.e. L = {t1 , . . . , tk }. end if Initialize G a (k + 1)-long array. . list of gains for i = 0, . . . , k do G[i] ← c(yti ..ti+1 ) − min [c(yti ..t ) + c(yt..ti+1 )] . ti <t<ti+1 end for bi ← arg max G[i] i t̂ ← arg min [c(ytbi ..t ) + c(yt..tbi+1 )]. tbi <t<tbi+1 L ← L ∪ {t̂} until stopping criterion is met. Output: set L of estimated breakpoint indexes. Algorithm 3 Algorithm BotUp Input: signal {yt }Tt=1 , cost function c(·), stopping criterion, grid size δ > 2. Initialize L ← {δ, 2δ, . . . , (bT /δc − 1) δ}. . Estimated breakpoints. repeat k ← |L|. . Number of breakpoints t0 ← 0 and tk+1 ← T . Dummy variables. Denote by ti (i = 1, . . . , k) the elements (in ascending order) of L, i.e. L = {t1 , . . . , tk }. Initialize G a (k − 1)-long array. . list of gains for i = 1, . . . , k − 1 do G[i − 1] ← c(yti−1 ..ti+1 ) − [c(yti−1 ..ti ) + c(yti ..ti+1 )] . end for bi ← arg min G[i] i Remove tbi+1 from L. until stopping criterion is met. Output: set L of estimated breakpoint indexes. 25 Algorithm 4 Algorithm Win Input: signal {yt }Tt=1 , cost function c(·), half-window width w, peak search procedure PKSearch. Initialize Z ← [0, 0, . . . ] a T -long array filled with 0. . Score list. for t = w, . . . , T − w do p ← (t − w)..t. q ← t..(t + w). r ← (t − w)..(t + w). Z[t] ← c(yr ) − [c(yp ) + c(yq )]. end for L ← PKSearch(Z) . Peak search procedure. Output: set L of estimated breakpoint indexes. Algorithm 5 Algorithm Pelt Input: signal {yt }Tt=1 , cost function c(·), penalty value β. Initialize Z a (T + 1)-long array; Z[0] ← −β. Initialize L[0] ← ∅. Initialize χ ← {0}. for t = 1, . . . , T do   t̂ ← arg mins∈χ Z[s] + c(ys..t ) + β .   Z[t] ← Z[t̂] + c(yt̂..t ) + β L[t] ← L[t̂] ∪ {t̂}. χ ← {s ∈ χ : Z[s] + c(ys..t ) ≤ Z[t]} ∪ {t} end for Output: set L[T ] of estimated breakpoint indexes. 26 . Admissible indexes. References [1] S. Adak. Time-dependent spectral analysis of nonstationary time series. Journal of the American Statistical Association, 93(444):1488–1501, 1998. [2] D. Angelosante and G. B. Giannakis. Group lassoing change-points piece-constant AR processes. EURASIP Journal on Advances in Signal Processing, 70, 2012. [3] S. Arlot and A. Celisse. A survey of cross-validation procedures for model selection. Statistical Surveys, 4:40–79, 2010. [4] S. Arlot, A. Celisse, and Z. Harchaoui. Kernel change-point detection. arXiv preprint arXiv:1202.3878, pages 1–26, 2012. [5] A. Aue and L. Horvàth. Structural breaks in time series. Journal of Time Series Analysis, 34:1–16, 2012. [6] J. Bai. Least squares estimation of a shift in linear processes. Journal of Time Series Analysis, 15(5):453–472, 1994. [7] J. Bai. Least absolute deviation of a shift. Econometric Theory, 11(3):403–436, 1995. [8] J. Bai. Testing for parameter constancy in linear regressions: an empirical distribution function approach. Econometrica, 64(3):597–622, 1996. [9] J. Bai. Estimating multiple breaks one at a time. Econometric Theory, 13(3):315–352, 1997. [10] J. Bai. Estimation of a change-point in multiple regression models. Review of Economic and Statistics, 79(4): 551–563, 1997. [11] J. Bai. Estimation of multiple-regime regressions with least absolutes deviation. Journal of Statistical Planning and Inference, 74:103–134, 1998. [12] J. Bai. Likelihood ratio tests for multiple structural changes. Journal of Econometrics, 91(2):299–323, 1999. [13] J. Bai. Vector autoregressive models with structural changes in regression coefficients and in variance–covariance matrices. Annals of Economics and Finance, 1(2):301–336, 2000. [14] J. Bai. Common breaks in means and variances for panel data. Journal of Econometrics, 157:78–92, 2010. [15] J. Bai and P. Perron. Estimating and testing linear models with multiple structural changes. Econometrica, 66(1): 47–78, 1998. [16] J. Bai and P. Perron. Critical values for multiple structural change tests. Econometrics Journal, 6(1):72–78, 2003. [17] J. Bai and P. Perron. Multiple structural change models: a simulation analysis. Journal of Applied Econometrics, 18:1–22, 2003. [18] J. Bai and P. Perron. Computation and analysis of multiple structural change models. Journal of applied econometrics, 18(1):1–22, 2003. [19] R. Baranowski and P. Fryzlewicz. wbs: wild binary segmentation for multiple change-point detection, 2015. URL https://cran.r-project.org/package=wbs. [20] R. Baranowski, Y. Chen, and P. Fryzlewicz. not: narrowest-over-threshold change-point detection, 2016. URL https://cran.r-project.org/package=not. [21] L. Bardwell and P. Fearnhead. Bayesian detection of abnormal segments in multiple time series. Bayesian Analysis, 12(1):193–218, 2017. [22] M. Basseville and I. Nikiforov. Detection of abrupt changes: theory and application, volume 104. Prentice Hall Englewood Cliffs, 1993. [23] R. Bellman. On a routing problem. Quaterly of Applied Mathematics, 16(1):87–90, 1955. [24] L. Birgé and P. Massart. Gaussian model selection. Journal of the European Mathematical Society, 3(3):203–268, 2001. [25] L. Birgé and P. Massart. Minimal penalties for Gaussian model selection. Probability Theory and Related Fields, 138(1):33–73, 2007. [26] L. Boysen, A. Kempe, V. Liebscher, A. Munk, and O. Wittich. Consistencies and rates of convergence of jumppenalized least squares estimators. The Annals of Statistics, 37(1):157–183, 2009. [27] B. E. Brodsky and B. S. Darkhovsky. Nonparametric methods in change point problems. Springer Netherlands, 1993. [28] B. E. Brodsky, B. S. Darkhovsky, A. Y. Kaplan, and S. L. Shishkin. A nonparametric method for the segmentation of the EEG. Computer Methods and Programs in Biomedicine, 60(2):93–106, 1999. [29] O. Cappé, É. Moulines, and T. Rydén. Inference in hidden Markov models. Springer-Verlag New York, 2005. [30] S. Chakar, É. Lebarbier, C. Levy-Leduc, and S. Robin. AR1seg: segmentation of an autoregressive Gaussian process of order 1, 2014. URL https://cran.r-project.org/package=AR1seg. [31] S. Chakar, É. Lebarbier, C. Levy-Leduc, and S. Robin. A robust approach for estimating change-points in the mean of an AR(1) process. Bernouilli Society for Mathematical Statistics and Probability, 23(2):1408–1447, 2017. [32] J. Chen and A. K. Gupta. Testing and locating variance changepoints with application to stock prices. Journal of the American Statistical Association, 92(438):739–747, 1997. [33] J. Chen and A. K. Gupta. Parametric Statistical Change Point Analysis: With Applications to Genetics, Medicine, and Finance. 2011. 27 [34] S. S. Chen and P. S. Gopalakrishnan. Speaker, environment and channel change detection and clustering via the bayesian information criterion. In Proceedings of the DARPA Broadcast News Transcription and Understanding Workshop, page 8, Landsdowne, VA, 1998. [35] H Chernoff and S Zacks. Estimating the Current Mean of a Normal Distribution which is Subjected to Changes in Time. The Annals of Mathematical Statistics, 35(3):999–1018, 1964. [36] S. Chib. Estimation and comparison of multiple change-point models. Journal of Econometrics, 86(2):221–241, 1998. [37] H. Cho, M. Barigozzi, and P. Fryzlewicz. factorcpt: simultaneous change-point and factor analysis, 2016. URL https://cran.r-project.org/package=factorcpt. [38] S. Clemencon, M. Depecker, and N. Vayatis. AUC optimization and the two-sample problem. In Advances in Neural Information Processing Systems 22 (NIPS 2009), pages 360–368, Vancouver, Canada, 2009. [39] A. Cleynen, G. Rigaill, and M. Koskas. Segmentor3IsBack: a fast segmentation algorithm, 2016. URL https: //cran.r-project.org/package=Segmentor3IsBack. [40] J. V. Davis, B. Kulis, P. Jain, S. Sra, and I. S. Dhillon. Information-theoretic metric learning. In Proceedings of the 24th International Conference on Machine Learning (ICML), pages 209–216, Corvalis, Oregon, USA, 2007. [41] E. I. Delatola, É. Lebarbier, T. Mary-Huard, F. Radvanyi, S. Robin, and J. Wong. SegCorr: a statistical procedure for the detection of genomic regions of correlated expression. BMC Bioinformatics, 18(1):1–15, 2017. [42] F. Desobry, M. Davy, and C. Doncarli. An online kernel change detection algorithm. IEEE Transactions on Signal Processing, 53(8):2961–2974, 2005. [43] B. M. Doyle and J. Faust. Breaks in the variability and comovement of G-7 economic growth. The Review of Economics and Statistics, 87(4):721–740, 2005. [44] I. A. Eckley, P. Fearnhead, and R. Killick. Analysis of changepoint models. In Bayesian Time Series Models, pages 205–224. Cambridge University Press, 2011. [45] B. Efron, T. Hastie, and R. Tibshirani. Least angle regression. The Annals of Statistics, 32(1):407–499, 2004. [46] C. Erdman and J. W. Emerson. bcp: an R package for performing a Bayesian analysis of change point problems. Journal of Statistical Software, 23(3):1–13, 2007. [47] R. Esteller, G. Vachtsevanos, J. Echauz, and B. Litt. A Comparison of waveform fractal dimension algorithms. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 48(2):177–183, 2001. [48] P Fearnhead. Exact and efficient Bayesian inference for multiple changepoint problems. Statistics and Computing, 16(2):203–213, 2006. [49] P. Fragkou, V. Petridis, and Ath Kehagias. A dynamic programming algorithm for linear text segmentation. Journal of Intelligent Information Systems, 23(2):179–197, 2004. [50] K. Frick, A. Munk, and H. Sieling. Multiscale change point inference. Journal of the Royal Statistical Society. Series B: Statistical Methodology, 76(3):495–580, 2014. [51] P. Fryzlewicz. Unbalanced Haar technique for nonparametric function estimation. Journal of the American Statistical Association, 102(480):1318–1327, 2007. [52] P. Fryzlewicz. Wild binary segmentation for multiple change-point detection. The Annals of Statistics, 42(6): 2243–2281, 2014. doi: 10.1214/14-AOS1245. [53] P. Fryzlewicz. breakfast: multiple change-point detection and segmentation, 2017. URL https://cran. r-project.org/package=breakfast. [54] P. Fryzlewicz and S. Subba Rao. Multiple change-point detection for auto-regressive conditional heteroscedastic processes. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 76(5):903–924, 2014. [55] D. Garreau and S. Arlot. Consistent change-point detection with kernels. arXiv preprint arXiv:1612.04740, pages 1–41, 2016. [56] A. Gretton, K. Borgwardt, M. J. Rasch, B. Scholkopf, and A. J. Smola. A kernel method for the two-sample problem. arXiv preprint arXiv:0805.2368, 2008. [57] A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Schölkopf, and A. Smola. A kernel two-sample test. Journal of Machine Learning Research (JMLR), 13:723–773, 2012. [58] Y. Guédon. Exploring the latent segmentation space for the assessment of multiple change-point models. Computational Statistics, 28(6):2641–2678, 2013. [59] Z. Harchaoui and O. Cappé. Retrospective mutiple change-point estimation with kernels. In Proceedings of the IEEE/SP Workshop on Statistical Signal Processing, pages 768–772, Madison, Wisconsin, USA, 2007. [60] Z. Harchaoui and C. Lévy-Leduc. Multiple Change-Point Estimation With a Total Variation Penalty. Journal of the American Statistical Association, 105(492):1480–1493, 2010. [61] Z. Harchaoui and C. Lévy-Leduc. Multiple change-point estimation with a total variation penalty. Journal of the American Statistical Association, 105(492):1480–1493, 2010. [62] Z. Harchaoui, F. Bach, and É. Moulines. Kernel change-point analysis. In Advances in Neural Information Processing Systems 21 (NIPS 2008), pages 609–616, Vancouver, Canada, 2008. [63] Z. Harchaoui, F. Vallet, A. Lung-Yut-Fong, and O. Cappé. A regularized kernel-based approach to unsupervised 28 [64] [65] [66] [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] [77] [78] [79] [80] [81] [82] [83] [84] [85] [86] [87] [88] [89] [90] [91] [92] audio segmentation. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 1665–1668, Taipei, Taiwan, 2009. T. Hastie, R. Tibshirani, and J. Friedman. The elements of statistical learning, volume 1. 2009. K. Haynes, I. A. Eckley, and P. Fearnhead. Computationally efficient changepoint detection for a range of penalties. Journal of Computational and Graphical Statistics, 26(1):134–143, 2017. K. Haynes, P. Fearnhead, and I. A. Eckley. A computationally efficient nonparametric approach for changepoint detection. Statistics and Computing, 27:1293–1305, 2017. J. Himberg, K. Korpiaho, H. Mannila, J. Tikanmaki, and H. T. Toivonen. Time series segmentation for context recognition in mobile devices. In Proceedings of the IEEE International Conference on Data Mining (ICDM), pages 203–210, 2001. D. V. Hinkley. Inference about the change point in a sequence of random variables. Biometrika, 57(1):1–17, 1970. T. Hocking, G Rigaill, J.-P. Vert, and F. Bach. Learning sparse penalties for change-point detection using max margin interval regression. In Proceedings of the International Conference on Machine Learning (ICML), pages 172–180, Atlanta, USA, 2013. T. Hocking, G. Schleiermacher, I. Janoueix-Lerosey, V. Boeva, J. Cappo, O. Delattre, F. Bach, and J.-P. Vert. Learning smoothing models of copy number profiles using breakpoint annotations. BMC Bioinformatics, 14(1):164, 2013. N. A. James and D. S. Matteson. ecp: an R package for nonparametric multiple change point analysis of multivariate data. Journal of Statistical Software, 62(7):1–25, 2014. V. Jandhyala, S. Fotopoulos, I. Macneill, and P. Liu. Inference for single and multiple change-points in time series. Journal of Time Series Analysis, 34(4):423–446, 2013. K. Karagiannaki, A. Panousopoulou, and P. Tsakalides. An online feature selection architecture for Human Activity Recognition. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 2522–2526, New Orleans, LA, USA, 2017. Y. Kawahara. Change-point detection in time-series data by direct density-ratio estimation. Proceedings of the 2009 SIAM International Conference on Data Mining (ICDM), pages 389–400, 2009. S M Kay. Fundamentals of statistical signal processing: Detection theory. Prentice Hall, 1998. S. M. Kay and A. V. Oppenheim. Fundamentals of Statistical Signal Processing, Volume II: Detection Theory. Prentice Hall, 1993. E. Keogh, S. Chu, D. Hart, and M. Pazzani. An online algorithm for segmenting time series. In Proceedings of the IEEE International Conference on Data Mining (ICDM), pages 289–296, 2001. E. Keogh, S. Chu, D. Hart, and M. Pazzani. Segmenting time series: a survey and novel approach. Data Mining in Time Series Databases, 57(1):1–22, 2004. D. Kifer, S. Ben-David, and J. Gehrke. Detecting change in data streams. In Proceedings of the Thirtieth International Conference on Very Large Data Bases (VLDB) - Volume 30, pages 180–191, Toronto, Canada, 2004. R. Killick and I. A. Eckley. changepoint: an R package for changepoint analysis. Journal of Statistical Software, 58(3):1–19, 2014. R. Killick, P. Fearnhead, and I. Eckley. Optimal detection of changepoints with a linear computational cost. Journal of the American Statistical Association, 107(500):1590–1598, 2012. S. I. M. Ko, T. T. L. Chong, and P. Ghosh. Dirichlet process hidden Markov multiple change-point model. Bayesian Analysis, 10(2):275–296, 2015. K. Korkas and P. Fryzlewicz. wbsts: multiple change-point detection for nonstationary time series, 2015. URL https://cran.r-project.org/package=wbsts. K. Korkas and P. Fryzlewicz. Multiple change-point detection for non-stationary time series using wild binary segmentation. Statistica Sinica, 27(1):287–311, 2017. P. R. Krishnaiah. Review about estimation of change points. Handbook of Statistics, 7:375–402, 1988. W. R. Lai, M. D. Johnson, R. Kucherlapati, and P. J. Park. Comparative analysis of algorithms for identifying amplifications and deletions in array CGh data. Bioinformatics, 21(19):3763–3770, 2005. R. Lajugie, F. Bach, and S. Arlot. Large-margin mMetric learning for constrained partitioning problems. In Proceedings of the 31st International Conference on Machine Learning (ICML), pages 297–395, Beijing, China, 2014. M. Lavielle. Optimal segmentation of random processes. IEEE Transactions on Signal Processing, 46(5):1365–1373, 1998. M. Lavielle. Detection of multiples changes in a sequence of dependant variables. Stochastic Processes and their Applications, 83(1):79–102, 1999. M. Lavielle. Using penalized contrasts for the change-point problem. Signal Processing, 85(8):1501–1510, 2005. M. Lavielle and É. Moulines. Least-squares estimation of an unknown number of shifts in a time series. Journal of Time Series Analysis, 21(1):33–59, 2000. M. Lavielle and G. Teyssière. Adaptive detection of multiple change-points in asset price volatility. In LongMemory in Economics, pages 129–156. Springer Verlag, Berlin, Germany, 2007. 29 [93] É. Lebarbier. Detecting multiple change-points in the mean of gaussian process by model selection. Signal Processing, 85(4):717–736, 2005. [94] C. Lévy-Leduc and F. Roueff. Detection and localization of change-points in high-dimensional network traffic data. The Annals of Applied Statistics, 3(2):637–662, 2009. [95] Song Liu, Makoto Yamada, Nigel Collier, and Masashi Sugiyama. Change-point detection in time-series data by relative density-ratio estimation. Neural Networks, 43:72–83, 2013. [96] G. Lorden. Procedures for reacting to a change in distribution. The Annals of Mathematical Statistics, 42(6): 1897–1908, 1971. [97] A. Lung-Yut-Fong, C. Lévy-Leduc, and O. Cappé. Distributed detection/localization of change-points in highdimensional network traffic data. Statistics and Computing, 22(2):485–496, 2012. [98] P. C. Mahalanobis. On the generalised distance in statistics. Proceedings of the National Institute of Sciences of India, 2(1):49–55, 1936. [99] R. Maidstone. Efficient Analysis of Complex Changepoint Models. page 34, 2013. [100] R. Maidstone, T. Hocking, G. Rigaill, and P. Fearnhead. On optimal multiple changepoint algorithms for large data. Statistics and Computing, 27(2):519–533, 2017. [101] C. L. Mallows. Some comments on Cp. Technometrics, 15(4):661–675, 1973. [102] I. Melnyk and A. Banerjee. A spectral algorithm for inference in hidden semi-Markov models. Journal of Machine Learning Research (JMLR), 18:1–39, 2017. [103] É. Moulines, F. Bach, and Z. Harchaoui. Testing for homogeneity with kernel fisher discriminant analysis. In Advances in Neural Information Processing Systems 20 (NIPS 2008), pages 609–616, 2008. [104] C. F. H. Nam, J. A. D. Aston, and A. M. Johansen. Quantifying the uncertainty in change points. Journal of Time Series Analysis, 33:807–823, 2012. [105] G. P. Nason, R. von Sachs, and G. Kroisandt. Wavelet processes and adaptive estimation of the evolutionary wavelet spectrum. Journal of the Royal Statistical Society. Series B (Statistical Methodology), 62(2):271–292, 2000. [106] A. B. Olshen, E. S. Venkatraman, R. Lucito, and M. Wigler. Circular binary segmentation for the analysis of array-based DNA copy number data. Biostatistics, 5(4):557–572, 2004. [107] L. Oudre, A. Lung-Yut-Fong, and P. Bianchi. Segmentation of accelerometer signals recorded during continuous treadmill walking. In Proceedings of the 19th European Signal Processing Conference (EUSIPCO), pages 1564–1568, 2011. [108] E. S. Page. A test for a change in a parameter occurring at an unknown point. Biometrika, 42:523–527, 1955. [109] V. Pavlovic, J. M. Rehg, and J. MacCormick. Learning Switching Linear Models of Human Motion. In Advances in Neural Information Processing Systems 13 (NIPS 2000), pages 981–987, Denver, United States, 2000. [110] B. S. Paye and A. Timmermann. Instability of return prediction models. Journal of Empirical Finance, 13(3): 274–315, 2006. [111] P. Perron. Dealing with structural breaks. Palgrave handbook of econometrics, 1(2):278–352, 2006. [112] F. Picard, S. Robin, M. Lavielle, C. Vaisse, and J.-J. Daudin. A statistical approach for array CGH data analysis. BMC Bioinformatics, 6(1):27, 2005. [113] T. Pohlert. trend: non-parametric trend tests and change-point detection, 2017. URL https://cran.r-project. org/package=trend. [114] R. Prescott Adams and D. J. C. MacKay. Bayesian Online Changepoint Detection. Technical report, 2007. [115] Z. Qu and P. Perron. Estimating and testing structural changes in multivariate regressions. Econometrica, 75(2): 459–502, 2007. [116] L.R. Rabiner. A tutorial on hidden Markov models and selected applications in speech recognition. Proceedings of the IEEE, 77(2):257–286, 1989. [117] J. Reeves, J. Chen, X. L. Wang, R. Lund, and Q. Q. Lu. A review and comparison of changepoint detection techniques for climate data. Journal of Applied Meteorology and Climatology, 46(6):900–915, 2007. ISSN 15588424. doi: 10.1175/JAM2493.1. [118] G. Rigaill. A pruned dynamic programming algorithm to recover the best segmentations with 1 to K_max change-points. Journal de la Société Française de Statistique, 156(4):180–205, 2015. [119] G. Ross. Parametric and nonparametric sequential change detection in R: the cpm package. Journal of Statistical Software, 66(3):1–20, 2015. [120] B. Schölkopf and A. J. Smola. Learning with kernels. MIT Press, Cambridge, USA, 2002. [121] G. Schwarz. Estimating the dimension of a model. The Annals of Statistics, 6(2):461–464, 1978. [122] N. Seichepine, S. Essid, C. Fevotte, and O. Cappé. Piecewise constant nonnegative matrix factorization. In Proceedings of the IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 6721– 6725, Florence, Italy, 2014. [123] A. Sen and M. S. Srivastava. On tests for detecting change in mean. The Annals of Statistics, 3(1):98–108, 1975. [124] J. J. Shen and N. R. Zhang. SeqCBS: CN profiling using sequencing and CBS, 2012. [125] David Siegmund and E S Venkatraman. Using the generalized likelihood ratio statistic for sequential detection 30 of a change-point. The Annals of Statistics, pages 255–271, 1995. [126] B. K. Sriperumbudur, A. Gretton, K. Fukumizu, G. Lanckriet, and B. Schölkopf. Injective Hilbert space embeddings of probability measures. In Proceedings of the 21st Conference on Learning Theory (COLT), pages 9–12, Helsinki, Finland, 2008. [127] R. Tibshirani. Regression shrinkage and selection via the lasso. Journal of the Royal Statistical Society. Series B (Methodological), 58(1):267–288, 1996. [128] E. S. Venkatraman and A. B. Olshen. A faster circular binary segmentation algorithm for the analysis of array CGH data. Bioinformatics, 23(6):657–663, 2007. [129] J.-P. Vert and K. Bleakley. Fast detection of multiple change-points shared by many signals using group LARS. In Advances in Neural Information Processing Systems 23 (NIPS 2010), volume 1, pages 2343–2351, Vancouver, Canada, 2010. [130] L. Y. Vostrikova. Detecting disorder in multidimensional random processes. Soviet Math. Dokl., 24:55–59, 1981. [131] H. Vullings, M. Verhaegen, and H. Verbruggen. ECG segmentation using time-warping. In Lecture notes in computer science, pages 275–286. Springer, 1997. [132] H. Willenbrock and J. Fridlyand. A comparison study: applying segmentation to array CGH data for downstream analyses. Bioinformatics, 21(22):4084–4091, 2005. [133] E. P. Xing, M. I. Jordan, and S. J. Russell. Distance metric learning, with application to clustering with sideInformation. In Advances in Neural Information Processing Systems 21 (NIPS 2003), pages 521–528, 2003. [134] Y.-C. Yao. Estimating the number of change-points via Schwarz’ criterion. Statistics and Probability Letters, 6(3): 181–189, 1988. [135] Y.-C. Yao and S. T. Au. Least-squares estimation of a step function. Sankhyā: The Indian Journal of Statistics, Series A, 51(3):370–381, 1989. [136] A. Zeileis, F. Leisch, K. Hornik, and C. Kleiber. strucchange: an R package for testing for structural change in linear regression models. Journal of Statistical Software, 7(2):1–38, 2002. [137] N. R. Zhang and D. O. Siegmund. A modified Bayes information criterion with applications to the analysis of comparative genomic hybridization data. Biometrics, 63(1):22–32, 2007. 31
5cs.CE
About Kendall’s regression arXiv:1802.07613v1 [math.ST] 21 Feb 2018 Alexis Derumigny∗, Jean-David Fermanian† February 22, 2018 Abstract Conditional Kendall’s tau is a measure of dependence between two random variables, conditionally on some covariates. We study nonparametric estimators of such quantities using kernel smoothing techniques. Then, we assume a regression-type relationship between conditional Kendall’s tau and covariates, in a parametric setting with possibly a large number of regressors. This model may be sparse, and the underlying parameter is estimated through a penalized criterion. The theoretical properties of all these estimators are stated. We prove non-asymptotic bounds with explicit constants that hold with high probability. We derive their consistency, their asymptotic law and some oracle properties. Some simulations and applications to real data conclude the paper. Keywords: conditional dependence measures, kernel smoothing, regression-type models MCS: 62H20, 62F12, 62J12. 1 The framework Let (X1 , X2 , Z) ∈ R2+p be a random vector, p ≥ 1. Our goal is to model the dependence between the first two scalar variables X1 and X2 given the vector of covariates Z. For j = 1, 2 and z ∈ Rp , ∗ † ENSAE, 5, avenue Henry Le Chatelier, 91764 Palaiseau cedex, France. [email protected] ENSAE, 5, avenue Henry Le Chatelier, 91764 Palaiseau cedex, France. [email protected]. This research has been supported by the Labex Ecodec. 1 (−1) denote by Fj|Z (·|Z = z) the conditional cdf of Xj given Z = z, and by Fj|Z (·|Z = z) its generalized inverse. Moreover, let F1,2|Z (·, ·|Z = z) be the cdf of the random vector X := (X1 , X2 ) given Z = z that will be continuous for every z. Following Patton [12, 13], define the conditional copula of X1 and X2 given Z = z as C1,2|Z (u1 , u2|Z = z) :=  −1 F1,2|Z F1|Z (u1 |Z = −1 z), F2|Z (u2 |Z  = z) Z = z , for any (u1 , u2 , z) ∈ [0, 1]2 × Rp , by an extension of Sklar’s Theorem. Conditional copulas and their inference have been studied in the recent literature: see Fermanian and Wegkamp [7], Gijbels et al. [9], etc. One of the challenges is often to check whether these copulas depend or not on the conditioning variable (the so-called “simplifying assumption”), a key assumption for vine modeling in particular: see Derumigny and Fermanian [4], Portier and Segers [14], in particular. In the field of dependence modeling, it is standard to work with dependence measures (i.e. scalars) instead of copulas (i.e. functions). Such summaries of information are very popular and are functionals of the underlying copulas: Kendall’s tau, Spearman’s rho, Blomqvist’s coefficient... See Nelsen [11, Section 5.1.1] for an introduction. In this paper, we focus on dependence measures given some covariates. Of particular interest is the conditional Kendall’s tau between X1 and X2 given Z = z, that is defined by τ1,2|Z=z := 4 Z [0,1]2 C1,2|Z (u1 , u2|Z = z) C1,2|Z(du1 , du2|Z = z) − 1  = 4 IP X1,1 > X2,1 , X1,2 > X2,2 Z1 = Z2 = z − 1   = IP (X1,1 − X2,1 )(X1,2 − X2,2 ) > 0 Z1 = Z2 = z − IP (X1,1 − X2,1 )(X1,2 − X2,2 ) < 0 Z1 = Z2 = z , for each z ∈ Rp , where (Xi,1 , Xi,2 , Zi ), i = 1, 2 are two independent versions of (X1 , X2 , Z) ∈ R2+p . We will denote τ1,2|Z=z = IE[g ∗ (X1 , X2 )|Z1 = Z2 = z], where g ∗ is the function that returns 1 if the pairs in its arguments are concordant, −1 if such pairs are discordant, and 0 else. Note that, as conditional copulas themselves, conditional Kendall’s taus are invariant wrt increasing transformations of the conditional margins X1 and X2 , given Z. Conditional Kendall’s 2 tau are of interest because they measure the evolution of the dependence between X1 and X2 when the covariates Z change. 1 Several parametric families of copulas have a simple one-to-one mapping between their parameter and the associated Kendall’s tau: Gaussian, Student with a fixed degree of freedom, Clayton, Gumbel and Frank copulas, etc. See Nelsen [11, Section 5.1.1] for a presentation of Kendall’s tau in such usual unconditional cases. Gijbels et al. [9] introduced non-parametric estimator of conditional Kendall’s taus. Apparently, their statistical properties have not been studied “per se” in the literature. For instance, the asymptotic normality of such estimators is seen as a consequence of the weak convergence of the empirical conditional copula process (see Veraverbeke et al. [18]), but its asymptotic law is not specified. The uniform consistency of conditional Kendall’s tau has been stated in the case of single index copulas by Fermanian and Lopez [6] in passing. In our paper, we directly focus on finite-distance and asymptotic properties of conditional Kendall’s tau, Moreover, we will assume a linear-type model for conditional Kendall’s taus, without any parametric assumption on the underlying copulas. The associated parameter can be obtained through penalized least squares. We will yield finite-distance, asymptotic and oracle properties of such an estimated parameter. To be specific, assume that the following model holds:  Λ τ1,2|Z=z = ψ(z)T β ∗ , (1) ′ for every z ∈ Z, a compact subset in Rp . Here, β ∗ ∈ Rp denotes the “true” unknown parameter. Λ is a known link function from [−1, 1] to R, that is increasing and continuously differentiable. T ′ The function ψ(·) := ψ1 (·), . . . , ψp′ (·) from Rp to Rp is known and corresponds to deterministic transforms of the covariates z. Typically, p′ ≫ p, allowing rich and flexible nonlinear transforms of z. In order to simplify notations, the mention of the conditioning event Z ∈ Z will be omitted.  We will set CZ := sup |z|∞ : z ∈ Z , denoting by | · |q the lq -norm when 1 ≤ q ≤ ∞. Equation (1) looks like a GLM, and it has three important characteristics: 1 Our τ1,2|Z=z has not to be confused with so-called “conditional Kendall’s tau” in the case of truncated data, as in Tsai [17]. 3 1. The explained variable τ1,2|Z=z is not observed. Therefore, a direct estimation of the parameter β ∗ (for example, by the ordinary least squares, or by the Lasso) is unfeasible. Nevertheless, we will replace τ1,2|Z=z by a nonparametric estimate τ̂1,2|Z=z , and use it as an approximation of the explained variable. 2. It is a “noiseless regression model”: unlike most regression models, there is no random variable disturbing the variable of interest. In particular, we can make the trivial observation that the quantity τ1,2|Z=z is deterministic knowing Z = z. If we knew the true conditional Kendall’s taus, the estimation of β ∗ in the model (1) would be reduced to a problem of numerical analysis, i.e. the decomposition of a given function into some linear combination of known functions. 3. The conditioning event is unusual : usual regression models consider IE[g(X)|Z = z] as a function of the conditioning variable z. Here, at the opposite, the expectation is made conditionally on Z1 = Z2 = z. This unusual conditioning event will necessitate some peculiar theoretical treatments. The functions ψi allow to take into account potential non-linearities and even discontinuities of conditional Kendall’s taus’ with respect to their conditioning variables. We will assume the identifiability of β ∗ , which is equivalent to the linear independence of the ψi (·), by the following proposition. Proposition 1. The parameter β ∗ is identifiable in Model (1) if and only if the functions (ψ1 (·), . . . , ψp′ (·)) are linearly independent IPZ -almost everywhere in the sense that, for any vector t = (t1 , . . . , tp′ ),  IPZ ψ(Z)T t = 0 = 1 implies t = 0.   Proof : Assume that there exists t 6= 0 such that IPZ ψ(Z)T t = 0 = 1. Then Λ τ1,2|Z=z = ψ(z)T β ∗ = ψ(z)T (β ∗ + t) for almost every z. As a consequence, β ∗ and β ∗ + t induce the same conditional Kendall’s taus and the parameter β ∗ is not identifiable.  ′ Conversely, assume that the model is identifiable. Let t ∈ Rp such that IPZ ψ(Z)T t = 0 = 1.  Then Λ τ1,2|Z=z = ψ(z)T β ∗ = ψ(z)T (β ∗ + t) holds almost surely. Due to the identifiability, β ∗ = β ∗ + t, that is t = 0.  4 A desirable empirical feature of model (1) would be the possibility of obtaining very high/low levels of dependence between X1 and X2 , for some Z values, i.e. Λ(−1) (ψ(z)T β ∗ ) should be close (or even equal) to 1 or −1 for some z. This can be the case even if Z is compact, that is required for theoretical reasons. Indeed, Λ is a mapping from [−1, 1] into an interval [Λmin , Λmax]. If ψ(z)T β ∗ ≥ Λmax (resp. ψ(z)T β ∗ ≤ Λmin ), then we set τ1,2|z = 1 (resp. τ1,2|z = (−1)). 2 Our goal is to estimate the true parameter β ∗ in the high-dimensional case, i.e. p′ is large and possibly larger than the number of observations. We will assume that β ∗ is sparse, in the sense that |S| = |β ∗|0 ≤ s, for some s ∈ {1, . . . , p′ }, where | · |0 is the number of non-zero components of ′ a vector of Rp and S is the set of non-zero components of β ∗ . Having in mind the model specification (1), we will estimate the parameter β ∗ using estimated conditional Kendall’s tau τ̂1,2|Z=z as approximations of the “true” conditional Kendall’s tau τ1,2|Z=z . An iid n-sample (X1,i, , X2,i , Zi )i=1,...,n will yield such quantities τ̂1,2|Z=z . Afterwards and independently, we will fix n′ values Z′i ∈ Z (fixed design setting). As the number of parameters p′ is possibly larger than n and n′ , we will use a penalized estimator, with the classical l1 penalty: β̂ := arg min′ p β∈R " # n′ 2 1 X ′ T Λ(τ̂1,2|Z=Z′i ) − ψ(Zi ) β + λ|β|1 , n′ i=1 (2) where λ is a positive tuning parameter (that may depend on n and n′ ). In Section 2, we provide the theoretical results concerning the nonparametric estimation of τ1,2|Z and the inference of β ∗ through the latter penalized linear procedure. In particular, we will study the cases when n′ is fixed and n → ∞, and when both indices tend to the infinity. Section 3 illustrates the numerical performances of such procedures. Most proofs have been postponed into appendices.  1+τ (the Fisher transform) or Λ2 (τ ) = It would be tempting to invoke usual transforms as Λ1 (τ ) = log 1−τ log(− log((1 − τ )/2)). Even if such functions are unbounded, they can be invoked, but restricted on some compact subsets of (−1, 1). In other words, we need to assume the possible conditional Kendall’s tau cannot be larger then 1 − ǫ, or smaller than −1 + ǫ, for some (small) ǫ > 0. 2 5 2 2.1 Theoretical results Estimation of the conditional Kendall’s tau Before studying β̂, it is necessary to state some results about our estimators of conditional Kendall’s tau. Using an i.i.d. sample (Xi,1, Xi,2 , Zi ), i = 1, . . . , n, we estimate the conditional cumulative distribution function of Xj given Z = z, for j = 1, 2 and z ∈ Z. Denote by F̂j|Z (·|Z = z) this estimator. Then, an estimator of the conditional copula of X1 and X2 given Z = z is Ĉ1,2|Z (u1, u2 |Z = z) := n X i=1  wi,n (z)1 F̂1|Z (Xi,1 |Z = z) < u1 , F̂2|Z (Xi,2 |Z = z) < u2 , (3) where 1 is the indicator function, wi,n is a sequence of weights given by Kh (Zi − z) , wi,n (z) = Pn j=1 Kh (Zj − z) (4) with Kh (·) := h−p K(·/h) for some kernel K on Rp , and h = h(n) denotes a usual bandwidth sequence that tends to zero when n → ∞. Note that these weights are well-defined if and only P if nj=1 Kh (Zj − z) > 0. Otherwise, simply set wi,n (z) = 0 for every i. The estimator (3) of the conditional copula can be used to define an estimator of the conditional Kendall’s tau τ̂1,2|Z=z := 4 =4 =4 Z Ĉ1,2|Z (u1 , u2 |Z = z) Ĉ1,2|Z (du1 , du2|Z = z) − 1 n X  wi,n (z)Ĉ1,2|Z F̂1|Z (Xi,1 |Z = z), F̂2|Z (Xi,2 |Z = z) Z = z − 1 i=1 n X n X i=1 j=1  wi,n (z)wj,n(z)1 Xi,1 < Xj,1, Xi,2 < Xj,2 − 1. (5) Note that the latter estimator does not depend on F̂1|Z and F̂2|Z . In other words, we only have to choose the weights wi,n to obtain an estimator of the conditional Kendall’s tau. This is coherent with the fact that the conditional Kendall’s taus are invariant with respect to conditional marginal distributions. Moreover, note that, in (5), the inequalities are strict, which implies that there are no terms corresponding to the cases i = j. This is inline with the definition of (condi- 6 tional) Kendall’s tau itself through coherent/discordant pairs of observations, and it will make the theoretical developments easier. P Let fˆZ (z) := n−1 nj=1 Kh (Zj −z) be an estimator of the marginal density fZ of the conditioning variable Z. We notice that the estimator τ̂1,2|Z=z is well-behaved only whenever fˆZ (z) > 0. Denote the joint density of (X, Z) by fX,Z . In our study, we need some conditions of regularity. Assumption 2.1. The kernel K is bounded, and set kKk∞ =: CK . It is symmetrical and satisfies R R K = 1, |K| < ∞. This kernel is of order α for some integer α > 1: for all j = 1, . . . , α − 1 R and every indices i1 , . . . , ij in {1, . . . , p}, Rp K(u)ui1 . . . uij du = 0,. Assumption 2.2. fZ is α-times continuously differentiable and there exists a constant CK,α > 0 s.t., for all z ∈ Z, Z |K|(u) p X i1 ,...,iα =1 |ui1 . . . uiα | sup t∈[0,1] ∂ α fZ (z + tu) du ≤ CK,α. ∂zi1 . . . ∂ziα Assumption 2.3. There exists a constant fZ,min > 0 such that for every z ∈ Z, fZ (z) ≥ fZ,min . Assumption 2.4. fZ (·) ≤ fZ,max for some finite constant fZ,max . Proposition 2. Under Assumptions 2.1-2.4 and if CK,αhα /α! < fZ,min , the estimator fˆZ (z) is  2 R strictly positive with a probability larger than 1−2 exp −nhp fZ,min −CK,α hα /α! / 2fZ,max K 2 +  (2/3)CK (fZ,min − CK,αhα /α!) . The latter proposition is proved in Section A.1. It will guarantee that τ̂1,2|Z=z is well-behaved with a probability close to one. Assumption 2.5. For every x ∈ R2 , z 7→ fX,Z (x, z) is differentiable almost everywhere up to the order α. For every 0 ≤ k ≤ α and every 1 ≤ i1 , . . . , iα ≤ p, let Hk,~ι(u, v, x1 , x2 , z) := sup t∈[0,1]  ∂ α−k f   ∂ k fX,Z  X,Z x1 , z + tu x2 , z + tv , ∂zi1 . . . ∂zik ∂zik+1 . . . ∂ziα 7 denoting ~ι = (i1 , . . . , iα ). Assume that Hk,~ι(u, v, x1 , x2 , z) is integrable and there exists a finite constant CXZ,α > 0, such that, for every z ∈ Z, Z R4+2p |K|(u)|K|(v) α   X α k=0 k p X i1 ,...,iα =1 Hk,~ι(u, v, x1 , x2 , z)|ui1 . . . uik vik+1 . . . viα | du dv dx1 dx2 ≤ CXZ,α. Proposition 3 (Exponential bound for the estimated conditional Kendall’s tau). Under Assumptions 2.1-2.5, for every t > 0 such that CK,αhα /α! + t < fZ,min /2 and every t′ > 0, we have !  2  C hα   C α 16fZ,max K,α XZ,α h +t × + t′ IP |τ̂1,2|Z=z − τ1,2|Z=z | > 4 1 + 3 fZ,min α! fZ2 (z)α!     4 (n − 1)h2p t′2 fZ,min nhp t2 R R + 2 exp − 2 ≤ 2 exp − . 2 2 2fZ,max K 2 + (2/3)CK t 4fZ,max ( K 2 )2 + (8/3)CK fZ,min t′ Remark 4. In the latter inequality, the constant fZ,min can be replaced by fZ (z). Moreover, when K is compactly supported, fZ,max can be replaced by supz̃∈V (z,ǫ) fZ (z̃), denoting by V(z, ǫ) a closed ball of center z and any radius ǫ > 0. This technical proposition will be key hereafter. It is proved in Section A.2. As a corollary, we have proven the weak consistency of τ̂1,2|Z=z for every z ∈ Z, under the assumptions of Proposition 3, if nh2p → ∞ (set t = 1 and t′ = ǫ > 0). The next proposition states the same result under weaker conditions. Proposition 5 (Consistency). Assume 2.1, and that • fZ and z 7→ τ1,2|Z=z are continuous on Z, • lim K(t)|t|p = 0 when |t| → ∞, • nhpn → ∞. Then τ̂1,2|Z=z tends to τ1,2|Z=z in probability, when n → ∞. This property is proved in Section A.3. To derive the asymptotic law of this estimator, we will assume: 8 Assumption 2.6. (i) nhpn → ∞ and nhp+2α → 0; (ii) K( · ) is compactly supported. n Proposition 6 (Asymptotic normality). Assume 2.1, 2.5, 2.6, and that • fZ and z 7→ fX,Z (x, z) are continuous on Z, for every x; • the Z′i are distinct. Then, (nhpn )1/2 τ̂1,2|Z=Z′i − τ1,2|Z=Z′i matrix defined by [H]i,j  D i=1,...,n′ −→ N (0, H) as n → ∞, where H is a n′ × n′ real R 4 K 2 1{Z′i =Z′j }  2 IE[g ∗ (X1 , X)g ∗(X2 , X)|Z = Z1 = Z2 = Z′i ] − τ1,2|Z=Z = ′ , i fZ (Z′i ) for every 1 ≤ i, j ≤ n′ , where (X, Z), (X1 , Z1 ), (X2 , Z2 ) are independent copies. This proposition is proved in Subsection A.4. We recall that g ∗ (X1 , X2 ) := 1{(X1,1 −X2,1 )(X1,2 −X2,2 )>0} − 1{(X1,1 −X2,1 )(X1,2 −X2,2 )<0} , denoting the bivariate vectors Xk := (Xk,1, Xk,2 ), k = 1, 2. Note that the latter function is symmetrical: g ∗(x, y) = g ∗ (y, x) for every bivariate vectors x and y. 2.2 Estimation of β ∗ by penalized linear regression on estimated conditional Kendall’s taus In the previous section, we have provided and study some estimators of conditional Kendall’s taus. Having in mind the model specification (1), we now estimate the parameter β ∗ using the estimated conditional Kendall’s tau τ̂1,2|Z=z as an approximation of the “true” τ1,2|Z=z . As the number of parameters p′ is possibly larger than n, we will use the penalized estimator given by (2), invoking the usual l1 penalty. The estimation algorithm is summed up in the following Algorithm 1. Its  time complexity is O n′ n(n + p) , plus the cost of the convex optimization program (2). Remark 7. Instead of a fixed design setting (Z′i )i=1,...,n′ in the optimization program, it would be possible to consider a random design: simply draw n′ realizations of Z, independently of the n-sample that has been used for the estimation of the conditional Kendall’s taus. The differences between fixed and random designs are mainly a matter of presentation and the reader could easily 9 Algorithm 1: Estimation algorithm for β̂ for i ← 1 to n′ do for j ← 1 to n do Compute the kernel Ki,j ← Kh (Zj − Z′i ). end for j ← 1 to n do P Compute the weight wj,n(Z′i ) ← Ki,j / nj=1 Ki,j (Equation (4)). end Compute the conditional Kendall’s tau τ̂1,2|Z=Z′i using Equation (5). end Solve the convex optimization program (2) and return β̂. rewrite our results in a random design setting. We have preferred the former one to study the finite distance properties and asymptotics when n′ is fixed (Subsection 2.3). When n and n′ will tend to the infinity (Subsection 2.4), both designs are encompassed de facto because we assume the weak convergence of the empirical distribution associated to the sample (Z′i )i=1,...,n′ , when n′ → ∞. Our first goal is to prove finite-distance bounds in probability for the estimator β̂. Let us introduce some notations. Let Z′ be the matrix of size n′ × p′ whose lines are ψ(Z′i )T , i = 1, . . . , n′ , ′ and let Y ∈ Rn be the column vector whose components are Yi = Λ(τ̂1,2|Z=Z′i ), i = 1, . . . , n′ . For ′ a vector v ∈ Rp , denote by ||v||n′ := |v|22 /n′ its empirical norm. We can then rewrite the criterion (2) as i h β̂ := arg min′ ||Y − Z′ β||2n′ + λ|β|1 , p β∈R where Y and Z′ may be considered as “observed”, so that the practical problem is reduced to a standard Lasso estimation procedure. Define some “residuals” by ξi,n := Λ(τ̂1,2|Z=Z′i ) − ψ(Z′i )T β ∗ = Λ(τ̂1,2|Z=Z′i ) − Λ(τ1,2|Z=Z′i ), i = 1, . . . , n′ . (6) Note that these ξi,n are not “true residuals” in the sense that they do not depend on the estimator β̂, but on the true parameter β ∗ . We also emphasized the dependence on n in the notation ξi,n , which is a consequence of the estimated conditional Kendall’s tau. To get non-asymptotic bounds on β̂, we will assume the Restricted Eigenvalue (RE) condition, 10 introduced by Bickel et al. [2]. For c0 > 0 and s ∈ {1, . . . , p}, it is defined as follows: RE(s, c0 ) condition : The design matrix Z′ satisfies κ(s, c0 ) := min min J0 ⊂ {1, . . . , p′ } δ 6= 0 Card(J0 ) ≤ s |δJ0C |1 ≤ c0 |δJ0 |1 |Z′ δ| √ 2 > 0. n′ |δ|2 Note that this condition is very mild, and is satisfied with a high probability for a large class of random matrices: see Bellec et al. [1, Section 8.1] for references and a discussion. Moreover, we will need the following assumption. Assumption 2.7. The functions Λ′ , ψ are bounded by some constants, respectively denoted by CΛ′ and Cψ . Theorem 8 (Fixed design case). Suppose that Assumptions 2.1-2.5 and 2.7 hold and that the design matrix Z′ satisfies the RE(s, 3) condition. Choose the tuning parameter as λ = γt, with γ ≥ 4 and t > 0, and assume that we choose h small enough such that fZ,min α! , and 2 CK,α 4 fZ,min α! t. hα ≤ 2 2 )CXZ,α 2 Cψ CΛ′ (fZ,min + 16fZ,max hα ≤ (7) (8) Then, we have ! √ 2/q 1/q s 4 (γ + 1)ts 4(γ + 1)t and |β̂ − β ∗ |q ≤ , for every 1 ≤ q ≤ 2 IP ||Z′ (β̂ − β ∗ )||n′ ≤ κ(s, 3) κ2 (s, 3)     (n − 1)h2p t2 ′ p ′ , (9) ≥ 1 − 2n exp − nh C1 − 2n exp − C2 + C3 · t 2 where C1 := fZ,min / 8fZ,max R R  2 2 6 K 2 +(4/3)CK fZ,min , C2 := 4{8Cψ CΛ′ (fZ,min +16fZ,max ) K 2 }2 /fZ,min , 2 2 2 4 (fZ,min + 16fZ,max )/fZ,min . and C3 := (64/3)Cψ CΛ′ CK This theorem, proved in Section B.2, yields some bounds that holds in probability for the prediction error ||Z′ (β̂ − β ∗ )||n′ and for the estimation error |β̂ − β ∗ |q , 1 ≤ q ≤ 2, under the 11 specification (1). Note that the influence of n′ and p′ is hidden through the Restricted Eigenvalue number κ(s, 3). The result depends on three parameters γ, t and h. Apparently, the choice of γ seems to be easy, as a larger γ deteriorates the upper bounds. Nonetheless, it is a bit misleading because β̂ implicitly depends on λ and then on γ (for a fixed t). Nonetheless, choosing γ = 4 is a reasonable “by default” choice. Moreover, a lower t provides a smaller upper bound, but at the same time the probability of this event is lowered. This induces a trade-off between the probability of the desired event and the size of the bound, as we want the smallest possible bound with the highest probability. Moreover, we cannot choose a too small t, because of the lower bound (8): t is limited by a value proportional to hα . The latter h cannot be chosen as too small, otherwise the probability in Equation (9) will decrease. To be short: low values of h and t yield a sharper upper bound with a lower probability, and the opposite. Therefore, there is a compromise to be found, depending of the kind of result we are interested in. Clearly, we would like to exhibit the sharpest upper bounds in (9), with the “highest probabilities”. Let us look for parameters of the form t ∝ n−a and h ∝ n−b , with a, b > 0. The assumptions of Theorem 8 imply bα ≥ a (to satisfy (8)) and 1 − 2a − 2pb > 0 (so that the right-hand side of (9) tends to 1 as n → ∞, i.e. nhp → ∞ and nt2 h2p → ∞). For fixed α and p, what are the “optimal” choices a and b under the constraints bα ≥ a and 1 − 2a − 2pb > 0 ? The latter domain is the interior of a triangle in the plane (a, b) ∈ R2+ , whose vertices are O := (0, 0), A := (0, 1/(2p)) and B := (α/(2p+2α), 1/(2p+2α)), plus the segment ]0, B[. All points in such a domain would provide admissible couples (a, b) and then admissible tuning parameters (t, h). In particular, choosing the neighborhood of B, i.e. a = α(1 − ǫ)/(2p + 2α) and b = 1/(2p + 2α) for some (small) ǫ > 0, will be nice because the upper bounds will be minimized. Corollary 9. For 0 < ǫ < 1, choosing the parameters λ = 4t, t = (n − 1)−α(1−ǫ)/(2α+2p) and h = ch (n − 1)−1/(2α+2p) , ch := 4 fZ,min α! 2 2 )CXZ,α 2 Cψ CΛ′ (fZ,min + 16fZ,max 12 ! α1 , for any n sufficiently large, we have √ 20 s and IP ||Z (β̂ − β )||n′ ≤ κ(s, 3)(n − 1)α(1−ǫ)/(2α+2p) ′ ∗ ! 2/q 1/q 5·4 s , for every 1 ≤ q ≤ 2 − 1)α(1−ǫ)/(2α+2p)     2αǫ/(2p+2α) c2p p ′ ′ (2α+p)/(2α+2p) h (n − 1) − 2n exp − ≥ 1 − 2n exp − C1 ch (n − 1) . C2 + C3 (n − 1)−α(1−ǫ)/(2α+2p) |β̂ − β ∗ |q ≤ 2.3 κ2 (s, 3)(n Asymptotic properties of β̂ when n → ∞ and for fixed n′ In this part, n′ is still supposed to be fixed and we state the consistency and the asymptotic normality asymptotic of β̂ as n → ∞. As above, we adopt a fixed design: the Z′i are arbitrarily fixed or, equivalently, our reasonings are made conditionally on the second sample. For n, n′ > 0, denote by β̂n,n′ the estimator (2) with h = hn and λ = λn,n′ . The following lemma provides another representation of this estimator β̂n,n′ that will be useful for deriving its asymptotic properties. It is proved in Section C.1. Lemma 10. We have β̂n,n′ = arg min β∈R p′ Gn,n′ (β), where ′ ′ n n 1 X 2 X ′ T ∗ ′ ξi,n ψ(Zi ) (β − β) + ′ ψ(Z′i )T (β ∗ − β) Gn,n (β) := ′ n i=1 n i=1 2 + λn,n′ |β|1 . (10) We will also invoke a so-called convexity argument, summarized in Kato [10] e.g.: “Let gn and g∞ be random convex functions taking minimum values at xn and x∞ , respectively. If all finite dimensional distributions of gn converge weakly to those of g∞ and x∞ is the unique minimum point of g∞ with probability one, then xn converges weakly to x∞ .” Theorem 11 (Consistency of β̂). Under the assumptions of Proposition 5, if n′ is fixed and λ = λn,n′ → λ0 , then, given Z′1 , . . . , Z′n′ and as n tends to the infinity, ′ P β̂n,n′ −→ β ∗∗ n 2 1 X ψ(Z′i )T (β ∗ − β) + λ0 |β|1 . := inf G∞,n′ (β), G∞,n′ (β) := ′ β n i=1 13 P ′ In particular, if λ0 = 0 and < ψ(Z′1 ), . . . , ψ(Z′n′ ) >= Rp , then β̂n,n′ −→ β ∗ . Proof : By Proposition 5, the first term in the r.h.s. of (10) converges to 0 as n → ∞. The third term in the r.h.s. of (10) converges to λ0 |β1 | by assumption. We have just proven that Gn,n′ → G∞,n′ pointwise as n → ∞. We can now apply the convexity argument, because Gn,n′ and G∞,n′ are convex functions. As a consequence, arg minβ Gn,n′ (β) → arg minβ G∞,n′ (β) in law. Since we have adopted a fixed design setting, β ∗∗ is non random, given (Z′1 , . . . , Z′n′ ). The convergence in law towards a deterministic quantity implies convergence in probability, which concludes the proof. Moreover, when λ0 = 0, β ∗ is the minimum of G∞,n′ because the vectors ψ(Z′i ), i = 1, . . . , p′ ′ generate the space Rp . Therefore, this implies the consistency of β̂n,n′ .  To evaluate the limiting behavior of β̂n,n′ , we need the joint asymptotic normality of (ξ1,n , . . . , ξn′ ,n ), when n → ∞ and given Z′1 , . . . , Z′n′ . By applying the Delta-method to the function Λ( · ) componentwise, this is given in the following corollary of Proposition 6. Corollary 12. Under the assumptions of Proposition 6 and given (Z′1 , . . . , Z′n′ ), we have (nhpn )1/2  [ξ1,n , . . . , ξn′ ,n ] −→ N 0, H̃ , T D  where H̃ is a n′ × n′ real matrix, defined for every integers 1 ≤ i, j ≤ n′ by [H̃]i,j := R 4 K 2 1{Z′i =Z′j } fZ (Z′i ) o  2 n 2 . × IE[g ∗ (X1 , X)g ∗(X2 , X)|Z = Z1 = Z2 = Z′i ] − τ1,2|Z=Z × Λ′ τ1,2|Z=Z′i ′ i Theorem 13 (Asymptotic law of the estimator). Under the assumptions of Proposition 6, and if λn,n′ (nhpn,n′ )1/2 → ℓ when n → ∞, we have D (nhpn,n′ )1/2 (β̂n,n′ − β ∗ ) −→ u∗ := arg min ′ F∞,n′ (u), p u∈R 14 given Z′1 , . . . , Z′n′ and as n → ∞, where ′ ′ ′ ′ p p n n X 2  1 X 2 XX ′ ′ T Wi ψj (Zi )uj + ′ |ui |1{βi∗ =0} + ui sign(βi∗ )1{βi∗ 6=0} , ψ(Zi ) u + ℓ F∞,n′ (u) := ′ n i=1 j=1 n i=1 i=1   with W = (W1 , . . . , Wn′ ) ∼ N 0, H̃ . This theorem is proved in Section C.2. When ℓ = 0, we can say more about the limiting law in general. Indeed, in such a case, u∗ = arg min u∈R p′ F∞,n′ (u) is the solution of the first order conditions ∇F∞,n′ (u) = 0, that are written as ′ ′ n X Wi ψ(Z′i ) + n X ψ(Z′i )(ψ(Z′i )T u) = 0. i=1 i=1 Therefore, n′ n′ X −1 X ′ ′ T u =− ψ(Zi )ψ(Zi ) Wi ψ(Z′i ), ∗ i=1 i=1 Pn′ ψ(Z′i )ψ(Z′i )T is invertible. In this case, the limiting law of (nhpn,n′ )1/2 (β̂n,n′ − β ∗ ) Pn′ ′ T −1 ′ is Gaussian, and its asymptotic covariance is Vas := Σ−1 n′ i,j=1 [H̃]i,j ψ(Zi )ψ(Zj ) Σn′ . when Σn′ := i=1 Let remember that S := {j : βj∗ 6= 0} and assume that |S| = s < p so that the true model depends on a subset of predictors. In the same spirit as Fan and Li [5], we say that an estimator β̂ satisfies the oracle property if ∗ • vn (β̂S − βS ) converges in law towards a continuous random vector, for some conveniently chosen rate of convergence (vn ), and • we identify the nonzero components of the true parameter β ∗ with probability one when the sample size n is large, i.e. the probability of the event {j : β̂j 6= 0} = S tends to one. As above, let us fix n′ and n will tend to the infinity. Then, denote {j : β̂j 6= 0} by S n , that will depends on n′ implicitly. It is well-known that the usual Lasso estimator does not fulfill the oracle property (Zou [19]). Here, this is still the case. The following proposition is proved in Section C.3. Proposition 14. Under the assumptions of Theorem 13, lim supn IP (S n = S) = c < 1. 15 A usual way of obtaining the oracle property is to modify our estimator in an “adaptive” way. Following Zou [19], consider a first step estimator of β ∗ , denoted by β̃n , or more simply β̃. Moreover νn (β̃n − β ∗ ) is assumed to be asymptotically normal. Now, let us consider the same optimization program as in (2) but with a random tuning parameter given by λn,n′ := µn,n′ /|β̃|δ , for some constant δ > 0 and some positive deterministic sequence (µn,n′ ). The corresponding adaptive estimator (solution of the modified Equation (2)) will be denoted by β̌n,n′ , or simply β̌. Hereafter, we still set S n = {j : β̌j 6= 0}. The following theorem is proved in Section C.4. Theorem 15 (Asymptotic law of the adaptive estimator of β). Under the assumptions of Proposition 6, if µn,n′ (nhpn,n′ )1/2 → ℓ ≥ 0 and µn,n′ (nhpn,n′ )1/2 νnδ → ∞ when n → ∞, we have D (nhpn,n′ )1/2 (β̌n,n′ − β ∗ )S −→ u∗∗ F̌∞,n′ (uS ), where S := arg min s u ∈R S ′ ′ n n 2 X ui 1 XX 2 XX ′ Wi ψj (Zi )uj + ′ sign(βi∗ ), ψj (Z′i )uj + ℓ F̌∞,n′ (uS ) := ′ n i=1 n i=1 |βi∗ |δ j∈S j∈S i∈S   with W = (W1 , . . . , Wn′ ) ∼ N 0, H̃ . Moreover, when ℓ = 0, the oracle property is fulfilled: when n tends to the infinity, IP (S n = S) → 1. 2.4 Asymptotic properties of β̂ when n and n′ jointly tend to +∞ Now, we consider a framework in which both n and n′ are going to the infinity, while the dimensions p and p′ stay fixed. To be specific, n and n′ will not be allowed to independently go to the infinity. In particular, for a given n, the other size n′ (n) (simply denoted as n′ ) will be constrained, as detailed in the assumptions below. In this section, we still work conditionally on Z′1 , . . . , Z′n′ , . . .. The latter vectors are considered as “fixed”, inducing a deterministic sequence. Alternatively, we could consider randomly drawn Z′i from a given law. The latter case can easily been stated from the results below but its specific statement is left to the reader. Theorem 16 (Consistency jointly in (n, n′ )). Assume that Assumptions 2.1-2.5 and 2.7 are sat16 isfied. Assume that P n′ i=1 ψ(Z′i )ψ(Z′i )T /n′ converges to a matrix Mψ,Z′ , as n′ → ∞. Assume that λn,n′ → λ0 and n′ exp(−Anh2p ) → 0 for every A > 0, when (n, n′ ) → ∞. Then P β̂n,n′ −→ arg min′ G∞,∞ (β), as (n, n′ ) → ∞, p β∈R where G∞,∞ (β) := (β ∗ − β)Mψ,Z′ (β ∗ − β)T + λ0 |β|1. Moreover, if λ0 = 0 and Mψ,Z′ is invertible, then β̂n,n′ is consistent and tends to the true value β ∗ . This theorem is proved in Section D.1. Note that, since the sequence (Z′i ) is deterministic, P ′ ′2 we just assume the usual convergence of ni=1 ψ(Z′i )ψ(Z′i )T /n′ in Rp . Moreover, if the “second subset” (Z′i )i=1,...,n′ were a random sample that were drawn along the law IPZ , the latter convergence would be understood “in probability”. And if IPZ satisfies the identifiability condition (Proposition 1), then Mψ,Z′ would be invertible and β̂n,n′ → β ∗ in probability. Now, we want to go one step further and derive the asymptotic law of the estimator β̂n,n′ . Assumption 2.8. (i) The support of the kernel K(·) is included into [−1, 1]p . Moreover, for all n, n′ and every (i1 , i2 ) ∈ {1, . . . , n′ }2 , i1 6= i2 , we have |Z′i1 − Z′i2 |∞ > 2hn,n′ . p 2α −1 (ii) We have the following convergences : (a) n′ (nhp+4α n,n′ + hn,n′ + (nhn,n′ ) ) → 0, and (b) λn,n′ (n′ n hpn,n′ )1/2 → 0. (iii) The distribution IPZ′ ,n′ := 1 n′ Pn′ ′ i=1 δZi weakly converges as n′ → ∞, to a distribution IPZ′ ,∞ on Rp , with a density fZ′ ,∞ with respect to the p-dimensional Lebesgue measure. (iv) The matrix V1 := R ψ(z′)ψ(z′)T fZ′ ,∞ (z′ )dz′ is non-singular. (v) Λ is two times continuously differentiable and its second derivative is bounded by a constant CΛ′′ . Part (i) of this assumption forbids the design points (Z′i )i≥1 from being too close to each other too fast, with respect to the rate of convergence of the sequence of bandwidths (hn,n′ ) to 0. This can be guaranteed by choosing an appropriate design. For example, if p = 1 and Z = [0, 1], we can choose the dyadic sequence 1/2, 1/4, 3/4, 1/8, 3/8, 5/8, 7/8, . . . 17 Part (ii) can be ensured by first choosing first a slowly growing sequence n′ (n), and then by choosing h that would tend to 0 fast enough. Note that a compromise has to be found concerning these two rates. The sequence λn,n′ should be chosen at last, so that (b) is satisfied. The design points Z′i are deterministic, similarly to all results in the present paper. Equivalently, all results can be seen as given conditionally to the sample (Z′i )i≥1 . For every n′ , we can still use the non-random measure IPZ′ ,n′ and we impose in Part (iii) that it converges to a measure with a density w.r.t. the Lebesgue measure. Intuitively, this means we do not want to observe design points that would be repeated infinitely often (this would result in a Dirac component in the limit of IPZ′ ,n′ ). Note that we do not impose any condition on the density fZ′ ,∞ , but we have already imposed that the true density fZ of the variable Z is bounded (see Assumptions 2.3 and 2.4). An optimal choice of the density fZ′ ,∞ is not an easy task. Indeed, even if we knew exactly the true density fZ (which is rather unlikely in applications), there is no obvious reasons why this choice would better than others. If we want a small asymptotic variance Ṽas , the distribution of the design 2 should concentrate the Z′i in the regions where Λ′ τ1,2|Z=z′ is small and where ψ(z′ )ψ(z′)T is big. Part (iv) of the assumption is usual, and ensure that the design is somehow “asymptotically full rank”. Note that this matrix V1 will also appear in the asymptotic variance, similarly to the result we have obtained in the case of the ordinary least squares. Part (v) will allow us to control the remainder term in a Taylor expansion of Λ. Notice that this assumption was not necessary in the previous section, that is, with the simple asymptotic framework, where we used the Delta-method on the vector (τ̂1,2|Z=Z′i − τ1,2|Z=Z′i )i=1,...,n′ . But when the number of terms n′ tends to infinity, we have to use the second derivative to control a remainder term (see the details about this remainder term T3 , Equation (22)). Theorem 17 (Asymptotic law of the estimator jointly in (n, n′ )). Under Assumptions 2.1-2.8, we D have (nn′ hpn,n′ )1/2 (β̂n,n′ − β ∗ ) −→ N (0, Ṽas ), where Ṽas := V1−1 V2 V1−1 and V2 := Z 2 K(t) dt Z 2 g ∗ (x1 , x3 )g ∗ (x2 , x3 )Λ′ τ1,2|Z=z′ ψ(z′)ψ(z′ )T , fZ′ ,∞ (z′ ) dx1 dx2 dx3 dz′ , × fX|Z (x1 |Z = z )fX|Z (x2 |Z = z )fX|Z (x3 |Z = z ) ′ fZ (z ) ′ ′ 18 ′ and V1 is the matrix defined in Assumption 2.8(iv). This theorem is proved in Section D.2. 3 Numerical applications 3.1 Simulations Now, we evaluate the numerical performance of our estimates through a small simulation study. In this subsection, we have chosen n = 3000, n′ = 100 and p = 1. The univariate covariate Z follows a uniform distribution between 0 and 1. The marginals X1 |Z = z and X2 |Z = z follow some Gaussian distributions N (z, 1). The conditional copula of (X1 , X2 )|Z = z belongs to a one-parameter family (here the Gaussian copula family). Therefore, it will be parameterized by its (conditional) Kendall’s tau τ1,2|Z=z , and is denoted by Cτ1,2|Z=z . Obviously, τ1,2|Z=z is computed using Model (1). The dependence w.r.t. Z = z is specified by τ1,2|Z=z := 3z(1 − z) = 3/4 − 3/4(z − 1/2)2. We will choose Λ as the identity function and the Zi′ as a uniform grid on [0.01, 0.99]. The values 0 and 1 are excluded to avoid boundaries numerical problems. As for regressors, we will consider p′ = 12 functions of Z, namely ψ1 (z) = 1, ψi+1 (z) = 2−i (z − 0.5)i for i = 1, . . . , 5, ψ5+2i (z) = cos(2πz/i) and ψ6+2i (z) = sin(2πz/i) for i = 1, 2, ψ11 (z) = 1{z ≤ 0.4}, ψ12 (z) = 1{z ≤ 0.6}. They cover a mix of polynomial, trigonometric and step-functions. Then, the true parameter is β ∗ = (3/4, 0, −3/4, 09), where 09 is the null vector of size 9. Our reference value of the tuning parameter h is given by the usual rule-of-thumb, i.e. h = σ̂(Z)n−1/5 , where σ̂ is the estimated standard deviation of Z. Moreover, we designed a cross validation procedure (see Algorithm 2) whose output is a data-driven choice for the tuning parameter λ̂cv . Finally, we perform the convex optimization of the Lasso criterion using the R package glmnet [8]. In our simulations, we observed that the estimation of β̂ are not very satisfying if the family of function ψi is far too large. Indeed, our model will “learn the noise” produced by the kernel  estimation, and there will be “overfitting” in the sense that the function Λ(−1) ψ(·)T β̂ will be very 19 Algorithm 2: Cross-validation algorithm for choosing λ. Divide the dataset D = (Xi,1 , Xi,2 , Zi )i=1,...,n into N disjoint blocks D1 , . . . , DN ; foreach λ do for k ← 1 to N do (k) Estimate the conditional Kendall’s taus τ̂1,2|Z=Z′ , i = 1, . . . , n′ on the dataset D k ; i Estimate β (−k) using Algorithm 1 on the dataset D\D k with the tuning parameter λ ; 2  P (k) ′ T (−k) Compute Errk (λ) := i=1,...,n′ τ̂1,2|Z=Z′ − ψ(Zi ) β ; i end end P Return λ̂cv := arg minλ k Errk (λ). close to τ̂1,2|Z=· , but not to the target τ1,2|Z=· . Therefore, we have to find a compromise between misspecification (to choose a family of ψi that is not rich enough), and over-fitting (to choose a family of ψi that is too rich). Note that in our simulations, we have replaced τ̂1,2|Z=z by the asymptotically equivalent symmetrical estimator ∗ τ̂1,2|Z=z := n X i,j=1     wi,n (z)wj,n(z) 1 (Xi,1 − Xj,1).(Xi,2 − Xj,2) > 0 − 1 (Xi,1 − Xj,1 ).(Xi,2 − Xj,2 ) < 0 , that provides more stable results in the limiting cases. We have led 100 simulations for couples of tuning parameters (λ, h), where λ ∝ λ̂cv , and h ∝ σ̂(Z)n−1/5 . The results in term of empirical bias and standard deviation of β̂ are displayed in Figure 1. Empirically, we find the smallest h tend to perform better than the largest ones. The influence of the tuning parameter λ (around reasonable values) is less clear. Finally, we selected h = 0.25σ̂(Z)n−1/5 and λ = 2λ̂cv . With the latter choice, the coefficient by coefficient results are provided in Table 1. The empirical results are relatively satisfying, despite a small amount of over-fitting. In particular, the estimation procedure is able to identify the non-zero coefficients almost systematically. Value Bias Std. dev. Prob. β̂1 β̂2 β̂3 β̂4 β̂5 β̂6 β̂7 β̂8 β̂9 β̂10 β̂11 β̂12 0.75 0 0.75 0 0 0 0 0 0 0 0 0 -0.13 3.6e-05 0.26 0.0033 -0.045 -0.0051 -0.011 -2e-04 -3.2e-05 0.073 -0.0013 0.00021 0.15 0.00041 0.18 0.035 0.078 0.041 0.022 0.0051 0.00037 0.15 0.007 0.0041 1 0.015 0.96 0.015 0.4 0.069 0.36 0.076 0.0076 0.33 0.038 0.023 Table 1: Estimated bias, standard deviation and probability of being non-null for each estimated component of β (h = 0.25 σ̂(Z)n−1/5 and λ = 2λ̂cv ). 20 0.06 lambda = 0.25 * lambdaCV 0.5 * lambdaCV 1 * lambdaCV 2 * lambdaCV 4 * lambdaCV 0.04 Mean standard deviation 0.08 0.10 h= 0.125 * sd(Z) * n^(−1/5) 0.25 * sd(Z) * n^(−1/5) 0.5 * sd(Z) * n^(−1/5) 0.75 * sd(Z) * n^(−1/5) 1 * sd(Z) * n^(−1/5) 2 * sd(Z) * n^(−1/5) 4 * sd(Z) * n^(−1/5) 0.05 0.06 0.07 0.08 Mean absolute bias P12 P ∗ |IE[ β̂ ] − β |/12 and mean standard deviation Figure 1: Mean absolute bias 12 i i i=1 σ(β̂i )/12, i=1 for different data-driven choices of the tuning parameters h and λ. To give a complete picture, for one particular simulated sample, we show the results of the estimation procedure, as displayed in Figures 2, 3 and 4. 3.2 Real data application Now, we apply the model given by (1) to a real dataset. From the website of the World Factbook of the Central Intelligence Agency, we have collected data of male and female life expectancy and GDP per capita for n = 206 countries in the world. We seek to analyze the dependence between male and female life expectancies conditionally on the GDP per capita, i.e. given the explanatory variable Z = log 10(GDP/capita). This dataset and these variables are similar as those in the first example given in Gijbels et al. [9]. We use n′ = 100, h = 2σ(Z)n−1/5 and the same family of functions ψi as above (once composed with a linear transform to be defined on [min(Z), max(Z)]). As expected, the levels of conditional dependence between male and female expectancies are strongly dependent overall. When some 21 9 5 3 1 −8 −6 −4 −2 2 8 −0.2 5 6 −0.4 Coefficients 0.0 4 12 7 11 −0.6 3 Log Lambda Figure 2: Evolution of the estimated non-zero coefficients as a function of the regularization parameter λ. Note that the coefficients β̂9 and β̂10 coefficients are always zero (and are not displayed). countries are by epidemics or wars, both genders suffer. And the opposite when an efficient national Health system is put in place. Nonetheless, we observe a decrease of the conditional Kendall’s tau when Z is larger, up to Z ≃ 4.5. This is inline with the analysis of Gijbels et al. [9]. Globally, when countries become richer, more developed and safe, men and women less and less depend on their environment (and on its risks, potentially). Interestingly, when Z become even larger (the richest countries in the world), conditional dependencies between male and female life expectancies increase again, because men and women behave similarly in terms of way of life. They can benefit from the same levels of security and health. 22 400 350 300 250 100 150 200 MSE −8 −6 −4 −2 log(Lambda) 0.0 −1.0 −0.5 Conditional Kendall’s tau 0.5 1.0 Figure 3: 5-fold cross-validation mean-squared error as a function of the regularization parameter λ. The dotted line correspond to the value 2 · λ̂cv where λ̂cv is selected by Algorithm 2. 0.0 0.2 0.4 0.6 0.8 1.0 z Figure 4: True conditional Kendall’s tau τ1,2|Z=z (black curve), estimated conditional Kendall’s  tau τ̂1,2|Z=z (red curve), and prediction Λ(−1) ψ(z)T β̂ (blue curve) as a function of z. For the blue curve, the regularization parameter is 2λ̂cv where λ̂cv is selected by Algorithm 2. 23 0.9 0.6 0.7 0.8 Estimated conditional Kendall’s tau 3.0 3.5 4.0 4.5 5.0 z  Figure 5: Estimated conditional Kendall’s tau τ̂1,2|Z=z (red curve), and prediction Λ(−1) ψ(z)T β̂ (blue curve) as a function of z for the application on real data, where the estimated non-zero coefficients are β̂1 = 0.78, β̂7 = −0.043, β̂8 = 0.069 and β̂11 = 0.020. The regularization parameter is λ̂cv /2 where λ̂cv is selected by Algorithm 2. 9 6 3 3 −10 −8 −6 −4 0.0 9 2 12 11 3 −0.1 Coefficients 0.1 8 −0.2 7 6 Log Lambda Figure 6: Evolution of the estimated non-zero coefficients as a function of the regularization parameter λ for the application on real data. Note that all the other ψi coefficients are zero (except the intercept). 24 200 195 190 180 185 MSE −10 −9 −8 −7 −6 −5 −4 −3 log(Lambda) Figure 7: 5-fold cross-validation mean-squared error as a function of the regularization parameter λ for the application on real data. The dotted line correspond to the value λ̂cv /2 where λ̂cv is selected by Algorithm 2. 25 References [1] Pierre C. Bellec, Guillaume Lecué, and Alexandre B. Tsybakov. Slope meets lasso: improved oracle bounds and optimality. ArXiv preprint, arXiv:1605.08651, 2016. [2] Peter J Bickel, Ya’acov Ritov, Alexandre B Tsybakov, et al. Simultaneous analysis of lasso and dantzig selector. The Annals of Statistics, 37(4):1705–1732, 2009. [3] Denis Bosq and Jean-Pierre Lecoutre. Théorie de l’estimation fonctionnelle. Economica, 1987. [4] Alexis Derumigny and Jean-David Fermanian. About tests of the “simplifying” assumption for conditional copulas. Dependence Modeling, 5(1):154–197, 2017. [5] Jianqing Fan and Runze Li. Variable selection via nonconcave penalized likelihood and its oracle properties. Journal of the American Statistical Association, 96(456):1348–1360, 2001. [6] Jean-David Fermanian and Olivier Lopez. Single-index copulae. Journal of Multivariate Analysis, 165:27–55, 2018. [7] Jean-David Fermanian and Marten H. Wegkamp. Time-dependent copulas. Journal of Multivariate Analysis, 110:19–29, 2012. [8] Jerome Friedman, Trevor Hastie, Rob Tibshirani, and Noah Simon. glmnet: Lasso and elasticnet regularized generalized linear models. R package version 2.0–2, 2017. [9] Irène Gijbels, Noël Veraverbeke, and Marek Omelka. Conditional copulas, association measures and their applications. Computational Statistics & Data Analysis, 55(5):1919–1932, 2011. [10] Kengo Kato. Asymptotics for argmin processes: Convexity arguments. Journal of Multivariate Analysis, 100(8):1816–1829, 2009. [11] Roger B. Nelsen. An introduction to copulas. Springer Science & Business Media, 2007. [12] Andrew J. Patton. Estimation of multivariate models for time series of possibly different lengths. Journal of applied econometrics, 21(2):147–173, 2006. 26 [13] Andrew J. Patton. Modelling asymmetric exchange rate dependence. International economic review, 47(2):527–556, 2006. [14] François Portier and Johan Segers. On the weak convergence of the empirical conditional copula under a simplifying assumption. ArXiv preprint, arXiv:1511.06544, 2015. [15] Robert J. Serfling. Approximation theorems of mathematical statistics. John Wiley & Sons, 1980. [16] Winfried Stute. Conditional U-statistics. The Annals of Probability, 19(2):812–825, 1991. [17] Wei-Yann Tsai. Testing the assumption of independence of truncation time and failure time. Biometrika, 77(1):169–177, 1990. [18] Noël Veraverbeke, Marek Omelka, and Irène Gijbels. Estimation of a conditional copula and association measures. Scandinavian Journal of Statistics, 38(4):766–780, 2011. [19] Hui Zou. The adaptive lasso and its oracle properties. Journal of the American Statistical Association, 101(476):1418–1429, 2006. A Proofs for τ̂ For convenience, remind Berk’s (1970) inequality (see Theorem A in Serfling [15, p.201]). Note that, if m = 1, this reduces to Bernstein’s inequality. Lemma 18. Let m > 0, X1 , . . . , Xm some random vectors with values in a measurable space X and g : X m → [a, b] be a symmetric real bounded function. Set θ := IE[g(X1 , . . . , Xm )] and σ 2 := V ar[g(X1, . . . , Xm )]. Then, for any t > 0 and n ≥ m, !    −1 X [n/m]t2 n , g(Xi1 , . . . , Xim ) − θ ≥ t ≤ exp − 2 IP 2σ + (2/3)(b − θ)t m c where P c denotes summation over all subgroups of m distinct integers (i1 , . . . , im ) of {1, . . . n}. 27 A.1 Proof of Proposition 2 Lemma 19. Under Assumptions 2.1, 2.2 and 2.4, we have for any t > 0,     p 2 α nh t C h K,α R + t ≤ 2 exp − . IP fˆZ (z) − fZ (z) ≥ α! 2fZ,max K 2 + (2/3)CK t This Lemma is proved below. If, for some ǫ > 0, we have CK,αhα /α! + t ≤ fZ,min − ǫ, then  R fˆ(z) ≥ ǫ > 0 with a probability larger than 1 − 2 exp − nhp t2 /(2fZ,max K 2 + (2/3)CK t) . We should therefore choose the largest t as possible, which yields Proposition 2. It remains to prove Lemma 19. Use the usual decomposition between a stochastic component   and a bias: fˆZ (z) − fZ (z) = fˆZ (z) − IE[fˆZ (z)] + IE[fˆZ (z)] − fZ (z) . We first upper-bound the bias. n   −1 X ˆ Kh (Zi − z) − fZ (z) IE[fZ (z)] − fZ (z) = IE n i=1 = = Z ZR R  K (y − z) f (y) − f (z) dy h Z Z p    K(u) f z + hu − f (z) du. Z Z p  Set φz,u(t) := fZ z + thu for t ∈ [0, 1]. This function has at least the same regularity as fZ , so it is α-differentiable. By a Taylor-Lagrange expansion, we get Z R  K(u) fZ p   z + hu − fZ (z) du = = Z R Z   K(u) φ (1) − φ (0) du z,u z,u p Rp K(u) X α−1 i=1  1 (α) 1 (i) φ (0) + φz,u (tz,u ) du, i! z,u α! R (i) for some real number tz,u ∈ (0, 1). By Assumption 2.1, for every i = 1, . . . , α−1, Rp K(u)φz,u (0) du = 0. Therefore, IE[fˆZ (z)] − fZ (z) = Z R p K(u) 1 (α) φ (tz,u )du α! z,u 28 1 = α! Z R K(u) p p X hα ui1 . . . uiα i1 ,...,iα =1   ∂ α fZ CK,α α h . z + tz,u hu du ≤ ∂zi1 . . . ∂ziα α! Second, the stochastic component may be written as fˆZ (z) − IE[fˆZ (z)] = n−1 n X i=1 n n h i X X −1 −1 Kh (Zi − z) − IE n Kh (Zi − z) = n Si , i=1 i=1 where Si := Kh (Zi − z) − IE[Kh (Zi − z)]. Apply Lemma 18 with m = 1 and g(Zi ) = Si . Here, we R have b = −a = h−p CK , θ = IE[g(Z1 )] = 0 and V ar[g(Z1 )] ≤ h−p fZ,max K 2 , and we get IP A.2 !   n nt2 1X R Kh (Zi − z) − IE[Kh (Zi − z)] ≥ t ≤ exp − −p . n i=1 2h fZ,max K 2 + (2/3)h−pCK t Proof of Proposition 3 Consider the decomposition τ̂1,2|Z=z − τ1,2|Z=z = 4 X 1≤i,j≤n   wi,n (z)wj,n(z)1 Xi < Xj − 4IP X1 < X2 Z1 = Z2 = z X Kh (Zi − z)Kh (Zj − z)    =4 1 Xi < Xj − IP X1 < X2 Z1 = Z2 = z n2 fˆ2 (z) = 1≤i,j≤n X f 2 (z) 4 Z × fˆZ2 (z) 1≤i,j≤n =: 4 fZ2 (z) × fˆ2 (z) Z Z  Kh (Zi − z)Kh (Zj − z)   Z = Z = z 1 X < X − IP X < X 1 2 i j 1 2 n2 fZ2 (z) ! X Si,j . 1≤i,j≤n P The conclusion will follow from the next two lemmas. Then, fZ2 (z)/fˆZ2 (z) and 1≤i,j≤n Si,j will be bounded separately.  Lemma 20. Under Assumptions 2.1-2.4 and if CK,α hα /α! + t < fZ,min /2 for some t > 0, then    2 2  C hα  16fZ,max nhp t2 fZ (z) K,α R , ≥1+ 3 +t ≤ 2 exp − IP fZ,min α! 2fZ,max K 2 + (2/3)CK t fˆZ2 (z) 29 and fˆZ (z) is strictly positive on these events. Proof : Applying the mean value inequality to the function x 7→ 1/x2 , we get 2 1 1 ≤ ∗ 3 fˆZ (z) − fZ (z) , − 2 2 ˆ fZ fZ (z) fZ (z) where fZ∗ lies between fˆZ (z) and fZ (z). By Lemma 19, we get     CK,αhα nhp t2 ˆ R IP fZ (z) − fZ (z) ≤ . + t ≥ 1 − 2 exp − α! 2fZ,max K 2 + (2/3)CK t Therefore, on this event, fˆZ (z) − fZ (z) ≤ fZ,min /2, so that fZ,min /2 ≤ fˆZ (z). We have also fZ,min /2 ≤ fZ (z) and then fZ,min /2 ≤ fZ∗ . Combining the previous inequalities, we finally get 1 fˆZ2 (z) −  16 ˆ 16  CK,αhα 1 ≤ ≤ f (z) − f (z) + t , Z Z 3 3 fZ2 (z) fZ,min fZ,min α! and we deduce the result.  Lemma 21. Under Assumptions 2.1-2.5, we have  IP X Si,j 1≤i,j≤n    (n − 1)h2p t2 CXZ,α hα R + t ≤ 2 exp − . > 2 2 2 2 2 2 n fZ (z)α! 16CK fZ,min ( K 2 )2 + (8/3)CK fZ,min t Proof : Note that X Si,j = 1≤i,j≤n The “diagonal term” X 1≤i6=j≤n n X  Si,j − IE[Si,j ] + n(n − 1)IE[S1,2 ] + Si,i . i=1 Pn i=1 Si,i = −IP X1 < X2 Z1 = Z2 = z negative and negligible. It will be denoted by −∆n .  Pn i=1 Kh2 (Zi − z)/(n2 fˆZ2 (z)) is Now, let us deal with the main term, that is decomposed as a stochastic component and a bias component. First, let us deal with the bias. Simple calculations provide, if i 6= j,    Kh (Zi − z)Kh (Zj − z)   1 Xi < Xj − IP Xi < Xj Zi = Zj = z IE[Si,j ] = IE n2 fZ2 (z) 30 = Z = Z R2p+2 = Z R2p+2 R2p+2  Kh (z1 − z)Kh (z2 − z)   x < x − IP X < X Z = Z = z 1 1 2 i j i j n2 fZ2 (z) × fX,Z (x1 , z1 ) fX,Z (x2 , z2) dx1 dz1 dx2 dz2  K(u)K(v)   1 x < x − IP X < X Z = Z = z 1 2 i j i j n2 fZ2 (z)     × fX,Z x1 , z + hu fX,Z x2 , z + hv dx1 du dx2 dv  K(u)K(v)   x < x − IP X < X Z = Z = z 1 1 2 i j i j n2 f 2 (z)   Z    fX,Z x1 , z + hu fX,Z x2 , z + hv − fX,Z (x1 , z) fX,Z (x2 , z) dx1 du dx2 dv, because, for every z, Z    0= x < x fX|Z=z (x1 )fX|Z=z (x2 )dx1 dx2 − IP X < X Z = Z = z 1 1 2 1 2 1 2 4 R Z    fX,Z (x1 , z)fX,Z (x2 , z) dx1 dx2 . = x < x − IP X < X Z = Z = z 1 1 2 1 2 1 2 fZ2 (z) R4 (11) We apply the Taylor-Lagrange formula to the function     φx1 ,x2 ,u,v (t) := fX,Z x1 , z + thu fX,Z x2 , z + thv . With obvious notations, this yields IE[Si,j ] = Z  K(u)K(v)   Z = Z = z 1 x < x − IP X < X i j 1 2 i j n2 f 2 (z)  Z  · φx1 ,x2 ,u,v (1) − φx1 ,x2 ,u,v (0) dx1 du dx2 dv  K(u)K(v)   Z = Z = z 1 x < x − IP X < X i j 1 2 i j n2 fZ2 (z) X  α−1 1 (k) 1 (α) · φx1 ,x2 ,u,v (0) + φx1 ,x2 ,u,v (tx1 ,x2 ,u,v ) dx1 du dx2 dv k! α! k=1   Z   1 (α) K(u)K(v)  1 x1 < x2 − IP Xi < Xj Zi = Zj = z = φ (tx ,x ,u,v ) dx1 du dx2 dv. n2 fZ2 (z) α! x1 ,x2 ,u,v 1 2 = Z 31 (α) Since φx1 ,x2 ,u,v (t) is equal to α   X α k=0 k p X i1 ,...,iα   ∂ k fX,Z  ∂ α−k fX,Z  h ui1 . . . uik vik+1 . . . viα x1 , z + thu · x2 , z + thv , ∂zi1 . . . ∂zik ∂zik+1 . . . ∂ziα =1 α using Assumption 2.5, we get IE[S1,2 ] ≤ CXZ,α hα /(n2 fZ2 (z)α!). (12) Second, the stochastic component will be bounded from above. Indeed, X 1≤i6=j≤n (Si,j − IE[Si,j ]) = 1 n2 X 1≤i6=j≤n  g (Xi , Zi ) , (Xj , Zj ) , with the function g defined by  Kh (Zi − z)Kh (Zj − z)   1 Xi < Xj − IP Xi < Xj Zi = Zj = z g (Xi , Zi ), (Xj , Zj ) := fZ2 (z)      −2 . −IE Kh (Zi − z)Kh (Zj − z)fZ (z) 1 Xi < Xj − IP Xi < Xj Zi = Zj = z     The symmetrized version of g is g̃i,j = g (Xi , Zi ) , (Xj , Zj ) + g (Xj , Zj ) , (Xi , Zi ) /2. We can   now apply Lemma 18 to the sum of the g̃i,j . With its notations, θ = IE g̃i,j = 0. Moreover, h i V ar g (Xi , Zi ), (Xj , Zj ) Z 2 Kh2 (z1 − z)Kh2 (z2 − z)   ≤ 1 x1 < x2 − IP Xi < Xj Zi = Zj = z fZ4 (z) × fX,Z (x1 , z1 )fX,Z (x2 , z2 ) dx1 dx2 dz1 dz2 Z K 2 (t1 )K 2 (t2 ) fX,Z (x1 , z − ht1 )fX,Z (x2 , z − ht2 ) dx1 dx2 dt1 dt2 ≤ h2p fZ4 (z) 2 Z −2p 2 4 K 2 /fZ,min ≤ h fZ,max , and the same upper bound applies for g̃i,j (invoke Cauchy-Schwartz inequality). Here, we choose 32 2 −2p −2 b = −a = 2CK h fZ,min . This yields  IP   4  X [n/2]t2 fZ,min 2 R g̃i,j > t ≤ exp − −2p 2 . 2 −2p 2 h fZ,min t n(n − 1) 1≤i6=j≤n 2h fZ,max ( K 2 )2 + (4/3)CK Then, for every t > 0, we obtain  X IP 1≤i6=j≤n  1  Si,j − IE[Si,j ] − ∆n ≥ t ≤ IP 2 n X 1≤i6=j≤n   g (Xi , Zi ) , (Xj , Zj ) ≥ t + ∆n  (n − 1)  X 2 ≤ IP g̃i,j ≥ t + ∆n · n n(n − 1) 1≤i6=j≤n   4 [n/2]t2 fZ,min R ≤ exp − −2p 2 , and 2 −2p 2 2h fZ,max ( K 2 )2 + (4/3)CK h fZ,min t  X IP | 1≤i6=j≤n   Si,j − IE[Si,j ] − ∆n | ≥ t ≤ 2 exp   4 (n − 1)t2 fZ,min R . − −2p 2 2 −2p 2 h fZ,min t 4h fZ,max ( K 2 )2 + (8/3)CK The latter inequality and (12) conclude the proof.  A.3 Proof of Proposition 5   Let us note that τ1,2|Z=z = IE g ∗ (X1 , X2 ) Z1 = z, Z2 = z , and that the estimator given by (5) with the weights (4) can be rewritten as τ̂1,2|Z=z := Un (g ∗ ) / {Un (1) + ǫn } where Un (g) := 1 n(n − 1)IE[Kh (z − Z)]2 X 1≤i6=j≤n g(Xi , Xj )Kh (z − Zi )Kh (z − Zj ), for any measurable bounded function g, with the residual diagonal term n X 1 ǫn = K 2 (z − Zi ). n(n − 1)IE[Kh (z − Z)]2 i=1 h 33 By Bochner’s lemma (see Bosq and Lecoutre [3]), ǫn is OP ((nhp )−1 ) and is negligible compared to Un (1). Note that Un (g ∗) := 1 n(n − 1)IE[Kh (z − Z)]2 X 1≤i6=j≤n g ∗ (Xi , Xj )Kh (z − Zi )Kh (z − Zj ) := X 1 ∗ gi,j , n(n − 1) 1≤i6=j≤n with obvious notations. In our case, its expectation is   1 IE g ∗ (X1 , X2 )Kh (z − Z1 )Kh (z − Z2 ) 2 IE[Kh (z − Z)] Z = g ∗(x1 , x2 )K(t1 )K(t2 )fX,Z (x1 , z + ht1 )fX,Z (x2 , z + ht2 )dx1 dx2 dt1 dt2 Z   1 g ∗ (x1 , x2 )fX,Z (x1 , z)fX,Z (x2 , z)dx1 dx2 = IE g ∗(X1 , X2 ) Z1 = z, Z2 = z , → 2 fZ (z)   IE Un (g ∗ ) := applying Bochner’s lemma to z 7→ continuous function. R g ∗(x1 , x2 )fX|Z=z (x1 )fX|Z=z(x2 ) dx1 dx2 = τ1,2|Z=z , that is a ∗ Set θn := IE[gi,j ]. Since g ∗ is symmetrical, the Hájek projection Ûn (g ∗ ) of Un (g ∗) satisfies n Ûn (g ∗ ) := n 2X 2X ∗ IE[g0,j |Xj , Zj ] − θn =: gn (Xj , Zj ) − θn , n j=1 n j=1   where gn (x, z̃) := Kh (z − z̃)IE g ∗(X, x)Kh (z − Z) / IE[Kh (z − Z)]2 . Note that IE[Ûn (g ∗)] = θn , ∗ i 6= j. Since V ar(Ûn (g ∗)) = 4V ar(IE[gi,j |Xj , Zj ])/n = O((nhp )−1 ), then Ûn (g ∗) = θn + oP (1) = τ1,2|Zz + oP (1). Moreover,  X  1 ∗ ∗ gi,j − IE[gi,j |Xj , Zj ] − IE[gi,j |Xi , Zi ] + θn n(n − 1) 1≤i6=j≤n X g i,j . Un (g ∗) − Ûn (g ∗ ) := =: 1 n(n − 1) 1≤i6=j≤n By usual U-statistics calculations, it can be easily checked that V ar(Un (g ∗ ) − Ûn (g ∗ )) = 1 2 n (n − 1)2 X X 1≤i1 6=j1 ≤n 1≤i2 6=j2 ≤n 34 IE[g i1 ,j1 g i2 ,j2 ] = O 1  . n2 h2p (13) Indeed, when all indices (i1 , i2 , j1 , j2 ) are different, or when there is a single identity among them, IE[g i1 ,j1 g i2 ,j2 ] = 0. The first nonzero terms arise when there are two identities, i.e. i1 = i2 and j1 = j2 (or i1 = j2 and j1 = i2 ). In the latter case, an upper bound as O((nhp )−2 ) when fZ is continuous at z, by usual change of variable techniques and Bochner’s lemma. Then, Un (g ∗ ) = Ûn (g ∗) + oP (1) = τ1,2|Zz + oP (1). Note that Un (1) + ǫn tends to one in probability (Bochner’s lemma). As a consequence, τ̂1,2|Z=z = Un (g ∗) / (Un (1) + ǫn ) tends to τ1,2|Z=z /1 by the continuous mapping theorem.  A.4 Proof of Proposition 6 We now study the joint behavior of (τ̂1,2|Z=Z′i − τ1,2|Z=Z′i )i=1,...,n′ . We will follow Stute [16], applying the same ideas with a multivariate conditioning variable z and studying the joint distribution of U-statistics at several conditioning points. As in the proof of Proposition 5, the estimator (5) with the weights (4) can be rewritten as τ̂1,2|Z=Z′i := Un,i (g ∗ ) / (Un,i (1) + ǫn,i ), where 1 Un,i (g) := n(n − 1)IE[Kh (Z′i − Z)]2 n X j1 ,j2 =1,j1 6=j2 g(Xj1 , Xj2 )Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ), for any bounded measurable function g : R4 → R. Moreover, supi=1,...,n′ |ǫn,i | = OP (n−1 h−p ). By a limited expansion of fX,Z w.r.t. its second argument, and under Assumption 2.5, we easily   check that IE Un,i (g) = τ1,2|Z=Z′i + rn,i , where |rn,i | ≤ C0 hαn /fZ2 (Z′i ), for some constant C0 that is independent of i.  Now, we prove the joint asymptotic normality of Un,i (g) i=1,...,n′ . The Hájek projection Ûn,i (g)    P of Un,i (g) satisfies Ûn,i (g) := 2 nj=1 gn,i Xj , Zj /n − θn , where θn := IE Un,i (g) and   gn,i (x, z) := Kh (Z′i − z)IE g(X, x)Kh (Z′i − Z) / IE[Kh (Z′i − Z)]2 . Lemma 22. Under the assumptions of Proposition 6, for any measurable bounded function g,    (nhp )1/2 Ûn,i (g) − IE Un,i (g) D i=1,...,n′ 35 −→ N (0, M∞ (g)), as n → ∞, where, for 1 ≤ i, j ≤ n′ , [M∞ (g)]i,j := 4 R K 2 1{Z′i =Z′j } Z fZ (Z′i ) g x1 , x)g x2 , x)fX|Z=Z′i (x)fX|Z=Z′i (x1 )fX|Z=Z′i (x2 )dx dx1 dx2 . This lemma is proved in Section A.5. Similarly as in the proof of Lemma 2.2 in Stute [16], for every i = 1, . . . , n′ and every bounded   symmetrical measurable function g, we have (nhp )1/2 V ar Ûn,i (g) − Un,i (g) = o(1), which implies    (nhp )1/2 Un,i (g) − IE Un,i (g) D i=1,...,n′ −→ N (0, M∞ (g)), as n → ∞. (14) Considering two measurable and bounded functions g1 and g2 , we have Un,i (c1 g1 + c2 g2 ) = c1 Un,i (g1 ) + c2 Un,i (g2 ) for every real numbers c1 , c2 . By the Cramér-Wold device, we get p 1/2 (nh )      , Un,i (g2 ) − IE Un,i (g2 ) i=1,...,n′ i=1,...,n′    D   M∞ (g1 ) M∞ (g1 , g2 ) −→ N 0,   , M∞ (g1 , g2 ) M∞ (g2 )   Un,i (g1 ) − IE Un,i (g1 ) as n → ∞, where [M∞ (g1 , g2 )]i,j := R 4 K 2 1{Z′i =Z′j } Z fZ (Z′i ) g1 x1 , x)g2 x2 , x)fX|Z=Z′i (x)fX|Z=Z′i (x1 )fX|Z=Z′i (x2 )dx dx1 dx2 . Set τ̃1,2|Z=Z′i := Un,i (g ∗) / Un,i (1). Since   (nhpn )1/2 τ̂1,2|Z=Z′i − τ̃1,2|Z=Z′i = OP (nhpn )1/2 ǫn,i = oP (1),  it is sufficient to establish the asymptotic law of (nhpn )1/2 τ̃1,2|Z=Z′i − τ1,2|Z=Z′i . Since IE[Un,i (1)] = 36 1 + o((nhp )−1/2 ) and IE[Un,i (g ∗ )] = τ1,2|Z=Z′i + o((nhpn )−1/2 ), we get p 1/2 (nh )   ∗ ′ Un,i (g ) − τ1,2|Z=Zi    , Un,i (1) − 1 i=1,...,n′ i=1,...,n′    ∗ ∗ D   M∞ (g ) M∞ (g , 1) −→ N 0,   , as n → ∞. ∗ M∞ (g , 1) M∞ (1) Now apply the Delta-method with the function ρ(x, y) := x/y where x and y are real-valued vectors of size n′ and the division has to be understood component-wise. The Jacobian of ρ is     ′ ′ , where given by the n ×2n matrix Jρ (x, y) = Diag y1−1 , . . . yn−1 , Diag − x1 y1−2 , · · · − xn′ yn−2 ′ ′ for any vector v of size n′ , Diag(v) is the diagonal matrix whose diagonal elements are the vi , for  D i = 1, . . . , n′ . We deduce (nhp )1/2 τ̃1,2|Z=Z′i − τ1,2|Z=Z′i i=1,...,n′ −→ N (0, H), as n → ∞, setting   ∗ ∗  M∞ (g ) M∞ (g , 1) T H := Jρ (~τ , e)   Jρ (~τ , e) , M∞ (g ∗ , 1) M∞ (1)  and e is the vector of size n′ whose all components are equal to 1.  Thus, we have Jρ (~τ , e) = Idn′ , −Diag(~τ ) , denoting by Idn′ the identity matrix of size n′ and by where ~τ = τ1,2|Z=Z′i i=1,...,n  ′ Diag(~τ ) the diagonal matrix of size n′ whose diagonal elements are the τ1,2|Z′i , for i = 1, . . . , n′ . To be specific, we get H = M∞ (g ∗ ) − Diag(~τ )M∞ (g ∗ , 1) − M∞ (g ∗ , 1)Diag(~τ ) + Diag(~τ )M∞ (1)Diag(~τ ). For i, j in {1, . . . , n′ } and using the symmetry of the function g ∗ , we obtain [M∞ (g ∗)]i,j = ∗ R 4 K 2 1{Z′i =Z′j } fZ (Z′i ) IE[g ∗ (X1 , X)g ∗(X2 , X)|Z = Z1 = Z2 = Z′i ], R 4 K 2 1{Z′i =Z′j } [Diag(~τ )M∞ (g , 1)]i,j = τ1,2|Z=Z′i IE[g ∗ (X1 , X)|Z = Z1 = Z′i ] ′ fZ (Zi ) R 2 4 K 1{Z′i =Z′j } 2 τ1,2|Z=Z′i = [M∞ (g ∗, 1)Diag(~τ )]i,j = [Diag(~τ )M∞ (1)Diag(~τ )]i,j . = ′ fZ (Zi ) 37 As a consequence, we obtain [H]i,j A.5 R  4 K 2 1{Z′i =Z′j }  ∗ ∗ ′ 2 IE[g (X1 , X)g (X2 , X)|Z = Z1 = Z2 = Zi ] − τ1,2|Z=Z′i .  = fZ (Z′i ) Proof of Lemma 22 Let us evaluate the variance-covariance matrix Mn,n′ := [Cov(Ûn,i , Ûn,j )]1≤i,j≤n′ . Note that h  i    IE gn,i Xj , Zj = IE Ûn,i = IE Un,i (g) , and that  p 1/2 (nh )     Ûn,i − IE Un,i (g) i=1,...,n′ n    2hp/2 X  = 1/2 gn,i Xj , Zj − IE Un,i (g) , n i=1,...,n′ j=1 that is a sum of independent vectors. Thus, for every i, j in {1, . . . , n′ },   Cov(Ûn,i , Ûn,j ) = 4n−1 Cov gn,i X, Z , gn,j X, Z , and h  i IE gn,i X, Z , gn,j X, Z     Z ′ ′ IE g(X, x)K (Z − Z) IE g(X, x)K (Z − Z) h h i j fX,Z (x, z)dx dz = Kh (Z′i − z)Kh (Z′j − z) IE[Kh (Z′i − Z)]2 IE[Kh (Z′j − Z)]2 Z 1 g x1 , x)g x2 , x)Kh (Z′i − z)Kh (Z′j − z)Kh (Z′i − w1 )Kh (Z′j − w2 ) ∼ p 2 ′ 2 ′ h fZ (Zi )fZ (Zj ) × fX,Z (x, z)fX,Z (x1 , w1 )fX,Z (x2 , w2 )dx dz dx1 dw1 dx2 dw2 Z Z′j − Z′i 1 ∼ p 2 ′ 2 ′ g x1 , x)g x2 , x)K(u1 )K(u2 )K(u)K( + u)fX,Z (x, Z′i − hu) h fZ (Zi )fZ (Zj ) h × fX,Z (x1 , Z′i − hu1 )fX,Z (x2 , Z′j − hu2 )dx du dx1 du1 dx2 du2 . If i 6= j and K is compactly supported, the latter term is zero when n is sufficiently large, and  Cov(Ûn,i , Ûn,j ) = −4n−1 IE[Un,i ]IE[Un,j ] ∼ −4n−1 τ1,2|Z=Z′i τ1,2|Z=Z′j = o (nhp )−1 . 38 Otherwise, i = j and we get   2 IE gn,i X, Z ∼ 1 4 p h fZ (Z′i ) Z g x1 , x)g x2 , x)K(u1 )K(u2 )K 2 (u)fX,Z (x, Z′i ) · fX,Z (x1 , Z′i )fX,Z (x2 , Z′i )dx du dx1 du1 dx2 du2 R 2 Z K · g x1 , x)g x2 , x)fX|Z=Z′i (x)fX|Z=Z′i (x1 )fX|Z=Z′i (x2 )dx dx1 dx2 , ∼ p h fZ (Z′i ) h i by Bochner’s lemma. As IE gn,i X1 , Z1 = O(1), we get h i V ar gn,i Xj , Zj ∼ R K2 hp fZ (Z′i ) Z g x1 , x)g x2 , x)fX|Z=Z′i (x)fX|Z=Z′i (x1 )fX|Z=Z′i (x2 )dx dx1 dx2 . We have proved that, for every i, j ∈ {1, . . . , n′ }, nhp [Mn,n′ ]i,j → R 4 K 2 1{Z′i =Z′j } Z fZ (Z′i ) g x1 , x)g x2 , x)fX|Z=Z′i (x)fX|Z=Z′i (x1 )fX|Z=Z′i (x2 ) dx dx1 dx2 , as n → ∞. Therefore, nhp Mn,n′ tends to M∞ . We now verify Lyapunov’s condition with third moments, so that the usual multivariate central limit theorem would apply. It is then sufficient to show that n  hp/2 3 X n1/2 j=1 IE  gn,i Xj , Zj    − IE Un,i (g) 3  = o(1). (15) For any j = 1, . . . , n, we have IE  ∼ Z gn,i Xj , Zj 1 2 fZ (Z′i )  Z   − IE Un,i (g) g(x1, x)Kh (Z′i 3  − z1 )Kh (Z′i  3 − z)fX,Z (x1 , z1 )dx1 dz1 − IE Un,i (g) fX,Z (x, z)dx dz. 39 We do the change of variable z1 = Z′i − ht1 and z = Z′i − ht. We get    3 IE gn,i Xj , Zj − IE Un,i (g) Z Z 1 −2p g(x1 , x)K(t1 )K(t)fX,Z (x1 , Z′i − ht1 )dx1 dt1 ∼ h fZ2 (Z′i )  3 − hp IE Un,i (g) fX,Z (x, Z′i − ht)dx dt = O(h−2p ),  because of Bochner’s lemma, under our assumptions. Therefore, we have obtained n  hp/2 3 X n1/2 j=1 IE  gn,i Xj , Zj    − IE Un,i (g) 3  = O(h3p/2 n−3/2 nh−2p ) = O((nhp )−1/2 ) = o(1). Therefore, we have checked Lyapunov’s condition and the result follows. B  Non-asymptotic proofs for β̂ In this section, we will use the notation u := β̂ − β ∗ and ξ = [ξi,n ]i=1,...,n′ , ξi,n = Yi − (Z′ β)i . B.1 Two technical lemmas Lemma 23. We have ||Z′ u||2n′ ≤ λ|u|1 + 1 hξ , Z′ ui. ′ n Proof : As β̂ is optimal, through the Karush-Kuhn-Tucker conditions, we have (1/n′ )Z′ T (Y −   Z′ β̂) ∈ ∂ λ|β̂|1 , where ∂ λ|β̂|1 is the subdifferential of the norm λ| · |1 evaluated at β̂. The dual norm of | · |1 is | · |∞ , so there exists v such that |v|∞ ≤ 1 and (1/n′ )Z′ T (Y − Z′ β̂) + λv = 0. We deduce successively Z′ T Z′ (β ∗ − β̂)/n′ + Z′ T ξ/n′ + λv = 0, 1 1 ′ ∗ |Z (β − β̂)|22 + ′ (β ∗ − β̂)T Z′T ξ + λ(β ∗ − β̂)T v = 0, and finally ′ n n E 1 D ||Z′ (β ∗ − β̂)||2n′ ≤ ′ Z′ (β̂ − β ∗ ) , ξ + λ|β ∗ − β̂|1 .  n 2 Lemma 24. We have |uS C |1 ≤ |uS |1 + ′ hξ , Z′ ui. λn 40 Proof : By definition, β̂ is a minimizer of ||Y − Z′ β||2n′ + λ|β|1. Therefore, we have ||Y − Z′ β̂||2n′ + λ|β̂|1 ≤ ||Y − Z′ β ∗ ||2n′ + λ|β ∗|1 .  After some algebra, we derive ||Y − Z′ β̂||2n′ − ||Y − Z′ β ∗ ||2n′ ≤ λ |(β ∗ − β̂)S |1 − |(β̂ − β ∗ )S C |1 . Moreover, the mapping β 7→ ||Y −Z′ β||2n′ is convex and its gradient at β ∗ is −2 Z′ T (Y −Z′ β ∗ )/n′ = −2 Z′ T ξ/n′ . So, we obtain ||Y − Z′ β̂||2n′ − ||Y − Z′ β ∗ ||2n′ ≥ E −2 D ′T ∗ . Z ξ , β̂ − β n′ Finally, combining the two previous equations, we obtain E  −2 D ′T ∗ Z ξ , β̂ − β ≤ λ |(β ∗ − β̂)S |1 − |(β̂ − β ∗ )S C |1 .  ′ n Lemma 25. Assume that ′ max j=1,...,p′ n 1 X ′ Z ξi,n ≤ t, n′ i=1 i,j for some t > 0, that the assumption RE(s, 3) is satisfied, and that the tuning parameter is given √ 4(γ + 1)t s 42/q (γ + 1)ts1/q ′ ∗ by λ = γt, with γ ≥ 4. Then, ||Z (β̂ − β )||n′ ≤ and |β̂ − β ∗ |q ≤ , for κ(s, 3) κ2 (s, 3) every 1 ≤ q ≤ 2. Proof : Under the first assumption, we have the upper bound ′ n 1 X ′ 1 ′T Zi,j ξi,n ≤ |u|1 t. Z ξ , u ≤ |u|1 max ′ ′ j=1,...,p n n′ i=1  ′ We first show that u belongs to the cone δ ∈ Rp : |δS C |1 ≤ 3|δS |1 , Card(S) ≤ s , so that we will be able to use the RE(s, 3) assumption with J0 = S. From Lemma 24, |uS C |1 ≤ | uS |1 + 2t|u|1 /λ. With our choice of λ, we deduce |uS C |1 ≤ |uS |1 + 2|u|1/γ. Using the decomposition |u|1 = |uS C |1 + |uS |1 , we get |uS C |1 ≤ |uS |1 (γ + 2)/(γ − 2) ≤ 3|uS |1 . √ √ As a consequence, we have |u|1 = |uS C |1 + |uS |1 ≤ 4|uS |1 ≤ 4 s|u|2 ≤ 4 s ||Z′ u||n′ /κ(s, 3). 41 By Lemma 23, ′ ||Z u||2n′ √ 4 s 1 ′ ||Z′ u||n′ (γ + 1)t ≤ λ|u|1 + ′ hξ , Z ui ≤ λ|u|1 + |u|1 t ≤ |u|1 (γ + 1)t ≤ n κ(s, 3) We can now simplify and we get ||Z′ u||n′ ≤ 4(γ + 1)t √ s, κ(s, 3) |u|2 ≤ 4(γ + 1)t √ 16(γ + 1)t s. s, and |u| ≤ 1 κ2 (s, 3) κ2 (s, 3) Now, we compute a general bound for |u|q , with 1 ≤ q ≤ 2, using the Hölder norm interpolation inequality: 2/q−1 |u|q ≤ |u|1 B.2 2−2/q |u|2 ≤ 42/q (γ + 1)ts1/q ·  κ2 (s, 3) Proof of Theorem 8 Using Proposition 3, for every t1 , t2 > 0 such that CK,αhα /α! + t1 < fZ,min /2, with probability     R 2 ′ p 2 ′ 4 greater than 1 − 2n exp − nh t1 / 2fZ,max K + (2/3)CK t1 ) − 2n exp − (n − 1)h2p t22 fZ,min  R 2 2 2 / 4fZ,max ( K 2 )2 + (8/3)CK fZ,min t2 , we have ′ max j=1,...,p′ n 1 X ′ Z ξi,n ≤ Cψ max ′ ξi,n ≤ Cψ CΛ′ max ′ τ̂1,2|Z=Z′i − τ1,2|Z=Z′i i=1,...,n i=1,...,n n′ i=1 i,j   2  C  C hα α 16fZ,max XZ,α h K,α ≤ 4Cψ CΛ′ 1 + 3 + t1 + t2 . 2 fZ,min α! fZ,min α! We choose t1 := fZ,min /2 so that, because of Condition (7), we get CK,αhα /α! + t1 ≤ fZ,min . 42 2 2 2 2 +16fZ,max )}. By Condition (8), CXZ,α hα /(fZ,min α!) ≤ Now we choose t2 := tfZ,min /{8Cψ CΛ′ (fZ,min t2 , so that we have       2 2 16fZ,max 16fZ,max CXZ,α hα + t2 ≤ 8t2 Cψ CΛ′ 1 + 2 × ≤ t. 4Cψ CΛ′ 1 + 2 2 fZ,min fZ,min α! fZ,min As a consequence, we obtain that IP max j=1,...,p′ !   n′ 2 nhp fZ,min 1 X ′ ′ R Z ξi,n > t ≤ 2n exp − n′ i=1 i,j 8fZ,max K 2 + (4/3)CK fZ,min   (n − 1)h2p t2 ′ , + 2n exp − C2 + C3 t and we can apply Lemma 25 to get the claimed result.  Asymptotic proofs in n for fixed n′ C C.1 Proof of Lemma 10 Using the definition (2) of β̂n,n′ , we get # n′  1 X 2 Λ(τ̂1,2|Z=Z′i ) − ψ(Z′i )T β + λn,n′ |β|1 β̂n,n′ := arg min ′ ′ p n β∈R i=1 " # ′ n  1 X 2 = arg min′ ξi,n + ψ(Z′i )T β ∗ − ψ(Z′i )T β + λn,n′ |β|1 ′ p n β∈R i=1 # " n′ n′ n′ X  2 X 1 1 X 2 2 ξi,n + ′ ξi,n ψ(Z′i )T (β ∗ − β) + ′ ψ(Z′i )T (β ∗ − β) + λn,n′ |β|1 = arg min′ ′ p n n n β∈R i=1 i=1 i=1 # " ′ ′ n n 2 1 X 2 X ′ T ∗ ′ T ∗ ξi,n ψ(Zi ) (β − β) + ′ ψ(Zi ) (β − β) + λn,n′ |β|1  = arg min′ p n′ i=1 n i=1 β∈R " 43 C.2 Proof of Theorem 13 Let us define rn,n′ := (nhpn,n′ )1/2 , u := rn,n′ (β − β ∗ ) and ûn,n′ := rn,n′ (β̂n,n′ − β ∗ ), so that β̂n,n′ = β ∗ + ûn,n′ /rn,n′ . By Lemma 10, β̂n,n′ = arg min β∈R ûn,n′ = arg min ′ p u∈R " p′ Gn,n′ (β). We have therefore # 2 n′ n′  X u 1 u u −2 X ξi,n ψ(Z′i )T + ψ(Z′i )T + λn,n′ β ∗ + n′ i=1 rn,n′ n′ i=1 rn,n′ rn,n′ 1 = arg min ′ Fn,n′ (u), p u∈R ′ where, for every u ∈ Rp , ′ ′ n n  2 1 X u −2rn,n′ X ′ T 2 ′ T ′ ξ ψ(Z ) u + r ψ(Z ) u + λ β∗ + Fn,n′ (u) := ′ i,n n,n n,n i i ′ ′ n n i=1 rn,n′ i=1 − β∗ 1  . 1 Note that, by Corollary 12, we have ′ ′ ′ ′ ′ p p n n n 2rn,n′ X 2 XX 2 XX D ′ ′ T rn,n′ ξi,n ψj (Zi )uj −→ ′ Wi ψj (Z′i )uj . ξi,n ψ(Zi ) u = ′ ′ n i=1 n i=1 j=1 n i=1 j=1 We also have, for any (fixed) u and when n is large enough, ′ ∗ β + 2 Therefore λn,n′ rn,n ′  u rn,n′ β∗ + 1 − β u rn,n′ ∗ 1 = p  X |ui | i=1 − β∗ 1 D 1  rn,n′ →ℓ 1{βi∗ =0} + Pp′ i=1 ui rn,n′ 1 sign(βi∗ ) {βi∗ 6=0}  .  |ui |1{βi∗ =0} + ui sign(βi∗ )1{βi∗ 6=0} . We have shown that Fn,n′ (u) −→ F∞,n′ (u). Those functions are convex, hence the conclusion follows from the convexity argument.  C.3 Proof of Proposition 14 The proof closely follows Proposition 1 in Zou [19]. It starts by noting that   IP (S n = S) ≤ IP β̂j = 0, ∀j 6∈ S . 44 Because of the weak limit of β̂ (Theorem 13 and the notations therein), this implies    lim sup IP β̂j = 0, ∀j 6∈ S ≤ IP u∗j = 0, ∀j 6∈ S . n If ℓ = 0, then u∗ is asymptotically normal, and the latter probability is zero. Otherwise ℓ 6= 0, and ~ ψ := 2 Pn′ Wi ψ(Z′ )/n′ . The KKT conditions applied to F∞,n′ provide define W i i=1 ′ n 2 X ~ ψ(Z′i )ψ(Z′i )T u∗ + ℓv∗ = 0, Wψ + ′ n i=1 for some vector v∗ ∈ Rp whose components vj∗ are less than one in absolute value when j 6∈ S, and vj∗ = sign(βj∗ ) when j ∈ S. If u∗j = 0 for all j 6∈ S, we deduce " ′ n 2 X ~ ψ(Z′i )ψ(Z′i )T (Wψ )S + ′ n i=1 " # S ,S ∗ u∗S + ℓ sign(βS ) = 0, and ′ n 2 X ~ c (Wψ )S + ′ ψ(Z′i )ψ(Z′i )T n i=1 # S c ,S (16) u∗S ≤ ℓ, (17) componentwise and with obvious notations. Combining the two latter equations provides ~ ψ) c − (W S " n′ X i=1 ψ(Z′i )ψ(Z′i )T # c S ,S " n′ X ψ(Z′i )ψ(Z′i )T #−1 S ,S i=1  ~ ψ ) + ℓ sign(β ∗ ) W S S  ≤ ℓ, (18) componentwise. Since the latter event is of probability strictly lower than one, this is still the case  for the event u∗j = 0, ∀j 6∈ S .  C.4 Proof of Theorem 15 The beginning of the proof is similar to the proof of Theorem 13. With obvious notations, ǔn,n′ = arg min u∈R ′ p′ F̌n,n′ (u), where for every u ∈ Rp ,   p′ n′ n′ X 2 1 −2rn,n′ X 1 X ui ′ T ∗ ∗ 2 ′ T F̌n,n′ (u) := ξi,n ψ(Zi ) u+ ′ |βi + | − |βi | . ψ(Zi ) u + µn,n′ rn,n′ δ ′ n′ n r | β̃ | n,n i i=1 i=1 i=1 45 If βi∗ 6= 0, then 2 µn,n′ rn,n ′ |β̃i |δ   ui ℓ µn,n′ rn,n′ ∗ ∗ |βi + ui sign(βi∗ ) = ∗ δ ui sign(βi∗ ) + oP (1). | − |βi | = δ rn,n′ |βi | |β̃i | If βi∗ = 0, then 2 µn,n′ rn,n ′ |β̃i |δ   µn,n′ rn,n′ νnδ ui ∗ ∗ | − |β | = |βi + |ui |. i rn,n′ |νn β̃i |δ By assumption νn β̃i = Op (1), and the latter term tends to the infinity in probability iff ui 6= 0. As a consequence, if there exists some i 6∈ S s.t. ui 6= 0, then F̌n,n′ (u) tends to the infinity. Otherwise, ui = 0 when i 6∈ S and F̌n,n′ (u) → F̌∞,n′ (uS ). Since F̌∞,n′ is convex, we deduce (Kato [10]) that ǔS → u∗S , and ǔS c → 0S c , proving the asymptotic normality of β̌n,n′ ,S . Now, let us prove the oracle property. If j ∈ S, then β̌j tends to βj in probability and IP(j ∈ S n ) → 1. It suffices to show that IP(j ∈ S n ) → 0 when j 6∈ S. If j 6∈ S and j ∈ S n , the KKT conditions on F̌n,n′ provide ′ ′ n n 2 X µn,n′ rn,n′ νnδ −2rn,n′ X ′ ′ ′ T ′ ξ ψ(Z ) + ψ(Z ) ψ(Z ) = − ǔ sign(ǔj )· i,n n,n i j i j i ′ δ n′ n |ν β̃ | n j i=1 i=1 Due to the asymptotic normality of β̌ (that implies the one of ǔn,n′ ), the left hand side of the previous equation is asymptotically normal, when ℓ = 0. On the other side, the r.h.s. tends to the infinity in probability because νn β̃j = OP (1). Therefore, the probability of the latter event tends to zero when n → ∞.  D D.1 Proofs in the double asymptotic framework Proof of Theorem 16 By Lemma 10, we have β̂n,n′ = arg min β∈R p′ Gn,n′ (β), where ′ ′ n n 2 2 X 1 X Gn,n′ (β) := ′ ξi,n ψ(Z′i )T (β ∗ − β) + ′ ψ(Z′i )T (β ∗ − β) + λn,n′ |β|1. n i=1 n i=1 46 Define also G∞,n′ (β) := Pn′ 2 ψ(Z′i )T (β ∗ − β) /n′ + λ0 |β|1. We have i=1 ′ n 2 X ′ ′ Gn,n (β) − G∞,n (β) ≤ ′ ξi,n ψ(Z′i )T (β ∗ − β) + |λn,n′ − λ0 | · |β|1. n i=1 By assumption, the second term on the r.h.s. converges to 0. We now show that the first term on the r.h.s. is negligible. Indeed, for every ǫ > 0, ! n′ 1 X IP ξi,n ψ(Z′i ) > ǫ ≤ IP n′ i=1  P ′ ≤ ni=1 IP |τ̂Z′i − τZ′i | > C2 ǫ , ! n′ kCΛ′ k X |τ̂Z′i − τZ′i | × kψ(Z′i ) > ǫ n′ i=1 where C2 is the constant (kCΛ′ k × kCψ k)−1 . Apply Proposition 3 with the t = t′ = 1, and get     2p IP |τ̂1,2|Z=z − τ1,2|Z=z | > ǫ ≤ 4 exp − Cst · nh , for some constant Cst > 0. Thus, every β. Since Pn′ i=1 Pn′ ′ ′ i=1 ξi,n ψ(Zi )/n = oIP (1), and Gn,n′ (β) = G∞,n′ (β) + oIP (1) for ψ(Z′i )ψ(Z′i )T /n′ tends towards a matrix Mψ,Z′ , deduce that G∞,n′ (β) tends to ′ G∞,∞ (β) when n′ → ∞. Therefore, for all β ∈ Rp , Gn,n′ (β) weakly tends to G∞,∞ (β). By the convexity argument, we deduce that arg minβ Gn,n′ (β) weakly converges to arg minβ G∞,∞ (β). Since the latter minimizer is non random, the same convergence is true in probability.  D.2 Proof of Theorem 17 We start as in the proof of Theorem 13. Define r̃n,n′ := (nn′ hpn,n′ )1/2 , u := r̃n,n′ (β − β ∗ ) and ′ ûn,n′ := r̃n,n′ (β̂n,n′ − β ∗ ), so that β̂n,n′ = β ∗ + ûn,n′ /r̃n,n′ . We define for every u ∈ Rp , ′ ′ n n  2 1 X u −2r̃n,n′ X ′ T 2 ′ T ξi,n ψ(Zi ) u + ′ ψ(Zi ) u + λn,n′ r̃n,n′ β ∗ + Fn,n′ (u) := ′ n n i=1 r̃n,n′ i=1 and we obtain ûn,n′ = arg min u∈R p′ Fn,n′ (u). 47 1 − β ∗ 1  , (19) Lemma 26. Under the same assumptions as in Theorem 17, T1 := (r̃n,n′ /n′ ) in law towards a Gaussian random vector N (0, V2 ). Pn′ ′ i=1 ξi,n ψ(Zi ) tends This lemma is proved in Section D.3. It yields the weak limit of the random vector T1 , and will help to control the first term in Equation (19), which is simply −2T1T u. ′ Using Assumption 2.8(iii) and for every u ∈ Rp , we get ′ Z n 2 2 1 X ′ T ψ(Zi ) u → ψ(z′)T u fZ′ ,∞ dz′ . ′ n i=1 z′ (20) Note that this is to be read as a convergence of a sequence of real numbers indexed by u, ′ because the design points Z′i are deterministic. We also have, for any u ∈ Rp and when n is large enough, ′ ∗ β + u r̃n,n′ 1 − β ∗ 1 = p  X |ui | r̃n,n′ i=1 1{βi∗ =0} + ui r̃n,n′ 1 sign(βi∗ ) {βi∗ 6=0}  . ′ Therefore, by Assumption 2.8(ii)(b), for every u ∈ Rp , 2 λn,n′ r̃n,n ′  β∗ + u r̃n,n′ − β∗ 1 1  → 0. (21) Combining Lemma 26 and Equations (19-21), and defining the function F∞,∞ by T F∞,∞ (u) := 2W̃ u + Z 2 ′ ψ(z′)T u fZ′ ,∞ (z′ )dz′, u ∈ Rp , where W̃ ∼ N (0, V2 ), we get that every finite-dimensional margin of Fn,n′ converges weakly to the corresponding margin of F∞,∞, defined by T F∞,∞ (u) := 2W̃ u + Z 2 ′ ψ(z′)T u fZ′ ,∞ (z′ )dz′, u ∈ Rp , 48 where W̃ ∼ N (0, V2 ). Now, applying the convexity lemma, we get D ûn,n′ −→ u∞,∞ , where u∞,∞ := arg min ′ F∞,∞ (u). p u∈R Since F∞,∞ (u) is a continuously differentiable convex function, we apply the first-order condition R ∇F∞,∞ (u) = 0, which yields 2W̃+2 ψ(z′)ψ(z′)T u∞,∞ fZ′ ,∞ (z′ )dz′ = 0. As a consequence u∞,∞ =  D  −V1−1 W̃ ∼ N (0, Ṽas ), using Assumption 2.8(iv). We finally obtain r̃n,n′ β̂n,n′ − β ∗ −→ N 0, Ṽas , as claimed.  D.3 Proof of Lemma 26 : convergence of T1 Using a Taylor expansion of order 1, we have n′ n′   r̃n,n′ X  r̃n,n′ X ′ ξi,n ψ(Zi ) = ′ Λ τ̂1,2|Z=Z′i − Λ τ1,2|Z=Z′i ψ(Z′i ) = T2 + T3 , T1 := ′ n i=1 n i=1 where the main term is ′ n   r̃n,n′ X ′ Λ τ1,2|Z=Z′i τ̂1,2|Z=Z′i − τ1,2|Z=Z′i ψ(Z′i ), T2 := ′ n i=1 and the remainder is ′ n 2 r̃n,n′ X T3 := ′ α3,i τ̂1,2|Z=Z′i − τ1,2|Z=Z′i ψ(Z′i ), n i=1 (22) with ∀i = 1, . . . , n′ , |α3,i | ≤ CΛ′′ /2, by Assumption 2.8(v). Using the definition (5) of τ̂1,2|Z=z , the definition (4) of the weights wi,n (z) and the notation  ψ(z) := Λ′ τ1,2|Z=z ψ(z), rewrite T2 =: T4 + T5 , where ′ n n n r̃n,n′ X X X Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) T4 := ′ 2 n n i=1 j =1 j =1 fZ2 (Z′i ) 1 2   ∗  ∗ ′ × g (Xj1 , Xj2 ) − IE g (Xj1 , Xj2 )|Zj1 = Zj2 = Zi ψ(Z′i ) 49 (23)   n n n′ r̃n,n′ X X X 1 1 ′ ′ T5 := ′ 2 Kh (Zi − Zj1 )Kh (Zi − Zj2 ) − ˆZ (Z′ )2 fZ (Z′i )2 n n i=1 j =1 j =1 f i 2 1    ∗ ∗ ′ × g (Xj1 , Xj2 ) − IE g (Xj1 , Xj2 )|Zj1 = Zj2 = Zi ψ(Z′i ). (24) The random variable T4 can be seen (see Equation (23)) as a sum of (indexed by i) U-statistics of order 2. Through its Hájek projection, we decompose it into a main term T4,1 , a remainder term T4,2 and the bias T4,3 : T4 = T4,1 + T4,2 + T4,3 , where T4,1 T4,2 T4,3 !  n n′  r̃n,n′ X X Kh (Z′i − Z1 )Kh (Z′i − Z2 ) ∗ := ′ g (X1 , X2 ) ψ(Z′i ), gn,i Xj , Zj − IE n n i=1 j=1 fZ2 (Z′i )  n  n n′  Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) r̃n,n′ X X X ∗ g (Xj1 , Xj2 ) := ′ 2 − gn,i Xj1 , Zj1 ψ(Z′i ), n n i=1 j =1 j =1 fZ2 (Z′i ) 2 1 ! ′   n  ∗  r̃n,n′ X Kh (Z′i − Z1 )Kh (Z′i − Z2 ) ∗ := ′ IE g (X1 , X2 ) − IE g (X1 , X2 )|Z1 = Z2 = Z′i ψ(Z′i ), ′ 2 (Z ) n i=1 fZ i     and gn,i x, z := IE g ∗ (X, x)Kh (Z′i − Z)Kh (Z′i − z) / fZ2 (Z′i ). We easily check that gn,i x, z =:   gn,i,1 x, z + gn,i,2 x, z , where Kh (Z′i − z) fX,Z (x1 , Z′i )dx1 , and fZ2 (Z′i ) Z   K(t)Kh (Z′i − z)  ′ ′ x, z = g ∗(x1 , x) f (x , Z + ht) − f (x , Z ) dx1 dt. X,Z 1 X,Z 1 i i fZ2 (Z′i )  gn,i,1 x, z = gn,i,2 Z g ∗(x1 , x) (25) (26) Note that   h h i  i Kh (Z′i − Z1 )Kh (Z′i − Z2 ) ∗ g (X , X ) = IE g X , Z = IE g X , Z + g X , Z , IE 1 2 n,i j j n,i,1 j j n,i,2 j j fZ2 (Z′i ) implying T4,1 = T4,1,1 + T4,1,2 , by setting T4,1,k  n′ n  h  i r̃n,n′ X X gn,i,k Xj , Zj − IE gn,i,k Xj , Zj := ′ ψ(Z′i ), k = 1, 2. n n i=1 j=1 (27) Now, we decompose the term T5 , as defined in Equation (24). For every i = 1, . . . , n′ , a usual 50 Taylor expansion yields 1 1 − 2 ′ = 2 ′ { 2 ′ ˆ fZ (Zi ) fZ (Zi ) fZ (Zi ) 1 fˆZ (Z′i ) − fZ (Z′i ) + T7,i , !2 − 1} = −2 fZ3 (Z′i ) fˆZ (Z′i ) − fZ (Z′i ) 1+ fZ (Z′i ) 1 where T7,i 3 = 2 ′ (1 + α7,i )−4 fZ (Zi ) fˆZ (Z′i ) − fZ (Z′i ) fZ (Z′i ) !2 , for some |α7,i | ≤ fˆZ (Z′i ) − fZ (Z′i ) . fZ (Z′i ) (28) Therefore, we get the decomposition T5 = −2 T6 + T7 , where ′ n n n r̃n,n′ X X X fˆZ (Z′i ) − fZ (Z′i ) T6 := ′ 2 Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) · , n n i=1 j =1 j =1 fZ3 (Z′i ) 1 2   ∗  ∗ ′ · g (Xj1 , Xj2 ) − IE g (Xj1 , Xj2 )|Zj1 = Zj2 = Zi ψ(Z′i ) (29) ′ n n n r̃n,n′ X X X T7 := ′ 2 Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) · T7,i n n i=1 j =1 j =1 1 2    · g ∗(Xj1 , Xj2 ) − IE g ∗ (Xj1 , Xj2 )|Zj1 = Zj2 = Z′i ψ(Z′i ). (30) Summing up all the previous equations, we get T1 = T4,1,1 + T4,1,2 + T4,2 + T4,3 − 2 · T6 + T7 + T3 , (31) Lemma 27. Under the assumptions 2.3, 2.4, 2.7, 2.8(i), 2.8 and (iii), if n′ nhpn,n′ → ∞, if fZ and D fX,Z (x, ·) are continuous on Z for every x, then T4,1,1 −→ N (0, V2 ). Afterwards, we will prove that all the remainders terms T4,1,2 , T4,2 , T4,3 , T6 , T7 and T3 are negligible, i.e. tends to zero in probability. These results are respectively proved in Subsections D.4, D.5, D.6, D.7, D.8, D.9 and D.10. Combining all these elements with Equation (31) yields D T1 −→ N (0, V2 ), as claimed.  51 D.4 Proof of Lemma 27 Let us prove the convergence of T4,1,1 to a non-degenerate Gaussian limit. Using the notation ′ n Z Kh (Z′i − Zj ) r̃n,n′ X g ∗ (x1 , Xj ) fX|Z (x1 |Z = Z′i )dx1 ψ(Z′i ), ωn (Xj , Zj ) := ′ n i=1 fZ (Z′i ) and combining Equations (27) and (25), we have T4,1,1 = n   1 X ωn (Xj , Zj ) − IE ωn (Xj , Zj ) . n j=1 For a fixed j ∈ {1, . . . , n}, we have   n′ Z r̃n,n′ X Kh (Z′i − Zj ) ′ ∗ ′ IE[ωn (Xj , Zj )] = IE g (x1 , Xj ) fX|Z (x1 |Z = Zi )dx1 ψ(Zi ) n′ i=1 fZ (Z′i ) Z n′ r̃n,n′ X Kh (Z′i − z2 ) ′ ∗ = fX|Z (x1 |Z = Z′i )fX,Z (x2 , z2 )dx1 dx2 dz2 ψ(Z ) g (x , x ) 1 2 i ′ ′ n i=1 fZ (Zi ) Z n′ K(t) r̃n,n′ X ′ ψ(Zi ) g ∗ (x1 , x2 ) fX|Z (x1 |Z = Z′i )fX,Z (x2 , Z′i − ht) dx1 dx2 dt = ′ n i=1 fZ (Z′i ) Z n′ r̃n,n′ X ′ ∼ ψ(Zi ) g ∗ (x1 , x2 )fX|Z (x1 |Z = Z′i )fX|Z (x2 |Z = Z′i ) dx1 dx2 , n′ i=1 using the continuity of fX,Z (·, ·) w.r.t. its second argument, which is guaranteed by Assumption 2.5. By simple calculations, we obtain n 1 1 X V ar[ωn (Xj , Zj )] = V ar[ωn (Xj , Zj )] V ar[T4,1,1 ] = 2 n j=1 n "  n′ Z Kh (Z′i1 − Zj ) 1 r̃n,n′ X ′ ∗ ′ ∼ IE g (x1 , Xj ) fX|Z (x1 |Z = Zi1 )dx1 ψ(Zi1 ) n n′ i =1 fZ (Z′i1 ) 1  T # n′ Z ′ K (Z − Z ) r̃n,n′ X h j i2 · g ∗ (x2 , Xj ) fX|Z (x2 |Z = Z′i2 )dx2 ψ(Z′i2 ) n′ i =1 fZ (Z′i2 ) 2 52 ′ ′   Z Z n n 2 r̃n,n Z′i2 − Z′i1 ′ X X h−p ∼ K(t)K t + dt × g ∗ (x1 , x3 )g ∗ (x2 , x3 ) nn′2 i =1 i =1 fZ (Z′i2 ) h 2 1 · fX|Z (x1 |Z = Z′i1 )fX|Z (x2 |Z = Z′i2 )fX|Z (x3 |Z = Z′i1 ) dx1dx2 dx3 ψ(Z′i1 )ψ(Z′i2 )T . Under the condition that i1 6= i2 =⇒ |Z′i2 − Z′i1 | > 2h, that is Assumption 2.8(i), all the extradiagonal terms of the latter sum are zero. Using Assumption 2.8(iii), we get R 2 Z n′ 2 X r̃n,n ′ K V ar[T4,1,1 ] ∼ g ∗ (x1 , x3 )g ∗(x2 , x3 )ψ(Z′i1 )ψ(Z′i1 )T ′2 p nn h i =1 fZ (Z′i1 ) 1 ∼ Z K 2 Z × fX|Z (x1 |Z = Z′i1 )fX|Z (x2 |Z = Z′i1 )fX|Z (x3 |Z = Z′i1 ) dx1 dx2 dx3 g ∗ (x1 , x3 )g ∗(x2 , x3 )ψ(z′ )ψ(z′ )T × fX|Z (x1 |Z = z′ )fX|Z (x2 |Z = z′ )fX|Z (x3 |Z = z′ ) fZ′ ,∞ (z′ ) dx1 dx2 dx3 dz′. ′ fZ (z ) Since the terms ωn (Xj , Zj ) are independent (given the sample (Z′i )i≥1 ), it only remains to check Lyapunov’s third’s moment condition and the proof is finished by applying the usual Central Limit Theorem. The analysis of the third moment of T4,1,1 is similar to the study of the previous variance: for any j = 1, . . . , n, h IE ωn (Xj , Zj )⊗3 ≤ 3 r̃n,n ′ ′3 n × ∞ n′ X n′ X n′ X i1 =1 i2 =1 i3 =1 Z i " = IE  r̃ ′ n,n′ n′ n Z X i=1 ⊗3 Kh (Z′i − Zj ) ′ ′ ψ(Z ) g ∗(x1 , Xj ) f (x |Z = Z )dx X|Z 1 1 i i fZ (Z′i ) ψ(Z′i1 ) ⊗ ψ(Z′i2 ) ⊗ ψ(Z′i3 ) ∞ Kh (Z′i1 − z4 )Kh (Z′i2 − z4 )Kh (Z′i3 − z4 ) g (x1 , x4 )g (x2 , x4 )g (x3 , x4 ) fZ (Z′i1 )fZ (Z′i2 )fZ (Z′i3 ) ∗ ∗ ∗ × fX|Z (x1 |Z = Z′i1 )fX|Z (x2 |Z = Z′i2 )fX|Z (x3 |Z = Z′i3 )fX,Z (x4 , z4) dx1 dx2 dx3 dx4 dz4 . 53 ∞ # Through the change of variable z4 = Z′i1 − ht, we get ′ ′ ′ n X n X n 3 X r̃n,n ′ ψ(Z′i1 ) ⊗ ψ(Z′i2 ) ⊗ ψ(Z′i3 ) ≤ ∞ n′3 h2p i =1 i =1 i =1 ∞ 1 2 3  ′    Zi2 − Z′i1 Z′i3 − Z′i1 Z K(t)K +t K +t h h ∗ ∗ ∗ × g (x1 , x4 )g (x2 , x4 )g (x3 , x4 ) fZ (Z′i1 )fZ (Z′i2 )fZ (Z′i3 ) h IE ωn (Xj , Zj )⊗3 i × fX|Z (x1 |Z = Z′i1 )fX|Z (x2 |Z = Z′i2 )fX|Z (x3 |Z = Z′i3 )fX,Z (x4 , Z′i1 − ht) dx1 dx2 dx3 dx4 dt. Due to Assumption 2.8(i), only the terms for which i1 = i2 = i3 are nonzero, this yields ′ h IE ωn (Xj , Zj )⊗3 ∞ i Z n 3 r̃n,n ′ X ′ ′ ′ ≤ ′3 2p kψ(Zi ) ⊗ ψ(Zi ) ⊗ ψ(Zi )k∞ g ∗ (x1 , x4 )g ∗ (x2 , x4 )g ∗ (x3 , x4 ) n h i=1 K(t)3 f (x1 |Z = Z′i )fX|Z (x2 |Z = Z′i )fX|Z (x3 |Z = Z′i )fX,Z (x4 , Z′i − ht) dx1 dx2 dx3 dx4 dt ′ 3 X|Z fZ (Zi ) Z n′ 3 X r̃n,n ′ fZ,max 2 ′ ′ ′ kψ(Zi ) ⊗ ψ(Zi ) ⊗ ψ(Zi )k∞ |K| , ≤ ′3 2p CK ′ 3 n h f (Z ) Z i i=1 × since g ∗ is bounded by one, by integrating w.r.t. the xk variables, k = 1, . . . , 4. Since ψ is bounded and fZ (Z′i ) > fZ,min for every i, we obtain   3 n   r̃n,n′ 1 X  ⊗3 ′ p −1/2 IE kω (X , Z ) k = O (nn h ) = o(1), = O n j j ∞ n3 j=1 n2 n′2 h2p applying Assumption 2.8(ii)(a). Therefore, we have checked Lyapunov’s condition and the result follows. D.5  Convergence of T4,1,2 to 0 Applying the Taylor-Lagrange formula to the function φx1 ,u,i (t) := fX,Z (x1 , Z′i + thu), t ∈ [0, 1], x1 ∈ R2 , u ∈ Rp , i ≥ 1, 54 we get from Equation (26) that  K(u)Kh (Z′i − z)  ′ ′ fX,Z (x1 , Zi + hu) − fX,Z (x1 , Zi ) dx1 du gn,i,2(x, z) = g (x1 , x) fZ2 (Z′i ) Z   Kh (Z′i − z) ∗ g (x1 , x)K(u) φx1 ,u,i (1) − φx1 ,u,i (0) dx1 du = fZ2 (Z′i ) X  Z α−1 Kh (Z′i − z) 1 (k) 1 (α) ∗ = g (x1 , x)K(u) φ (0) + φx1 ,u,i (tx1 ,u,i ) dx1 du. fZ2 (Z′i ) k! x1 ,u,i α! Z ∗ k=1 R (i) By Assumption 2.1, for every i = 1, . . . , α − 1, Rp K(u)φx1 ,u,i (0)du = 0. Therefore,   Z Kh (Z′i − z) 1 (α) ∗ gn,i,2 (x, z) = g (x1 , x)K(u) φ (tx ,u,i ) dx1 du fZ2 (Z′i ) α! x1 ,u,i 1  X Z p  hα Kh (Z′i − z) ∂ α fX,Z  ∗ = g (x1 , x)K(u) u i1 . . . u iα x1 , z + tx1 ,u,i hu dx1 du. α!fZ2 (Z′i ) ∂zi1 . . . ∂ziα i ,...,i =1 1 α In other words, gn,i,2(x, z) = hα Kh (Z′i − z)χ(x, z)/{α!fZ2 (Z′i )}, for some measurable χ that is upper bounded when z ∈ Z and x ∈ R2 . By the same calculations as in D.4, we easily show that V ar(T4,1,2 ) = O(h2α ). Therefore, T4,1,2 = oIP (1).  D.6 Convergence of T4,2 to 0 Let us remind the definition of T4,2 . ′ T4,2 n n n r̃n,n′ X X X  ∗ g (Xj1 , Xj2 )Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) := 2 ′ n n i=1 j =1 j =1 1 2 Z  ψ(Z′ ) − g ∗ (x1 , Xj1 )Kh (Z′i − Zj1 )Kh (Z′i − z1 )fX,Z (x1 , z1 )dx1 dz1 2 i′ . fZ (Zi ) ′ n r̃n,n′ X := 2 ′ n n i=1 j n X 1 ,j2 =1,j1 6=j2 ′ n n r̃n,n′ X X {Wi,j1 ,j2 − IE[Wi,1,2 |Zj1 ]} + 2 ′ {Wi,j,j − IE[Wi,1,2 |Zj1 ]} n n i=1 j=1 := T4,2,1 + T4,2,2 , with obvious notations. The second term on the r.h.s. corresponds to the diagonal of the double √ sum and T4,2,2 = OP ( n′ (nhp )−1 ) = oP (1) under our assumptions. It remains to prove that T4,2,1 = oP (1). Since it is centered, it is sufficient to show that its variance tend to zero when 55 n → ∞. ′ ′ n X n 2 X r̃n,n ′ V ar(T4,2,2 ) = 2 ′ 2 (n n ) i =1 i =1 j 1 2 n X n X 1 ,j2 =1,j1 6=j2 j3 ,j4 =1,j3 6=j4 {Wi1 ,j1 ,j2 − IE[Wi1 ,1,2 |Zj1 ]} {Wi2 ,j3 ,j4 − IE[Wi2 ,1,2 |Zj1 ]} . It is easy to see that the latter expectations are zero when all indices j1 , j2 , j3 and j4 are different. Even more, it is necessary that j1 ∈ {j3 , j4 } or j2 ∈ {j3 , j4 }. For instance, assume j1 = j3 . If, moreover, j4 6∈ {j1 , j2 }, then     IE Wi1 ,j1 ,j2 − IE[Wi1 ,j1 ,j2 |Zj1 ] × Wi2 ,j1 ,j4 − IE[Wi2 ,j1 ,j4 |Zj1 ]     = IE IE[ Wi1 ,j1 ,j2 − IE[Wi1 ,j1 ,j2 |Zj1 ] |Zj1 , Zj4 ] × Wi2 ,j1 ,j4 − IE[Wi2 ,j1 ,j4 |Zj1 ] = 0. Therefore, it is necessary to impose a second identity among the four indices jk , k = 1, . . . , 4. For instance, assume j = j3 =: j and j2 = j4 =: j ′ . Then, the corresponding expectations are given by four terms of the type ψ(Z′ )ψ(Z′ ) IE[Wi1 ,j,j ′ Wi2 ,j,j ′ ] = 2 i′ 1 2 i′2 fZ (Zi1 )fZ (Zi2 ) Z g ∗ (xj , xj ′ )2 Kh (Z′i1 − Z′j )Kh (Z′i1 − zj ′ )Kh (Z′i2 − Z′j ) × Kh (Z′i2 − zj ′ )fX,Z (xj , zj )fX,Z (xj ′ , zj ′ )dxj dzj dxj ′ dzj ′ Z ψ(Z′i1 )ψ(Z′i2 ) (Z′i2 − Z′i1 ) (Z′i2 − Z′i1 ) 2 ∗ ′ ′ = )K ( ) K(t )K(t g (x , x + t )K ( + tj ′ ) h j j j j j h fZ2 (Z′i1 )fZ2 (Z′i2 ) h h × fX,Z (xj , Z′i1 − htj )fX,Z (xj ′ , Z′i1 − htj ′ ) dxj dtj dxj ′ dtj ′ /h2p , that is nonzero only when Z′i1 = Z′i2 . The other terms can be dealt similarly. Therefore, the number of nonzero terms on the r.h.s. of the latter equation is less than n′ n2 . We deduce V ar(T4,2,1 ) = O  2 r̃n,n ′ 2p 2 h n n′  =O  1 nhp  Therefore, by Assumption 2.8(ii)(a), T4,2,1 converges to 0 in L2 (IP) and then T4,2 tends to zero in probability, as claimed.  56 D.7 Convergence of T4,3 to 0 Let us remind the definition of T4,3 . T4,3 !   n′  ∗  Kh (Z′i − Z1 )Kh (Z′i − Z2 ) ∗ r̃n,n′ X IE g (X1 , X2 ) − IE g (X1 , X2 )|Z1 = Z2 = Z′i ψ(Z′i ) := ′ n i=1 fZ2 (Z′i ) Z n′ Kh (Z′i − z1 )Kh (Z′i − z2 ) ∗ r̃n,n′ X ′ g (x1 , x2 )fX,Z (x1 , z1 )fX,Z (x2 , z2 ) dx1 dx2 dz1 dz2 ψ(Zi ) = ′ n i=1 fZ2 (Z′i )  Z ∗ ′ ′ − g (x1 , x2 )fX|Z (x1 |Z = Zi )fX|Z (x2 |Z = Zi )dx1 dx2 ′  Z n r̃n,n′ X fX,Z (x1 , Z′i + ht1 )fX,Z (x2 , Z′i + ht2 ) ′ = ′ ψ(Zi ) K(t1 )K(t2 ) n i=1 fZ2 (Z′i )  ′ ′ − fX|Z (x1 |Z = Zi )fX|Z (x2 |Z = Zi ) g ∗(x1 , x2 ) dx1 dx2 dt1 dt2. Apply an α-order Taylor expansion to the function (t1 , t2) 7→ fX,Z (x1 , Z′i + ht1 )fX,Z (x2 , Z′i + ht2 ). Since we work with α-order kernels, it is easy to see that T4,3 = OIP (h2α r̃n,n′ ) = oIP (1), under Assumpion 2.8(ii)(a).  D.8 Convergence of T6 to 0 Replacing fˆZ in the definition of T6 above by the normalized sum of the kernels, we get n′ n n n′ n n  r̃n,n′ X X X Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) ˆZ (Z′ )] − fZ (Z′ ) IE[ f T6 = ′ 2 i i n n i=1 j =1 j =1 fZ3 (Z′i ) 1 2    × g ∗ (Xj1 , Xj2 ) − IE g ∗ (X1 , X2 )|Z1 = Z2 = Z′i ψ(Z′i ) n  r̃n,n′ X X X X Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) ′ ˆZ (Z′ )] K (Z − Z ) − IE[ f + ′ 3 h j 3 i i n n i=1 j =1 j =1 j =1 fZ3 (Z′i ) 1 2 3    × g ∗ (Xj1 , Xj2 ) − IE g ∗ (X1 , X2 )|Z1 = Z2 = Z′i ψ(Z′i ) =: T6,1 + T6,2 . The first term T6,1 is a bias term. By Assumption 2.1, sup i=1,...,n′ IE[fˆZ (Z′i )] − fZ (Z′i ) = O(hα ). 57 The sum of the diagonal terms in T6,1 is ′ n n  α    r̃n,n′ X X Kh2 (Z′i − Zj ) ˆZ (Z′ )]−fZ (Z′ ) IE g ∗ (X1 , X2)|Z1 = Z2 = Z′ ψ(Z′ ) = OIP r̃n,n′ h . − ′ 2 IE[ f i i i i n n i=1 j=1 fZ3 (Z′i ) nhp The sum of the extra-diagonal terms in T6,1 is a centered r.v. ′ T 6,1 n  r̃n,n′ X X Kh (Z′i − Zj1 )Kh (Z′i − Zj2 ) IE[fˆZ (Z′i )] − fZ (Z′i ) := ′ 2 3 ′ n n i=1 1≤j 6=j ≤n fZ (Zi ) 1 2    ∗ ∗ ′ × g (Xj1 , Xj2 ) − IE g (X1 , X2 )|Z1 = Z2 = Zi ψ(Z′i ).   Note that z 7→ fZ (z) and z 7→ IE g ∗ (X1 , X2 )|Z1 = z1 , Z2 = z2 is α-times continuously differen- tiable on Z, because of 2.1 and 2.5. By α-order Taylor expansions of such terms, they yield some 2 2α factors hα . It is easy to check that the variance of T 6,1 is of order r̃n,n /(n2 h2p ). Therefore, ′h T6,1 = OIP  r̃ α n,n′ h nhp = OIP  (n′ )1/2 hα  √ = oIP (1). nhp Concerning T6,2 , we can assume that the indices j1 , j2 and j3 are pairwise distinct. Indeed, the cases of one or two identities among such indices can be easily dealt. They yield an upper bound that is OIP (r̃n,n′ hα /(nhp )) as above, and they are negligible. Once we remove such terms from the triple sum defining T6,2 , we get the centered r.v. T 6,2 . Let us calculate the second moment of T 6,2 . ′ ′ n n  2  nn′ hp X X IE T 6,2 := ′2 6 n n i =1 i =1 " Kh (Z′i1 − Zj1 )Kh (Z′i1 − Zj2 ) fZ3 (Z′i1 ) 1≤j1 6=j2 6=j3 ≤n 1≤j4 6=j5 6=j6 ≤n 1 2    × Kh (Z′i1 − Zj3 ) − IE[fˆZ (Z′i1 )] g ∗ (Xj1 , Xj2 ) − IE g ∗ (X1 , X2 )|Z1 = Z2 = Z′i1 ψ(Z′i1 ) X X IE  Kh (Z′i2 − Zj4 )Kh (Z′i2 − Zj5 ) ′ ˆZ (Z′ )] K (Z − Z ) − IE[ f × h j i 6 i 2 2 fZ3 (Z′i2 ) #     × g ∗(Xj4 , Xj5 ) − IE g ∗ (X1 , X2)|Z1 = Z2 = Z′i2 ψ(Z′i2 )T ′ n X nn′ hp X =: ′2 6 n n i ,i =1 1≤j 6=j 6=j 1 2 1 2 3 ≤n X Ei1 ,i2 ,j1 −j6 . 1≤j4 6=j5 6=j6 ≤n When all the indices of the latter sums are different, the latter expectation is zero. Non zero terms 58 above are obtained only when j3 and j6 are equal to some other indices. In the case j3 = j6 and no other identity among the indices, obtain two extra factors hα through α-order limited expansions   of z 7→ IE g ∗ (X1 , X2 )|Z1 = z1 , Z2 = z2 . This yields an order O(nn′ hp+2α /(nhp )). When j3 and j6 are equal to other indices (j3 = j3 and j6 = j2 , e.g.), we lose hp but we still benefit from the two latter factors hα . This yields an upper bound O(nn′ hp+2α /(n2 h2p ) = o(1). The other situations can be managed similarly. We get  nn′ hp+2α   2  = o(1). IE T 6,2 = O nhp Globally, we obtain T6 → 0 in probability under Assumptions 2.8(ii)(a).  D.9 Convergence of T7 to 0 Since supi=1,...,n′ |fˆZ (Z′i ) − fZ (Z′i )| = oIP (1), note that 6 sup |T7,i | ≤ sup |fˆZ (Z′i ) − fZ (Z′i )|2 , 4 fZ,min i=1,...,n′ i=1,...,n′ with a probability arbitrarily close to one. Apply Lemma 19 with a fixed t > 0 and z = Z′i for each i = 1, . . . , n′  IP sup |T7,i | ≥ i=1,...,n′ 3 4 fZ,min  2    nhp t2 CK,αhα ′ R +t ≥ 2n exp − . α! 2fZ,max K 2 + (2/3)CK t By setting t = hα , deduce supi=1,...,n′ |T7,i | = OP (h2α ) since nhp+2α / ln n′ → ∞. Then, n′ n n XXX r̃n,n′ |K|h (Z′i − Zj1 )|K|h (Z′i − Zj2 )|ψ(Z′i )|. |T7 | ≤ ′ 2 sup |T7,i | nn i i=1 j =1 j =1 1 2 The expectation of the double sum is O(1). Then, by Markov’s inequality, we deduce T7 =  OIP (r̃n,n′ supi |T7,i |) = OIP (n′ /(nhp ))1/2 . Therefore, TT = oIP (1).  59 D.10 Convergence of T3 to 0 For every ǫ > 0, by Markov’s inequality, ′ n 2  CΛ′′ r̃n,n′ X  ′ − τ1,2|Z=Z′ ψ(Z′i ). IE τ̂ IP(|T3 | > ǫ) ≤ 1,2|Z=Z i i 2n′ ǫ i=1 2   can be obtained following the steps of An approximated calculation of IE τ̂1,2|Z=Z′i − τ1,2|Z=Z′i the proof of Theorem 6. Indeed, it can be easily seen that the order of magnitude of the latter expectation is the same as the variance of Un,i (g ∗ ), and then of its Hájek projection Ûn,i (g). Since the latter variance is O((nhp )−1 ), we get IP(|T3 | > ǫ) ≤ B1 r̃n,n′ , nhp ǫ for some constant B1 . Since n′ /(nhp ) → 0, we get T3 = oIP (1), as claimed.  60
10math.ST
(IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 2, February 2011 Computer Modelling of 3D Geological Surface Kodge B. G. Hiremath P. S. Department of Computer Science, S. V. College, Udgir, District Latur, Maharashtra state, India [email protected] Department of Computer Science, Gulbarga University, Gulbarga Karnataka state, India [email protected] Abstract— The geological surveying presently uses methods and tools for the computer modeling of 3D-structures of the geographical subsurface and geotechnical characterization as well as the application of geoinformation systems for management and analysis of spatial data, and their cartographic presentation. The objectives of this paper are to present a 3D geological surface model of Latur district in Maharashtra state of India. This study is undertaken through the several processes which are discussed in this paper to generate and visualize the automated 3D geological surface model of a projected area. Keywords-component; 3D Visualization, Geographical Information System, Digital Terrain Data Processing, Cartography. II. STUDY AREA Latur District is in the south-eastern part of the Maharashtra state in India. It is well known for its Quality of Education, Administration, food grain trade and oil mills. Latur district has an ancient historical background. The King 'Amoghvarsha' of Rashtrakutas developed the Latur city, originally the native place of the Rashtrakutas. The Rashtrakutas who succeeded the Chalukyas of Badami in 753 A.D called themselves the residents of Lattalut. Latur is a major city and district in Maharashtra state of India. It is well known for its quality of education, administration, food grain trade and oil mills. The district is divided into three sub-divisions and 10 talukas (subdistricts) [1]. I. INTRODUCTION Traditional geological maps which illustrate the distribution and orientation of geological structures and materials on a twodimensional (2D) ground surface are no longer sufficient for the storing, displaying, and analysing of geological information. It is also difficult and expensive to update traditional maps that cover large areas. Many kinds of raster and vector based models for describing, modelling, and visualizing 3D spatial data have been developed. At the mean time, with the fast development of sensor techniques and computer methods, several types of airborne or close range laser scanners are available for acquisition of 3D surface data in real or very fast time. A few more type of digital photogrammetry workstations are also available for semiautomatic interpretation of the complicated man made 3D surfaces. However due to image noises and limited resolution of current laser range data, so many existing techniques still need to be extended to fit real application. This paper presents a fast and efficient method to automate the generation of 3D geological surfaces from 2D geological maps. The method was designed to meet the requirement in creating a three-dimensional (3D) geologic map model of Latur district in Maharashtra state of India. The LULC (Land Use and Land Cover) database [11] of National Remote Sensing Centre, ISRO, India, for Latur district has been used for visualization experiments. The elevation data pertaining to Latur district is obtained from USGS (United State Geological Survey) Seamless server database [10] of United States and is used for digital elevation modelling (DEM) experiments. Figure 1. A false color composite imagery of India acquired by SPOT & IKONOS, the location of Latur district (Courtesy NRSA Hyd.). (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 2, February 2011 Latur is located at 18°24′N 76°35′E / 18.4°N 76.58°E / 18.4; 76.58 as shown in Fig.1. It has an average elevation of 631 meters (2070 feet). It is situated 636 meter above mean sea level. The district is situated on Maharashtra-Karnataka boundary. On the eastern side of the Latur is Bidar district of Karnataka, whereas Nanded is on the Northeast, Parbhani district on the northern side, Beed on the Northwest and Osmanabad on the western and southern side. The entire district of Latur is situated on the Balaghat plateau, 540 to 638 meters from the mean sea level. B. Cropping DEMs using Latur district base map shape file. After integrating DEMs tiles, the next process is to extract (crop) the required region of Latur district from integrated DEMs using the latur district base map shape file. For this process, we use the software GLOBAL MAPPER 11v to crop the DEMs with only required region’s terrain data. The remaining area is considered as null data as shown in Fig.3. III. AUTOMATED 3D SURFACE MODEL 3D geological information systems provide a means to capture, model, manipulate, retrieve, analyse, and present geological situations. Traditional geological maps which illustrate the distribution and orientation of geological materials and structures on a 2D ground surfaces provide vast amounts of raw data. It is thus vital to develop a set of intelligent maps that shows features of geological formations and their relationships[2]. A. Digital Elevation Model of Latur district DEM is a representation of the terrain surface by coordinates and numerical descriptions of altitude. DEM is easy to store and manipulate, and it gives a smoother, more natural appearance of derived terrain features. Therefore, the created DEM is the foundation of 3D geological maps when the zcoordinates of the vertices of geological formations can be interpolated. The data consists of 4 topographical map sheets, with 3D coordinates of terrain, contour lines, and other information. The maps are in GEOTIFF format at a scale of 1:150000 (Fig.2). These DEMs were then integrated into a whole DEM of Latur using a DEM Global Mapper. The final gridded DEM data with 5-metre intervals for Latur district was obtained (Fig.2). The file size is about 4.83MB. Figure 3. Cropped DEM using Latur district base map. C. Accessing and concatenating DEMs in MATLAB After the successful cropping of all the DEM data sheets (tiles), we import them in MATLAB for further processes. The DEMs can be converted in to DTED (Digital Terrain Elevation Data) version 0,1,2.. any format, and import them in MATLAB. The DTED0 files have 120-by-120 points. DTED1 files have 1201-by-1201. The edges of adjacent tiles have redundant records. Acquiring all the data sheets with their specified location (projection) and sequence of data sheets are very important here. Concatenation of the DEM tiles with respect to their locations needs horizontal and vertical concatenation. 1) Horizontal Concatenation First, we concatenate the matrices of top-left and top-right tiles (Fig.2), i.e. Horizontal concatenation. H1= TL (horzcat) TR . Figure 2. Tiled DEM of Latur District (courtesy USGS). (1) where H1 is a concatenated matrix of top-left (TL) and topright (TR) matrices. (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 2, February 2011 Next, we concatenate the matrices of Bottom-Left and Bottom-Right tiles, i.e. again Horizontal concatenation. H2=BL (horzcat) BR (2) where H2 is a concatenated matrix of Bottom-left (BL) and Bottom-right (BR) matrices. The shading function sets the shading. If the shading is interpolates, C must be of the same size as X, Y, and Z; it specifies the colors at the vertices. The color within a surface patch is a bilinear function of the local coordinates. If the shading is faceted (the default) or flat, C(i,j) specifies the constant color in the surface patch: 2) Vertical Concatenation Next, we need to concatenate H1 and H2 matrices vertically, i.e. H = H1 (vertcat) H2 (i,j) (i,j+1) | C(i,j) | (i+1,j) - (i+1,j+1) (5) (3) where H is a complete concatenated matrix of H1 and H2. In this case, C can be the same size as X, Y, and Z and its last row and column are ignored. Alternatively, its row and column dimensions can be one less than those of X, Y, and Z. D. Visualizing 3D geographical surface model E. Assigning axes to 3D model A workflow was chosen, on the one hand, by applying GIS methods using ESRI shape files and global mapper software for data acquisition, maintenance, and presentation and on the other hand, by applying three-dimensional spatial modelling with a interactive 3D modelling in MATLAB. Based on NonUniform Rational data, any geometric shape can be modelled. Besides surfaces of the different engineering geological units, solids using boundary representation techniques were modelled [3]. In MATLAB it is one of the easiest way to visualize the well defined projected data sets in 3D view using mathematical functions surf() and mesh(). To visualize the acquired projected data set over a rectangular region, we need to create colored parametric surfaces specified by X, Y, and Z, with color specified by Z. A parametric surface is parameterized by two independent variables, i and j, which vary continuously over a rectangle; for example, 1<=i<=m and 1<=j<=n. The three functions x(i,j), y(i,j), and z(i,j) specify the surface. When i and j are integer values, they define a rectangular grid with integer grid points. The functions x(i,j), y(i,j), and z(i,j) become three m-by-n matrices, X, Y, and Z. Surface color is a fourth function, c(i,j), denoted by matrix C. Each point in the rectangular grid can be thought of as connected to its four nearest neighbours [6]. i-1,j | i,j-1 - i,j - i,j+1 | i+1,j (4) Surface color can be specified in two different ways: at the vertices or at the centers of each patch. In this general setting, the surface need not be a single-valued function of x and y. Moreover, the four-sided surface patches need not be planar. For example, one can have surfaces defined in polar, cylindrical, and spherical coordinate systems [8]. MATLAB automatically creates an axes, if one does not already exist, when you issue a command that creates a graph, but the default axes assigned by MATLAB doesn’t match with real coordinate systems of this projected area. This existing model is built with 3 axes data x, y and z respectively. The X and Y axis represents the latitude and longitude values for this model i.e. UPPER LEFT X=76.2076079218 UPPER LEFT Y=18.8385493143 LOWER RIGHT X=77.2934412815 LOWER RIGHT Y=17.8677159574 WEST LONGITUDE=76° 12' 27.3885" E NORTH LATITUDE=18° 50' 18.7775" N EAST LONGITUDE=77° 17' 36.3886" E SOUTH LATITUDE=17° 52' 3.7774" N The above shown values are associated with all four tiles of DTED files. The Z axis itself represents the terrain (height) values of ground surface objects. Here in this model the elevation data is assigned in feet scale format i.e. 0 to 3000 feets. IV. RESULTS With reference to the processes discussed above, the 3D visualization experimental results are shown in the Figs. 4, 5 and 6 for 3D model of Latur district geological surface. (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 2, February 2011 Figure 6. A true color composite scheme (Atlas shader) 3D model. Figure 4. A 70o camera view point of surface model with gray color scheme. V. CONCLUSIONS AND FUTURE WORK Some key processes for automated 3D geological surface modeling such as data acquisition, concatenation, 3D surface modeling and axes data managing have been presented. The visualization experiments are done using data for Latur district. In the future work, we attempt to overlay real time map layers on this 3D surface model. ACKNOWLEDGEMENT The authors are indebted to the National Remote Sensing Centre (NRSC), ISRO, India, for providing LULC digital data of Latur district, and to United States Geological Survey (USGS) for providing access to elevation data for Latur district. REFERENCES [1] [2] [3] Figure 5. A 45o camera view point of surface model with HSV color scheme. [4] [5] [6] Hiremath P.S., Kodge B.G., “Visualization and data ming techniques in latur district satellite imagery”, Journal of Advances in computational research, Vol 2, Issue 1, pp. 21-24, Jan. 2010. Zheng zong, et al, “Automated 3D geological surface modeling with CDT”, Technical aspects in SIM, FIG working week, pp. 1-9, 2007, Detlev Neumann, et al, “3D modeling of ground conditions for the engineering geology map of the city of Magdeburg”, IAEG, Geological society of London, pp. 1-7, 2006. Fabien Ramos, “A multi-level approach for 3D modeling in Geographical Information System”, Symposium on geospatial theory, processing and applications, Ottawa 2002. Xiaoyong chen, Shunji Murai, “Integration of Image Analysis and GIS for 3D city Modeling”, IAPRS, Vol. 32/4, ISPRS commission IV Symposium on GIS. Rafael Gonzalez, Richard Woods, Steven Eddins, “ Digital Image Processing using MATLAB”, LPE Pearson education , South Asia. (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 2, February 2011 [7] Peter A.Burrough and Rachael A. McDonell, “Principles of Geographical Information Systems”, Oxford University Press, New York 2000 [8] www.mathworks.com/access/helpdesk/help/helpdesk.html [9] www.globalmapper.com/helpv8/Help_Main.html [10] www.seamless.usgs.gov/Website/Seamless/viewer.htm [11] www.nrsc.gov.in/products/IRS_Satellite_data_order.htm AUTHORS PROFILE Kodge Bheemashankar G. is a research scholar in department of studies and research in Computer Science of Swami Vivekanand College, Udgir Dist. Latur (MH) INDIA. He obtained MCM (Master in Computer Management) in 2004, M. Phil. in Computer Science in 2007 and registered for Ph.D. in Computer Science in 2008. His research areas of interests are GIS and Remote Sensing, Digital Image processing, Data mining and data warehousing. He is published 23 research papers in national, international Journals and proceedings conferences. Tel. +919923229672. Dr. P.S. Hiremath is a Professor and Chairman, Department of P. G. Studies and Research in Computer Science, Gulbarga University, Gulbarga-585106 INDIA, He has obtained M.Sc. degree in 1973 and Ph.D. degree in 1978 in Applied Mathematics from Karnataka University, Dharwad. He had been in the Faculty of Mathematics and Computer Science of Various Institutions in India, namely, National Institute of Technology, Surathkal (1977-79), Coimbatore Institute of Technology, Coimbatore(1979-80), National Institute of Technology, Tiruchirapalli (1980-86), Karnatak University, Dharwad (1986-1993) and has been presently working as Professor of Computer Science in Gulbarga University, Gulbarga (1993 onwards). His research areas of interest are Computational Fluid Dynamics, Optimization Techniques, Image Processing and Pattern Recognition. He has published 142 research papers in peer reviewed International Journals and proceedings of conferences. Tel (off): +91 8472 263293, Fax: +91 8472 245927.
5cs.CE
Published as a conference paper at ICLR 2018 OF GRID - LIKE REPRESENTATIONS BY TRAINING RECURRENT NEURAL NETWORKS TO PERFORM SPATIAL LOCALIZATION arXiv:1803.07770v1 [q-bio.NC] 21 Mar 2018 E MERGENCE Christopher J. Cueva∗, Xue-Xin Wei∗ Columbia University New York, NY 10027, USA {ccueva,weixxpku}@gmail.com A BSTRACT Decades of research on the neural code underlying spatial navigation have revealed a diverse set of neural response properties. The Entorhinal Cortex (EC) of the mammalian brain contains a rich set of spatial correlates, including grid cells which encode space using tessellating patterns. However, the mechanisms and functional significance of these spatial representations remain largely mysterious. As a new way to understand these neural representations, we trained recurrent neural networks (RNNs) to perform navigation tasks in 2D arenas based on velocity inputs. Surprisingly, we find that grid-like spatial response patterns emerge in trained networks, along with units that exhibit other spatial correlates, including border cells and band-like cells. All these different functional types of neurons have been observed experimentally. The order of the emergence of grid-like and border cells is also consistent with observations from developmental studies. Together, our results suggest that grid cells, border cells and others as observed in EC may be a natural solution for representing space efficiently given the predominant recurrent connections in the neural circuits. 1 I NTRODUCTION Understanding the neural code in the brain has long been driven by studying feed-forward architectures, starting from Hubel and Wiesel’s famous proposal on the origin of orientation selectivity in primary visual cortex (Hubel & Wiesel, 1962). Inspired by the recent development in deep learning (Krizhevsky et al., 2012; LeCun et al., 2015; Hochreiter & Schmidhuber, 1997; Mnih et al., 2015), there has been a burst of interest in applying deep feedforward models, in particular convolutional neural networks (CNN) (LeCun et al., 1998), to study the sensory systems, which hierarchically extract useful features from sensory inputs (see e.g., Yamins et al. (2014); Kriegeskorte (2015); Kietzmann et al. (2017); Yamins & DiCarlo (2016)). For more cognitive tasks, neural systems often need to maintain certain internal representations of relevant variables in the absence of external stimuli- a process that requires more than feature extraction. We will focus on spatial navigation, which typically requires the brain to maintain a representation of self-location and update it according to the animal’s movements and landmarks of the environment. Physiological studies done in rodents and other mammals (including humans, non-human primates and bats) have revealed a variety of neural correlates of space in Hippocampus and Entorhinal Cortex (EC), including place cells (O’Keefe, 1976), grid cells (Fyhn et al., 2004; Hafting et al., 2005; Fyhn et al., 2008; Yartsev et al., 2011; Killian et al., 2012; Jacobs et al., 2013), along with border cells (Solstad et al., 2008), band-like cells (Krupic et al., 2012) and others (see Figure 1a). In particular, each grid cell only fires when the animal occupies a distinct set of physical locations, and strikingly these locations lie on a lattice. The study of the neural underpinning of spatial cognition has provided an important window into how high-level cognitive functions are supported in the brain (Moser et al., 2008; Aronov et al., 2017). ∗ equal contribution 1 Published as a conference paper at ICLR 2018 How might the spatial navigation task be solved using a network of neurons? Recurrent neural networks (RNNs) (Hochreiter & Schmidhuber, 1997; Graves et al., 2013; Oord et al., 2016; Theis & Bethge, 2015; Gregor et al., 2015; Sussillo et al., 2015) seem particularly useful for these tasks. Indeed, recurrent-based continuous attractor networks have been one popular type of models proposed for the formation of grid cells (McNaughton et al., 2006; Burak & Fiete, 2009; Couey et al., 2013) and place cells (Samsonovich & McNaughton, 1997). Such models have provided valuable insights into one set of possible mechanisms that could support the formation of the grids. However, these models typically rely on fine-tuned connectivity patterns, in particular the models need a subtle yet systematic asymmetry in the connectivity pattern to move the attractor state according to the animal’s own movement. The existence of such a specific 2D connectivity in rodent EC remains unclear. Additionally, previous models have mainly focused on grid cells, while other types of responses that co-exist in the Entorhinal Cortex have been largely ignored. It would be useful to have a unified model that can simultaneously explain different types of neural responses in EC. Motivated by these considerations, here we present an alternative modeling approach for understanding the representation of space in the neural system. Specifically, we trained a RNN to perform some spatial navigation tasks. By leveraging the recent development in RNN training and knowledge of the navigation system in the brain, we show that training a RNN with biologically relevant constraints naturally gives rise to a variety of spatial response profiles as observed in EC, including grid-like responses. To our knowledge, this is the first study to show that grid-like responses could emerge from training a RNN to perform navigation. Our result implies that the neural representation in EC may be seen as a natural way for the brain to solve the navigation task efficiently (Wei et al., 2015). More generally, it suggests that RNNs can be a powerful tool for understanding the neural mechanisms of certain high-level cognitive functions. firing rate a grid cell b band cell border cell irregular cell RNN c Input Output speed x-position direction speed Performance Output: target Output: RNN direction y-position Figure 1: a) Example neural data showing different kinds of neural correlates underlying spatial navigation in EC. All figures are replotted from previous publications. From left to right: a “grid cell” recorded when an animal navigates in a square environment, replotted from Krupic et al. (2012), with the heat map representing the firing rate of this neuron as a function of the animal’s location (red corresponds to high firing rate); a “band-like” cell from Krupic et al. (2012); a border cell from Solstad et al. (2008); an irregular spatially tuned cell from Diehl et al. (2017); a “speed cell” from Kropff et al. (2015), which exhibits roughly linear dependence on the rodent’s running speed; a “heading direction cell” from Sargolini et al. (2006), which shows systematic change of firing rate depending on animal’s heading direction. b) The network consists of N = 100 recurrently connected units (or neurons) which receive two external inputs, representing the animal’s speed and heading direction. The two outputs linearly weight the neurons in the RNN. The goal of training is to make the responses of the two output neurons accurately represent the animal’s physical location. c) Typical trajectory after training. As shown, the output of the RNN can accurately, though not perfectly, track the animal’s location during navigation. 2 Published as a conference paper at ICLR 2018 2 2.1 M ODEL M ODEL DESCRIPTION Our network model consists of a set of recurrently connected units (N = 100). The dynamics of each unit in the network ui (t) is governed by the standard continuous-time RNN equation: τ Nin N X X dxi (t) in = −xi (t) + Wijrec uj (t) + Wik Ik (t) + bi + ξi (t) dt j=1 (1) k=1 for i = 1, . . . , N . The activity of each unit, ui (t), is related to the activation of that unit, xi (t), through a nonlinearity which in this study we take to be ui (t) = tanh(xi (t)). Each unit receives input from other units through the recurrent weight matrix W rec and also receives external input, I(t), that enters the network through the weight matrix W in . Each unit has two sources of bias, bi which is learned and ξi (t) which represents noise intrinsic to the network and is taken to be Gaussian with zero mean and constant variance. The network was simulated using the Euler method for T = 500 timesteps of duration τ /10. To perform a 2D navigation task with the RNN, we linearly combine the firing rates of units in the network to estimate the current location of the animal. The responses of the two linear readout neurons, y1 (t) and y2 (t), are given by the following equation: yj (t) = N X out Wji ui (t) (2) i=1 2.2 I NPUT TO THE NETWORK The network inputs and outputs were inspired by simple spatial navigation tasks in 2D open environments. The task resembles dead-reckoning (sometimes referred to as path integration), which is ethologically relevant for many animal species (Darwin, 1873; Mittelstaedt & Mittelstaedt, 1980; Etienne & Jeffery, 2004; McNaughton et al., 2006). To be more specific, the inputs to the network were the animal’s speed and direction at each time step. Experimentally, it has been shown that the velocity signals exist in EC (Sargolini et al., 2006; Kropff et al., 2015; Hinman et al., 2016), and there is also evidence that such signals are necessary for grid formation (Winter et al., 2015a;b). Throughout the paper, we adopt the common assumption that the head direction of the animal coincides with the actual moving direction. The outputs were the x- and y-coordinates of the integrated position. The direction of the animal is modeled by modified Brownian motion to increase the probability of straight-runs, in order to be consistent with the typical rodent’s behavior in an open environment. The usage of such simple movement statistics has the advantage of having full control of the simulated trajectories. However, for future work it would be very interesting to test the model using different animals’ real movement trajectories to see how the results might change. Special care is taken when the animal is close to the boundary. The boundary of the environment will affect the statistics of the movement, as the animal cannot cross the boundary. This fact was reflected in the model by re-sampling the angular input variable until the input angle did not lead the animal outside the boundary. In the simulations shown below, the animal always starts from the center of the arena, but we verified that the results are insensitive to the starting locations. 2.3 T RAINING We optimized the network parameters W rec , W in , b and W out to minimize the squared error in equation (3) between target x- and y-coordinates from a two dimensional navigation task (performed in rectangular, hexagonal, and triangular arenas) and the network outputs generated according to equation (2). M,T,N Xout 1 E= (yj (t, m) − yjtarget (t, m))2 (3) M T Nout m,t,j=1 Parameters were updated with the Hessian-free algorithm (Martens & Sutskever, 2011) using minibatches of size M = 500 trials. In addition to minimizing the error function in equation (3) we 3 Published as a conference paper at ICLR 2018 regularized the input and output weights according to equation (4) and the squared firing rates of the units (referred to as metabolic cost) according to equation (5). In sum, the training aims to minimize a loss function, that consists of the error of the animal, the metabolic cost, and a penalty for large network parameters. RL2 N,N NX out ,N Xin 1 1 in 2 = (W ) + (Wijout )2 N Nin i,j=1 ij N Nout i,j=1 RF R = 1 NTM N,T,M X ui (t, m)2 (4) (5) i,t,m=1 We find that the results are qualitatively insensitive to the initialization schemes used for the recurrent weight matrix W rec . For the results presented in this paper, simulations in the hexagonal environment were obtained by initializing the elements of W rec to be zero mean Gaussian random variables with variance 1.52 /N , and simulations in the square and triangular environments were initialized with an orthogonal W rec (Saxe et al., 2014). We initialized the bias b and output weights W out to be zero. The elements of W in were zero mean Gaussian variables with variance 1/Nin . a grid-like b band-like c border d irregular Figure 2: Different types of spatial selective responses of units in the trained RNN. Example simulation results for three different environments (square, triangular, hexagon) are presented. Blue (yellow) represents low (high) activity. a) Grid-like responses. b) Band-like responses; c) Borderrelated responses; d) Spatially irregular responses. These responses can be spatially selective but they do not form a regular pattern defined in the conventional sense. 3 R ESULTS We run simulation experiments in arenas with different boundary shapes, including square, triangular and hexagonal. Figure 1c shows a typical example of the model performance after training; the network (red trace) accurately tracks the animal’s actual path (black). 3.1 T UNING PROPERTIES OF THE MODEL NEURONS We are mostly interested in what kind of representation the RNN has learned to solve this navigation task, and whether such a representation resembles the response properties of neurons in EC (Moser et al., 2008). 3.1.1 S PATIAL TUNING To test whether the trained RNN developed location-selective representations, we plot individual neurons’ mean activity level as a function of the animal’s location during spatial exploration. Note 4 Published as a conference paper at ICLR 2018 that these average response profiles should not be confused with the linear filters typically shown in feedforward networks. Surprisingly, we find neurons in the trained RNN show a range of interesting spatial response profiles. Examination of these response profiles suggests they can be classified into distinct functional types. Importantly, as we will show, these distinct spatial response profiles can be mapped naturally to known physiology in EC. The spatial responses of all units in trained networks are shown in the Appendix. Grid-like responses Most interestingly, we find some of the units in the RNN exhibit clear grid-like responses (Figure 2a). These firing patterns typically exhibit multiple firing fields, with each firing field exhibiting roughly circular symmetric or ellipse shape. Furthermore, the firing fields are highly structured, i.e., when combined, are arranged on a regular lattice. Furthermore, the structure of the response lattice depends on the shape of the boundary. In particular, training the network to perform self-localization in a square environment tends to give rectangular grids. In hexagonal and triangular environments, the grids are closer to triangular. Experimentally, it is shown that (medial) EC contains so-called grid cells which exhibit multiple firing fields that lie on a regular grid (Fyhn et al., 2004; Hafting et al., 2005). The grid-like firing patterns in our simulation are reminiscent of the grid cells in rodents and other mammals. However, we also notice that the the grid-like model responses typically exhibit few periods, not as many as experimental data (see Figure 1a). It is possible that using a larger network might reveal finer grid-patterns in our model. Nonetheless, it is surprising that the gird-like spatial representations can develop in our model, given there is no periodicity in the input. Another potential concern is that, experimentally it is reported that the grids are often on the corners of a triangular lattice (Hafting et al., 2005) even in square environments (see Figure 1a), though the grids are somewhat influenced by the shape of the environment. However, the rats in these experiments presumable had spatial experience in other environments with various boundary shapes. Experimentally, it would be interesting to see if grid cells would lie on a square lattice instead if the rats are raised in a single square environment - a situation we are simulating here. Border responses Many neurons in the RNN exhibit selectivity to the boundary (Figure 2c). Typically, they only encode a portion of the boundary, e.g. one piece of wall in a square shaped environment. Such properties are similar to the border cells discovered in rodent EC (Solstad et al., 2008; Savelli et al., 2008; Lever et al., 2009). Experimentally, border cells mainly fire along one piece of wall, although some have been observed to fire along multiple borders or along the whole boundary of the environment; interestingly, these multi-border responses were also observed in some RNN models. Currently, it is unclear how the boundary-like response profiles emerge (Solstad et al., 2008; Savelli et al., 2008; Lever et al., 2009). Our model points to the possibility that the border cells may emerge without the presence of tactile cues. Furthermore, it suggests that border cell formation may be related to the movement statistics of the animals, i.e. due to the asymmetry of the movement statistics along the boundary. Band-like responses Interestingly, some neurons in the RNN exhibit band-like responses (Figure 2b). In most of our simulations, these bands tend to be parallel to one of the boundaries. For some of the units, one of the bands overlaps the boundary, but for others, that is not the case. Experimentally, neurons with periodic-like firing patterns have been recently reported in rodent EC. In one study, it has been reported that a substantial portion of cells in EC exhibit band-like firing characteristics (Krupic et al., 2012). However, we note that based on the reported data in Krupic et al. (2012), the band pattern is not as clear as in our model. Spatially-stable but non-regular responses Besides the units described above, most of the remaining units also exhibit stable spatial responses, but they do not belong to the above categories. These response profiles can exhibit either one large irregular firing field; or multiple circular firing fields, but these firing fields do not show a regular pattern. Experimentally these types of cells have also been observed. In fact, it is recently reported that the non-grid spatial cells constitute a large portion of the neurons in Layer II and III of rodent EC (Diehl et al., 2017). 3.1.2 S PEED TUNING AND HEAD DIRECTION TUNING Speed tuning We next ask how neurons in the RNN are tuned to the inputs. Many of the model neurons exhibit linear responses to the running speed of the animal, while some neurons show no selectivity to speed, as suggested by the near-flat response functions. Example response profiles are 5 Published as a conference paper at ICLR 2018 a d g b e h c f i direction speed direction speed direction speed Figure 3: Direction tuning and speed tuning for nine example units in an RNN trained in a triangular arena. For each unit, we show the spatial tuning, (head) directional tuning, speed tuning respectively, from left to right. a,b,c) The three model neurons show strong directional tuning, but the spatial tuning is weak and irregular. The three neurons also exhibit linear speed tuning. d,e,f) The three neurons exhibit grid-like firing patterns, and clear speed tuning. The strength of their direction tuning differ. g,h) Border cells exhibit weak and a bit complex directional tuning and almost no speed tuning. i) This band cell shows weak directional tuning, but strong speed tuning. shown in Figure 3. Interestingly, we observe that the model border cells tend to have almost zero speed-tuning (e.g., see Figure 3g,h). Head direction tuning A substantial portion of the model neurons show direction tuning. There are a diversity of direction tuning profiles, both in terms of the strength of the tuning and their preferred direction. Example tuning curves are shown in Figure 3, and the direction tuning curves of a complete population are shown in the Appendix. Interestingly, in general model neurons which show the strongest head direction tuning do not show a clear spatial firing pattern (see Figure 3a,b,c). This suggests that there are a group of neurons which are mostly responsible for encoding the direction. We also notice that neurons with clear grid-like firing can exhibit a variety of direction tuning strengths, from weak to strong (Figure 3d,e,f). In the Appendix, we quantify the relation between these different tuning properties at the whole population level, which show somewhat complex dependence. Experimentally, the heading direction tuning in EC is well-known, e.g., Sargolini et al. (2006). Both the grid and non-grid cells in EC exhibit head direction tuning (Sargolini et al., 2006). Furthermore, the linear speed dependence of the model neurons is similar to the properties of speed cells reported recently in EC (Kropff et al., 2015). Our result is also consistent with another recent study reporting that the majority of neurons in EC exhibit some amount of speed tuning (Hinman et al., 2016). It remains an open question experimentally, at a population level, how different types of tuning characteristics in EC relate to each other. 3.1.3 D EVELOPMENT OF THE TUNING PROPERTIES We next investigate how the spatial response profiles evolve as learning/training progresses. We report two main observations. First, neurons that fire selectively along the boundary typically emerge first. Second, the grid-like responses with finer spatial tuning patterns only emerge later in training. For visualization, we perform dimensionality reduction using the t-SNE algorithm (Maaten & Hinton, 2008). This algorithm embeds 100 model neurons during three phases of training (early, intermediate, and late) into a two-dimensional space according to the similarity of their temporal responses. Here the similarity metric is taken to be firing rate correlation. In this 2D space as shown in Figure 4a, border cell representations appear early and stably persist through the end of training. Furthermore, early during training all responses are similar to the border related responses. In contrast, grid-like cells typically undergo a substantial change in firing pattern during training before settling into their final grid-like representation (Figure 4b). The developmental time line of the grid-like cells and border cells is roughly consistent with developmental studies in rodents. Experimentally, it is known that border cells emerge earlier in development, and they exist at about 2 weeks after the rat is born (Bjerknes et al., 2014). The grid 6 Published as a conference paper at ICLR 2018 a Dimension 2 cells mature only at about 4 weeks after birth (Langston et al., 2010; Wills et al., 2010; Bjerknes et al., 2014). Furthermore, our simulations suggest the reason why border cells emerge earlier in development may be that computationally it is easier to wire-up a network that gives rise to border cell responses. b 0 -10 Early Training iteration 100 -20 Intermediate Training 500 -20 iteration -10 Late Training iteration1000 0 Dimension 1 10 Figure 4: Development of border cells and grid-like cells. Early during training all responses are similar to the border related responses, and only as training continues do the grid-like cells emerge. We perform dimensionality reduction using the t-SNE algorithm on the firing rates of the neurons. Each dot represents one neuron (N = 100), and the color represents different training stages (early/intermediate/late shown in blue/cyan/yellow). Each line shows the trajectory of a single highlighted neuron as its firing responses evolve during training. In panel a), we highlight the border representation. It appears there are four clusters of border cells, each responding to one wall of a square environment (spatial responses from four of these border cells are inset). These cells’ response profiles appear early and stably persist through training, illustrated by the short distance they travel in this space. In b), we show that the neurons which eventually become grid cells initially have tuning profiles similar to the border cells but then change their tuning substantially during learning. As a natural consequence, they need to travel a long distance in this space between the early and late phase of the training. Spatial responses are shown for four of these grid-like cells during the late phase of training. 3.2 T HE IMPORTANCE OF REGULARIZATION We find appropriate regularizations of the RNN to be crucial for the emergence of grid-like representations. We only observed grid-like representations when the network was encouraged to store information while perturbed by noise. This was accomplished by setting the speed input to zero, e.g. zero speed 90% of the time, and adding Gaussian noise to the network (ξi (t) in equation (1)); the precise method for setting the speed input to zero and the value of the noise variance is not crucial for our simulations to develop grid-like representations. The cost function which aims to capture the penalization on the metabolic cost of the neural activity also acts as an important regularization. Our simulations show that the grid-like representation did not emerge without this metabolic cost. In Figure 5, we show typical simulation results for a square environment, with and without proper metabolic regularization. In the Appendix, we illustrate the effect of regularization further, in particular the role of injecting noise into the RNN units. Our results are consistent with the general notion on the importance of incorporating proper constraint for learning useful representations in neural networks (Bengio et al., 2013). Furthermore, it suggests that, to learn a model with response properties similar to neural systems it may be necessary to incorporate the relevant constraints, e.g., noise and metabolic cost. 3.3 E RROR CORRECTION AROUND THE BOUNDARY One natural question is whether the trained RNNs are able to perform localization when the path length exceeds the typical length used during training (500 steps), in particular given that noise in 7 Published as a conference paper at ICLR 2018 a b Figure 5: Complete set of spatial response profiles for 100 neurons in a RNN trained in a square environment. a) Without proper regularization, complex and periodic spatial response patterns do not emerge. b) With proper regularization, a rich set of periodic response patterns emerge, including grid-like responses. Regularization can also be adjusted to achieve spatial profiles intermediate between these two examples. 0.02 no boundary interaction boundary interaction b Squared error Squared error a 0.016 0.012 0 boundary interaction 1 boundary interaction 2 to 5 interactions 6 to 50 interactions 0.4 0 (in the next 50 time steps) 0.008 RNN output constant output 0.8 -40 -20 0 20 40 Timesteps relative to first boundary interaction 0 2 4 6 Timesteps 8 10 10 5 Figure 6: Error-correction happens at the boundary and the error is stable over time. At the boundary, the direction is resampled to avoid input velocities that lead to a path extending beyond the boundary of the environment. These changing input statistics at the boundary, termed a boundary interaction, are the only cue the RNN receives about the boundary. We find that the RNN uses the boundary interactions to correct the accumulated error between the true integrated input and its prediction based on the linear readout of equation (2). Panel a), the mean squared error increases when there are no boundary interactions, but then decreases after a boundary interaction, with more boundary interactions leading to greater error reduction. In the absence of further boundary interaction, the squared error would gradually increase again (blue curve) at roughly a constant rate. b) The network was trained using mini-batches of 500 timesteps but has stable error over a duration at least four orders of magnitude larger. The error of the RNN output (mean and standard deviation shown in black, computed based on 10000 timesteps) is compared to the error that would be achieved by an RNN outputting the best constant values (red). the network would gradually accumulate, leading to a decrease in localization performance. We test this by simulating paths that are several orders of magnitude longer. Somewhat surprisingly, we find the RNNs still perform well (Figure 6b). In fact, the squared error (averaged over every 10000 steps) is stable. The spatial response profiles of individual units also remain stable. This implies that the RNNs have acquired intrinsic error-correction mechanisms during training. As shown earlier, during training some of the RNN units develop boundary-related firing (Figure 2c), presumably by exploiting the change of input statistics around the boundary. We hypothesize that 8 Published as a conference paper at ICLR 2018 boundary interactions may enable error-correction through signals based on these boundary-related activities. Indeed, we find that boundary interactions can dramatically reduce the accumulated error (Figure 6a). Figure 6a shows that, without boundary interactions, on average the squared error grows roughly linearly as expected, however, interactions with the boundaries substantially reduce the error, and more frequent boundary interactions can reduce the error further. Error-correction on grid cells via boundary interactions has been proposed (Hardcastle et al., 2015; Pollock et al., 2017), however, we emphasize that the model proposed here develops the grid-like responses, boundary responses and the error-correction mechanisms all within the same neural network, thus potentially providing a unifying account of a diverse set of phenomena. 4 D ISCUSSION In this paper, we trained RNNs to perform path integration (dead-reckoning) in 2D arenas. We found that after training RNNs with appropriate regularization, the model neurons exhibit a variety of spatial and velocity tuning profiles that match neurophysiology in EC. What’s more, there is also similarity in terms of when these distinct neuron types emerge during training/development. The EC has long been thought to be involved in path integration and localization of the animal’s location (Moser et al., 2008). The general agreement between the different response properties in our model and the neurophysiology provide strong evidence supporting the hypothesis that the neural population in EC may provide an efficient code for representation self-locations based on the velocity input. Recently, there has been increased interest in using complex neural network models to understand the neural code. But the focus has been on using feedforward architectures, in particular CNNs (LeCun et al., 1998). Given the abundant recurrent connections in the brain, it seems a particularly fruitful avenue to take advantage of the recent development in RNNs to help with neuroscience questions (Mante et al., 2013; Song et al., 2016; Miconi, 2017; Sussillo et al., 2015). Here, we only show one instance following this approach. However, the insight from this work could be general, and potentially useful for other cognitive functions as well. The finding that metabolic constraints lead to the emergence of grid-like responses may be seen as conceptually related to the efficient coding hypothesis in visual processing (Barlow, 1961), in particular the seminal work on the emergence of the V1-like Gabor filters in a sparse coding model by Olshausen & Field (1996). Indeed, our work is partly inspired by these results. While there are conceptual similarities, however, we should also note there are differences between the sparse coding work and ours. First, the sparsity constraint in sparse coding can be naturally viewed as a particular prior while in the context of the recurrent network, it is difficult to interpret that way. Second, the grid-like responses are not the most sparse solution one could imagine. In fact, they are still quite dense compared to a more spatially localized representation. Third, the grid-like patterns that emerged in our network are not filters based on the raw input, rather the velocity inputs need to be integrated first in order to encode spatial locations. Our work is also inspired by recent work using the efficient coding idea to explain the functional architecture of the grid cells (Wei et al., 2015). It has been shown that efficient coding considerations could explain the particular set of grid scales observed in rodents (Stensola et al., 2012). However, in that work, the firing patterns of the neurons are assumed to have a lattice structure to start with. Furthermore, our work is related to the study by Sussillo and others (Sussillo et al., 2015), in which they show that regularization of RNN models are important for generating solutions that are similar to the neural activity observed in motor cortex. In Sussillo et al., a smoothness constraint together with others lead to simple oscillatory neural dynamics that well matches the neural data. We have not incorporated a smoothness constraint into our network. Additionally, we note that there are a few recent studies which use place cells as the input to generate grid cells (Dordek et al., 2016; Stachenfeld et al., 2016), which are fundamentally different from our work. In these feedforward network models, the grid cells essentially perform dimensionality reduction based on the spatial input from place cells. However, the main issue with these models is that, it is unclear how place cells acquire spatial tuning in the first place. To the contrary, our model takes the animal’s velocity as the input, and addresses the question of how the spatial tuning can be generated from such input, which are known to exist in EC (Sargolini et al., 2006; Kropff et al., 2015). In another related study (Kanitscheider & Fiete, 2016), the authors train a RNN with 9 Published as a conference paper at ICLR 2018 LSTM units (Hochreiter & Schmidhuber, 1997) to perform different navigation tasks. However, no grid-like spatial firing patterns are reported. Although our model shows a qualitative match to the neural responses observed in the EC, nonetheless it has several major limitations, with each offering interesting future research directions. First, the learning rule we use seems to be biologically implausible. We are interested in exploring how a more biologically plausible learning rule could give rise to similar results (Lillicrap et al., 2016; Miconi, 2017; Guerguiev et al., 2017). Second, the simulation results do not show a variety of spatial scales in grid-like cells. Experimentally, it is known that grid cells have multiple spatial scales, that scale geometrically with a ratio 1.4 (Stensola et al., 2012), and this particular scale ratio is predicted by efficient coding of space (Wei et al., 2015). We are investigating how to modify the model to get a hierarchy of spatial scales, perhaps by incorporating more neurons or modifying the regularization. Last but not least, we have focused on the representation produced by the trained RNN. An equally important set of questions concern how the networks actually support the generation of such a representation. As a preliminary effort, we have examined the connectivity patterns of the trained network, and they do not seem to resemble the connectivity patterns required by standard attractor network models. Maybe this should not be seen as too surprising. After all, the trained networks can produce a diverse set of neural responses, while the previous models only led to grid responses. It would be interesting for future work to systematically examine the questions related to the underlying mechanisms. 5 ACKNOWLEDGEMENTS We thank members of the Center for Theoretical Neuroscience at Columbia University for useful discussions and three anonymous reviewers for constructive feedback. Research supported by NSF NeuroNex Award DBI-1707398 and NIH training grant 5T32NS064929 (CJC). R EFERENCES Dmitriy Aronov, Rhino Nevers, and David W Tank. Mapping of a non-spatial dimension by the hippocampalentorhinal circuit. Nature, 2017. Horace B Barlow. Possible principles underlying the transformation of sensory messages. Sensory communication, pp. 217–234, 1961. Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013. Tale L Bjerknes, Edvard I Moser, and May-Britt Moser. Representation of geometric borders in the developing rat. Neuron, 82(1):71–78, 2014. Yoram Burak and Ila R Fiete. Accurate path integration in continuous attractor network models of grid cells. PLoS computational biology, 5(2):e1000291, 2009. Jonathan J Couey, Aree Witoelar, Sheng-Jia Zhang, Kang Zheng, Jing Ye, Benjamin Dunn, Rafal Czajkowski, May-Britt Moser, Edvard I Moser, Yasser Roudi, et al. Recurrent inhibitory circuitry as a mechanism for grid formation. Nature neuroscience, 16(3):318–324, 2013. Charles Darwin. Origin of certain instincts. Nature, 7:417–418, 1873. Geoffrey W Diehl, Olivia J Hon, Stefan Leutgeb, and Jill K Leutgeb. Grid and nongrid cells in medial entorhinal cortex represent spatial location and environmental features with complementary coding schemes. Neuron, 94(1):83–92, 2017. Yedidyah Dordek, Daniel Soudry, Ron Meir, and Dori Derdikman. Extracting grid cell characteristics from place cell inputs using non-negative principal component analysis. eLife, 5:e10094, 2016. Ariane S Etienne and Kathryn J Jeffery. Path integration in mammals. Hippocampus, 14(2):180– 192, 2004. 10 Published as a conference paper at ICLR 2018 Marianne Fyhn, Sturla Molden, Menno P Witter, Edvard I Moser, and May-Britt Moser. Spatial representation in the entorhinal cortex. Science, 305(5688):1258–1264, 2004. Marianne Fyhn, Torkel Hafting, Menno P Witter, Edvard I Moser, and May-Britt Moser. Grid cells in mice. Hippocampus, 18(12):1230–1238, 2008. Alex Graves, Abdel-Rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013. Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015. Jordan Guerguiev, Timothy P Lillicrap, and Blake A Richards. Towards deep learning with segregated dendrites. eLife, 6, 2017. Torkel Hafting, Marianne Fyhn, Sturla Molden, May-Britt Moser, and Edvard I Moser. Microstructure of a spatial map in the entorhinal cortex. Nature, 436(7052):801–806, 2005. Kiah Hardcastle, Surya Ganguli, and Lisa M Giocomo. Environmental boundaries as an error correction mechanism for grid cells. Neuron, 86(3):827–839, 2015. James R Hinman, Mark P Brandon, Jason R Climer, G William Chapman, and Michael E Hasselmo. Multiple running speed signals in medial entorhinal cortex. Neuron, 91(3):666–679, 2016. Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997. David H Hubel and Torsten N Wiesel. Receptive fields, binocular interaction and functional architecture in the cat’s visual cortex. The Journal of physiology, 160(1):106–154, 1962. Joshua Jacobs, Christoph T Weidemann, Jonathan F Miller, Alec Solway, John F Burke, Xue-Xin Wei, Nanthia Suthana, Michael R Sperling, Ashwini D Sharan, Itzhak Fried, et al. Direct recordings of grid-like neuronal activity in human spatial navigation. Nature neuroscience, 16(9):1188– 1190, 2013. Ingmar Kanitscheider and Ila Fiete. Training recurrent networks to generate hypotheses about how the brain solves hard navigation problems. arXiv preprint arXiv:1609.09059, 2016. Tim Christian Kietzmann, Patrick McClure, and Nikolaus Kriegeskorte. Deep neural networks in computational neuroscience. bioRxiv, pp. 133504, 2017. Nathaniel J Killian, Michael J Jutras, and Elizabeth A Buffalo. A map of visual space in the primate entorhinal cortex. Nature, 491(7426):761–764, 2012. Nikolaus Kriegeskorte. Deep neural networks: a new framework for modeling biological vision and brain information processing. Annual Review of Vision Science, 1:417–446, 2015. Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 1097–1105, 2012. Emilio Kropff, James E Carmichael, May-Britt Moser, and Edvard I Moser. Speed cells in the medial entorhinal cortex. Nature, 523(7561):419–424, 2015. Julija Krupic, Neil Burgess, and John O?Keefe. Neural representations of location composed of spatially periodic bands. Science, 337(6096):853–857, 2012. Rosamund F Langston, James A Ainge, Jonathan J Couey, Cathrin B Canto, Tale L Bjerknes, Menno P Witter, Edvard I Moser, and May-Britt Moser. Development of the spatial representation system in the rat. Science, 328(5985):1576–1580, 2010. Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. 11 Published as a conference paper at ICLR 2018 Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015. Colin Lever, Stephen Burton, Ali Jeewajee, John O’Keefe, and Neil Burgess. Boundary vector cells in the subiculum of the hippocampal formation. The journal of neuroscience, 29(31):9771–9777, 2009. Timothy P Lillicrap, Daniel Cownden, Douglas B Tweed, and Colin J Akerman. Random synaptic feedback weights support error backpropagation for deep learning. Nature communications, 7, 2016. Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov):2579–2605, 2008. Valerio Mante, David Sussillo, Krishna V Shenoy, and William T Newsome. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature, 503(7474):78–84, 2013. James Martens and Ilya Sutskever. Learning recurrent neural networks with hessian-free optimization. pp. 10331040, 2011. Bruce L McNaughton, Francesco P Battaglia, Ole Jensen, Edvard I Moser, and May-Britt Moser. Path integration and the neural basis of the ’cognitive map’. Nature Reviews Neuroscience, 7(8): 663–678, 2006. Thomas Miconi. Biologically plausible learning in recurrent neural networks reproduces neural dynamics observed during cognitive tasks. eLife, 6:e20899, 2017. M-L Mittelstaedt and H Mittelstaedt. senschaften, 67(11):566–567, 1980. Homing by path integration in a mammal. Naturwis- Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. Edvard I Moser, Emilio Kropff, and May-Britt Moser. Place cells, grid cells, and the brain’s spatial representation system. Annu. Rev. Neurosci., 31:69–89, 2008. John O’Keefe. Place units in the hippocampus of the freely moving rat. Experimental neurology, 51 (1):78–109, 1976. Bruno A Olshausen and David J Field. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583):607, 1996. Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016. Eli Pollock, Niral Desai, Xue-Xin Wei, and Vijay B Balasubramanian. A mechanism for selforganized error-correction of grid cells by border cells. CoSyNe abstract, 2017. Alexei Samsonovich and Bruce L McNaughton. Path integration and cognitive mapping in a continuous attractor neural network model. Journal of Neuroscience, 17(15):5900–5920, 1997. Francesca Sargolini, Marianne Fyhn, Torkel Hafting, Bruce L McNaughton, Menno P Witter, MayBritt Moser, and Edvard I Moser. Conjunctive representation of position, direction, and velocity in entorhinal cortex. Science, 312(5774):758–762, 2006. Francesco Savelli, D Yoganarasimha, and James J Knierim. Influence of boundary removal on the spatial representations of the medial entorhinal cortex. Hippocampus, 18(12):1270, 2008. Andrew M Saxe, James L McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. 2014. Trygve Solstad, Charlotte N Boccara, Emilio Kropff, May-Britt Moser, and Edvard I Moser. Representation of geometric borders in the entorhinal cortex. Science, 322(5909):1865–1868, 2008. 12 Published as a conference paper at ICLR 2018 H Francis Song, Guangyu R Yang, and Xiao-Jing Wang. Training excitatory-inhibitory recurrent neural networks for cognitive tasks: A simple and flexible framework. PLoS Comput Biol, 12(2): e1004792, 2016. Kimberly Lauren Stachenfeld, Matthew M Botvinick, and Samuel J Gershman. The hippocampus as a predictive map. bioRxiv, pp. 097170, 2016. Hanne Stensola, Tor Stensola, Trygve Solstad, Kristian Frøland, May-Britt Moser, and Edvard I Moser. The entorhinal grid map is discretized. Nature, 492(7427):72–78, 2012. David Sussillo, Mark M Churchland, Matthew T Kaufman, and Krishna V Shenoy. A neural network that finds a naturalistic solution for the production of muscle activity. Nature neuroscience, 18(7): 1025–1033, 2015. Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems, pp. 1927–1935, 2015. Xue-Xin Wei, Jason Prentice, and Vijay Balasubramanian. A principle of economy predicts the functional architecture of grid cells. Elife, 4:e08362, 2015. B Willmore and DJ Tolhurst. Characterizing the sparseness of neural codes. Network, 12:255–270, 2001. Tom J Wills, Francesca Cacucci, Neil Burgess, and John O’keefe. Development of the hippocampal cognitive map in preweanling rats. Science, 328(5985):1573–1576, 2010. Shawn S. Winter, Benjamin J. Clark, and Jeffrey S. Taube. Disruption of the head direction cell network impairs the parahippocampal grid cell signal. Science, 347(6224):870–874, 2015a. Shawn S. Winter, Max L. Mehlman, Benjamin J. Clark, and Jeffrey S. Taube. Passive transport disrupts grid signals in the parahippocampal cortex. Current Biology, 25:2493–2502, 2015b. Daniel LK Yamins and James J DiCarlo. Using goal-driven deep learning models to understand sensory cortex. Nature neuroscience, 19(3):356–365, 2016. Daniel LK Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619–8624, 2014. Michael M Yartsev, Menno P Witter, and Nachum Ulanovsky. Grid cells without theta oscillations in the entorhinal cortex of bats. Nature, 479(7371):103–107, 2011. 13 Published as a conference paper at ICLR 2018 A T RIANGULAR ENVIRONMENT Noise 1, Metabolic 0 Noise 0, Metabolic 1 Noise and metabolic cost are important for grid-like representations. The figure on the left shows the spatial responses for a network trained with noise and no metabolic cost. The figure on the right shows the spatial responses for a network trained with no noise and the metabolic cost. 14 Published as a conference paper at ICLR 2018 Head direc&on tuning Activity of unit (-1 to 1) Ac&vity of unit (-1 to 1) Training epoch 2900, 2000 trials, 500 time steps in simulation errormain = 0.002977, normalized error overall = 1.3595% Angular input (0 to 360 degrees) Direc&on input (0 to 360 degrees) Speed tuning Activity of unit (-1 to 1) Ac,vity of unit (-1 to 1) Training epoch 2900, 2000 trials, 500 time steps in simulation errormain = 0.002977, normalized error overall = 1.3595% Speed input (0 to 0.199999) Speed input 15 Published as a conference paper at ICLR 2018 R ECTANGULAR ENVIRONMENT Head direc6on tuning Activity of units (-1 to 1) Ac6vity of unit (-1 to 1) Training epoch 1000, 2000 trials, 450 time steps in simulation errormain = 0.0047399, normalized error overall = 3.5752% Angular input (0 to 360 degrees) Angular input (0 to 360 degrees) Speed tuning Training epoch 1000, 2000 trials, 450 time steps in simulation errormain = 0.0047399, normalized error overall = 3.5752% Activity of unit (-1 to 1) Ac,vity of unit (-1 to 1) B Speed input (0 to 0.2) Speed input 16 Published as a conference paper at ICLR 2018 H EXAGONAL ENVIRONMENT Head direc6on tuning Activity of unit (-1 to 1) Ac6vity of unit (-1 to 1) Training epoch 900, 2000 trials, 450 time steps in simulation errormain = 0.00403, normalized error overall = 4.2275% Angular input (0 to 360 degrees) Angular input (0 to 360 degrees) Speed tuning Activity of unit (-1 to 1) Training epoch 900, 2000 trials, 450 time steps in simulation errormain = 0.00403, normalized error overall = 4.2275% Ac#vity of unit (-1 to 1) C Speed input (0 to 0.2) Speed input 17 Published as a conference paper at ICLR 2018 D R ELATION BETWEEN SPEED , DIRECTION , AND SPATIAL SELECTIVITY To quantify the speed selectivity of each unit we first fit a line to the tuning curve of unit activity as a function of speed. The speed selectivity is the absolute value of the slope. If the unit activity is not modulated by speed then the speed selectivity is 0. To quantify the direction selectivity of each unit we calculated the average unit activity as a function of direction input and then took the maximum minus minimum of this tuning curve. If the unit activity is not modulated by direction then the direction selectivity is 0. To quantify the spatial selectivity we used lifetime sparseness (Willmore & Tolhurst, 2001). If the unit activity is not modulated by spatial location then the spatial selectivity is 0. Each dot in the figures below show the selectivity for a single unit. Rectangle Hexagon 0.5 0.4 0.4 0.4 0.3 0.2 0.1 Spatial selectivity 0.5 Spatial selectivity Spatial selectivity Spa$al selec$vity Triangle 0.5 0.3 0.2 0.1 0 0.3 0.2 0.1 0 0 0.5 1 1.5 2 0 0.5 Direction selectivity 1 1.5 0 2 0 Direction selectivity 0.5 Triangle Rectangle 4 1 1.5 2 1.5 2 Direction selectivity Direc$on selec$vity Hexagon 4 3.5 2 1 Speed selectivity Speed selectivity Speed selectivity Speed selec)vity 3 3 2.5 2 1.5 1 3 2 1 0.5 0 0 0 0.5 1 1.5 2 0 0.5 Direction selectivity 1 1.5 0 2 0 0.5 Direction selectivity 1 Direction selectivity Direc)on selec)vity Triangle Rectangle 4 Hexagon 4 3.5 2 1 Speed selectivity Speed selectivity Speed selectivity Speed selec$vity 3 3 2.5 2 1.5 1 3 2 1 0.5 0 0 0 0.1 0.2 0.3 Spatial selectivity 0.4 0.5 0 0.1 0.2 0.3 0.4 Spatial selectivity Spa$al selec$vity 18 0.5 0 0 0.1 0.2 0.3 Spatial selectivity 0.4 0.5 Published as a conference paper at ICLR 2018 E A DDITIONAL TRAINING DETAILS During training we tried to balance all three terms we were minimizing (E, RL2 , and RF R ) so no single term was neglected or dominated. At the beginning of training we weighted the regularization term RL2 to be equal to the error function E and then decreased the weighting on RL2 according to the schedule used by Martens & Sutskever (2011). We adaptively adjusted the weighting on RF R , starting from an initial value of E/10 and enforcing an upper bound of E/3 as training progressed. We found this training procedure improved training performance and led to more interesting representations. 19
9cs.NE
arXiv:1608.08193v2 [math.AC] 5 Mar 2017 BIG COHEN-MACAULAY AND SEED ALGEBRAS IN EQUAL CHARACTERISTIC ZERO VIA ULTRAPRODUCTS GEOFFREY D. DIETZ AND REBECCA R.G. Abstract. Let R be a commutative, local, Noetherian ring. In a past article, the first author developed a theory of R-algebras, termed seeds, that can be mapped to balanced big Cohen-Macaulay R-algebras. In prime characteristic p, seeds can be characterized based on the existence of certain colon-killers, integral extensions of seeds are seeds, tensor products of seeds are seeds, and the seed property is stable under base change between complete, local domains. As a result, there exist directed systems of big Cohen-Macaulay algebras over complete, local domains. In this work, we will show that these properties can be extended to analogous results in equal characteristic zero. The primary tool for the extension will be the notion of ultraproducts for commutative rings as developed by Schoutens and Aschenbrenner. For a local ring (R, m), a big Cohen-Macaulay R-algebra B is an R-algebra such that some system of parameters for R forms a regular sequence on B with the extra property that mB 6= B to ensure that B is not trivial. If this is true for every system of parameters for R, then B is a balanced big Cohen-Macaulay algebra. Big Cohen-Macaulay algebras were first shown to exist in [HH92] using characteristic p methods related to tight closure theory (see [HH90]). Hochster and Huneke proved that the absolute integral extension R+ is a balanced big CohenMacaulay R-algebra when R is an excellent, local, domain of prime characteristic. These results were extended in further articles. For example, in [Ho94] Hochster makes explicit use of tight closure to provide an alternative proof of the existence of big Cohen-Macaulay algebras in prime characteristic based on the notion of algebra modifications. In [HH95] Hochster and Huneke proved the existence of balanced big Cohen-Macaulay algebras for rings containing a field of characteristic zero and proved the “weakly functorial” existence of big Cohen-Macaulay algebras, i.e., given complete local domains of equal characteristic R → S, there exists a balanced big Cohen-Macaulay R-algebra B and a balanced big Cohen-Macaulay S-algebra C such that B → C extends the map R → S. The results in equal characteristic zero are based on reductions to prime characteristic that rely on Artin approximation. In [D07], the first author introduced the notion of seed algebras. Given a local, Noetherian ring R, a seed algebra over R is an R-algebra S such that there exists an R-algebra map S → B where B is a balanced big Cohen-Macaulay Ralgebra. Some of the noteworthy results in that paper for rings of prime characteristic are Theorem 4.8 (which characterizes seeds based on durable, colon-killers), Date: August 30, 2016. 2010 Mathematics Subject Classification. Primary 13C14; Secondary 13A35. Key words and phrases. big Cohen-Macaulay algebras, tight closure, equal characteristic zero, ultraproducts. The second author was partially supported by the National Science Foundation [grant numbers DGE 1256260, DMS 1401384]. 1 2 GEOFFREY D. DIETZ AND REBECCA R.G. Theorem 6.9 (which shows that integral extensions of seeds are seeds and thus partially generalizes Hochster and Huneke’s result for R+ ), Theorem 7.8 (which shows that every seed can be mapped to an absolutely integrally closed, m-adically separated, quasilocal, balanced big Cohen-Macaulay algebra domain), Theorem 8.4 (which shows that tensor products of seeds are seeds and thus that any two big Cohen-Macaulay algebras map to a common big Cohen-Macaulay algebra), and Theorem 8.10 (which shows that the seed property is stable under base change and thus generalizes the weakly functorial existence result of Hochster and Huneke). Our aim in this paper is to extend the results of [D07] to equal characteristic zero using the notion of ultraproducts of rings as developed by Schoutens and Aschenbrenner in works such as [Sch03], [AS07], and [Sch10], to name just a few. Although many reductions to characteristic p have relied more directly upon various forms of Artin approximation, we decided that the theory of ultraproducts better suited the arguments here. Theorems 3.3, 3.5, 4.2, 4.3, and 5.1 in this work will serve as analogues to the above mentioned Theorems 8.4, 8.10, 4.8, 7.8, and 6.9 (respectively) from [D07]. As an added bonus, we do not need a hypothesis of completeness on the rings in this work as was needed in [D07]. The equal characteristic zero local domains R in this work (complete or not) will each have an associated Lefschetz hull D(R) which is an ultraproduct of rings Rw almost all of which are complete, local domains of prime characteristic. See Discussion 1.10 and Theorem 1.11 for details. on the Lefschetz hull and its properties. We will then prove that properties of the Rw transfer back to R, even without the hypothesis of completeness on R. In the first section, we will review some properties of ultraproducts and big Cohen-Macaulay algebras. With those tools established, we will proceed to discuss the notion of seeds in equal characteristic zero and then prove the analogues of the results named above from [D07] in the following sections. Throughout this paper, all rings are assumed to be commutative with identity, but not necessarily Noetherian unless stated explicitly. We will also follow the convention that “quasilocal” means that a ring (not necessarily Noetherian) has a unique maximal ideal while “local” means quasilocal and Noetherian. 1. Overview of Ultraproducts and Big Cohen-Macaulay Algebras We begin our efforts by reviewing background material necessary for our results. The main area of focus will be the topics related to ultraproducts in commutative algebra. The primary references will be the works of Schoutens and Aschenbrenner. See [Sch10], [AS07], and [Sch03] for examples. Some of the results needed are listed below. References are provided to relevant sections of the works mentioned above. Definition 1.1 ((2.1.1), [Sch10]). Let W be an infinite set. A filter on W is a proper, nonempty collection W of subsets of W that is closed under finite intersections and taking supersets. If we add the conditions that the empty set is not in W and that for every subset A of W , either A ∈ W or W − A ∈ W, then W is an ultrafilter. We say that W is principal if it contains a least element, i.e., a set contained in every other element of W. This least element in a principal ultrafilter will always be a singleton set. An ultrafilter that does not have a least element is non-principal. Note that all of the sets in a non-principal ultrafilter are infinite, as intersections of finite sets always result in smaller sets and eventually lead to the empty set. BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 3 Following Schoutens, we will say (equivalently) that a non-principal ultrafilter on W is a collection W of infinite subsets of W that is closed under finite intersection and such that for any W ′ ⊆ W , either W ′ ∈ W or W − W ′ ∈ W. Note that the requirement that all sets in W be infinite implies that the empty set is not in W, and that W is not principal as it cannot contain a singleton set. Also, if W ′ ∈ W and W ′ ⊆ W ′′ , then under this notion we will have W ′′ ∈ W as otherwise W − W ′′ ∈ W. But W − W ′′ is disjoint from W ′ , so this would imply that the empty set is in W. All ultrafilters in this work will be non-principal ultrafilters. Example 1.2. Let W be any infinite set, and take the collection of subsets of W whose complements are finite. This can be expanded to a non-principal ultrafilter via the axiom of choice. Hence there is always at least one ultrafilter on any infinite set W . See Section 6.2 of [Ho93] for more details. Remark 1.3. In what follows, we will generally work with a fixed non-principal ultrafilter on a given set W . In the later sections, W will be the set of positive prime integers, but the specific ultrafilter W on W will not be described as it mostly does not play a determining role in the results. The presence of a non-principal ultrafilter is all that is needed. The purpose of the ultrafilter is to specify which subsets of W are “large” and thus develop a notion of when a property is true for “almost all” elements in W . Definition 1.4. Let W be an infinite set, and W a non-principal ultrafilter on W . We say that a property holds for almost all w ∈ W if it holds for all w in some W ′ ∈ W. In the later sections, we will prove a number of results in equal characteristic zero by appealing to a similar result already known to be true in characteristic p > 0. The idea is that many rings of equal characteristic zero have the structure of an ultraproduct, defined below, of rings of characteristic p > 0, and many properties of the factors transfer to their ultraproduct. Definition 1.5 ((2.1.2)–(2.1.4), [Sch10]). Let W be an infinite set with a nonprincipal ultrafilter W. For each w ∈ W , take a ring Aw . The ultraproduct A♮ of the Aw (with respect to W) is the quotient (Πw Aw ) /Inull , where Inull is the ideal of elements (xw )w∈W of Πw Aw where xw = 0 for almost all w. Any such ring A♮ is called an ultraring. Given an element (aw ) ∈ Πw Aw , we refer to its image a♮ in A♮ as the ultraproduct of the aw , and denote it by ulimw aw . We can take ultraproducts of Aw -modules as well: the ultraproduct of the Aw modules Mw is M♮ = (Πw Mw ) /Mnull , where Mnull consists of all elements of Πw Mw almost all of whose entries are 0. M♮ has the structure of an A♮ -module and will be called an ultramodule. Maps on the components of an ultraproduct lead to a map on the ultraproduct. Definition 1.6 ((2.1.7), [Sch10]). Given rings Aw and Bw and maps fw : Aw → Bw , the ultraproduct f♮ of the fw is defined to be the map f♮ (ulimw aw ) = ulimw fw (aw ). We call f♮ a map of ultrarings. Similarly, given Aw -modules Mw and Nw and maps fw : Mw → Nw , the ultraproduct f♮ of the fw is defined by f♮ (ulimw mw ) = ulimw fw (mw ). We call f♮ a map of ultramodules. 4 GEOFFREY D. DIETZ AND REBECCA R.G. The following theorem is one of the main tools for working with ultraproducts. Theorem 1.7 (Los’s Theorem, (2.3.1), [Sch10]). Let S be a system of equations f1 = f2 = . . . = fs = 0 and inequalities g1 6= 0, g2 6= 0, . . . , gt 6= 0 with fi , gj ∈ Z[x1 , . . . , xn ]. Then an element a♮ ∈ A♮ is a solution of S if and only if aw is a solution of S in Aw for almost all w. Ring theoretic properties that can be defined equationally can typically be transferred between an ultraring and almost all of its components via Los’ Theorem. For example, almost all Aw are domains if and only if A♮ is a domain ([Sch10, 2.4.10]). Other critical examples for us are given below. Example 1.8 ((2.4.1)–(2.4.4), [Sch10]). A Lefschetz field K is a field of characteristic zero that is an ultraproduct almost all of whose components Kw are fields of positive characteristic. The field of complex numbers C is isomorphic to a Lefschetz field constructed from the algebraic closures of the finite fields of characteristic p > 0. More generally, assuming the generalized Continuum Hypothesis, any uncountable algebraically closed field of characteristic zero is also a Lefschetz field. Example 1.9 ((2.9.7), [Sch03]). Let x♮ be a sequence of elements in an ultraring A♮ with corresponding sequences of elements xw in each of the Aw . Then x♮ is a regular sequence on A♮ if and only if xw is a regular sequence on Aw for almost all w. One of the most important constructions used below to transfer results from characteristic p > 0 to equal characteristic zero is the Lefschetz hull of an equal characteristic zero local ring. The reader is referred to [AS07, Sections 4 and 5] for the full treatment of these subjects, but we attempt to summarize some key results below. The following is the base assumption for all local rings in the following sections. Discussion 1.10. Let R denote an equal characteristic zero Noetherian local ring that is not necessarily complete. Let K denote a Lefschetz field with respect to an unspecified non-principal ultrafilter placed upon the set of positive prime integers. The components Kw of K will then be algebraically closed fields of characteristic p(w). The cardinality of K needs to be sufficiently large, e.g., a cardinality exceeding 2|R| . One can add extra data (including a local homomorphism to K) so that there exists a Lefschetz hull D(R) which is defined to be an ultraproduct of rings Rw (called the approximations of R), where each Rw is a complete local Noetherian ring with algebraically closed, characteristic p > 0 residue field Kw . The full definition and development of the Lefschetz hull is rather technical, and the curious reader is referred to [AS07, Section 4] for the complete details. We include several statements and theorems below that will attempt to describe the properties of the Lefschetz hull that are of the greatest interest to us for this present article. By ([AS07, (4.21)]), there is a faithfully flat functorial map R → D(R). Given any r ∈ R, there is a corresponding element ulimw rw in D(R), where each rw ∈ Rw . The rw are called approximations of r. Also, D(R) is not necessarily Noetherian. BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 5 Given a local homomorphism R → S of equal characteristic zero local rings, choose K as above with sufficiently large cardinality compared to both rings. Again by ([AS07, (4.26)]), there exist faithfully flat Lefschetz hulls for both rings forming a commutative diagram / D(S) D(R) O O /S R We will consider this setup as our standing hypotheses on local equal characteristic zero rings and on local homomorphisms between them in the later sections. The sense in which the components Rw of the Lefschetz hull D(R) are characteristic p > 0 approximations of R is indicated by the following summary of results. Theorem 1.11. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in (1.10). (1) [AS07, (5.2.1)] Almost all Rw have the same dimension as R. (2) [AS07, (5.4)] A tuple x from R is a partial system of parameters for R if and only if xw is a partial system of parameters in Rw for almost all w. (3) [AS07, (5.17)] If R is a domain, then D(R) is a domain and Rw is a domain for almost all w. We close out this introduction with a very quick review of big Cohen-Macaulay algebras. Definition 1.12. Let (R, m) be a local ring of dimension d. An R-algebra B is a big Cohen-Macaulay algebra over R with respect to the system of parameters x1 , . . . , xd for R if x1 , . . . , xd forms a regular sequence on B and mB 6= B. We also call B a big Cohen-Macaulay algebra over R if the particular system of parameters is not relevant. An R-algebra B is a balanced big Cohen-Macaulay algebra over R if every system of parameters on R is a regular sequence on B and mB 6= B. As mentioned at the start of the paper, Hochster and Huneke [HH92] first proved the existence of balanced big Cohen-Macaulay algebras over excellent local rings R of characteristic p > 0 by showing that every system of parameters from R is a regular sequence on R+ . Hochster generalized this in [Ho94] by showing how to construct a balanced big Cohen-Macaulay algebra over R using systems of algebra Pk modifications. If S is an R-algebra, and sxk+1 = i=1 xi si is a relation in S on a partial system of parameters from R, then an algebra modification of S is T = S[U1 . . . , Uk ] P s − ki=1 xi Ui For characteristic p > 0 local rings R, a direct limit of algebra modifications can be built into a balanced big Cohen-Macaulay algebra over R. Before we proceed further, we note that the Cohen-Macaulay property is preserved by ultraproducts. The result below is a generalization of [Sch10, Theorem 6.4.7], which proves something similar for the specific case of absolute integral clo+ sures Rw and their ultraproducts. 6 GEOFFREY D. DIETZ AND REBECCA R.G. Lemma 1.13. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Suppose that B♮ = ulimw Bw , where Bw is an Rw -algebra. Then (a) B♮ is a big Cohen-Macaulay R-algebra with respect to a fixed system of parameters x if and only if Bw is a big Cohen-Macaulay Rw -algebra with respect to any choice of approximations xw for almost all w. (b) B♮ is a balanced big Cohen-Macaulay R-algebra if and only if for almost all w, Bw is a big Cohen-Macaulay algebra over Rw with respect to the approximations xw for all systems of parameters x of R. (c) If almost all Bw are balanced big Cohen-Macaulay Rw -algebras, then B♮ is a balanced big Cohen-Macaulay R-algebra. Proof. Let x be a sequence of elements from R with corresponding approximations xw in each of the Rw . By [AS07, Lemma 5.4], x is a system of parameters for R if and only if xw is a system of parameters for almost all of the Rw . By Los’ Theorem (or see the details of the proof for [AS07, Lemma 5.4]), x will be a regular sequence on B♮ if and only if xw is regular on Bw for almost all w. Thus, B♮ is big Cohen-Macaulay over R with respect to x if and only if for almost all w, Bw is big Cohen-Macaulay over Rw with respect to xw . Part (b) follows from part (a). The single direction for part (c) then follows from part (b) as any approximation of a system of parameters from R will be a system of parameters for almost all Rw .  The converse of part (c) is likely to be false, but we do not have an explicit counterexample. There is no a priori reason why a big Cohen-Macaulay Rw -algebra with respect to approximations xw of the systems of parameters of R should still be big Cohen-Macaulay over Rw with respect to all systems of parameters of Rw , i.e., not every system of parameters for Rw will necessarily arise as an approximation of a system of parameters from R. 2. Seeds in Equal Characteristic Zero Definition 2.1. Given a local ring (R, m), a seed S over R is an R-algebra S such that there exists an R-algebra map S → B where B is a (balanced) big CohenMacaulay R-algebra [D07]. Remark 2.2. By the result of Bartijn and Strooker [BS83], there is no harm in leaving off the adjective “balanced” as any big Cohen-Macaulay algebra (or module) can be modified into a balanced version by applying the m-adic separated completion. In order to apply a reduction to characteristic p method via ultraproducts, we find it necessary to set forth the following modified definition for rings of equal characteristic zero. Definition 2.3. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. An R-algebra S is called a rational seed if there exists an R-algebra map S → T♮ such that T♮ = ulimw Tw , where Tw is a seed algebra over Rw for almost all w. We will call the ultrarings T♮ ultraseeds. Rational seeds exist in equal characteristic zero. BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 7 Theorem 2.4. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Then R is a rational seed and D(R) is an ultraseed over R. Proof. Consider a Lefschetz hull D(R) and the approximations Rw in characteristic p. By [AS07, (4.2) and (5.17)] almost all of the Rw are complete, local domains of characteristic p and so can be mapped to balanced big Cohen-Macaulay Rw algebras Bw by [HH92, (5.15)] or [D07, (6.11)]. (For the cases where Rw is not a complete, local domain, set Bw to be the zero ring.) As almost all of the Rw rings are seeds over themselves, D(R) is an ultraseed over R. The map R → D(R) shows that R is a rational seed.  The following lemma provides alternative characterizations of rational seeds. In short, the lemma says that when working with a rational seed S, we can skip over the ultraseed T♮ and work directly with an ultraring B♮ that is also a (balanced) big Cohen-Macaulay R-algebra. Lemma 2.5. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Then the following are equivalent for an R-algebra S: (1) S is a rational seed over R. (2) There exists an R-algebra map S → B♮ such that B♮ is an ultraring and a balanced big Cohen-Macaulay R-algebra. (3) There exists an R-algebra map S → B♮ such that B♮ is an ultraring and a big Cohen-Macaulay R-algebra with respect to a fixed system of parameters from R. Proof. For (1) ⇒ (2), there is a map S → T♮ , where almost all approximations Tw are seeds over Rw . Thus, almost all of the Tw can be mapped to balanced big Cohen-Macaulay Rw -algebras Bw . Let B♮ be the ultraproduct of the Bw . Then the map S → T♮ and maps Tw → Bw induce a composite map S → B♮ . Moreover, Lemma 1.13(c) implies that B♮ is a balanced big Cohen-Macaulay R-algebra. The implication (2) ⇒ (3) is obvious. Finally, for (3) ⇒ (1) note that Lemma 1.13(a) implies that almost all of the approximations Bw are big Cohen-Macaulay Rw algebras for some fixed system of parameters from Rw and thus are seeds over Rw .  The next result indicates that R-algebras that are formed by algebra modifications of a rational seed are also rational seeds. Proposition 2.6. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Let S be a rational seed over R. Suppose that T is an S-algebra that is also a direct limit of algebra modifications of S with respect to relations on the systems of parameters of R. Then T is a rational seed. Proof. As T is a direct limit of algebra modifications of S, it maps to every Salgebra that is also a balanced big Cohen-Macaulay R-algebra [RG15]. Since S is a rational seed, Lemma 2.5 implies that there is a map S → B♮ , a balanced big Cohen-Macaulay R-algebra and an ultraring. Thus, there is a map T → B♮ , showing that T is a rational seed.  8 GEOFFREY D. DIETZ AND REBECCA R.G. Question 2.7. Are there R-algebra seeds S in equal characteristic zero that are not rational seeds? This question reduces to the question of whether there are big Cohen-Macaulay R-algebras in equal characteristic zero that do not arise from some reduction to characteristic p argument or from a sequence of algebra modifications but exist “intrinsically” over R. Answering this question one way or another would inform us about whether or not there is a difference between rational seeds and ordinary seeds. For the time being however, the notion of rational seed seems robust enough. We can also show that direct limits of ultraseeds are ultraseeds under certain conditions, paralleling [D07, Lemma 3.2]. To do so we need a lemma about direct limits and ultralimits. Unlike the analogous work in [D07], Lemma 2.8 and Proposition 2.9 are not used in deriving the remaining results in this article. Lemma 2.8. Let Λ be a directed set. Let W be an ultrafilter on an infinite set W . Suppose that for all w ∈ W and all λ ≤ µ ≤ ν ∈ Λ we have ring maps (µ) fw(λ,µ) : A(λ) w → Aw (ν) fw(µ,ν) : A(µ) w → Aw (λ,ν) fw (λ,ν) such that fw (µ,ν) = fw (λ,µ) ◦ fw (λ) (ν) : Aw → Aw (λ) . For all λ ∈ Λ let A♮ (λ) = ulim Aw , for all w ∈ W (λ) let Aw = limλ Aw , and let A♮ = ulim Aw . Then −→ (λ) A♮ = lim A♮ −→ λ in the category of ultrarings with respect to W, with morphisms maps of ultrarings. (λ,µ) Proof. First note that as the maps fw , etc. exist for all w ∈ W (and not just almost all w), the hypotheses on compositions of those maps induce analogous (λ) properties on maps f (λ,µ) in the directed system of ultrarings {A♮ }λ∈Λ by [Sch10, (λ) (2.1.7)]. Therefore, limλ A♮ exists in the category of ultrarings. −→ (λ) We will now prove that A♮ = limλ A♮ by showing A♮ satisfies the universal −→ mapping property of a direct limit in the category of ultrarings. Indeed, suppose that C♮ = ulim Cw is an ultraring and that for all λ ∈ Λ there exists a map of (λ) ultrarings ψ (λ) : A♮ → C♮ such that ψ (λ) = ψ (µ) ◦ f (λ,µ) for all λ ≤ µ in Λ. Therefore, for all w ∈ W we have maps (λ) (λ) (µ) (λ,µ) ψw : A(λ) w → Cw such that ψw = ψw ◦ fw for all λ ≤ µ in Λ. For each w ∈ W we apply the universal mapping property of (λ) direct limits to construct a map ψw : Aw → Cw as Aw = limλ Aw . As we have −→ maps for all w ∈ W , [Sch10, (2.1.7)] implies that we have a map ψ : A♮ → C♮ , (λ) which shows that A♮ is limλ A♮ in the category of ultrarings.  −→ Proposition 2.9. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Adopt the same notation and hypotheses of Lemma 2.8 for Rw -algebras (λ) (λ) (λ) Aw and Aw and ultrarings A♮ and A♮ = ulim Aw = limλ A♮ . Then A♮ is −→ BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 9 an ultraseed (i.e., Aw is a seed over Rw for almost all w) if and only if P = (λ) {w | Aw is a seed over Rw for all λ} is a set in the ultrafilter W on W . Proof. For the forward direction, note that if A♮ is an ultraseed, then the maps (λ) (λ) A♮ → A♮ in the direct limit system arise from maps Aw → Aw for all w, using the previous lemma to identify A♮ with ulim Aw . As the Aw are seeds over Rw for (λ) (λ) almost all w, for these values of w, the maps Aw → Aw imply that Aw is a seed over Rw for all λ, showing that the set P is in the ultrafilter W. Conversely, suppose that the set P is in the ultrafilter W. Then for almost (λ) all w we have that Aw is a seed over Rw for all λ. Hence for almost all w we (λ) have Aw = limλ Aw is a seed over Rw [D07, Lemma 3.2], which implies that −→ A♮ = ulim Aw is an ultraseed.  Remark 2.10. The proposition above, unlike most other results in this work, depends upon the choice of ultrafilter W. The subtlety lies in the fact that the set P in the statement is equal to the possibly infinite intersection of the sets (λ) (λ) Pλ = {w | Aw is a seed over Rw } . While each A♮ is an ultraseed if and only if Pλ is in the ultrafilter, the set P may or may not still live in the ultrafilter as ultrafilters need only be closed under finite intersections. There is no guarantee for infinite intersections. 3. Tensor Products and Base Change In this section we aim to prove the analogues of two major results from [D07]: tensor products of seeds are seeds and base change applied to a seed maintains the seed property. As both results relate to tensor products, we need an initial elementary lemma relating tensor products to ultraproducts. The result is a partial generalization of [AS07, Proposition 1.2] for tensor products of arbitrary modules. Lemma 3.1. Let A♮ be an arbitrary ultraring, i.e., an ultraproduct of (not necessarily Noetherian) commutative rings Aw . Let Mw and Nw be arbitrary (not necessarily finitely generated) Aw -modules. Then there exists a canonical map M♮ ⊗A♮ N♮ → ulim(Mw ⊗Aw Nw ). Proof. Let m♮ , m′♮ ∈ M♮ and n♮ ∈ N♮ with approximations mw , m′w , and nw , respectively. Define a map M♮ × N♮ → (Mw ⊗Aw Nw )♮ by sending (m♮ , n♮ ) 7→ ulim(mw ⊗ nw ). This map is well-defined on equivalence classes for m♮ or n♮ . Indeed, if m♮ = 0, then almost all mw = 0 and so (mw ⊗ nw ) = 0 for almost all w so that the ultraproduct is also 0. A similar situation holds when n♮ = 0. The map is also bilinear: we have (m♮ + m′♮ , n♮ ) = ((m + m′ )♮ , n♮ ) 7→ ulim((mw + m′w ) ⊗ nw ) = ulim(mw ⊗ nw ) + ulim(m′w ⊗ nw ). Similarly, the map is additive in the second coordinate. Finally, if a♮ ∈ A♮ with approximations aw , then (a♮ m♮ , n♮ ) = ((aw mw )♮ , n♮ ) 7→ ulim(aw mw ⊗ nw ) = a♮ · ulim(mw ⊗ nw ). By the universal mapping property of tensor products, we now have the desired  map M♮ ⊗A♮ N♮ → ulim(Mw ⊗Aw Nw ). 10 GEOFFREY D. DIETZ AND REBECCA R.G. Lemma 3.2. Let A♮ be an arbitrary ultraring, i.e., an ultraproduct of (not neces(i) sarily Noetherian) commutative rings Aw . Let Mw be arbitrary (not necessarily finitely generated) Aw -modules indexed set I. Then there exists a N by a common  N (i) (i) M . [Note that the first tensor product canonical map i∈I M♮ → ulim w i∈I has A♮ as its base ring while the second has the Aw rings as bases.] Proof. A similar argument to that above can be used to show that a similar map (i) defined on the arbitrary product Πi∈I M♮ is A♮ -linear in every coordinate, which then gives a map from the tensor product to the desired ultraproduct of tensor products.  We present one of our main theorems next, which shows that tensor products of rational seeds are also rational seeds, an analogue of [D07, Theorem 8.4]. Theorem 3.3. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as N in Discussion 1.10. Let (Si )i∈I be a finite family of rational seeds over R. Then i∈I Si (tensored over R) is also a rational seed. Consequently, if B♮ and B♮′ are (balanced) big Cohen-Macaulay R-algebras and ultrarings, then there exists a (balanced) big Cohen-Macaulay R-algebra and ultraring C♮ filling in the commutative diagram: B♮ O / C♮ O R / B′ ♮ (i) Proof. By the definition of rational seed, for each i ∈ I we have a map Si → T♮ (i) such that T♮ is an ultraproduct of Rw -algebras, almost all of which are seeds over Rw . As the set I is finite and a finite intersection of sets in an ultrafilter still lies (i) in the ultrafilter, we can say that almost all Tw are Rw -seeds across all i ∈ I simultaneously. (In other words, the “almost all w” is independent of the choice of N (i) i.) Thus for almost all w, we have that i∈I Tw (tensored over Rw ) is a seed over Rw by [D07, Theorem 8.4]. Finally note that we have maps ! O O (i) O (i) Si → T♮ → ulim Tw , i∈I i∈I i∈I where the first product uses R as base, the second uses D(R) as base, the third N uses Rw as base, and the last map follows from Lemma 3.2. This shows that i∈I Si is a rational seed. Now that we have established that tensor products of rational seeds are rational seeds, we can deduce the final claim by noting that B♮ and B♮′ are rational seeds by Lemma 2.5 and Lemma 1.13. As a result, there is a map B♮ ⊗R B♮′ → C♮ as the first part of the proof shows that B♮ ⊗R B♮′ is a rational seed, and Lemma 1.13 shows that there is a map to a balanced big Cohen-Macaulay R-algebra C♮ that is also an ultraring.  BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 11 Remark 3.4. The characteristic p > 0 version of the theorem above is true for arbitrarily large families of tensor products. We kept the equal characteristic zero version limited to finite families because of subtleties related to ultrafilters. One can conclude that an infinite tensor product of rational seeds is a rational seed as long as the set {w | Tw(i) is a seed over Rw for all i ∈ I} is a member of the ultrafilter. This is similar to the restriction applied in Proposition 2.9 earlier. We are also able to derive an equal characteristic zero version of [D07, Theorem 8.10], which will show that the rational seed property is stable under base change between local domains of equal characteristic zero. Theorem 3.5. Let R and S be local domains of equal characteristic zero with a local map R → S and Lefschetz hulls D(R) and D(S) with characteristic p > 0 approximations Rw and Sw as in Discussion 1.10. Suppose that T is a rational seed over R. Then T ⊗R S is a rational seed over S. Consequently, if B♮ is an ultraproduct and a big Cohen-Macaulay R-algebra, then there exists C♮ which is a balanced big Cohen-Macaulay algebra over S and an ultraproduct that fills in a commutative diagram: / C♮ B♮ O O R /S Proof. As T is a rational seed over R, there exists an R-linear map T → U♮ , where almost all Uw are seeds over the complete, local domains Rw of characteristic p > 0. By [D07, Theorem 8.10], we know that Uw ⊗Rw Sw is a seed over Sw for almost all w. Therefore ulim(Uw ⊗Rw Sw ) is an ultraseed over S. Note that we have S-linear maps: T ⊗R S → U♮ ⊗R S → U♮ ⊗D(R) D(S) → ulim(Uw ⊗Rw Sw ), where the last map follows from Lemma 3.1. This chain of S-algebra maps shows that T ⊗R S is a rational seed over S. In the special case that T = B♮ is a big Cohen-Macaulay R-algebra, B♮ ⊗R S will map further to an S-algebra C♮ with the desired properties by Lemma 2.5.  4. Other Properties of Seeds In this section we present two primary results, both of which are equal characteristic zero analogues of results from [D07]. The first result will characterize rational seeds in terms of “durable colon-killers” while the second will show that rational seeds can be mapped to balanced big Cohen-Macaulay algebras with a host of other nice properties. We start by restating the definition of durable colon-killer from [D07, Definition 4.7]. Definition 4.1. For a local ring (R, m) and an R-algebra S, an element c ∈ S is called a weak durable colon-killer over R if for some system of parameters x1 , . . . , xn of R, c((xt1 , . . . , xtk )S :S xtk+1 ) ⊆ (xt1 , . . . , xtk )S, 12 GEOFFREY D. DIETZ AND REBECCA R.G. for all 1 ≤ T k ≤ n − 1 and all t ∈ N, and if for each N ≥ 1, there exists a k ≥ 1 such that cN 6∈ k mk S. An element c ∈ S will be called a durable colon-killer over R if it is a weak durable colon-killer for every system of parameters of R. Notice that if S = R, then all colon-killers in R that are not nilpotent are durable colon-killers, and if R is reduced, all nonzero colon-killers are durable colon-killers. The following is an analogue of [D07, Theorem 4.8]. Theorem 4.2. Let (R, m) be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Then the following three properties are equivalent for an R-algebra S: (1) S is a rational seed. (2) There exists a map S → T♮ such that T♮ contains a durable colon-killer c. (3) There exists a map S → T♮ with element c ∈ T♮ such that c = ulim cw where cw is a weak durable colon-killer in almost all Tw . Moreover, property (4) below implies (1)–(3): (4) There exists a map S → T♮ with element c ∈ T♮ such that c = ulim cw where cw is a durable colon-killer in almost all Tw . Proof. (1) along with Lemma 2.5 imply that there exists S → B♮ such that B♮ is a balanced big Cohen-Macaulay R-algebra. Thus, (1) implies (2) using T♮ = B♮ and c = 1. (2) implies (3) when one takes approximations cw of c and applies Los’ Theorem. Indeed, fix a system of parameters x1 , . . . , xd for R and take approximations x1w , . . . , xdw in each Rw via D(R). Then almost all sequences x1w , . . . , xdw form a system of parameters in Rw by [Sch10, Corollary 4.3.8]. Powers of the system of parameters and their approximations are also systems of parameters for R and almost all Rw , respectively. By Los’ Theorem and the fact that c is a colon-killer, almost all cw will be weak colon-killers with respect to the powers of the T approximations of the system of parameters x. They will be durable as cN 6∈ k mk T♮ for all N implies that the same is true for almost all of the approximations cN w by Los’ T k N Theorem. Indeed, suppose that for some N we have cw ∈ k mw Tw for almost all w. As m is a finitely generated ideal, each inclusion can be specified equationally using polynomials and thus Los’ Theorem would imply that the same inclusion will hold for cN , a contradiction. We will show that (3) and (4) each imply (1) to complete the proof. By [D07, Theorem 4.8], (3) and (4) each imply that almost all of the Tw are seeds over Rw . Thus, the map S → T♮ shows that S is a rational seed.  We also present an analogue of [D07, Theorem 7.8] showing that rational seeds map to ultrarings with a host of other nice properties. Theorem 4.3. Let (R, m) be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. If S is a rational seed over R, then S maps to a quasilocal, absolutely integrally closed, m-adically separated, balanced big Cohen-Macaulay R-algebra domain B♮ . Proof. There exists a map S → T♮ such that almost all Tw are seeds over Rw . By [D07, Theorem 7.8], almost all of the Tw can be mapped to quasilocal, absolutely integrally closed, m-adically separated, balanced big Cohen-Macaulay Rw -algebra domains Bw . (Set Bw to be the zero ring for the cases where Tw is not a seed so that BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 13 there is still a map Tw → Bw .) By Lemma 1.13(c), we have that B♮ is a balanced big Cohen-Macaulay R-algebra with a composite map S → T♮ → B♮ induced by the maps Tw → Bw . Note that [Sch10, (2.4.10)] implies B♮ is a domain as almost all Bw are domains, and [Sch10, (2.4.8)] implies that B♮ will be quasilocal. To see that B♮ is also absolutely integrally closed, note that as the Bw are almost all absolutely integrally closed, all monic polynomials split in those Bw . Consider a monic polynomial in B♮ . Then almost all approximations over Bw will split. By Los’ Theorem, the original polynomial will split over B♮ as T well. Finally, to see that B♮ is m-adically separated, let b♮ ∈ k mk B♮ . TVia the Lefschetz hull D(R) and Los’ Theorem we obtain approximations bw ∈ k mkw Bw for almost all w. Due to the separation for almost all w, we have that bw = 0 for almost all w. Thus, b = 0 and so B♮ is m-adically separated.  5. Integral Extensions of Seeds We now show the final promised result: integral extensions of rational seeds are also rational seeds, which is an analogue of [D07, Theorem 6.9]. Theorem 5.1. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Let S be a rational seed over R, and let T be an integral extension of S. Then T is also a rational seed. Proof. Start with the integral extension S ֒→ T . We will expand this map into the diagram below, where I will be an ideal of S and U♮ will be an ultraseed domain. We will show that all vertical maps are integral extensions. / U♮ / S/I   S _ _ _  T  / T /IT  / T /IT ⊗S/I U♮ Indeed, by Theorem 4.3 the rational seed S maps to an ultraseed domain U♮ . (It actually has far more properties, but for this argument we only need it to be an ultraseed and a domain.) Let S/I be the homomorphic image of S within the domain U♮ , which implies that S/I is a domain and so I is a prime ideal of S. As S ֒→ T is integral, the induced map S/I → T /IT will still be integral. As I is a prime ideal (and hence integrally closed) and T is an integral extension of S, we have IT ∩ S = I and so S/I → T /IT remains injective as well. The existence of the two maps to T /IT ⊗S/I U♮ are then clearly established, but we need to show that the rightmost vertical map is an integral extension. The map is integral as it is a base change of the integral map S/I → T /IT (or S → T ). For injectivity, we appeal to the general lemma [D07, Lemma 6.2], which proves that given the integral extension S/I → T /IT and the domain (reduced is sufficient) extension S/I → U♮ , the vertical map on the right is also injective. In order to prove the theorem, it now suffices to prove that the ring T /IT ⊗S/I U♮ is a rational seed. Thus, we may reduce the whole problem to the case that S = U♮ is an ultraseed domain, and T = (U♮ )+ , the absolute integral closure of U♮ within an algebraic closure L♮ of the fraction field of U♮ . By [Sch10, Remark 2.4.4], L♮ is also Lefschetz. 14 GEOFFREY D. DIETZ AND REBECCA R.G. For almost all w, we have that Uw is a domain and a seed over Rw , a complete local domain of characteristic p > 0, and Lw is an algebraic closure of the fraction field of Uw . Thus, for almost all w we have the inclusions: Uw ֒→ (Uw )+ ֒→ Lw . By [D07, Theorem 6.9], almost all (Uw )+ will be seeds over Rw as they are integral extensions of the seeds Uw . Therefore, V = ulim((Uw )+ ) is an ultraseed over R. To finish the proof, we claim that V = (U♮ )+ within L♮ . Indeed, let v♮ ∈ V . Then almost all approximations vw live in (Uw )+ and satisfy a monic polynomial over Uw . Taking the ultralimit of the polynomials and applying Los’ Theorem shows that v♮ is the root of a monic polynomial over U♮ and so lives in (U♮ )+ . Conversely, let t ∈ (U♮ )+ . As t ∈ (U♮ )+ ⊆ L♮ , we have t = ulim tw where tw ∈ Lw . Also, t is the root of a monic polynomial over U♮ , so another application of Los’ Theorem shows that almost all tw are roots of the corresponding approximated monic polynomials over Uw . Therefore, almost all tw live in (Uw )+ within Lw , and so t lives in V = ulim((Uw )+ ) within L♮ .  We can then use this result to deduce an equal characteristic zero result about the absolute integral closure R+ of R, independent of Hochster and Huneke’s result that R+ is a balanced big Cohen-Macaulay algebra in characteristic p. Corollary 5.2. Let R be a local domain of equal characteristic zero. Then the absolute integral closure R+ of R is a rational seed over R. 6. Applications to tight closure in equal characteristic zero Using Theorems 3.3 and 3.5, we can define a closure operation on equal characteristic zero rings using balanced big Cohen-Macaulay algebras that are ultrarings formed from balanced big Cohen-Macaulay Rw -algebras. Definition 6.1. Let R be a local domain of equal characteristic zero with Lefschetz hull D(R) and characteristic p > 0 approximations Rw as in Discussion 1.10. Let cl N ⊆ M be R-modules. For u ∈ M , we say that u ∈ NM if 1 ⊗ u ∈ Im(B♮ ⊗R N → B♮ ⊗R M ) for some balanced big Cohen-Macaulay R-algebra B♮ that is an ultraproduct of balanced big Cohen-Macaulay Rw -algebras. As tight closure in characteristic p > 0 is equivalent to extension and contraction from some balanced big Cohen-Macaulay algebra ([Ho94, Theorem 11.1]), the operation above provides a way to transfer tight closure from characteristic p > 0 to equal characteristic zero. In [Sch03, Definition 5.2], Schoutens defines generic tight closure, which is similar to the operation above as both rely on the approximations of an element residing in characteristic p > 0 tight closure for almost all p. However, they may not be equal. We do have the following: Proposition 6.2. Let R be a local domain of equal characteristic zero with characteristic p > 0 approximations Rw as in Discussion 1.10. We can extend generic tight closure to finitely-generated R-modules as in [E12, Lemma 7.0.5]. Then the closure operation cl given in Definition 6.1 is contained in generic tight closure, i.e. g cl ⊆ NM , where g denotes generic for any finitely-generated R-modules N ⊆ M , NM tight closure. BIG C-M AND SEED ALGEBRAS . . . VIA ULTRAPRODUCTS 15 Proof. To show that generic tight closure can be extended to finitely-generated Rmodules, it suffices to note that both ultraproducts and tight closure commute with finite direct sums [E12, Lemma 7.0.5]. Let N ⊆ M be finitely-generated R-modules. By [Sch05, Section 2.5], they have approximations Nw and Mw , respectively, with ultraproducts N♮ = ulim Nw cl and M♮ = ulim Mw . Suppose that u ∈ NM . Then there is some balanced big Cohen-Macaulay R-algebra B♮ that is an ultraring, and such that 1 ⊗ u ∈ Im(B♮ ⊗R N → B♮ ⊗R M ). By Lemma 3.1, for any finitely-generated R-module Q, we have maps B♮ ⊗R Q → B♮ ⊗D(R) Q♮ → ulimw Bw ⊗Rw Qw . In particular, we have the following diagram: B♮ ⊗ R N / B♮ ⊗ R M  ulim Bw ⊗Rw Nw  / ulim Bw ⊗Rw Mw Since 1 ⊗ u is in the image of the first horizontal map, ulim 1w ⊗ uw is in the image of the lower horizontal map. Hence for almost every w, 1w ⊗ uw ∈ Im(Bw ⊗ Nw → Bw ⊗ Mw ). Hence, for almost all w, we have uw ∈ (Nw )∗Mw over Rw by [Ho94, Theorem 11.1]. g This implies that u ∈ NM , as desired.  Remark 6.3. The reverse inclusion of above is still murky. The stumbling block to a proof is that as B♮ is not finitely generated, for a finitely generated R-module Q we only have known maps B♮ ⊗R Q → ulimw Bw ⊗Rw Qw , but we would need the g cl reverse directions to prove that NM ⊆ NM . As any two B♮ as above map to a common balanced big Cohen-Macaulay algebra (Theorem 3.3) and we have a base change property (Theorem 3.5), the closure operation cl above can be shown to have a host of nice properties, including: persistence, colon-capturing, phantom acyclicity, and triviality of all closures over regular rings. Given Theorems 3.3 and 3.5, the proofs of these claims (and more) can be found in [D05, Chapter 7]. Further study of the properties of this closure operation is merited. Acknowledgments Our thanks to Neil Epstein, Mel Hochster, and Hans Schoutens who each took the time to read initial drafts of this work. We also thank the anonymous referee for many helpful suggestions that improved the exposition of the paper. References [AS07] M. Aschenbrenner and H. Schoutens, Lefschetz extensions, tight closure and big Cohen-Macaulay algebras, Israel J. Math. 161 (2007), 221–310. MR2350164 [BS83] J. Bartijn and J.R. Strooker, Modifications Monomiales, Séminaire d’Algèbre DubreilMalliavin, Paris 1982, Lecture Notes in Mathematics, 1029, Springer-Verlag, Berlin, 1983, 192–217. MR0732476 [D05] G. Dietz, Closure Operations in Positive Characteristic and Big Cohen-Macaulay Algebras, Thesis, Univ. of Michigan, 2005. MR2707771 16 GEOFFREY D. DIETZ AND REBECCA R.G. [D07] G. Dietz, Big Cohen-Macaulay algebras and seeds, Trans. Amer. Math. Soc. 359 (2007), no. 12, 5959–5989. MR2336312 (2008h:13021) [E12] N. Epstein, A guide to closure operations in commutative algebra, in: Progress in Commutative Algebra 2, Walter de Gruyter, Berlin, 2012, 1–37. MR2932590 [Ho93] W. Hodges, Model Theory, in: Encyclopedia of Mathematics and its Applications, vol. 42, Cambridge University Press, Cambridge, 1993. [Ho94] M. Hochster, Solid closure, in: Commutative Algebra: Syzygies, Multiplicities, and Birational Algebra, Contemp. Math. 159, Amer. Math. Soc., Providence, RI, 1994, 103–172. MR1266182 (95a:13011) [HH90] M. Hochster and C. Huneke, Tight closure, invariant theory, and the Briançon-Skoda theorem, J. Amer. Math. Soc. 3 (1990), 31–116. MR1017784 (91g:13010) [HH92] M. Hochster and C. Huneke, Infinite integral extensions and big Cohen-Macaulay algebras, Annals of Math. 135 (1992), 53–89. MR1147957 [HH95] M. Hochster and C. Huneke, Applications of the existence of big Cohen-Macaulay algebras, Adv. Math. 113 (1995), no. 1, 45–117. MR1332808 [RG15] R. R.G., Closure operations that induce big Cohen-Macaulay algebras, preprint, 2015: https://arxiv.org/abs/1512.07862 . [Sch03] H. Schoutens, Non-standard tight closure for affine C-algebras, Manuscripta Math. 111 (2003), no. 3, 379?412. MR1993501 [Sch05] H. Schoutens, Log-terminal singularities and vanishing theorems via non-standard tight closure, J. Algebraic Geom., 14 (2005), no. 2, 357–390. MR2123234 [Sch10] H. Schoutens, The use of ultraproducts in commutative algebra. Lecture Notes in Mathematics 1999, Springer-Verlag, Berlin (2010). MR2676525 Department of Mathematics, Gannon University, Erie, PA 16541 E-mail address: [email protected] Mathematics Department, Syracuse University, Syracuse, NY 13244 E-mail address: [email protected]
0math.AC
An Iterative Regression Approach for Face Pose Estimation from RGB Images Wenye He This paper presents a iterative optimization method, explicit shape regression, for face pose arXiv:1709.03170v1 [cs.CV] 10 Sep 2017 detection and localization. The regression function is learnt to find out the entire facial shape and minimize the alignment errors. A cascaded learning framework is employed to enhance shape constraint during detection. A combination of a two-level boosted regression, shape indexed features and a correlation-based feature selection method is used to improve the performance. In this paper, we have explain the advantage of ESR for deformable object like face pose estimation and reveal its generic applications of the method. In the experiment, we compare the results with different work and demonstrate the accuracy and robustness in different scenarios. Introduction Pose estimation is an important problem in computer vision, and has enabled many practical application from face expression 1 to activity tracking 2 . Researchers design a new algorithm called explicit shape regression (ESR) to find out face alignment from a picture 3 . Figure 1 shows how the system uses ESR to learn a shape of a human face image. A simple way to identify a face is to find out facial landmarks like eyes, nose, mouth and chin. The researchers define a face shape S and S is composed of Nf p facial landmarks. Therefore, they get S = [x1 , y1 , ..., xNf p , yNf p ]T . The objective of the researchers is to estimate a shape S of a face image. The way to know the accuracy 1 Figure 1: A final shape generated from the inital shape by ESR of the estimation is to minimize the alignment error. Equation 1 show how to find alignment error and used for the cascaded learning framework 4 . ||S − Ŝ|2 , (1) where Ŝ is the ground true shape of the image. Nevertheless, the true shape is unknown in testing procedure, so optimization-based method and regression-based method are the most popular approaches for this problem. The researchers use the regression-based method, and, then, they create the algorithm, ESR. Compared to most previous works, ESR does not use any parametric shape models. Considering all facial landmarks are regressed jointly, the researchers train the regressor by reducing the alignment error over training data. This regressor solve large shape variantions and guarantee robustness. Moreover, the researchers design the second regressor to solve small variantion and ensure accuracy. Besides, ESR used the improved version of the cascaded pose regression framework. The layer based regressor has also be adopted for many other applications, such as depth completion 6 . The next section goes over some related works. 2 Related Works In previous works, active appearance models5 (AAM) is one of influential models in alignment approaches. In 1998, Cootes et al. introduce AAM to interpret an image. In the same year, they publish how this model interpret face image7 and recognize face8 . In 2007, Saragih and Goechke10 propose a nonlinear discriminative approach to AAM. In 2010, Laurens and Emile11 make an extension of AAM to solve the large variation in face appearance. In 2011, Sauer and Cootes13 use random forest and boosting regression with AAM. In face alignment, regression-based method is a well-known one. In 2007, Cristinancce and Cootes14 construct constrained local models for face interpretion. In 2010, Valstar et al.15 apply boosted regression find facial features. Cascaded pose regressor (CPR) was originally derived from the boosted regression category 4 . CPR has also been successfully used for face detection in videos 12 . Method This section illustrates the ESR. A basic and essential terms are required to declared here, the normalized shape MS ◦ S. MS is produced from Equation 2 that looks for a M that can make S as close to as the mean shape S as possible. MS = argmin ||S − M ◦ S||2 , M (2) where S is the mean shape and S is an input shape. 1 T There are N training samples {Ii , Ŝi , Si0 }N i=1 , and the stage regressors (R , ..., R ). In every Stage 3 t, the stage regressor Rt is learnt like Equation 3. t R = argmin R N X ||yi − R(Ii , Sit−1 )||2 (3) i=1 yi = MSit−1 ◦ (Ŝi − Sit−1 ), where Sit−1 is the estimated shape in previous Stage t−1, and MSit−1 ◦(Ŝi −Sit−1 ) is the normalized regression target. In testing, in each Stage t, the normalized shape Sit is computed as follow, t−1 t Sit = Sit−1 + MS−1 ), t−1 ◦ R (Ii , Si (4) i where the normalized shape is updated by the regressor Rt from S t−1 . The normalization reduces the complication of the regression. Suppose there are two facial images, I1 and I2 with the estimated shape and I2 is transformed from I1 . The results of both regressions are different due to transformation. However, normalization, simplifying the problem, would give the same result in both regressions. Algorithem 1 below shows how ESR processing in both training and testing. In ESR training, the researchers initialize the training data, compute normalized targets and get the stage regressors. In the ESR testing, ther researchers initialize the testing data, normalize targets and output the shape using the regressor. In the initialization, the researchers has an InitSet composed of exemplar shapes which are viewed as representative shapes or groundtruth shapes from the training data. Each exemplar shape generates a number of initial shapes. The researchers’ implementation here is 20. The initialization returns a triple {Ii0 , Ŝi0 , Si0 }CD i=1 , the facial image, the groundtruth shape and the initial shape. Therefore, the number of a triple that has identical facial image and identical groundtruth shape is 20. 4 Algorithm 1 Explicit Shape Regression (ESR) Variables: Training images and labeled shapes {Il , Ŝl }Ll=1 ; ESR model {Rt }Tt=1 ; Testing image I; predicted shape S; T rainP arams{times of data augment Na ug, number of stages T }; T estP arams{number of multiple initializations Nint }; InitSet which contains exemplar shapes for initialization ESRTraining({Il , Ŝl }Ll=1 , T rainP arams, InitSet) // augment training data L {Ii , Si , Si0 }N i=1 ← Initialization({Il , Ŝl }l=1 , Naug , InitSet) for t from 1 to T do Y ← {MSit−1 ◦ (Ŝi − Sit−1 )}N i=1 // compute normalized targets Rt ← LearnStageRegressor(Y, {Il , Sit−1 )}N i=1 )// using Eq. (3) for i from 1 to N do t−1 t ) Sit ← Sit−1 + MS−1 t−1 ◦ R (Il , Si i end for end for return {Rt }Tt=1 ESRTesting(I, {Rt }Tt=1 , T estP arams, InitSet) //multiple initializations int {Ii , ∗, Si0 }N i=1 ← Initialization({I, ∗}, Nint , InitSet) for t from 1 to T do for i from 1 to Nint do t−1 t ) Sit ← Sit−1 + MS−1 t−1 ◦ R (Il , Si i end for end for int S ← CombineM ultipleResults({SiT }N i=1 ) return S Initialization({Ic , Ŝc }C c=1 , D, InitSet) i←1 for c from 1 to C do for d from 1 to D do Si0 ← sampling an exemplar shape from InitSet {Ii0 , Ŝi0 } ← {Ic , Ŝc } i←i+1 end for end for return {Ii0 , Ŝi0 , Si0 }CD i=1 5 To improve the performance of the experiments, the researchers introduce two-level boosted regression, external-level and internal-level. The stage regressor Rt is internal-level and is called primitive regressor. The number of iterations is T K, where T is the number of iterations in the external-level and K is that in the others. Figure 2 shows the tradeoffs between two level boosted regression. When the total iterations is 5000, the researchers find the lowest mean error as T = 10 and K = 500. Figure 2: Tradeoffs between two level boosted regression A fern16 is used as the internal-level regressor. Fern can be considered as pixel domain comparison in contrast to features, and can be used for image matching 9 . In the researchers’ implementation, a fern contains F = 5 features. Thus, the feature space and all training samples {ŷi }N i=1 are divided into 2F bins and every bin b means a regression output yb . The prediction of a bin is calculated like Equation 5, yb = argmin y X ||ŷi − y||2 , (5) i∈Ωb where the set Ωb implies the samples in the bth bin. The best solution is the average, P yb = i∈Ωb ŷi |Ωb | . (6) To solve the over-fitting problem, Equation 6 is revised into Equation 7. 1 yb = 1 + β/|Ωb | 6 P i∈Ωb |Ωb | ŷi , (7) where β is a free shrinkage parameter. Given that the final regressed shape S starts from the initial shape S 0 and updates by catching the information from the groundtruth shapes, S is computed like Equation 8, 0 S=S + N X wi Ŝi . (8) i=1 Before demonstrating the procedure of the internal-boosted regression, shape indexed features is introduced as an important ingredient in the regression. The researchers use pixel-difference features, which means the intensity difference of two pixels in the image. The extracted pixels are unchangeable to similarity transform and normalization. Each pixel is indexed by the local coorinate δ l = (δxl , δy l ), where l is a landmark associated with the pixel. Considering that pixels indexed by the same global coordinates may be variant because of different face shape while those in the same local coordinates are invariant though in different face shape (detail in Figure 3), the Figure 3: Left pair of images show the local coordinates and right pair of images show the global coordinates. The global coordinates have different meaning due to different images researchers find the local coordinates first and, then, turn them back to the global coordinates for the intensity difference of two pixels. The transform is showed in Euqation 9. πl ◦ S + MS−1 ◦ ∆l , 7 (9) where πl is the operator to get the x and y coordinates of a landmark from the shape. In Figure 3 and the explanation above, different samples has the identical δ l . Alogorithm 2 shows how the researchers get shape indexed features. In Algorithm 2, P numbers of pixels are generated, so Algorithm 2 Shape indexed features Variables: images and corresponding estimated shapes {Ii , Si }N i=1 ; number of shape indexed pixel features P ; number of facial points Nf p ; the range of local coordinate κ; local coordinates {∆lαα }Pα=1 ; shape indexed pixel features ρ ∈ <N ×P ; shape indexed pixel-difference features 2 X ∈ <N ×P ; GenerateShapeIndexedFeatures({Ii , Si }N i=1 , Nf p , P, κ) {∆lαα }Pα=1 ← GenerateLocalCoordinates(F eatureP arams) lα P ρ ← ExtractShapeIndexedP ixels({Ii , Si }N i=1 , {∆α }α=1 ) X ← pairwise difference of all columns of ρ return {∆lαα }Pα=1 , ρ, X GenerateLocalCoordinates(Nf p , P, κ) for α from 1 to P do lα ← randomly drawn a integer in [1, Nf p ] ∆lαα ← randomly drawn two floats in [−κ, kappa] end for return {∆lαα }Pα=1 lα P ExtractShapeIndexedPixels({Ii , Si }N i=1 , {∆α }α=1 ) for i from 1 to N do for α from 1 to P do µα ← πlα ◦ Si + MS−1 ◦ ∆lα i ρiα ← Ii (µα ) end for end for return ρ there are P 2 number of pixel-difference features. This makes a huge number of calculations. To optimize the performance and improve the efficiency, the researchers create a correlation-based feature selection to reduce unnecessary computations. The researchers selects F out of P 2 features to form a fern regressor. Two properities are required 8 for a good fern: high correlation between each feature in the fern and the regression target and low correlation between features enough to composed complementarily. They propse Equation 10 to maximizing feature’s correlation: jopt = argminj corr(Yprob , Xj ), (10) where Y is the regression target with N rows and 2Nf p columns, and X is pixel-difference features matrix with N rows and P 2 columns. N is the number of samples. Each column Xj of feature matrix represents a pixel-difference feature. yprob means a projection Y into a column vector from unit Gaussian. The researchers write a pixel-difference feature as ρm − ρn , and they get Equation 10 about the correlation below: corr(Yprob , ρm − ρn ) = corr(Yprob , ρm ) − corr(Yprob , ρn ) p σ(Yproj )σ(ρm − ρn ) (11) σ(ρm − ρn ) = cov(ρm , ρm ) + cov(ρn , ρn ) − 2cov(ρm , ρn ). The pixel-pixel covariances σ(ρm − ρn ) can be pre-computed and reused with in each internallevel boosted regression due to fixity of the shape indexed pixels, which reduces the complexity from O(N P 2 ) to O(N P ). Algorithm 3 is the method to selecting correlatioin-based feature. After introduction of shape indexed features and correlation-based feature selection, the internalboosted regression is explained in Algorithm 4. The regression consists of K primitive regressors {r1 , ..., rK }, which are ferns. F thresholds are sampled randomly from an uniform distribution provided the range of pixel difference feature is [−c, c], the range of the uniform distribution is [−0.2c, 0.2c]. In each iteration a new primitive regressor is learn from the residues left by previous regressors. 9 Algorithm 3 Shape indexed features Input: regression targets Y ∈ <N ×2Nf p ; shape indexed pixel features ρ ∈ <N ×N ; pixel-pixel covariance cov(ρ) ∈ <P ×P ; number of features of a fern F ; Output: The selected pixel-difference features {ρmf − ρnf }Ff=1 and the corresponding indices {mf , nf }Ff=1 ; CorrelationBasedFeatureSelection(Y, cov(ρ), F ) for f from 1 to F do v ← randn(2Nf p , 1) // draw a random projection from unit Gaussian Yprob ← Yv // random projection cov(Yp rob, ρ) ∈ <1×P ← compute target-pixel covariance σ(Yprob ) ← compute sample variance of Yprob mf = 1; nf = 1; for m from 1 to P do for n from 1 to P do corr(Yprob , ρm − ρn ) ← compute correlation using Eq.(11) if corr(Yprob , ρm − ρn ) > corr(Yprob , ρmf − ρnf ) then mf = m; nf = n; end if end for end for end for return {ρmf − ρnf }Ff=1 , {mf , nf }Ff=1 10 Algorithm 4 Internal-level boosted regression Variables: regression targets Y ∈ <N ×2Nf p ; training images and corresponding estimated shapes {Ii , Si }N i=1 ; training parameters T rainP arams{Nf p , P, κ, F, K}; the stage regressor R; testing image and corresponding estimated shape {I, S}; LearnStageRegressor(Y, {Ii , Si }N i=1 , T rainP arams) lα P {∆α }α=1 ← GenerateLocalCoordinates(Nf p , P, κ) lα P ρ ← ExtractShapeIndexedP ixels({Ii , Si }N i=1 , {∆α }α=1 ) cov(ρ) ← pre-compute pixel-pixel covariance Y 0 ← Y // initialization for k from 1 to K do {ρmf − ρnf }Ff=1 , {mf , nf }Ff=1 ← CorrelationBasedFeatureSelection(Y k−1 , cov(ρ), F ) {θf }Ff=1 ← thresholds from an uniform distribution F {Ωb }2b=1 ← partition training samples into 2F bins F {yb }2b=1 ← randomly drawn two floats in [−κ, kappa] compute the outputs of all bins using Eq.(7) F rk ← {{mf , nf }Ff=1 {θf }Ff=1 , {yb }2b=1 } //construct a fern Yk ← Y k−1 − rk ({ρmf − ρnf }Ff=1 ) //update the targets end for lα P R ← {{rk }K k=1 , ∆α }α=1 } //construct stage regressor return R ApplyStageRegressor(I, S, R) // i.e. R(I, S) ρ ← ExtractShapeIndexedP ixels({I, S}, {∆lαα }Pα=1 ) δS ← 0 for k from 1 to K do δS ← δS + rk ({ρmf − ρnf }Ff=1 ) end for return δS 11 Experiments and results The researchers compare their approach to previous approaches. Figure 4-6 show samples of images from different datasets. Figure 4: Selected results from LFPW Figure 5: Selected results from LFPW87 Comparison with CE on LFPW Compared to the consensus exemplar approach17 on LFPW17 , ESR has more than 10% accurate on most landmarks estimation and smaller overall error. 12 Figure 6: Selected results from Helen dataset Figure 7: 29 facial landmarks on the left image. The radius of circle implies the average error of ESR. The color of the circles suggests accuracy improvement over the CE method. Green has more than 10% accuracy, while cyan has lass than 10% accuracy. The bar graph shows the different accuracy between two methods among all landmarks. The small table shows average error of all landmarks in both methods Comparison with CDS on LFPW87 A component-based discriminative search (CDS)18 method is proposed by Liang et al.18 ESR beats CDS due to lower error rate. Figure 8: Percentages of test images with root mean square error less than given thresholds on the LFW87 dataset Comparison with STASM and CompASM on Helen ESR has around 40% − 50% lower mean error on Helen dataset19 than STASM20 and CompASM19 have. 13 Figure 9: Different errors in ESR, STASM and CompASM Reference 1. S.B. Gokturk, J.-Y. Bouguet, “Model-based face tracking for view-independent facial expression recognition, ” Automatic Face and Gesture Recognition, pp. 55- 37, 2012. 2. J. Shen and J. Yang, “Automatic human animation for non-humanoid 3d characters,” International Conference on Computer-Aided Design and Computer Graphics (CAD/Graphics), pp. 220-221, 2015. 3. Cao, Xudong, et al. ”Face alignment by explicit shape regression.” International Journal of Computer Vision 107.2 (2014): 177-190. 4. Dollr, Piotr, Peter Welinder, and Pietro Perona. ”Cascaded pose regression.” Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on. IEEE, 2010. 5. Cootes, Timothy F., Gareth J. Edwards, and Christopher J. Taylor. ”Active appearance models.” European conference on computer vision. Springer Berlin Heidelberg, 1998. 6. J. Shen and S. C. S. Cheung, “Layer Depth Denoising and Completion for Structured-Light RGB-D Cameras,” IEEE Conference on Computer Vision and Pattern Recognition, pp. 11871194, 2013. 14 7. Edwards, Gareth J., Christopher J. Taylor, and Timothy F. Cootes. ”Interpreting face images using active appearance models.” Automatic Face and Gesture Recognition, 1998. Proceedings. Third IEEE International Conference on. IEEE, 1998. 8. Edwards, Gareth, Timothy Cootes, and Christopher Taylor. ”Face recognition using active appearance models.” Computer VisionECCV98 (1998): 581-595. 9. J. Shen and W. Tan, “Image-based indoor place-finder using image to plane matching,” IEEE International Conference on Multimedia and Expo, pp. 1-6, 2013. 10. Saragih, Jason, and Roland Goecke. ”A nonlinear discriminative approach to AAM fitting.” Computer Vision, 2007. ICCV 2007. IEEE 11th International Conference on. IEEE, 2007. 11. Van Der Maaten, Laurens, and Emile Hendriks. ”Capturing appearance variation in active appearance models.” Computer Vision and Pattern Recognition Workshops (CVPRW), 2010 IEEE Computer Society Conference on. IEEE, 2010. 12. R. Liu, J. Shen, Q. Sun, J. Yang, S. C. S. Cheung, “Cascaded Pose Regression Revisited: Face Alignment in Videos,” IEEE Third International Conference on Multimedia Big Data (BigMM), pp. 291-298, 2017. 13. Patrick Sauer, Tim Cootes and Chris Taylor. Accurate Regression Procedures for Active Appearance Models. In Jesse Hoey, Stephen McKenna and Emanuele Trucco, Proceedings of the British Machine Vision Conference, pages 30.1-30.11. BMVA Press, September 2011. http://dx.doi.org/10.5244/C.25.30 15 14. Cristinacce, David, and Timothy F. Cootes. ”Boosted regression active shape models.” BMVC. Vol. 2. 2007. 15. Valstar, Michel, et al. ”Facial point detection using boosted regression and graph models.” Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on. IEEE, 2010. 16. Ozuysal, Mustafa, et al. ”Fast keypoint recognition using random ferns.” IEEE transactions on pattern analysis and machine intelligence 32.3 (2010): 448-461. 17. Belhumeur, Peter N., et al. ”Localizing parts of faces using a consensus of exemplars.” IEEE transactions on pattern analysis and machine intelligence 35.12 (2013): 2930-2940. 18. Liang, Lin, et al. ”Face alignment via component-based discriminative search.” Computer VisionECCV 2008 (2008): 72-85. 19. Le, Vuong, et al. ”Interactive facial feature localization.” Computer VisionECCV 2012 (2012): 679-692. 20. Milborrow, Stephen, and Fred Nicolls. ”Locating facial features with an extended active shape model.” European conference on computer vision. Springer Berlin Heidelberg, 2008. 16
1cs.CV
Automatic Coding Rule Conformance Checking Using Logic Programs ⋆ arXiv:0711.0344v1 [cs.PL] 2 Nov 2007 Guillem Marpons1 , Julio Mariño1 , Ángel Herranz1 , Lars-Åke Fredlund1 , Manuel Carro1, and Juan José Moreno-Navarro1,2 1 2 Universidad Politécnica de Madrid IMDEA Software {gmarpons,jmarino,aherranz,lfredlund,mcarro,jjmoreno}@fi.upm.es Some approaches to increasing program reliability involve a disciplined use of programming languages so as to minimise the hazards introduced by error-prone features. This is realised by writing code that is constrained to a subset of the a priori admissible programs, and that, moreover, may use only a subset of the language. These subsets are determined by a collection of so-called coding rules. Standard coding rule sets exist that target different languages (e.g. MISRA-C for the C language or HICPP for C++) and application domains. Some organisations do set up their own coding rule sets. A major drawback of actual coding rule sets is that they are written in natural language, which bears ambiguity and undermines any effort to enforce them automatically. This work aims at defining a framework to formalise coding rules and check for conformity with them, using logic programming. It is part of the Global GCC project (http://www.ggcc.info/), an ITEA funded EU programme intended to enrich the GNU Compiler Collection with advanced project-wide analysis capacities. The overwhelming diversity of rules (they range from being trivially enforceable to expressing non-computable properties) has obliged us to focus first on a particular class that we have termed structural rules: those which deal with static entities in the code (classes, member functions, etc.) and their properties and relationships (inheritance, overriding, etc.) We have identified a significant number of rules of this kind that can be statically checked, being at the same time more interesting than those purely syntactic. Rules are formalised using first order logic: relationships between program entities are encoded as facts (thus giving an abstract description of the program) and a formula is generated for every coding rule. When these, together, are inconsistent, the program violates the coding rule. We automate this process by generating a program-dependent set of Prolog facts and program-independent predicates which describe rule violations. For example, a violation of rule 3.3.15 of HICPP, which reads “ensure base classes common to more than one derived class are virtual ”, is codified as: v i o l a t e _ h i c p p _ 3 _ 3 _ 1 5(A ,B ,C , D ) : - class ( A ) , class ( B ) , class ( C ) , class ( D ) , B \= C , d i r e c t _ b a s e _ o f(A , B ) , d i r e c t _ b a s e _ o f(A , C ) , base_of (B , D ) , base_of (C , D ) , \+ v i r t u a l _ b a s e _ o f(A , C ). Successful queries to this predicate pinpoint infringements of the rule and the answer substitutions identify a source of the violation. As rule-writers may not be proficient in Prolog, we provide a user-friendly domainspecific language (DSL) that also increases expressiveness by, e.g., allowing quantification over some specific domains or providing facilities for defining closures. At the DSL core there is a set of predefined predicates describing (structural) program properties, such as those used in the above rule, that are gathered during the compilation process. ⋆ Work partially supported by Spanish Ministry of Industry PROFIT grants FIT340005-2007-7 and FIT-350400-2006-44, Comunidad Autónoma de Madrid grant S0505/TIC/0407 (PROMESAS), Ministry of Education and Science grant TIN200509207-C03-01 (MERIT/COMVERS) and EU IST FET grant IST-15905 (MOBIUS).
6cs.PL
arXiv:1711.03026v1 [cs.SY] 8 Nov 2017 Intelligent Fault Analysis in Electrical Power Grids Biswarup Bhattacharya Abhishek Sinha Department of Computer Science University of Southern California Los Angeles, CA 90089. USA. Email: [email protected] Adobe Systems Incorporated Noida, UP 201301. India. Email: [email protected] Abstract—Power grids are one of the most important components of infrastructure in today’s world. Every nation is dependent on the security and stability of its own power grid to provide electricity to the households and industries. A malfunction of even a small part of a power grid can cause loss of productivity, revenue and in some cases even life. Thus, it is imperative to design a system which can detect the health of the power grid and take protective measures accordingly even before a serious anomaly takes place. To achieve this objective, we have set out to create an artificially intelligent system which can analyze the grid information at any given time and determine the health of the grid through the usage of sophisticated formal models and novel machine learning techniques like recurrent neural networks. Our system simulates grid conditions including stimuli like faults, generator output fluctuations, load fluctuations using Siemens PSS/E software and this data is trained using various classifiers like SVM, LSTM and subsequently tested. The results are excellent with our methods giving very high accuracy for the data. This model can easily be scaled to handle larger and more complex grid architectures. I. I NTRODUCTION Power grids are now been considered to be one of the important components of infrastructure on which the modern society depends. The primary objective of power system operation is to supply uninterrupted power to the customers. But small and large scale faults and disturbances in the grid often cause power outages and thereby affect the system reliability and customer satisfaction. Electrical power grids are huge systems, especially at the national level. The “synchrophasors project” in India [1] has been deployed with the help of which system operators are now able to monitor the magnitude and angle of each phase of the three phase voltage and current, frequency, rate of change of frequency and angular separation at every few millisecond intervals (40 milliseconds) at a Load Dispatch Centre (LDC). Thus the transient or dynamic behavior of the power system can be observed in near real-time at the control centre which hitherto was possible only in offline mode in the form of Substation Disturbance Records or through offline dynamic simulations performed on network models. A phasor measurement unit (PMU) is a device which measures the electrical waves on an electricity grid using a common time source for synchronization. PMUs provide us with a huge amount of data [2] and monitoring such huge data manually is an infeasible task. Thus, automated algorithms are required for monitoring the power grids, determining the health of the grid and performing intelligent fault analysis in real-time. The importance of fault analysis lies in the fact that electrical faults cause maintenance issues, financial losses for companies and general inconvenience to consumers. Typically, electrical faults take multiple hours, if not days, to repair. Such kind of inefficient infrastructure causes a lot of problems to commercial establishments and households as almost all civilizations are nowadays heavily dependent on electricity to perform almost every task. Thus, with the help of intelligent fault analysis, one can, in a way, predict faults before they are just about to happen so as to ensure that the relays and the protective infrastructure in the power grid switch on in time and function as required. With accessibility to cutting edge technologies like recurrent neural networks, such kind of prediction capabilities are now possible to be performed within milliseconds and with high accuracy. Machine learning and deep learning models have been explored in mild detail previously in research literature, however we demonstrate with clarity that neural networks can indeed perform extremely well when applied in power system domains and especially electrical fault analysis. The approach we have used is such that it can even be scaled up to handle all grid sizes, from the small simulator grids to large real grids, like the Indian electricity grid, and can be deployed in the real world. II. R ELATED W ORK Majority of the literature that exists on fault analysis is usually focused on numerical optimization techniques and statistical techniques. Relevant literature does exist for the kind of work, though sparingly, where some have applied artificial intelligence techniques on power systems to derive various relations. However, the methodology adopted by us using state-of-the-art techniques and achieving great accuracy has not been attempted before. Some of the existing literature on fault analysis are discussed here. In [3], a scheme was proposed which first identifies fault locations using an iterative estimation of load and fault current at each line section and then an actual location is identified, applying the current pattern matching rules. In [4], expert system for the diagnosis of faults was discussed. In [5], the paper proposes alternatives to improve the electric power service continuity using the learning algorithm for ©2017 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. DOI: 10.1109/ICTAI.2017.00151 multivariable data analysis (LAMDA) classification technique to locate faults in power distribution systems. This was a data analytic approach to find location of faults whereas we are using a machine learning technique. With respect to AI approaches, in [6], the authors discuss their experience of developing a multi-agent system that is robust enough for continual online use within the power industry. In [7], the paper presents an artificial neural network (ANN) and support vector machine (SVM) approach for locating faults in radial distribution systems. Our approach is novel compared to this paper as we realized that long short-term memories (LSTMs) may be the better way to represent time series voltage and angle data and the hypothesis has been confirmed by our experiments. Short Term Memory) network, is used to take care of long time dependencies. Each LSTM cell gives as an output the hidden state till and the output vector at that point of time [11]. The LSTM cell structure is shown in Figure 2. Fig. 2. Basic structure of a LSTM cell (image from [12]) III. BACKGROUND & P RELIMINARIES A. Support Vector Machines (SVM) In machine learning, support vector machines (SVMs) are supervised learning models that analyze data and provide output for classification and regression analysis [8]. SVM is a non-probabilistic binary linear classifier, such that it classifies examples to be falling into one of two classes. The SVM margin, which is the separation between the two classes, is trained to be as optimal as possible. New examples are then mapped into that same training space and predicted to belong to one of the classes depending on which side of the hyperplane they fall in. B. Recurrent Neural Networks (RNN) The idea behind RNNs is to make use of sequential information. In a traditional neural network, it is assumed that all inputs and outputs are independent of each other. However, that may not be a useful choice of architecture always. For example, when trying to predict words that will come in a sentence, it is important to consider the words that came before, thereby incorporating a type of “temporal” or “sequential” aspect to the learning process. RNNs are called recurrent because they perform the same task for every element of a sequence, with the output being depended on the previous computations. RNNs have a “memory” which captures information about what has been calculated so far [9]. A typical RNN structure has been shown in Figure 1. IV. P ROBLEM D ESCRIPTION In the current situation of Indian electrical power grids, when a small disturbance is seen at a dispatch center, then the norm is to generate a report and check with other dispatch centers. If the disturbance is found to be local, then it is ignored. Else, if it is found to be correlated (similar disturbances observed at other dispatch centers), then further diagnostics are conducted. Our goal is to perform this fault analysis automatically using machine learning. We aim to monitor the grid continuously and then in the case of a fault determine the type of the fault as and when it occurs. Apart from just predicting the nature of the fault we aim to give further insight into the fault such as in which bus line the fault had been triggered. The entire process has to be done automatically using machine learning techniques without using any human supervision and using just the current as well as past states of the grid as an input. V. DATASET A. Software for Data Collection The experiments required the use of power grid and power system data. For our simulation and testing purposes, we used simulation data from the Siemens PSS/E software [13] and PowerWorld Simulator [14]. The Siemens PSS/E software package can do fast and robust power flow solution for network models up to 200,000 buses. It has an array of features useful for dynamic and transient analysis. It also has an useful scripting system named psspy. Using psspy, one can use the modules of PSS/E remotely through Python. We used this scripting system for porting data, simulating and creating the dataset. B. Methodology Fig. 1. A recurrent neural network and the unfolding in time (image from [10] Since in practice RNNs are limited in the span of time they can look back to, a variant of it, called as a LSTM (Long 1) Inputs and Disturbances: One can modify a huge number of parameters through PSS/E. However, for our analysis, we focused on mainly the power injection and load values at each bus. Keeping in mind our goal, it made sense to vary only the power values (real & reactive) as that will correspond to a change in the bus voltages and angles. Using these bus voltages and angles, we can perform our analysis. Using psspy, we changed the power input and load at every bus at a certain timestamp suddenly during the simulation. This essentially mimics the fluctuations which happens in the real grids all the time. The value of the fluctuation was distributed along a uniform distribution with suitable upper and lower limits. Hence, the fluctuation could be very small in one bus whereas very large in another bus. We also made sure that no bus becomes totally disconnected in the grid due to too high fluctuations, as that essentially corresponds to a fault. The network (electric grid) used by us consisted of 23 buses with 6 generators and 8 loads at various buses throughout the network. The base frequency used was 50 Hz which is the standard for India. The base MVA for the network was 100 MVA. 2) Outputs: In the PMUs, one can measure the values of voltage and angle in real time. Hence, given the inputs and disturbances, we logged the voltage and angle at every bus at every timestamp. The logging was done at every 40 ms which mimics the actual metering done by the PMUs. For every simulation, the data was collected for upto 4 seconds of simulation time to capture the transient and also observe the changes due to generator or load fluctuations and faults suitably. 3) Simulating the faults: In an electric power system, a fault or fault current is any abnormal electric current [15]. For example, a short circuit is a fault in which current bypasses the normal load. An open-circuit fault occurs if a circuit is interrupted by some failure. In three-phase systems, a fault may involve one or more phases and ground, or may occur only between phases. In a “ground fault” or “earth fault”, current flows into the earth. The prospective short circuit current of a predictable fault can be calculated for most situations. In power systems, protective devices can detect fault conditions and operate circuit breakers and other devices to limit the loss of service due to a failure. In a polyphase system, a fault may affect all phases equally which is a “symmetrical fault”. If only some phases are affected, the resulting “asymmetrical fault” becomes more complicated to analyze. The analysis of these types of faults is often simplified by using methods such as symmetrical components. For our analysis, we focused on simulating the symmetrical faults and unsymmetrical faults. The faults simulated were namely: • • • • 3φ bus fault: This is a symmetrical fault as it affects all the phases at a bus equally. Branch Trip fault: This is a symmetrical fault which trips the transmission line (all 3 phases) between two buses. LL fault: This is an unsymmetrical fault and it short circuits two phases (in PSS/E, these are Phase A and Phase B). LG fault: This is an unsymmetrical fault and it short circuits one phase (in PSS/E, this is Phase A) with the ground. Fig. 3. A typical voltage varying voltage plot for a particular bus line in the presence of a fault The voltage profile during a fault is shown in Figure 3. The fault was initiated and subsequently cleared at points during the simulation pre-decided by the data generator. This was however not known to the classifier built and the classifier was able to predict this time of initiation and clearing of faults without this knowledge simply by learning the data collected. C. Data Collected We collected data for all the 4 fault types with generator or load fluctuations as specified. We simulated every type of fault when the fault occurs at each individual bus. Thus, this translates to data corresponding to 23 buses for all 4 types of faults. For each bus, the simulation was run 100 times to generate different variations so that there are enough examples. Also, there were examples which consisted of just the generator or load fluctuations, and no faults so as to make the machine learn to differentiate between the allowed generator or load fluctuations and the fault conditions. Each training example consisted of the volt and angle information for the particular bus at timestamps ranging from 0 seconds to 4 seconds with an interval of 0.04 seconds. The amount of time required to generate the data on the server provided to us was around 20 minutes per bus per fault (100 simulations per bus). VI. F ORECASTING THE MAXIMUM VOLTAGE DEVIATION USING PRE - FAULT DATA A. The Model The data corresponding to a network having 23 different buses and subjected to transmission fault (line trip) was obtained. A neural network model [16] was constructed to predict the maximum voltage deviations corresponding to each bus line just by looking at the pre-fault state of the network. The model consists of 2 hidden layers consisting of 60 and 40 neurons respectively. The input to the model is a vector of size equal to the number of bus lines corresponding to the pre-fault voltage data of each bus. Since the post fault voltage value will depend on the states of each of the buses, thus the prediction for each bus is not done independently, but rather the forecasting of entire network is done simultaneously. The output is of the same size as the input and contains the forecasted voltage value for each bus. The data was divided into 80% training and 20% test data and the results were obtained on test set after having trained the model on training data. The model used by us has been shown in Figure 4. Fig. 6. Variation of voltage value in presence of LL fault Fig. 4. Model for prediction of maximum voltage deviation after fault triggering (image adapted from [17]) B. Results After 2000 steps of training the following losses were obtained between the actual output and predicted output corresponding to the network. The mean L2 error was equal to 2.8 × 10−3 and the mean L1 error was equal to 2.3 × 10−2 . The plot of L2 error with progress of training has been shown in Figure 5. Fig. 7. Variation of voltage value in presence of LG fault B. Classification using LSTM (Recurrent neural network) Fig. 5. Variation of L2 -error with progress of training VII. C LASSIFICATION OF FAULTS Classification of faults given the entire network data was done for the case of LL (line to line) and LG (line to ground) faults. The voltage data corresponding to 100 different time steps and for each of the bus lines present in the network are given as an input to the classifier. The classifier gives an output probability corresponding to the two fault classes. The variation of voltage values in the presence of LL and LG faults have been shown in Figures 6 and 7 respectively. A. Classification using SVM Out of the 2300 data examples available per fault, 2000 were used for training while the rest 300 were used for testing. The input to the SVM model was the voltage & angle data of all the buses for 100 time steps. The output of the SVM classifier was the fault type or class. The classification accuracy on the test set was observed to be around 87-88% for SVM classifier. The above SVM model had a major disadvantage in the sense that it did not utilize the information present in the data. It is the variation of voltage with time that tells us as to what fault had occurred in the network. However the data was presented just as a normal vector to the model. To utilize this time varying information models need to be constructed which take data in accordance with the variation of data with the time and this is where recurrent neural networks (RNN) come into play. 1) The Model: The model consists of 100 unfoldings in time of LSTM cells corresponding to 100 time varying voltage values for each of the bus. Each LSTM cell gets a vector of size equal to the number of buses corresponding to the voltage values of the buses at that time step. Both the hidden vector and output vectors are of size 128. The output vector of the last cell contains the temporal information present in the entire data. This information extracted can then be further used to classify the type of fault. For the classification of faults from the information obtained from LSTM a second model is built entirely of fully connected layers. The model consists of 1 hidden layer consisting of 64 neurons followed by an output layer of size 2. The output obtained determines the probability of the fault belonging to LL or LG class. The model has been described by a block diagram (Figure 8). A. The Model Fig. 8. Model using LSTM for classification of faults C. Results With LSTM the classification accuracy jumped to 94-95%, an improvement of around 6% from the SVM model. The plot of accuracy and loss with training have been shown in Figures 9 and 10. The data input to the classifier was again the voltage data corresponding to each of the bus lines for the 100 different steps. The classifier was trained to output the bus number corresponding to where the fault had been triggered or an output of 0 if the network data corresponded to non-faulty one whereby no fault had been triggered on any bus line. LSTM was again used to extract meaningful time dependent information from the data which was then used to correctly classify the data via fully connected neural network layers. The fully connected layer consisted of one hidden layer consisting of 128 neurons. The output size was one more than the number of bus lines present in the network. The plots of the bus line in which the fault had been triggered and the other bus line where the fault had not been triggered have been shown in Figure 11. Fig. 9. Variation of cross entropy loss with training Fig. 11. Blue line: Voltage variation with time for the bus line in which fault was triggered; Red line: Voltage variation with time for the bus line in which no fault was triggered B. Results Fig. 10. Variation of training accuracy with progress of training For the 3φ fault, the classifier gave an accuracy of 97% corresponding to predicting the bus number. The bus number was outputted or classified as “0” in case of non-faulty data. For the LL fault the accuracy was also 97%. The plots of accuracy and loss with progress of training for LL fault have been shown in Figures 12 and 13. VIII. L OCATION OF BUS LINE IN WHICH FAULT WAS TRIGGERED Once the type of fault had been determined by the classification model, different models were constructed for each of the different fault types to determine the bus line in which the fault had been triggered. Again the voltage variations of the network with time can be used to find out the bus number. This classification task was done for both 3-phase (3φ) and LL faults. The source of the fault (if any) was not part of the input for obvious reasons. This model is essential as often it is necessary to find out the location of the fault given just the PMU voltage graphs data. Fig. 12. Variation of training accuracy with progress of training vulnerability of the grid, issues like load shedding, power surges etc. can be handled efficiently. With time, the system will have the ability to be more sophisticated to handle various types of networks and situations which will be suitable for deployment at the national level. ACKNOWLEDGMENT The authors were undergraduate students of the Indian Institute of Technology (IIT) Kharagpur, West Bengal, India during the period of research for this project which culminated in this paper. The authors would like to thank the institute for their support. Fig. 13. Variation of training loss with progress of training IX. F URTHER W ORK & C ONCLUSION In conclusion, we created a grid to perform intelligent fault analysis where we forecasted the maximum voltage deviation using pre-fault data, classified the type of faults and found out the location of the fault, all using machine learning and deep learning techniques. The different models are inter-related as given the PMU data in crisis situations, running the above models will give a great deal of insight into the severity and extent of a possible undesirable situation. The results obtained were very encouraging and thus, further analysis can be done on various avenues starting from this. Some of these avenues are discussed henceforth. Dynamic thresholds are required mainly for taking into account the difference in loading conditions. These can be developed. Another major task in the monitoring of the health of the grid is prognosis of the grid vulnerability when the actual load-generation of the grid deviates from the predicted schedule. The monitoring of grid states need to be done continuously and once the current state is found to differ significantly than the predicted state, then a close monitoring is required. The challenge is to come up with some health metrics which can, from the close monitoring of grid states, determine whether the network is going to a vulnerable state or not. The input to be considered is a time window of past network states, the current network state and the predicted state for the current time and the output will be either a yes or a no depending on whether a vulnerable state is going to be reached or not. Once the health metrics have been defined and vulnerability of the states determined, the data can then be used as training data for building or learning rules so that any new data which is not on the training set can be easily classified regarding the grid vulnerability. Issues such as congestion of the power network and optimal generator subset selection can also be explored [18]. Finally the whole system can be tested on the real-world grid data obtained from national agencies. We started with an aim of deriving accurate prognostics information so as to make power grids artificially intelligent. The working system will be especially useful in renewable energy power grids where the generation periods are erratic (e.g. solar power generators generate power only during the day when the Sun is up). With the knowledge about the R EFERENCES [1] Power System Operation Corporation Limited, “Synchrophasors Initiatives in India,” 2013. [2] P. Pentayya, A. Gartia, S. K. Saha, R. Anumasula, and C. Kumar, “Synchrophasor based application development in Western India,” in Innovative Smart Grid Technologies-Asia (ISGT Asia), 2013 IEEE. IEEE, 2013, pp. 1–6. [3] S.-J. Lee, M.-S. Choi, S.-H. Kang, B.-G. Jin, D.-S. Lee, B.-S. Ahn, N.S. Yoon, H.-Y. Kim, and S.-B. Wee, “An intelligent and efficient fault location and diagnosis scheme for radial distribution systems,” IEEE transactions on power delivery, vol. 19, no. 2, pp. 524–532, 2004. [4] S. N. Talukdar, E. Cardozo, and T. Perry, “The operator’s assistant– an intelligent, expandable program for power system trouble analysis,” IEEE Transactions on Power Systems, vol. 1, no. 3, pp. 182–187, 1986. [5] J. Mora-Florez, V. Barrera-Núñez, and G. Carrillo-Caicedo, “Fault location in power distribution systems using a learning algorithm for multivariable data analysis,” IEEE Transactions on power delivery, vol. 22, no. 3, pp. 1715–1721, 2007. [6] E. M. Davidson, S. D. McArthur, J. R. McDonald, T. Cumming, and I. Watt, “Applying multi-agent system technology in practice: Automated management and analysis of scada and digital fault recorder data,” IEEE Transactions on Power Systems, vol. 21, no. 2, pp. 559–567, 2006. [7] D. Thukaram, H. Khincha, and H. Vijaynarasimha, “Artificial neural network and support vector machine approach for locating faults in radial distribution systems,” IEEE Transactions on Power Delivery, vol. 20, no. 2, pp. 710–721, 2005. [8] C. Cortes and V. Vapnik, “Support-vector networks,” Machine learning, vol. 20, no. 3, pp. 273–297, 1995. [9] D. Servan-Schreiber, A. Cleeremans, and J. L. McClelland, “Learning sequential structure in simple recurrent networks,” in Proceedings of the 1st International Conference on Neural Information Processing Systems. MIT Press, 1988, pp. 643–652. [10] D. Britz, “Recurrent neural networks tutorial, part 1 introduction to rnns,” 2015, [Online; accessed June 5, 2017]. [Online]. Available: http: //d3kbpzbmcynnmx.cloudfront.net/wp-content/uploads/2015/09/rnn.jpg [11] S. Hochreiter and J. Schmidhuber, “Long short-term memory,” Neural computation, vol. 9, no. 8, pp. 1735–1780, 1997. [12] C. Olah, “Understanding lstms,” 2015, [Online; accessed June 5, 2017]. [Online]. Available: http://colah.github.io/posts/ 2015-08-Understanding-LSTMs/img/LSTM3-chain.png [13] Siemens, PTI, “PSS/E,” vol. Version 33, 2011. [14] PowerWorld Corporation, “Power Simulator,” vol. Version 19.0, 2005. [15] D. Kothari and I. Nagrath, Power system engineering. Tata McGrawHill, 2008. [16] J. Penman and C. M. Yin, “Feasibility of using unsupervised learning, artificial neural networks for the condition monitoring of electrical machines,” IEE Proceedings-Electric Power Applications, vol. 141, no. 6, pp. 317–322, 1994. [17] F. S. Caparrini, “Artificial neural networks in netlogo,” 2017, [Online; accessed June 5, 2017]. [Online]. Available: https://www.intechopen. com/source/html/39071/media/f2.jpg [18] B. Bhattacharya and A. Sinha, “Intelligent subset selection of power generators for economic dispatch,” arXiv preprint arXiv:1709.02513, 2017.
2cs.AI
A Hierarchical Recurrent Encoder-Decoder for Generative Context-Aware Query Suggestion Alessandro Sordonif ‡ , Yoshua Bengiof , Hossein Vahabig , Christina Liomah , Jakob G. Simonsenh , Jian-Yun Nief f DIRO, Université de Montréal, Québec g Yahoo Labs, Barcelona, Spain h Dept. Computer Science, Copenhagen University, Denmark arXiv:1507.02221v1 [cs.NE] 8 Jul 2015 ‡ [email protected] ABSTRACT Users may strive to formulate an adequate textual query for their information need. Search engines assist the users by presenting query suggestions. To preserve the original search intent, suggestions should be context-aware and account for the previous queries issued by the user. Achieving context awareness is challenging due to data sparsity. We present a probabilistic suggestion model that is able to account for sequences of previous queries of arbitrary lengths. Our novel hierarchical recurrent encoder-decoder architecture allows the model to be sensitive to the order of queries in the context while avoiding data sparsity. Additionally, our model can suggest for rare, or long-tail, queries. The produced suggestions are synthetic and are sampled one word at a time, using computationally cheap decoding techniques. This is in contrast to current synthetic suggestion models relying upon machine learning pipelines and hand-engineered feature sets. Results show that it outperforms existing context-aware approaches in a next query prediction setting. In addition to query suggestion, our model is general enough to be used in a variety of other applications. Categories and Subject Descriptors: H.3.3 [Information Search and Retrieval]: Query formulation Keywords: Recurrent Neural Networks; Query Suggestion. 1. INTRODUCTION Modern search engines heavily rely on query suggestions to support users during their search task. Query suggestions can be in the form of auto-completions or query reformulations. Auto-completion suggestions help users to complete their queries while they are typing in the search box. In this paper, we focus on query reformulation suggestions, that are produced after one or more queries have already been submitted to the search engine. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. CIKM’15, October 19–23, 2015, Melbourne, Australia. c 2015 ACM. ISBN 978-1-4503-3794-6/15/10 ...$15.00. DOI: http://dx.doi.org/10.1145/XXX.XXXXXXX. Search query logs are an important resource to mine user reformulation behaviour. The query log is partitioned into query sessions, i.e. sequences of queries issued by a unique user and submitted within a short time interval. A query session contains the sequence of query reformulations issued by the user while attempting to complete the search mission. Therefore, query co-occurrence in the same session is a strong signal of query relatedness and can be straightforwardly used to produce suggestions. Methods solely relying on query co-occurrence are prone to data sparsity and lack coverage for rare and long-tail queries, i.e. unseen in the training data. A suggestion system should be able to translate infrequent queries to more common and effective formulations based on similar queries that have been seen in the training data. Amongst the interesting models that have been proposed, some capture higher order collocations [7], consider additional resources [19, 39], move towards a word-level representation [8, 9] or describe queries using a rich feature space and apply learning to rank techniques to select meaningful candidates [27, 33]. An additional desirable property of a suggestion system is context-awareness. Pairwise suggestion systems operate by considering only the most recent query. However, previous submitted queries provide useful context to narrow down ambiguity in the current query and to produce more focused suggestions [21]. Equally important is the order in which past queries are submitted, as it denotes generalization or specification reformulation patterns [17]. A major hurdle for current context-aware models is dealing with the dramatic growth of diverse contexts, since it induces sparsity, and classical count-based models become unreliable [10, 14]. Finally, relatively unexplored for suggestion systems is the ability to produce synthetic suggestions. Typically, we assume that useful suggestions are already present in the training data. The assumption weakens for rare queries or complex information needs, for which it is possible that the best suggestion has not been previously seen [19, 38]. In these cases, synthetic suggestions can be leveraged to increase coverage and can be used as candidates in complex learning to rank models [27]. We present a generative probabilistic model capable of producing synthetic, context-aware suggestions not only for popular queries, but also for long tail queries. Given a sequence of queries as prefix, it predicts the most likely sequence of words that follow the prefix. Variable context lengths can be accounted for without strict built-in limits. Figure 1: Projection of the (a) word and (b) query embeddings learnt by our neural network architecture. Topically similar terms and queries are close in the embedding space. Query suggestions can be mined by sampling likely continuations given one or more queries as context. Prediction is efficient and can be performed using standard natural language processing word-level decoding techniques [22]. The model is robust to long-tail effects as the prefix is considered as a sequence of words that share statistical weight and not as a sequence of atomic queries. As an example, given a user query session composed of two queries cleveland gallery → lake erie art issued sequentially, our model predicts sequentially the words cleveland, indian, art and ◦, where ◦ is a special end-of-query symbol that we artificially add to our vocabulary. As the end-of-query token has been reached, the suggestion given by our model is cleveland indian art. The suggestion is contextual as the concept of cleveland is justified by the first query thus the model does not merely rely on the most recent query only. Additionally, the produced suggestion is synthetic as it does not need to exist in the training set. To endow our model with such capabilities, we rely on recent advances in generative natural language applications with neural networks [3, 11, 26]. We contribute with a new hierarchical neural network architecture that allows to embed a complex distribution over sequences of queries within a compact parameter space. Differently from count-based models, we avoid data sparsity by assigning single words, queries and sequences of queries to embeddings, i.e. dense vectors bearing syntactic and semantic characteristics (Figure 1) [4]. Our model is compact in memory and can be trained end-to-end on query sessions. We envision future applications to various tasks, such as search log mining, query auto-completion and query next-word prediction. 2. KEY IDEA Suggestion models need to capture the underlying similarities between queries. Vector representations of words and phrases, also known as embeddings, have been successfully used to encode syntactic or semantic characteristics thereof [3, 4, 24, 34]. We focus on how to capture query similarity and query term similarity by means of such embeddings. In Figure 1 (a) and (b), we plot a two-dimensional projection of the word and query embeddings learnt by our model. The vectors of topically similar terms or queries are close to each other in the vector space. Vector representations for phrases can be obtained by averaging word vectors [24]. However, the order of terms in queries is usually important [36]. To obtain an ordersensitive representation of a query, we use a particular neural network architecture called Recurrent Neural Network (RNN) [3, 25]. For each word in the query, the RNN takes as input its embedding and updates an internal vector, called recurrent state, that can be viewed as an order-sensitive summary of all the information seen up to that word. The first recurrent state is usually set to the zero vector. After the last word has been processed, the recurrent state can be considered as a compact order-sensitive encoding of the query (Figure 2 (a)). A RNN can also be trained to decode a sentence out of a given query encoding. Precisely, it parameterizes a conditional probability distribution on the space of possible queries given the input encoding. The process is illustrated in Figure 2 (b). The input encoding may be used as initialization of the recurrence. Then, each of the recurrent states is used to estimate the probability of the next word in the sequence. When a word is sampled, the recurrent state is updated to take into account the generated word. The process continues until the end-of-query symbol ◦ is produced. The previous two use cases of RNNs can be pipelined into a single recurrent encoder-decoder, as proposed in [11, 37] for Machine Translation purposes. The architecture can be used to parameterize a mapping between sequences of words. This idea can be promptly casted in our framework by predicting the next query in a session given the previous one. With respect to our example, the query encoding estimated by the RNN in Figure 2 (a) can be used as input to the RNN in Figure 2 (b): the model learns a mapping between the consecutive queries cleveland gallery and lake erie art. At test time, the user query is encoded and then decoded into likely continuations that may be used as suggestions. Although powerful, such mapping is pairwise, and as a result, most of the query context is lost. To condition the prediction of the next query on the previous queries in the session, we deploy an additional, session-level RNN on top of the query-level RNN encoder, thus forming a hierarchy of RNNs (Figure 3). The query-level RNN is responsible to initialization recurrent states output query encoding samples lake erie art lake erie word vectors cleveland gallery input query encoding (a) art (b) Figure 2: (a) An encoder RNN processing the query cleveland gallery followed by a special endof-query symbol ◦. Each solid arrow represents a non-linear transformation. (b) A decoder RNN generating the next query in the session, lake erie art, from a query encoding as input. encode a query. The session-level RNN takes as input the query encoding and updates its own recurrent state. At a given position in the session, the session-level recurrent state is a learnt summary of the past queries, keeping the information that is relevant to predict the next one. At this point, the decoder RNN takes as input the session-level recurrent state, thus making the next query prediction contextual. The contribution of this architecture is two-fold. The query-level encoder RNN maps similar queries to vectors close in the embedding space (Figure 1 (b)). The mapping generalizes to queries that have not been seen in the training data, as long as their words appear in the model vocabulary. This allows the model to map rare queries to more useful and general formulations, well beyond past co-occurred queries. The session-level RNN models the sequence of the previous queries, thus making the prediction of the next query contextual. Similar contexts are mapped close to each other in the vector space. This property allows to avoid sparsity, and differently from count-based models [10, 14], to account for contexts of arbitrary length. 3. MATHEMATICAL FRAMEWORK We start by presenting the technical details of the RNN architecture, which our model extends. We consider a query session as a sequence of M queries S = {Q1 , . . . , QM } submitted by a user in chronological order, i.e. Qm <t Qm+1 where <t is the total order generated by the submission time, and within a time frame, usually 30 minutes. A query Qm is a sequence of words Qm = {wm,1 , . . . , wm,Nm }, where Nm is the length of query m. V is the size of the vocabulary. 3.1 Recurrent Neural Network For each query word wn , a RNN computes a dense vector called recurrent state, denoted hn , that combines wn with the information that has already been processed, i.e. the recurrent state hn−1 . Formally: hn = f (hn−1 , wn ), h0 = 0 (1) where hn ∈ Rdh , dh is the number of dimensions of the recurrent state, f is non-linear transformation and the recurrence is seeded with the 0 vector. The recurrent state hn acts as a compact summary of the words seen up to position n. Usually, f consists of a non-linear function, i.e. the logistic sigmoid or hyperbolic tangent, applied element-wise to a time-independent affine transformation [25]. The complexity of the function f has an impact on how accurately the RNN can represent sentence information for the task at hand. To reduce the fundamental difficulty in learning longterm dependencies [5], i.e. to store information for longer sequences, more complex functions have been proposed such as the Long Short-Term Memory (LSTM) [16] and the Gated Recurrent Unit (GRU) [11]. Once Eq. 1 has been run through the entire query, the recurrent states h1 , . . . , hN can be used in various ways. In an encoder RNN, the last state hN may be viewed as an order-sensitive compact summary of the input query. In a decoder RNN, the recurrent states are used to predict the next word in a sequence [11, 25]. Specifically, the word at position n is predicted using hn−1 . The probability of seeing word v at position n is: exp o> v hn−1 , P (wn = v|w1:n−1 ) = P > k exp ok hn−1 (2) where oi ∈ Rde is a real-valued vector of dimensions de associated to word i, i.e. a word embedding, and the denominator is a normalization factor. A representation of the embeddings learnt by our model is given in Figure 1 (a). The semantics of Eq. 2 dictates that the probability of seeing word v at position n increases if its corresponding embedding vector ov is “near” the context encoded in the vector hn−1 . The parameters of the RNN are learned by maximizing the likelihood of the sequence, computed using Eq. 2. 3.1.1 Gated Recurrent Unit We choose to use the Gated Recurrent Unit (GRU) as our non-linear transformation f . GRUs have demonstrated to achieve better performance than simpler parameterizations at an affordable computational cost [11]. This function reduces the difficulties in learning our model by easing the propagation of the gradients. We let wn denote the one-hot representation of wn = v, i.e. a vector of the size of the vocabulary with a 1 corresponding to the index of the query word v. The specific parameterization of f is given by: rn = σ(Ir wn + Hr hn−1 ), un = σ(Iu wn + Hu hn−1 ), (reset gate) (update gate) h̄n = tanh(Iwn + H(rn · hn−1 )), (candidate update) hn = (1 − un ) · hn−1 + un · h̄, (3) (final update) where σ is the logistic sigmoid, σ(x) ∈ [0, 1], · represents the element-wise scalar product between vectors, I, Iu , Ir ∈ Rdh ×V and H, Hr , Hu are in Rdh ×dh . The I matrices encode the word wn while the H matrices specialize in retaining or forgetting the information in hn−1 . In the following, this function will be noted GRU (hn−1 , wn ). The gates rn and un are computed in parallel. If, given the current word, it is preferable to forget information about the past, i.e. to reset parts of hn , the elements of rn will be pushed towards 0. The update gate un plays the opposite role, i.e. it judges whether the current word contains relevant information that should be stored in hn . In the final update, if the elements of un are close to 0, the network discards the update h̄ and keeps the last recurrent state hn−1 . The gating behaviour provides robustness to noise in the input sequence: we hypothesize that this is particularly important for IR as it allows, for example, to exclude from the summary non-discriminative terms appearing in the query. lake erie art lake erie cleveland indian art prediction decoder initial recurrent state session-level recurrent state generated context-aware suggestion art cleveland indian art query-level recurrent state cleveland gallery lake erie art Figure 3: The hierarchical recurrent encoder-decoder (HRED) for query suggestion. Each arrow is a non-linear transformation. The user types cleveland gallery → lake erie art. During training, the model encodes cleveland gallery, updates the session-level recurrent state and maximize the probability of seeing the following query lake erie art. The process is repeated for all queries in the session. During testing, a contextual suggestion is generated by encoding the previous queries, by updating the session-level recurrent states accordingly and by sampling a new query from the last obtained session-level recurrent state. In the example, the generated contextual suggestion is cleveland indian art. 3.2 Architecture Our hierarchical recurrent encoder-decoder (HRED) is pictured in Figure 3. Given a query in the session, the model encodes the information seen up to that position and tries to predict the following query. The process is iterated throughout all the queries in the session. In the forward pass, the model computes the query-level encodings, the session-level recurrent states and the log-likelihood of each query in the session given the previous ones. In the backward pass, the gradients are computed and the parameters are updated. 3.2.1 Query-Level Encoding For each query Qm = {wm,1 , . . . , wm,Nm } in the training session S, the query-level RNN reads the words of the query sequentially and updates its hidden state according to: hm,n = GRUenc (hm,n−1 , wm,n ), n = 1, . . . , Nm , (4) where GRUenc is the query-level encoder GRU function in Eq. 3, hm,n ∈ Rdh and hm,0 = 0, the null vector. The recurrent state hm,Nm is a vector storing order-sensitive information about all the words in the query. To keep the notation uncluttered, we denote qm ≡ hm,Nm the vector for query m. In summary, the query-level RNN encoder maps a query to a fixed-length vector. Its parameters are shared across the queries. Therefore, the obtained query representation qm is a general, acontextual representation of query m. The computation of the q1 , . . . , qM can be performed in parallel, thus lowering computational costs. A projection of the generated query vectors is provided in Figure 1 (b). 3.2.2 where sm ∈ Rds is the session-level recurrent state, ds is its dimensionality and s0 = 0. The number of session-level recurrent states sm is M , the number of queries in the session. The session-level recurrent state sm summarizes the queries that have been processed up to position m. Each sm bears a particularly powerful characteristic: it is sensitive to the order of previous queries and, as such, it can potentially encode order-dependent reformulation patterns such as generalization or specification of the previous queries [17]. Additionally, it inherits from the query vectors qm the sensitivity to the order of words in the queries. Session-Level Encoding The session-level RNN takes as input the sequence of query representations q1 , . . . , qM and computes the sequence of session-level recurrent states. For the session-level RNN, we also use the GRU function: sm = GRUses (sm−1 , qm ), m = 1, . . . , M, (5) 3.2.3 Next-Query Decoding The RNN decoder is responsible to predict the next query Qm given the previous queries Q1:m−1 , i.e. to estimate the probability: P (Qm |Q1:m−1 ) = N m Y P (wn |w1:n−1 , Q1:m−1 ). (6) n=1 The desired conditioning on previous queries is obtained by initializing the recurrence of the RNN decoder with a nonlinear transformation of sm−1 : dm,0 = tanh(D0 sm−1 + b0 ), (7) where dm,0 ∈ Rdh is the decoder initial recurrent state (depicted in Figure 3), D0 ∈ Rdh ×ds projects the context summary into the decoder space and b0 ∈ Rdh . This way, the information about previous queries is transferred to the decoder RNN. The recurrence takes the usual form: dm,n = GRUdec (dm,n−1 , wm,n ), n = 1, . . . , Nm , (8) where GRUdec is the decoder GRU, dm,n ∈ Rdh [11]. In a RNN decoder, each recurrent state dm,n−1 is used to compute the probability of the next word wm,n . The probability of word wm,n given previous words and queries is: P (wm,n = v | wm,1:n−1 , Q1:m−1 ) = = exp o> v ω(dm,n−1 , wm,n−1 ) P , exp o> k ω(dm,n−1 , wm,n−1 ) k de ×dh de ×V Learning M X Nm M X X (11) log P (wm,n |wm,1:n−1 , Q1:m−1 ). m=1 n=1 The gradients of the objective function are computed using the back-propagation through time (BPTT) algorithm [31]. 3.4 cleveland gallery → lake erie art cleveland indian art lake erie art gallery lake erie picture gallery sandusky ohio art gallery Table 1: HRED suggestions given the context. session-level recurrent state, slake erie art , into the initial decoder input d0 using Eq. 7. We are ready to start the sampling of the suggestion. Let assume that the beam-search size is 1. The probability of the first word w1 in the suggestion is computed using Eq. 9 by using d0 and w0 = 0, the null vector. The word with the highest probability, i.e. cleveland, is added to the beam. The next decoder recurrent state d1 is computed by means of Eq. 8 using d0 and w1 = cleveland. Using d1 , we are able to pick w2 = indian as the second most likely word. The process repeats and the model selects art and ◦. As soon as the end-of-query symbol is sampled, the context-aware suggestion cleveland indian art is presented to the user. In Table 1 we give an idea of the generated suggestions for 2 contexts in our test set. Rescoring. Our model can evaluate the likelihood of a given log P (Qm |Q1:m−1 ) m=1 = ace hardware ace hard drive hp officejet drive ace hardware series (10) The model parameters comprise the parameters of the three GRU functions, GRUenc , GRUdec , GRUses , the output parameters Ho , Eo , bo and the V output vectors oi . These are learned by maximizing the log-likelihood of a session S, defined by the probabilities estimated with Eq. 6 and Eq 9: L(S) = ace series drive de where Ho ∈ R , Eo ∈ R and bo ∈ R . To predict the first word of Qm , we set wm,0 = 0, the 0 vector. Instead of using the recurrent state directly as in Eq. 2, we add another layer of linear transformation ω. The Eo parameter accentuates the responsibility of the previous word to predict the next one. This formulation has shown to be beneficial for language modelling tasks [28, 11, 25]. If ov is “near” the vector ω(dm,n−1 , wm,n−1 ) the word v has high probability under the model. 3.3 Synthetic Suggestions (9) where ov ∈ Rde is the output embedding of word v and ω is a function of both the recurrent state at position n and the last input word: ω(dm,n−1 , wm,n−1 ) = Ho dm,n−1 + Eo wm,n−1 + bo , Context Generation and Rescoring Generation. In our framework, the query suggestion task corresponds to an inference problem. A user submits the sequence of queries S = {Q1 , . . . , QM }. A query suggestion is a query Q∗ such that: Q∗ = arg max P (Q|Q1:M ), Q∈Q (12) where Q is the space of possible queries, i.e. the space of sentences ending by the end-of-query symbol. The solution to the problem can be approximated using standard wordlevel decoding techniques such as beam-search [11, 22]. We iteratively consider a set of k best prefixes up to length n as candidates and we extend each of them by sampling the most probable k words given the distribution in Eq. 9. We obtain k2 queries of length n + 1 and keep only the k best of them. The process ends when we obtain k well-formed queries containing the special end-of-query token ◦. Example. Consider a user who submits the queries cleveland gallery → lake erie artist. The suggestion system proceeds as follows. We apply Eq. 4 to each query obtaining the query vectors qcleveland gallery and qlake erie art . Then, we compute the session-level recurrent states by applying Eq. 5 to the query vectors. At this point, we obtain two session-level recurrent states, scleveland gallery and slake erie art . To generate context-aware suggestions, we start by mapping the last suggestion conditioned on the history of previous queries through Eq. 6. This makes our model integrable into more complex suggestion systems. In the next section, we choose to evaluate our model by adding the likelihood scores of candidate suggestions as additional features into a learningto-rank system. 4. EXPERIMENTS We test how well our query suggestion model can predict the next query in the session given the history of previous queries. This evaluation scenario aims at measuring the ability of a model to propose the target next query, which is assumed to be one desired by the user. We evaluate this with a learning-to-rank approach (explained in Section 4.3), similar to the one used in [26, 35] for query auto-completion and in [27, 33] for query suggestion. We first generate candidates using a co-occurrence based suggestion model. Then, we train a baseline ranker comprising a set of contextual features depending on the history of previous queries as well as pairwise features which depend only on the most recent query. The likelihood scores given by our model are used as additional features in the supervised ranker. At the end, we have three systems: (1) the original co-occurrence based ranking, denoted ADJ; (2) the supervised contextaware ranker, which we refer to as Baseline Ranker; and (3) a supervised ranker with our HRED feature. We evaluate the performance of the model and the baselines using mean reciprocal rank (MRR). This is common for tasks whose ground truth is only one instance [21, 26]. 4.1 Dataset We conduct our experiments on the well-known search log from AOL, which is the only available search log that is large enough to train our model and the baselines. The queries in this dataset were sampled between 1 March, 2006 and 31 Batches Seen 135,350 Training 44h 01m Decoding (50) ∼ 1s % of Test sessions Memory 70 301 Mb 62.13 Next Query / Robust 60 Table 2: Full statistics about training time, memory impact and decoding time with a beam size of 50. 50 Long Tail 46.17 40 May, 2006. In total there are 16,946,938 queries submitted by 657,426 unique users. We remove all non-alphanumeric characters from the queries, apply a spelling corrector and lowercasing. After filtering, we sort the query log by query timestamp and we use the queries submitted before 1 May, 2006 as our background data to estimate the proposed model and the baselines. The next two weeks of data are used as a training set for tuning the ranking models. The remaining two weeks are split into the validation and the test set. We follow common practice and we define the end of a session by a 30 minute window of idle time [20]. After filtering, there are 1,708,224 sessions in the background set, 435,705 in the training set, 166,836 in the validation set and 230,359 sessions in the testing set. 4.2 Model Training The most frequent 90K words in the background set form our vocabulary V . This is a common setting for RNN applied to language and allows to speed-up the repeated summations over V in Eq. 9 [11, 37]. Parameter optimization is done using mini-batch RMSPROP [13]. We stabilize the learning by normalizing the gradients if their norm exceeds a threshold c = 1 [28]. The training stops if the likelihood of the validation set does not improve for 5 consecutive iterations. We train our model using the Theano1 library [2, 6]. The dimensionality of the query-level RNN is set to dh = 1000. To ensure a high-capacity session-level RNN, we set ds = 1500. This is useful to memorize complex information about previous queries. The output word embeddings oi are 300 dimensional vectors, i.e. de = 300. Differently from context-aware approaches for which the model size increases with the number of queries, our model is compact and can easily fit in memory (Table 2). 4.3 Learning to Rank Given a session S = {Q1 , . . . , QM }, we aim to predict the target query QM given the context Q1 , . . . , QM −1 . QM −1 is called the anchor query and will play a crucial role in the selection of the candidates to rerank. To probe different capabilities of our model, we predict the next query in three scenarios: (a) when the anchor query exists in the background data (Section 4.4); (b) when the context is perturbed with overly common queries (Section 4.5); (c) when the anchor is not present in the background data (Section 4.6). For each session, we select a list of 20 possible candidates to rerank. The exact method used to produce the candidates will be discussed in the next sections. Once the candidates are extracted, we label the true target as relevant and all the others as non-relevant. We choose to use one of the state-ofthe-art ranking algorithms LambdaMART as our supervised ranker, which is the winner in the Yahoo! Learning to Rank Challenge in 2010 [41]. We tune the LambdaMART model 1 An implementation of the model is https://github.com/sordonia/hed-qs. available at 33.84 27.51 30 19.99 20 10.36 10 0 Short Medium Long Figure 4: Proportion (%) of short (2 queries), medium (3 or 4 queries) and long (at least 5 queries) sessions in our test scenarios. with 500 trees and the parameters are learnt using standard separate training and validation set. We describe the set of pairwise and contextual features (17 in total) used to train a supervised baseline prediction model, denoted Baseline Ranker. The baseline ranker is a competitive system comprising features that are comparable with the ones described in the literature for query autocompletion [21, 26] and next-query prediction [14]. Pairwise and Suggestion Features. For each candidate suggestion, we count how many times it follows the anchor query in the background data and add this count as a feature. Additionally, we use the frequency of the anchor query in the background data. Following [21, 27] we also add the Levenshtein distance between the anchor and the suggestion. Suggestion features include: the suggestion length (characters and words) and its frequency in the background set. Contextual Features. Similarly to [26, 35], we add 10 features corresponding to the character n-gram similarity between the suggestion and the 10 most recent queries in the context. We add the average Levenshtein distance between the suggestion and each query in the context [21]. We use the scores estimated using the context-aware Query Variable Markov Model (QVMM) [14] as an additional feature. QVMM models the context with a variable memory Markov model able to automatically back-off shorter query n-grams if the exact context is not found in the background data. HRED Score. The proposed Hierarchical Recurrent Encoder Decoder (HRED) contributes one additional feature corresponding to the log-likelihood of the suggestion given the context, as detailed in Section 3.4. 4.4 Test Scenario 1: Next-Query Prediction For each session in the training, validation and test set, we extract 20 queries that most likely follow the anchor query in the background data, i.e. with the highest ADJ score. The session is included if and only if at least 20 queries have been extracted and the target query appears in the candidate list. In that case, the target query is the positive candidate and the 19 other candidates are the negative examples. Note that a similar setting has been used in [21, 26] for query auto-completion. We have 18,882 sessions in the training, 6,988 sessions in the validation and 9,348 sessions in the test set. The distribution of the session length is reported in ADJ Baseline Ranker + HRED MRR 0.5334 0.5563 0.5749 ∆% 0.64 +4.3% +7.8%/+3.3% 0.62 Table 3: Next-query prediction results. All improvements are significant by the t-test (p < 0.01). ADJ Baseline Ranker 0.58 0.56 HRED 0.601 0.6 MRR Method 0.573 0.565 0.567 0.553 0.545 0.54 0.529 0.522 0.52 0.492 0.5 Figure 4. The scores obtained by the ADJ counts are used as an additional non-supervised baseline. 0.48 0.46 Short Main Result. Table 3 shows the MRR performance for our model and the baselines. Baseline Ranker achieves a relative improvement of 4.3% with respect to the ADJ model. We find that the HRED feature brings additional gains achieving 7.8% relative improvement over ADJ. The differences in performance with respect to ADJ and the Baseline Ranker are significant using a t-test with p < 0.01. In this general next-query prediction setting, HRED boosts the rank of the first relevant result. Impact of Context Length. We test whether the performance obtained by HRED on long sessions can be obtained using a shorter context. For each long session in our test set, we artificially truncate the context to make the prediction depend on the anchor query, QM −1 , only (1 query), on QM −2 and QM −1 (2 queries), on 3 queries and on the entire context. When one query is considered, our model behaves similarly to a pairwise recurrent encoder-decoder model trained on consecutive queries. Figure 6 shows that when only one query is considered, the performance of HRED is similar to the Baseline Ranker (0.529) which uses the whole context. However, HRED appears to perform best when the whole context is considered, which highlights the importance of context-information. Additional gains can be obtained by considering more than 3 queries, which highlights the ability of our model to consider long contexts. Long Figure 5: Next-query performance in short, medium and long sessions. All differences in MRR are statistically significant by the t-test (p < 0.01). 0.6 0.58 0.567 MRR Impact of Session Length. We expect the session length to have an impact on the performance of context-aware models. In Figure 5, we report separate results for short (2 queries), medium (3 or 4 queries) and long sessions (at least 5 queries). HRED brings statistically significant improvements across all the session lengths. For short sessions, the improvement is marginal but consistent even though only a short context is available in this case. The semantic mapping learnt by the model appears to be useful, even in the pairwise case. ADJ is affected by the lack of context-awareness and suffers a dramatic loss of performance with increasing session length. In the medium range, context-aware models account for previous queries and achieve the highest performance. The trend is not maintained for long sessions, seemingly the hardest for the Baseline Ranker. Long sessions can be the result of complex search tasks involving a topically broad information need or changes of search topics. Beyond the intrinsic difficulty in predicting the target query in these cases, exact context matches may be too coarse to infer the user need. Count-based methods such as QVMM meet their limitations due to data sparsity. In this difficult range, HRED achieves its highest relative improvement with respect to both ADJ (+15%) and the Baseline Ranker (+7%), thus showing robustness across different session lengths. Medium 0.555 0.56 0.546 0.54 0.533 0.52 0.5 1 Query 2 Queries 3 Queries All Figure 6: Variation of HRED performance with respect to the number of previous queries considered. The evolution is computed on long sessions. 4.5 Test Scenario 2: Robust Prediction Query sessions contain a lot of common and navigational queries such as google or facebook which do not correspond to a specific search topic. A context-aware suggestion system should be robust to noisy queries and learn to discard them from the relevant history that should be retained. We propose to probe this capability by formulating an original robust prediction task as follows. We label the 100 most frequent queries in the background set as noisy 2 . For each entry in the training, validation and test set of the previous next-query prediction task, we corrupt its context by inserting a noisy query at a random position. The candidates and the target rest unchanged. The probability of sampling a noisy query is proportional to its frequency in the background set. For example, given the context airlines → united airlines and the true target delta airlines, the noisy sample google is inserted at a random position, forcing the models to predict the target given the corrupted context airlines → united airlines → google. Main Result. Table 4 shows that corruption considerably affects the performance of ADJ. Cases in which the corruption occurred at the position of the anchor query severely harm pairwise models. The Baseline Ranker achieves sig2 A similar categorization has been proposed in [30]. Method MRR ADJ Baseline Ranker + HRED 0.4507 0.4831 0.5309 ∆% Method +7,2% +17,8%/+9.9% ADJ Baseline Ranker + HRED Table 4: Robust prediction results. The improvements are significant by the t-test (p < 0.01). ua uua ug Figure 7: Magnitude of the elements in the sessionlevel update gates. The darker the image, the more the model discards the current query. The vector corresponding to google, ug , is darker, i.e. the network mainly keeps its previous recurrent state. MRR 0.3830 0.6788 0.7112 ∆% +77.2% +85.3% /+5.6% Table 5: Long-tail prediction results. The improvements are significant by the t-test (p < 0.01). case, we cannot leverage the ADJ score to select candidates to rerank. For each session, we iteratively shorten the anchor query by dropping terms until we have a query that appears in the background data. If a match is found, we proceed as described in the next-query prediction setting, that is, we guarantee that the target appears in the top 20 queries that have the highest ADJ scores given the anchor prefix. The statistics of the obtained dataset are reported in Figure 4. As expected, the distribution of lengths changes substantially with respect to the previous settings. Long-tail queries are likely to appear in medium and long sessions, in which the user strives to find an adequate textual query. Main Result. Table 5 shows that, due to the anchor prenificant gains over ADJ by leveraging context matches. Its performance is inferior to the baseline ADJ performance in the next-query setting reported in Table 3 (0.5334). HRED appears to be particularly effective in this difficult setting achieving a relative improvement of 17.8% over ADJ and 9.9% over the Baseline Ranker, both statistically significant. Comparative to the next-query task, the improvements over ADJ and the Baseline Ranker are 2.5 and 3 times higher respectively. Our model appears to be more robust than the baselines in these extreme cases and can better reduce the impact of the noisy query. Impact of the Hierarchical Structure. As noisy queries bring little information to predict future queries in the session, HRED may automatically learn to be robust to the noise at training time. The hierarchical structure allows to decide, for each query, if it is profitable to account for its contribution to predict future queries. This capability is sustained by the session-level GRU, which can ignore the noisy queries by “turning-off” the update gate un when they appear (see Section 3.1.1). Given the corrupted context airlines → united airlines → google, the session-level GRU computes three update gate vectors: ua , uua , ug , each corresponding to a position in the context. In Figure 7, we plot the magnitude of the elements in these vectors. As the model needs to memorize the initial information, ua shows a significant number of non-zero (bright) entries. At this point, general topical information has already been stored in the first recurrent state. Hence, uua shows a larger number of zero (dark) entries. When google is processed, the network tends to keep past information in memory by further zeroing entries in the update gate. This sheds an interesting perspective: this mechanism may be used to address other search log related tasks such as session-boundary detection. 4.6 Test Scenario 3: Long-Tail Prediction To analyze the performance of the models in the long-tail, we build our training, validation and test set by retaining the sessions for which the anchor query has not been seen in the background set, i.e. it is a long-tail query. In this fix matching, ADJ suffer a significant loss of performance. The performances of the models generally confirm our previous findings. HRED improves significantly by 5.6% over the Baseline Ranker and proves to be useful even for longtail queries. Supervised models appear to achieve higher absolute scores in the long-tail setting than in the general next-query setting reported in Table 3. After analysis of the long-tail testing set, we found that only 8% of the session contexts contain at least one noisy query. In the general next-query prediction case, this number grows to 37%. Noisy queries generally harm performance of the models by increasing the ambiguity in the next query prediction task. This fact may explain why the Baseline ranker and HRED perform better on long-tail queries than in the general case. It is interesting to see how the improvement of HRED with respect to the Baseline Ranker is larger for long-tail queries than in the general setup (5.6% to 3.3%). Although not explicitly reported, we analyzed the performance with respect to the session length in the long-tail setting. Similarly to the general next-query prediction setting, we found that the Baseline Ranker suffers significant losses for long sessions while our model appears robust to different session lengths. 4.7 User Study The previous re-ranking setting doesn’t allow to test the generative capabilities of our suggestion system. We perform an additional user study and ask human evaluators to assess the quality of synthetic suggestions. To avoid sampling bias towards overly common queries, we choose to generate suggestions for the 50 topics of the TREC Web Track 2011 [12]. The assessment was conducted by a group of 5 assessors. To palliate the lack of context information for TREC queries, we proceed as follows: for each TREC topic QM , we extract from the test set the sessions ending exactly with QM and we take their context Q1 , . . . , QM −1 . After contextualization, 19 TREC queries have one or more queries as context and the remaining are singletons. For HRED, we build synthetic queries following the generative procedure described in Section 3.4. In addition to QVMM and ADJ, we compare our model with two other baselines: CACB [10], which is similar Useful Somewhat Not Useful HRED SS CACB QVMM ADJ 0% 20% 40% 60% 80% 100% Figure 8: User study results, which compare the effectiveness of HRED with the baseline techniques. to QVMM but builds clusters of queries to avoid sparsity, and SS (Search Shortcuts) [9], which builds an index of the query sessions and extracts the last query of the most similar sessions to the source context. Note that we do not compare the output of the previous supervised rankers as this would not test the generative capability of our model. Each assessor was provided with a random query from the test bed, its context, if any, and a list of recommended queries (the top-5 for each of the methods) selected by the different methods. Recommendations were randomly shuffled, so that the assessors could not distinguish which method produced them. Each assessor was asked to judge each recommended query using the following scale: useful, somewhat useful, and not useful. The user study finished when each assessor had assessed all recommendations for all 50 queries in the test bed. Figure 8 reports the results of the user study averaged over all raters. Overall, for HRED, 64% of the recommendations were judged useful or somewhat useful. The quality of the queries recommended by HRED is higher than our baselines both in the somewhat and in the useful category. 5. RELATED WORKS Query Suggestion. A notorious context-aware method was proposed by He et al. [14]. The authors use a Variable Memory Markov model (QVMM) and build a suffix tree to model the user query sequence. We used this model as a contextaware baseline feature in our supervised ranker. The method by Cao et al. [10] is similar but they build a suffix tree on clusters of queries and model the transitions between clusters. We didn’t notice any improvements by adding this model as a feature in our case. For both models, the number of parameters increases with the depth of the tree inducing sparsity. Instead, our model can consider arbitrary length contexts with a fixed number of parameters. Jiang et al. [21] and Shokouhi et al. [35] propose context-aware approaches for query auto-completion. We adopted a similar framework for query suggestion and use our model as a feature to rank the next-query. Santos et al. [33] and Ozertem et al. [27] also use learning to rank approach for query suggestion. In those cases, the rankers are trained using pairwise features and do not consider previous queries. Interestingly, the authors model explicitly the usefulness of a suggestion by using click data and the result list. In the future, we plan to integrate click information in the generation process of our model. Query suggestion algorithms use clustering methods to find similar queries so that they can be used as suggestions for one another [1, 40]. We demonstrated that our model exhibits similar clustering properties due to the embeddings learnt by the neural network. Other works build a Query Flow Graph (QFG) to capture high-order query cooccurrence [7, 32]. Operating at the query-level, these methods suffer from the long-tail problem. Bonchi et al. [8] propose a solution to these problems by introducing the TermQFG (TQG), where single query terms are also included into the graph. However, suggestion requires repeated complex random walks with restart. Similarly, our model can handle rare queries as long as their words appear in the model vocabulary. Vahabi et al. [39] find suggestions to long-tail queries by comparing their search results. Although effective, the approach requires to have 100 results per query. A related approach is the Search Shortcut [9] which avoids the long-tail problem by means of a retrieval algorithm. Few synthetic suggestion models have been proposed in the literature. Szpektor et al. [38] use a template generation method by leveraging WordNet. Jain et al. [19] combine different resources and use a machine learning approach to prune redundant suggestions. These methods achieve automatic addition, removal and substitution of related terms into the queries. By maximizing the likelihood of the session data, our model learns to perform similar modifications. Neural Networks for NLP. Neural networks have found several applications in a variety of tasks, ranging from Information Retrieval (IR) [18, 34], Language Modeling (LM) [25, 29] and Machine Translation (MT) [11, 37]. Cho et al. [11] and Sutskever et al. [37] use a Recurrent Neural Network (RNN) for end-to-end MT. Our model bears similarities to these approaches but we contribute with the hierarchical structure. The idea of encoding hierarchical multi-scale representations is also explored in [15]. In IR, neural networks embeddings were used by Li et al [23]. The authors used deep feed-forward neural networks to use previous queries by the same user to boost document ranking. In [18, 34], the authors propose to use clickthrough data to learn a ranking model for ad-hoc IR. Our model shares similarities with the interesting recent work by Mitra [26]. The authors apply the discriminative pairwise neural model described in [34] to measure similarity between queries. Context-awareness is achieved at ranking time, by measuring the similarity between the candidates and each query in the context. Our work has several key differences. First, we deploy a novel RNN architecture. Second, our model is generative. Third, we model the session context at training time. To our knowledge, this is the first work applying RNNs to an IR task. 6. CONCLUSION In this paper, we formulated a novel hierarchical neural network architecture and used it to produce query suggestions. Our model is context-aware and it can handle rare queries. It can be trained end-to-end on query sessions by simple optimization procedures. Our experiments show that the scores provided by our model help improving MRR for next-query ranking. Additionally, it is generative by definition. We showed with a user study that the synthetic generated queries are better than the compared methods. In future works, we aim to explicitly capture the usefulness of a suggestion by exploiting user clicks [27]. This may be done without much effort as our architecture is flexible enough to allow joint training of other differentiable loss functions. Then, we plan to further study the synthetic generation by means of a large-scale automatic evaluation. Currently, the synthetic suggestions tend to be horizontal, i.e. the model prefers to add or remove terms from the context queries and rarely proposes orthogonal but related reformulations [19, 39]. Future efforts may be dedicated to diversify the generated suggestions to account for this effect. Finally, the interactions of the user with previous suggestions can also be leveraged to better capture the behaviour of the user and to make better suggestions accordingly. We are the most excited about possible future applications beyond query suggestion: auto-completion, next-word prediction and other NLP tasks such as Language Modelling may be fit as possible candidates. Acknowledgments We would like to thank Jianfeng Gao, Çağlar Gülçehre and Bhaskar Mitra for their precious advice, enlightening discussions and invaluable moral support. We gratefully acknowledge the support of NVIDIA Corporation with the donation of the Tesla K40 GPU used for this research. 7. REFERENCES [1] R. Baeza-Yates, C. Hurtado, and M. Mendoza. Query recommendation using query logs in search engines. In In Proc. of Int. Conf. on Current Trends in Database Tech., pages 588–596, 2004. [2] F. Bastien, P. Lamblin, R. Pascanu, J. Bergstra, I. J. Goodfellow, A. Bergeron, N. Bouchard, and Y. Bengio. Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop, 2012. [3] Y. Bengio. Deep learning of representations: Looking forward. CoRR, abs/1305.0445, 2013. [4] Y. Bengio, R. Ducharme, and P. Vincent. A neural probabilistic language model. Journal of Machine Learning Research, 3:1137–1155, 2003. [5] Y. Bengio, P. Simard, and P. Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, pages 157–166, 1994. [6] J. Bergstra, O. Breuleux, F. Bastien, P. Lamblin, R. Pascanu, G. Desjardins, J. Turian, D. Warde-Farley, and Y. Bengio. Theano: a CPU and GPU math expression compiler. In In Proc. of SciPy, 2010. [7] P. Boldi, F. Bonchi, C. Castillo, D. Donato, A. Gionis, and S. Vigna. The query-flow graph: Model and applications. In In Proc. of CIKM, pages 609–618, 2008. [8] F. Bonchi, R. Perego, F. Silvestri, H. Vahabi, and R. Venturini. Efficient query recommendations in the long tail via center-piece subgraphs. In In Proc. of SIGIR, pages 345–354, 2012. [9] D. Broccolo, L. Marcon, F. M. Nardini, R. Perego, and F. Silvestri. Generating suggestions for queries in the long tail with an inverted index. Inf. Process. Manage., 48(2):326–339, 2012. [10] H. Cao, D. Jiang, J. Pei, Q. He, Z. Liao, E. Chen, and H. Li. Context-aware query suggestion by mining click-through and session data. In In Proc. of SIGKDD, pages 875–883, 2008. [11] K. Cho, B. Merrienboer, Ç. Gülçehre, F. Bougares, H. Schwenk, and Y. Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. In Proc. of EMNLP, 2014. [12] C. LA Clarke, N. Craswell, I. Soboroff, and E. M Voorhees. Overview of the trec 2011 web track. Proceedings of the 2011 Text Retrieval Conference (TREC 2011), 2011. [13] A. Graves. Generating sequences with recurrent neural networks. CoRR, abs/1308.0850, 2013. [14] Q. He, D. Jiang, Z. Liao, S. C. H. Hoi, K. Chang, E. P. Lim, and H. Li. Web query recommendation via sequential query prediction. In In Proc. of ICDE, pages 1443–1454, 2009. [15] S. El Hihi and Y. Bengio. Hierarchical recurrent neural networks for long-term dependencies. In NIPS, pages 493–499. Citeseer, 1995. [16] S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. [17] J. Huang and E. N. Efthimiadis. Analyzing and evaluating query reformulation strategies in web search logs. In In Proc. of CIKM, pages 77–86, 2009. [18] P. S. Huang, X. He, J. Gao, L. Deng, A. Acero, and L. Heck. Learning deep structured semantic models for web search using clickthrough data. In In Proc. of CIKM, pages 2333–2338, 2013. [19] A. Jain, U. Ozertem, and E. Velipasaoglu. Synthesizing high utility suggestions for rare web search queries. In In Proc. of SIGIR, pages 805–814, 2011. [20] B. J. Jansen, A. Spink, C. Blakely, and S. Koshman. Defining a session on web search engines: Research articles. J. Am. Soc. Inf. Sci. Technol., 58(6):862–871, April 2007. [21] J.Y. Jiang, Y.Y. Ke, P.Y. Chien, and P.J. Cheng. Learning user reformulation behavior for query auto-completion. In In Proc. of SIGIR, pages 445–454, 2014. [22] P. Koehn. Statistical machine translation. Cambridge University Press, 2009. [23] X. Li, C. Guo, W. Chu, Y.Y. Wang, and J. Shavlik. Deep learning powered in-session contextual ranking using clickthrough data. In In Proc. of NIPS, 2014. [24] T. Mikolov, K. Chen, G. Corrado, and J. Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013. [25] T. Mikolov, M. Karafiát, L. Burget, J. Cernocký, and S. Khudanpur. Recurrent neural network based language model. In In Proc. of ACISCA, pages 1045–1048, 2010. [26] B. Mitra. Exploring session context using distributed representations of queries and reformulations. In In Proc. of SIGIR. To appear, 2015. [27] U. Ozertem, O. Chapelle, P. Donmez, and E. Velipasaoglu. Learning to suggest: A machine learning framework for ranking query suggestions. In In Proc. of SIGIR, pages 25–34, 2012. [28] R. Pascanu, C. Gulcehre, K. Cho, and Y. Bengio. How to construct deep recurrent neural networks. arXiv preprint arXiv:1312.6026, 2013. [29] R. Pascanu, T. Mikolov, and Y. Bengio. On the difficulty of training recurrent neural networks. In Proc. of ICML, 2013. [30] K. Raman, P. Bennett, and K. Collins-Thompson. Understanding intrinsic diversity in web search: Improving whole-session relevance. ACM Trans. Inf. Syst., 32(4):20:1–20:45, October 2014. [31] D. E Rumelhart, G. E Hinton, and R. J Williams. Learning representations by back-propagating errors. Cognitive modeling, 1988. [32] E. Sadikov, J. Madhavan, L. Wang, and A. Halevy. Clustering query refinements by user intent. In In Proc. of WWW, pages 841–850, 2010. [33] R. L.T. Santos, C. Macdonald, and I. Ounis. Learning to rank query suggestions for adhoc and diversity search. Information Retrieval, 16(4):429–451, 2013. [34] Y. Shen, X. He, J. Gao, L. Deng, and G. Mesnil. A latent semantic model with convolutional-pooling structure for information retrieval. In In Proc. of CIKM, pages 101–110, 2014. [35] M. Shokouhi. Learning to personalize query auto-completion. In In Proc. of SIGIR, pages 103–112, 2013. [36] A. Sordoni, J.Y. Nie, and Y. Bengio. Modeling term dependencies with quantum language models for ir. In In Proc. of SIGIR, pages 653–662, 2013. [37] I. Sutskever, O. Vinyals, and Q. V. V Le. Sequence to sequence learning with neural networks. In In Proc. of NIPS, pages 3104–3112. 2014. [38] I. Szpektor, A. Gionis, and Y. Maarek. Improving recommendation for long-tail queries via templates. In In Proc. of WWW, pages 47–56, 2011. [39] H. Vahabi, M. Ackerman, D. Loker, R. Baeza-Yates, and A. Lopez-Ortiz. Orthogonal query recommendation. In In Proc. of RECSYS, RecSys ’13, pages 33–40. ACM, 2013. [40] J.R. Wen, J.Y. Nie, and H.J. Zhang. Clustering user queries of a search engine. In In Proc. of WWW, pages 162–168. ACM, 2001. [41] Q. Wu, C. J. Burges, K. M. Svore, and J. Gao. Adapting boosting for information retrieval measures. Inf. Retr., 13(3):254–270, June 2010.
9cs.NE
Conceptual Understanding of Computer Program Execution: Application to C++ Sabah Al-Fedaghi Computer Engineering Department, Kuwait University P.O. Box 5969 Safat 13060 Kuwait Abstract A visual programming language uses pictorial tools such as diagrams to represent its structural units and control stream. It is useful for enhancing understanding, maintenance, verification, testing, and parallelism. This paper proposes a diagrammatic methodology that produces a conceptual representation of instructions for programming source codes. Without loss of generality in the potential for using the methodology in a wider range of applications, this paper focuses on using these diagrams in teaching of C++ programming. C++ programming constructs are represented in the proposed method in order to show that it can provide a foundation for understanding the behavior of running programs. Applying the method to actual C++ classes demonstrates that it improves understanding of the activities in the computer system corresponding to a C++ program. Keywords: conceptual model, programming, C++, diagram. understanding, computer 1. Introduction This paper aims at proposing a diagrammatic methodology that produces a conceptual representation of instructions for programming source codes. Without loss of generality, this methodology is applied to the programming language C++. The advantages of this application include source code understanding, maintenance, verification, testing, and identification of parallelism, in addition to other purposes such as reuse and reverse engineering. The proposed methodology enhances understanding of program code in terms of its corresponding computer operations, not as registers, fetch/store/execute cycle, addresses; rather, in terms of conceptual operations such as create, release, transfer, receive, and process, thus completing the cycle of understanding, where it is always claimed that, as a first step, a programmer must understand the application domain (e.g., inventory). This work can be considered a type of visualization of computer programs. Program visualization is a well-known paradigm. A visual programming language, not to be confused with a visual programming environment, is a language that uses graphic tools to represent structural units and control streams in programs. This type of language facilitates creating and specifying of program elements graphically rather than by writing them textually [1]. Some visualization of programs is based on the notion of dataflow programming that represents a program as a directed graph of the data flowing among operations [2][3]. Program understanding is one of the most important aspects influencing the maintainability of programs for programmers [4]. “Mechanisms for improving program comprehensibility can reduce maintenance cost and maximize return on investments in legacy code by promoting reuse” [5]. According to Kiper et al. [5], The entire software engineering philosophy is built on the premise that high level language code is created for human consumption rather than driven by machine requirements. The first step in repairing or modifying existing code is to understand what that code does. Nevertheless, Complete understanding of a large system is an unrealistic goal. Rather, a maintainer must identify those program components that are important for a specific change and focus on understanding them well enough to safely make the modification. It is hard to define exactly how programmers go about achieving this level of understanding or even how they know when it has been achieved. [6] Some visual programming languages express constructs in diagrams. Diagrams are often used in software learning and development, and in business systems to represent requirements, dataflows, workflows, and software architecture [7]. For years, diagrams have been utilized in constructing software systems [8][9]. Many tools have been built to aid programmers, giving them many capabilities, including drawing and sketching to construct programs and examine codes [10][11][12]. Diagrams - or more generally, visualizations of nonapparent systems, concepts, relationships, processes and ideas - help students to recognise and understand parallels and structural correlations between things in the world; their constitutive natures, their internal structures and relationships; the systems of which they form a part, and the processes they are involved with. [13] [Italics added] According to Lee [14], Despite all of these previous efforts, the majority of programming activity occurs in text-centric development environments with information often conveyed through list and tree views. If programmers worked efficiently and effectively in these environments, there may be little reason to consider how to better support programming through diagramming tools. Here, it can be sensed that the need exists to develop tools to facilitate understanding and to serve more than documentation and initial planning needs of a program, as in the case of pseudo codes and flowcharts. This paper claims that: A new methodology of high-level description, called the Flowthing Model (FM), is a viable alternative to other diagrammatic methods for program understanding. To substantiate this claim, programming constructs in a textbook will be recast in FM, with the aim of showing the advantages and disadvantages of each method. To focus such a process, the paper narrows the materials as follows: - The paper focuses mainly on the general problem of using diagrams as a “foundation for understanding the behaviour of running programs” in learning programming [15]. - Without loss of generality of the potential for using FM in a wider range of application, this paper focuses on using diagrams in teaching programming [15]. - More focus is realized in the paper by taking the construct of C++ as a study case to exemplify and contrast FM with flowcharting and pseudo codes. This tightening of materials in the paper makes it easier to concentrate on a limited domain, thus achieving the capability to explore specific aspects of the proposed method. needs about 10 years of practice to become an expert programmer [16]. Acquiring and developing knowledge about programming is a highly complex process. It involves a variety of cognitive activities, and mental representations related to program design, program understanding, modifying, debugging (and documenting). Even at the level of computer literacy, it requires construction of conceptual knowledge, and the structuring of basic operations (such as loops, conditional statements, etc.) into schemas and plans. [17] Computer science students have problems in mastering programming. According to Thomas [18], this difficulty is “one of the manifestations of lack of understanding of program behavior.” In order to understand a program’s behaviour it is necessary for the programmer to have a model of the computer that will execute it. This ‘notional machine’ provides a foundation for understanding the behaviour of running programs… Programming ability must rest on a foundation of knowledge about computers, a programming language or languages, … [15]. Typically, models of program comprehension (e.g., [19] [20]) concentrate on programming that involves mappings from the problem domain into the programming domain. In these approaches, there is little appreciation of the role at the computation level (Fig. 1). High-level programming languages are supposed to be abstracted from machine hardware. Meanings of architectural aspects such as the CPU, address, Memory, ALU, … are brushed off in chapter 1 of most programming texts. The reason is to avoid getting involved in computer hardware but to focus on the software instead as the tool for problem solving. Problem (reality) domain Programming (software) domain Computation (system) domain Fig. 1 Different domains related to programming 2. Problem The skill of programming is quite valuable, and interest in programming is increasing; however, there are difficulties in learning to program [15]. It is reported that a novice This paper demonstrates that it is possible to build a conceptual map of activities corresponding to those in a C++ program within a computer system without incorporating hardware elements. Here the term conceptual refers to a high-level depiction of essential elements and their interrelationships in the computation domain (computer) using diagrammatic notations. Its purpose is to convey a common description without technological aspects that can serve as a guide for understanding operations specified in a C++ program. Nevertheless, the generality of FM applications at different levels of programming development (see Fig. 2), can be claimed. For example, a simplified FM conceptual description introduces a more complete flowchart. In addition, a textual specification of the FM depiction is suggested as a narrative of events that is less “sketchy” than pseudo code. Problem (reality) domain Flowcharts, pseudo code Potential claim: Can FM be used at this level? C++ Claim: FM presents a conceptual description for understanding C++ Potential Claim: FM presents a conceptual description for designing C++ Computing (system) domain Fig. 2 Domains and claims in the paper For the sake of a self-contained paper, section 3 briefly describes the Flowthing Model, FM, upon which the new representation is built. FM has been utilized in many applications [e.g., 21–25]. 3. Flowthing Model The Flowthing Model (FM) is a depiction of the structure of a system, a road map of its components and conceptual flow. A component comprises spheres (e.g., operating system, program, statement, C++ function) that may enclose or intersect with other spheres (e.g., the sphere of a house contains rooms, which in turn include walls, ceilings). Or, a sphere embeds flows (called flowsystems e.g., walls encompass pipes of water flow and wires of electricity flow). Things that flow in a flowsystem are referred to as flowthings (e.g., money, data, products, cars, parts). The life cycle of a flowthing can be defined in terms of six mutually exclusive stages: creation, process, arrival, acceptance, release, and transfer. Within a certain sphere: - Creation means the appearance of the flowthing in the totality of a sphere’s system for the first time (e.g., the creation of a new program). - Process means application of a change to the form of an existing flowthing (e.g., writing a program in a structured way). - Release means marking a flowthing as “to be output”, but it remains within the sphere (e.g., data marked “to be transmitted”). - Transfer denotes the input/output module of the sphere (e.g., interface component [port] of a device for a communication channel). - Arrival means that the flowthing reaches the sphere but is not necessarily permitted to enter it (e.g., a letter delivered to the wrong recipient and rejected, to be returned). - Acceptance means permitting the arrived flowthing to enter the system. Fig. 3 shows a flowsystem with its stages, where it is assumed that no released flowthing flows back to previous stages. The reflexive arrow in the figure indicates flow to the Transfer stage of another flowsystem. For simplicity’s sake, the stages Arrive and Accept can be combined and termed Receive. Create Process Release Accept Transfer Arrive Receive Fig. 3 Flowsystem The stages in the life cycle of a flowthing are mutually exclusive (i.e., the flowthing can be in one and only one stage at a time). All other states of flowthings are not generic states. For example, we can have stored created flowthings, stored processed flowthings, stored received flowthings, etc. Flowthings can be released but not transferred (e.g., the channel is down), or arrived but not accepted, … In addition to flows, triggering is a transformation (denoted by a dashed arrow) from one flow to another, e.g., a flow of electricity triggers the flow of air. Example: This example is artificially constructed to somewhat resemble a C++ program with two statements, one to fetch data from computer memory to be displayed on the screen, and the second to signal that such an operation is successful. The purpose is to illustrate the FM concepts of sphere, flowsystem, and flowthing in a computer program. Note that when a sphere includes a single flowsystem, one rectangle is drawn to represent both of them, the sphere as well as its flowsystem. In a market, the daily procedure for display of gold and precious jewelry, under the supervision of a manager, is performed by a worker who performs the following two tasks in sequence, as shown in an FM representation in Fig. 4: Task 1: Bring the jewels from the safe to be exhibited. Task 2: Report to the manager the success of the opening operation. Accordingly, the market sphere includes all other subspheres. The first task involves three subspheres: safety box, worker, and exhibition. It starts when the gold and jewels (a flowsystem - circle 1 in the figure) flow from the sphere of the safety box (2) to the worker, then to the exhibition area (3). In the exhibition sphere, the jewels are unpacked from their boxes (processed) and displayed (4). The second task, reporting (a sphere/flowsystem, 5) is accomplished by creating an “OK” message (a flowthing, 6) and sending it to the manager (7). The conceptual picture involves two flows: that of the gold and jewels, and that of information (OK message). Triggering can be added to the figure; say, the manager triggers the worker to start setting up the daily exhibit. It is assumed that the two tasks are executed in sequence; otherwise, it is possible to make the end of task 1 trigger task 2. - Familiarize the student with the basic problem-solving concepts, top-down design, stepwise refinement, modularity, object oriented programming, and reusability . 4.1 Input cin and output cout Starting with the semantics of cin in C++, Fig. 5(a) shows its FM representation. Data flows from the keyboard, assuming standard input/output, to the data flowsystem in the computer sphere, to be stored. Because in this conceptual picture there is only one type of flowthing (data), it is possible to depict it with one rectangle, as shown in Fig. 5(b). Fig. 5(c) shows cout, and Fig. 5(d) shows a sample output to the screen. Market Manager Daily program Tasks Safety box system 1 Transfer Release Jewels Employee 3 Task 1 2 Transfer Exhibition area Transfer 4 Receive Process Receive Release Unpack and Display Process Reporting 5 Create OK 6 Task 2 Release 7 Transfer Fig. 4 FM description of jewel exhibition process 4. Conceptual Base for Understanding C++ Keyboard Computer system sphere Keyboard Computer system sphere This section presents the main contribution of this paper: Receive Transfer Receive Transfer FM-based description of C++ constructs. The representation depicts the conceptual (in contrast to data hardware) computer operations that correspond to these constructs. The course CpE-200: Computer Programming (a) (b) for Engineers is selected for an experiment with FM Screen Screen modeling of programming. It uses the text C++: How to Program, Fifth Edition by Deitel and Deitel (Prentice Hall, Computer system sphere Computer system sphere n 2005) as the source of the sample programs in this paper Release Transfer Release Transfer after removing comments. The course objectives in the academic catalog are stated as follows: - Familiarize the students with fundamental understanding “Welcome to C++!\n” of computers and the basic constructs of a modern (c) (d) programming language. [Italics added] Fig. 5 FM description of cin and cout The FM representation reveals conceptual incompleteness of flows, as seen in the previous figures, where keyboard and screen seem to be something outside the picture. Going beyond C++, it is possible to represent the flow of data in cout to the screen sphere, as shown in Fig. 6 for the screen. The flow from the keyboard in cin is shown in Fig. 7. In Fig. 7, the user’s actions trigger (dashed arrow) the generation of data that flows to the computer system. Note that in FM, an action is a flowthing that can be created, released, transferred, received, and processed. Computer system sphere Release Screen Transfer Transfer Receive Process “Welcome to C++!\n” 1. Display “Welcome to C++!” 2. Carriage return Fig. 6 FM description of cout and Screen Computer system sphere User action Create data Receive Transfer Fig. 9 presents a conceptual picture of operations without discussion of the computer hardware. The FM representation provides a complete conceptual description of the process of execution inside the computer. The execution is controlled by the operating system sphere that activates the program main sphere statements in sequential order. In the statement sphere, the execution starts with the first statement, then the second statement. This computer-based view of the program enhances its understanding. The statement: std::cout << "Welcome to C++!\n"; presents some mysteries to the student: What is "Welcome to C++!\n"? Where was it? What is cout? Is it the screen? Where is the screen? Usually, the answers are given in textual or oral format, but now FM presents a blueprint of this statement just like the blueprint for water and electrical connections in a building. Of course such a map enhances understanding more than the analogous architectural description: pipes << water. In the CpE-200 class, students agreed with this conclusion; however, they complained about the complexity of the representation. Keyboard Transfer data Release Create Fig. 7 User action triggers generating of data in the keyboard that flows to the computer system 1 2 3 4 5 int main () { std::cout << "Welcome to C++!\n"; return 0 } 4.2 Program 1 Now consider the C++ program 1 shown in Fig. 8. For comparison, Fig. 9 shows its FM representation. The process starts at circle 1, where the first statement is executed by triggering cout (circle 2) to retrieve the string (3) from memory that flows to the screen (4). Then the return statement is executed (5), and (if execution is successful) it creates zero (6) that flows to the operating system (7). Notice the resemblance of this program to the example given in Fig. 4 in the previous section. Main, statements, operating system, memory system, and screen as well as Market, manager, employee, and exhibition are all conceptual spheres. In the Computer sphere, there are the sub-spheres Operating system, and Main. Main includes the Statements sphere. In this sphere there are statement 1 and statement 2. Statement 1 has three flowsystems: Memory, cout and screen. The second statement has the flowsystem of the return signal. Since statement 2 has a single flowsystem, they are represented by one rectangle. Fig. 8 C++ program 1 Computer system Operating system Main Statements 2 Memory system Transfer Release “Welcome to C++!\n” Statement 1 3 1 Screen 4 Transfer Receive Receive Release 1. Display “Welcome to C++!” 2. Carriage return Std::cout Transfer Process Process Return Create 0 6 5 Statement 2 Release 7 Transfer Fig. 9 FM description of program 1 4.3 Program 2 Now consider the program shown in Fig. 10 and its corresponding FM representation in Fig. 11, which shows that within the main sphere, in the statements sphere, statements are executed in sequence. Statements std::cin >> integer1; std::cin >> integer2; can be drawn in one box in Fig. 11. int main() 2 { 3 int integer1; 4 int integer2; 5 int sum; 6 std::cin >> integer1; 7 std::cin >> integer2; 8 sum = integer1 + integer2; 9 std::cout << "Sum is " << sum << std::endl; 10 return 0; 11 } Operating system User 1 Main Statements Statement: std::cin >>integer1; integer1; 2 Keyboard Memory system 5 Integer1 Create Receive Transfer 1 Receive Transfer Transfer 4 Memory system Statement: std::cin >>integer2; Keyboard 6 Create Receive Integer2 8 3 Receive Std::cin Release Receive Transfer Transfer Transfer 7 Std::cin Release Receive Statement: sum = integer1 + integer2; Fig. 10 C++ program 2 The execution starts by waiting for user input (1) through the keyboard (2) that is received by cin (3) to be sent to the memory system (4) and stored in location integer1 (5). Similarly, flowsystems (6–8) deposit integer2 in the memory. In the statement Sum = integer1 + integer2; the values of integer1 and integer2 (9–10) flow to the ALU (11), where addition is performed (12) to trigger generating (13) the result that flows to the memory (14). As in program 1, the statements are executed sequentially and return creates zero and sends it to the operating system. The rest of statements in Fig. 11 can be explained in a similar fashion to similar constructs discussed previously. Sub-statements std::cout << "Sum is " std::cout << sum << std::endl; in std::cout << "Sum is " << sum << std::endl; can be drawn in a single box in Fig. 11. Notice how the assignment statement is represented. Understanding this modeling would, certainly, eliminate any confusion between the semantics of the statement and the meaning of the symbol “=” in the statement. Variables are also clearly defined in terms of name, value, and type. Integer1, integer2, and sum are names of locations in the memory. This is usually repeated by the teacher, but it hardly “sticks” in the students’ minds the way a picture depicted by the FM representation does. Different types of variables are emphasized by flowing in different flowsystems. Memory system 9 Transfer Release Transfer 11 Integer1 Receive Process: 12 ADDITION Integer2 10 14 Sum Receive ALU Create 13 Statement: std::out<<”Sum is “<<sum<<end1; Memory system Transfer Release “Sum is” Screen Transfer Std::cout Transfer Receive Process Receive Release 1. Display “Sum is ” Process Memory system Transfer Release sum Screen Transfer Std::cout Transfer Receive Process Receive Release Process 1. Display Sum 2. Carriage return Return Create 0 Release Transfer Fig. 11 FM description of cout and Screen 4.4 If statement 1 int main () 2 { 3 int num1; 4 int num2; 5 cout << "Enter two integers\n" 6 7 cin >> num1 >> num2; 8 if (num1 == num2) 9 cout << num1 << " is equal to " << num2 << endl; Fig. 12 shows a C++ program that involves an if statement. Fig. 13 shows its FM representation. The computing process starts with the flow of “Welcome to C++!\n” and “the relationships they satisfy:” (1) to the screen (2). Then num1 and num2 are input through the keyboard (3) to flow and be stored in the memory, as described previously (4). 40 42 Other if statements return 0; } Fig. 12 C++ program 3 Operating system Main Statements Statement: Memory system Transfer Release cout << "Enter two integers\n" Screen Transfer Std::cout Release Receive “Enter two integers/n” 1 Transfer Memory system num1 num2 Receive Memory system equal to " << num2 << endl; num1 Receive Std::cin Transfer Release Transfer Statement: if ( num1 == num2 ) cout << num1 << " is num1 num2 5 1. Display “Enter two integers” 2. Carriage return 2 Process 4 Process Receive 3 Keyboard Create Transfer 6 ALU Receive Transfer Release Transfer Receive Statement: cin >> num1 >> num2; Process: num1 = num2? Yes 7 8 Release Transfer Memory system 12 Transfer Transfer Receive Transfer Process 13 Release cout 14 Release Receive Process Print num1 9 Screen “is equal to” Memory system 10 cout Release Receive Transfer Transfer Process Num2 Release Transfer 16 Memory system 15 Screen Transfer Transfer Receive Process Process 1. Display “is equal ” 2. Carriage return Receive Release cout 17 Screen … Other if statements Return Create 0 Release Receive Transfer Fig. 13 FM representation of C++ program 3 Process Print num2 11 The if statement is executed by retrieving num1 and num2 from memory (5) to flow to the ALU (6). In the ALU, the two integers are compared, and if they are equal (7), then this triggers (8) three output constructs (9–11). In output 9, the value of num1 (12) flows to the screen (13). In output 10, the string “ is equal to ” (14) flows to the screen (15). In output 11, the value of num2 (16) flows to the screen (17). Figure 14 shows a simplified version of the FM representation, where a diamond is used for an if statement in the fashion of flowcharts. Fig. 15(a) shows further simplification to arrive at the flowchart shown in Fig 15(b). Accordingly, the FM representation provides a complete description of the process that is sketched by flowcharts. Operating system Main Statements Memory system “Enter two integers/n” Screen Std::cout num1 1. Display “Enter two integers” 2. Carriage return Std::cin Memory system num2 Keyboard ALU Memory system num1 num1 cout Memory system Screen “is equal to” cout Screen Memory system 1. Display “is equal ” cout Num2 … Create 0 Yes um1 = num2? num2 print num1 Memory system 2. Carriage return Screen Print num2 Other if statements Return Fig. 14 Simplified version of FM representation of C++ program 3 num1 num1 “is equal to” num2 cout cout um1 = num2? Yes Yes um1 = num2? Display num1 Display num1 1. Display “is equal ” 2. Carriage return 1. Display “is equal ” 2. Carriage return Display num2 Num2 cout Display num2 (b) (a) Fig. 15 From FM to flowchart A. “Enter grade” is printed (4). B. grade is input (5) C. The values of grade and total are added and the result is stored in total (6) D. gradecounter is incremented by 1 (7) Figure 18 shows a simplified version of the while loop. 4.5 While statement Fig. 16 shows a portion of the C++ program that involves a while statement, and Fig. 17 depicts its FM representation. The program problem can be stated as follows: A class of ten students took a quiz. The grades (integers in the range 0 to 100) for this quiz are available to you. Determine the class average on the quiz. The execution of the While statement starts at circle 1, where the value of gradecounter is sent to the ALU to be compared to 10. For simplicity’s sake, we ignore here the issue that the constant 10 itself is fetched from memory. Accordingly, if gradecounter ≤ 10, the block in the brackets {} is executed (3). Four tasks are triggered: 2 Process GradeCounter<=10 22 23 24 25 26 27 while (gradeCounter <= 10) { cout << "Enter grade: "; cin >> grade; total = total + grade; gradeCounter = gradeCounter + 1; } Fig. 16 While statement ALU Receive Transfer ALU Transfer cout Transfer Memory Create Process: +1 Release 3 Release {} 1 Receive gradeCounter Receive Transfer 4 A “Enter grade” B cin Release Release Transfer Create ALU Process: total + grade 5 Receive Receive total grade Transfer C Release Receive 6 D Fig. 17 FM representation of C++ program 3 Process GradeCounter<=10 ALU Memory ALU cout gradeCounter {} A B C Process: +1 “Enter grade” ALU cin grade total Process: total + grade D Fig. 18 Simplified FM representation of While statement - 5. Conclusions This paper proposes a diagrammatic methodology that produces a conceptual representation of instructions for programming source codes. The paper focuses on diagrams used for teaching C++ programming. C++ programming constructs are represented in the proposed method in order to show that it can provide a foundation for understanding the behavior of running programs. The paper introduces the methodology for the purpose of facilitating discussion about the FM model, and to report initial findings in its application. The method is being applied in a yearlong study to explore its potential uses. The initial results are as follows: - Some students complained at the beginning that the FM method is complex. The instructor then showed them design diagrams from different engineering design application (blueprints of buildings, electrical systems, aerodynamics, etc.). The argument is in order to build a precise specification of a system, then, when it seems complicated diagrams are necessary, as long as they are developed in a systematic way. FM has few concepts that are repeatedly applied in different parts of the schemata. Programs, especially those embedded in critical systems (e.g., heart control instruments, airplanes) ought to be fully understood and specified. - Students have indicated that their understanding of C++ increased when the instructor explained the semantics of the language utilizing the FM model. It should be pointed out that this method is utilized side by side with the typical (oral) explanation of C++ statements. - Early indicators point to the fact that the FM methodology benefits analysis of programs, but not as a method to construct them as in the case of pseudo code. Nevertheless, since designing and building programs is an iterative process, some students reported that the FM method helped in rewriting their programs after they’d written earlier versions and examined their FM semantics. - As demonstrated in Fig. 15, FM representation can be simplified and reduced to flowcharts. This gives more meaning to the origin of flowcharts based on conceptual operations inside the computer. Similar results can be applied to pseudo codes. We can conclude that the FM method as applied in this paper presents a new viable approach in the programming domain; however, its advantages/disadvantages are still to be explored in two areas: Experimentation with the method in actual programming environments. - Development of a friendly user interface for FM, with possible auto-diagramming of programs and statements [26]. In the current experiment, information about exam results is being collected over the course of two semesters, and results will be reported within a year. References [1] S. D. Bragg, and C. G. Driskill, “Diagrammatic-Graphical Programming Languages and DoD-STD-2167A”, IEEE Systems Readiness Technology Conference, “Cost Effective Support into the Next Century”, Conference Proceedings, 1994, pp. 211–220. [2] W. M. Johnston, J. R. P. Hanna, and R. J. Millar, “Advances in Dataflow Programming Languages”, ACM Computing Surveys, Vol. 36, No. 1, 2004, pp. 1–34. [3] Akepogu Anand Rao, and Karanam Madhavi, “Framework for visualizing model-driven software evolution and its application”, IJCSI International Journal of Computer Science Issues, Vol. 7, Issue 1, No. 3, January 2010. [4] Victor R. Basili, “Viewing Maintenance as Reuse-Oriented Software Development”, IEEE Software, Vol. 7, No. 1, 1990. [5] James Kiper, Chuck Ames, and Lizz Howard, “Using Program Visualization to Enhance Maintainability and Promote Reuse”, in Proceedings of Computing in Aerospace, March 1995, American Institute of Aeronautics and Astronautics. [6] Norman Wilde, Understanding Program Dependencies, Carnegie Mellon University, Software Engineering Institute, SEI-CM-26, August 1990. [7] Dhirendra Pandey, Ugrasen Suman, and A. K. Ramani, “A Framework for Modelling Software Requirements”, IJCSI International Journal of Computer Science Issues, Vol. 8, Issue 3, No. 1, May 2011. [8] A. Von Mayrhauser, and A. M. Vans, “Program Comprehension during Software Maintenance and Evolution”, Computer, Vol. 28, No. 8, 1995, pp. 44-55. [9] M. Cherubini, G. Venolia, R. DeLine, and A. J. Ko, “Let's Go to the Whiteboard: How and Why Software Developers Draw Code”, in ACM Conference on Human Factors in Computing Systems (CHI), 2007, pp. 557–566. [10] J. Grundy, and J. Hosking, “Supporting Generic SketchingBased Input of Diagrams in a Domain-Specific Visual Language Meta-Tool”, in 29th International Conference on Software Engineering (ICSE), 2007, pp. 282–291. [11] V. Sinha, D. Karger, and R. Miller, “Relo: Helping Users Manage Context during Interactive Exploratory Visualization of Large Codebases,” in IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC'06), 2006, pp. 187–194. [12] M. A. D. Storey, and H. A. Müller, “Manipulating and Documenting Software Structures Using SHriMP Views”, in 11th International Conference on Software Maintenance (ICSM), 1995, pp. 275. [13] John Cussans, “Diagram As Thinking Machine”, DRUGG Presentation, Art as Metapractice (Part One). http://diagramresearch.wordpress.com/symposia/ [14] Seonah Lee, Gail C. Murphy, Thomas Fritz, and Meghan Allen, “How Can Diagramming Tools Help Support Programming Activities?” in IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC 2008), Herrsching am Ammersee, Germany, September 15–19, 2008. [15] A. Robins, J. Rountree, and N. Rountree, “Learning and Teaching Programming: A Review and Discussion”, Computer Science Education, Vol. 13, No. 2, 2003. [16] L. E. Winslow, “Programming Pedagogy – A Psychological Overview”, SIGCSE Bulletin, Vol. 28, 1996, pp. 17–22. [17] J. Rogalski, and R. Samurçay, “Acquisition of Programming Knowledge and Skills“, In J. M. Hoc, T.R.G. Green, R. Samurcay, and D. J. Gillmore (Eds.), Psychology of Programming, pp. 157–174. London: Academic Press, 1990. [18] Lynda Thomas, Mark Ratcliffe, and Benjy J. Thomasson, “Can Object (Instance) Diagrams Help First Year Students Understand Program Behaviour?” Diagrams, 2004, pp. 368– 371. [19] R. E. Brooks, “Towards a Theory of the Cognitive Processes in Computer Programming”, International Journal of Man-Machine Studies, Vol. 9, 1977, pp. 737–751. [20] F. P. Brooks Jr., The Mythical Man-Month: Essays on Software Engineering, Anniversary Edition. Reading, MA: Addison-Wesley, 1995. [21] Sabah Al-Fedaghi, “Reconceptualization of Class-based Representation in UML", IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 6, 2012. [22] Sabah Al-Fedaghi, “Diagrammatization of the Transmission Control Protocol”, IJCSI International Journal of Computer Science Issues, Vol. 9, Issue 5, 2012. [23] Sabah Al-Fedaghi, “Scrutinizing the Rule: Privacy Realization in HIPAA”, International Journal of Healthcare Information Systems and Informatics (IJHISI), Vol. 3, No. 2, 2008, pp. 32-47. [24] Sabah Al-Fedaghi, “Scrutinizing UML Activity Diagrams”, 17th International Conference on Information Systems Development (ISD2008), Paphos, Cyprus, August 25–27, 2008. [25] Sabah Al-Fedaghi, “Information Management and Valuation”, International Journal of Engineering Business Management, Vol. 4, 2012, p. 47. [26] Soumaya Amdouni, Wahiba Ben Abdessalem Karaa, and Sondes Bouabid, “Semantic Annotation of Requirements for Automatic UML Class Diagram Generation”, IJCSI International Journal of Computer Science Issues, Vol. 8, Issue 3, No. 1, May 2011. Sabah Al-Fedaghi holds an MS and a PhD in computer science from the Department of Electrical Engineering and Computer Science, Northwestern University, Evanston, Illinois, and a BS in Engineering Science from Arizona State University, Tempe. He has published two books and more than 70 articles published/forthcoming in more than 50 different peer-reviewed journals. He has also published more than 80 articles in conferences on Software Engineering, Database Systems, Information Systems, Computer/information Ethics, Information Privacy, Information Security and Warfare, Conceptual Modeling, and Artificial Agents. He is an associate professor in the Computer Engineering Department, Kuwait University. He previously worked as a programmer at the Kuwait Oil Company and headed the Electrical and Computer Engineering Department (1991–1994) and the Computer Engineering Department (2000– 2007).
6cs.PL
Denotational Validation of Higher-Order Bayesian Inference ADAM ŚCIBIOR, University of Cambridge, England and Max Planck Institute for Intelligent Systems, arXiv:1711.03219v1 [cs.PL] 9 Nov 2017 Germany OHAD KAMMAR, University of Oxford, England MATTHIJS VÁKÁR, University of Oxford, England SAM STATON, University of Oxford, England HONGSEOK YANG, KAIST, South Korea YUFEI CAI, Universität Tübingen, Germany KLAUS OSTERMANN, Universität Tübingen, Germany SEAN K. MOSS, University of Cambridge, England and University of Oxford, England CHRIS HEUNEN, University of Edinburgh, Scotland ZOUBIN GHAHRAMANI, University of Cambridge, England and Uber AI Labs, California, USA We present a modular semantic account of Bayesian inference algorithms for probabilistic programming languages, as used in data science and machine learning. Sophisticated inference algorithms are often explained in terms of composition of smaller parts. However, neither their theoretical justification nor their implementation reflects this modularity. We show how to conceptualise and analyse such inference algorithms as manipulating intermediate representations of probabilistic programs using higher-order functions and inductive types, and their denotational semantics. Semantic accounts of continuous distributions use measurable spaces. However, our use of higher-order functions presents a substantial technical difficulty: it is impossible to define a measurable space structure over the collection of measurable functions between arbitrary measurable spaces that is compatible with standard operations on those functions, such as function application. We overcome this difficulty using quasiBorel spaces, a recently proposed mathematical structure that supports both function spaces and continuous distributions. We define a class of semantic structures for representing probabilistic programs, and semantic validity criteria for transformations of these representations in terms of distribution preservation. We develop a collection of building blocks for composing representations. We use these building blocks to validate common inference algorithms such as Sequential Monte Carlo and Markov Chain Monte Carlo. To emphasize the connection between the semantic manipulation and its traditional measure theoretic origins, we use Kock’s synthetic measure theory. We demonstrate its usefulness by proving a quasi-Borel counterpart to the Metropolis-Hastings-Green theorem. CCS Concepts: • Mathematics of computing → Metropolis-Hastings algorithm; Sequential Monte Carlo methods; • Theory of computation → Probabilistic computation; Bayesian analysis; Denotational semantics; • Software and its engineering → Language types; Functional languages; Interpreters; Domain specific languages; • Computing methodologies → Machine learning; Additional Key Words and Phrases: quasi-Borel spaces, synthetic measure theory, Bayesian inference, applied category theory, commutative monads, Kock integration, initial algebra semantics, sigma-monoids Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s). © 2018 Copyright held by the owner/author(s). 2475-1421/2018/1-ART60 https://doi.org/10.1145/3158148 Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60 60:2 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani ACM Reference Format: Adam Ścibior, Ohad Kammar, Matthijs Vákár, Sam Staton, Hongseok Yang, Yufei Cai, Klaus Ostermann, Sean K. Moss, Chris Heunen, and Zoubin Ghahramani. 2018. Denotational Validation of Higher-Order Bayesian Inference. Proc. ACM Program. Lang. 2, POPL, Article 60 (January 2018), 31 pages. https://doi.org/10.1145/3158148 ACKNOWLEDGMENTS Supported by a Royal Society University Research Fellowship, Institute for Information & Communications Technology Promotion (IITP) grant funded by the Korea government (MSIP) No. R0190-162011 ‘Development of Vulnerability Discovery Technologies for IoT Software Security’, Engineering and Physical Sciences Research Council (ESPRC) Early Career Fellowship EP/L002388/1 ‘Combining viewpoints in quantum theory’, an EPSRC studentship and grants EP/N007387/1 ‘Quantum computation as a programming language’ and EP/M023974/1 ‘Compositional higher-order model checking: logics, models, and algorithms’, a Balliol College Oxford Career Development Fellowship, and a University College Oxford Junior Research Fellowship. We would like to thank Samson Abramsky, Thorsten Altenkirch, Bob Coecke, Mathieu Huot, Radha Jagadeesan, Dexter Kozen, Paul B. Levy, and the anonymous reviewers for fruitful discussions and suggestions. 1 INTRODUCTION One of the key challenges in Bayesian data analysis is to develop or find an efficient algorithm for estimating the posterior distribution of a probabilistic model with respect to a given data set. This posterior distribution combines prior knowledge encoded in the model and information present in the data set consistently according to the rules of probability theory, but its mathematical definition often involves integration or summation over a large index set and does not yield to an efficient computation strategy immediately. A data scientist typically has to make one of the suboptimal decisions: she has to consult a large body of specialised research in order to pick an algorithm suitable for her model, or to change the model so that it falls into one of those cases with efficient known algorithms for posterior inference, or to face the challenge directly by developing a new algorithm for herself. Recent probabilistic programming languages aim to resolve this dilemma. They include constructs for describing probability distributions and conditioning, and enable data scientists to express sophisticated probabilistic models as programs. More importantly, they come with the implementation of multiple algorithms for performing posterior inference for models and data sets expressed in the languages. The grand vision is that by using these languages, a data scientist no longer has to worry about the choice or design of such an inference algorithm but focuses on the design of an appropriate model, instead. In this paper, we provide a denotational validation of inference algorithms for higher-order probabilistic programming languages, such as Church [Goodman Goodman et al. 2008 2008], Anglican [Wood Wood et al. 2014] and Venture [Mansinghka 2014 Mansinghka et al. 2014 2014]. The correctness of these algorithms is subtle. The early version of the lightweight Metropolis-Hastings algorithm had a bug because of an incorrect acceptance ratio [Wingate Wingate et al. 2011 2011]. The correctness often relies on intricate interplay between facts from probability theory and those from programming language theory. Moreover, correctness typically requires stronger results from probability theory than those used for the usual Rn case in the machine-learning community (e.g., Green’s measure-theoretic justification of Markov Chain Monte Carlo rather than the usual one for Rn based on density functions). Our starting point is the body of existing results on validating inference algorithms for probabilistic programs [Borgström Borgström et al. 2016 2016; Hur et al. 2015 2015]. Those earlier results tend to be based on operational semantics, and often (not always) focus on first-order programs. By working in a modular Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:3 way with monads, denotational semantics and higher-order functions, we are able to validate sophisticated inference algorithms, such as resample-move Sequential Monte Carlo [Doucet Doucet and Johansen 2011], that are complex yet modular, being composed of smaller reusable components, by combining 2011 our semantic analysis of these components. The probabilistic programming language considered in the paper includes continuous distributions, which means that semantic accounts of them or their inference algorithms need to use measure theory and Lebesgue integration. Meanwhile, our semantic account uses a meta-language with higher-order functions for specifying and interpreting intermediate representations of probabilistic programs that are manipulated by components of inference algorithms. Such higher-order functions let us achieve modularity and handle higher-order functions in the target probabilistic programming language. These two features cause a tension because it is impossible to define a measurable space structure over the collection of measurable functions between arbitrary measurable spaces that is compatible with standard operations on those functions, such as function application. We resolve the tension using quasi-Borel spaces [Heunen Heunen et al. 2017 2017], a recently proposed mathematical structure that supports both function spaces and continuous distributions. We define a semantic class of structures for various intermediate representations of probabilistic programs, and semantic validity criteria for transformations of these representations in terms of distribution preservation. We develop a collection of building blocks for composing representations. We use these building blocks to validate common inference algorithms such as Sequential Monte Carlo and Markov Chain Monte Carlo. To emphasize the connection between the semantic manipulation and its traditional measure theoretic origins, we use Kock’s synthetic measure theory. We demonstrate its usefulness by proving a quasi-Borel counterpart to the Metropolis-Hastings-Green theorem. To ease the presentation, we proceed in two steps. First, we present our development in the discrete setting, where the set-theoretic account is simpler and more accessible. Then, after developing an appropriate mathematical toolbox, we transfer this account to the continuous case. Inference in the continuous setting, while conceptually very similar to the discrete case, is inseparable from our development. The semantic foundation for continuous distributions over higher-order functions has been very problematic in the past. The fact that our approach does generalise to the continuous case, and does so smoothly, is one of our significant contributions, only brought about through the careful combination of quasi-Borel spaces, synthetic measure theory, the meta-language, and the inference building blocks. The rest of the paper is structured as follows. Sec. 2 presents a core calculus, our metalanguage, with its type system and set-theoretic denotational semantics. Sec. 3 presents the core ideas of our development in a simpler discrete set-theoretic setting. Sec. 4 reviews the mathematical concepts required for dealing with continuous distributions. Sec. 5 presents representations and transformations for continuous distributions. Sec. 6 decomposes the common Sequential Monte Carlo inference algorithm into simpler inference representations and transformations. Sec. 7 similarly decomposes the general Trace Markov Chain Monte Carlo algorithm. Sec. 8 concludes. Basic results in synthetic measure theory are listed for the reader’s convenience in Appendix A. 2 THE CORE CALCULUS We use a variant of the simply-typed λ-calculus with sums and inductive types, base types and constructors, primitives, and primitive recursion, but without effects. We also use monad-like constructs in the spirit of Moggi Moggi’s computational λ-calculus [1989 1989]. The core calculus is very simple, and at places we need an inherently semantic treatment, which the core calculus alone cannot express. In those cases, we resort directly to the semantic structures, sets or spaces. However, the calculus still serves a very important purpose: every type and function expressed in it denote Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:4 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani τ , σ , ρ ::= types α positive variable | {ℓ1 τ1 . . . ℓn τn } variant | 1 | τ ∗σ finite product | µα .τ inductive type |τ → σ function |A base |F τ base constructors Γ B x 1 : τ1 , . . . , x n : τn variable contexts t, s, r ::= terms | match t binary products x variable with ( x, y) → s | τ .ℓ t variant constructor | () | (t, s) nullary and binary tuples | match t inductive types | τ .roll iso-inductive constructor with roll x → s | λx : τ .t function abstraction | τ .fold t inductive recursion | match t pattern matching: variants | ts function application | φ primitive with { ℓ1 x 1 → s 1 · · · ℓn x n → sn } Fig. 1. Core calculus types (top) and terms (bottom) well-formed objects and well-formed morphisms. In the continuous case, using this calculus yields correct-by-construction quasi-Borel spaces and their morphisms, avoiding a tedious and errorprone manual verification. Using the core calculus also brings our theoretical development closer to potential implementations in functional languages. 2.1 Syntax Fig. 1 (top) presents the types of our core calculus. To support inductive types, we include type variables, taken from a countable set ranged over by α, β, γ , . . .. Our kind system will later ensure these type variables are strictly positive: they can only appear free covariantly — to the right of a function type. Variant types use constructor labels taken from a countable set ranged over by ℓ, ℓ1 , ℓ2 , . . .. Variant types are in fact partial functions with a finite domain from the set of constructor labels to the set of types. When σ is a variant type, we write (ℓ τ ) ∈ σ for the assertion that σ assigns the type τ to ℓ. We include the standard unit type, binary products, and function types. We include unary uninterpreted base types and constructors. While we use a list syntax for variable contexts Γ, they are in fact partial functions with a finite domain from the countable set of variables, ranged over by x, y, z, . . ., to the set of types. We desugar stand-alone labels in a variant type {· · · ℓ · · ·} to the unit type {· · · ℓ () · · ·}. We also desugar seemingly-recursive type declarations τ B σ [α 7→ τ ] to τ B µα .σ . Example 2.1. The type of booleans is given by bool B {True False}. The type of natural numbers is given by N B {Zero Succ N} desugaring to N B µα .{Zero Succ α }. The type of α-lists is given by List α B {Nil Cons α ∗ List α }, desugaring to List α B µβ .{Nil Cons α ∗ β }. Base types and constructors allow us to include semantic type declarations into our calculus. For example, we will always include the following base types: • I : unit interval [0, 1]; • R: extended real line [−∞, ∞]; • R+ : non-negative extended reals • R: real line (−∞, ∞); • R+ : non-negative reals [0, ∞); and [0, ∞]. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference (α ∈ ∆) 60:5 for all 1 ≤ i ≤ n: ∆ ⊢k τi : type ∆ ⊢k α : type ∆ ⊢k {ℓ1 τ1 . . . ℓn τn } : type ∆ ⊢k 1 : type ⊢k τ : type ∆ ⊢k σ : type : : ∆ ⊢k τ type ∆ ⊢k σ type ∆, α ⊢k τ : type ∆ ⊢k τ ∗ σ : type ∆ ⊢k A : type ∆ ⊢k µα .τ : type ∆ ⊢k τ → σ : type : : ∆ ⊢k τ type for all (x τ ) ∈ Γ: ⊢k τ : type ∆ ⊢k F τ : type ⊢k Γ : context Fig. 2. Core calculus kind system In addition, once we define a type constructor such as List α, we will later reuse it as a base type constructor List τ , effectively working in an extended calculus. Thus we are working with a family of calculi, extending the base signature with each type definition in our development. Fig. 1 (bottom) presents the terms in our core calculus. Variant constructor terms τ .ℓ t are annotated with their variant type τ to avoid label clashes. The tupling constructors are standard. We use iso-inductive types: construction of inductive types requires an explicit rolling of the inductive definition such as N.roll (Zero()). Variable binding in function abstraction is intrinsically typed in standard Church-style. We include standard pattern matching constructs for variants, binary products, and inductive types. We include a structural recursion construct τ .fold for every inductive type τ . Function application is standard, as is the inclusion of primitives. To ease the construction of terms, we use the standard syntactic sugar (e.g. let x = t in s for (λx . t)s, if then else for pattern matching booleans), informally elide types from the terms, elide roll ing/unrolling inductive types, and informally use nested pattern matching. Example 2.2. For List τ = µα .{Nil Cons τ ∗ α }, we can express standard list manipulation: x :: x s = Cons(x, x s ) x s ++ ys = foldr ys (::) x s foldr a f = List τ .fold λ{ Nil → a Cons (x, b) → f (x, b)} map f x s = foldr [ ] (λ{ (y, ys ) → (f (y), ys )}) where we abbreviate [a 1 , . . . , an ] to Cons (a 1 , . . . , Cons (an , Nil) . . .). 2.2 Type system To ensure the well-formedness of types, which involve type variables, we use a simple kind system, presented in Fig. 2. Each kinding judgement ∆ ⊢k τ : type asserts that a given type τ is well-formed in the type variable context ∆, which is finite set of type variables. The kinding judgements are standard. All type variables must be bound by the enclosing context, or by an inductive type binder. The contravariant position in the function type τ → σ must contain a closed type, ensuring that free type variables can only appear in strictly positive positions. Variable contexts Γ must only assign closed types. Example 2.3. The types from Ex. 2.1 are well-kinded: ⊢k bool, N, List α : type. We define capture avoiding substitution of types for type variables in the standard way, which obeys the usual structural properties. Henceforth we consider only well-formed types in context, leaving the context implicit wherever possible, and gloss over issues of alpha-convertibility of bound type variables. To type terms, we assume each primitive φ has a well-formed type ⊢k τφ : type associated with it. Fig. 3 presents the resulting type system. Each typing judgement Γ ⊢ t : τ asserts that a given term t is well-typed with the well-formed closed type ⊢k τ : type in the variable context ⊢k Γ : context. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:6 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani Γ ⊢ t : τi Γ ⊢t :σ ∗ρ Γ ⊢ τ .ℓi t : τ ((ℓi τi ) ∈ τ ) Γ ⊢ () : 1 Γ, x : τ ⊢ t : σ (τ = µα .σ )  Γ ⊢ (t, s) : τ ∗ σ Γ ⊢ τ .roll : σ [α 7→ τ ] → τ Γ ⊢ λx : τ .t : τ → σ for each 1 ≤ i ≤ n: Γ, x i : τi ⊢ si : τ Γ ⊢ t : {ℓ1 τ1 . . . ℓn τn } Γ ⊢t :τ Γ ⊢x :τ Γ ⊢s :σ ((x : τ ) ∈ Γ) Γ ⊢ match t with {ℓ1 x 1 → s 1 · · · ℓn x n → sn } : τ Γ, x : σ , y : ρ ⊢ s : τ Γ ⊢ t : µα .σ Γ, x : σ [α 7→ µα .σ ] ⊢ s : τ Γ ⊢ match t with(x, y) → s : τ Γ ⊢ t : σ [α 7→ ρ] → ρ (τ = µα .σ ) Γ ⊢ τ .fold t : τ → ρ Γ ⊢ match t with roll x → s : τ Γ ⊢t :σ →τ Γ ⊢s :σ Γ ⊢ts :τ Γ ⊢ φ : τφ Fig. 3. Core calculus type system The rules are standard. By design, every term has at most one type in a given context. Example 2.4. Once desugared, the list manipulation terms from Ex. 2.2 have types: (::) : τ ∗ List τ → List τ map : (τ → σ ) → (List τ → List σ ) 2.3 foldr : σ ∗ (τ ∗ σ → σ ) ∗ List τ → σ (++) : (List τ ) ∗ (List τ ) → List τ Primitive recursion As is well-known [Geuvers Geuvers and Poll 2007 2007; Hutton 1999 1999], structural recursion on inductive types allows us to express primitive recursion. By ‘primitive recursion’, we mean recursing through values of an inductive type µα .σ using a term of the form: Γ, k : σ [α 7→ (µα .σ ) ∗ ρ] ⊢ t : ρ with the intention that t can use either arbitrary (total) processing on the sub-structures of its input k, or make a primitive recursive call to itself with a sub-structure. In order to desugar such a term into a function of type τ ∗ (µα .σ ) → ρ, we use terms of the following type, defined by induction on types: π α .σ, ρ : σ [α 7→ (µα .σ ) ∗ ρ] → σ [α 7→ µα .σ ] and interpret the primitive recursive declaration t embodied by:   Γ, x : µα .σ ⊢ match (µα .σ ).fold λk : σ [α 7→ (µα .σ ) ∗ ρ]. (roll πα .σ, ρ k, t) x with (_, r ) → r : σ This translation is global in nature: the structure of the term π depends on the type of t. Thus, it does not constitute a macro translation [Felleisen Felleisen 1991 1991]. With this point in mind, we will allow ourselves to use primitive recursive definitions. Example 2.5. We define a function aggr : List(R+ ∗ X ) → List(R+ ∗ X ) which takes a list of weighted values and aggregates all the weights based on their values. We make use of the auxiliary function add : (R+ ∗ X ) ∗ List(R+ ∗ X ) → List(R+ ∗ X ), which adds a weighted value to an already aggregated list. We define add by primitive recursion: add((s, a), x s ) B match x s with {[ ] → [(s, a)] (r , x) :: x s → if x =a then (s + r , a) :: x s else (r , x) :: add((s, a), x s )} -- new entry -- accumulate -- recurse Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference ⎜α⨆︁ d B d(α) ⎟{ℓ1 τ1 . . . ℓn τn }∮︀ d B ⎜µα .τ ⨆︁ d B µX . ⎜τ ⨆︁ d[α 7→ X ] n Õ ⎜τi ⨆︁ d ⎜1⨆︁ B  ⎜τ ⨆︁ () ⎜τ → σ ⨆︁ d B ⎜σ ⨆︁ d i=1 60:7 ⎜F τ ⨆︁ d B B ⎜F⨆︁ (⎜τ ⨆︁ d) ⎜A⨆︁ d B B ⎜A⨆︁ Fig. 4. Core calculus type-level semantics and set aggr B foldr [ ] add. This example makes use of an equality predicate between X elements, restricting its applicability. 2.4 Denotational semantics We give a set-theoretic semantics to the calculus. In such set-theoretic semantics, types-in-context ∆ ⊢k τ : type are interpreted as functors ⎜τ ⨆︁ : Set∆ → Set, i.e., ⎜τ ⨆︁ assigns a set ⎜τ ⨆︁ (X α )α ∈∆ for every ∆-indexed tuple of sets, and a function  ⎜τ ⨆︁ f α : X α → Yα α ∈∆ : ⎜τ ⨆︁ (X α ) → ⎜τ ⨆︁ (Yα ) for every ∆-indexed tuple of functions between the sets with corresponding index, and this assignment preserves composition and identities. In order to interpret iso-inductive types µα .τ , we need canonical isomorphisms between the sets ⎜τ ⨆︁ (⎜µα .τ ⨆︁)  ⎜µα .τ ⨆︁. We will do this in a standard way, by interpreting ⎜µα .τ ⨆︁ as the initial algebra for the functor ⎜τ ⨆︁ : [ Set∆ → Set] → [ Set∆ → Set]. This means that for every functor A : Set∆ → Set with a natural family of functions {a X : (⎜τ ⨆︁ A)(X ) → A(X )}X ∈ Set∆ , there is a canonical natural family of functions {foldX : ⎜µα .τ ⨆︁ (X ) → A(X )}X ∈ Set∆ . A technical requirement is needed to ensure that this initial algebra exists: we fix a regular cardinal κ, and demand that each type denotes a κ-ranked functor (ranked functor for short), that is, that it denotes a functor that preserves κ-filtered colimits1 . The κ-ranked functors are closed under composition, products, sums, and initial algebras. Initial algebras for κ-ranked functors on locally presentable categories always exist, because they can be built in an iterative way by transfinite induction (see e.g. [Kelly Kelly 1980 1980]). 2.4.1 Set-theoretic interpretation. To interpret types, we assume a given interpretation B ⎜−⨆︁ of the base types A as sets B ⎜A⨆︁ and of base type constructors F as ranked functors B ⎜F⨆︁ : Set → Set. We then interpret each well-formed type in context ∆ ⊢k τ : type as a ranked functor ⎜τ ⨆︁ : Set∆ → Set, as depicted in Fig. 4. In this definition, the parameter d may be either a tuple of sets or functions. When interpreting type variables, we write d(α) for the α-indexed component of d. The interpretation of simple types uses disjoint unions, singletons, finite products, and exponentials, i.e. the bi-cartesian closed structure of Set. We interpret inductive types ⎜µα .τ ⨆︁ d using the initial algebra for the ranked functor λX . ⎜τ ⨆︁ d[α 7→ X ] : Set → Set. In the semantics of the function type τ → σ , the exponential makes no use of the functor’s arguments, and relies on the fact that all type variables are strictly positive. We use the given interpretation of base types and type constructors to interpret them. Lemma 2.6. The semantics of types is well-defined: every well-formed type ∆ ⊢k τ : type denotes a ranked functor ⎜τ ⨆︁ : Set∆ → Set. In particular, every closed type denotes a set. 1 We do not use simpler classes of functors, such as polynomial functors or containers, as they are not closed under subfunctors, given by subsets in the discrete case and subspaces in the continuous case, which we need in the sequel. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:8 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani instance Monad (List) where return x = [x]  x s >>= f = foldr [ ] λ(x, ys ). f (x) ++ ys x s (a) Declaring monadic interfaces Sugar • x ← t; s • return t • t; s Elaboration t >>= λx . s returnT t _ ← t; s (b) Haskell’s do-notation Fig. 5. Monadic programming notation The proof is by induction on the kinding judgements, using well-known properties of Set. We will always interpret the base types I, R, etc. by the sets they represent. Example 2.7. We calculate the denotations of the types from Ex. 2.1 2.1. Booleans denote a twoelement set ⎜bool⨆︁ = {False, True}, and the natural numbers denote the set of natural numbers : ⎜N⨆︁ = N. By Lemma 2.6 2.6, ⎜List⨆︁ denotes a ranked functor Ð List Set → Set, and this functor is given by the set of sequences of X -elements List X B n ∈N X n . Beyond establishing the well-definedness of the semantic interpretation, Lemma 2.6 equips us with syntactic means to define ranked functors. Once defined, we can add these functors to our collection of base types (in an extended instance of the core calculus). In the sequel, we will often restrict a given ranked functor F : Set → Set by specifying a subset GX ⊆ FX . Doing so is analogous to imposing an invariant on a datatype. The subsets GX form a subfunctor G ⊆ F precisely if they are closed under the functorial action of F , i.e., for every function f : X → Y and a ∈ GX , F f (a) ∈ GY . Lemma 2.8. Subfunctors of ranked functors over Set are ranked. We can prove this lemma directly, but it also follows from a higher-level argument using the commutation of finite limits and κ-directed colimits in Set. 2.5 Monadic programming In the sequel, we will be working with types that support a monadic programming style. More precisely, a monadic interface T consists of a triple T = (T , returnT , >>=T ) where: T assigns to each T set X a set T X ; returnT assigns to each set X a function returnX : X → T X ; and >>=T assigns to T each pair of sets X and Y a function >>=X,Y : T X × (TY )X → TY . We borrow Haskell’s type-class syntax to define such interfaces. As an example, Fig. 5a defines a monadic interface over List. Each such monadic interface T allows us to use standard do-notation summarised in Fig. 5b 5b. Though simple in principle, we must take care when treating this notation as syntactic sugar, as choosing the appropriate function returnX or >>=X,Y at each desugaring step must take typing information into account. When we use do-notation in the sequel, we ensure that such choices can be disambiguated. Finally, we will delimit our use of do-notation to within a do-block T .do {. . .}, omitting the monadic interface T or the entire delimiter when either is clear from the context. Importantly, we do not insist that a monadic interface satisfies the monad associativity and unit laws: (return x) >>= f = f (x), a >>= return x = a, and (a >>= f ) >>= д = a >>= (λx . (f x >>= д)). Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 3 60:9 DISCRETE INFERENCE We can now lay-out the core ideas in the simpler, set-theoretic case: a semantic structure for higherorder (discrete) probabilistic programs, intermediate representations of these programs for the purpose of inference, valid transformations between these representations, and modular building blocks for creating new representations and transformations from existing ones. For simplicity, we consider representations and transformations from simple rather naive inference algorithms only in this section. In Sec. 6 and Sec. 7, we show how the core ideas here apply to advanced algorithms when aided with further technical developments. 3.1 The mass function monad For our purposes, probabilistic programming languages contain standard control-flow mechanisms and data types, such as our core calculus, together with probabilistic choice and conditioning operations. In the discrete case, these are given by two effectful operations: Γ ⊢ t : R+ Γ ⊢comp flip : bool Γ ⊢comp score t : 1 In Bayesian probabilistic programming, we think of flip as drawing from a (uniform) prior distribution on bool, and of score as recording a likelihood. Typically, one calls score(f (x)) where f is a density function of a distribution, which records the likelihood of observing data x from the distribution f . The score might be zero, a hard constraint: this path is impossible. The score might be in the unit interval, the probability of a discrete observation; but in general a likelihood function can take any positive real value. The inference problem is to approximate the posterior distribution, from the unnormalized posterior defined by the program, combining a prior and likelihood. To give a set-theoretic semantic structure to such a higher-order language with these two constructs, it suffices to give a monadic interface T for which the associativity and unit laws hold, together with two functions: flip : ⎜1⨆︁ → T ⎜bool⨆︁ score : ⎜R+ ⨆︁ → T ⎜1⨆︁ For the purposes of the discrete development, the following monad fits the bill. A (finite) mass function over a set X is a function µ : X → R+ for whichthere exists a finite set F ⊆ X such that µ is 0 outside F : in other words, the support set supp µ B x ∈ X µ(x) , 0 is finite. For every set X ,  let Mass X B µ : X → R+ µ is a mass function . The mass function monad is given by: Mass B instance Monad (Mass) where return x 0 = λx . Í if (x = x 0 ) then 1 else 0 µ >>= f = λy. x ∈supp µ µ(x) · (f (x)(y)) and we set flip = λ_. 12 and score r = λ{ () → r }. Intuitively, values of Mass X represent unnormalized probabilistic computations of a result in X . From the Bayesian perspective, the meaning of a program is the unnormalized posterior. Lemma 3.1. The monadic interface Mass defines a ranked monad over Set. This monad is also known as the free positive cone monad, as it constructs the ‘positive fragment’ of a vector space over the field of reals with basis X . Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:10 3.2 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani Inference representations The mass function semantics is accurate, but idealised: realistic implementations cannot be expected to compute mass functions at arbitrary types, and especially at higher-order types. Instead, probabilistic inference engines would manipulate some representation of the program, while maintaining its semantics. Definition 3.2. A discrete inference representation T is a sextuple   T = T , returnT , >>=T , flipT , scoreT , mT consisting of:   • a monadic interface T , returnT , >>=T ; • two functions flipT : 1 → T 2 and scoreT : R+ → T 1, where 1 := ⎜1⨆︁, 2 := ⎜bool⨆︁; and T • an assignment of a meaning function mX : T X → Mass X for every set X such that the following laws hold for all sets X , Y , and x ∈ X , a ∈ T X , r ∈ R+ , and f : X → TY : returnMass x = m(returnT x) m(flipT ) = flipMass m(a >>=T f ) = (m a) >>=Mass λx . m(f x) m(scoreT r ) = scoreMass r As with monadic interfaces, we use a type-class notation for defining inference representations. Example 3.3 (Discrete weighted sampler). Consider the type Term α B {Return (R+ ∗ α) Flip (Term α ∗ Term α)} which induces a ranked functor Term. The elements of Term X are binary trees, which we call terms, whose leaves contain weighted values of type X . Fig. 6a presents the inference representation structure of the functor Term. Flip represents a probabilistic choice while Return holds the final value and the total weight for the branch. Thus an immediately returning computation is represented by a leaf with weight 1. The auxiliary function scale in the definition of >>= scales the leaves of its input term by the input weight. The function >>= itself substitutes terms for the leaves according to its input function f , making sure the newly grafted terms are scaled appropriately. The probabilistic choice operation flip constructs a single node with each leaf recording the probabilistic choice unweighted. Conditioning records the input weight. The meaning function recurses over the term, replacing each node representing a probabilistic choice by probabilistic choice of the mass function monad, and reweighting the end result appropriately. The main step in validating the inference representation laws involves >>=: first show that composing the meaning function with the auxiliary function scale scales the meaning of the input term appropriately, and then proceed by structural induction on terms. The weighted sampler representation in fact forms a proper monad over Set: it is the free monad for an algebraic theory with a binary operation flip and unary operations scorer subject to flip(scorer (x), scorer (y)) = scorer (flip(x, y)). As the mass function monad also validates these equations, the meaning function is then the unique monad morphism from Term to Mass preserving the operations flip and score. However, we emphasise that an inference representation need not form a proper monad, and that the meaning function need not be a monad morphism. Indeed, the Pop Sam representation introduced in Sec. 6 is not a monad and most of the non-trivial inference transformations we discuss are not monad morphisms. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:11 instance Discrete Monad (Term) where return x= Return (1, x) -- uses primitive recursion a >>= f = let (scale : R+ ∗ Term X → Term X ) = λs. λ{Return (r , x) → Return (s · r , x) Flip (k False , k True )→ Flip (scale(r , k False ), scale(r , k False ))} in match a with { Return (r , x) →scale(r , f x) Flip (k False , k True )→Flip (k False >>= f , -- uses primitive recursion k True >>= f )} flip = Flip (Return (1, False), Return (1, True)) score r = Return (r , ()) ma = fold λ{Return (r , x) → Mass .do {score r ; return x } Flip (µ False , µ True )→ Mass .do {x ← flip; if x then µ True else µ False }} (a) Discrete weighted sampler representation instance Inf Trans (W) where instance Discrete Monad (Enum) where return x= [(1, x)] liftT a = T .do { x ← a; x s >>= f = let (scale : R+ ∗ Enum X → Enum X ) = return(1, x)} λ{ (r , x s ) → map λ{ (s, y) → (r · s, y)} returnW T x= returnT (1, x) xs } a >>=W T f = T .do {(r , x) ← a; in foldr [ ] (s, y) ← f (x); λ{ ((r , x), ys ) → scale(r , f x) ++ ys } return(r · s, y)} xs 1 1 = lift flipT flipW T flip = [( 2 , False), ( 2 , True)] T score r = [(r , ())] scoreW T r = return Í Í (r , ()) m xs = λa. -- m x s a = (r,x )∈x s r mW T a = λx . (r,x )∈supp mT (a) r x =a   (tmap t) = t R+ ∗X X λ{ ((r , x), s) → foldr 0 xs if x = a then r + s else s} (b) Discrete enumeration sampler (c) Discrete weighting transformer Fig. 6. Example inference representations (a,b) and transformers (c) The weighted sampler representation allows us to incorporate both intensional and operational aspects into our development. Bayesian inference ultimately reduces a representation into probabilistic simulation. The weighted sampler representation can thus act as an internal representation of this simulation. Moreover, its continuous analogue will allow us to manipulate traces when analysing the Trace Markov Chain Monte Carlo algorithm in Sec. 7. Example 3.4 (Enumeration). The type Enum α B List(R+ ∗ α) induces a ranked functor Enum. Elements of Enum X form an enumeration of the mass function they represent, with the same value x potentially appearing multiple times with different weights. Values not appearing in the list at all have weight 0. Fig. 6b presents an inference representation structure using Enum. Returning a value lists the unique non-zero point mass. The >>= operation applies the given function to each element listed, Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:12 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani scales the list appropriately and accumulates all intermediate lists. The choice operation enumerates both branches with equal probability, and conditioning inserts a scaling factor. The meaning function assigns to an element the sum of its weights. This definition uses an equality predicate. Establishing the inference representation laws is straightforward. 3.3 Inference transformations We can now define the central validity criterion in our development. We decompose Bayesian inference algorithms into smaller transformations between inference representations. To be correct, these transformations need to preserve the meaning of the representation they manipulate: Definition 3.5. Let T , S be two inference representations. A discrete inference transformation t : T → S assigns to each set X a function t X : T X → S X satisfying mT (a) = mS (t X (a)) for every a ∈ TX. This validity criterion guarantees nothing beyond the preservation of the overall mass function of our representation. The transformed representation may not be better for inference along any axis, such as better convergence properties or execution time. It is up to the inference algorithm designer to convince herself of such properties by other means: formal, empirical, or heuristic. Some transformations change the representation type: Example 3.6 (Enumeration). Define a transformation: t : Term → Enum by: t B λ{ Return (r , x) → Enum .do {score r ; return x } Flip (x sFalse , x sTrue )→ Enum .do {b ← flip; if b then x sTrue else x sFalse }} Straightforward calculation shows it preserves the meaning functions. The last example is a special case: analogous functions form inference transformations t T : Term → T for every discrete inference representation T . To establish meaning preservation, calculate that both mTerm and mT ◦ t T are monad morphisms that preserve probabilistic choice and conditioning and appeal to the initiality of Term. An inference transformation need not be natural: Example 3.7 (Aggregation). Recall the functions aggrX : List(R+ ∗ X ) → List(R+ ∗ X ) from Ex. 2.5 which aggregate list elements according to their X component by summing their weights. It forms an inference transformation aggr : Enum → Enum. The meaning preservation proof uses straightforward structural induction. Note that aggr is not a natural transformation. 3.4 Inference transformers We can decompose the weighted sampler representation Term, which forms a monad, by transforming the discrete sampler representation DSam X B {Return X Sample (DSam X ∗ DSam X )} with the following writer monad transformer WT X B T (R+ ∗ X ), i.e. Term = W DSam. Such decompositions form basic building blocks for constructing and reasoning about more sophisticated representations. Definition 3.8. An inference transformer F is a triple (F , tmapF , liftF ) whose components assign: • inference representation F T to every inference representation T ; • inference transformation tmapF t : FT → FS to every inference transformation t : T → S; and • inference transformation liftT : T → F T to every inference representation T . We use type-class notation for defining inference transformers. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:13 Example 3.9. The weighting inference transformer structure on WT X B T (R+ ∗ X ) is given in Fig. 6c 6c. We lift a representation in T into WT by assigning weight 1 to it. The monadic interface uses the standard writer monad for the multiplication structure on R+ , accumulating the weights as computation proceeds. We lift the probabilistic choice from T , but crucially we reimplement a new conditioning operation using the explicitly given weights. The mass function meaning of a representation then accumulates the mass of all weights associated to a given value. We transform an inference transformation by picking the component of the appropriate type. It is straightforward to show that WT is an inference representation, using preservation of return and >>= by the meaning function to reduce the proof to manipulations of weighted sums over R+ . Establishing the validity of lift and tmap is straightforward. The weighting transformer augments the representation with a new conditioning operation, but transforms its choice operation to the new representation. We will later see more examples of both kinds. 3.5 Summary We have introduced our three core abstractions, inference representations, transformations, and transformers, in relation to a mathematical semantic structure, the mass function monad. The examples so far show that the higher-order structure in our core calculus acts as a useful glue for manipulating and defining these abstractions. In the continuous case, we will also use this higher-order structure to represent computations over the real numbers. 4 PRELIMINARIES In order to generalise this higher-order treatment to the continuous case, we first need to review and develop the mathematical theory of quasi-Borel spaces. Our development uses Kock Kock’s synthetic measure theory [2012 2012], which allows us to reason analogously to measure theory. In order to present the synthetic theory, we briefly review the required category theoretic concepts. These sections are aimed at readers who are interested in the categorical context of our development. Other readers may continue directly to § 4.3 4.3. 4.1 Category theory Basic notions. We assume basic familiarity with categories C, D, functors F , G : C → D, and natural transformations α, β : F → G, and their theory of limits, colimits, and adjunctions. To Î fix notation, a cartesian closed category is a category with finite products, denoted by 1, ×, ni=1 , and exponentials, denoted by X Y . In this subsection, we use the fragment of our core calculus consisting of the simply-typed λ-calculus (with sums, if necessary) to more compactly review the relevant concepts. Monads. A strong monad T over a cartesian closed category is a triple (T , return, >>=) consisting of an assignment of an object T X and a morphism returnX : X → T X for every object X , and an assignment of a morphism >>=X,Y : T X × (TY )X → TY , satisfying the monad laws from § 2.5 2.5. Given a monad T , a T -algebra A is a pair (|A| , >>=A ) consisting of an object |A|, called the carrier, and an TX : X assignment of a morphism >>=A to every object X satisfying X |A| → |A| (return x >>=A f ) = f x and ((a >>= f ) >>=A д) = a >>= (λx . f (x) >>=A д). The pair (T X , >>=) always forms a T -algebra called the free T -algebra over X . The Eilenberg-Moore category CT for a monad T consists of T -algebras and their homomorphism. The Kleisli category CT consists of the same objects as C, but morphisms from X to Y in CT are morphisms X → T Y Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:14 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani in C. The Kleisli category CT inherits any coproducts C has. A strong monad T is commutative when, for every a : T X , b : TY ⊢ T .do {x ← a; y ← b;return(x, y)} = T .do {y ← b; x ← a;return(x, y)} (The notion of strong/commutative monad is due to [Kock Kock 1972 1972]; our formulation of algebras also appears in [Marmolejo Marmolejo and Wood 2010 2010].) Biproducts. A zero object Z is both initial and terminal. A category has (finite, countable, etc.) biproducts if it has a zero object (and hence zero morphisms 0X,Y : X →Z →Y ) and the following canonical morphisms are invertible: h  i Í Î : i ∈I X i → j ∈I X j δi, j j ∈I where: δi,i B idX i , δi, j B 0X i ,X j for i , j. i ∈I Algebraic structure. Recall the notion of a commutative monoid (M, 1, ·) in a category with finite products. We extend it to countably many arguments. Let C be a category with countable products. A σ -monoid (see also [Haghverdi Haghverdi and Scott 2006 2006]) is a triple (M, 0, Σ) consisting of: an object M; a morphism 0 : 1 → M; and a morphism Σ : M N → M such that: • setting δ 0 B idM : M → M and δi B 0◦! : M → 1 → M, i > 0, we have Σ ◦ (δi )i ∈N = δ 0 ; and     • for every bijection φ : N  N × N, a (−,−) : M N×N ⊢ Σ Σ a (i, j) = Σ aφ(k ) . j ∈N i ∈N k ∈N Proposition 4.1. In a category with countable biproducts, each object M is a σ -monoid via: Î Í ∇ → M where ∇ is the codiagonal. 01, M : 1 → M Σ : i ∈N M  i ∈N M − Every morphism is a σ -monoid homomorphism with respect to this structure. A σ -semiring is a quintuple (S, 1, ·, 0, Σ) consisting of: a commutative monoid (S, 1, ·); and a σ -monoid (S, 0, Σ), such that a : S, b− ∈ S N ⊢ a · Σ (bi )i ∈N = Σ (a · bi )i ∈N . Given a σ -semiring (S, 1, ·, 0, Σ), an S-module is a pair (M, ⊙) consisting of a σ -monoid M; and  a morphism ⊙ : S × M → M satisfying: x = x, 0S ⊙ x = 0M , (a · b) ⊙ x = a ⊙ (b ⊙ x), Σ (an )n ∈N ⊙ x = Σ (an ⊙ x)n ∈N . 4.2 Synthetic measure theory Synthetic mathematics identifies structure and axioms from which we can recover the main concepts and results of specific mathematical theories, and transport them to new settings. We now briefly recount the relevant parts of Kock Kock’s [2012 2012] development. (In the finite discrete case, this is also related to Jacobs Jacobs’s [2017 2017] work on effectuses.) 4.2.1 Axioms and structure. Let C be a cartesian closed category with countable products and coproducts, and let M be a commutative monad over C. If the morphism ! : M 0 → 1 is invertible, then both the Eilenberg-Moore category C M and the Kleisli category C M have zero objects. As a h  i Î Í consequence, we have a canonical M-homomorphism >>= δi, j j : M i ∈N X i → j ∈N M X j . i  Definition 4.2. A measure category is a pair C, M consisting of a cartesian closed category C with countable products and coproducts, hand equalisers; and a commutative monad M over C such  i Í Î that the morphisms ! : M 0 → 1 and >>= δi, j j : M i ∈N X i → j ∈N M X j are invertible. i  We fix a measure category C, M for the remainder of this section. The intuition is that M X is the object of distributions/measures over X . Kock shows that, while short, the above definition has surprisingly many consequences. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:15 Notation Meaning R B M1 ⊢ f∗ µ f : YX, µ : MX B (M f )(µ) : ⊢ µ(X ) µ MX B !∗ µ B return(x) x :X ⊢ δ x µ : M X , f : (M Y )X ⊢ X f (x)µ(dx) B µ >>= f  w : RX , µ : M X ⊢w ⊙µ B X (w(x) ⊙ δ x )µ(dx) " #   f : (T Z )X ×Y , ⊢ Y f (x, y)k(x, dy) B Y f (x, y)k(x)(dy) X x : X , k : (TY ) # " P  f : (M X )X ×Y , ⊢ X ×Y f (x, y)µ(dx, dy) B X ×Y f (z)µ(dz) µ ∈ M(X × Y )    B X Y δ (x,y)ν (dy) µ(dx) µ : MX,ν : MY ⊢ µ ⊗ν Terminology Scalars Push-forward The total measure Dirac distribution Kock integral Rescaling µ : M X , f : |A| f : RX , µ : M X Expectation Lebesgue integral X EAx∼µ [f B µ >>= f B ERx ∼µ [f (x)] ⊢ (x)] ∫ ⊢ X f (x)µ(dx) Kernel integration Iterated integrals Product measure Fig. 7. Synthetic measure theory notation Both the Eilenberg-Moore and the Kleisli categories have countable biproducts, and as a consequence, all M-algebras have a σ -monoid structure and all M-homomorphisms are σ -monoid homomorphisms with respect to it. Moreover, this structure on the free algebra on the terminal object R B M 1 extends to a σ -semiring structure by setting: 1 B return() and r · s B M.do {r ; s}. Kock calls this structure the σ -semiring of scalars. Each M-algebra A has an R-module structure: r : R, a : |A| ⊢ r ⊙ a B M.do {r ; a} As C has equalisers, for each object X , we may form the equaliser P X subX M! MX − −− −− −− −→ → R be1 cause R = M 1. Each subX is monic, the monadic structure factors through sub turning P into a commutative monad P, and sub : P ↣ M into a strong monad monomorphism. The morphism M! : M X → R is called the total measure morphism, and P is then the sub-object of all the measures with total measure 1, and so we think of it as the object of probability measures over X . For example, every P-algebra is closed under convex linear combinations of scalars: if r − : N → R satisfies Σ (r i )i = 1 then µ : (P X )N ⊢ M!(Σ r i ⊙ µ ) = 1. − i i 4.2.2 Notation and basic properties. Kock’s theory shines brightly when we adopt a measuretheoretic notation, as in Fig. 7, by thinking of M X as the object of measures over X , and R as the object of scalars these measures take values in. The functorial action of the monad allows us to push measures along morphisms, and pushing all the measure into the terminal object gives a scalar we think of as the total measure of an object. The monadic return acts as a dirac distribution. The main advantage is the  Kock integral, synonymous to the ∫ monadic >>=. The main difference between the Kock integral and the usual Lebesgue integral from measure theory is that the Kock integral evaluates to a measure, and not a scalar. Calculating with the Kock integral is analogous to using Lebesgue integrals with respect to a generic test function, and proceeding by algebraic manipulation. The scalar rescaling ⊙ allows us to rescale a distribution by an arbitrary weight function. A kernel is a morphism k : X → M Y , and we use the usual notation for integration Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:16 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani against a kernel and iterated integration. We define the product measure by iterated integration. Finally, the >>= operation of an M-algebra A gives rise to an expectation operation. Here we will only make use of the scalars’ algebra structure, which generalises the usual Lebesgue integral. The justification for this notation is that it obeys the expected properties, which we now survey. The commutativity of the monad lets us change the order of integration: Theorem 4.3 (Fubini-Tonelli). For every pair of objects X , Y in a measure category (C, M): P     f (x, y)(µ ⊗ ν )(dx, dy) = ν (dy) X µ(dx)f (x, y) = ν (dy) X µ(dx)f (x, y) X ×Y Y Y Moreover, for every M-algebra A: A [f (x, y)] = EA [ EA [f (x, y)]] = EA [ EA [f (x, y)]] µ : M X , ν : M Y , f : |A| X ×Y ⊢ xE ∼µ x ∼µ y∼ν y∼ν y∼ν x ∼µ As usual, we allow placing the binder µ(dx) on either side of the integrand f (x). Integrals and expectation interact well with the R-module structure in the sense that they are homomorphisms in both arguments. The precise statement of this fact can be found in Appendix A. The push-forward operation interacts with rescaling in the following way:  Theorem 4.4 (Frobenius reciprocity). For all objects X , Y in a measure category C, M :     w : R X , µ : M X , f : Y X ⊢ w ⊙ f ∗ µ = f ∗ (w ◦ f ) ⊙ µ When calculating in this notation, we use the equations in Appendix A where we present a toolbox for synthetic measure theory. This toolbox includes most of the equations we come to expect from standard measure theory, like the change of variables law. To validate them, inline the definitions and proceed using the usual category-theoretic properties. The following two sections contain relevant extensions to Kock’s theory. 4.2.3 Radon-Nikodym derivatives. The Radon-Nikodym Theorem is a powerful tool in measure theory, and we now phrase a synthetic counterpart. As usual in the synthetic setting, we set the definitions up such that the theorem will be true. Doing so highlights the difference between three measure-theoretic concepts that coincide in measure theory, but may differ in the synthetic setting. Let µ, ν ∈ M X be measures. We say that ν is absolutely continuous with respect to µ, and write ν << µ, when there exists a morphism w : X → R such that ν = w ⊙ µ. Given two morphisms w, v : X → R and a measure µ ∈ M X , we say that w and v are equal µ-almost everywhere (µ-a.e.) when w ⊙ µ = v ⊙ µ. A measurable property over X is a morphism P : X → bool. Given a measure µ ∈ M X a measurable property P over X holds µ-a.e., when the morphism [P] B λx . if P x then 1 else 0 is equal µ-a.e. to 1. Theorem 4.5 (Radon-Nikodym). Let (C, M) be a well-pointed measure category. For every ν << µ in M X , there exists a µ-a.e. unique morphism dν dµ : X → R satisfying dν dµ ⊙ µ = ν. 4.2.4 Kernels. We say that a kernel k : X → M Y is Markov when, for all x, k(x, Y ) = 1, i.e., when k factors through the object of probability measures via sub : P ↣ M. We now restrict attention to kernels k : X → M X over the same object X . We say that such a kernel preserves a measure µ when µ >>= k = µ. Recall the morphism swap B λ(x, y). (y, x) : X × Y → Y × X . Given a P measure µ ∈ M X and a kernel k, we define the box product by µ ⊠ k B X ×X δ (x,y ) µ(dx)k(x, dy). A kernel k is reversible with respect to a measure µ ∈ M X when swap∗ (µ ⊠ k) = µ ⊠ k. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:17 The following standard results on kernels transfer into the synthetic setting. If a Markov kernel k is reversible with respect to µ, then k preserves µ. Kernels obtained by rescaling the Dirac kernel, Í i.e., λx . w(x) ⊙ δ x are reversible w.r.t. all measures. Finally, linear combinations λx . n ∈N r n ⊙ kn (x) of reversible kernels w.r.t. µ are also reversible w.r.t. µ. 4.3 Quasi-Borel spaces It remains to show that there is a concrete model of synthetic measure theory that contains the classical measure theoretic ideas that are central to probability theory and inference. This is novel because Kock Kock’s work [2012 2012] is targeted at the geometric/topological setting, whereas probability theory is based around Borel sets rather than open sets. It is non-trivial because the traditional setting for measure theory does not support higher-order functions [Aumann Aumann 1961 1961] and commutativity of integration is subtle in general. In this section we resolve these problems by combining some recent discoveries [Heunen Heunen et al. 2017 2017; Staton 2017 2017], and exhibit a model of synthetic measure theory which contains classical measure theory, for instance: • the σ -semiring over the morphisms 1 → R is isomorphic to the usual σ -semiring over the extended non-negative reals, R+ ; • this isomorphism induces a bijective correspondence between the morphisms R → 1 + 1 and the Borel subsets of R+ , as characteristic functions, and also between the morphisms R → R and the measurable functions R+ → R+ ; • it also induces an injection of the morphisms 1 → M(R) into the set of Borel measures on R+ , whose image contains all the probability measures; the morphisms R → M(R) include all the Borel probability kernels; ∫ • the canonical morphism R R × M(R) → R, (f , µ) 7→ f (x) µ(dx), corresponds to classical Lebesgue integration. Moreover, each object X can be seen as a set U (X ) = C(1, X ) with structure, because the category is well-pointed, in the sense that the morphisms X → Y are a subset of the functions U (X ) → U (Y ). 4.3.1 Rudiments of classical measure theory. Measurable spaces are the cornerstone of conventional measure theory, supporting a notion of measure. Recall that a σ -algebra on a set X is a set ΣX of subsets of X that is closed under countable unions and complements. A measurable space is a set together with a σ -algebra. A measure is a σ -additive function ΣX → R+ . A function f between measurable spaces is measurable if the inverse image of every measurable set according to f is measurable. n For example, on a Euclidean space R we can consider the Borel sets, which form the smallest n σ -algebra containing the open cubes. There is a canonical measure on R , the Lebesgue measure, n which assigns to each cube its volume, and thus to every measurable function f : R → R+ a ∫ Lebesgue integral Rn f ∈ R+ . A slightly more general class of measures is the σ -finite measures, which include the Lebesgue measures and are closed under disjoint unions and product measures. A measurable space that arises from the Borel sets of a Polish space is called a standard Borel space. In fact, every standard Borel space is either countable or isomorphic to R. Standard Borel spaces are closed under countable products and countable disjoint unions. 4.3.2 Quasi-Borel spaces. In this section we fix an uncountable standard Borel space, R. For example, R = R. The basic idea of quasi-Borel spaces is that rather than focusing on measurable sets of a set X , as in classical measure theory, one should focus on the admissible random elements R → X. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:18 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani Definition 4.6 ([Heunen Heunen et al. 2017 2017]). A quasi-Borel space (QBS) is a set X together with a set of functions M X ⊆ [R, X ] such that (i) all the constant functions are in M X , (ii) M X is closed under precomposition with measurable functions on R, and (iii) M X satisfies the piecewise condition: if Ò∞ Ò∞ R = i=1 Ui , where Ui is Borel measurable and α i ∈ M X for all i, then i=1 α i ∩ (Ui × X ) is in M X . A morphism f : X → Y is a function that respects the structure, i.e. if α ∈ M X then (f ◦ α) ∈ MY . Morphisms compose as functions, and we have a category QBS. A QBS X is a subspace of a QBS Y if X ⊆ Y and M X = {α : R → X | α ∈ MY }. A measurable space X can be turned into a QBS when given the set of measurable functions R → X as M X . When X and Y are standard Borel spaces considered as QBSes this way, QBS(X , Y ) comprises the measurable functions, so QBS can be thought of as a conservative extension of the universe of standard Borel spaces. The three conditions on quasi-Borel spaces ensure that coproducts and products of standard Borel spaces retain their universal properties in QBS. In fact, the category of QBSs has all limits and colimits. It is also cartesian closed; e.g., RR B QBS(R, R), and M (RR ) = α : R → (RR ) uncurry(α) ∈ QBS(R × R → R) . For any QBS X , M X = QBS(R, X ). 4.3.3 A monad of measures. The following development is novel. Definition 4.7. A measure µ on a quasi-Borel space is a triple (Ω, α, µ) where Ω is a standard Borel space, α ∈ QBS(Ω, X ), and µ is a σ -finite measure on Ω. n For example, Ω might be R and µ might be the Lebesgue measure. A measure determines an integration operator: if f ∈ QBS(X , R+ ) then define ∫ ∫ f d(Ω, α, µ) B Ω f (α(x)) µ(dx) using Lebesgue integration according to µ. We say that two measures are equal, denoted (Ω, α, µ) ≈ (Ω ′, α ′, µ ′), if they determine the same integration operator. We write [Ω, α, µ] for an equivalence class of measures. As an aside, we note that not every integration operator on R in the classical sense is a measure in the sense of Def. 4.7 4.7, because we restrict to σ -finite µ. Technically, the only integration operators that arise in this way are those corresponding to s-finite measures. This is a class of measures that includes the probability measures, and which works well with iterated integration and probabilistic programming [Staton Staton 2017 2017]. The measures up-to ≈ form a monad, as follows. First, the set of all measures M X forms a QBS by setting M M X = λr . [D r , α(r , −), µ |D r ] µ σ -finite on Ω, D ⊆ R × Ω measurable, α ∈ QBS(D, X ) , where D r = {ω | (r , ω) ∈ D}. In consequence, when Ω ′ is a standard Borel space, for every morphism f : Ω ′ → M X , there exist Ω, µ, D ⊆ Ω ′ × Ω and α ∈ QBS(D, X ) such that f (ω ′) = [D ω ′ , α(ω ′, −), µ |D ω ′ ]. One intuition is that α is a partial function Ω ′ × Ω → X , with domain D. The unit of the monad, return : X → M X , is return(x) B [1, λ_. x, δ () ] where δ () is the Dirac measure on the one-point space 1. We often write δ x for return(x). The bind >>=: M X ×M Y X → M Y is [Ω, α, µ] >>= φ B [D, β, (µ ⊗ µ ′)|D ] where φ(α(r )) = [D r , β(r, −), µ ′]. Note that (φ ◦ α) : Ω → M X must be of this form because it is a morphism from a standard Borel space. The measure µ ⊗ µ ′ is the product measure, which exists because µ and µ ′ are σ -finite. This structure satisfies the monad laws, it is commutative by the Fubini-Tonelli theorem, and it satisfies the biproduct axioms, and so it is a model of synthetic measure theory. Every measure on 1 is equivalent to one of the form ([0, r ], !, µ) where r ∈ R+ , ! : [0, r ] → 1 is the unique such random element, and µ is the Lebesgue measure. Thus M 1  R+ . Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:19 As another aside, we note that when Ω, Ω ′ are standard Borel spaces, the Kleisli morphisms Ω → M Ω ′ correspond to s-finite kernels, which were shown in [Staton Staton 2017 2017] to provide a fully complete model of first-order probabilistic programming. 5 CONTINUOUS INFERENCE We now develop the continuous counterpart to Sec. 3. The semantic structure of the category of quasi-Borel spaces allows us to transport many of the definitions with little change. For example, a monadic interface T consists of analogous data, but the assignments are indexed by quasi-Borel spaces, T assigns quasi-Borel spaces, and returnT and >>=T assign quasi-Borel space morphisms. Definition 5.1. A continuous representation T is a tuple (T , returnT , >>=T , mT ) consisting of: • a monadic interface (T , returnT , >>=T ); T • an assignment of a meaning morphism mX : T X → M X for every space X such that mT preserves returnT and >>=T . A sampling representation is a tuple (T , returnT , >>=T , mT , sampleT ) such that its first four components form a continuous representation, it has an additional Qbs-morphism sampleT : 1 → T I, and mT maps sampleT () to the uniform Qbs-measure U = [I, id, Uniform] on the unit interval I, where Uniform is the usual uniform distribution on I. A conditioning representation T is similarly a tuple (T , returnT , >>=T , scoreT , mT ), with a Qbsmorphism scoreT : R+ → T 1 such that for each r , mT maps scoreT (r ) to the r -rescaled unit Qbs-measure r ⊙ δ () = [1, λ_. (), r · δ () ]. An inference representation T is a tuple (T , returnT , >>=T , sampleT , scoreT , mT ) with the appropriate components forming both a sampling representation and a conditioning representation. This definition refines Def. 3.2 with sampling and scoring representations, allowing us to talk about inference transformers that augment a representation of one kind into another. Example 5.2 (Continuous sampler). By analogy with Ex. 3.3 3.3, we define in Fig. 8a a sampling representation using the type Sam α B {Return α Sample (I → Sam α)}. Validating the preservation of sample and the monadic interface is straightforward. It also follows from more general principles: Sam is the initial monad with an operation sample : T I. We define inference transformations between any two representations as in Def. 3.5 3.5. We have four kinds of representations, and when defining transformers we can augment a representation with additional capabilities: Definition 5.3. Let k 1 , k 2 be a pair of kinds of representation. A k 1 to k 2 transformer F is a tuple (F , tmapF , liftF ) consisting of an assignments of: • a k 2 representation F T to every k 1 representation T ; • an inference transformation tmapF t : FT → FS to every transformation t : T → S; and • an inference transformation liftT : T → F T to every k 1 representation T . When the two kinds k 1 , k 2 differ, we say that that the transformer is augmenting. When defining a k 1 to k 2 transformer, we adopt a Haskell-like type-class constraint notation k 1 =⇒ k 2 used for example in Fig. 11a 11a. Example 5.4. By analogy with Ex. 3.9 3.9, Fig. 8b presents the continuous weighting transformer structure on WT X B T (R+ ∗ X ). It augments any representation transformer with conditioning capabilities. Each conditioning operation is deferred to the return value, and so we can view this transformer as freely adding a conditioning operation that commutes with all other operations. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:20 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani instance Sampling Monad (Sam) where return x = Return x a >>= f = match a with { Return x →f (x) Sample k→ Sample (λr . k(r ) >>= f )} sample = Sample λr . (Return r ) ma = match a with { Return x →δ x Sample k→ I k(x)U(dx)} (a) Continuous sampler representation instance Cond Trans (W) where returnW T x= returnT (1, x) a >>=W T f = T .do {(r , x) ← a; (s, y) ← f (x); return(r · s, y)} (tmap t)X = t R+ ∗X = T .do {x ← a; return(1, x)} liftT a mW T a = λx . R ×X r ⊙ δ x mT (a)(dr , dx) + scoreW T r = returnT (r , ()) (b) Continuous weighting inference transformer Fig. 8. Continuous representations and tranformers When the starting representation had conditioning capabilities, we have an inference transformation waggr : WT → T , given by waggr a B T .do {(r , x) ← a; scoreT r ; return x } which conditions based on the aggregated weight. Its validity follows from a straightforward calculation using the meaning preservation of T . In the continuous case, the output of the final inference transformation will always be W Sam X or a similar Pop Sam X described in the next section. From this representation, we obtain the Monte Carlo approximation to the posterior by using a random number generator to supply the values required by Sam. Interpreting the program directly in W Sam X and sampling from that would correspond to simple importance sampling from the prior, which usually needs a very large number of samples to give a good approximation to the posterior. Our goal in approximate Bayesian inference is therefore to find another representation for the program and a sequence of inference transformations that map it to W Sam X . While, in principle, this output represents the same posterior distribution, hopefully it uses a representation that requires fewer samples to obtain a good approximation than a direct interpretation in W Sam X . We emphasise that approximation is only done in this final sampling step, while all the inference transformations that happen before it are exact. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 6 60:21 SEQUENTIAL MONTE CARLO Sequential Monte Carlo (SMC) is a family of inference algorithms for approximating sequences of distributions. In SMC, every distribution is approximated by a collection of weighted samples called a population, with each population obtained from the previous one in the sequence by a suitable transformation. In a sub-class of SMC known as particle filters, each distribution in the sequence is generated by a known random process from the previous distribution and we can apply this process to samples in the previous population to obtain the current population. In particle filters the samples in the population are called particles. A common problem with particle filters is that, after multiple steps, a few particles have much larger weights than the remaining ones, effectively reducing the sample size in the population well below the actual number of particles, a phenomenon known as sample impoverishment. To ameliorate this problem, particle filters introduce additional resample operations after each step in the sequence, which constructs a new population by sampling with replacement from the old one. The new population has uniform weights across its particles. In the setting of probabilistic programming, we use suspended computations as particles, and their associated weight is their currently accumulated likelihood. We show how to decompose a particle filter into a stack of two transformers: a representation to conditioning transformer for representing a population of particles, and a conditioning to conditioning transformer that allows us to run a particle until its next conditioning operation. We define each step of the SMC algorithm as an inference transformation on this stack. We can then apply this stack of transformers to a sampling representation to obtain a correct by construction variation of SMC. The algorithm we obtain is known as the particle filter with multinomial resampling [Doucet Doucet and Johansen 2011 2011] that uses the prior as the proposal distribution, but throughout this paper we refer to it simply as SMC. 6.1 The population transformer Given a representation T , we define a representation structure over PopT X B T (List(R+ ∗ X )). We further deconstruct this representation transformer as the composition of two transformers: the continuous weighting transformer W from Ex. 5.4 5.4, and Haskell’s notorious ListT transformer. The negative reputation associated to the transformer ListTT X B T (List X ) stems from its failure to validate the monad laws when T is not commutative.2 However, it is a perfectly valid representation transformer, described in Fig. 9a 9a, since we do not require that representations satisfy monad laws. To prove the meaning function preserves return, simply calculate. For >>= preservation, show: Õ as : List(T X ) ⊢ m ListT T (sequence as ) = mT (a) a ∈a s and proceed via straightforward calculation using the linearity of the Kock integral and the commutative (σ -)monoid structure on measures. By composing the two representation transformers, we obtain the representation to conditioning transformer Pop, given explicitly in Fig. 9b 9b. Fig. 9c presents a N+ -indexed family of inference transformations. Fix any n ∈ N. The spark function generates a population of particles with the unit value, and the same weight n1 . Thus, spawn (n, a) takes a distribution a over particle populations, sparks n equally weighted particles, and for each of them, samples a population based on a. A straightforward calculation confirms that the meaning of spark is 1, and so spawn (n, −) : PopT → PopT is an inference transformation. In 2 For a list transformer “done right”, see Jaskelioff Jaskelioff’s thesis [2009 2009], and its generalisations [Fiore Fiore and Saville 2017 2017; Piróg 2016 2016]. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:22 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani instance Cond Trans (Pop) where Auxiliary functions: returnPop T = return(W ◦ ListT)T sequence : List(T X ) → T (List X ) >>=Pop T = >>=(W ◦ ListT)T sequence B foldr (return[ ]) lift = liftW(ListT T ) ◦ liftListT T Pop T (λ(a, r ). T .do {x ← a; tmap Pop T = tmapW(ListT T ) ◦ tmapListT T xs ← r ; = m(W◦ ListT)T return(x :: x s )} m Pop T Í = λa. mT (a)(dx s ) (r,x )∈x s r ⊙ δ x concat : List(List X ) → List X List(R+ ×X ) concat B foldr [ ] ++  Í scorePop T = score(W ◦ ListT)T x ∈x s f (x) B foldr 0 λ(x, s). f (x) + s x s instance Rep Trans (ListT) where returnListT T x = returnT [x] a >>=ListT T f = T .do {x s ← a; let bs = map f x s in yss ← sequence bs ; return(concat yss )}  Í m ListT T a = List X mT (a)(dx s ) x ∈x s δ x liftListT T a = T .do {x ← a; return [x]} = t List X (tmap t)X (a) The list transformer (b) The population transformer replicate : N ∗ X → List X replicate(n, x) B N.fold λ{ Zero → [ ] Succ x s → x :: x s } n spark : N+ → PopT 1   spark B returnT replicate(n, ( n1 , ())) spawn : N+ ∗ PopT X → PopT X spawn(n, a) B PopT .do {spark n; a} (c) Spawning new particles Fig. 9. Representing populations the version of SMC we consider below, we will only pass to spawn a distribution a over uniformlyweighted single-particle populations. We use spawn to resample a new population. Thinking operationally, we have a population of weighted particles and we obtain a new population by sampling with replacement from the current one, where the probability of selecting a given particle is proportional to its weight. Doing so is equivalent to simulating a discrete weighted sample using a uniform one. Lemma 6.1. There is a Qbs-morphism dwrand : List(R+ ∗ X ) ∗ I → {Take X Fail } such that: Í • For all x s for which (r,_)∈x s r = 0, we have dwrand(x s , −)∗ U = δ Fail . Í Í ri • For all x s for which w := (r,_)∈x s r > 0, we have dwrand(x s , −)∗ U = (r,x )∈x s w ⊙ δ Take x . Fig. 10a presents one such morphism, though its precise implementation does not matter to our development. As a consequence, for every sampling representation T for which we have an element fail : T X such that mT (fail) = 0, we can define a discrete weighted sampler dwsampleT (x s ) : Í List(R+X ) → T X in Fig. 10b which will then satisfy mT (dwsampleT (x s )) = (r,x )∈x s r ⊙ δ x . The resampling step in Fig. 10c operationally takes the current population, creates a computation/thunk that samples a single particle from this population, and then spawns n new particles that are initialised with this thunk. The morphism resample (n, −) : PopT → PopT is an inference transformation because, as we know, spawn (n, −) is one and dwsamplePop T : PopT → PopT samples a population consisting of just a single unit weight particle with a probability proportional to its renormalised weight in the original population. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference dwrand(x sÍ ,r) B let w = (r,_)∈x s r in if w=0 then Fail else foldr (w · r, Fail) (λ((s, x), (fuel, result)). if 0 ≤ fuel < s then(−1, Take x) else -- potential underflow (fuel − s, result)) xs 60:23 dwsampleT (x s )ÍB T .do {score( (r,_)∈x s r ); r ← sample; match dwrand (x s , r ) with { Fail →fail Take x→return x }} (b) A discrete weighted sampler resample : N+ ∗ PopT X → PopT X resample(n, a) B T .do {x s ← a; spawn(n, dwsamplePop T x s )} (c) Resampling (a) A discrete weighted randomiser Fig. 10. The resampling transformation instance Cond =⇒ Cond Trans (Sus) where returnSus T x = returnT (Return x) a >>=Sus T f = fold (λb. T .do { t ← b; match t with { Return x→f (x) Yield c →Yield c})} a liftSus T a = T .do {x ← a; returnSus T x } (tmapSus T t)X = SusT X .fold (λb. mS (b)) m Sus T a = mT (finishSus T (a)) score r = returnT (Yield liftSus T (score r )) (a) The suspension transformer advanceT : SusT X → SusT X advanceT a = T .do { t ← a; match t with { Return x→returnT x Yield t →t }} : SusT X → T X finishT finishT a = fold λb. T .do { t ← b; match t with { Return x→return x Yield b →b}} (b) Suspension operations Fig. 11. The suspension transformation 6.2 The suspension transformer The second transformer in the SMC algorithm allows us to suspend computation after each conditioning. The suspension transformer equips the standard resumption monad transformer SusT X B T {Return X Yield (SusT X )}, presented in Fig. 11a 11a, with inference transformations. The two transformations on suspended computations in Fig. 11b take one step, and complete the computation, accordingly. As the meaning function for the transformed representation returns the meaning the computation would have if it was allowed to run to completion, these two operations do not change the meaning and so form inference transformations. We can now put all the components together: Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:24 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani Theorem 6.2. Let T be a sampling representation. For every pair of natural numbers n, k, the following composite forms an inference transformation: T tmapSus spawn(n,−) smcn,k B (Sus ◦ Pop)T −−−−−−−−−−−−−−−→ (Sus ◦ Pop)T (advance ◦ tmapSus resample(n,−))◦k finish −−−−−−−−−−−−−−−−−−−−−−−−−−−→ (Sus ◦ Pop)T −−−−→ PopT T In the above (−)◦− : X X × N → X X denotes n-fold composition. The transformation smcn,k amounts to running the SMC algorithm with n particles for k steps. If the representation T is operational in nature, such as the continuous sampler Sam, we get a sequence of weighted values over the return type when we run the resulting representation. By construction, the distribution on the results, rescaled according to their final weights, would be identical to the desired posterior distribution. When the representation T is not a commutative monad, like the continuous sampler Sam, the resulting representation PopT is not a monad: the monad laws do not hold. Therefore, to encompass representations of PopT one must generalise beyond monads. 7 TRACE MARKOV CHAIN MONTE CARLO Markov Chain Monte Carlo (MCMC) algorithms operate by repeatedly using a transition kernel to generate a new sample from a current one. Thus they can be thought of as performing a random walk around the space they are exploring. If the transition kernel is well-behaved, they are guaranteed to preserve the distribution. A popular MCMC algorithm used for Bayesian inference is Metropolis-Hastings (MH), where the transition kernel consists of a proposal kernel followed by a decision to either accept the proposed sample or keep the old one. The accept or reject step is used to correct for bias introduced by the proposal kernel, thus producing a valid MCMC algorithm for a rich family of proposal kernels. MH is a general inference method, but it requires specialised knowledge about the space on which they operate on. In the context of a probabilistic programming language, the Trace MH algorithm replaces the unknown target space with the space of program traces, which are shared by all probabilistic programs. Thus, Trace MH allows probabilistic programming language designers to devise general-purpose kernels to effectively explore traces. We analyse the the Trace MH as follows. First, we prove a quasi-Borel space counterpart of the Metropolis-Hastings-Green (MHG) Theorem, that forms the theoretical foundation for the correctness of MH. We then present the tracing representation and show its validity. We present the Trace MH algorithm, parameterised by a proposal kernel for traces, and give sufficient conditions on this kernel for the resulting transformation to be valid. We then give a concrete proposal kernel and show that it satisfies these general conditions. 7.1 Abstract Metropolis-Hastings-Green In the abstract, the key ingredient in MH is the Metropolis-Hastings-Green (MHG) morphism η presented in Fig. 12a 12a, formulated in terms of an arbitrary inference representation T . This transformation is usually known as the update step of the MH algorithm. It is parameterised by a (representation of a) proposal kernel ψ : X → T X , and by a chosen (representation of a) Radon-Nikodym derivative ρ : X × X → R+ . To use η in an inference transformation, we need to provide well-behaved parameters ψ , ρ, and their behaviour may depend on the representation of the input distribution a. In particular, the parameter ρ should represent a well-behaved appropriate Radon-Nikodym derivative. To simplify our proofs, we also require that the proposal kernel ψ is Markov, which suffices for our application. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:25 X ×X ψ : (T X )X , ρ : R+ , a : T X ⊢ T .do {x ← a; y ← ψ (x); r ← sample; if r < min(1, ρ(x, y)) then return y else return x } (a) The Metropolis-Hastings-Green morphism ηψ , ρ (a) p ∈ t = match (p, t) with {([ ] , Return x )→ True (r :: r s , Sample f )→ [r s ∈ f (r )] -- any other case: (_ ,_ )→ False} Í Í w − : t ∈WSam X Paths t → R+ v − : t ∈WSam X Paths t → X w Return (r,x ) ([ ]) = r v Return (r,x ) ([ ]) = x w Sample t− (s :: r s ) = w ts (r s ) v Sample t− (s :: r s ) = vts (r s ) (b) Traces through a probabilistic program Fig. 12. Basic notions in Trace MH Theorem 7.1 (Metropolis-Hastings-Green). Let X be a qbs, a ∈ T X a distribution, ψ : X → T X a kernel, and ρ : X × X → R+ a Qbs-morphism. Set k B mT ◦ ψ and µ B [ρ , 0] ⊙ (mT (a) ⊠ k).  Assume that: (1) k is Markov; (2) [1 = ρ ◦ swap · ρ] holds µ-a.e.; (3) ρ is a Radon-Nikodym derivative of swap∗ µ with respect to µ; and (4) ρ(x, y) = 0 ⇐⇒ ρ(y, x) = 0 for all x, y ∈ X . Then (mT ◦ ηψ , ρ )(a) = mT (a). Using Kock’s synthetic measure theory, we were able to follow closely standard measure-theoretic proofs of MHG [Geyer Geyer 2011 2011]. The synthetic setting highlights the different roles each of the three abstractions: a.e.-equality, a.e.-properties, and Radon-Nykodim derivatives play in the proof that our formulation exposes (cf. § 4.2.3 4.2.3). 7.2 Tracing representation A sampling trace is a sequence of samples that occur during the execution of a probabilistic program. We represent such programs as elements of the continuous weighted sampler W Sam from (cf. Fig. 8). Consequently, the collection of traces through a program t ∈ W Sam X is a subset of List I. Fig. 12b defines a measurable predicate [∈] : W Sam X × List I → bool that tests whether a given sequence p of probabilistic choice forms a complete trace in the program t. Consequently, we can define the set of paths through a given program t by Paths t B p ∈ List I p ∈ t ⊆ List I, and equip it with the subspace structure it inherits from List I. We can therefore define the set: Õ  Paths t := (t, p) ∈ WSam X × List I p ∈ t ⊆ WSam X × List I t ∈WSam X which we can also equip with a subspace structure. We can now define the weight w − and valuation v − morphisms in Fig. 12b that retrieve the likelihood and value at the end of a trace. We can now define the tracing inference representation. It is parameterised by an inference representation T and given for X as the following subspace of WSam X × T (List I): ( ) [ ∈ t] mT (a)-a.e., and  TrT X B (t, a) ∈ WSam X × T (List I) . m WSam (t) = List I δ vt (p) mT (a)(dp) Thus, a representation consists of a program representation t, together with a distribution a on all lists, but maintaining two invariants. First, the lists are mT (a)-almost-everywhere paths through t, and so we can indeed think of a as a representation of a distribution over traces. Second, if we calculate the posterior of the paths through t according to mT (a), it should have the same meaning as the original program. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:26 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani ηψTr, Tρ : TrT X → TrT X instance Inf =⇒ Inf Monad (TrT ) where   return x = (returnWSam x, returnT [ ]) ηψTr, Tρ (t, a) B t, ηψt , ρ t (a) (t, a) >>= (f , д) = (t >>=WSam f ,T .do {p ← a; q ← д ◦ vt (p); (b) Trace MH update-step return(p + + q))})  priT : WSam X → T (List(I)) m(t, a) = mWSam (t) = List I δ vt (p) mT (a)(dp) priT (t) B fold = id × t List I tmap t sample = (sampleWSam , λ{Return (r , x)→ returnT [ ] T .do {r ← sample; return[r ]}) Sample k → T .do { score r = (scoreWSam , r ← sampleT ; T .do {score r ; return[ ]}) k(r )}} (a) The tracing inference (c) Prior representation Fig. 13. Building blocks of Trace MH We stress that an implementation need not compute the meaning of the program. But this representation guarantees that the meaning will be preserved by the inference operations. Note that the integrand in the definition of (t, a) ∈ TrT X is only partially defined. This partiality is not an issue because the first condition guarantees it is mT (a)-a.e. defined. We can then choose the constantly 0 distribution when p < t. Fig. 13a presents the inference representation structure of TrT . Most of the proof revolves around preseving the invariant, i.e., that these definitions define set-theoretic functions. The inference transformation marginalT : TrT X → T X marginalises the trace transformer once it is no longer useful. It first samples a path and then uses it to run the program discarding the weight: marginal (t, a) = do {x ← a; return vt (x)}. Its correctness is precisely the invariant. 7.3 Inference with MHG The transition from T to TrT still requires a proposal kernel and a representation of the appropriate derivative, but these can now be given in terms of concrete traces. Given an inference representation T , a trace proposal kernel is a transformation representing  Í a kernel ψ : Paths t → T (List I). A trace derivative is a transformation representing t ∈WSam X  Í the derivative ρ : t ∈WSam X Paths t × Paths t → R+ . Given a trace proposal kernel ψ and a trace derivative ρ, Fig. 13b presents the trace MHG update transformation using the corresponding MHG update on T (List I). The Trace MH update step requires some assumptions to form an inference transformation: Theorem 7.2 (Trace Metropolis-Hastings-Green). Let T be an inference representation, ψ a trace proposal kernel, and ρ a trace derivative. Assume that, for every (t, a) ∈ TrT X , letting k B mT ◦ψt and µ B [ρ t , 0]⊙(mT (a)⊠k): (1) k is Markov; (2) [1 = ρ t ·(ρ t ◦swap)] holds µ-a.e.; (3) ρ t is a Radon-Nikodym derivative of swap∗ µ with respect to µ; and (4) ρ t (p, q) = 0 ⇐⇒ ρ t (q, p) = 0 for all p, q ∈ List(I). Then ηψTr, Tρ : TrT → TrT is a valid inference transformation. We will now demonstrate such a simple and generic trace proposal kernel and trace derivative that implement a MHG update step of a popular lightweight Metropolis-Hastings algorithm in several probabilistic programming language systems [Goodman Goodman et al. 2008 2008; Goodman and Stuhlmüller 2014; Hur et al. 2015 2014 2015; Wood et al. 2014 2014]. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:27 For any inference representation T , Fig. 13c defines the morphism priT that maps a representation t ∈ WSam X to its prior distribution on paths over t. Let UD (n) ∈ M(N) be the measure for the 1 uniform discrete distribution with support {0, 1, . . . , n}. Intuitively, it assigns a probability n+1 to every element in the support. It be easily defined from sampleM , which denotes the uniform distribution on I, as in Lemma 6.1 6.1. We now define our concrete proposal ψt and derivative, a.k.a. ratio, ρ t : ψt : List(I) → T (List(I)) ψt (p) B T .do {i ← UDT (|p|) q ← priT (sub(t, take(i, p))) return(take(i, p) + q)} ρ t : List(I) × List(I) → R+ w (q)·(|p |+1) ρ t (p, q) B w tt (p)·(|q |+1) where sub(t, x) selects a subterm of a given term by following the list x and take(i, p) retrieves the i-th prefix of p. This proposal and derivative/ratio satisfy the condition in the Trace MH. Our approach lets us combine MH updates with other inference building block. For example, recall the SMC algorithm from Section 6.2 6.2. Each time it performs resampling, multiple particles are given the same values, which results in inadequate coverage of the space, a phenomenon known as degeneracy. One way to ameliorate this problem is to apply multiple MH transitions to each particle after resampling in order to spread them across the space, resulting in an algorithm known as resample-move SMC [Doucet Doucet and Johansen 2011 2011]. The implemnetation of resample-move SMC is very similar to that of SMC from Section 6.2 6.2, except we introduce an additional layer Tr between Sus and Pop: Theorem 7.3. Let T be a sampling representation. For every pair of natural numbers n, k, ℓ the following composite forms an inference trasnformation: T tmapSus tmapTr spawn(n,−) rmsmcn,k, ℓ B (Sus ◦ Tr ◦ Pop)T −−−−−−−−−−−−−−−−−−−−−→ (Sus ◦ Tr ◦ Pop)T (advance ◦ tmapSus η ◦ℓ ◦tmapSus tmapTr resample(n,−))◦k marginal ◦ finish −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−→ (Sus ◦ Tr ◦ Pop)T −−−−−−−−−−−−→ PopT In the above we apply ℓ MH transitions after each resampling. Our compositional correctness criterion corresponds to a known result that resample-move SMC is an unbiased importance sampler. 8 RELATED WORK AND CONCLUDING REMARKS The idea of developing a programming language for machine learning and statistics is old, and was explored at least in the early 2000s [Park Park et al. 2005 2005; Ramsey and Pfeffer 2002 2002; Thomas et al. 1992 1992] as an interesting yet niche research topic. In the past five years, however, designing such a language and building its runtime system has become an active research area, and lead to practical programming languages and libraries [Carpenter Carpenter et al. 2017 2017; Goodman et al. 2008 2008; Goodman and Stuhlmüller 2014; Gordon et al. 2014 2014 2014; Mansinghka et al. 2014 2014; Minka et al. 2014 2014; Murray 2013 2013; Narayanan et al. 2016; Tran et al. 2017 2016 2017; Wood et al. 2014 2014] . Most of these research efforts have focussed on developing efficient inference algorithms and implementations [Kucukelbir Kucukelbir et al. 2015 2015; Le et al. 2017 2017; Tran et al. 2017; Wingate and Weber 2013 2017 2013]. Only a smaller amount of work has been dedicated to justifying the algorithms or other runtime systems of those languages [Borgström Borgström et al. 2015 2015; Hur et al. 2015 2015]. Our work contributes to this less-explored line of research by providing novel denotational techniques and tools for specifying and verifying key components of inference algorithms, in particular, those for expressive higher-order probabilistic programming languages. Such specifications can then be combined to construct the correctness argument of a complex inference algorithm, as we have shown in the paper. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:28 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani The idea of constructing inference algorithms by composing transformations of an intermediate representations is, to the best of our knowledge, relatively recent. In previous work with Gordon [Ścibior Ścibior et al. 2015 2015], we manipulated a free monad representation to obtain an implementation of SMC. However, we did not implement MH, did not break down SMC further into resampling and suspension, and our semantics was not compositional. Zinkov and Shan [2016 2016] directly manipulate syntax trees of a small language Hakaru. Their semantics is only first-order and they focus on local program transformations corresponding to solving integrals analytically, which is orthogonal to our global transformations relating to sampling algorithms. Our approach does not yet deal with two important aspects of inference. In practice, one wants convergence guarantees for the inference algorithm, estimating the results within an error margin after a given number of inference steps. As any purely-measure theoretic approach, ours does not express such properties. Additionally, we can not express algorithms that rely on derivatives of the density function for the program traces, such as Hamiltonian Monte Carlo or variational inference. Developing a theory of differentiation over quasi-Borel spaces might enable us to express such algorithms. Another interesting direction for future work is to develop a denotational account of some probabilistic programming languages that allow users to select or compose parts of inference algorithms [Mansinghka Mansinghka et al. 2014 2014; Tran et al. 2017 2017]. The exposure of an inference algorithm in such languages breaks the usual abstraction of probabilistic programs as distributions, and causes difficulties of applying existing semantic techniques to such programs. Our more intensional semantics may be able to overcome these difficulties. Finally, it would be interesting to consider indexed or effect-annotated versions of inference representations, transformations and transformers, where indices or annotations ensure that inference components are applied to a certain type of programs. Such a refined version of our results may lead to a way of selectively applying Hamiltonian Monte Carlo or other algorithms that assume the presence of differentiable densities and a fixed length of all paths through the program. REFERENCES R. J. Aumann. 1961. Borel structures for function spaces. Illinois Journal of Mathematics 5 (1961), 614–630. Johannes Borgström, Ugo Dal Lago, Andrew D. Gordon, and Marcin Szymczak. 2015. A Lambda-Calculus Foundation for Universal Probabilistic Programming. CoRR abs/1512.08990 (2015). http://arxiv.org/abs/1512.08990 Johannes Borgström, Ugo Dal Lago, Andrew D. Gordon, and Marcin Szymczak. 2016. A lambda-calculus foundation for universal probabilistic programming. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming, ICFP 2016, Nara, Japan, September 18-22, 2016. 33–46. Bob Carpenter, Andrew Gelman, Matthew Hoffman, Daniel Lee, Ben Goodrich, Michael Betancourt, Marcus Brubaker, Jiqiang Guo, Peter Li, and Allen Riddell. 2017. Stan: A Probabilistic Programming Language. Journal of Statistical Software, Articles 76, 1 (2017), 1–32. https://doi.org/10.18637/jss.v076.i01 Arnaud Doucet and Adam M. Johansen. 2011. A Tutorial on Particle Filtering and Smoothing: Fifteen years later. In The Oxford Handbook of Nonlinear Filtering, Dan Crisan and Boris Rozovskii (Eds.). Oxford University Press, 656–704. Matthias Felleisen. 1991. On the Expressive Power of Programming Languages. Sci. Comput. Program. 17, 1-3 (1991), 35–75. Marcelo Fiore and Philip Saville. 2017. List Objects with Algebraic Structure. In 2st International Conference on Formal Structures for Computation and Deduction, FSCD 2017. Herman Geuvers and Erik Poll. 2007. Iteration and primitive recursion in categorical terms. In Reflections on Type Theory, Lambda Calculus, and the Mind, Essays Dedicated to Henk Barendregt on the Occasion of his 60th Birthday. Radboud Universiteit, Nijmegen, 101–114. Charles J. Geyer. 2011. Introduction to Markov Chain Monte Carlo. In Handbook of Markov Chain Monte Carlo, Steve Brooks, Andrew Gelman, Galin L. Jones, and Xiao-Li Meng (Eds.). Chapman and Hall/CRC, Chapter 1, 3–48. Noah Goodman, Vikash Mansinghka, Daniel M Roy, Keith Bonawitz, and Joshua B Tenenbaum. 2008. Church: a language for generative models. In UAI. Noah Goodman and Andreas Stuhlmüller. 2014. Design and Implementation of Probabilistic Programming Languages. http://dippl.org. (2014). http://dippl.org Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:29 Andrew D. Gordon, Thore Graepel, Nicolas Rolland, Claudio Russo, Johannes Borgstrom, and John Guiver. 2014. Tabular: A Schema-driven Probabilistic Programming Language. In Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’14). ACM, New York, NY, USA, 321–334. https://doi.org/10.1145/2535838.2535850 Esfandiar Haghverdi and Philip Scott. 2006. A categorical model for the geometry of interaction. Theoretical Computer Science 350, 2 (2006), 252 – 274. https://doi.org/10.1016/j.tcs.2005.10.028 Automata, Languages and Programming: Logic and Semantics (ICALP-B 2004). Chris Heunen, Ohad Kammar, Sam Staton, and Hongseok Yang. 2017. A Convenient Category for Higher-Order Probability Theory. In Proceedings of the 32nd Annual ACM/IEEE Symposium on Logic in Computer Science, LICS ’17, Reykjavik, Iceland, June 20-23, 2017. Chung-Kil Hur, Aditya V. Nori, Sriram K. Rajamani, and Selva Samuel. 2015. A Provably Correct Sampler for Probabilistic Programs. In 35th IARCS Annual Conference on Foundation of Software Technology and Theoretical Computer Science, FSTTCS 2015, December 16-18, 2015, Bangalore, India. 475–488. Graham Hutton. 1999. A Tutorial on the Universality and Expressiveness of Fold. J. Funct. Program. 9, 4 (July 1999), 355–372. https://doi.org/10.1017/S0956796899003500 Bart Jacobs. 2017. From Probability Monads to Commutative Effectuses. Journ. of Logical and Algebraic Methods in Programming (2017). To appear. Mauro Jaskelioff. 2009. Lifting of Operations in Modular Monadic Semantics. Ph.D. Dissertation. University of Nottingham. G M Kelly. 1980. A unified treatment of transfinite constructions for free algebras, free monoids, colimits, associated sheaves and so on. Bull. Austral. Math. Soc. 22 (1980), 1–83. Anders Kock. 1972. Strong functors and monoidal monads. Archiv der Mathematik 23, 1 (1972), 113–120. Anders Kock. 2012. Commutative monads as a theory of distributions. Theory and Applications of Categories 26, 4 (2012), 97–131. Alp Kucukelbir, Rajesh Ranganath, Andrew Gelman, and David Blei. 2015. Automatic Variational Inference in Stan. In NIPS. https://papers.nips.cc/paper/5758-automatic-variational-inference-in-stan Tuan Anh Le, Atilim Gunes Baydin, and Frank Wood. 2017. Inference Compilation and Universal Probabilistic Programming. In AISTATS. http://www.tuananhle.co.uk/assets/pdf/le2016inference.pdf Vikash K. Mansinghka, Daniel Selsam, and Yura N. Perov. 2014. Venture: a higher-order probabilistic programming platform with programmable inference. arXiv:1404.0099 (2014). http://arxiv.org/abs/1404.0099 Francisco Marmolejo and Richard J. Wood. 2010. Monads as extension systems — no iteration is necessary. Theory and Applications of Categories 24, 4 (2010), 84–113. T. Minka, J.M. Winn, J.P. Guiver, S. Webster, Y. Zaykov, B. Yangel, A. Spengler, and J. Bronskill. 2014. Infer.NET 2.6. (2014). Microsoft Research Cambridge. http://research.microsoft.com/infernet. Eugenio Moggi. 1989. Computational Lambda-Calculus and Monads. In LICS. IEEE Computer Society, USA, 14–23. Lawrence M. Murray. 2013. Bayesian State-Space Modelling on High-Performance Hardware Using LibBi. arXiv:1306.3277. (2013). Praveen Narayanan, Jacques Carette, Wren Romano, Chung-chieh Shan, and Robert Zinkov. 2016. Probabilistic inference by program transformation in Hakaru (system description). In International Symposium on Functional and Logic Programming - 13th International Symposium, FLOPS 2016, Kochi, Japan, March 4-6, 2016, Proceedings. Springer, 62–79. https://doi.org/10.1007/978-3-319-29604-3_5 Sungwoo Park, Frank Pfenning, and Sebastian Thrun. 2005. A probabilistic language based upon sampling functions. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, Long Beach, California, USA, January 12-14, 2005. 171–182. Maciej Piróg. 2016. Eilenberg-Moore Monoids and Backtracking Monad Transformers. In Proceedings 6th Workshop on Mathematically Structured Functional Programming, MSFP@ETAPS 2016, Eindhoven, Netherlands, 8th April 2016. (EPTCS), Robert Atkey and Neelakantan R. Krishnaswami (Eds.), Vol. 207. 23–56. https://doi.org/10.4204/EPTCS.207.2 Norman Ramsey and Avi Pfeffer. 2002. Stochastic lambda calculus and monads of probability distributions. In Conference Record of POPL 2002: The 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, OR, USA, January 16-18, 2002. 154–165. Adam Ścibior, Zoubin Ghahramani, and Andrew Gordon. 2015. Practical Probabilistic Programming with Monads. In Haskell. http://dl.acm.org/citation.cfm?id=2804317 Sam Staton. 2017. Commutative semantics for probabilistic programming. In Proc. ESOP 2017. Andrew Thomas, David J. Spiegelhalter, and W. R. Gilks. 1992. BUGS: A program to perform Bayesian inference using Gibbs sampling. Bayesian statistics 4 (1992), 837–842. Issue 9. Dustin Tran, Matthew D. Hoffman, Rif A. Saurous, Eugene Brevdo, Kevin Murphy, and David M. Blei. 2017. Deep Probabilistic Programming. In ICLR. David Wingate, Andreas Stuhlmüller, and Noah Goodman. 2011. Lightweight Implementations of Probabilistic Programming Languages Via Transformational Compilation. In AISTATS. Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. 60:30 Ścibior, Kammar, Vákár, Staton, Yang, Cai, Ostermann, Moss, Heunen, and Ghahramani https://web.stanford.edu/~ngoodman/papers/lightweight-mcmc-aistats2011.pdf The published version contains a serious bug in the definition of alpha that was fixed in revision 3 available at the given URL. David Wingate and Theophane Weber. 2013. Automated Variational Inference in Probabilistic Programming. arXiv:1301.1299. (2013). Frank Wood, Jan Willem van de Meent, and Vikash Mansinghka. 2014. A New Approach to Probabilistic Programming Inference. In Proceedings of the 17th International conference on Artificial Intelligence and Statistics. 1024–1032. Robert Zinkov and Chung-chieh Shan. 2016. Composing inference algorithms as program transformations. arXiv:1603.01882. (2016). Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018. Denotational Validation of Higher-Order Bayesian Inference 60:31  f : Y X ⊢ f ∗δ x = δ f (x ) ⊢ X δ a(x ) µ(dx) = a ∗ µ   µ : M X ⊢ X δ x µ(dx) = µ ⊢ X f (x)δ x 0 (dx) = f (x 0 )  ⊢ E x ∼δ x [f (x)] = f (x 0 ) µ : M X ⊢ µ(X ) = X 1µ(dx) 0  ⊢ 1 µ r (dξ ) =r ⊙µ   = Y f (y)(a ∗ µ)(dy) µ : M X , a : Y X , f : (M Z )Y ⊢ X (f ◦ a)(x)µ(dx)  x 0 : X , w : R X , f : (TY )X ⊢ X f (x)(w ⊙ δ x 0 )(dx) = w(x  0 ) ⊙ f (x 0 ) µ : M X , w : R X , f : (TY )X ⊢ X f (x)(w ⊙ µ)(dx) = X w(x) ⊙ f (x)µ(dx)  >>=) µ : M X , f : (M Y )X ⊢ E x(KY, [f (x)] = X f (x)µ(dx) ∼µ µ : M X , a : Y X , f : |A|Y ⊢ Ey∼a∗ µ [f (y)] = E x ∼µ [(f ◦ a)(x)]  P µ : M(X 1 × X 2 ), f : (M Y )X i = X f (x)((πi )∗ µ)(dx) ⊢ X ×X f (x)µ(dx, dy) 1 2      µ : M X , f : (M Y )X , д : (M Z )Y ⊢ X µ(dx) Y д(y)f (x)(dy) = Y д(y) X f (x)µ(dx) (dy)   µ : M X , ν : M Y , д : (M Z )Y ⊢ Y (µ ⊗ д(y))ν (dy) = µ ⊗ Y д(y)ν (dy) µ : MX,a : YX x 0 : X , f : (MY )X x 0 : X , f : |A| X r : M 1, µ : M X  µ µ (dx) = µ (X 2 ) ⊙ µ Γ B µ : X 1 , µ : X 2 , i = 1, 2 : Γ ⊢ (πi )∗ (µ ⊗ µ ) = µ (X 3−i ) ⊙ µ X 1 2 1 2 1 2 3−i i 2 1  P Γ, f : (M Y )X i ⊢ X ×X f (x i )(µ ⊗ µ )(dx 1 , dx 2 ) = µ (X 3−i ) ⊙ X f (x i )µ (dx i ) i 1 2 1 2 3−i i Γ, f 1 : Y1X 1 , f 2 : Y2X 2 ⊢ (f 1 × f 2 )∗ (µ ⊗ µ ) = (f ∗1 µ ) ⊗ (f ∗2 µ ) 1 2 1 2         1 (x ) ⊗ f 2 (x ) (µ ⊗ µ )(dx , dx ) = 1 (x )µ (dx ) ⊗ 2 (x )µ (dx ) f f f 1 2 1 2 1 1 2 2 X ×X X X 1 2 1 2 1 1 2 2 Fig. 14. Toolbox for synthetic measure theory A A TOOLBOX FOR SYNTHETIC MEASURE THEORY In this section, we list some equations that allow us to work in synthetic measure theory much as if we would in classical measure theory. In fact, the validity of these equations lets us port many classical measure theory proofs to our setting. Figure 14 lists some basic equations that hold in synthetic measure theory. Additionally, we have the following theorem which makes precise the statement that integration and expectation act as R-module homomorphisms.  Theorem A.1 (σ -linearity). For all objects X , Y in a measure category C, M and M-algebras A:   Õ Õ µ : M X , r − : R N , f − : (M Y )N×X ⊢ µ(dx) r n ⊙ fn (x) = rn ⊙ µ(dx)fn (x) X  n ∈N n ∈N n∈N r n ⊙µ n n ∈N X  Õ ©Õ ª µ : (M X )N , r − : R N , f : (M Y )X ⊢ r n ⊙ µ ® (dx)f (x) = rn ⊙ µ (dx)f (x) ­ − n n n ∈N n ∈N ¬ X « X Õ  Õ   ⊢ EA  µ : M X , r − : R N , f − : |A| N×X r n ⊙ fn (x) = r n ⊙ EA [fn (x)] x ∼µ  x ∼µ  n ∈N n ∈N  Õ µ : (M X )N , r − : R N , f : |A| X ⊢ Í EA [f (x)] = r n ⊙ EA [f (x)] − x∼ x ∼µ n Proceedings of the ACM on Programming Languages, Vol. 2, No. POPL, Article 60. Publication date: January 2018.
6cs.PL
A PTAS for the Steiner Forest Problem in Doubling Metrics arXiv:1608.06325v1 [cs.DS] 22 Aug 2016 T-H. Hubert Chan∗ Shuguang Hu∗ Shaofeng H.-C. Jiang∗ Abstract We achieve a (randomized) polynomial-time approximation scheme (PTAS) for the Steiner Forest Problem in doubling metrics. Before our work, a PTAS is given only for the Euclidean plane in [FOCS 2008: Borradaile, Klein and Mathieu]. Our PTAS also shares similarities with the dynamic programming for sparse instances used in [STOC 2012: Bartal, Gottlieb and Krauthgamer] and [SODA 2016: Chan and Jiang]. However, extending previous approaches requires overcoming several non-trivial hurdles, and we make the following technical contributions. (1) We prove a technical lemma showing that Steiner points have to be “near” the terminals in an optimal Steiner tree. This enables us to define a heuristic to estimate the local behavior of the optimal solution, even though the Steiner points are unknown in advance. This lemma also generalizes previous results in the Euclidean plane, and may be of independent interest for related problems involving Steiner points. (2) We develop a novel algorithmic technique known as “adaptive cells” to overcome the difficulty of keeping track of multiple components in a solution. Our idea is based on but significantly different from the previously proposed “uniform cells” in the FOCS 2008 paper, whose techniques cannot be readily applied to doubling metrics. ∗ Department of Computer Science, the University of Hong Kong. {hubert,sghu,sfjiang}@cs.hku.hk 1 Introduction We consider the Steiner Forest Problem (SFP) in a metric space (X, d). An instance of the problem is given by a collection W of n terminal pairs {(ai , bi ) : i ∈ [n]} in X, and the objective is to find a minimum weight graph F = (V, E) (where V is a subset of X and the edge weights are induced by the metric space) such that every pair in W is connected in F . 1.1 Problem Background The problem is well-known in the computer science community. In general metrics, Chlebı́k and 96 . The Chlebı́ková [CC08] showed that SFP is NP-hard to approximate with ratio better than 95 best known approximation ratio achievable in polynomial time is 2 [GW95, AKR95]. Recently, Gupta and Kumar [GK15] gave a purely combinatorial greedy-based algorithm that also achieves constant ratio. However, it is still an open problem to break the 2-approximation barrier in general metrics for SFP. SFP in Euclidean Plane and Planar Graphs. In light of the aforementioned hardness result [CC08], restrictions are placed on the metric space to achieve (1 + ǫ) approximation in polynomial time. In the Euclidean plane, a randomized polynomial-time approximation scheme (PTAS) was obtained in [BKM08], using the dynamic programming framework proposed by Arora [Aro98]. Later on, a simpler analysis was presented in [BH12], in which a new structural property is proved and additional information is incorporated in the dynamic programming algorithm. It was only suggested that similar techniques might be applicable to higher-dimensional Euclidean space. Going beyond the Euclidean plane, a PTAS for planar graphs is obtained in [BHM11] and more generally, on bounded genus graphs. As a building block, they also obtained a PTAS for graphs with bounded treewidth. Steiner Tree Problems. A notable special case of SFP is the Steiner Tree Problem (STP), in which all terminals are required to be connected. In general metrics, the MST on the terminal points simply gives a 2-approximation. There is a long line of research to improve the 2-approximation, and the state-of-the-art approximation ratio 1.39 was presented in [BGRS10] via an LP rounding 96 [CC08]. approach. On the other hand, it is NP-hard to approximate STP better than the ratio 95 2−ǫ For the group STP in general metrics, it is NP-hard to approximate within log n [HK03] unless NP ⊆ ZTIME(npolylog(n) ). On the other hand, it is possible to approximate within O(log3 n) as shown in [GKR00]. Restricting to planar graphs, the group STP can be approximated within O(log n poly log log n) [DHK14], and very recently, this result is improved to a PTAS [BDHM16]. For more related works, we refer the reader to a survey by Hauptmann and Karpiński [HK13], who gave a comprehensive literature review of STP and its variations. PTAS’s for Other Problems in Doubling Metrics. Doubling dimension captures the local growth rate of a metric space. A k-dimensional Euclidean dimension has doubling dimension O(k). A challenge in extending algorithms for low-dimensional Euclidean space to doubling metrics is the lack of geometric properties in doubling metrics. Although QPTAS’s for various approximation problems in doubling metrics, such as the Traveling Salesman Problem (TSP) and STP, were presented in [Tal04], a PTAS was only recently achieved for TSP [BGK12]. Subsequently, a PTAS is also achieved for group TSP in doubling metrics [CJ16]. Before this work, the existence of a PTAS for SFP (or even the special case STP) in doubling metrics remains an open problem. 1.2 Our Contribution and Techniques Although PTAS’s for TSP (and its group variant) are known, as we shall explain later, the nature of SFP and TSP-related problems are quite different. Hence, it is interesting to investigate what 1 new techniques are required for SFP. Fundamentally, it is an important question that whether the notion of doubling dimension captures sufficient properties of a metric space to design a PTAS for SFP, even without the geometric properties that are crucially used in obtaining approximation schemes for SFP in the Euclidean plane [BKM08]. In this paper, we settle this open problem by giving a (randomized) PTAS for SFP in doubling metrics. We remark that previously even a PTAS for SFP in higher-dimensional Euclidean space is not totally certain. Theorem 1.1 (PTAS for SFP in Doubling Metrics). For any 0 < ǫ < 1, there is a (randomized) algorithm that takes an instance of SFP with n terminal pairs in a metric space with doubling dimension at most k, and returns a (1 + ǫ)-approximate solution with constant probability, running √ k in time O(nO(1) ) · exp( log n · O( kǫ )O(k) ). We next give an overview of our techniques. On a high level, we use the divide and conquer framework that was originally used by Arora [Aro98] to achieve a PTAS for TSP in Euclidean space, and was extended recently to doubling metrics [BGK12]. However, we shall explain that it is non-trivial to adapt this framework to SFP, and how we overcome the difficulties encountered. Moreover, we shall provide some insights regarding the relationship between Euclidean and doubling metrics, and discuss the implications of our technical lemmas. Summary of Framework. As in [BGK12], a PTAS is designed for a class of special instances known as sparse instances. Then, it can be shown that the general instances can be decomposed into sparse instances. Roughly speaking, an instance is sparse, if there is an optimal solution such that for any ball B with radius r, the portion of the solution in B has weight that is small with respect to r. The PTAS for the sparse instances is usually based on a dynamic program, which is based on a randomized hierarchical decomposition as in [Tal04, BGK12]. This framework has also been successfully applied to achieve a PTAS for group TSP in doubling metrics [CJ16]. Intuitively, sparsity is used to establish the property that with high enough probability, a cluster in the randomized decomposition cuts a (near) optimal tour only a small number of times [BGK12, Lemma 3.1]. However, SFP brings new significant challenges when such a framework is applied. We next describe the difficulties and give an overview of our technical contributions. Challenge 1: It is difficult to detect a sparse instance because which Steiner points are used by the optimal solution are unknown. Let us first consider STP, which is a special case of SFP in which all (pairs of) terminals are required to be connected. In other words, the optimal Steiner tree is the minimum weight graph that connects all terminals. Unlike TSP in which the points visited by a tour are clearly known in advance, it is not known which points will be included in the optimal Steiner tree. In [BGK12], a crucial step is to estimate the sparsity of a ball B, which measures the weight of the portion of the optimal solution restricted to B. For TSP tour, this can be estimated from the points inside B that have to be visited. However, for solution involving Steiner points, it is difficult to analyze the solution inside some ball B, because it is possible that there are few (or even no) terminals inside B, but the optimal solution could potentially have lots of Steiner points and a large weight inside B. Our Solution: Analyzing the Distribution of Steiner Points in an Optimal Steiner Tree in Doubling Metrics. We resolve this issue by showing a technical characterization of Steiner points in an optimal Steiner tree for doubling metrics. This technical lemma is used crucially in 2 our proofs, and we remark that it could be of interest for other problems involving Steiner points in doubling metrics. Lemma 1.1 (Formal version in Lemma 3.1). For a terminal set S with diameter D, if an optimal Steiner tree spanning S has no edge longer than γD, then every Steiner point in the solution is √ within O( γ) · D distance to some terminal in S, where the big O hides the dependence on the doubling dimension. We observe that variants of Lemma 1.1 have been considered on the Euclidean plane. In [DHC85, DHW87], it is shown that if the terminal set consists of n evenly distributed points on a unit circle, then for large enough n, there is no Steiner points in an optimal Steiner tree. To see how this relates to our lemma, when n is sufficiently large, it follows that adjacent points in the circle are very close to each other. Hence, any long edge in a Steiner tree could be replaced by some short edge between adjacent terminals in the circle. Our lemma then implies that all Steiner points must be near the terminals, which is a weaker statement than the conclusion in [DHC85], but is enough for our purposes. We emphasize that the results in [DHC85, DHW87] rely on the geometric properties of the Euclidean plane. However, in our lemma, we only use that the doubling dimension is bounded. Implication of Lemma 1.1 on Sparsity Heuristic. We next demonstrate an example of how we use this technical lemma. In Lemma 3.3, we argue that our sparsity heuristic provides an upper bound on the weight of the portion of an optimal solution F within some ball B. The idea is that we remove the edges in F within B and add back some edges of small total weight to maintain connectivity. We first add a minimum spanning tree H on some net-points N within B of an appropriate scale γ · D. Using the property of doubling dimension, we argue that the number of points in H is bounded and so is its weight. In one of our case analysis, there are two sets S and T of terminals that are far apart d(S, T ) ≥ D, and we wish to argue that in the optimal Steiner tree F connecting S and T , there is an edge {u, v} of length at least Ω(γ) · D. If this is the case, we could remove this edge and connect u and v to their corresponding net-points directly. For contradiction’s sake, we assume there is no such edge, but Lemma 1.1 implies that every Steiner point must be close to either S and T . Since S and T are far apart, this means that there is a long edge after all. Conversely, in Lemma 3.4, we also use this technical lemma to show that if the sparsity heuristic for some ball B is large, then the portion of the optimal solution F inside B is also large. Challenge 2: In doubling metrics, the number of cells for keeping track of connectivity in each cluster could be too large. Unlike the case for TSP variants [BGK12, CJ16], the solution for SFP need not be connected. Hence, in the dynamic programming algorithm for SFP, in addition to keeping track of what portals are used to connect a cluster to points outside, we need to keep information on which portals the terminals inside a cluster are connected to. In previous works [BKM08], the notion of cells is used for this purpose. Previous Technique: Cell Property. The idea of cell property was first introduced in [BKM08], which gave a PTAS for SFP in the Euclidean plane using dynamic programming. Since there would have been an exponential number of dynamic program entries if we keep information on which portal is used by every terminal to connect to its partner outside the cluster, the high level idea is to partition a cluster into smaller clusters (already provided by the hierarchical decomposition) known as cells. Loosely speaking, the cell property ensures that every terminal inside the same cell must be connected to points outside the cluster in the same way. More precisely, a solution F satisfies the cell property if for every cluster C and every cell e inside C, there is only one component in the portion of F restricted to C that connects e to points outside C. 3 A great amount of work was actually needed in [BKM08] and subsequent work [BH12] to show that it is enough to consider cells whose diameters are constant times smaller than that of its cluster. This allows the number of dynamic program entries to be bounded, which is necessary for a PTAS. Difficulty Encountered for Doubling Metrics. When the notion of cell is applied to the dynamic program for SFP in doubling metrics, an important issue is that the diameters of cells need to be about Θ(log n) times smaller than that of its cluster, because there are around Θ(log n) levels in the hierarchical decomposition. Hence, the number of cells in a cluster is Ω(poly log n), which would eventually lead to a QPTAS only. A similar situation is observed when dynamic programming was first used for TSP on doubling metrics [Tal04]. However, the idea of using sparsity as in [BGK12] does not seem to immediately provide a solution. Our Solution: Adaptive Cells. Since there are around Θ(log n) levels in the hierarchical decomposition, it seems very difficult to increase the diameter of cells in a cluster. Our key observation is that the cells are needed only for covering the portion of a solution inside a cluster that touches the cluster boundary. Hence, we use the idea of adaptive cells. Specifically, for each connected component A in the solution crossing a cluster C, we define the corresponding basic cells such that if the component A has larger weight, then its corresponding basic cells (with respect to cluster C) will have larger diameters. Combining with the notion of sparsity and bounded doubling dimension, we can show that we only need to pay attention to a small number of cells. Further Cells for Refinement. Since the dynamic program entries are defined in terms of the hierarchical decomposition and the entries for a cluster are filled recursively with respect to those of its child clusters, we would like the cells to have a refinement property, i.e., if a cluster C has some cell e (which itself is some descendant cluster of C), then the child C ′ containing e has either e or all children of e as its cells. At first glance, a quick fix may be to push down each basic cell in C to its child clusters. Although we could still bound the number of relevant cells, it would be difficult to bound the cost to achieve the cell property. The reason is that the basic cells from higher levels are too large for the descendant clusters. When more than one relevant component intersects such a large cell, we need to add edges to connect the components. However, if the diameter of the cell is too large compared to the cluster, these extra edges would be too costly. We resolve this issue by introducing non-basic cells for a cluster: promoted cells and virtual cells. These cells are introduced to ensure that every sibling of a basic cell is present. Moreover, only non-basic cells of a cluster will be passed to its children. We show in Lemma 5.5 that the total number of effective cells for a cluster is not too large. Moreover, Lemma 5.3 shows that the refinement property still holds even if we only pass the non-basic cells down to the child clusters. More importantly, we show that as long as we enforce the cell property for the basic cells, the cell property for all cells are automatically ensured. This means that it is sufficient to bound the cost to achieve the cell property with respect to only the basic cells. Further Techniques: Global Cell Property. We note that the cell property in [BKM08] is localized. In particular, for each cluster C, we restrict the solution inside C, which could have components disconnected within C but are actually connected globally. In order to enforce the localized cell property as in [BKM08], extra edges would need to be added for these locally disconnected components. Instead, we enforce a global cell property, in which for every cell e in a cluster C, there is only one (global) connected component in the solution that intersects e and crosses the boundary of cluster C. A consequence of this is that if there are m components in the solution, then at most m − 1 extra edges are needed to maintain the global cell property. This implication is crucially used in our charging argument to bound the cost for enforcing the cell property for the basic cells. However, this would imply that in the dynamic program entries, we need to keep 4 additional information on how the portals of a cluster are connected outside the cluster. Combining the Ideas: A More Sophisticated Dynamic Program. Even though our approaches to tackle the encountered issues are intuitive, it is a non-trivial task to balance between different tradeoffs and keep just enough information in the dynamic program entries, but still ensure that the entries can be filled in polynomial time. 2 Preliminaries We consider a metric space M = (X, d) (see [DL97, Mat02] for more details on metric spaces). For x ∈ X and ρ ≥ 0, a ball B(x, ρ) is the set {y ∈ X | d(x, y) ≤ ρ}. The diameter Diam(Z) of a set Z ⊂ X is the maximum distance between points in Z. For S, T ⊂ X, we denote d(S, T ) := min{d(x, y) : x ∈ S, y ∈ T }, and for u ∈ X, d(u, T ) := d({u}, T ). Given a positive integer m, we denote [m] := {1, 2, . . . , m}. A set S ⊂ X is a ρ-packing, if any two distinct points in S are at a distance more than ρ away from each other. A set S is a ρ-cover for Z ⊆ V , if for any z ∈ Z, there exists x ∈ S such that d(x, z) ≤ ρ. A set S is a ρ-net for Z, if S is a ρ-packing and a ρ-cover for Z. We assume that a ρ-net for any ball in X can be constructed efficiently. We consider metric spaces with doubling dimension [Ass83, GKL03] at most k; this means that for all x ∈ X, for all ρ > 0, every ball B(x, 2ρ) can be covered by the union of at most 2k balls of the form B(z, ρ), where z ∈ X. The following fact captures a standard property of doubling metrics. Fact 2.1 (Packing in Doubling Metrics [GKL03]). Suppose in a metric space with doubling dimenk sion at most k, a ρ-packing S has diameter at most R. Then, |S| ≤ ( 2R ρ ) .  Given an undirected graph G = (V, E), where V V ⊂ X, E ⊆ V2 , and an edge e = {x, y} ∈ E receives weight d(x, y) from the metric space M . The weight w(G) or cost of a graph is the sum of its edge weights. Let V (G) denote the vertex set of a graph G. We consider the Steiner Forest Problem (SFP). Given a collection W = {(ai , bi ) | i ∈ [n]} of terminal pairs in X, the goal is to find an undirected graph F (having vertex set in X) with minimum cost such that each pair of terminals are connected in F . The non-terminal vertices in V (F ) are called Steiner points. Rescaling Instance. Fix constant ǫ > 0. Since we consider asymptotic running time to obtain (1+ǫ)-approximation, we consider sufficiently large n > 1ǫ . Suppose R > 0 is the maximum distance between a pair of terminals. Then R is a lower bound on the cost of an optimal solution. Moreover, the optimal solution F has cost at most nR, and hence, we do not need to consider distances larger ǫR than nR. Since F contains at most 4n vertices, if we consider an 32n 2 -net S for X and replace every point in F with its closest net-point in S, the cost increases by at most ǫ · OPT. Hence, after rescaling, we can assume that inter-point distance is at least 1 and we consider distances 3 up to O( nǫ ) = poly(n). By the property of doubling dimension (Fact 2.1), we can hence assume |X| ≤ O( nǫ )O(k) ≤ O(n)O(k) . c Hierarchical Nets. As in [BGK12], we consider some parameter s = (log n) k ≥ 4, where 0 < c < 1 is a universal constant that is sufficiently small (as required in Lemma 5.11). Set L := O(logs n) = k log n O( log log n ). A greedy algorithm can construct NL ⊆ NL−1 ⊆ · · · ⊆ N1 ⊆ N0 = N−1 = · · · = X such that for each i, Ni is an si -net for X, where we say distance scale si is of height i. Net-Respecting Solution. As defined in [BGK12], a graph F is net-respecting with respect to {Ni }i∈[L] and ǫ > 0 if for every edge {x, y} in F , both x and y belong to Ni , where si ≤ ǫ · d(x, y) < si+1 . 5 Given an instance W of a problem, let OPT(W ) be an optimal solution; when the context is clear, we also use OPT(W ) to denote the cost w(OPT(W )) as well; similarly, OPTnr (W ) refers to an optimal net-respecting solution. 2.1 Overview As in [BGK12, CJ16], we achieve a PTAS for SFP by the framework of sparse instance decomposition. Sparse Solution and Dynamic Program. Given a graph F and a subset S ⊆ X, F |X is the subgraph induced by the vertices in V (F ) ∩ X. A graph F is called q-sparse, if for all i ∈ [L] and all u ∈ Ni , w(F |B(u,3si ) ) ≤ q · si . We show that for SFP (in Section 5) there is a dynamic program DP that runs in polynomial time such that if an instance W has an optimal net-respecting solution that is q-sparse for some 1 ). small enough q, DP(W ) returns a (1 + ǫ)-approximation with high probability (at least 1 − poly(n) Sparsity Heuristic. Since one does not know the optimal solution in advance, we estimate the local sparsity with a heuristic. For i ∈ [L] and u ∈ Ni , given an instance W , the heuristic (i) Hu (W ) is supposed to estimate the sparsity of an optimal net-respecting solution in the ball B ′ := B(u, O(si )). We shall see in Section 3 that the heuristic actually gives a constant approximation to some appropriately defined sub-instance W ′ in the ball B ′ . Generic Algorithm. We describe a generic framework that applies to SFP. Similar framework is also used in [CJ16, BGK12] to obtain PTAS’s for TSP related problems. Given an instance W , we describe the recursive algorithm ALG(W ) as follows. 1. Base Case. If |W | = n is smaller than some constant threshold, solve the problem by brute force, recalling that |X| ≤ O( nǫ )O(k) . (i) 2. Sparse Instance. If for all i ∈ [L], for all u ∈ Ni , Hu (W ) is at most q0 · si , for some appropriate threshold q0 , call the subroutine DP(W ) to return a solution, and terminate. 3. Identify Critical Instance. Otherwise, let i be the smallest height such that there exists (i) (i) u ∈ Ni with critical Hu (W ) > q0 · si ; in this case, choose u ∈ Ni such that Hu (W ) is maximized. 4. Decomposition into Sparse Instances. Decompose the instance W into appropriate subinstances W1 and W2 (possibly using randomness). Loosely speaking, W1 is a sparse enough sub-instance induced in the region around u at distance scale si , and W2 captures the rest. We (i) note that Hu (W2 ) ≤ q0 · si such that the recursion will terminate. The union of the solutions to the sub-instances will be a solution to W . Moreover, the following property holds. 1 · (OPTnr (W ) − E[OPTnr (W2 )]), (1) E[OPT(W1 )] ≤ 1−ǫ where the expectation is over the randomness of the decomposition. 5. Recursion. Call the subroutine F1 := DP(W1 ), and solve F2 := ALG(W2 ) recursively; return the union F1 ∪ F2 . Analysis of Approximation Ratio. We follow the inductive proof as in [BGK12] to show that with constant probability (where the randomness comes from DP), ALG(W ) returns a tour with 1+ǫ ·OPTnr (W ), where expectation is over the randomness of decomposition expected length at most 1−ǫ into sparse instances in Step 4. As we shall see, in ALG(W ), the subroutine DP is called at most poly(n) times (either explicitly in the recursion or the heuristic H(i) ). Hence, with constant probability, all solutions returned by all instances of DP have appropriate approximation guarantees. 6 Suppose F1 and F2 are solutions returned by DP(W1 ) and ALG(W2 ), respectively. Since we assume that W1 is sparse enough and DP behaves correctly, w(F1 ) ≤ (1 + ǫ) · OPT(W1 ). The nr induction hypothesis states that E[w(F2 )|W2 ] ≤ 1+ǫ 1−ǫ · OPT (W2 ). 1 In Step 4, equation (1) guarantees that E[OPT(W1 )] ≤ 1−ǫ · (OPTnr (W ) − E[OPTnr (W2 )]). nr 1+ǫ Hence, it follows that E[w(F1 ) + w(F2 )] ≤ 1−ǫ · OPT (W ) = (1 + O(ǫ)) · OPT(W ), achieving the desired ratio. (i) Analysis of Running Time. As mentioned above, if Hu (W ) is found to be critical, then in the (i) decomposed sub-instances W1 and W2 , Hu (W2 ) should be small. Hence, it follows that there will be at most |X| · L = poly(n) recursive calls to ALG. Therefore, as far as obtaining polynomial running times, it suffices to analyze the running time of the dynamic program DP. The details are in Section 5.3. 2.2 Paper Organization In order to apply the above framework to obtain a PTAS for SFP, we shall describe in details the following components. (i) 1. (Section 3.) Design a heuristic H such that for each i ∈ [L] and u ∈ Ni , the heuristic Hu (W ) gives an upper bound for OPTnr (W )|B(u,3si ) . (i) 2. (Section 4.) When a critical Hu (W ) is found, decompose W into instances W1 and W2 such that equation (1) holds. 3. (Section 5.) Design a dynamic program DP that gives (1+ǫ)-approximation to sparse instances in polynomial time. 3 Sparsity Heuristic for SFP Suppose a collection W of terminal pairs is an instance of SFP. For i ∈ [L] and u ∈ Ni , recall that (i) we wish to estimate OPTnr (W )|B(u,3si ) with some heuristic Hu (W ). We consider a more general (i,t) heuristic Tu associated with the ball B(u, tsi ), for t ≥ 1. The following auxiliary sub-instance deals with terminal pairs that are separated by the ball. Auxiliary Sub-Instance. Fix δ := Θ( kǫ ), where the constant depends on the proof of Lemma 4.2. (i,t) For i ∈ [L], u ∈ Ni and t ≥ 1, the sub-instance Wu is induced by each pair {a, b} ∈ W as follows. (a) If both a, b ∈ B(u, tsi ), or if exactly one of them is in B(u, tsi ) and the other in B(u, (t + δ)si ), (i,t) then {a, b} is also included in Wu . (b) Suppose j is the index such that sj < δsi ≤ sj+1 . If a ∈ B(u, tsi ) and b ∈ / B(u, (t + δ)si ), (i,t) then {a, a′ } is included in Wu , where a′ is the nearest point to a in Nj . (c) If both a and b are not in B(u, tsi ), then the pair is excluded. (i) (i,4) Defining Heuristic. We define Hu (W ) := Tu (W ) in terms of a more general heuristic, where (i,t) (i,t) Tu (W ) is the cost of a constant approximate net-respecting solution of SFP on the instance Wu . For example, we can first apply the primal-dual algorithm in [GW95] that gives a 2-approximation (i,t) (i,t) of SFP, and then make it net-respecting and we have Tu (W ) ≤ 2(1 + Θ(ǫ)) · OPT(Wu ). (i,t) One potential issue is that OPTnr (W ) might use Steiner points in B(u, tsi ), even if Wu is empty. We shall prove a structural property of Steiner tree in Lemma 3.1, and Lemma 3.1 implies Lemma 3.2 which helps us to resolve this issue. Recall that the Steiner tree problem is a special case of SFP where the goal is to return a minimum cost tree that connects all terminals. 7 Lemma 3.1 (Distribution of Steiner Points in The Optimal Steiner Tree). Suppose S is a terminal set with Diam(S) ≤ D, and suppose F is an optimal Steiner tree with terminal set S. If the longest edge in F has weight at most γD (0 < γ ≤ 1), then for any Steiner point r in F , d(r, S) ≤ 4kγ log2 γ4 · D. Proof. Since F is an optimal solution, all Steiner points in F have degree at least 3. Fix any Steiner point r in F . Denote K := ⌈log2 (γD)⌉. Suppose we consider r as the root of the tree F . We shall show that there is a path of small weight from r to some terminal. Without loss of generality, we can assume that all terminals are leaves, because once we reach a terminal, there is no need to visit its descendants. For simplicity, we can assume that each internal node (Steiner point) has exactly two children, because we can ignore extra branches if an internal has more than two children. For i ≤ K, let Ei be the set of edges in F that have weights in the range (2i−1 , 2i ], and we say that such an edge is of type i. For each node u in F , denote Fu as the subtree rooted at u. Suppose (i) we consider Fu and remove all edges in ∪j≥i Ej from Fu ; in the resulting forest, let Mu be the number of connected components that contain at least one terminal. We shall prove the following statement by structural induction on the tree Fb . P (i) For each node u ∈ F , there exists a leaf x ∈ Fu such that d(x, u) ≤ i≤K 2i log2 Mu . Base Case. If u is a leaf, then the statement is true. Inductive Step. Suppose u has children u1 and u2 such that {u, u1 } ∈ Ei and {u, u2 } ∈ Ei′ , where i ≥ i′ . Suppose x1 and x2 are the leaves in Fu1 and Fu2 , respectively, from the induction (i) (i) (i) hypothesis. Observe that Mu = Mu1 + Mu2 . We consider two cases. (i) (i) (1) Suppose Mu1 ≤ Mu2 . Then, we can pick x1 to be the desired leaf, because the extra distance (i) (i) (j) (j) d(u1 , u) ≤ 2i can be accounted for, as 2Mu1 ≤ Mu , and Mu1 ≤ Mu for j 6= i. More precisely, P P (i) (j) (j) d(x1 , u) ≤ d(x1 , u1 ) + d(u1 , u) ≤ 2i · (1 + log2 Mu1 ) + j≤K:j6=i 2j log2 Mu1 ≤ j≤K 2j log2 Mu , where the second inequality follows from the induction hypothesis for u1 . (i) (i) (2) Suppose Mu2 < Mu1 . Then, similarly we pick x2 to be the desired leaf, because the extra ′ i distance is d(u2 , u) ≤ 2 ≤ 2i . This completes the inductive step. (i) Next, it suffices to give an upper bound for each M (i) := Mr for root r. Suppose after removing all tree edges in ∪j≥i Ej , P and Q are two clusters each containing at least one terminal. Then, observe that the path in F connecting P and Q must contain an edge e with weight at least 2i−1 . It follows that d(P, Q) ≥ 2i−1 ; otherwise, we can replace e in F with another edge of length less than 2i−1 to obtain a Steiner tree with strictly less weight. It follows that each cluster has a terminal )k , by the packing property of representative that form a 2i−1 -packing. Hence, we have M (i) ≤ ( 4D 2i doubling metrics (Fact 2.1). P 4D i Therefore, every Steiner point r in Fb has a terminal within distance i≤K k · 2 log 2 2i ≤ 4kγD log2 γ4 . Given a graph F , a chain in F is specified by a sequence of points (p1 , p2 , . . . , pl ) such that there is an edge {pi , pi+1 } in F between adjacent points, and the degree of an internal point pi (where 2 ≤ i ≤ l − 1) in F is exactly 2. Lemma 3.2 (Steiner Tree of Well-Separated Terminals Contains A Long Chain). Suppose S and T are terminal sets in a metric space with doubling dimension at most k such that Diam(S ∪ T ) ≤ D, and d(S, T ) ≥ τ D, where 0 < τ < 1. Suppose F is an optimal net-respecting Steiner tree connecting τ2 the points in S ∪ T . Then, there is a chain in F with weight at least 4096k 2 ·D such that any internal point in the chain is a Steiner point. 8 2 τ Proof. Denote γ := 4096k 2 . Suppose for contradiction’s sake that all chains in F have weight less than γD. We consider a minor Fb that is obtained from F by merging Steiner points of degree 2 with adjacent points. Hence, the vertex set of Fb are the terminals together with Steiner points in F with degree at least 3. Moreover, an edge in Fb corresponds to a chain in F , and its weight is defined to be the weight of the corresponding chain. Then by using the argument in Lemma 3.1, We can prove that every point u in Fb is within distance at most 4kγ log2 γ8 · D to a terminal. Precisely, we shall replace the F in the argument of Lemma 3.1 with Fb . We observe that the only difference caused by this replacement is when we use the optimality of the solutions. Specifically, in Lemma 3.1 we use the fact that when an edge e connects point sets P and Q that both contain at least one terminal (i.e. removing e results in the dis-connectivity of P and Q), it has to be d(P, Q) ≥ w(e), while the corresponding fact for Fb w(e) is d(P, Q) ≥ 1+Θ(ǫ) ≥ w(e) 2 because of the net-respecting property. Obtaining Contradiction. Recall that the terminal sets S and T are well-separated d(S, T ) ≥ τ D. Since all Steiner points in Fb are at distance at most 4kγ log2 γ8 ·D from the terminals, it follows √ that there must be an edge in Fb with length at least τ D −8kγ log2 8 ·D > τ D −32k γD > γD. γ Lemma 3.3. Suppose F is an optimal net-respecting solution for an SFP instance W . Then, for (i,t+1) O(k) si . any i and u ∈ Ni and t ≥ 1, w(F |B(u,tsi ) ) ≤ Tu (W ) + O( skt ǫ ) Proof. Given an optimal net-respecting solution F , we shall construct another net-respecting solution in the following steps. 1. Remove edges in F |B(u,tsi ) . (i,t+1) 2. Add edges corresponding to the heuristic Tu (W ). ǫ i 3. Add edges in a minimum spanning tree H of Nj ∩ B(u, (t + 2)si ), where sj ≤ Θ( (t+1)k 2)·s < sj+1 , where the constant in Theta depends on Lemma 3.2; convert each added edge into a net-respecting path if necessary. Observe that the weight of edges added in this step is O(k) · si . O( stk ǫ ) 4. To ensure feasibility, replace some edges without increasing the weight. If we can show that the resulting solution is feasible for W , then the optimality of F implies b := B(u, (t + 1)si ). the result. We denote B := B(u, tsi ) and B Feasibility. b / B and y is connected in F |X\B to some point outside B}, Define Vb1 := {x : x ∈ B | ∃{x, y} ∈ F s.t. y ∈ and b In Step b \ B | x is connected in F | b to some point in Vb1 , ∃{x, y} ∈ F s.t. y ∈ / B}. Vb2 := {x : x ∈ B B 4, we will ensure that all points in Vb1 ∪ Vb2 are connected to the MST H. b then they will be connected by the edges correIf a pair {a, b} ∈ W has both terminals in B, (i,t+1) b and b ∈ b then edges for the heuristic T(i,t+1) sponding to Tu (W ). If a ∈ B / B, (W ) ensures that u a is connected to H; moreover, in the original tree F , if the path from a to b does not meet any node in Vb2 , then this path is preserved, otherwise there is a portion of the path from a point in Vb2 b then they might be connected in F via to b that is still preserved. If both a and b are outside B, b b points in V2 ; however, since all points in V2 are connected to H, feasibility is ensured. We next elaborate how Step 4 is performed. Consider a connected component U in F |Vb1 ∪(B\B) b b b b that contains a point in V1 . Let S1 := U ∩ V1 and S2 := U ∩ V2 . If S2 = ∅, then there is an edge b This means that both its end-points are in Nj by the connecting S1 directly to a point outside B. net-respecting property, and hence S1 is already connected to H. b connected directly to some point y ∈ S2 such that d(y, z) ≥ si , Next, if there is a point z ∈ /B 2 then by the net-respecting property, y ∈ Nj and so again U is connected to H. Otherwise, we 9 i b connecting have d(S1 , S2 ) ≥ s2 . We next replace U with an optimal net-respecting Steiner tree U S1 ∪ S2 . Since U itself is net-respecting, this does not increase the cost. Observing that Diam(S1 ∪ S2 ) ≤ 2(t + 1)si , we can use Lemma 3.2 to conclude that there exists b from some point u to v such that its length is at least Θ( 2 1 ) · si . Hence, we a chain in U k (t+1) can remove this chain, and use its weight to add a net-respecting path from each of u and v to its nearest point in Nj . This does not increase the cost, and ensures that both S1 and S2 are connected to H. c2 are connected to Therefore, we have shown that Step 4 ensures that all points in c V1 and V H. (i) (i,4) It is because of Lemma 3.3 that we choose Hu (W ) := Tu (W ) to be the heuristic. Corollary 3.1 (Threshold for Critical Instance). Suppose F is an optimal net-respecting solution Θ(k) . If for all i ∈ [L] and u ∈ N , H(i) (W ) ≤ qsi , then F is for an SFP instance W , and q ≥ Θ( sk u i ǫ ) 2q-sparse. Lemma 3.4. Suppose W is an SFP instance. Consider i ∈ [L], u ∈ Ni , and t ≥ t′ ≥ 1. Suppose ′ (i,t) (i,t′ ) O(k) si . F is a net-respecting solution for Wu . Then, Tu (W ) ≤ 4(1 + ǫ) · w(F ) + O( skt ǫ ) (i,t′ ) Proof. We first show that there is a feasible solution for Wu with weight at most 2 · w(F ) + (i,t′ ) skt′ O(k) i s . Then, the heuristic Tu (W ) gives the weight of a net-respecting solution with cost O( ǫ ) ′ O(k) si . at most 4(1 + ǫ) · w(F ) + O( skt ǫ ) (i,t′ ) (i,t) We first include F in the solution. It suffices to handle the terminal pairs in Wu \ Wu . (i,t) ′ ′ i Such a pair {a, a } must be induced from {a, b} ∈ Wu such that a ∈ B(u, t s ) and b ∈ B(u, (t + δ)si ) \ B(u, (t′ + δ)si ). We next add more edges such that a is connected to a′ , which lies in Nj , 2 where sj ≤ Θ( t′δk2 ) · si < sj+1 . We add a minimum spanning tree H on the points in Nj ∩ B(u, (t′ + δ)si ). This has cost at ′ O(k) · si . most O( skt ǫ ) (i,t) Consider a connected component U of F . Consider the terminal pairs {a, b} ∈ Wu connected by U such that a ∈ B(u, t′ si ) and b ∈ B(u, (t + δ)si ); let S1 be those terminals a’s, and S2 be those b is an optimal net-respecting Steiner tree connecting S1 ∪ S2 . Since U is terminal b’s. Suppose U b is at most that of U . also net-respecting, it follows that the weight of U i Since d(S1 , S2 ) ≥ δs and Diam(S1 ∪ S2 ) ≤ Θ(t′ )si , it follows from Lemma 3.2 that there exists b with weight at least Θ( ′δ22 ) · si . Hence, we can remove this chain, and use a chain from p to q in U tk this weight to connect p and q to each of their closest points in Nj . This ensures that each point a ∈ S1 is connected to its closest point in Nj via the minimum spanning tree H. If we perform this operation on each connected component U of F , the weight of edges added (i,t′ ) is at most w(F ). Hence, we have shown that there is a feasible solution to Wu with cost at most skt′ O(k) i s , as required. 2 · w(F ) + O( ǫ ) 4 Decomposition into Sparse Instances (i) In Section 3, we define a heuristic Hu (W ) to detect a critical instance around some point u ∈ Ni at distance scale si . We next describe how the instance W can be decomposed into W1 and W2 such that equation (1) in Section 2.1 is satisfied. Since the ball centered at u with radius around si could potentially separate terminal pairs in W , we use the idea in Section 3 for defining the heuristic to decompose the instance. 10 Θ(k) according to CorolDecomposing a Critical Instance. We define a threshold q0 := Θ( sk ǫ ) lary 3.1. As stated in Section 2.1, a critical instance is detected by the heuristic when a smallest (i) (i,4) i ∈ [L] is found for which there exists some u ∈ Ni such that Hu (W ) = Tu (W ) > q0 si . More(i) over, in this case, u ∈ Ni is chosen to maximize Hu (W ). To achieve a running time with an exp(O(1)k log(k) ) dependence on the doubling dimension k, we also apply the technique in [CJ16] to choose the cutting radius carefully. (i,4+2λ) Claim 4.1 (Choosing Radius of Cutting Ball). Denote T(λ) := Tu 0 ≤ λ < k such that T(λ + 1) ≤ 30k · T(λ). (W ). Then, there exists Proof. Suppose the contrary is true. Then, it follows that T(k) > (30k)k · T(0). We shall obtain (i,4+2k) a contradiction by showing that there is a solution for the instance Wu corresponding to (i,4+2k) T(k) = Tu (W ) with small weight. Define Ni′ to be the set of points in Ni that cover B(u, (2k + 5)si ), and similarly define Nj′ , where sj ≤ δ · si ≤ sj+1 . Define edge set F to be the union of a minimum spanning tree on Nj′ together with the union of (i,4+2k) (i) . By the edge sets Hv over v ∈ Ni′ . It follows that F is a feasible solution for the instance Wu ′ i ′ i k the choice of u and q0 , we have w(F ) ≤ |Nj | · 2(2k + 5) · s + |Ni | · T(0) ≤ q0 s + (4k + 10) · T(0) ≤ (15k)k · T(0). Hence, we have an upper bound for the heuristic T(k) ≤ 2(1 + Θ(ǫ)) · w(F ) ≤ (30)k · T(0), which gives us the desired contradiction. Cutting Ball and Sub-Instances. Suppose λ ≥ 0 is picked as in Claim 4.1, and sample h ∈ [0, 12 ] b := B(u, (4 + uniformly at random. Recall that δ := Θ( kǫ ). Define B := B(u, (4 + 2λ + h)si ) and B i 2λ + h + δ)s ). The instances W1 and W2 are induced by each pair {a, b} ∈ W as follows. b then include {a, b} in W1 . (a) If a ∈ B and b ∈ B, b (b) If a ∈ B and b ∈ / B, then include {a, a′ } in W1 and {a′ , b} in W2 , where a′ is the closest point in Nj to a and sj ≤ δ · si < sj+1 . (c) If both a and b are not in B, then include {a, b} in W2 . Lemma 4.1 (Sub-Instances Are Sparse). The sub-instances W1 and W2 satisfy the following. (i) If F1 is feasible for W1 and F2 is feasible for W2 , then the union F1 ∪ F2 is feasible for W . (i) (ii) The sub-instance W2 does not have a critical instance with height less than i, and Hu (W2 ) = 0. (i) (iii) Hu (W1 ) ≤ O(s)O(k) · q0 · si . Proof. The first two statements follow immediately from the construction. For the third statement, we use the fact that there is no critical instance at height i − 1 to show that there is a solution to W1 with small cost. Specifically, we consider a minimum spanning tree H on Nj ∩B(u, 5si ), where sj ≤ δ·si−1 < sj+1 . Then, we have w(H) ≤ q0 · si . (i−1) Moreover, we consider the union of solutions corresponding to Hv (W ), over v ∈ Ni−1 ∩ i O(k) i B(u, 5s ). The cost is O(s) · q0 · s . (i−1) Hence, the union of H together with the edges for the Hv (W )’s is feasible for W1 , and this (i) implies that Hu (W1 ) ≤ O(s)O(k) · q0 · si . Lemma 4.2 (Combining Costs of Sub-Instances). Suppose F is an optimal net-respecting solution for W . Then, for any realization of the decomposed sub-instances W1 and W2 as described above, 11 there exist net-respecting solutions F1 and F2 for W1 and W2 , respectively, such that (1 − ǫ) · E[w(F1 )] + E[w(F2 )] ≤ w(F ), where the expectation is over the randomness to generate W1 and W2 . b ⊂ B. b be defined as above, and denote B := B(u, (4+2λ+1)·si ). Hence, B ⊂ B Proof. Let B and B We start by including F |B in T1 , and including the remaining edges in F in F2 . We will then show how to add extra edges with expected weight at most ǫ · E[w(F1 )] to make F1 and F2 feasible. This will imply the lemma. Define N to be the subset of Nj that cover the points in B, where sj < δsi ≤ sj+1 . We include a copy of a minimum spanning tree H of N in each of F1 and F2 , and make it net-respecting. This O(k) · si . costs at most |N | · O(k) · si ≤ O( ks ǫ ) b \ B (of width δ) into F1 . This has expected We next include the edges of F in the annulus B cost at most δ · w(F |B ). Connecting Crossing Points. To ensure the feasibility of F1 , we connect the following sets of points to N . We denote: b \ B, {x, y} ∈ F }, V2 := {y ∈ B b \ B | ∃x ∈ B, {x, y} ∈ F }, and V1 := {x ∈ B | ∃y ∈ B b b V3 := {x ∈ B | ∃y ∈ / B, {x, y} ∈ F }. We shall connect each point in V1 ∪ V2 ∪ V3 to its closest point in N . Note that if such a point x i is incident to some edge in F with weight at least s4 , then the net-respecting property of F implies b that x is already in N . Otherwise, this is because some edge {x, y} in F is cut by either B or B, ). Hence, each edge {x, y} ∈ F |B has an expected which happens with probability at most O( d(x,y) si contribution of δsi · O( d(x,y) ) = O(δ) · d(x, y). si Similarly, to ensure the feasibility of F2 , we ensure each point in the following set is connected to N . Denote c V1 := {x ∈ B | ∃y ∈ / B, {x, y} ∈ F }. By the same argument, the expected cost to connect each point to N is also at most O(δ) · w(F |B ). Charging the Extra Costs to F1 . Apart from using edges in F , the extra edges come from two copies of the minimum spanning tree H, and other edges with cost O(δ) · w(F |B ). We charge these extra costs to F1 . (i,4) (i,4+2λ+h) Since Tu (W ) > q0 · si and F1 is a net-respecting solution for Wu , by Lemma 3.4, q0 1 sk O(k) i i (i) · s ) > 8 · s , by choosing large enough q0 . w(F1 ) ≥ 4(1+ǫ) (T (u, 4) − O( ǫ ) ǫ 2 O(k) ·si ≤ Therefore, the cost for the two copies of the minimum spanning tree H is at most O( ks ǫ ) · w(F1 ). (i,4+2(λ+1)) We next give an upper bound on w(F |B ), which is at most Tu (i,4+2(λ+1)) O(k) · si , (W ) + O( sk ǫ ) (i,4+2λ+1) by Lemma 3.3. By the choice of λ, we have Tu (W ) ≤ 30k · Tu (W ). Moreover, (i,4+2λ+1) sk O(k) i · s . Hence, we can conclude that by Lemma 3.4, Tu (W ) ≤ 4(1 + ǫ) · w(F1 ) + O( ǫ ) w(F |B ) ≤ O(k) · w(F1 ). Hence, by choosing small enough δ = Θ( kǫ ), we can conclude that the extra costs O(δ)·w(F |B ) ≤ ǫ 2 · w(F1 ). Therefore, we have shown that E[w(F1 )] + E[w(F2 )] ≤ w(F ) + ǫ · w(F1 ), where the right hand side is a random variable. Taking expectation on both sides and rearranging gives the required result. 5 A PTAS for Sparse SFP Instances Our dynamic program follows the divide and conquer strategy as in previous works on TSP [Aro98, Tal04, BGK12] that are based on hierarchical decomposition. However, to apply the framework to 12 SFP, we need a version of the cell property that is more sophisticated than previous works [BKM08, BH12]. We shall first give a review of the hierarchical decomposition techniques in Section 5.1. Then in Section 5.2, we shall define our cell property precisely, and also prove that there exist good solutions that satisfy the cell property (in Lemma 5.6). Finally, we shall define DP in Section 5.3, and conclude a PTAS for sparse SFP instances (in Corollary 5.2). 5.1 Review on Hierarchical Decomposition Definition 5.1 (Single-Scale Decomposition [ABN06]). At height i, an arbitrary ordering πi is imposed on the net Ni . Each net-point u ∈ Ni corresponds to a cluster center and samples random t ln χ χ · lnsiχ · e− si for hu from a truncated exponential distribution Expi having density function t 7→ χ−1 t ∈ [0, si ], where χ = O(1)k . Then, the cluster at u has random radius ru := si + hu . The clusters induced by Ni and the random radii form a decomposition Πi , where a point p ∈ V belongs to the cluster with center u ∈ Ni such that u is the first point in πi to satisfy p ∈ B(u, ru ). We say that the partition Πi cuts a set P if P is not totally contained within a single cluster. ) The results in [ABN06] imply that the probability that a set P is cut by Πi is at most β·Diam(P , si where β = O(k). Definition 5.2 (Hierarchical Decomposition). Given a configuration of random radii for {Ni }i∈[L] , decompositions {Πi }i∈[L] are induced as in Definition 5.1. At the top height L − 1, the whole space is partitioned by ΠL−1 to form height-(L − 1) clusters. Inductively, each cluster at height i + 1 is partitioned by Πi to form height-i clusters, until height 0 is reached. Observe that a cluster has K := O(s)k child clusters. Hence, a set P is cut at height i iff the set P is cut by some partition P ) ) = O(k)·Diam(P . Πj such that j ≥ i; this happens with probability at most j≥i β·Diam(P si si Portals. As in [Aro02, Tal04, BGK12], each height-i cluster U is equipped with portals such that a solution F is portal-respecting, if for every edge {x, y} in F between a point x in U and some point y outside U , at least one of x and y must be a portal of cluster U . As mentioned in [BGK12], the portals of a cluster need not be points of the cluster itself, but are just used as connection points. For a height-i cluster C, its portals is the subset of net-points in Ni′ that cover C, where i′ is the ′ ǫ maximum index such that si ≤ max{1, 4βL · si }. As noted in [Tal04, BGK12, CJ16], any solution can be made to be portal-respecting with a multiplicative factor of 1 + O(ǫ) in cost. k Since a height-i cluster has diameter O(si ), by Fact 2.1, the cluster has at most m := O( βLs ǫ ) portals. (m, r)-Light Solution. A solution F is called (m, r)-light, if it is portal-respecting for a hierarchical decomposition in which each cluster has at most m portals, and for each cluster, at most r of its portals are used in F to connect points in the cluster to the points outside. 5.2 Structural Property In this section, we shall define the cell property (Definition 5.13) with respect to the effective cells (Definition 5.9), where the effective cells are carefully chosen to implement our adaptive cells idea which is discussed in Section 1. Specifically, the effective cells are defined by the union of the basic cells (Definition 5.5) and the non-basic cells (Definition 5.8). Moreover, the virtual cells and the promoted cells (Definition 5.7) are introduced in order to define the non-basic cells. Finally, we shall prove the structural property in Lemma 5.6. Notations and Parameters. Let ht(C) denote the height of a cluster C, des(C) denote the collection of all descendant clusters of C (including C), and par(C) denote the parent cluster of C. 13 For x ∈ R+ , let ⌊x⌋s denote the largest power of s that is at most x, and ⌈x⌉s denote the smallest power of s that is at least x. Define γ̂0 := Θ( ksǫ2 L ), and define γ̂1 := Θ( sǫ2 ). Define γ0 such that 1 1 1 1 γ0 := ⌈ γ̂0 ⌉s , and define γ1 such that γ1 := ⌊ γ̂1 ⌋s . We note that γ0 < γ1 . Definition 5.3 (Cell). Suppose C is a cluster of height i. A p-cell of C is a height-logs p sub-cluster of C. Definition 5.4 (Crossing Component). Suppose C is some cluster, and F is a solution for SFP. We say that a subset A crosses C, if there exists points x, y ∈ A such that x ∈ C and y ∈ / C. A component A in F is called a crossing component of C if A crosses C. In the following, we shall introduce the notions of the basic cells, owner of basic cells, promoted cells, virtual cells, non-basic cells, and effective cells. All of these are defined with respect to some feasible solution to SFP. We assume there is an underlying feasible solution F when talking about these definitions. Adaptive Cells. For each cluster C, we shall define its basic cells whose heights depend on the weights l of the crossing components of C in the solution F . We consider three cases. Define I1 (l) := {i | ⌊l⌋s ≥ si }, I2 (l) := {i | γγ10 si ≤ ⌊l⌋s < si } and I3 (l) := {i | i ≤ L, ⌊l⌋s < γγ10 si }. Define a function h : [L] × R+ → R+ , such that  i for i ∈ I1 (l)  γ1 s , h(i, l) = γ1 ⌊l⌋s , for i ∈ I2 (l)   i γ0 s , for i ∈ I3 (l) Lemma 5.1. h(i+1,l) s ≤ h(i, l) ≤ h(i + 1, l). Proof. If both i and i + 1 lie in the same Ij (l) (j ∈ {1, 2, 3}), then it holds immediately. Otherwise, it is either i ∈ I2 (l) but i + 1 ∈ I3 (l), or i ∈ I1 (l) but i + 1 ∈ I2 (l). • If i ∈ I1 (l) and i+1 ∈ I2 (l). This implies si = ⌊l⌋s . Hence, h(i, l) = γ1 si = γ1 ⌊l⌋s = h(i+1, l). • If i ∈ I2 (l) and i + 1 ∈ I3 (l). This implies si = γγ01 ⌊l⌋s . Hence, s · h(i, l) = s · γ1 ⌊l⌋s = γ0 si+1 = h(i + 1, l). This implies the inequality. Definition 5.5 (Basic Cell). Suppose C is a cluster of height i, and A is a crossing component of C. Define l := w(A). Define the basic cells of A in C, BasA (C), to be the collection of the h(i, l)-cells of C that intersect A. Define the basic cells of C, Bas(C), to be the union of BasA (C) for all crossing components A of C. Definition 5.6 (Owner of a Basic Cell). For some cluster C, define the owner of e ∈ Bas(C) to be the minimum weight crossing component A such that e ∈ BasA (C). Definition 5.7 (Promoted Cell and Virtual Cell). Suppose C is a cluster of height i. Let S be the set of sub-clusters of C that is not in Bas(C) but has a sibling in Bas(C). Consider each e ∈ S. • If there exists a sub-cluster C ′ of C such that e ∈ Bas(C ′ ), then define Proe (C) := des(e) ∩ Bas(C ′ ), and define Vire (C) := ∅, where C ′ ⊂ C is any one that satisfies e ∈ Bas(C ′ ). • Otherwise, define S Proe (C) := ∅, and define Vire (C) S := e. Finally, Pro(C) := e∈S Proe (C), and Vir(C) := e∈S Vire (C), and elements in Pro(C) and Vir(C) are called promoted cells and virtual cells respectively. 14 Lemma 5.2. For any cluster C, if e ∈ Vir(C), then for any cluster C ′ ⊂ C (C ′ may equal C), e\{e′ ∈ Bas(C ′ ) | e′ ( e} has no intersection with any crossing component of C ′ . Proof. Suppose not. Then, there exists a cluster C ′ ⊂ C, and a crossing component A of C ′ , such that A intersects u := e\{e′ ∈ Bas(C ′ ) | e′ ( e}. This implies that there exists u′ ∈ BasA (C ′ ), such that e ⊂ u′ . By Lemma 5.1, and the fact that h(ht(C ′ ), w(A)) ≥ sht(e) and that h(0, w(A)) < sht(e) , we know that there exists a cluster C ′′ ⊂ C ′ ⊂ C, such that e ∈ BasA (C ′′ ). This contradicts with the definition of virtual cells. Definition 5.8 (Non-basic Cell). We define the non-basic cells NBas(C) for a cluster C. If C is the root cluster, then NBas(C) = Pro(C) ∪ Vir(C)\Bas(C). For any other cluster C, define NBas(C) := {e ∩ C | e ∈ Pro(C) ∪ Vir(C) ∪ NBas(par(C))\Bas(C)}. Definition 5.9 (Effective Cell). For a cluster C, define the effective cells of C as Eff(C) := Bas(C) ∪ NBas(C). Definition 5.10 (Refinement). Suppose S1 and S2 are collections of clusters. We say S1 is a refinement of S2 , if for any e ∈ S2 , either e ∈ S1 , or all child clusters of e are in S1 . Lemma 5.3. Suppose C is S a cluster that is not a leaf. Define {Ci }i to be the collection of all the child clusters of C. Then i Eff(Ci ) is a refinement of Eff(C). S Proof. Define S := i Eff(Ci ). It is sufficient to prove that for any e ∈ Eff(C), either e ∈ S, or all child clusters of e are in S. If e ∈ NBas(C) and e 6= C, then e ∈ S follows from Definition 5.8 and Definition 5.9. If e ∈ NBas(C) but e = C, then also by Definition 5.8 and Definition 5.9, C ∩ Ci = Ci ⊂ Eff(Ci ), and this implies that all child clusters of e are in S. Otherwise, e ∈ Bas(C), then by Lemma 5.1, we know that either e ∈ S, or there exists e′ ⊂ e such that ht(e′ ) = ht(e)−1 and e′ ∈ S. Then all siblings of e′ are in S, by the definition of promoted cells and virtual cells. This implies that all child clusters of e are in S. Definition 5.11 (Candidate Center). Suppose CSis a cluster of height i. The set of candidate centers of C, denoted as Can(C), is the subset of ij=logs γ 2 si Nj that may become a center of C’s 0 child cluster in the hierarchical decomposition. Lemma 5.4. For any cluster C, the centers of clusters in Eff(C) are chosen from Can(C), and |Can(C)| ≤ κ, where κ := O( γ10 )O(k) . Proof. We first prove that centers of cluster in Eff(C) are chosen from Can(C). • For e ∈ Bas(C), by the definition of the basic cells, we have ht(e) ≥ logs γ0 si . • For e ∈ Pro(C), we have that e is a basic cell of some cluster C ′ , and hence ht(e) ≥ logs γ02 si . • For e ∈ Vir(C), since it is a sibling of a basic cell, so ht(e) ≥ logs γ0 si . • For e ∈ NBas(C), there is a cluster C ′′ such that C ⊂ C ′′ and e ∈ Pro(C ′′ ) ∪ Vir(C ′′ ). Hence ht(e) ≥ logs γ02 si . Therefore, centers of clusters in Eff(C) are in Can(C). We then bound |Can(C)|. Suppose i := ht(C). Observe that a center of height j ≤ i that may become a center of a child cluster of C are contained in a ball of diameter O(si ). Moreover, Nj is an sj packing. Hence, by packing property, |Can(C)| ≤ O( γ10 )O(k) . Lemma 5.5. Suppose Eff is defined in terms of a solution that is (m, r)-light. Then for each cluster C, |Eff(C)| ≤ ρ, where ρ := O(logs γ10 ) · r 2 · O( γs1 )O(k) . 15 Proof. Suppose C is of height i. We give upper bounds for |Bas(C)|, |Pro(C)|, |Vir(C)| and |NBas(C)| respectively. Bounding |Bas(C)|. Fix a crossing component A of C, and suppose l := w(A). We upper bound |BasA (C)|. • If i ∈ I1 (l), then BasA (C) is a subset of γ1 si -cells of C. By packing property, |BasA (C)| ≤ O( γ11 )k . • If i ∈ I2 (l), then BasA (C) is a subset of γ1 ⌊l⌋s -cells of C. Since all the γ1 ⌊l⌋s -cells that intersect A are inside a ball of diameter O(l), by packing property, |BasA (C)| ≤ O( γs1 )O(k) . • If i ∈ I3 (l), then BasA (C) is a subset of γ0 si -cells of C. Since all the γ0 si -cells that intersect A are inside a ball of diameter O( γγ10 si ), by packing property, |BasA (C)| ≤ O( γ11 )k . Since the solution is r-light, there are at most r crossing components. Therefore, s |Bas(C)| ≤ r · O( )O(k) . γ1 Bounding |Pro(C)| and |Vir(C)|. Recall that for e ∈ Bas(C), and for e′ ∈ / Bas(C) that is a sibling ′ of e, we either include e to Vir(C), or include des(e) ∩ Bas(C ) to Pro(C), for some sub-cluster C ′ of C. In either cases, the number of added elements is at most r · O( γs1 )O(k) , and we charge this to e. We observe that for each e ∈ Bas(C), it has at most O(s)k siblings, by packing property. Therefore, each e is charged at most O(s)k times. We conclude that s |Pro(C) ∪ Vir(C)| ≤ O(s)k · r 2 · O( )O(k) . γ1 Bounding |NBas(C)|. Suppose P is the set consisting S of C and all its ancestor clusters. By definition, NBas(C) is a subset of the inside C clusters of p∈P (Pro(p) ∪ Vir(p)). We shall first prove that if ht(p) − ht(C) > 2 logs γ10 , then there is no element in Pro(p) ∪ Vir(p) that can appear in NBas(C), for any p ∈ P . Suppose not. Then there exists some p such that ht(p)− ht(C) > 2 logs γ10 . Let j := ht(p). We observe that all elements in Pro(p)∪ Vir(p) have height at least logs γ02 sj = j − 2 logs γ10 , by Definition 5.7 and Definition 5.5. However, if some element in Pro(p) ∪ Vir(p) appears in C, then it has height less than j − 2 logs γ10 , by ht(C) < ht(p) − 2 logs γ10 . This is a contradiction. Therefore, |NBas(C)| ≤ O(logs Hence |Eff(C)| ≤ |Bas(C)| + |NBas(C)| ≤ O(logs 1 s ) · r 2 · O( )O(k) . γ0 γ1 1 2 γ0 ) · r · O( γs1 )O(k) . S ′ Definition 5.12 (Disjointification). For any collection of clusters S, define Dis(S) := {e\ e′ ∈S:e′ (e e }e∈S . S We say e is induced by u in S, if u ∈ S and e = u\ e′ ∈S:e′ (u e′ , and the height of e is defined as the height of u. Definition 5.13 (Cell Property). Suppose F is an SFP solution, and suppose f maps a cluster C to a collection of sub-clusters of C. We say that f satisfies the cell property in terms of F if for all clusters C, for all e ∈ Dis(f (C)), there is at most one crossing component of C in F that intersects e. Lemma 5.6 (Structural Property). Suppose an instance has a q-sparse optimal net-respecting solution F . Moreover, for each i ∈ [L], for each u ∈ Ni , point u samples O(k log n) independent random radii as in Definition 5.1. Then, with constant probability, there exists a configuration from the sampled radii that defines a hierarchical decomposition, under which there exists an (m, r)-light solution F ′ that includes all the points in F , and Eff defined in terms of F ′ satisfies the cell property, where 16 • E[w(F ′ )] ≤ (1 + O(ǫ)) · w(F ), k k s k k k • m := O( skL ǫ ) and r := O(1) · q log s log n + O( ǫ ) + O( ǫ ) . Proof. We observe that the argument in [BGK12,h Lemma i 3.1] readily gives an (m, r)-light solution Fb with the desired m and r, and also satisfies E w(Fb) ≤ (1 + ǫ) · w(F ). We shall first show additional steps with additional cost at most ǫw(F ) in expectation, so that Bas defined in terms of the resultant solution satisfies the cell property. And then, we shall show that this implies Eff defined in terms of the resultant solution also satisfies the cell property (hence no more additional cost caused). Maintaining Cell Property: Basic Cells. For i := L, L−1, L−2, . . . , 0, for each height-i cluster C, we examine e ∈ Dis(Bas(C)) in the non-decreasing order of its height. If there are at least two crossing components that intersect e, we add edges in e to connect all crossing components that intersect e. We note that each added edge connects two components in F , and edges added are of length at most Diam(e). At the end of the procedure, we define the solution as F ′ . We observe that Bas defined in terms of F ′ satisfies the cell property. Recall that each added edge connects two components. We charge the cost of the edge to one of the components that it connects to. Moreover, after a rearrangement (at the end of the procedure), we can make sure each edge is charged to one of the components it connects to and each component is charged at most once. Bounding The Cost. We shall show that for a fixed component A, the expected cost it takes charge of is at most ǫ · w(A). Define l := w(A). The expected cost that A takes is at most the following (up to contant) L X i=1 Pr[A takes an edge in a cell of height i] · si+1 . Define pi := Pr[A takes an edge in a cell of height i]. Then, L X i=0 pi · si+1 ≤ X X si+1 + i:si ≤2γ1 l i:si >2γ1 l ≤ O(γ1 s)l + ≤ O(ǫ)l + pi si+1 X pi si+1 i:si >2γ1 l X pi si+1 . i:si >2γ1 l Fix an i such that si > 2γ1 l, and we shall upper bound pi . Suppose in the event corresponding to pi , A takes charge of an edge inside a cell e that is a basic cell of some height-h cluster. Note that h and e are random and recall that the edge is inside a cell of height i. We shall give a lower bound of h. Claim 5.1. sh ≥ si 2γ0 . Proof. Define the weight of the owner of e to be l′ . We first show that h must be in I3 (l′ ). By the procedure of maintaining cell property, we know that l′ ≤ l. If h ∈ I1 (l′ ), then ⌊l′ ⌋s ≥ sh , and si ≤ 2γ1 sh by e is of height i and the choice of radius in the single-scale decomposition. This implies that si ≤ 2γ1 sh ≤ 2γ1 l, which cannot happen since we assume si > 2γ1 l. 17 If h ∈ I2 (l′ ), then si ≤ 2γ1 ⌊l′ ⌋s . This implies that si ≤ 2γ1 l, which cannot happen as well. Therefore, h ∈ I3 (l′ ). This implies that 2γ0 sh ≥ si . Since the event that the edge is taken by A automatically implies that A is cut by a height-h cluster, and the probability that A is cut at a height-j cluster is at most O(k) · slj for j ∈ [L], we conclude that X X l l ≤ O(γ0 k) · i . pi ≤ Pr[A is cut at height j] ≤ O(k) · j s s i i s j:sj ≥ 2γ s j:sj ≥ 2γ 0 Hence P i:si >2γ1 l pi s i+1 0 ≤ O(γ0 ksL) · l ≤ O(ǫ)l. Maintaining Cell Property: Effective Cells. Next we show that Bas defined in terms of F ′ satisfies the cell property implies that Eff defined in terms of F ′ also satisfies the cell property. Fix a cluster C and fix e ∈ Dis(Eff(C)). We shall prove that there is at most one crossing component of C that intersects e in F ′ . Suppose e is induced by u in Eff(C). b such that C ⊂ C b and u ∈ Vir(C), b then there exists cluster C ′ Lemma 5.7. If there is no cluster C such that u ∈ Bas(C ′ ), ht(C ′ ) ≤ ht(C) and Eff(C) is a refinement of des(u) ∩ Bas(C ′ ). Proof. If u ∈ Bas(C), then we define C ′ = C, and the Lemma follows. If u ∈ NBas(C), then there exists C ′′ such that C ⊂ C ′′ and u ∈ Pro(C ′′ ). This is by the b such that C ⊂ C b definition of non-basic cells, and by the assumption that there is not cluster C ′ b Then by the definition of the promoted cells, there exists cluster C such that and u ∈ Vir(C). ′ u ∈ Bas(C ), ht(C ′ ) < ht(C ′′ ), and des(u) ∩ Bas(C ′ ) ⊂ Eff(C ′′ ). Since u ∈ NBas(C) ⊂ Eff(C) and by Lemma 5.3, we know that Eff(C) is a refinement of des(u) ∩ Bas(C ′ ). Hence, it remains to show ht(C ′ ) ≤ ht(C). Suppose for contradiction that ht(C ′ ) > ht(C), so ht(C) < ht(C ′ ) < ht(C ′′ ). By the definition of non-basic cells, we have that NBas(C ′ ) ∩ Bas(C ′ ) = ∅. Since u ∈ Bas(C ′ ), we know that u∈ / NBas(C ′ ). However, this implies that u ∈ / NBas(C), which contradicts with the assumption that u ∈ NBas(C). b such that u ∈ Vir(C) b and C ⊂ C, b then by Lemma 5.2, there is no If there exists cluster C ′ crossing component of C in F that intersects e. b such that u ∈ Vir(C) b and C ⊂ C. b By Lemma 5.7, there exists Otherwise, there is no cluster C ′ ′ ′ a cluster C such that u ∈ Bas(C ), ht(C ) ≤ ht(C) and Eff(C) is a refinement of des(u) ∩ Bas(C ′ ). We pick any one of such C ′ . Define e′ ∈ Dis(Bas(C ′ )) as the one induced by u in Bas(C ′ ). Since Bas defined in terms of F ′ satisfies the cell property, there is at most one crossing component of C ′ that intersects e′ . Lemma 5.8. e ⊂ e′ . Proof. Recall that e ∈ Dis(Eff(C)) is induced by u in Eff(C), and e′ ∈ Dis(Bas(C ′ )) is induced by u in Bas(C ′ ). Then we can write e = u\P and e′ = u\P ′ such that P ⊂ Eff(C) and P ′ ⊂ Bas(C ′ ). Since P ′ = des(u) ∩ Bas(C ′ ), and Eff(C) is a refinement of des(u) ∩ Bas(C ′ ), we know that P ′ ⊂ P . This implies that e ⊂ e′ . Since ht(C) ≥ ht(C ′ ), any crossing component of C is also a crossing component of C ′ . Moreover, Lemma 5.8 implies that e ⊂ e′ . Hence, if there are two crossing components A1 , A2 of C that intersect e, then A1 and A2 are also crossing components of C ′ and both of them intersect e′ . However, this cannot happen since Bas satisfies the cell property, and there is at most one crossing 18 component in C ′ that intersects e′ . Therefore, there is at most one crossing component of C that intersects e. 5.3 Dynamic Program Recall that the input of DP is an instance that has a q-sparse optimal net-respecting solution, where q ≤ O(s)O(k) · q0 , by Lemma 4.1 and Corollary 3.1. In the DP algorithm, O(k log n) random radii are independently sampled for each u ∈ Ni , i ∈ [L], and then a dynamic programming based algorithm is used to find a near optimal SFP solution over all hierarchical decompositions defined by the radii. In this section, we shall describe in detail the dynamic program and an algorithm that solves the dynamic program efficiently. For completeness, we shall also analyze the correctness of the dynamic program. We first describe the information needed to identify each cluster at each height. Information to Identify a Cluster. Each cluster is identified by the following information. 1. Height i and cluster center u ∈ Ni . This has L · O(nk ) combinations, recalling that |Ni | ≤ O(nk ). 2. For each j ≥ i, and v ∈ Nj such that d(u, v) ≤ O(sj ), the random radius chosen by (v, j). Observe that the space around B(u, O(si )) can be cut by net-points in the same or higher heights that are nearby with respect to their distance scales. As argued in [BGK12], the k k number of configurations that are relevant to (u, i) is at most O(k log n)L·O(1) = nO(1) , 1 where L = O(logs n) and s = (log n)Θ( k ) . 3. For each j > i, which cluster at height j (specified by the cluster center vj ∈ Nj ) contains O( k2 ) the current cluster at height i. This has O(1)kL = n log log n combinations. To define the dynamic program, we start by defining the entries. Entries of DP. We define entries as (C, (R, Y ), (BAS, NBAS), (g, P )). Define U := Dis(BAS ∪ NBAS). We define the following internal constraints for entries, where the parameters m, r are as defined in Lemma 5.6, and ρ is as defined in Lemma 5.5. • C is a cluster. • R is a subset of the m pre-defined portals, such that |R| ≤ r. This intends to denote the active portals. • Y ⊂ 2R is a partition of R. We intend to use it to record the subsets of portals that are connected inside C. • BAS and NBAS are collections of sub-clusters of C such that BAS ∩ NBAS = ∅ and |BAS ∪ NBAS| ≤ ρ, and the centers of the clusters in BAS∪NBAS are chosen from Can(C). Moreover, e ∈ BAS implies that any sibling cluster of e is in BAS ∪ NBAS. We intend to use this to record the basic cells and non-basic cells. • g is a mapping from U to 2Y . For some e ∈ U , we intend to use g(e) to denote the portals that e connects to inside C. • P ⊂ 2Y is a partition of Y , such that ∀e ∈ U , g(e) = Q implies that Q is a subset of a part in P . The intended use of P is to denote the portals that are to be connected outside C. We only consider the entries that satisfy the internal constraints. We capture the intended use of an entry formally as follows. Definition 5.14 (Compatibility). Suppose F is a graph on the metric space, and E is an entry. Let E := (C, (R, Y ), (BAS, NBAS), (g, P )). Define F ′ := F |C∪R . We say F is compatible to E, if F ′ satisfies the following. 1. A part y is in Y , if and only if F ′ connects all the portals in y. 2. BAS covers all components of F ′ that intersect R. 19 3. 4. 5. 6. For e ∈ U , g(e) is exactly the collection of subsets of Y that e is connected to by F ′ . Every terminal in C is visited by F ′ . Every isolated terminal of C is connected to at least one portal in R by F ′ . Every terminal pair that both lie in C is either in the same component of F ′ , or they are connected to y1 and y2 in Y by F ′ and {y1 , y2 } is a subset of a part in P . We bound the number of entries in the following lemma. k k Lemma 5.9 (Number of Entries). There are at most O(nO(1) ) · O(κmr)O(k) ·ρr number of entries. Moreover, for any fixed cluster C, the number of entries with C as the cluster is at most k O(κmr)O(k) ·ρr . (κ is defined as in Lemma 5.4.) Proof. Since R is a set of at most r portals chosen from m pre-defined portals, there are at most O(mr ) possibilities of R. Then after R is fixed, there are O(r r ) possibilities of Y , since Y is a partition of Y and |R| ≤ r. To count the number of BAS and NBAS, we count the union S := BAS ∪ NBAS of them, and then for any fixed S we count the number of ways to assign elements in S to BAS and NBAS. Since it is required that the centers of clusters in S are chosen from Can(C), to form S, we first choose at most ρ centers from Can(C). There are at most O(κρ ) possibilities for this, by Lemma 5.4. For each chosen center u that is of height iu , we count the number of configurations of the cluster Cu centered at u. Since C is already fixed, we only need to consider relevant radii for clusters of height less than ht(C) and at least iu . Since u ∈ Can(C), and for j ≥ iu there are O(1)k clusters of height-j can O(1)k ·logs ( 1 2) k γ 0 ≤ O(k log n)O(k) configurations affect u, we conclude that there are at most O(k log n) k for Cu . Since |S| ≤ ρ, there are at most O(k log n)O(k) ·ρ configurations for all clusters in S, for k any given the centers. Therefore, there are O(κ)O(k) ·ρ possibilities for S in total. Then we assign elements in S to one of BAS, NBAS, and there are at most 2|S| ≤ 2ρ number of them. In conclusion, k the number of possibilities for BAS and NBAS is at most O(κ)O(k) ·ρ . With S fixed, we count the number of possibilities of g. Since g is a mapping from U to 2Y , the number of such a mapping is at most O((2|Y | )|U | ) ≤ O(2ρ·r ). Finally, observe that P is a partition of Y , and |Y | ≤ r. This implies that P has at most O(r r ) possibilities. k Therefore, after fixing C, there are at most O(κmr)O(k) ·ρr possibilities for ((R, Y ), (BAS, NBAS), (g, P )). We then count the number of possibilities of C. Observe that there are O(n)O(k) centers for C. k For a fixed center, since the number of configurations is at most nO(1) , we conclude that there are k k at most O(nO(1) ) · O(κmr)O(k) ·ρr entries in total. After we define the entries, we shall (recursively) define the value that is associated with each entry. The intended value of an entry E is the weight of the minimum graph that is recursively compatible to E (see definition 5.18). Definition 5.15 (Child Entry Collection). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an entry. We say a collection of entries {(Ci , (Ri , Yi ), (BASi , NBASi ), (gi , Pi ))}i is a child entry collection of E, if {Ci }i is a partition of C with ht(Ci ) = ht(C) − 1 for all i. Definition 5.16 (Portal Graph). We say a graph G is a portal graph S of a collection of entries I := {(Ci , (Ri , Yi ), (BASi , NBASi ), (gi , Pi ))}i , if the vertex set of G is i Ri . Definition 5.17 (Consistency Checking). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an entry, and I := {(Ci , (Ri , Yi ), (BASi , NBASi ), (gi , Pi ))}i is a child entry collection of E and G is a portal graph of I. We say G and I are consistent with E, if all checks in the following procedure are passed. 20 S 1. Check if i (Ci ∪ Ri ) = C ∪ R. S S 2. We shall define Y ′ to be a partition of R′ := i Ri . Initialize Y ′ := i Yi , and whenever there are y1 , y2 ∈ Y ′ connected by G or y1 ∩ y2 6= ∅, replace them by the union of them. Check if Y ′ restricted to R is exactly Y . 3. For each e ∈ BAS, check if there exists i and e′ ∈ BASi , such that e′ = e or e′ is a child cluster of e. 4. For each e ∈ NBAS, check if S either there exists i and e′ ∈ BASi ∪ NBASi such that e = e′ , or all child clusters of e are in i (BASi ∪ NBASi ). 5. Define gi′ to be a mapping from Ui to 2Y , where gi′ (e) := {y ∩ R | y ∈ Y ′ ∧ ∃y ′ : (y ′ ∈ gi (e) ∧ y ∩ y ′ 6= ∅)}, for e ∈ Ui . Here gi′ (e) intends to mean the parts in Y that e connects to, which is defined by “extending” gi (e) with respect to G. For each i and u ∈ BASi , if there exists e ∈ Ui such that e ⊂ u and gi′ (e) 6= ∅, then check if there exists u′ ∈ BAS such that u = u′ or u is a child cluster of u′ . S S 6. Define a mapping g ′ from U to 2Y , where g′ (e) := i e′ ∈Ui :e′ ⊂e gi′ (e′ ), for e ∈ U . Check if g′ is exactly g. We observe that here we consider e′ ⊂ e only, and we shall see later why this is sufficient. 7. For each i, for each y1 , y2 ∈ Yi (y1 6= y2 ) such that y1 , y2 are in the same part of Pi , check if either there exists y ∈ Y ′ such that y1 ∪ y2 ⊂ y, or there exists y1′ , y2′ ∈ Y ′ such that y1′ 6= y2′ , y1 ⊂ y1′ , y2 ⊂ y2′ , y1′ ∩ R 6= ∅, y2′ ∩ R 6= ∅, and {y1′ ∩ R, y2′ ∩ R} is a subset of a part in P . This intends to check if the parts in Pi are connected by G, or the information in Pi ’s is passed to P. 8. For each terminal pair (a, b) such that a ∈ Ci and b ∈ Cj for i 6= j, suppose a ∈ ei and b ∈ ej for ei ∈ Ui and ej ∈ Uj . Check if gi (ei ) is connected by G to gj (ej ), or if gi′ (ei ) 6= ∅, gj′ (ej ) 6= ∅, gi′ (ei ) ∪ gj′ (ej ) is a subset of a part in P . This intends to check if (a, b) are already connected by G, or otherwise they will be connected outside C. 9. For each isolated terminal a in C, check if there exists i and e ∈ Ui , such that a ∈ e and gi′ (e) is non-empty. Definition 5.18 (Recursive Compatibility). Suppose E := (C, (R, Y ), (BAS, NBAS), (g, P )) is an entry, and F is some graph on the metric space. F is recursively compatible with E, if there exists a set S of entries with E ∈ S and with a unique entry in S that corresponds to each descendant cluster of C, such that the following requirements hold. • For each E ′ := (C ′ , (R′ , Y ′ ), (BAS′ , NBAS′ ), (g′ , P ′ )) in S, we require F ′ := F |C ′ ∪R′ be compatible to E ′ . • For each E ′ := (C ′ , (R′ , Y ′ ), (BAS′ , NBAS′ ), (g′ , P ′ )) in S, suppose the child entry collection that consisting of elements in S is I ′ , and define I ′ := {(Ct , (Rt , Yt ), (BASt , NBASt ), (gt , Pt ))}t . Define G′ := F |St Rt . (Note that G′ is a portal graph of I ′ .) We require I ′ and G′ be consistent with E ′ . Value of Entries. For any entry E := (C, (R, Y ), (BAS, NBAS), (g, P )), we shall define its value val(E). The height-0 clusters are corresponding to the base cases. In particular, for any C := {x} that is a height-0 cluster, we define entries with such C and with BAS := {C}, NBAS := ∅, R := C, Y := {R}, g(C) := Y , P := {Y } to be the base entries. All base entries have value 0. All other (non-base) entries with height-0 clusters have value ∞. We then define val(E) when ht(C) 6= 0. Define IE to be the set of tuples (I, G), such that I is a child entry collection of E and G is a portal graph of I, and I, G P are consistent. The value of E is defined as val(E) := min(I,G)∈IE {w(G) + val(I)}, where val(I) = E ′ ∈I val(E ′ ). As we shall see in Lemma 5.12, for any entry E, if val(E) 6= ∞, then there actually exists a graph that is recursively compatible to E with weight val(E). 21 Lemma 5.10 (Counting IE ). For any entry E, the number of possibilities of IE is at most O(k) 2 k O(k log n)O(s) · O(κmr)O(sk) ·ρr , where κ is defined as in Lemma 5.4. Proof. Define E := (C, (R, Y ), (BAS, NBAS), (g, P )). We first bound the number of possibilities of child entry collections I := {(Ci , (Ri , Yi ), (BASi , NBASi ), (gi , Pi ))}i of C. To define I, we start by defining {Ci }i . By packing property, there are at most O(s)k centers for the child clusters of C. For each center u of the child cluster, there are at most O(k log n) possible radii. Hence, there are k at most O(k log n)O(s) possibilities for {Ci }i . By Lemma 5.9, there are at most Z possibilities for ((Ri , Yi ), (BASi , NBASi ), (gi , Pi )) for any k k k fixed Ci , where Z := O(κmr)O(k) ·ρr . Therefore, there are at most O(k log n)O(s) · Z O(s) possibilities of I. For a fixed I, the vertex set of the portal graph G of I is fixed, and there are at most O(s)k · r vertices in G. Then the number of possibilities of G for a fixed I is at most the number of edge O(k) 2 sets, and it is at most 2O(s) ·r since there are at most (O(s)k · r)2 edges. O(k) 2 k k In conclusion, there are at most O(k log n)O(s) · Z O(s) · 2O(s) ·r possibilities of IE , which is O(k) 2 k at most O(k log n)O(s) · O(κmr)O(sk) ·ρr . Final Entry. The final entry is the entry with C being the root cluster, R, BAS, NBAS to be ∅, and Y, g, P being uniquely defined from R, BAS, NBAS = ∅. We use the value of the final entry as the output of DP. Evaluating The Final Entry Although we only care about the value of the final entry, it may be necessary to evaluate the value of other entries. We shall define a (recursive) algorithm in Definition 5.19 that takes an entry and returns the value of the input. To get the value of the final entry which is the output of DP, we invoke the algorithm with the final entry as the input. We note that the counting argument in Lemma 5.9 and Lemma 5.10 can both be naturally implemented as algorithms, with additional O(nO(k) ) factors in the running time compared with the corresponding counting bounds. We will make use of these implementations as subroutines in Definition 5.19. Moreover, the natural implementation of the consistency checking procedure in Definition 5.17 runs in time O(nO(k) ). Definition 5.19 (Algorithm for Evaluating Value of Entries). We define a recursive procedure that evaluates the value of an input entry E := (C, (R, Y ), (BAS, NBAS), (g, P )). • If ht(C) = 0, then the value of it is already defined, and we return its value. • If ht(C) > 0 and val(E) is already calculated, then we return the calculated value. • Otherwise, ht(C) > 0 and val(E) has not yet calculated. The following procedure is executed. 1. Set the default value for val(E) := ∞. 2. Calculate IE . 3. For each element (I, G) ∈ IE , use the consistency checking procedure defined in Definition 5.17 to check if I and G are consistent with E. If they are consistent, then recursively use this procedure to calculate val(I) + w(G), and update val(E) if val(E) + w(G) is smaller than val(E). 4. Finally, return val(E) as the output. Lemma 5.11 (Running Time). The running time for the algorithm defined in Definition 5.19 is √ k at most O(nO(1) ) · exp( log n · O( kǫ )O(k) ). Proof. Suppose the input is E := (C, (R, Y ), (BAS, NBAS), (g, P )). We observe that once the value for some entry is calculated, it would not be calculated again, and recalling the value takes constant time. Then we shall bound the time when val(E) is not yet calculated and ht(C) 6= 0. 22 Observe that for any given I with val(E ′ ) for all E ′ ∈ I known and a graph G such that (I, G) ∈ IE , evaluating val(I) + w(G) takes O(n)O(k) time. Therefore, combining with Lemma 5.9 k k and Lemma 5.10, there are at most O(nO(1) ) · Z entries, and it takes O(n)O(k) · O(k log n)O(s) · O(k) 2 O(κmr)O(sk) ·ρr to evaluate each. In conclusion, the time for evaluating all the entries is at O(k) 2 k k most O(nO(1) ) · O(k log n)O(s) · O(κmr)O(sk) ·ρr . Substituting Parameters. Recall that we consider q ≤ O(s)O(k) · q0 . Observe that γ10 := 3 2 O(k) and ⌈ γ̂10 ⌉s ≤ O( ksǫ L ), and γ11 := ⌊ γ̂11 ⌋s ≤ O( sǫ ). Substituting γ0 and γ1 , we have κ ≤ O( ksL ǫ ) O(k) . Moreover, ρ ≤ O( sk ǫ ) k s sk skL k r := O(1)k · q logs log n + O( )k + O( )k ≤ O( )O(k) , m ≤ O( ) . ǫ ǫ ǫ ǫ c k log n By definition, s := (log n) k , L := O(logs n) = O( c log log n ). Therefore, the running time is at most k k O(k) 2 O(nO(1) ) · O(k log n)O(s) · O(κmr)O(sk) ·ρr ksL O( sk )O(k) k k ≤ O(nO(1) ) · O(k log n)O(s) · O( ) ǫ ǫ k log n k k ) ≤ O(nO(1) ) · exp(O(s)O(k) · O( )O(k) · log ǫ ǫ k k ≤ O(nO(1) ) · exp(O( )O(k) · O(log n)O(c) · log log n). ǫ √ By choosing constant c to be sufficiently small so that O(log n)O(c) · log log n ≤ O( log n), we √ k conclude that the running time is at most O(nO(1) ) · exp( log n · O( kǫ )O(k) ). Lemma 5.12 (Characterizing the Value of Entries). For each entry E := (C, (R, Y ), (BAS, NBAS), (g, P )) with val(E) 6= ∞, val(E) is the weight of the minimum weight graph that is recursively compatible to the entry and uses points in C ∪ R only. Proof. For the clusters of height 0, the Lemma holds trivially. Assuming the Lemma holds for all entries with the clusters of height i − 1, we prove the Lemma for an entry E with C of height i centered at u ∈ Ni , where i ≥ 1. We shall first show that val(E) is the weight of some graph that is recursively compatible to the entry and uses points in C ∪ R only. Then we shall show that the value is minimum. Feasibility. Suppose (I, G) := arg min(I ′ ,G′ )∈IE {val(I ′ ) + w(G′ )}. Define I = {Ej }j , where Ej := (Cj , (Rj , Yj ), (BASj , NBASj ), (gj , Pj )). Since val(E) 6= ∞, we have val(I ′ ) 6= ∞. For Ej ∈ I, by assumption, there exists a graph that is recursively compatible to Ej and uses points in Cj ∪ Rj only, and we denote it as Fj . We define a graph F that is the union of Fj for all j, and G. Then w(F ) = val(I) + w(G). We shall show that F is recursively compatible to E. Since (I, G) ∈ IE , I and G are consistent with E. Since Fj is recursively compatible to Ej for all j, it remains to verify F is compatible to E. When we say “consistency checking procedure”, we refer to Definition 5.17. • F uses points in C ∩ R only. This is by definition. • A part y is in Y , if and only if F connects all the portals in the part y. This is by the step 2 of the consistency checking procedure. • BAS covers all components of F that intersect R. This is by step 5 of the consistency checking procedure. 23 • For e ∈ U , the collection of subsets of Y that e is connected to by F is exactly g(e). We note that step 3, 4 of the consistency checking procedure, together with the internal constraint that S e′ ∈ BASj implies any sibling cluster of e′ is in BASj ∪ NBASj for all j. This implies that j (BASj ∪ NBASj ) is a refinement of BAS ∪ NBAS. Then, for each j, for each e′ ∈ Uj , and for each e ∈ U , either e′ ⊂ e or e′ ∩ e = ∅. Therefore, step 6 is sufficient to ensure this item. (If e′ is not a subset of e but e′ ∩ e 6= ∅, then the gj mappings in the sub-entries have not sufficient information to determine the portals that e′ ∩ e is connected to.) • Every terminal in C ∪ R is visited by F . This is by the construction of F , and by Fj is recursively compatible to Ej for all j. • Every isolated terminal of C is connected to at least one portal in R by F . This is by step 9 of the consistency checking procedure. • Every terminal pair that both lie in C is either in the same component of F , or they are connected to y1 and y2 in Y by F and {y1 , y2 } is a subset of a part in P . This is by step 7, 8 of the consistency checking procedure, and by Fj is recursively compatible to Ej for all j. This implies that F is recursively compatible to E. Optimality. Then we shall show that val(E) is minimum. Suppose not. Define l as the weight of the minimum weight graph that is recursively compatible to E and uses points in C ∪ R only. Define F ′ to be the corresponding graph recursively compatible to E with weight l. Since F ′ is recursively compatible to E, there exists I ′ := {Et := (Ct , (Rt , Yt ), (BASt , NBASt ), (gt , Pt ))}t and a portal graph G′ of I ′ that are consistent with E. Moreover, there exists a graph Ft that is recursively compatible to Et , for all t. P ′ ′ ′ We note that P (I ′ , G′ ) ⊂ IEP . Therefore, t w(Ft ) + w(G ) = l < val(E) ≤ val(I ) + w(G ). This implies that t w(Ft ) < E ′ ∈I ′ val(E ′ ), and hence there exists t such that w(Ft ) < val(Et ). However, we know that Ft is recursively compatible to Et , and by assumption, val(Et ) ≤ w(Ft ). This is a contradiction. Corollary 5.1. There exists a feasible solution to SFP whose weight is the value of the final entry. Lemma 5.13 (Good Solution is Recursively Compatible). Suppose for each i ∈ [L] and u ∈ Ni , O(k log n) radii are fixed. Suppose F is an (m, r)-light solution such that Eff satisfies the cell property in terms of F under one of the hierarchical decompositions defined by the radii. Then the value of the final entry is at most w(F ). Proof. We shall show that F is recursively compatible to the final entry, and then Lemma 5.12 implies that the value of the final entry is at most w(F ). Suppose we fix a hierarchical decomposition induced from the given radii, such that F is (m, r)light and Eff satisfies the cell property in terms of F . For each cluster C in the decomposition, we define FC := FC∪R , define an entry EC := (C, (RC , YC ), (BASC , NBASC ), (gC , PC )) as follows, where R is the set of active portals for C. • RC := R. • YC contains a part y, if and only if portals in y is connected by FC . • BASC := Bas(C), NBASC := NBas(C). • For each e ∈ UC , let gC (e) := Q, where Q is the collection of parts in YC that e is connected to by FC . • Define PC to be any one that satisfies 1. for each e ∈ UC , gC (e) = Q implies Q is a subset of PC ; 2. for each terminal pair (a, b) that both lie in C, if they are not connected by FC then the subsets of portals that a and b are connected by FC are in a same part of PC . 24 The internal constraints for an entry is satisfied, from the definition of the cells, the fact that Eff satisfies the cell property, Lemma 5.4 and Lemma 5.5. Then we (uniquely) define IC := {(Ci , (Ri , Yi ), (BASi , NBASi ), (gi , Pi ))}i as the child collection of EC , and define GC := F |Si Ri as the portal graph of IC . We then check that IC and GC are consistent with EC . Step 1, 2, 7, 8, 9 are immediate. Step 3, 4, 5 follow from the definition of the basic cells and non-basic cells. Inside step 6, we observe that g′ (e) is evaluated by looking at e′ ⊂ e only (instead of considering all e′ ∈ Ui ), for e′ ∈ Ui for some i, and e ∈ U . However, this is indeed sufficient, since Lemma 5.3 asserts that for any e ∈ U , e′ ∈ Ui for any i, either e′ ⊂ e′ or e ∩ e′ = ∅. It remains to check the following for EC , for each cluster C. • A part y ∈ YC , if and only if FC connects all the portals in the part y. This is by definition. • BAS covers all components of FC that intersect RC . This is by definition. • For e ∈ UC , the collection of subsets of YC that e is connected to by FC is exactly gC (e). This is by definition. • Every terminal in C ∪ RC is visited by FC . This is by the feasibility of F . • Every isolated terminal of C is connected to at least one portal in RC by FC . This is by the feasibility of F . • Every terminal pair that both lie in C is either in the same component of FC , or they are connected to y1 and y2 in YC by FC and {y1 , y2 } is a subset of a part in PC . This is by definition. This finishes the proof. Combining Lemma 5.6, Lemma 5.13, Corollary 5.1 and Lemma 5.11, we conclude a PTAS for sparse SFP instances. Corollary 5.2 (PTAS for Sparse SFP Instances). For an instance of SFP that has a q-sparse optimal net-respecting solution, algorithm DP returns a (1 + ǫ) solution with constant probability, √ k running in time O(nO(1) ) · exp( log n · O( kǫ )O(k) ), for q ≤ O(s)O(k) · q0 . References [ABN06] Ittai Abraham, Yair Bartal, and Ofer Neiman. Advances in metric embedding theory. In STOC, pages 271–286. ACM, 2006. [AKR95] Ajit Agrawal, Philip N. Klein, and R. Ravi. When trees collide: An approximation algorithm for the generalized steiner problem on networks. SIAM J. Comput., 24(3):440– 456, 1995. [Aro98] Sanjeev Arora. Polynomial time approximation schemes for euclidean traveling salesman and other geometric problems. J. ACM, 45(5):753–782, 1998. [Aro02] S. Arora. Approximation algorithms for geometric TSP. In The traveling salesman problem and its variations, volume 12 of Comb. Optim., pages 207–221. Kluwer Acad. Publ., Dordrecht, 2002. [Ass83] P. Assouad. Plongements lipschitziens dans Rn . Bull. Soc. Math. France, 111(4):429– 448, 1983. [BDHM16] MohammadHossein Bateni, Erik D. Demaine, MohammadTaghi Hajiaghayi, and Dániel Marx. A PTAS for planar group steiner tree via spanner bootstrapping and prize collecting. In STOC, pages 570–583. ACM, 2016. 25 [BGK12] Yair Bartal, Lee-Ad Gottlieb, and Robert Krauthgamer. The traveling salesman problem: low-dimensionality implies a polynomial time approximation scheme. In STOC, pages 663–672. ACM, 2012. [BGRS10] Jaroslaw Byrka, Fabrizio Grandoni, Thomas Rothvoß, and Laura Sanità. An improved lp-based approximation for steiner tree. In STOC, pages 583–592. ACM, 2010. [BH12] MohammadHossein Bateni and MohammadTaghi Hajiaghayi. collecting steiner forest. Algorithmica, 62(3-4):906–929, 2012. [BHM11] MohammadHossein Bateni, Mohammad Taghi Hajiaghayi, and Dániel Marx. Approximation schemes for steiner forest on planar graphs and graphs of bounded treewidth. J. ACM, 58(5):21, 2011. [BKM08] Glencora Borradaile, Philip N. Klein, and Claire Mathieu. A polynomial-time approximation scheme for euclidean steiner forest. In FOCS, pages 115–124. IEEE Computer Society, 2008. [CC08] Miroslav Chlebı́k and Janka Chlebı́ková. The steiner tree problem on graphs: Inapproximability results. Theor. Comput. Sci., 406(3):207–214, 2008. [CJ16] T.-H. Hubert Chan and Shaofeng H.-C. Jiang. Reducing curse of dimensionality: Improved PTAS for TSP (with neighborhoods) in doubling metrics. In SODA, pages 754–765. SIAM, 2016. [DHC85] DZ Du, FK Hwang, and SC Chao. Steiner minimal tree for points on a circle. Proceedings of the American Mathematical Society, 95(4):613–618, 1985. [DHK14] Erik D. Demaine, Mohammad Taghi Hajiaghayi, and Philip N. Klein. Node-weighted steiner tree and group steiner tree in planar graphs. ACM Trans. Algorithms, 10(3):13:1–13:20, 2014. [DHW87] Ding-Zhu Du, Frank K. Hwang, and JF Weng. Steiner minimal trees for regular polygons. Discrete & Computational Geometry, 2(1):65–84, 1987. [DL97] M. M. Deza and M. Laurent. Geometry of cuts and metrics, volume 15 of Algorithms and Combinatorics. Springer-Verlag, Berlin, 1997. [GK15] Anupam Gupta and Amit Kumar. Greedy algorithms for steiner forest. In STOC, pages 871–878. ACM, 2015. [GKL03] Anupam Gupta, Robert Krauthgamer, and James R. Lee. Bounded geometries, fractals, and low-distortion embeddings. In FOCS, pages 534–543. IEEE Computer Society, 2003. [GKR00] Naveen Garg, Goran Konjevod, and R. Ravi. A polylogarithmic approximation algorithm for the group steiner tree problem. J. Algorithms, 37(1):66–84, 2000. [GW95] Michel X. Goemans and David P. Williamson. A general approximation technique for constrained forest problems. SIAM J. Comput., 24(2):296–317, 1995. [HK03] Eran Halperin and Robert Krauthgamer. Polylogarithmic inapproximability. In STOC, pages 585–594. ACM, 2003. 26 Euclidean prize- [HK13] Mathias Hauptmann and Marek Karpiński. A compendium on steiner tree problems. Inst. für Informatik, 2013. [Mat02] J. Matoušek. Lectures on discrete geometry, volume 212 of Graduate Texts in Mathematics. Springer-Verlag, New York, 2002. [Tal04] Kunal Talwar. Bypassing the embedding: algorithms for low dimensional metrics. In STOC, pages 281–290. ACM, 2004. 27
8cs.DS
To be submitted as a conference paper at ICLR 2018 C OUPLED E NSEMBLES OF N EURAL N ETWORKS Anuvabh Dutt Univ. Grenoble Alpes, CNRS, Grenoble-INP, LIG, F-38000 Grenoble France [email protected] arXiv:1709.06053v1 [cs.CV] 18 Sep 2017 Denis Pellerin Univ. Grenoble Alpes, CNRS, Grenoble-INP, GIPSA-Lab, F-38000 Grenoble France [email protected] Georges Quénot Univ. Grenoble Alpes, CNRS, Grenoble-INP, LIG, F-38000 Grenoble France [email protected] A BSTRACT We investigate in this paper the architecture of deep convolutional networks. Building on existing state of the art models, we propose a reconfiguration of the model parameters into several parallel branches at the global network level, with each branch being a standalone CNN. We show that this arrangement is an efficient way to significantly reduce the number of parameters without losing performance or to significantly improve the performance with the same level of performance. The use of branches brings an additional form of regularization. In addition to the split into parallel branches, we propose a tighter coupling of these branches by placing the “fuse (averaging) layer” before the Log-Likelihood and SoftMax layers during training. This gives another significant performance improvement, the tighter coupling favouring the learning of better representations, even at the level of the individual branches. We refer to this branched architecture as “coupled ensembles”. The approach is very generic and can be applied with almost any DCNN architecture. With coupled ensembles of DenseNet-BC and parameter budget of 25M, we obtain error rates of 2.92%, 15.68% and 1.50% respectively on CIFAR-10, CIFAR-100 and SVHN tasks. For the same budget, DenseNet-BC has error rate of 3.46%, 17.18%, and 1.8% respectively. With ensembles of coupled ensembles, of DenseNet-BC networks, with 50M total parameters, we obtain error rates of 2.72%, 15.13% and 1.42% respectively on these tasks. 1 I NTRODUCTION The design of early convolutional architectures (CNN) involved choices of hyper-parameters such as: filter size, number of filters at each layer, and padding (Lecun et al., 1998; Krizhevsky et al., 2012). Since the introduction of the VGGNet (Simonyan and Zisserman, 2014) the design has moved towards following a template: fixed filter size of 3 × 3 and N features maps, down-sample to half the input resolution only by the use of either maxpool or strided convolutions (Springenberg et al., 2015), and double the number the computed feature maps following each down-sampling operation. This philosophy is used by state of the art models such as ResNet (He et al., 2016b) and DenseNet (Huang et al., 2017). The last two architectures extended the template to include the use of “skip-connections” between non-contiguous layers. Our work extends this template by adding another element, which we refer to as “coupled ensembling”. In this set-up, the network is decomposed into several branches, each branch being functionally similar to a complete CNN (and able to fully do the classification task alone, generally with a lower performance). The proposed template achieves performance comparable to state of the art models with a significantly lower parameter count. The proposed modification 1 To be submitted as a conference paper at ICLR 2018 is simple to implement and we provide a wrapper to compose different standard architectures at: https://github.com/vabh/coupled_ensembles. In this paper, we make the following contributions: (i) we show that given a parameter budjet, splitting a large network into an ensemble of smaller parallel branches of the same type, and jointly training them performs better or at par; (ii) when a final SoftMax (SM) layer is used during the prediction step, we show that ensemble fusion works better when averaging is done before this layer than when it is done after; (iii) when a final Log-Likelihood (LL) layer is used during the training step, we show that ensemble fusion of branches works better when the fusion is done before this layer than when it is done after; (iv) combining all these elements, we significantly improved the performance and/or significantly reduce the parameter count of state-of-the-art neural network architectures on CIFAR and SVHN data sets. (v) We show that such multi-branch networks can be further ensembled at a higher level still producing a significant performance gain. This paper is organised as follows: in section 2, we discuss related work; in section 3, we introduce the concept of coupled ensembles and the motivation behind the idea; in section 4, we present the evaluation of the proposed approach and compare it with the state of the art; and we conclude and discuss future work in section 5. 2 R ELATED WORK Multi-column architectures. The network architecture that we propose has strong similarities with Cireşan’s Neural Networks Committees (Cireşan et al., 2011) and Multi-Column Deep Neural Network (MCDNN) (Cireşan et al., 2012), which are a type of ensemble of networks where the “committee members” or “DNN columns” correspond to our basic block instances (or branches). However, our coupled ensemble networks differ as following: (i) we train a single model which is composed of sub-networks, while they train each member or column separately. (ii) we consider a coupled ensemble of smaller networks for improving the performance of a network, given a budget of parameters for the entire model. This is contrary to improving it by utilising multiple models of fixed size and therefore multiplying the overall size (though both are not exclusive); (iii) we consider placing the averaging (AVG) layer, not only completely at the end of the network but also before the Log-Likelihood (LL) layer during training and before the Soft-Max (SM) layer during training and/or during prediction; (iv) we used the same preprocessing for all branches while they considered different preprocessing (data augmentation) blocks for different members or different subsets of columns; we consider doing this also in the future. Multi-branch architectures. Multi-branch architectures have been very successful in several vision applications (He et al., 2016a; Szegedy et al., 2015). Recently, modifications have been proposed (Xie et al., 2017; Chollet, 2017) for these architectures using the concept of “grouped convolutions”, in order to factorize spatial feature extraction and channel features. These modifications additionally advocate the use of template building blocks stacked together to form the complete model. This modification is at the level of the building blocks of their corresponding base architectures: ResNet and Inception respectively. In contrast we propose a generic modification of the structure of the CNN at the global model level. This includes a template in which the specific architecture of a “basic block” is specified, and then this “basic block” is replicated as parallel branches to form the final composite model. To further improve the performance of such architectures, Shake-Shake regularization (Gastaldi, 2017) proposes a stochastic mixture of each of the branches and has achieved good results on the CIFAR datasets. However, the number of epochs required for convergence is much higher compared to the base model. Additionally, the technique seems to depend on the batch size. In contrast, we apply our method using the exact same hyper-parameters as used in the underlying CNN. Zhao et al. (2016) investigate the usage of parallel paths in a ResNet, connecting layers to allow information exchange between the paths. However this requires modification at a local level of each of the residual blocks. In contrast, our method is a generic rearrangement of a given architecture’s parameters, which does not introduce additional choices. Additionally, we empirically confirm that our proposed configuration leads to an efficient usage of parameters. Neural network ensembles. Ensembling is a reliable technique to increase the performance of models for a task. Due to the presence of several local minima, multiple trainings of the exact 2 To be submitted as a conference paper at ICLR 2018 same neural network architecture can reach a different distribution of errors on a per-class basis. Hence, combining their outputs lead to improved performance on the overall task. This was observed very early (Hansen and Salamon, 1990) and is now commonly used for obtaining top results in classification challenges, despite the increase in training and prediction cost. Our proposed model architecture is not an ensemble of independent networks given that we have a single model made up of parallel branches that is trained. This is similar in spirit to the residual block in ResNet and ResNeXt, and to the inception module in Inception but is done at the full network level. We would like to emphasize here that “arranging” a given budget of parameters into parallel branches leads to an increase in performance (as shown in tables 1, 2 and 3). Additionally, the classical ensembling approach can still be applied for the fusion of independently trained coupled ensemble networks where it produces a significant performance improvement (as shown in table 4) 3 C OUPLED ENSEMBLES T ERMINOLOGY For the following discussion, we define some terms: • Branch: the proposed model comprises several branches. Each branch takes as input a data point and produces a score vector corresponding to the target classes. Current design of CNNs are referred to as single-branch. The number of branches is denoted by e. • Basic block: the model architecture used to form a branch. In our experiments, we use DenseNetBC and ResNet with pre-activation as basic blocks. • Fuse Layer: the operation used to combine each of the parallel branches which make up our model. In our experiments, each of the branches are combined by taking the average of each of their predicted log probabilities over the target classes. Section 4.4 explores different choices of operations for the fuse layer. We consider a classification task in which individual samples are always associated to exactly one class, labelled from a finite set. This is the case for CIFAR (Krizhevsky and Hinton, 2009), SVHN (Netzer et al., 2011) and ILSVRC (Russakovsky et al., 2015) tasks. In theory, this should work for other tasks as well (for example, segmentation, object detection, etc.). We consider neural network models whose last layer outputs a score vector of the same dimension as the number of target classes. This is usually implemented as a linear layer and referred to as a fully connected (FC) layer. This layer can be followed by a SoftMax (SM) layer to produce a probability distribution over the target classes. During training, this is followed by a loss layer, for example, negative log-likelihood (LL). This is the case for all recent network architectures for image classification1 (Krizhevsky et al., 2012; Simonyan and Zisserman, 2014; Szegedy et al., 2015; He et al., 2016a; Xie et al., 2017; Huang et al., 2016; Zagoruyko and Komodakis, 2016; Huang et al., 2017). The differences among them is related to what is present before the last FC layer. We are agnostic to this internal setup (however complex it may or may not be) because the resulting “basic block” always takes an image as input and produces a vector of N values (one for each target class) as output, parametrized by a tensor W . In the case of ensemble predictions, fusion is usually done by computing the individual predictions separately for e model instances and then averaging them. Each of the instances are trained seperately. This is functionally equivalent to predicting with a “super-network” including the e instances as parallel branches with a final averaging (AVG) layer on top. Such super-networks are generally not implemented because the branch instances often already correspond to the maximum memory capacity of GPUs. The remaining AVG layer operation can be implemented separately. Alternatively, it is possible to place the averaging layer just after the last FC layer of the basic block instances and before the SM layer, which is then “factorized”. 1 Though all these networks actually do have a FC layer before the SM one, the last layer need not be a linear layer, as long as it produces one value for each target label. We will refer to the output of each basic block as “FC”. Similarly, the proposed method may be easily adapted to multi-label classification (i.e. considering nonexclusive classes) by simply replacing the SM (and possibly also the LL) layer(s) by any variant(s) appropriate for multi-label classification. Again, we will refer to their output as “SM” and “LL”. 3 To be submitted as a conference paper at ICLR 2018 In our setup, a model is composed of parallel branches and each branch produces a score vector for the target categories. We explore three options to combine these vectors during training: • Activation (FC) average. • Probability (SM) average (in practice we do an arithmetic average of log-probabilities). • Log Likelihood (LL) average (average of the loss of each branch). We investigate these options in section 4.4. Note that for inference, averaging the FC layer activations is equivalent to averaging the LogSoftMax values (or to a geometric average of the softmax values, see section B of supplementary material). This transformation of having multiple branches, and combining the branch activations by averaging the log probabilites that they predict for the target categories, leads to a performance improvement, with a lower parameter count, in all our experiments (see section 4). The parameter vector W of this composite branched model is the concatenation of the parameter vectors We of the e basic blocks with 1 ≤ i ≤ e. All parameters are in the “basic blocks” as the “fuse layer” does not contain any parameters. The e model instances do not really need to share the same architecture. Three training versions may be considered depending upon whether the “fuse layer” is placed after the FC, after the SM or after the LL layer. All the instances are trained simultaneously trough a single loss function and the W parameter vector is obtained in a single training phase. In practice, in the first and the third versions, the SM and LL layers are replaced by a single Cross-Entropy (CE) layer as this is numerically more stable. Similarly, in the second and intermediate case, a LogSoftMax (LSM) layer is used instead of the regular SM layer before the arithmetic averaging (while removing the Log operation in the LL layer). This is equivalent to replacing the arithmetic average by a geometric one with the regular SM and LL layers. The training can be done in four different ways: the three coupled ways correspoding to the “fuse layer” plus the the one in which all basic blocks are trained separately in e independent trainings. Regardless of how the training of the basic blocks has been performed, it is possible to use any of the two coupled ways for making ‘coupled prediction’ and it is also possible to use the individual basic blocks for making e ‘individual predictions’. Not all of these combinations are expected to be consistent or equally efficient but all can be implemented and evaluated as shown in section 4.4. 4 4.1 E XPERIMENTS DATASETS We evaluate our proposed architecture on the CIFAR (Krizhevsky and Hinton, 2009) and SVHN (Netzer et al., 2011) data sets. CIFAR-10 and CIFAR-100 consist each of 50,000 training images and 10,000 test images, distributed into 10 and 100 categories respectively. SVHN consists of 73,257 training images, 531,131 “easy” training images (we use both for training) and 26,032 testing images, distributed into 10 categories. Each image from these datasets is of size 32×32 pixels. 4.2 E XPERIMENTAL SET- UP All hyper parameters are set according to the original descriptions of the “basic block” that is used. This may not be the optimal setting in our case (especially the learning rate decay schedule) but we do not alter them, so as to not introduce any bias in comparisons. For CIFAR-10, CIFAR-100 and SVHN, the input image is normalised by subtracting by the mean image and dividing by the standard deviation. During training on CIFAR datasets, standard data augmentation is used, which comprises random horizontal flips and random crops. For SVHN, no data augmentation is used. However, a dropout ratio of 0.2 is applied in the case of DenseNet when training on SVHN. Testing is done after normalising the input in the same way as during training. All error rates are given in percentages and correspond to an average computed on the last 10 epochs for CIFAR and on the last 4 epochs for SVHN. This measure is more conservative than the one used by the DenseNet authors (see supplementary material, section D). For DenseNet-BC, Amos and Kolter (2017)’s PyTorch implementation has been used. All execution times were measured using a 4 To be submitted as a conference paper at ICLR 2018 single NVIDIA 1080Ti GPU with the optimal micro-batch2 . Experiments in section 4.3, 4.4 are done on the CIFAR-100 data set with the “basic block” being DenseNet-BC, depth L = 100, growth rate k = 12. For experiments in Section 4.5, we consider this same configuration (with a single branch) as our baseline reference point. 4.3 C OMPARISON WITH SINGLE BRANCH AND INDEPENDENT ENSEMBLES A natural point of comparison of the proposed branched architecture is with an ensemble of independent models. Rows 2 (coupled training with SM averaging) and 4 (no averaging) in Table 1 present the results of these two cases respectively. Row 4 shows the error rate obtained from averaging the predictions of 4 identical models, each of which were trained separately. We see that even though the total number of trainable parameters involved is exactly the same, a jointly trained branched configuration gives a much lower test error (17.61 vs. 18.42 with 4 predictions fused at the FC level in both cases). The next point of comparison is with a single branch model comprising a similar number of parameters as the multi branch configuration. The choice of single branch models has been done by: increasing k while keeping L constant, by increasing both k and L, or by increasing L while keeping k constant. The last three rows of Table 1 show that the error from the multi branch model is considerably lower, as compared to a single branch model (17.61 vs. 20.01, with 4 predictions fused at the FC level). These observations show that the arranging a given budget of parameters into parallel branches is efficient in terms of parameters, as compared to having a large single branch or multiple independent trainings. In Section 4.5 we analyse the relation between the number of branches and the model performance. 4.4 C HOICE OF F USE L AYER OPERATION In this section, we compare the performance of our proposed branched model for different choices for the positioning of the “fuse layer” (see section 3). Experiments are carried out to evaluate the best training and prediction fusion combinations. We consider two branched models with e = 2, e = 4, trained in the following conditions: training with fusion after the LL layer, after the SM layer, or after the FC layer. Table 1 shows the performance of the differently trained systems for different prediction configurations: individual average performance of the trained instances (without fusion) and performance of the ensemble system with fusion after the SM layer or after the FC layer. Note that this table includes models with parameters obtained using different training methods . We can make the following observations: • The Avg. FC training with separate predictions (in red) does not work well. This is expected since a similar FC average may be reached with quite unrelated FC instances. The Avg. FC training with Avg. SM prediction (in red) works a bit better but is still not good because the non-linearity of the SM layer distorts the FC average. Indeed, the consistent Avg. FC training with Avg. FC prediction works quite well though it does not yield the best performance. • The Avg. FC prediction works at least as well and often significantly better than the Avg. SM prediction whatever the training choice is. This can be explained by the fact that the SM layer compresses values for probabilities close to 0 and 1 while the values remain more spread and transmit more information at the FC layer, even for different training conditions. • The average error rate of each of the “basic blocks” trained jointly in coupled ensembles with SM fusion is significantly lower than the error rate of the individual instances trained separately. This indicates that the coupling not only forces them to learn complementary features as a group but also to better learn individually. Averaging the log probabilities forces the network to continuously update all branches so as to be consistent with each other. This provides a stronger gradient signal. Additionally, the training loss remains higher compared to single branch models, serving as a regularizer. The error gradient that is back-propagated from the fuse layer is the same for all 2 The micro-bath denotes the number of images samples that were processed in one batch on the GPU so as to have the best throughput. In practice, minibatch (for parameter update) = n×microbatch 5 To be submitted as a conference paper at ICLR 2018 Table 1: Coupled Ensembles of DenseNet-BCs versus a single model of comparable complexity and study of training / prediction fusion combinations. Top: e = 2, bottom: e = 4. Performance is given as the top-1 error rate (mean±standard deviation for the individual branches) on the CIFAR-100 data set with standard data augmentation. Columns “L” and “k” indicate the DenseNet-BC hyperparameter values of the “basic block”. Column “e” indicates the number of branches. Column “Avg.” indicates the type of “fuse layer” during training: “none” for separate trainings (classical ensembling), “FC”, “SM” and “LL” for fusion (arithmetic averaging) after the FC, SM and LL layers respectively (not applicable for e = 1). Column “Individual” gives the performance for the individual “basic blocks” evaluated separately; Columns “FC” and “SM” give the performance with fusion (arithmetic averaging) during prediction done after the FC and SM layers respectively. The last three columns give the total number of parameters of the model, the duration of a training iteration (50,000 images) and the prediction time per test image (in batch mode). (*) See supplementary material, section D; The average and standard deviations are computed here for the independent trainings (comprising 2 and 4 models respectively.). L 100 100 100 100 100 124 148 k 12 12 12 12 17 14 12 e 2 2 2 2 1 1 1 Avg. FC SM LL none n/a n/a n/a Individual 52.68±22.95 22.17±0.32 22.78±0.08 23.13±0.15(*) 21.22±0.12 21.75±0.10 20.80±0.06 FC 22.25 19.06 19.33 20.44 n/a n/a n/a SM 28.78 19.43 19.91 20.44 n/a n/a n/a Params 1.60M 1.60M 1.60M 1.60M 1.57M 1.55M 1.56M Epoch(s) 174 174 174 171 121 135 159 Test(ms) 0.98 0.98 0.98 0.98 0.67 0.77 0.90 L 100 100 100 100 100 154 220 k 12 12 12 12 25 17 12 e 4 4 4 4 1 1 1 Avg. FC SM LL none n/a n/a n/a Individual 74.36±26.28 22.29±0.11 22.83±0.18 23.13±0.09(*) 20.61±0.01 20.02±0.10 20.01±0.12 FC 22.55 17.61 18.21 18.42 n/a n/a n/a SM 31.92 17.68 18.92 18.85 n/a n/a n/a Params 3.20M 3.20M 3.20M 3.20M 3.34M 3.29M 3.15M Epoch(s) 402 402 402 341 164 245 326 Test(ms) 2.00 2.00 2.00 2.00 0.8 1.3 1.5 branches, and this gradient depends on the combined predictions. This means that at every step all branches act complementary to the other branches’ weight updates. • All ensemble combinations except those based on the Avg. FC training do significantly better than a single network of comparable size and same depth. For a global network size of about 1.6M (resp. 3.2M) parameters, the error rate decreases from 20.80 (resp. 20.01) for the best single instance combination to 19.06 (−1.74) with two instances (resp. 17.61 (−2.40) with four instances). • The best combination seems to be Avg. SM for training with Avg. FC for prediction. • The branched model with e = 4 and Avg. SM for the “fuse layer” has the same performance as a DenseNet-BC (L = 250, k = 24) model (Huang et al., 2017), which has about 5 times more parameters (15.3M versus 3.2M). All the following experiments have Avg. SM for the training “fuse layer’ in the branched models. 4.5 C HOICE OF THE NUMBER OF BRANCHES In this section, we investigate the optimal number of branches e for a given model parameter budget. We evaluate on CIFAR-100, with DenseNet-BC as the “basic block”, and parameter budget equal to 0.8M parameters (this is the number of parameters in DenseNet-BC (L = 100, k = 12)). Indeed, the optimal number of instances e is likely to depend upon the network architecture, upon the parameter budget and upon the data set but this gives at least one reference. This was investigated again with larger models, and the results are in table 3 (last four rows). 6 To be submitted as a conference paper at ICLR 2018 Table 2: Different number of branches, e for a fixed parameter count. The models are trained on CIFAR-100 with standard data augmentation. See table 1 caption for the meaning of row and column labels. When applicable (e > 1), “fuse layer” is SM Avg. (*) Average and standard deviation on 10 trials with different seeds; Huang et al. (2017) reports 22.27, see supplementary material, section D. L 100 76 88 94 100 70 82 88 94 64 70 58 64 58 64 k 12 10 9 8 8 9 8 7 7 8 8 7 7 6 6 e 1 2 2 2 2 3 3 3 3 4 4 6 6 8 8 Individual 22.87±0.17(*) 25.58±0.20 25.15±0.31 25.72±0.20 25.42±0.20 26.67±0.40 26.47±0.17 26.92±0.41 26.50±0.12 28.58±0.59 27.65±0.48 30.11±0.53 30.65±0.62 32.15±0.00 31.52±0.38 FC n/a 21.66 21.87 21.95 21.87 21.10 21.25 22.09 21.95 22.44 21.50 23.87 23.08 25.95 24.42 SM n/a 22.17 22.19 22.22 22.07 21.24 21.46 22.49 22.35 22.58 22.12 24.22 23.36 25.70 24.69 Params 800k 720k 747k 666k 737k 773k 800k 698k 775k 719k 828k 718k 840k 722k 843k Epoch(s) 86 103 119 115 126 129 141 148 160 142 156 179 198 219 250 Test(ms) 0.51 0.63 0.71 0.69 0.75 0.77 0.85 0.92 0.98 0.88 0.94 1.08 1.20 1.35 1.51 Table 2 shows the performance for different configurations of branches e, depth L, and growth rate k. One difficulty is that DenseNet-BC parameter counts are strongly quantified according to the L and k values (L has to be a multiple of 6 modulo 4) and, additionally, to the e value in the coupled ensemble version. This is even more critical in moderate size models like the 800K one targeted here. We selected model configurations with parameters just below the target for making a fair comparison. A few models have slightly more parameters so that some interpolation can be done for possibly more accurate comparisons. We can make the following observations: • In the considered case (DenseNet-BC, CIFAR-100 and 800K parameters), the optimal number of branches is e = 3, L = 70, k = 9. With these parameters, the error rates decreases from 22.87 for the regular (L = 100, k = 12) DenseNet-BC model to 21.10 (−1.77). • Using 2 to 4 branches yields a significant performance gain over the classical (single branch, e = 1) case, and even over the original performance of 22.27 reported for the (L = 100, k = 12) DenseNet-BC (see supplementary material, section D). • Using 6 or 8 branches performs significantly less well. • Slightly varying the L, k and e hyper-parameters around their optimal value does not lead to a significant performance drop, showing that the coupled ensemble approach and the DenseNet-BC architecture are quite robust relatively to these choices. • The gain in performance comes at the expense of an increased training and prediction times even though the model size does not change. This is due to the use of smaller values of k that prevents good parallelism efficiency. This increase is relatively smaller with bigger networks. The same experiment was done on a validation set with a 40k/10k random split of the CIFAR100 training set and we could draw the same conclusions from there; they led to predict that the (L = 82, k = 8, e = 3) combination should be the best one on the test set. The (L = 70, k = 9, e = 3) combination appears to be slightly better here but the difference is probably not statistically significant. 4.6 C OMPARISON WITH THE STATE OF THE ART We have evaluated the coupled ensemble network approach with networks of various sizes. We used again Huang et al. (2017)’s DenseNet-BC architecture as the “basic block” since this was the current state of the art or very close to it at the time we started these experiments. We used Amos and Kolter (2017)’s PyTorch DenseNet-BC implementation both for the multi-branch (coupled ensembles) and 7 To be submitted as a conference paper at ICLR 2018 single-branch (classical) experiments. We also evaluated the approach using He et al. (2016b)’s ResNet with pre-activation as the basic block to check if the coupled ensemble approach works well with other architectures. Table 3 reports in the upper part the results obtained by the current best systems (see section 2 for references) and the results obtained with our coupled ensembles approach in the lower part. All results presented in this table correspond to the training of a single, possibly big, network. Even if ensembles are considered, they are always coupled as described in section 3 and trained as a single global network. A further level of ensembling involving multiple trainings is considered in section 4.7. Results are presented on the CIFAR 10 and 100 data set with standard data augmentation and on SVHN using the extra training data. Table 3: Classification error comparison with the state of the art, for a single model. System C10+ C100+ SVHN #Params ResNet L = 110 k = 64 6.61 1.7M ResNet stochastic depth L = 110 k = 64 5.25 24.98 1.7M ResNet stochastic depth L = 1202 k = 64 4.91 10.2M ResNet pre-activation L = 164 k = 64 5.46 24.33 1.7M ResNet pre-activation L = 1001 k = 64 4.92 22.71 10.2M DenseNet L = 100 k = 24 3.74 19.25 1.59 27.2M DenseNet-BC L = 100 k = 12 (Torch) 4.51 22.27 1.76 0.80M DenseNet-BC L = 250 k = 24 (Torch) 3.62 17.60 15.3M DenseNet-BC L = 190 k = 40 (Torch) 3.46 17.18 25.6M Shake-Shake C10 Model S-S-I 2.86 26.2M Shake-Shake C100 Model S-E-I 15.85 34.4M Snapshot Ensemble DenseNet-40 (α0 = 0.1) 4.99 23.34 1.64 6.0M Snapshot Ensemble DenseNet-40 (α0 = 0.2) 4.84 21.93 1.73 6.0M Snapshot Ensemble DenseNet-100 (α0 = 0.2) 3.44 17.41 163M SGDR WRN-28-10 Loshchilov and Hutter (2017) 4.03 19.57 36.5M SGDR WRN-28-10 3 snapshots 3.51 17.75 110M ResNeXt-29, 8×64d Xie et al. (2017) 3.65 17.77 34.4M ResNeXt-29, 16×64d Xie et al. (2017) 3.58 17.31 68.1M DFN-MR2 Zhao et al. (2016) 3.94 19.25 1.51 14.9M DFN-MR3 Zhao et al. (2016) 3.57 19.00 1.55 24.8M IGC-L450M2 Zhang et al. (2017) 3.25 19.25 19.3M IGC-L32M26 Zhang et al. (2017) 3.31 18.75 1.56 24.1M ResNet pre-activation L = 65 k = 64 e = 2 5.26 23.24 1.4M ResNet pre-activation L = 164 k = 64 e = 2 4.24 19.92 3.4M ResNet pre-activation L = 164 k = 64 e = 4 3.96 18.84 6.8M DenseNet-BC L = 100 k = 12 e = 1 4.77 22.87 1.79 0.8M DenseNet-BC L = 112 k = 16 e = 1 4.47 20.73 1.83 1.7M DenseNet-BC L = 130 k = 20 e = 1 4.06 19.03 1.84 3.4M DenseNet-BC L = 160 k = 24 e = 1 3.98 18.92 1.88 6.9M DenseNet-BC L = 166 k = 32 e = 1 4.03 20.03 1.88 13.0M DenseNet-BC L = 190 k = 40 e = 1 4.04 18.19 1.79 25.8M DenseNet-BC L = 82 k = 8 e = 3 4.30 21.25 1.66 0.8M DenseNet-BC L = 82 k = 10 e = 4 3.78 19.92 1.62 1.6M DenseNet-BC L = 88 k = 14 e = 4 3.57 17.68 1.55 3.5M DenseNet-BC L = 88 k = 20 e = 4 3.18 16.79 1.57 7.0M DenseNet-BC L = 94 k = 26 e = 4 3.01 16.24 1.50 13.0M DenseNet-BC L = 118 k = 35 e = 3 2.99 16.18 1.50 25.7M DenseNet-BC L = 106 k = 33 e = 4 2.99 15.68 1.53 25.1M DenseNet-BC L = 76 k = 33 e = 6 2.92 15.76 1.50 24.6M DenseNet-BC L = 64 k = 35 e = 8 3.13 15.95 1.50 24.9M 8 To be submitted as a conference paper at ICLR 2018 For the ResNet pre-act architecture, the ensemble versions with 2 or 4 branches leads to a significantly better performance than single branch versions with comparable or higher number of parameters. Regarding the DenseNet-BC architecture, we considered 6 different network sizes, roughly following multiples of powers of 2 and ranging from 0.8M up to 25.6M parameters, with two extremes corresponding to those for which the error rates were available Huang et al. (2017). We chose these values for the depth L and growth rate k for these points and interpolated between them according to a log scale as much as possible. Our experiments showed that the trade-off between L and k is not critical for a given overall parameter count. This was also the case for choosing between the number of branches e, depth L and growth rate, k for a given overall parameter count budget as long as e ≥ 3 (or even e ≥ 2 for small networks). For the 6 configurations, we experimented with both the single-branch (classical) and multi-branch versions of the model, with e = 4. Additionally, for the largest model, we tried e = 3, 6, 8 branches. For the single branch version with extreme network sizes, we obtained error rates significantly lower than those reported by Huang et al. (2017). From what we have checked, the Lua Torch implementation they used and the PyTorch one we used are equivalent. The difference may be due to the fact that we used a more conservative measure of the error rate (on the last iterations) and from statistical differences due to different initializations and/or to non-deterministic computations (see section D in supplementary material). Still, the coupled ensemble version leads to a significantly better performance for all network sizes, even when compared to DenseNet-BC’s reported performance. Our larger models of coupled DenseNet-BCs (error rates of 2.92% on CIFAR 10, 15.68% on CIFAR 100 and 1.50% on SVHN) perform better than or are on par with all current state of the art implementations that we are aware of at the time of publication of this work. Only the Shake-Shake S-S-I model (Gastaldi, 2017) performs slightly better on CIFAR 10. We also compare the performance of coupled ensembles with model architectures that were ‘learnt’ in a meta learning scenario. The results are presented in the supplementary material, section C. 4.7 E NSEMBLES OF COUPLED ENSEMBLES The coupled ensemble approach is limited by the size of the network that can fit into GPU memory during the training and the time that such training takes. With the hardware we have access to, it was not possible to go much beyond the 25M-parameter scale. For going further, we resorted to the classical ensembling approach based on independent trainings. An interesting question was whether we could still significantly improve the performance since the classical approach generally plateaus after quite a small number of models and the coupled ensemble approach already include several. For instance the SGDR with snapshots approach (Loshchilov and Hutter, 2017) has a significant improvement from 1 to 3 models but not much improvement from 3 to 16 models (see tables 3 and 4). As doing multiple times the same training is quite costly when models are large, we instead ensembled the four large coupled ensemble models that we trained for the four values of e = 3, 4, 6, 8. Results are shown in table 4. We obtained a significant gain by fusing two models and a quite small one from any further fusion of three or four of them. To the best of our knowledge, these ensembles of coupled ensemble networks outperform all state of the art implementations including other ensemble-based ones at the time of publication of this work. Table 4: Classification error comparison with the state of the art, multiple model trainings. System C10+ C100+ SVHN #Params SGDR WRN-28-10 3 runs × 3 snapshots 3.25 16.64 329M SGDR WRN-28-10 16 runs × 3 snapshots 3.14 16.21 1752M DenseNet-BC ensemble of ensembles e = 6, 4 2.72 15.13 1.42 50M DenseNet-BC ensemble of ensembles e = 6, 4, 3 2.68 15.04 1.42 75M DenseNet-BC ensemble of ensembles e = 8, 6, 4, 3 2.73 15.05 1.41 100M 9 To be submitted as a conference paper at ICLR 2018 4.8 PARAMETER U SAGE Figure 1 shows that for a given parameter count, coupled ensemble networks or ensembles of coupled ensemble networks perform significantly better for all parameter budgets. Our approach is shown by the blue diamonds. CIFAR-10 Ours DenseNet-BC SGDR-WRN Others Error Rate 6 5 4 3 106 107 108 109 108 109 Parameters CIFAR-100 Error Rate 24 22 20 18 16 106 107 Parameters SVHN 1.9 Error Rate 1.8 1.7 1.6 1.5 1.4 106 107 Parameters 108 Figure 1: Comparison of parameter usage between different methods. Results on CIFAR-10 (top), CIFAR-100 (middle) and SVHN (bottom) tasks. “DenseNet-BC”: single-branch (PyTorch) configuration; “Ours”: proposed multiple branch configuration using DenseNet-BC as the basic block, single training up to 25M parameters and ensembles of coupled ensembles beyond; SGDR-WRN: snapshot ensembles with SGDR on Wide ResNets up to 110M parameters and ensembles of snapshot ensembles beyond; ”Other”: all other architectures mentioned in tables 3 and 4. 10 To be submitted as a conference paper at ICLR 2018 5 D ISCUSSION The proposed approach consists in replacing a single deep convolutional network by a number of “basic blocks” which resemble standalone CNN models. The intermediate score vectors produced by each of the basics blocks are coupled via a “fuse layer”. At training time, this is done by taking an arithmetic average of their log-probabilites for the targets. At test time the score vectors are averaged following the output from each score vector. Both of these aspects leads to a significant performance improvement over a single branch configuration. This improvement comes at the cost of a small increase in the training and prediction times. The proposed approach leads to the best performance for a given parameter budget as can be seen in tables 3 and 4, and in figure 1. The increase in training and prediction times is mostly due to the sequential processing of branches during the forward and backward passes. The smaller size of the branches makes the data parallelism on GPUs less efficient. This effect is not as pronounced for larger models. This could be solved in two ways. First, as there is no data dependency between the branches (before the averaging layer) it is possible to extend the data parallelism to the branches, restoring the initial level of parallelism. This can be done by implementing a parallel implementation of multiples 2D convolutions at the same time. Second or alternatively, when multiple GPUs are used, it is possible to spread the branches over the GPUs. We have currently evaluated the coupled ensemble approach only on relatively small data sets. We therefore plan to conduct experiments on ImageNet (Russakovsky et al., 2015) to check whether it will work equally well on large collections. ACKNOWLEDGEMENTS This work has been partially supported by the LabEx PERSYVAL-Lab (ANR-11-LABX-0025-01). Experiments presented in this paper were partly carried out using the Grid’5000 test-bed, supported by a scientific interest group hosted by Inria and including CNRS, RENATER and several Universities as well as other organizations (see https://www.grid5000.fr). R EFERENCES Amos, B. and Kolter, J. Z. (2017). A PyTorch Implementation of DenseNet. https://github. com/bamos/densenet.pytorch. Accessed: June 2017. Chollet, F. (2017). Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Cireşan, D., Meier, U., and Schmidhuber, J. (2012). Multi-column deep neural networks for image classification. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pages 3642–3649. Cireşan, D. C., Meier, U., Gambardella, L. M., and Schmidhuber, J. (2011). Convolutional neural network committees for handwritten character classification. In Proceedings of the 2011 International Conference on Document Analysis and Recognition, ICDAR ’11, pages 1135–1139, Washington, DC, USA. Gastaldi, X. (2017). Shake-shake regularization. In International Conference on Learning Representations. arXiv:1705.07485. Hansen, L. K. and Salamon, P. (1990). Neural network ensembles. IEEE Transactions on Pattern Analysis and Machine Intelligence, 12(10):993–1001. He, K., Zhang, X., Ren, S., and Sun, J. (2016a). Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778. arXiv:1512.03385. He, K., Zhang, X., Ren, S., and Sun, J. (2016b). Identity Mappings in Deep Residual Networks, pages 630–645. 11 To be submitted as a conference paper at ICLR 2018 Huang, G., Liu, Z., van der Maaten, L., and Weinberger, K. Q. (2017). Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Huang, G., Sun, Y., Liu, Z., Sedra, D., and Weinberger, K. Q. (2016). Deep Networks with Stochastic Depth, pages 646–661. Kawaguchi, K. (2016). Deep learning without poor local minima. In Advances in Neural Information Processing Systems, pages 586–594. Krizhevsky, A. and Hinton, G. (2009). Learning multiple layers of features from tiny images. Krizhevsky, A., Sutskever, I., and Hinton, G. E. (2012). Imagenet classification with deep convolutional neural networks. In Pereira, F., Burges, C. J. C., Bottou, L., and Weinberger, K. Q., editors, Advances in Neural Information Processing Systems 25, pages 1097–1105. Curran Associates, Inc. Lecun, Y., Bottou, L., Bengio, Y., and Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324. Loshchilov, I. and Hutter, F. (2017). SGDR: stochastic gradient descent with restarts. In International Conference on Learning Representations. Netzer, Y., Wang, T., Coates, A., Bissacco, A., Wu, B., and Ng, A. Y. (2011). Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011. Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., Berg, A. C., and Fei-Fei, L. (2015). ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252. Simonyan, K. and Zisserman, A. (2014). Very deep convolutional networks for large-scale image recognition. CoRR, abs/1409.1556. Published at ICLR 2015. Springenberg, J. T., Dosovitskiy, A., Brox, T., and Riedmiller, M. (2015). Striving for simplicity: The all convolutional net. In International Conference on Learning Representations. Szegedy, C., Liu, W., Jia, Y., Sermanet, P., Reed, S. E., Anguelov, D., Erhan, D., Vanhoucke, V., and Rabinovich, A. (2015). Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9. Xie, S., Girshick, R., Dollr, P., Tu, Z., and He, K. (2017). Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. Zagoruyko, S. and Komodakis, N. (2016). Wide residual networks. In Proceedings of the British Machine Vision Conference 2016, BMVC 2016, York, UK, September 19-22, 2016. Zhang, T., Qi, G.-J., Xiao, B., and Wang, J. (2017). Interleaved Group Convolutions for Deep Neural Networks. In International Conference on Computer Vision. Zhao, L., Wang, J., Li, X., Tu, Z., and Zeng, W. (2016). On the connection of deep fusion to ensembling. arXiv preprint arXiv:1611.07718. Zoph, B. and Le, Q. V. (2017). Neural architecture search with reinforcement learning. In International Conference on Learning Representations. Zoph, B., Vasudevan, V., Shlens, J., and Le, Q. V. (2017). Learning transferable architectures for scalable image recognition. arXiv preprint arXiv:1707.07012. 12 To be submitted as a conference paper at ICLR 2018 Supplementary Material A I MPLEMENTATION Figure 2 shows the common structure of the test (top) and train (bottom) versions of networks used as basic blocks. Figure 3 shows how it is possible to place the averaging layer just after the last FC layer of the basic block instances and before the SM layer which is then “factorized”. The e model instances do not need to share the same architecture. Figure 3 shows how it is possible to place the averaging layer just after the last FC layer, just after the SM (actually LSM (LogSoftMax), which is equivalent to do a geometric mean of the SM values) layer, or just after the LL layer. Image [W] Basic Block FC SM [W] Basic Block FC SM Scores Label Image LL Loss Figure 2: Versions of the base network. Top: test, bottom: train. [W1] FC Basic Block ⋯ Image [We] Basic Block FC [W1] Basic Block FC Image [We] ⋯ SM AVG Scores SM Scores SM AVG FC Basic Block Figure 3: Test versions of coupled ensemble networks. Top: SM (classical) fusion, bottom: FC fusion. AVG: averaging layer. We reuse “basic blocks” from other groups (with appropriate credits, please let us know if any is missing or requires updating) in their original form as much as possible both for efficiency and for ensuring more meaningful comparisons. When available, we use the PyTorch implementations. Each of the e branches is defined by a parameter vector We containing the same parameters as the original implementation. The global network is defined by a parameter vector W which is a concatenation of all the We parameter vectors. When training is done in the coupled mode and the prediction is done in a separate mode or vice-versa, a dedicated script is used for splitting the W vector into the We ones or vice-versa. In all coupled networks, for all train versions and for all test version, the same global parameter vector W is used with the same split and defining the same basic block functions. This is how we can combine in any way all of the four possible training conditions with all the three possible prediction conditions, even though not all of them are consistent or equally efficient. The overall network architecture is determined by: • the global hyper-parameter specifying the train versus test mode; • the global hyper-parameter e specifying the number of branches; • the global hyper-parameter specifying after which layer the AVG layer should be placed (FC, SM or LL); 13 To be submitted as a conference paper at ICLR 2018 Label [W1] Basic Block Image ⋯ FC LL SM [We] Basic Block FC SM [W1] Basic Block FC SM AVG Loss AVG LL Loss SM LL Loss LL Label ⋯ Image [We] Basic Block FC [W1] Basic Block FC SM Label Image [We] ⋯ Basic Block AVG FC Figure 4: Train versions of coupled ensemble networks. Top: LL fusion, middle: SM fusion, bottom: FC fusion. • either one basic block to be replicated e times with its own hyper-parameters or a list of e basic blocks, each with its own hyper-parameters. B T EST TIME EQUIVALENCE BETWEEN FC AVERAGE AND L OG S OFT M AX AVERAGE Given branches E = E1 , E2 , ..Ee , each Ei produces a score vector of dimension C, where C is the number of categories. An element of Ei is referenced as Eic , were c ∈ [1, C]. FC Average denotes averaging the raw activations from each branch. LSM Average denotes averaging across branches, after a LogSoftMax operation in applied on each branch activation vector, separately. Pe Case 1: FC average: ScorescF C = i=1 Eic Case 2: exp(Eec ) LogSof tM ax(Enc ) = log P c c exp(Ee ) = log exp(Eec ) − log X exp(Eec ) c = Eec − Ze P Pe Pe c c LSM average: ScorescLSM = i=1 Zi , where Ze = log C exp(Ee ). Hence we i=1 Ei − see that the LSM average score vector is a translated version of the FC average score vector. Also, doing an arithmetic average of LogSoftMax values is equivalent to doing a geometric average of SoftMax values. This holds during inference where we are interested only in the maximum value. C C OMPARISON WITH Learnt ARCHITECTURES In table 5, we compare the parameter usage and performance of the branched coupled ensembles with model architectures that were recovered using meta learning techniques. 14 To be submitted as a conference paper at ICLR 2018 Table 5: Classification error comparison with learnt architectures. System C10+ C100+ SVHN Neural Architecture Search v3 (Zoph and Le, 2017) 3.65 NASNet-A (Zoph et al., 2017) 3.41 DenseNet-BC L = 82 k = 10 e = 4 3.78 19.92 1.62 DenseNet-BC L = 88 k = 14 e = 4 3.57 17.68 1.55 DenseNet-BC L = 88 k = 20 e = 4 3.18 16.79 1.57 D #Params 37.4M 3.3M 1.6M 3.5M 7.0M P ERFORMANCE MEASUREMENT AND REPRODUCIBILITY ISSUES When attempting to compare the relative performance of different methods, we face the issue of the reproducibility of the experiments and of the statistical significance of the observed difference between performance measures. Even for a same experiment, we identified the five following sources of variation in the performance measure: • Underlying framework for the implementation: we made experiments with Torch7 (lua) and with PyTorch. • Random seed for the network initialization. • CuDNN non-determinism during training: GPU associative operations are by default fast but non-deterministic. We observed that the results varies even for a same tool and the same seed. In practice, the observed variation is as important as when changing the seed. • Fluctuations associated to the computed moving average and standard deviation in batch normalization: these fluctuations can be observed even when training with the learning rate, the SGD momentum and the weight decay all set to 0. During the last few epochs of training, their level of influence is the same as with the default value of these hyper-parameters. • Choice of the model instance chosen from training epochs: the model obtained after the last epoch, or the best performing model. Note that choosing the best performing model involves looking at test data. Regardless of the implementation, the numerical determinism, the Batch Norm moving average, and the epoch sampling questions, we should still expect a dispersion of the evaluation measure according to the choice of the random initialization since different random seeds will likely lead to different local minima. It is generally considered that the local minima obtained with “properly designed and trained” neural networks should all have similar performance (Kawaguchi, 2016). We do observe a relatively small dispersion (quantified by the standard deviation below) confirming this hypothesis. This dispersion may be small but it is not negligible and it complicates the comparisons between methods since differences in measures lower than their dispersions is likely to be nonsignificant. Classical statistical significance tests do not help much here since differences that are statistically significant in this sense can be observed between models obtained just with different seeds (and even with the same seed), everything else being kept equal. Experiments reported in this section gives an estimation of the dispersion in the particular case of a moderate scale model. We generally cannot afford doing a large number of trials for larger models. We tried to quantify the relative importance of the different effects in the particular case of DenseNetBC with L = 100, k = 12 on CIFAR 100. Table 6 shows the results obtained for the same experiment in the four groups of three rows. We tried four combinations corresponding to the use of Torch7 versus PyTorch and to the use of the same seed versus the use of different seeds. For each of these configuration, we used as the performance measure: (i) the error rate of the model computed at the last epoch or (ii) the average of the error rate of the models computed at the last 10 epochs, (iii) the error rate of the model having the lowest error rate over all epochs. For these 2 × 2 × 3 cases, we present the minimum, the median, the maximum and the mean±standard deviation over 10 measures corresponding to 10 identical runs (except for the seed when indicated). Additionally, in the case of the average of the error rate of the models computed at the 10 last epochs, we present the root mean square of the standard deviation of the fluctuations on the last 10 epochs (which is the same as the square root of the mean of their variance). We make the following observations: 15 To be submitted as a conference paper at ICLR 2018 • There does not seem to be a significant difference between Torch7 and PyTorch implementations; • There does not seem to be a significant difference between using a same seed and using different seeds; the dispersion observed using the same seed (with everything else being equal) implies that there is no way to exactly reproduce results; • There does not seem to be a significant difference between the means over the 10 measures computed on the single last epoch and the means over the 10 measures computed on the last 10 epochs; • The standard deviation of the measures computed on the 10 runs is slightly but consistently smaller when the measures are computed on the last 10 epochs than when they are computed on the single last epoch; this is the same for the difference between the best and the worst measures; this was expected since averaging the measure on the last 10 epochs reduces the fluctuations due to the moving average and standard deviation computed in batch normalization and possibly too the the random fluctuations due to the final learning steps; • The mean of the measures computed on the 10 runs is significantly lower when the measure is taken at the best epoch than when they are computed either on the single last epoch or on the last 10 epochs. This is expected since the minimum is always below the average. However, presenting this measure involves using the test data for selecting the best model. Table 6: Performance measurement and reproducibility issues. Statistics on 10 runs. Seeds Impl. Last L k e Min. Med. Max. Mean±SD RMS(SD) diff. PyT. 1 100 12 1 22.64 22.80 23.22 22.89±0.21 n/a diff. PyT. 10 100 12 1 22.67 22.83 23.14 22.87±0.17 0.13 diff. PyT. best 100 12 1 22.13 22.56 22.91 22.54±0.24 n/a same PyT. 1 100 12 1 22.77 23.05 23.55 23.06±0.23 n/a same PyT. 10 100 12 1 22.81 22.98 23.49 23.04±0.22 0.11 same PyT. best 100 12 1 22.44 22.67 23.02 22.71±0.18 n/a diff. LuaT. 1 100 12 1 22.55 22.94 23.11 22.90±0.20 n/a diff. LuaT. 10 100 12 1 22.55 22.89 23.08 22.86±0.20 0.12 diff. LuaT. best 100 12 1 22.17 22.52 22.75 22.49±0.18 n/a same LuaT. 1 100 12 1 22.33 22.82 23.58 22.82±0.34 n/a same LuaT. 10 100 12 1 22.47 22.92 23.51 22.87±0.30 0.12 same LuaT. best 100 12 1 22.24 22.51 23.24 22.54±0.29 n/a diff. PyT. 1 82 8 3 21.27 21.44 21.70 21.49±0.15 n/a diff. PyT. 10 82 8 3 21.24 21.46 21.63 21.45±0.11 0.12 diff. PyT. best 82 8 3 20.84 21.18 21.30 21.14±0.14 n/a diff. PyT. 1 100 12 4 17.24 17.71 17.86 17.65±0.18 n/a diff. PyT. 10 100 12 4 17.37 17.67 17.81 17.66±0.14 0.11 diff. PyT. best 100 12 4 17.11 17.46 17.66 17.45±0.16 n/a Following these observations, we propose a method for ensuring the best reproducibility and the fairest comparisons. Choosing the measure as the minimum of the error rate for all models computed during the training seems neither realistic nor a good practice since we have no way to know which model will be the best one without looking at the results (cross-validation cannot be used for that) and this is like tuning on the test set. Even though this is not necessarily unfair for system comparison if the measures are done in this condition for all systems, this does introduce a bias for the absolute performance estimation. Using the error rate at the last iteration or at the 10 last iteration does not seem to make a difference in the mean but the standard deviation is smaller for the latter, therefore this one should be preferred when a single experiment is conducted. We also checked that using the 10 or the 25 last epochs does not make much difference (learning at this point does not seem to lead to further improvement). A value different from 10 can be used and this is not critical. In all the CIFAR experiments reported in this paper, we used the average of the error rate for the models obtained at the last 10 epochs as this should be (slightly) more robust and more conservative. The case for SVHN experiments is slightly different since there is a much smaller number of much bigger epochs; we used the last 4 iterations in this case. These observations have been made in a quite specific case but the principle and the conclusions (use of the average of the error rate from the last epochs should lead to more robust and conservative 16 To be submitted as a conference paper at ICLR 2018 results) are likely to be general. Table 6 also shows the results for a coupled ensemble network of comparable size and for a coupled ensemble network four times bigger. Similar observations can be made and, additionally, we can observe that both the range and the standard deviations are smaller. This might be because an averaging is already made between the branches leading to a reduction of the variance. Though this requires confirmation at larger scales, coupled ensemble networks might lead to both a better and a more stable performance. 17
1cs.CV
GENERALIZED CLUSTER TREES AND SINGULAR MEASURES By Yen-Chi Chen arXiv:1611.02762v2 [math.ST] 16 Feb 2018 Department of Statistics University of Washington February 19, 2018 In this paper, we study the α-cluster tree (α-tree) under both singular and nonsingular measures. The α-tree uses probability contents within a set created by the ordering of points to construct a cluster tree so that it is well-defined even for singular measures. We first derive the convergence rate for a density level set around critical points, which leads to the convergence rate for estimating an α-tree under nonsingular measures. For singular measures, we study how the kernel density estimator (KDE) behaves and prove that the KDE is not uniformly consistent but pointwise consistent after rescaling. We further prove that the estimated α-tree fails to converge in the L∞ metric but is still consistent under the integrated distance. We also observe a new type of critical points–the dimensional critical points (DCPs)–of a singular measure. DCPs are points that contribute to cluster tree topology but cannot be defined using density gradient. Building on the analysis of the KDE and DCPs, we prove the topological consistency of an estimated α-tree. 1. Introduction. Given a function f defined on a smooth manifold M, the cluster tree of f is a tree structure representing the creation and merging of connected components of a level set {x : f (x) ≥ f0 } when we move down the level f0 (Stuetzle, 2003; Klemelä, 2004). Because cluster trees keep track of the connected components of level sets, the shape of a cluster tree contains topological information about the underlying function f . Moreover, a cluster tree can be displayed on a two-dimensional plane regardless of the dimension of M, which makes it an attractive approach for visualizing f . Figure 1 provides an example illustrating the construction of a cluster tree in a 1D Euclidean space. In this paper, we focus on the case where f ≡ fP is some function of the underlying distribution P . In this context, the cluster tree of f reveals information about P . Most of cluster trees being studied in the literature are the λ-tree of a distribution (Balakrishnan et al., 2012; Chaudhuri and Dasgupta, 2010; Chaudhuri et al., 2014; Chen et al., 2016b; Kpotufe and Luxburg, 2011; Stuetzle, 2003). The λ-tree of a distribution is the cluster tree of the density function p of that distribution. In this case, the tree structure contains the topological information of p and we can use the λ-tree to visualize a multivariate density function. When we use an λ-tree for visualization purposes, it is also called a density tree (Klemelä, 2004, 2006, 2009). Kent (2013) proposed a new type of cluster tree of a distribution–the α-tree. The α-tree uses the function α(x) = P ({y : p(y) ≤ p(x)}) to construct a cluster tree. Note that such a function is also called density ranking in our following paper (Chen and Dobra, 2017) and it shows great potential in analyzing GPS datasets. When the distribution is nonsingular and smooth, the α-tree MSC 2010 subject classifications: Primary 62G20; secondary 62G05, 62G07 Keywords and phrases: cluster tree, kernel density estimator, level set, singular measure, critical points, topological data analysis 1 2 Y.-C. CHEN ● ● ● ● ● ● Fig 1. An example of constructing a cluster tree in d = 1 case. The purple horizontal lines indicates the level f0 we are using in each panel. The blue region at the bottom indicates the corresponding level set {x : f (x) ≥ f0 }. From left to right, we gradually decrease the level f0 and use red lines to indicate how the connected components evolve. The resulting red tree in the right panel is a cluster tree. and the λ-tree are topologically equivalent (Lemma 1), so they both provide similar topological information for the underlying distribution. To estimate an α-tree, we use the cluster tree of the function estimator α bn (x) = Pbn ({y : pbn (y) ≤ pbn (x)}) where Pbn is the empirical measure and pbn is the kernel density estimator (KDE). Namely, we first use the KDE to estimate the density of each data point and count the number of data points with a density below the density of that given point. When a distribution is singular, the λ-tree is ill-defined because of the lack of a probability density function, but the α-tree is still well-defined under a mild modification. For an illustrating example, see Figure 2. These are random samples from a distribution mixed with a point mass at x = 2 with a probability of 0.3 and a standard normal distribution with a probability of 0.7. Thus, these samples are from a singular distribution. We generate n = 5 × 103 (left), 5 × 105 (middle), and 5 × 107 (right) data points and estimate the density using the KDE with the smoothing bandwidth selected by the default rule in R. The estimated density and λ-trees (red trees) are displayed in the top row. It can be seen that when the sample size increases, λ-trees become degenerated. This is because there is no population λ-tree for this distribution. However, the α-trees are stable in all three panels (see the bottom row of Figure 2). Main Results. The main results of this paper are summarized as follows: • When the distribution is nonsingular, 1. We derive the convergence rate for the estimated level set when the level equals the density value of a critical point (Theorem 3). 2. We derived the convergence rate of α bn (Theorem 4). • When the distribution is singular, 3. We propose a framework that generalizes α(x) to define the α-tree (Section 4). 4. We show that after rescaling, the KDE is pointwise, but not uniformly, consistent (Theorem 8). 5. We prove that α bn is inconsistent under the L∞ metric (Corollary 7) but consistent under the L1 and L1 (P ) distance (Theorem 10). 6. We identify a new type of critical points, the dimensional critical points (DCPs), which 3 GENERALIZED CLUSTER TREES N = 5e+05 ; Bandwidth = 0.08 N = 5e+07 ; Bandwidth = 0.03 Density 1.0 0.5 0.5 −3 −2 −1 0 1 2 3 1.0 3 0.8 2 0.6 1 0.2 0 0.0 −1 α(x) 0.8 0.6 α(x) −2 0.4 −3 1.0 3 0.4 2 0.2 1 0.0 0 0.2 −1 0.0 −2 0.0 0.0 0.0 α(x) 0.6 0.8 1.0 −3 0.4 1.5 2.0 1.0 Density 0.4 0.3 0.1 0.2 Density 2.5 0.5 3.0 0.6 1.5 N = 5000 ; Bandwidth = 0.21 Fig 2. Example of the estimated λ-tree and α-tree of a singular distribution. This is a random sample from a singular distribution where with a probability of 0.3, it puts a point mass at x = 2, and with a probability of 0.7, we sample from a standard normal. The top panel shows the density estimated by the KDE and the red tree structure corresponds to the estimated λ-tree. The bottom panel displays the estimated α-tree. From left to right, we increase the sample size from 5 × 103 , 5 × 105 , to 5 × 107 . Because the distribution is singular, there is no population λ-tree so when the smoothing bandwidth decreases (when the sample size increases), the estimated λ-tree is getting degenerated. On the other hand, the estimated α-trees remain stable regardless of the smoothing bandwidth. Note that every level set in a λ-tree corresponds to a level set in the α-tree but the value of the corresponding level (Y -axis) will be different. The function used in constructing a λ-tree may have an unbounded range when the sample size goes to infinity, whereas the function for building an α-tree always has a range of [0, 1]. 4 Y.-C. CHEN also contribute to the change in cluster tree topology. We analyze their properties in Lemma 11, 13, and 14. 7. We demonstrate that the estimated α-tree Tαbn is topologically equivalent to the population α-tree with probability exponentially converging to 1 (Theorem 15). Related Work. There is extensive literature on theoretical aspects of the λ-tree. Notions of consistency are analyzed in Hartigan (1981); Chaudhuri and Dasgupta (2010); Chaudhuri et al. (2014); Eldridge et al. (2015). The convergence rate and the minimax theory are studied in Chaudhuri and Dasgupta (2010); Balakrishnan et al. (2012); Chaudhuri et al. (2014). Chen et al. (2016b) study how to perform statistical inference for a λ-tree. The cluster tree is also related to the topological data analysis (Carlsson, 2009; Edelsbrunner and Morozov, 2012; Wasserman, 2016). In particular, a cluster tree contains information about the zeroth order homology groups (Cohen-Steiner et al., 2007; Fasy et al., 2014; Bobrowski et al., 2017; Bubenik, 2015). In our analysis, we generalize the Morse theory to a non-smooth and even discontinuous function. Baryshnikov et al. (2013) also generalizes the Morse theory to a non-smooth function using the concept of configuration space (the collection of n points in a bounded area in Rd ). Note that their setting is different from us because we are working on a probability density function whereas the function in Baryshnikov et al. (2013) is related to pairwise distance between points and distance to the boundary of certain area. The theory of estimating a cluster tree is closely related to the theory of estimating a level set; an incomplete list of literature is as follows: Polonik (1995); Tsybakov (1997); Walther (1997); Mason and Polonik (2009); Singh et al. (2009); Rinaldo and Wasserman (2010); Steinwart (2011). Outline. We begin with an introduction of cluster trees and the geometric concepts used in this paper in Section 2. In Section 3, we derive the convergence rate for the α-tree estimator under nonsingular measures. In Section 4, we study the behavior of the KDE and the stability of the estimated α-tree under singular measures. In Section 5, we investigate critical points of singular measures and derive the topological consistency of the estimated α-tree. We summarize this paper and discuss possible future directions in Section 6. We leave all proofs in the supplementary materials (Chen, 2016). 2. Backgrounds. 2.1. Cluster Trees. Here we recall the definition of cluster trees in Chen et al. (2016b). Let K ⊂ Rd and f : K 7→ [0, ∞) be a function with support K. The cluster tree of function f is defined as follows. Definition 1 (Definition 1 in Chen et al. (2016b)). K where 2K denotes the set of all subsets of K, 22 of K, and Tf (λ) is the set of connected components of define the collection of connected components {Tf }, as K 22 , For any f : K 7→ [0, ∞) we define Tf : R 7→ denotes the collection of all sets of subsets the upper S level set {x ∈ K : f (x) ≥ λ}. We {Tf } = Tf (λ). Thus, {Tf } is a collection λ of subsets of K. We called {Tf } the cluster tree of f . Clearly, the cluster tree {Tf } has a tree structure, because for each pair C1 , C2 ∈ {Tf }, either C1 ⊂ C2 , C2 ⊂ C1 , or C1 ∩ C2 = φ holds. To get a geometric understanding of the cluster tree in Definition 1, we identify edges that constitute the cluster tree. Intuitively, edges correspond to either leaves or internal branches. An GENERALIZED CLUSTER TREES 5 Fig 3. Connected components, edges, and edge set of a cluster tree. Left: We display connected components of level sets under five different levels (indicated by the colors: magenta, yellow, sea green, sky blue, and gray). The color of boundaries of each connected component denotes the edge they correspond to. Right: The cluster tree. We color the three edges (vertical lines) red, blue, and black. The edge set E(Tf ) = {Cred , Cblue , Cblack } and we have the ordering Cred ≤ Cblack and Cblue ≤ Cblack . Note that the solid black horizontal line is not an edge set; it is a visual representation of connecting the blue and red edges to the black edge. The horizontal dashed lines indicate the five levels corresponding to the left panel. In the left panel, the three connected components with red boundaries are elements of the edge Cred . edge is roughly defined as a set of clusters whose inclusion relation with respect to clusters outside an edge is equivalent. So when the collection of connected components is divided into edges, we observe the same inclusion relation between representative clusters whenever any cluster is selected as representative for each edge. To formally define edges, we define an interval in the cluster tree, and the equivalence relation in the cluster tree. For any two clusters A, B ∈ {Tf }, the interval [A, B] ⊂ {Tf } is defined as a set clusters that contain A and are contained in B, i.e. [A, B] := {C ∈ {Tf } : A ⊂ C ⊂ B} , We define the equivalence relation ∼ such that A ∼ B if and only if ∀C ∈ {Tf } such that C ∈ / [A, B] ∪ [B, A], C ⊂ A ⇔ C ⊂ B, A ⊂ C ⇔ B ⊂ C. It is easy to see that the relation ∼ is reflexive (A ∼ A), symmetric (A ∼ B implies B ∼ A), and transitive (A ∼ B and B ∼ C implies A ∼ C). Hence the relation ∼ is indeed an equivalence relation, and we can consider the set of equivalence classes {Tf }/∼ . We define the edge set (the collection of edges) E(Tf ) as E(Tf ) := {Tf }/∼ . Each element in the edge set C ∈ E(Tf ) is called an edge, which contains many nested connected components of the cluster tree {Tf } (i.e. if C1 , C2 ∈ C, then either C1 ⊂ C2 or C2 ⊂ C1 ). Note that every element in an edge corresponds to a connected component of an upper level set of function f . To associate the edge set E(Tf ) to a tree structure, we define a partial order on the edge set as follows: let C1 , C2 ∈ E(Tf ) be two edges, we write C1 ≤ C2 if and only if A ⊂ B for all A ∈ C1 and B ∈ C2 . Then the topology of the cluster tree (the shape of the cluster tree) is completely determined by the edge set E(Tf ) and the partial order among the edge set. Figure 3 provides an example of the connected components, edges, and edge set of a cluster tree along with a tree representation. Based on the above definitions, we define the topological equivalence between two cluster trees. 6 Y.-C. CHEN Definition 2. For two functions f : K 7→ [0, ∞) and g : K 7→ [0, ∞), we say Tf and Tg are T topological equivalent, denoted as Tf ≈ Tg , if there exists a bijective mapping S : E(Tf ) 7→ E(Tg ) such that for any C1 , C2 ∈ E(Tf ), C1 ≤ C2 ⇐⇒ S(C1 ) ≤ S(C2 ). For each C ∈ E(Tf ), we define U (C) = sup{λ : ∃C ∈ Tf (λ), C ∈ C} to be the maximal level of an edge C. We define the critical tree-levels of function f as (1) Af = {U (C) : C ∈ E(Tf )}. It is easy to see that Af is the collection of levels of f where the creation of a new connected component or the merging of two connected components occurs. In most of the cluster tree literature (Balakrishnan et al., 2012; Chaudhuri and Dasgupta, 2010; Chaudhuri et al., 2014; Chen et al., 2016b; Eldridge et al., 2015), the cluster tree is referred to as the λ-tree, which uses the probability density function p to build a cluster tree. Namely, the λ-tree is Tp . In this paper, we focus on the α-tree (Kent, 2013) that uses the function (2) α(x) = P ({y : p(y) ≤ p(x)}) = 1 − P ({y : p(y) > p(x)}) = 1 − P (Lp(x) ) to build the cluster tree Tα (Tα is called the α-tree). The function α(x) is also called density ranking in Chen and Dobra (2017). The set Lλ = {x : p(x) ≥ λ} is the upper level set of p (note that P ({y : p(y) > p(x)}) = P ({y : p(y) ≥ p(x)}) when the density function p is bounded). A feature of the α-tree is that the function α(x) depends only on the ordering of points within K. Namely, any function that assigns the same ordering of points within K as the density function p can be used to construct the function α(x). Specifically, we write x1 p x2 ⇔ p(x1 ) > p(x2 ), x1 ≺p x2 ⇔ p(x1 ) < p(x2 ), x1 'p x2 ⇔ p(x1 ) = p(x2 ). Then (3) α(x) = P ({y : p(y) ≤ p(x)}) = P ({y : y p x}), where y p x means either y ≺p x or y 'p x. Note that if we replace the function p(x) by 2p(x) or log p(x), the ordering remains the same (i.e., x p y ⇔ x 2p y ⇔ x log p y). We will use this feature later to generalize equation (2) to singular measures. One feature of the α-tree is that it is topological equivalent to the λ-tree. GENERALIZED CLUSTER TREES 7 Lemma 1. Assume the distribution P has a bounded density function p and p is a Morse function with a compact support. Then the λ-tree and α-tree are topological equivalent. Namely, T Tp ≈ Tα . The proof of this lemma follows from the argument at the beginning of Section 4.1 of Cadre et al. (2009) so we ignore the proof. The main idea is that by equation (2) and the fact that p is Morse, α is a strictly monotonic transformation of the density p so the topology is preserved. When we use the α-tree, the induced upper level set A$ = {x : α(x) ≥ $} is called an α-level set. Remark 1 (κ-tree). Kent (2013) also proposed another cluster tree–the κ-tree–which uses the probability content within each edge set defined by an α-tree (or a λ-tree) to compute the function κ(x). Because it is just a rescaling from the α-tree, the theory of α-tree also works for the κ-tree. For simplicity, we only study the theory of the α-tree in this paper. 2.2. Singular Measure. When the probability measure is singular, the λ-tree is no longer welldefined because there is no density function. However, the α-tree can still be defined. A key feature for constructing the α-tree is the ordering. Here we will use a generalized density function, the Hausdorff density (Preiss, 1987; Mattila, 1999), to define the α-tree under singular measures. Given a probability measure P , the s-density (s dimensional Hausdorff density) is Hs (x) = lim r→0 P (B(x, r)) Cs · r s provided the limit exists. Note that B(x, r) = {y : ky − xk ≤ r} and Cs is the s-dimensional volume of an s-dimensional unit ball for s ≥ 1 and C0 = 1. For a given point x, we define the notion of generalized density using two quantities τ (x) and ρ(x): τ (x) = max{s ≤ d : Hs (x) < ∞} ρ(x) = Hτ (x) (x). Namely, τ (x) is the ‘dimension’ of the probability measure at x and ρ(x) is the corresponding Hausdorff density at that dimension. Note that the function ρ(x) is well-defined for every x. For any two points x1 , x2 ∈ K, we define an ordering such that x1 τ,ρ x2 if τ (x1 ) < τ (x2 ), or τ (x1 ) = τ (x2 ), ρ(x1 ) > ρ(x2 ). That is, for any pair of points, we first compare their dimensions τ (x). The point with the lower dimensional value τ will be ranked higher than the other point. If two points have the same dimension, then we compare their corresponding Hausdorff density. When the distribution is nonsingular, 8 Y.-C. CHEN Fig 4. The supports K2 , K1 , and K0 for the bivariate random variable in Example 1. The yellow region is K2 = [−1, 1]2 \R0.5 , where R0.5 = {(x, y) : x2 + y 2 = 0.52 }. The red ring is K1 = R0.5 \{(0.5, 0)}. The blue dot is the location of (0.5, 0). τ (x) = d for every x ∈ K and ρ(x) = p(x) is the usual density function. Thus, the ordering is determined by the density function p(x). To define the α-tree, we use equation (3): (4) α(x) = P ({y : y τ,ρ x}) . Namely, α(x) is the probability content of regions of points whose ordering is lower than or equal to x. As shown in equation (3), equation (4) is the same as equation (2) when P is nonsingular. Note that by equation (4), the α-level set A$ = {x : α(x) ≥ $} is well-defined in a singular measure. 2.3. Geometric Concepts. We first define some notations for sets. For a set A, define A to be the closure of A, Å to be the relative interior of A, ∂A to be the boundary of set A. and AC = K\A to be the complement of set A restricted to the support K. We define A4B = (A\B) ∪ (B\A) to be the symmetric difference for sets A and B Based on the definition of τ (x), we decompose the support K into [ [ [ (5) K = Kd Kd−1 · · · K0 , where Ks = {x : τ (x) = s}. Thus, {K0 , · · · , Kd } forms a partition of the entire support K. We call each Ks an s-dimensional support. When we analyze the support Ks , any Ks0 with s0 > s is called a higher dimensional support (with respect to Ks ) and s0 < s will be called a lower dimensional support. Example 1. Let X be a bivariate random variable such that (i) with a probability of 0.7, it is from a uniform distribution on [−1, 1]2 , (ii) with a probability of 0.25, it is from a uniform distribution on the ring R0.5 = {(x, y) : x2 + y 2 = 0.52 }, (iii) with a probability of 0.05, it is equal to (0.5, 0). Apparently, the distribution of X is singular and the support K = [−1, 1]2 . In this case, K2 = [−1, 1]2 \R0.5 , K1 = R0.5 \{(0.5, 0)}, and K0 = {(0.5, 0)}. Figure 4 shows these supports under different colors. The yellow rectangular region is K2 , the red ring area is K1 , and the blue dot denotes the location of K0 . GENERALIZED CLUSTER TREES 9 To regularize the behavior of ρ(x) on each support Ks , we assume that the closure of the support, Ks , is an s-dimensional smooth manifold (properties of a smooth manifold can be found in Lee 2012; Tu 2010). For an s-dimensional smooth manifold M, the tangent space on each point of M changes smoothly (Tu, 2010; Lee, 2012). Namely, for x ∈ M, we can find an orthonormal basis {v1 (x), · · · , vs (x) : v` (x) ∈ Rd , ` = 1, · · · , s} such that {v1 (x), · · · , vs (x)} spans the tangent space of M at x and each v` (x) is a smooth (multivalued) function on Ms . For simplicity, for x ∈ Ks , we denote Ts (x) as the tangent space of Ks at x, Ns (x) as the normal space of Ks at x, and ∇Ts (x) to be taking the derivative in the tangent space. For a function f : M 7→ R defined on a smooth manifold M, the function f is a Morse function (Milnor, 1963; Morse, 1925, 1930) if all its critical points are non-degenerate. Namely, the eigenvalues of the Hessian matrix of f at each critical point are non-zero. When the function f is a Morse function, its λ-tree is stable (Chazal et al., 2014; Chen et al., 2016b) in the L∞ metric under a small perturbation of f . To link the concept of the Morse function to the Hausdorff density ρ(x), we introduce a generalized density ρ†s : Ks 7→ [0, ∞) such that ρ†s (x) = limxn ∈Ks :xn →x ρ(xn ) provided the limit exists and does not depend on the choice of the sequence xn . It is easy to see that ρ†s (x) = ρ(x) when x ∈ Ks but now it is defined on a smooth manifold Ks . We say ρ(x) is a generalized Morse function if the corresponding ρ†s (x) is a Morse function for s = 1, · · · , d. Later we will show that this generalization leads to a stable α-tree for a singular measure. For Ks , let Cs = {x ∈ Ks : ∇Ts (x) ρ†s (x) = 0} be the collection of its critical points. Then the fact that ρ†s (x) is a Morse function implies that the eigenvalues of the Hessian matrix ∇Ts (c) ∇Ts (c) ρ†s (c) are non-zero for every c ∈ Cs . We call gs (x) = ∇Ts (x) ρ†s (x) the generalized gradient and Hs (x) = ∇Ts (x) ∇Ts (x) ρ†sS (x) the generalized Hessian. For the case s = 0 (point mass), we define C0 = K0 . The collection C = s=1,··· ,d Cs is called the collection of generalized critical points of ρ(x). Each element c ∈ C is called a generalized critical point. Finally, we introduce the concept of reach (Federer, 1959; Chen et al., 2015a) for a smooth manifold M. The reach of M is defined as reach(M) = sup{r ≥ 0 : every point in M ⊕ r has a unique projection onto M}, where A ⊕ r = {x : d(x, A) ≤ r}. One can view reach as the radius of the largest ball that can roll freely outside M. More details about reach can be found in Federer (1959); Chen et al. (2015a). Reach plays a key role in the stability of a level set; see Chen et al. (2015a) for more details. Remark 2. (6) If we further assume that the supports satisfy K ⊃ Kd ⊃ Kd−1 ⊃ · · · ⊃ K0 , then the support K forms a stratified space (Goresky and MacPherson, 1980, 2012). Roughly speaking, a stratified space is a topological space W such that there exists a decomposition (called stratification) WS0 , · · · , Wd of W with the properties that (i) each Wk is a k-dimensional smooth manifold, (ii) W = dω=0 Wω , and (iii) for any k ≤ `, Wk ∩ W` 6= ∅ ⇔ Wk ⊂ W` . 10 Y.-C. CHEN From the properties of a stratified space, one can see how equation (6) is related to a stratified space. Note that for a stratified space, if we consider a probability measure that is a mixture of probability measures defined on each stratum (Wk ), this defines a singular measure as the one being considered in this paper. The topology of a stratified space can be defined using the intersection homology (Goresky and MacPherson, 1980; Edelsbrunner and Harer, 2008; Friedman, 2014). The notion of intersection homology and stratified space will be particularly useful if we want to work on higher-order homology groups. 2.4. Estimating the α function and the α-tree. In this paper, we focus on estimating α-trees via the KDE:   n 1 X kx − Xi k pbn (x) = . K h nhd i=1 Specifically, we first estimate the density by pbn and then construct the estimator α bn : (7) α bn (x) = Pbn ({y : pbn (y) ≤ pbn (x)}) b where Pbn is the empirical measure and  Lλ ={x : pbn (x) ≥ λ}. Note that when x does not contain b pb (x) . any point mass of P , α bn (x) = 1 − Pbn L n To quantify the uncertainty in the estimator α bn , we consider three error measurements. The first error measurement is the L∞ error, which is defined as kb αn − αk∞ = sup |b αn (x) − α(x)|. x The L∞ error has been used in several cluster tree literature; see, e.g., Eldridge et al. (2015); Chen et al. (2016b). An appealing feature of the L∞ error is that this quantity is the same (up to some constant) as some other tree error metrics such as the merge distortion metric (Eldridge et al., 2015). Convergence in the merge distortion metric implies the Hartigan consistency (Eldridge et al., 2015), a notion of consistency of a cluster tree estimator described in Hartigan (1981); Chaudhuri and Dasgupta (2010); Chaudhuri et al. (2014). Thus, because of the equivalence between the L∞ error and the merge distortion metric, convergence in L∞ implies the Hartigan consistency of an estimated cluster tree. The other two errors are the integrated error and the probability error (probability-weighted integrated error). Both are common error measurements for evaluating the quality of a function estimator (Wasserman, 2006; Scott, 2015). The integrated error is Z kb αn − αkµ = |b αn (x) − α(x)|dx, which is also known as the integrated distance or L1 distance. The probability error (probabilityweighted integrated error) is Z kb αn − αkP = |b αn (x) − α(x)|dP (x), which is the integrated distance weighted by the probability measure, which is also known as L1 (P ) distance. The integrated error and the probability error are more robust than the L∞ error–a large difference in a small region will not affect on these errors much. 11 GENERALIZED CLUSTER TREES To quantify the uncertainty in the topology of α-tree, we introduce the notion of topological error, which is defined as     P T =1−P Tαbn 6≈ Tα T Tαbn ≈ Tα . Namely, the topological error is the probability that the estimated α-tree is not topological equivalent to the population α-tree. Finally, we define the following notations. For a smooth function p, we define kpk`,∞ as the supremum maximal norm of `-th derivative of p. For instance, kpk0,∞ = sup p(x), x∈K kpk1,∞ = sup kg(x)kmax , kpk2,∞ = sup kH(x)kmax , x∈K x∈K where g(x) = ∇p(x) and H(x) = ∇∇p(x) are the gradient and Hessian matrix of p(x), respectively. A vector β = (β1 , . . . , βd ) of non-negative integers is called a multi-index with |β| = β1 +β2 +· · ·+βd and the corresponding derivative operator is Dβ = (8) ∂ β1 ∂xβ1 1 ··· ∂ βd ∂xβd d , where Dβ f is often written as f (β) . 3. Theory for Nonsingular Measures. To study the theory for nonsingular measures, we make the following assumptions. Assumptions. (P1) p has a compact support K and is a Morse function and is four times differentiable with kpk`,∞ < ∞ for ` = 0, · · · , 4. (K1) K(x) has compact support and is non-increasing on [0, 1], and has at least fourth-order bounded derivative and Z Z  2 2 (β) K (β) (kxk) dx < ∞ kxk K (kxk)dx < ∞, for |β| ≤ 2 and K (2) (0) < 0. (K2) Let     (β) kx − yk d Kr = y 7→ K : x ∈ R , |β| = r, h̄ > h > 0 , h S where K (β) is defined in equation (8) and Kl∗ = lr=0 Kr and h̄ is some positive number. We assume that K2∗ is a VC-type class. i.e. there exists constants A, v and a constant envelope b0 such that  v A ∗ 2 (9) sup N (K2 , L (Q), b0 ) ≤ ,  Q where N (T, dT , ) is the -covering number for a semi-metric set T with metric dT and L2 (Q) is the L2 norm with respect to the probability measure Q. 12 Y.-C. CHEN Assumption (P1) is a common condition to guarantee that critical points are well-separated and will not move too far away under a small perturbation on the gradient and Hessian of the density function (Chazal et al., 2014; Chen et al., 2016b). We need the fourth-order derivative to ensure the estimated density Hessian matrix converges to the population density Hessian matrix (the bias in estimating the Hessian matrix depends on fourth-order derivatives). Assumption (K1) is a standard condition on kernel function (Wasserman, 2006; Scott, 2015). Assumption (K2) regularizes the complexity of kernel functions so we have uniform bounds on density, gradient, and Hessian estimation. It was first proposed by Giné and Guillou (2002) and Einmahl and Mason (2005) and was later used in various studies such as Genovese et al. (2009, 2014); Chen et al. (2015b). We first study the error rates under nonsingular measures. In the case of the λ-tree, error rates are well-studied, and we summarize them in the following theorem. Theorem 2. d+4 Assume (P1, K1–2). Then when h → 0, nh log n → ∞, ! r log n 2 kb pn − pk∞ = O(h ) + OP nhd ! r 1 2 kb pn − pkµ = O(h ) + OP nhd ! r 1 kb pn − pkP = O(h2 ) + OP nhd   T d+4 P Tpbn ≈ Tp ≥ 1 − c0 · e−c1 ·nh , for some c0 , c1 > 0. The rate of consistency under the L∞ error can be found in Chen et al. (2015a); Giné and Guillou (2002); Einmahl and Mason (2005). The integrated error and probability error can be seen in Scott (2015). And the topological error bound follows Lemma 2 in Chen et al. (2016b) and the concentration of L∞ metric for the estimated Hessian matrix. The requirement of h in Theorem 2 enforces the uniform convergence of the KDE as well as its first and second derivative. Uniform convergence of derivatives of the KDE implies the convergence of some geometric structures of the density function, such as the ridges (Chen et al., 2015b; Genovese et al., 2014), critical points (Chazal et al., 2014; Chen et al., 2016a), and persistent diagrams (Cohen-Steiner et al., 2007; Fasy et al., 2014; Chen, 2017). Now we turn to the consistency for α-tree. To derive the rate for the α-tree, we need to study the convergence rate of an estimated level set when the level is the density value of a critical point (also known as a critical level). The reason is that the quantity α(x) = 1 − P (Lp(x) ) is the probability content of upper level set Lp(x) = {y : p(y) ≥ p(x)}. When p(x) = p(c) for some critical point c of p, we face the problem of analyzing the stability of level sets at a critical level. Theorem 3 (Level set error at a critical value). Assume (P1) and (K1–2) and d ≥ 2. Let λ be log n a density level corresponding to the density of a critical point. When h → 0, nh d+4 → 0,     d d+1 b λ 4Lλ = OP kb µ L pn − pk∞ . 13 GENERALIZED CLUSTER TREES The rate in Theorem 3 is slower than the usual density estimation rate. This is because the boundary of Lλ hits a critical point when λ equals the density of a critical point. The regions around a critical point have a very low gradient, which leads to a slower convergence rate. It is well-known (Giné and Guillou, 2002; Einmahl and Mason, 2005; Genovese et al., 2014) that under assumption (P) and (K1–2), ! r log n 2 kb pn − pk∞ = O(h ) + OP . nhd d In Theorem 3, we see that when d is large, the quantity d+1 → 1 so the error rate is similar to kb pn − pk∞ . This is because the regions that slow down the error rate are areas around the critical points. These areas occupy a small volume when d is large, which decreases the difference in the rate. Remark 3. Theorem 3 complements many existing level set estimation theories. To our knowledge, no literature has worked on the situation where λ equals the density of a critical point. Level set theories mostly focus on one of the following three cases: (i) the gradient on the level set boundary ∂Lλ = {x : p(x) = λ} is bounded away from 0 (Molchanov, 1991; Tsybakov, 1997; Walther, 1997; Cadre, 2006; Laloe and Servien, 2013; Mammen and Polonik, 2013; Chen et al., 2015a), (ii) a lower bound on the density changing rate around level λ (Singh et al., 2009; Rinaldo et al., 2012), (iii) an (, σ) condition for density (Chaudhuri and Dasgupta, 2010; Chaudhuri et al., 2014). When λ equals a critical level, none of these assumptions hold. Based on Theorem 3, we derive the convergence rate of α bn . Theorem 4. Assume (P1) and (K1–2) and d ≥ 2 and the smoothing bandwidth satisfies h → log n 0, nh d+4 → 0. Let C = {x : ∇p(x) = 0} be the collection of critical points and let an be a sequence of n such that kb pn − pk∞ = o(an ). Then uniformly for all x,  (kb pn − pk∞ )  , if |p(x) − p(c)| > an for all c ∈ C, OP  d α bn (x) − α(x) = d+1 OP kb pn − pk∞ , otherwise. Theorem 4 shows uniform error rates for α bn . When the density of a given point is away from critical levels, the rate follows the usual density estimation rate. When the given point has a density value close to some critical points, the rate is slowed down by the low gradient areas around critical points. Note that the sequence an is to make the bound uniform for all x. To  obtain an integrated q  error rate (and the probability error rate) of α bn , we can choose an = which leads to the following result. 1 log n O(h2 ) + OP 1 nhd 14 Y.-C. CHEN Corollary 5. d+4 Assume (P1) and (K1–2) and d ≥ 2. Then when h → 0, nh log n → ∞, !   d  2d  2(d+1) log n kb αn − αk∞ = O h d+1 + OP d nh ! r log n 2 kb αn − αkµ = O(h ) + OP nhd ! r log n 2 kb αn − αkP = O(h ) + OP nhd   T d+4 P Tαbn ≈ Tα ≥ 1 − c0 · e−c1 ·nh , for some c0 , c1 > 0. Comparing Corollary 5 to Theorem√2, we see that only the L∞ error rate has a major difference and the other two errors differ by a log n factor. This is because Theorem 4 proves that, only at the level of a critical point, we will have a slower convergence rate. Thus, the L∞ error will be slowed down by these points. However, the collection of points {x : p(x) = p(c) for some c ∈ C} has Lebesgue measure zero so the slow convergence rate does not translate to the integrated error T and the probability error. The topological error follows from Theorem 2 and Lemma 1: T (b pn ) ≈ T Tαbn , T (p) ≈ Tα . 4. Singular Measures: Error Rates. Now we study error rates under singular measures. When a measure is singular, the usual (Radon-Nikodym) density cannot be defined. Thus, we cannot define the λ-tree. However, as we discussed in Section 4, we are still able to define the α-tree. Thus, in this section, we will focus on error rates for the α-tree. 4.1. Analysis of the KDE under Singular Measures. To study the convergence rate, we first investigate the bias of smoothing in the singular measure. Let ph (x) = E(b pn ), which is also known as the smoothed density. Assumption. (S) For all s < d, Ks is a smooth manifold with positive reach and K is a compact set. (P2) ρ(x) is a generalized Morse function and there exists some ρmin , ρmax > 0 such that 0 < ρmin ≤ ρ(x) ≤ ρmax < ∞ for all x. Moreover, for any s > 0, ρ†s is unique and has bounded continuous derivatives up to the fourth order. Assumption (S) ensures that Ks is smooth and every connected component of Ks is separated for each s. Assumption (P2) is a generalization of (P1) to singular distributions. Lemma 6 (Bias of the smoothed density). Assume (S, P2). Let x ∈ K̊s and define m(x) = R min{` > s : x ∈ K` } − s. Let C`† = ( B` K(kyk)dy)−1 , where B` = {y : kyk ≤ 1, y`+1 = y`+2 = · · · = yd = 0} for ` = 1, · · · , d and dy is integrating with respect to `-dimensional area and C0† = 1/K(0). Then for a fixed x, when h → 0 and m(x) > 0, ( O(h2 ) + O(hm(x) ), if m(x) > 0 † d−τ (x) Cτ (x) h · ph (x) = ρ(x) + . 2 O(h ), if m(x) = 0 15 GENERALIZED CLUSTER TREES Moreover, if K` ∩ Ks 6= φ, for some s < `, then there exists  > 0 such that lim sup |Cτ (x) hd−τ (x) · ph (x) − ρ(x)| >  > 0. h→0 x∈K Lemma 6 describes the bias of the KDE. The scaling factor Cτ†(x) hd−τ (x) rescales the smoothed density to make it comparable to the generalized density. The first assertion is a pointwise convergence of smoothed density. In the case of m(x) > 0, the bias contains two components: O(h2 ), the usual smoothing bias, and O(hm(x) ), the bias from a higher dimensional support. This is because the KDE is isotropic, so the probability content outside Ks will also be included, which causes additional bias. The second assertion states that the smoothed density does not uniformly converge to the generalized density ρ(x), so together with the first assertion, we conclude that the smoothing bias converges pointwisely but not uniformly. Next, we provide an example showing the failure of uniform convergence of a singular measure. Example 2 (Failure of uniform convergence). We consider X from the same distribution as in Figure 2: with a probability of 0.3, X = 2, and with a probability of 0.7, X follows a standard normal. For simplicity, we assume that the kernel function is the spherical kernel K(x) = 21 I(0 ≤ x ≤ 1) and consider the smoothing bandwidth h → 0. This choice of kernel yields C1† = 1. Now consider a sequence of points xh = 2 + h2 . Then the smoothed density at each xh is 1 P (xh − h < X < xh + h) h   1 h 3h = P 2− <X <2+ h 2 2 3 1 , ≥ P (X = 2) = h 10h ph (xh ) = which diverges when h → 0. However, it is easy to see that τ (xh ) = 1 and ρ(xh ) = which is a finite number. Thus, |E(ph (xh ) − ρ(xh )| does not converge. 7 10 φ(xh ) → 7 10 φ(1) Remark 4. The scaling factor in Lemma 6 Cτ†(x) hd−τ (x) depends on the support Ks where x resides. In practice, we do not know τ (x) so we cannot properly rescale pbn (x) to estimate ρ(x). However, we are still able to rank pairs of data points based on Lemma 6. To see this, let x1 and x2 be the two points that we want to compare their orderings (i.e., we want to know x1 ≺τ,ρ x2 or x1 τ,ρ x2 or x1 'τ,ρ x2 ). When x1 and x2 are both in Ks for some s, the scaling does not affect the ranking between them so the sign of ρ(x1 ) − ρ(x2 ) is the same as that of ph (x1 ) − ph (x2 ). When x1 and x2 are in different supports (i.e. x1 ∈ Ks1 , x2 ∈ Ks2 , where s1 6= s2 ), ph (x1 ) and ph (x2 ) diverge at different rates, meaning that we can eventually distinguish them. Thus, ordering for most points can still be recovered under singular measures. This is an important property that leads to the consistency of α bn under other error measurements. Due to the failure of uniform convergence in the bias, the L∞ error of α bn does not converge under singular measures. 16 Y.-C. CHEN Fig 5. Good regions Ks (h) for Example 1. Left: the original K2 , K1 , and K0 . Right: the corresponding K2 (h), K1 (h), and K0 (h). The yellow area is the set K2 (h), which are regions in K2 away from lower-dimensional supports K1 and K0 . The red area is the set K1 (h), which are regions in K1 where regions close to K0 have been removed. The blue dot is K0 (h), which is the same as K0 because there is no lower dimensional support. Note that K(h) is the union of the three color regions in the right panel. Corollary 7 (L∞ error for singular measures). Assume (S, P2). When Kd ∩ Ks 6= φ, for some s < d, kb αn − αk∞ does not converge to 0. Namely, there exists  > 0 such that lim inf P (kb αn − αk∞ > ) > 0. n,h The proof of Corollary 7 is a direct application of the failure of uniform convergence in smoothing bias shown in Lemma 6. This corollary shows that for a singular measure, the L∞ error of the estimator α bn does not converge in general. Thus, there is no guarantee for the Hartigan consistency of the estimated α-tree. 4.2. Error Measurements. Although Corollary 7 presents a negative result on estimating the αtree, in this section, we show that the estimator α bn is still consistent under other error measurements. A key observation is S that there is a good region where the scaled KDE converges uniformly. Let Ks (h) = K̊s \( `<s K` ⊕ h) be the set that is in the interior of Ks and is away from lower dimensional supports for s > 0; in the case of s = 0, we define K0 (h) = K0 . We define K(h) = S K (h), which is the union of each Ks (h). Figure 5 shows the good region of support Ks (h) and s≤d s the original support Ks in Example 1. Later we will show that the set K(h) is the good region. In Lemma 6, the quantity m(x) = min{` ≥ τ (x) : x ∈ K` } − τ (x) plays a key role in determining the rate of smoothing bias. Only when m(x) = 1, do we have a slower rate for the bias. Thus, to obtain a uniform rate on the bias, we introduce the quantity (10) mmin = inf x∈K,m(x)>0 If m(x) = 0 for all x ∈ K, we define mmin = 2. m(x). 17 GENERALIZED CLUSTER TREES Theorem 8 (Consistency of the KDE under singular measures). be the constant in Lemma 6. Define Assume (S, P2, K1–2). Let C`† δn,h,s = sup kCs† hd−s pbn (x) − ρ(x)k x∈Ks (h) (1) δn,h,s = sup kCs† hd−s ∇Ts (x) pbn (x) − ∇Ts (x) ρ(x)kmax x∈Ks (h) (2) δn,h,s = sup kCs† hd−s ∇Ts (x) ∇Ts (x) pbn (x) − ∇Ts (x) ∇Ts (x) ρ(x)kmax , x∈Ks (h) where ∇Ts (x) is taking gradient with respect to the tangent space of Ks at x. Then when h → d+4 0, nh log n → ∞, r (11) δn,h,s = O(h2 V (1) δn,h,s = O(h2 V δn,h,s = O(h2 V (2) where a V mmin ) + OP r mmin ) + OP r mmin ) + OP log n nhs ! , log n nhs+2 ! log n nhs+4 ! , , b = min{a, b}. Theorem 8 shows that after rescaling, the KDE is uniformly consistent within the good region Ks (h) for density, gradient, and Hessian estimation. A more interesting result is that, after rescaling, the error rate is the same as the usual L∞ error rate in the s-dimensional case with a modified bias term (bias is affected by a higher dimensional support). Remark 5. (Non-convergence of the integrated distance of the KDE) One may wonder if the scaled KDE (Cτ†(x) hd−τ (x) · pbn (x)) converges to the generalized density ρ(x) under the integrated distance. There is no guarantee for such a convergence because Z kCτ†(x) hd−τ (x) · pbn (x) − ρ(x)kdx = OP (1). To see this, consider a point x ∈ Ks and let K` be a higher order support (` > s) with x ∈ K` . Then the region B(x, h) ∩ K` has `-dimensional volume at rate O(h`−s ). For any point y ∈ B(x, h) ∩ K` , τ (y) = ` but the KDE pbn (y) is at rate OP (hs−d ). Thus, the difference between the scaled KDE and the generalized density is C`† hd−` · pbn (y) − ρ(y) = OP (hs−` ). Such y has `-dimensional volume at rate O(h`−s ), so the integrated error is at rate OP (hs−` ) × O(h`−s ) = OP (1). Based on Theorem 8, we can derive a nearly uniform convergence rate of α bn . 18 Y.-C. CHEN Theorem 9 (Nearly uniform consistency of α-trees). Assume (S, P2, K1–2). Let Cs be the collection of generalized critical points of Ks . Let δn,h,s be defined in equation (11) and rn,h,s be a d+2 δ = oP (1). Then when h → 0, nh quantity such that rn,h,s log n → ∞, uniformly for every x ∈ Ks (h), n,h,s α bn (x) − α(x) = ( O (δ  n,h,s ) O (δn,h,s ) if s s+1  inf c∈Cs |ρ(x) − ρ(c)| > rn,h,s , otherwise. The convergence rate in Theorem 9 is similar to that in Theorem 8: for a given point x when α(x) is away from the α value of a generalized critical point (a critical α level), we have the usual convergence rate. When α(x) is close to a critical α level, the convergence rate is slower. The quantity rn,h,s behaves like the quantity $n in Theorem 4, which was introduced to guarantee the uniform convergence. To derive the consistency of α bn under the integrated error and the probability error, δn,h,s we choose rn,h,s = log , which leads to the following theorem. n Theorem 10 (Consistency of α-trees). Then Assume (S, P2 , K1–2). kb αn − αkP = O (δn,h,d ) , kb αn − αkµ = O (δn,h,d ) . Theorem 9 shows that the quantity α(x) can be consistently estimated by α bn (x) for the majority points. This implies that the ordering of points using pbn is consistent with the ordering from τ, ρ in most areas of K. 5. Singular Measures: Critical Points and Topology. Recall from Section 2.1 that the topology of an α-tree Tα is determined by its edge set E(Tα ) and the relation among edges C ∈ E(Tα ). The set Aα (critical tree-levels) contains the levels where the upper level set A$ = {x : α(x) ≥ $} changes its shape. For nonsingular measures, Aα corresponds to the density value of some critical points. For singular measures, this is not true even when ρ(x) is a generalized Morse function. Consider the example in Figure 6. The solid box in the left panel indicates a new type of critical points, where merges between elements in different edge sets occur (change in the topology of level sets occurs). By the definition of Aα , this corresponds to an element in Aα , but it is clearly not a generalized critical point. We call this type of critical points the dimensional critical points (DCPs). In Figure 6, the dimension d = 2 and we have a 2D spherical distribution mixed with a 1D singular measure that is distributed on the red curves K1 . The bluish contours are density contours of the 2D spherical distribution, the crosses are locations of local modes, and the solid box is the location of a DCP. To see how the solid box changes the topology of level sets, we display two level sets in the middle and right panels. In the middle panel, the level is high and there are two connected components (the gray area and the solid curve). In the right panel, we lower the level, and now, the two connected components merge at the location of the solid box. Although the location of the solid box does not belong to the collection of generalized critical points C, this point does correspond to GENERALIZED CLUSTER TREES 19 Fig 6. Example of DCPs. This is a d = 2 case; there is a 2D spherical distribution mixed with a 1D distribution on a line segment. Left: the blue contours are density contours of the 2D spherical distribution and the red line segment is K1 , the support of the 1D singular distribution. The two crosses are the density maxima at the 2D distribution and the 1D singular distribution. The black square indicates a DCP. To see how DCPs merge two connected components, we consider the middle and the right panel, which are level sets of α(x) at two different levels. Middle: the level set A$ where the level $ is high; we can see that there are two connected components (left gray-black disk and the right line segment). Right: we move down the level a little bit; now the two connected components merge so there is only one connected component. The merging point is the square point, which is defined as a DCP. the merging of connected components in the level sets. Thus, this point corresponds to an element in Aα . Here is the formal definition of the DCP. Recall that C is the collection of generalized critical points of ρ(x) and from equation (1), Aα is the collection of levels of function α(x) such that the creation of a new connected component or merging of connected components occurs. For simplicity, we denote A = Aα . For any level $ ∈ A, we define ( max{w ≥ 0 : Kw ⊂ A$ }, if K0 ⊂ A$ (12) ξ($) = . −1, if K0 6⊂ A$ Namely, ξ($) is the highest dimensional structure that is covered by the level set A$ . Definition 3. For $ ∈ A, we say x is a DCP if the following holds (1) x ∈ K` for some ` ≤ ξ($). (2) There exists an edge C ∈ E(Tα ) such that (i) x ∈ / C for all C ∈ C, (ii) d(x, C ) → 0 when  → 0, where C = C ∩ Tα ($ + ). Note that x may not exist. In such a case, there is no DCPs for level $. The first requirement is to ensure that x is on a lower dimensional support (K` : ` < ξ($)). The second requirement is to show that the DCP x is not in the same edge C, but its distance to the elements (connected components) of the edge is shrinking to 0. By the definition of α(x), the first requirement implies that x is contained in A$+ for a sufficiently small . Therefore, we can find C0 ∈ E(Tα ) such that every element C ∈ C0 contains x. Because x is (i) in the elements of edge C0 , and (ii) not in any element of edge C, and because (iii) the distance from x to the element of C 20 Y.-C. CHEN converges to 0 when the level decreases to the level $, x is a merging point of edges C0 and C and the level $ is their merging level. Note that since DCPs occur when different dimensional regions intersect each other, the topological structure of such an intersection may be related to the intersection homology and stratified space (Edelsbrunner and Harer, 2008; Goresky and MacPherson, 1980, 2012). Let C D be the collection of DCPs. For a point c ∈ C D , we denote α† (c) as the level of α function corresponding to the DCP at c. Note that α† (c) 6= α(c) when c is a DCP. Since a DCP is generally in a lower dimensional support than the support that the merging happens, α(c) > α† (c). Remark 7 provides an example of how α and α† differs. Remark 6 (Relation to the usual critical points). The definition of DCPs is similar to that of saddle points or local minima, who contribute to the merging of level sets. Saddle points (or local minima) that contribute to a merging of level sets can be defined as a point x with the following properties: (1) x ∈ Kξ($)+1 . (2) There exists two different edges C1 , C2 ∈ E(Tα ) such that (i) x ∈ / C1 , x ∈ / C2 for all C1 ∈ C1 and C2 ∈ C2 , (ii) d(x, C1, ) → 0 when  → 0, where C1, = C1 ∩ Tα ($ + ), (iii) d(x, C2, ) → 0 when  → 0, where C2, = C2 ∩ Tα ($ + ). It is easy to see that for a Morse function, a point x with the above properties must be a saddle point or a local minimum. The main difference between this definition and that of DCPs is the support where x lives– if x lives in a lower dimensional support K` , ` ≤ ξ($), then it is a DCP, and if x lives in the support Kξ($)+1 , then it is a saddle point or a local minimum. Remark 7. Note that a DCP might be at the same position as a critical point. Consider the example in Figure 2 and Example 2. In this case, ( 0.7 · 2 · Φ0 (−|x|), if x 6= 2 α(x) = , 1, if x = 2 where Φ0 (x) is the cumulative distribution of a standard normal. Moreover, Aα = {1, 0.7, 0.0319}; the first element {1} is the level of the point mass located at x = 2, the second element {0.7} is the level of the mode of the standard normal distribution, the last element is the level where the connected components created at levels 1 and 0.7 merged so it comes from a DCP. This DCP also located at x = 2, which coincides with a local mode. Note that the number 0.0319 = 0.7 · 2 · Φ0 (−2), which is the level where the merging occurred. At the critical point x = 2, α(2) = 1 and α† (2) = 0.0319. To analyze the properties of DCPs and their estimators, we consider the following assumptions. Assumptions. (A) The elements in the collection A are distinct and each element corresponds to one critical point or one DCP, but not both. And all DCPs are distinct. (B) For every x ∈ ∂Ks (s > 0) and r > 0, there is y ∈ B(x, r) ∩ Ks such that ρ(y) > ρ(x). GENERALIZED CLUSTER TREES 21 (C) There exists η0 > 0 such that inf d(c, K` ) ≥ η0 , c∈Cs for all ` < s and s = 1, 2, · · · , d. Assumption (A) is to ensure that no multiple topological changes will occur at the same level so each level corresponds to only a merging or a creation. Assumption (B) is to guarantee that no new connected component at the boundary of a lower dimensional manifold will be created. Thus, any creation of a new connected component of the level set A$ occurs only at a (generalized) local mode. Assumption (C) is to regularize (generalized) critical points so that they are away from lower dimensional supports. This implies that when h is sufficiently small, all critical points will be in the good region K(h). Lemma 11 (Properties of DCPs). Assume (S, P2, B). The DCPs have the following properties • If a new connected component of A$ is created at $ ∈ A, then there is a local mode c of ρ or an element in K0 such that $ = α(c). Namely, DCPs only merge connected components. • For any value $ ∈ A, either $ = α(c) for some c ∈ C or there is a DCP associated with $. Lemma 11 provides two basic properties of DCPs. First, DCPs only merge connected components. Moreover, when the topology of connected components of α-level sets changes (when we decrease the level), either a critical point or a DCP must be responsible for this. Theorefore, as long as we control the stability of generalized critical points and DCPs, we control the topology of an α-tree. Thus, in what follows, we will study the stability of generalized critical points and DCPs. Lemma 12 (Stability of generalized critical points). Assume (S, P2, K1–2, C). Let c ∈ Ks be a generalized critical point with n(c) negative eigenvalues of its generalized Hessian matrix. Let Cb be d+4 the collection of critical points of pbn . Then when h → 0, nh c ∈ Cb such log n → ∞, there exists a point b that ! r 1 kb c − ck = O (h) + OP nhs+2   s kb αn (b c) − α(c)k = OP (δn,h,s ) s+1 and the estimated Hessian matrix at b c has n(c) + d − s negative eigenvalues. The quantity δn,h,s is defined in equation (11). Lemma 12 is a generalization of the stability theorem of critical points given in Lemma 16 of Chazal et al. (2014). Note that the bias is now of the order O(h); this is due to the smoothing effect from a higher dimensional support. Lemma 13 (Properties of estimated critical points). Assume (S, P2, K1–2, A, B). Assume there are k DCPs. Let Cb be the critical points of pbn . Define Gb ⊂ Cb as the collection of estimated critical b = C\ b Gb be the remaining estimated points corresponding to the generalized critical points. Let D nhd+4 critical points. Then when h → 0, log n → ∞, b ⊂ KC (h), • D 22 Y.-C. CHEN b ≥ k, where |A| for a set A is the cardinality, • D b contains no local mode of pbn . • D Lemma 13 provides several useful properties of the estimated critical points (critical points of pbn ). First, the estimated critical points are all in the bad region KC (h), except for those converging to generalized critical points. Second, the number of estimated critical points will (asymptotically) not be less than the total number of DCPs. Third, all estimated local modes are estimators of generalized critical points. Lemma 14 (Stability of critical tree-levels from DCPs). Assume (S, P2, K1–2, A, B). Let b be defined as Lemma 13. Then when c be a DCP and α† (c) ∈ A be the associated level. Let D nhd+2 b h → 0, log n → ∞, there exists a point b c ∈ D such that  kb αn (b c) − α† (c)k = O δn,h,ξ(α0 (c))+1 , b αb (bc)+ and A b αb (bc) are not topological equivalent. where δn,h,s is defined in (11). Moreover, the A n n Lemma 14 illustrates the stability of critical tree-levels from DCPs: for every DCP, there will be an estimated critical point that corresponds to this DCP and this estimated critical point also represents a merging of the estimated level sets. In Lemma 12, we derived the convergence rate of the estimated (generalized) critical points versus the population critical points, but here we only derive the rate for the critical tree-levels. The reason is that critical points are solutions to a certain function (gradient equals to 0), so we can perform a Taylor expansion to obtain the convergence rate. However, for the DCPs, they are not solutions to some functions, so it is unclear how to derive the convergence rate for their locations. Example 3 (A DCP and its estimator). Consider again the example in Figure 2 and Example 2. We have a singular distribution mixed with a point mass at x = 2 with a probability of 0.3 and a standard normal with a probability of 0.7. In this case, as indicated, a DCP is located at x = 2 with level 0.0319 (see Remark 7). In every panel of the top row of Figure 2, there is a local minimum located in the region x ∈ [1.5, 2]. Moreover, when we increase the sample size (from left to right), this b local minimum is moving toward x = 2. This local minimum is an estimated critical point b c ∈ D, as described in Lemma 14, whose estimated α-level is approaching the α-level of the DCP at x = 2. Theorem 15 (Topological error of α-trees). Assume (S, P2, K1–2, A, B, C). Then when h → d+4 0, nh log n → ∞,   T d+4 P Tαbn ≈ Tα ≥ 1 − c0 · e−c1 ·nh , for some c0 , c1 > 0. Theorem 15 quantifies the topological error of the estimated α-tree under singular measures. The error rate is the same as that in the nonsingular measures (Theorem 5). The topological error bound is similar to that in Corollary 5. Both have exponential concentration bounds with a factor of nhd+4 , which is the Hessian estimation error rate. The two concentration bounds are similar, because as GENERALIZED CLUSTER TREES 23 shown in Theorem 8, the main difference between singular and nonsingular measures lies in the bias part, which will not contribute to the concentration inequality as long as h → 0. The Hessian error rate is because we need to make sure the signs of eigenvalues of Hessian matrices around critical points remain unchanged. Remark 8. Theorem 15 also implies that, under singular measures, the cluster tree of the KDE pbn (estimated λ-tree) converges topologically to a population cluster tree defined by the function T α(x). To see this, recall that by Lemma 1, Tpbn ≈ Tαbn . This, together with Theorem 15, implies   T d+4 →1 P Tpbn ≈ Tα ≥ 1 − c0 · e−c1 ·nh under a suitable choice of h. This shows that even when the population distribution is singular, the estimated λ-tree still converges topologically to the population α-tree. 6. Discussion. In this paper, we study how the α-tree behaves under singular and nonsingular measures. In the nonsingular case, the error rate under the L∞ metric is slower than other metrics because of the slow rate of level set estimation around saddle points. However, other error rates are the same as estimating the λ-tree. When a distribution is singular, we obtain many fruitful results for both the KDE and the estimated α-tree. In terms of the KDE, we prove that 1. the KDE is a pointwise consistent estimator after rescaling; 2. the KDE is a uniformly consistent estimator after rescaling for the majority of the support; and 3. the cluster tree from the KDE (estimated λ-tree) converges topologically to a population cluster tree defined by α. For the estimator α bn (x) and the estimated α-tree, we show that 1. 2. 3. 4. α bn is a pointwise consistent estimator of α; α bn is a uniformly consistent estimator for the majority of the support; α bn is a consistent estimator of α under the integrated distance and probability distance; and the estimated α-tree converges topologically to the population α-tree. Moreover, we observe a new type of critical points–the DCPs–that also contribute to the merging of level sets for singular measures. We study the properties of DCPs and show that the estimated critical points from the KDE approximate these DCPs. Finally, we point out some possible future directions. • Persistence Homology. The cluster tree is closely related to the persistent homology of level sets (Fasy et al., 2014; Bobrowski et al., 2017). In the persistent homology, a common metric for evaluating the quality of an estimator is the bottleneck distance (Cohen-Steiner et al., 2007; Edelsbrunner and Morozov, 2012). Because the bottleneck distance is bounded by the L∞ metric (Cohen-Steiner et al., 2007; Edelsbrunner and Morozov, 2012), many bounds on the bottleneck distance are derived via bounding the L∞ metric (Fasy et al., 2014; Bobrowski et al., 2017). However, for α-trees under singular measures, the L∞ metric does not converge (Corollary 7) but we do have topological consistency (Theorem 15), which implies convergence in the bottleneck distance. This provides an example where we have consistency under the 24 Y.-C. CHEN bottleneck distance and inconsistency in the L∞ metric. How this phenomenon affects the persistence homology is unclear and we leave that line of study for future work. • Higher-order Homology Groups and Stratified Space. Our definition of DCPs is for connected components, which are zeroth-order homology groups (Cohen-Steiner et al., 2007; Fasy et al., 2014; Bubenik, 2015) and sufficient for analyzing cluster trees. However, critical points also contribute to the creation and elimination of higher-order homology groups such as loops and voids, which are not covered in this paper. Thus, a future direction is to study whether the KDE is also consistent in recovering higher-order homology groups under singular measures. Moreover, as is mentioned in Remark 2, the supports we are analyzing are related to the stratified space (Friedman, 2014; Goresky and MacPherson, 1980) and the DCPs might be related to the intersection homology (Friedman, 2014; Goresky and MacPherson, 1980; Edelsbrunner and Harer, 2008). The intersection homology extends the definition of homology group to a stratified space so it provides a tool to analyze higher-order homology groups in our setting. Thus, finding the connection between theories of stratified space and the higher-order homology groups in our settings will be another future research direction. • Minimax theory. Chaudhuri and Dasgupta (2010); Chaudhuri et al. (2014) derived the minimax theory for estimating the λ-tree under nonsingular measures and proved that the the k-nearest neighbor estimator is minimax. When the distribution is nonsingular, the α-tree and λ-tree are very similar so we expect the minimax theory to be the same. However, for singular measures, it is unclear how to derive the minimax theory so we plan to investigate this in the future. Acknowledgements. We thank reviewers for their very insightful comments. We also thank members in the CMU Topstat group for useful discussion. APPENDIX A: PROOF To prove Theorem 3, we will use the following lemma. Lemma 16. Assume p satisfies (P1). Let λ be the density value of a critical point and C(λ) be the collection of all critical points with density value being λ. Let ∂Lλ = {x : p(x) = λ}. Then there exists R̄ > 0 and 0 < Cmin ≤ Cmax < ∞ such that for any positive number r < R̄, inf x∈(∂Lλ ⊕R̄)\(C(λ)⊕r) sup x∈C(λ)⊕r kg(x)k ≥ Cmin r, kg(x)k ≤ Cmax r. The first assertion means that the low gradient region must be around critical points and the gradient has to be linearly increasing as we move away from a critical point. The second assertion states that when we move away from a critical point, the gradient cannot increase faster than a linear rate. Essentially, these two properties are just natural outcomes from the fact that the density p is a Morse function (Hessian matrix at critical points have non-zero eigenvalues) and has bounded third derivatives. GENERALIZED CLUSTER TREES 25 Proof. First assertion. By the continuity of the gradient of p (assumption (P1) implies bounded Hessian matrix, which implies the continuity of gradient), regions with low gradient must be around a critical point. Let c0 be a critical point of C(λ). When R̄ is sufficiently small, for any unit vector ν ∈ Rd and any two positive numbers r1 < r2 < R̄, we have 0 < kg(c0 + r1 ν)k < kg(c0 + r2 ν)k. Namely, if we are moving away from a critical point along a fixed orientation, the amount gradient will be increasing as long as we do not move too far away. This is because the density around a critical point behaves like a quadratic function due to the Morse lemma (see, e.g., Lemma 3.11 of Banyaga and Hurtubise 2013). Thus, when R̄ is sufficiently small and r < R̄, the infimum inf x∈(∂Lλ ⊕R̄)\(C(λ)⊕r) kg(x)k occurs at the boundary ∂(C(λ) ⊕ r). Let x0 ∈ ∂(C(λ) ⊕ r) be the point where the infimum occurs and c be the critical point of C(λ) such that kx0 − ck = r. Because p is a Morse function, all eigenvalues of H 2 (c) must be non-zero. Thus, the fact that p has a bounded third derivative (assumption (P1)) implies that when R̄ is sufficiently small, all eigenvalues of H 2 (x) must be greater than or equal to a positive constant C1 uniformly for all x ∈ B(c, R̄). Define a line L0 (t) = t · x0 + (1 − t) · c passing through c and x0 . Then the gradient Z t=1 dg(L0 (t)) + g(x0 ) = g(c) |{z} t=0 =0 (c is a critical point) Z t=1 H(L0 (t)) L00 (t) dt, = | {z } t=0 =x0 −c which implies kg(x0 )k = t=1 Z t=0 H(L0 (t))(x0 − c)dt ≥ p C1 kx0 − ck = Cmin r, which proves the first assertion. Second assertion. By assumption (P1), every element of H(x) is uniformly bounded so the eigenvalues of H 2 (x) is also bounded. Let Cmax = supx kH(x)k∗ be the uniform bound on the spectral norm of H(x). For any point x ∈ B(c, r), again we define the line L0 (t) = t · x0 + (1 − t) · c passing through c and x0 . Then, Z t=1 g(x0 ) = g(c) + dg(L0 (t)) |{z} t=0 =0 (c is a critical point) Z t=1 = H(L0 (t)) L00 (t) dt | {z } t=0 =x0 −c and kg(x0 )k = which completes the proof. Z t=1 t=0 H(L0 (t))(x0 − c)dt ≤ Cmax kx − ck ≤ Cmax r, 26 Y.-C. CHEN Proof of Theorem 3. Let c be a critical point with λ = p(c). We denote δ∞ = kb pn − pk∞ . bλ , For a point y ∈ L λ ≤ pbn (y) ≤ p(y) + δ∞ ⇒ p(y) ≥ λ − δ∞ . b λ \Lλ , we have Thus, for a point y ∈ L λ > p(y) ≥ λ − δ∞ . b λ , we have Similarly, for any point y ∈ Lλ \L λ + δ∞ > p(y) ≥ λ. Thus, the set difference b λ 4Lλ ) ⊂ Dλ,∞ = {x : |p(x) − λ| ≤ δ∞ }, (L which further implies   b λ 4Lλ ≤ µ(Dλ,∞ ). µ L So we can bound the quantity µ(Dλ,∞ ) to complete the proof. Note that by the continuity of p(x) and the fact that p is a Morse function (implying no flat density region), δ∞ → 0 implies that Haus(Dλ,∞ , ∂Lλ ) → 0, where ∂Lλ = {x : p(x) = λ} is the boundary of Lλ . Thus, Lemma 16 holds when δ∞ is sufficiently small. We partition the set Dλ,∞ into two regions: An = Dλ,∞ \ B C (c, Rn ), Bn = Dλ,∞ \ B(c, Rn ), where Rn is a number that shrinks to 0 when δ∞ → 0. Later we will provide an explicit expression for Rn . We only consider the case where c is unique and is a saddle point; one can easily generalize the proof to the case of multiple critical points because p is a Morse function so every critical point is well-separated (see, e.g., Lemma 3.2 of Banyaga and Hurtubise 2013). The proof requires two simple geometric facts: • Fact 1: Let γy (t) be a curve starting from y passing through a point x at time tx . Namely, γy (0) = y and γy (tx ) = x. Then kx − yk ≤ Z 0 tx kγy0 (t)kdt, i.e, the distance between two points is less than or equal to the length of any curve connecting the two points. • Fact 2: If ∂Lλ has finite (d − 1)-dimensional volume (i.e., finite surface area), then when rn → 0, µ (∂Lλ ⊕ rn ) = O(rn ), where µ(·) is the Lebesgue measure. Note that this fact is because p is a Morse function so the level set ∂Lλ = {x : p(x) = λ} is a (d − 1) rectifiable set and thus the Minkowski content (lim→0 µ(∂L2λ ⊕) ) equals to the (d − 1)-dimensional volume. GENERALIZED CLUSTER TREES 27 For simplicity, we first consider the points in An with a density value below λ. Let x ∈ An ∩ {y : p(y) < λ} be one such point. This implies p(x) < λ. Define a density gradient (ascent) flow πx starting at x as follows: πx (0) = 0, πx0 (t) = g(πx (t)). Namely, the gradient flow πx is a flow starting at x that follows the gradient of the density function. Because this flow follows the density gradient, the density along this flow p(πx (t)) is increasing with respect to t. Let t0 be the time such that p(πx (t0 )) = λ. Then we have  Z t0  dp(πx (t)) λ − p(x) = dt dt 0 (13) Z t0 Z t0 T 0 = g (πx (t))πx (t)dt = kg(πx (t))k2 dt 0 0 because πx0 (t) = g(πx (t)) by construction. By the definition of An , λ − p(x) ≤ δ∞ so we conclude Z t0 (14) δ∞ ≥ kg(πx (t))k2 dt. 0 Now we partition the interval [0, t0 ] into TRA and TB where TA = {t : πx (t) ∈ An } and TB = {t : R πx (t) ∈ Bn }. Denote tA = TA dt and tB = TB dt as the length of TA and TB . Note that t0 = tA +tB . Using TA and TB , we rewrite equation (14) as Z t0 Z Z 2 2 (15) δ∞ ≥ kg(πx (t))k dt = kg(πx (t))k dt + kg(πx (t))k2 dt. 0 TA TB In the case of TA , by the first assertion of Lemma 16, we have a lower bound on the gradient: kg(πx (t))k ≥ Cmin Rn for some constant Cmin . Thus, Z Z 2 2 (16) kg(πx (t))k dt ≥ (Cmin Rn )2 dt = Cmin Rn2 tA . TA TA To bound TB , for simplicity we assume TB = [t∗ , t∗∗ ] (if TB contains multiple intervals, we can do the same thing for each of them). At the beginning of TB (t = t∗ ), πx (t∗ ) is on the boundary of the ball B(c, Rn ) so g(πx (t∗ )) ≥ Cmin Rn by Lemma 16. For t ∈ [t∗ , t∗∗ ], we have  Z s=t  dkg(πx (s))k2 2 2 ds kg(πx (t))k = kg(πx (t∗ ))k + ds s=t∗ Z s=t 2 2 (17) ≥ Cmin Rn + 2πx0 (s)T H(πx (s))g(πx (s))ds 2 = Cmin Rn2 + 2 s=t∗ Z s=t g T (πx (s))H(πx (s))g(πx (s))ds. s=t∗ Note that in the last equality we use the property of a gradient flow: πx0 (s) = g(πx (s)). Because πx (s) ∈ B(c, Rn ) when s ∈ [t∗ , t∗∗ ], the second assertion of Lemma 16 implies kg(πx (s))k ≤ Cmax Rn . Let kM k∗ denotes the spectral norm of the matrix M . Then 0 g T (πx (s))H(πx (s))g(πx (s)) ≥ − sup kH(y)k∗ sup kg(y)k2 ≥ −Cmax Rn2 , y y∈Bn 28 Y.-C. CHEN 0 for some constant Cmax > 0. Note that the spectral norm is bounded because of (P1) – the second derivative of p is uniformly bounded. Thus, equation (17) implies Z s=t 2 2 2 0 2 2 0 kg(πx (t))k ≥ Cmin Rn − Cmax Rn ds = Cmin Rn2 − Cmax Rn2 (t − t∗ ). s=t∗ This implies the following bound Z Z t∗∗  2 0 2 Cmin Rn2 − Cmax Rn2 (t − t∗ ) dt kg(πx (t))k dt ≥ (18) TB t∗ 2 0 = Cmin Rn2 tB − 0.5Cmax Rn2 t2B . Putting equations (16) and (18) into equation (15) and using the fact that t0 = tA +tB , we obtain Z Z kg(πx (t))k2 dt kg(πx (t))k2 dt + δ∞ ≥ ≥ = ≥ ≥ TB TA 2 2 2 2 0 Cmin Rn tA + Cmin Rn tB − 0.5Cmax Rn2 t2B 2 0 Cmin Rn2 t0 − 0.5Cmax Rn2 t2B 2 0 Cmin Rn2 t0 − 0.5Cmax Rn2 t20 0 Cmin Rn2 t0 0 for some positive constant Cmin when t0 → 0 (later we will show that this is true). This implies t0 = O(δ∞ /Rn2 ). (19) Let xλ = πx (t0 ) ∈ Lλ be the point where πx (t) intersect Lλ . By Fact 1, Z t0 kxλ − xk ≤ kπx0 (t)kdt s0 Z Z t0 t0 ≤ kπx0 (t)k2 dt 12 dt (Cauchy-Schwarz inequality) 0 sZ = 0 ≤ 0 t0 kg(πx p δ ∞ t0 (t))k2 dt Z t0 12 dt (πx0 (t) = g(πx (t))) 0 (equation (14)) = O(δ∞ /Rn ) (equation (19)). Thus, we conclude that An ∩ {y : p(y) < λ} ⊂ (∂Lλ ⊕ O(δ∞ /Rn )). Similarly, we can prove that An ∩ {y : p(y) > λ} ⊂ (∂Lλ ⊕ O(δ∞ /Rn )) by considering a gradient descent flow. So we conclude An ⊂ (∂Lλ ⊕ O(δ∞ /Rn )). Now using Fact 2 (because p is a Morse function and has bounded 4 times differentiations, ∂Lλ has a bounded surface area), we conclude µ(An ) = O(δ∞ /Rn ) 29 GENERALIZED CLUSTER TREES when δ∞ /Rn → 0. T Because Bn = Dλ,∞ B(c, Rn ) ⊂ B(c, Rn ), µ(Bn ) ≤ µ(B(c, Rn )) = O(Rnd ). Therefore, putting it altogether, we conclude   b λ 4Lλ ≤ µ(Dλ,∞ ) = µ(An ) + µ(Bn ) ≤ O(δ∞ /Rn ) + O(Rd ). µ L n 1 d+1 , we obtain Choosing Rn = δ∞  d   d+1 b , µ Lλ 4Lλ ≤ O δ∞  which is the desired rate. Note that this choice of Rn does satisfy the requirement in equation (19) d−1 d+1 that t0 = δ∞ /Rn2 = δ∞ → 0 when d ≥ 2 so we have completed the proof. Before proving Theorem 4, we first note the following lemma from Chazal et al. (2014). Lemma 17 (Lemma 16 in Chazal et al. (2014)). Let p be a density with compact support S. Assume that S is a d-dimensional compact submanifold of Rd with boundary. Assume p is a Morse function with finitely many, distinct, critical values with corresponding critical points c1 , · · · , ck . Also assume that p is twice continuously differentiable on the interior of S, continuous and differentiable with non vanishing gradient on the boundary of S. Then there exists 0 > 0 such that for all 0 <  < 0 the following is true: for some positive constant c, there exists η ≥ c such that, for any density q with support S satisfying kp − qk∞ < η, sup k∇p(x) − ∇q(x)kmax < η, sup k∇∇p(x) − ∇∇p(x)kmax < η, x x q is a Morse function with exactly k critical points c01 , · · · , c0k such that after relabeling, kc` − c0` k <  and the number of positive eigenvalues of ∇∇p(c` ) and ∇∇q(c0` ) are the same. Essentially, Lemma 17 shows that when the density, gradient, and Hessian of two functions are sufficiently close, there exists a unique 1 − 1 correspondence between critical points in the two functions. Thus, any critical point of p corresponds to a unique critical point of q. In the proof of Theorem 4, we will replace q by the KDE pbn .    b pb (x) and α(x) = P Lp(x) . The main idea Proof of Theorem 4. Recall that α bn (x) = Pbn L n for the proof is the following decomposition:     b pb (x) − P L b pb (x) α bn (x) − α(x) = Pbn L n n | {z } (A)        b pb (x) − P L b p(x) + P L b p(x) − P Lp(x) . +P L n | {z } | {z } (B) (C) 30 Y.-C. CHEN We first bound part (B) and part (C). We will use the results in these two parts to bound the case of part (A). Part (B). Because       b pb (x) − P L b p(x) | ≤ P L b pb (x) 4L b p(x) , (20) |P L n n we first investigate a more general bound on the right hand side. Let  > 0 be a small number. For b λ and L b λ+ , we want to control the quantity P (L b λ 4L b λ+ ) when  → 0. the estimated level sets L To obtain the bound in equation (20), we choose λ = p(x) and  = pbn (x) − p(x). b λ 4L b λ+ ) differs if λ is a critical value (i.e. density value of a An interesting result is that P (L critical point) or not. When λ is not a critical value, the gradient g(x) has a nonzero lower bound b λ and we have the local approximation on ∂ L b λ+ ) = d(x, L  + o() kg(x)k b λ . Thus, this implies L b λ+ ⊂ L b λ ⊕ O() and the set L b λ+ \L b λ has Lebesgue measure for each x ∈ ∂ L b O() because of the normal compatibility property and the fact that ∂ Lλ has finite d − 1 volume. As a result, b λ 4L b λ+ ) = P (L b λ+ \L b λ ) = O(). P (L (21) b λ 4L b λ+ into two subregions: When λ coincides with a critical value, we need to split the region L \ b λ 4L b λ+ ) B C (c, R ), An = (L \ b λ 4L b λ+ ) B(c, R ), Bn = (L where R0 is a nonzero constant and R is a constant converging to 0 when  → 0. This idea is similar to the proof of Theorem 3. Using the same calculation as Part An in the proof of Theorem 3, we obtain the rate    P (An ) = OP . R The other part Bn controls the area around critical points. This part contributes P (Bn ) = OP (d ). Thus, putting it all together, we have b λ 4L b λ+ ) = P (An ) + P (Bn ) P (L    + OP (Rd ) = OP R  d  = OP  d+1 (22) 1 when we choose R = O( d+1 ). √ Note that the area around the critical point is at rate . This is because the density at a critical √ point behaves quadratically, so a difference in density of  results in a difference in distance of . 1 √ In addition, the choice Rn = O( d+1 ) is obviously slower than , so equation (22) is valid. Substituting equations (21) and (22) into equation (20), we conclude that 31 GENERALIZED CLUSTER TREES • if the density at x, p(x), is not a critical value of pb,     b pb (x) − P L b p(x) = OP (|b pn (x) − p(x)|) ; P L n • if the density at x, p(x), is a critical value of pb,       d b pb (x) − P L b p(x) = OP |b d+1 P L p (x) − p(x)| . n n Finally, for a point x, the case where its density p(x) might be a critical value of pbn occurs only when (23) |p(x) − p(c)| ≤ kb pn − pk∞ + O(kb gn − gk2∞ ) = OP (kb pn − pk∞ ) for some critical point c of p. To see equation (23), first note for each critical point c of p, there exists a critical point b c of pbn that is close to c due to Lemma 17 (this is because the gradient and Hessian of pbn are close to the gradient and Hessian of p, respectively). Then by Taylor expansion c − c)T H(x)(b c − c) + OP (kb c − ck3 ) = OP (kb c − ck2 ). p(b c) − p(c) = (b c − c)T g(c) +(b |{z} =0 To bound the rate kb c − ck, note that gbn (b c) = g(c) = 0 so b n (c)(c − b gbn (c) − g(c) = gbn (c) − gbn (b c) = H c) + OP (kb c − ck2 ). b −1 (c) from the left and take the norm, we obtain Multiplying both sides by H n b n−1 (c)(b kb c − ck = H gn (c) − g(c))(1 + oP (1)) = OP (kb gn (c) − g(c)k) = OP (kb gn − gk∞ ) . Moreover, because kb gn − gk2∞ = O(h4 ) + OP  log n nhd+2  and kb pn − pk∞ = O(h2 ) + OP q log n nhd  , the log n requirement on h: h → 0, nh gn − gk2∞ = oP (kb pn − pk∞ ). Putting it altogether, d+4 → 0, implies kb |b pn (b c) − p(c)| ≤ |b pn (b c) − p(b c)| + |p(b c) − p(c)| ≤ kb pn − pk∞ + OP (kb c − ck2 ) = kb pn − pk∞ + OP (kb gn − gk2∞ ) = OP (kb pn − pk∞ ) , which proves equation (23). Recall that an is a sequence of n such that kb pn − pk∞ = o(an ). Then the above bound can be rewritten as (     OP  (|b pn (x) − p(x)|)  , if |p(x) − p(c)| > an for all c ∈ C. b pb (x) − P L b p(x) = d P L n OP |b pn (x) − p(x)| d+1 , otherwise. This bound is uniform for all x because the sequence an does not depend on x. Part (C). This part is simply applying Theorem 3, which shows that 32 Y.-C. CHEN • if the density at x, p(x), is not a critical value of p,    b p(x) − P Lp(x) = OP (kb P L pn − pk∞ ) ; • if the density at x, p(x), is a critical value of p,     d  d+1 b . P Lp(x) − P Lp(x) = OP kb pn − pk∞ Part (A). Let δ∞ = kb pn − pk∞ . It is easy to see that b pb (x) ⊂ Lpb (x)−δ . Lpbn (x)+δ∞ ⊂ L n n ∞ (24) This is because any point z ∈ Lpbn (x)+δ∞ satisfies p(z) ≥ pbn (x) + δ∞ and thus, pbn (z) ≥ p(z) − δ∞ ≥ b pb (x) . The other case can be derived similarly. Equation (24) implies pbn (x), which implies z ∈ L n b pb (x) ) ≤ P (Lpb (x)−δ ) P (Lpbn (x)+δ∞ ) ≤ P (L n n ∞ b pb (x) ) ≤ Pbn (Lpb (x)−δ ) Pbn (Lpbn (x)+δ∞ ) ≤ Pbn (L n n ∞ Now because the collection of set L = {Lλ : λ > 0} has VC dimension 1, by VC theory (see, e.g., Theorem 2.43 in Wasserman 2006), ! r log n sup |Pbn (Lλ ) − P (Lλ )| = OP . n λ Therefore, r P (Lpbn (x)+δ∞ ) + OP log n n ! r b pb (x) ) ≤ P (Lpb (x)−δ ) + OP ≤ Pbn (L n n ∞ log n n ! . This implies that r b pb (x) ) − P (L b pb (x) )| ≤ P (Lpb (x)−δ ) − P (Lpb (x)+δ ) + OP |Pbn (L n n n ∞ n ∞ log n n ! . By a similar derivation as part (B), we will obtain a similar bound as equations (21) and (22) P (Lpbn (x)−δ∞ ) − P (Lpbn (x)+δ∞ )   q  log n  OP (δ∞ ) + OP n  d  q  =  log n d+1  + OP OP δ∞ n Note that the term OP q log n n , if |b p(x) − p(c)| > δ∞ for all c ∈ C. , otherwise.  in the above bound is of a smaller order so we can ignore them. As a result, part (A) contributes b pb (x) ) − P (L b pb (x) )| |Pbn (L n n  (kb pn − pk∞ )  OP  d = d+1 OP kb pn − pk∞ , if |b p(x) − p(c)| > δ∞ for all c ∈ C. , otherwise. 33 GENERALIZED CLUSTER TREES Thus, putting it all together and using the fact that δ∞ = kb pn − pk∞ = oP (an ), we conclude that uniformly for all x,  (kb pn − pk∞ )  , if |p(x) − p(c)| > an for all c ∈ C, OP  d α bn (x) − α(x) = d+1 OP kb pn − pk∞ , otherwise. Proof of Lemma 6. Part 1: pointwise bias. Without loss of generality, we assume x ∈ K̊s . We first consider the case m(x) > 0. In this case, there is a higher-dimensional support Ks+m(x) T such that x ∈ Ks+m(x) . Thus, for any r > 0, the ball B(x, r) Ks+m(x) 6= φ. Because the kernel function K is supported on [0, 1], Z ph (x) = E (b pn (x)) = 1 K hd When h is sufficiently small, B(x, h) as  T ph (x) = kx − yk h  dP (y) = d Z X `=0 K` 1 K hd  kx − yk h  dP (y). K` = φ for any ` < s so the above expression can be rewritten d Z X K` `=s 1 K hd  kx − yk h  dP (y). T Now by the definition of m(x), B(x, r) K` = φ for every ` > s and ` < s + m(x). Thus, we can again rewrite ph (x) as   Z 1 kx − yk dP (y) ph (x) = K d h Ks h   Z d X 1 kx − yk + dP (y) K h hd `≥s+m(x) K`   Z 1 kx − yk = K dP (y) (25) T d h Ks B(x,h) h | {z } (I) d X + Z `≥s+m(x) K` | T B(x,h) 1 K hd {z (II)  kx − yk h  dP (y) . } Using the generalized density on the s-dimensional support, the first term equals   Z 1 kx − yk (I) = K dP (y) T d h Ks B(x,h) h   (26) Z 1 kx − yk = K ρ(y)dy, T d h Ks B(x,h) h 34 Y.-C. CHEN where dy is integrating with respect to s-dimensional areas (strictly speaking, it should be written as a differential s-form but here we write dy for simplicity). Because we assume that ρ(x) is at least three-times bounded differentiable, for any y ∈ Ks that is close to x, we have ρ(y) = ρ(x) + (y − x)T gs (x) + (y − x)T Hs (x)(y − x) + o(kx − yk2 ), where gs and Hs are the generalized gradient and Hessian matrix on Ks , respectively (see Section 2.3 of the main paper). By substituting this into equation (26) and using the fact that K(kxk) is symmetric and Ks is an s-dimensional manifold, we obtain   Z 1 kx − yk K ρ(y)dy (I) = T d h Ks B(x,h) h Z 1 = K (kuk) ρ(x)du · hs T d x+uh∈Ks B(x,h) h  s+2  Z 1 h T s+2 K (kuk) u Hs (x)udu · h +o + T d hd x+uh∈Ks B(x,h) h  s+2  Z 1 h = ρ(x) · K (kuk) du · hs + O . T d hd x+uh∈Ks B(x,h) h Note that again in the above integration, du is integrating with respect to s-dimensional area (again, it is actually a differential s-form). Because Ks has positive reach, Ks around x changes smoothly (if the reach is χ, we can move a ball with radius χ smoothly T over every point in Ks ). This further implies that when  → 0, the (s-dimensional) area of Ks B(x, ) and the area of Bs (0, ) are similar in the sense that T Vols (Ks B(x, )) = 1 + O(2 ), Vols (Bs (0, )) where Vols (A) is the s-dimensional volume of the set A. Thus, we have Z Z 1 K (kuk) du = K (kuk) du(1 + O(h2 )) = † (1 + O(h2 )). T Cs x+uh∈Ks B(x,h) Bs (0,1) Using this and the fact that τ (x) = s, the quantity (I) equals (I) = 1 Cs† hs−d ρ(x) + O(hs−d+2 ) = 1 Cτ†(x) hτ (x)−d ρ(x) + O(hτ (x)−d+2 ). T Now we bound the second quantity (II). Because the set K` B(x, h) has `-dimensional volume O(h` ),   Z Z   kx − yk 1 1 `−d K dP (y) ≤ K(0)ρ dy = O h . max T d h hd K` T B(x,h) K` B(x,h) h In addition, the smallest possible ` is ` = s + m(x). Using this and the bound on (I), we get 1 hs−d ρ(x) + O(hs−d+2 ) + O(hs−d+m(x) ) Cs† 1 = † hτ (x)−d ρ(x) + O(hτ (x)−d+2 ) + O(hτ (x)−d+m(x) ). Cτ (x) ph (x) = 35 GENERALIZED CLUSTER TREES Therefore, by multiplying both sides by Cs† hd−τ (x) , we obtain Cτ†(x) hd−τ (x) · ph (x) = ρ(x) + O(h2 ) + O(hm(x) ), which proves the first assertion. Note that if m(x) = 0, we will not have the second term (II), so there is no dimensional bias O(hm(x) ). Part 2: Failure of uniform convergence ofTthe bias. Without loss of generality, let (s, `) be the two lower T dimensional supports such that K` Ks 6= φ and s < `. Let x ∈ K` Ks be a point on Ks . Then by the first assertion, we have Cs† hd−s · ph (x) = ρ(x) + O(h2 ) + O(hm(x) ). Now, consider a sequence T of points where h → 0: {xh ∈ K` : kxh − xk ≤ h2T }. We can always find such a sequence because K` Ks 6= φ. For such a sequence, the set B(xh , h) Ks converges to the T set B(x, h) Ks in the sense that T T P ((B(xh , h) Ks )4(B(x, h) Ks )) T →0 P (B(x, h) Ks ) when h → 0. This is because the distance between the centers of the two balls shrinks at rate h2 but the radius of the ball shrinks at rate h. † d−s h) Thus, pphh(x · ph (xh ) → ρ(x) so (x) → 1 when h → 0. This implies that Cs h Cτ†(xh ) hd−τ (xh ) · ph (xh ) = C`† hd−` · ph (xh ) = C`† Cs† hs−` · Cs† hd−s · ph (xh ) | {z } →ρ(x) diverges (since ` > s so hd−` diverges). Thus, we do not have uniform convergence for the bias. Before we proceed to the proof of Theorem 8, we first derive a useful lemma about the variance of the KDE. Assume (S, P2, K1–2). Then for x ∈ K(h),   1 Var(b pn (x)) = O , nh2d−τ (x)   1 d−τ (x) Var(Cτ (x) h · pbn (x)) = O . nhτ (x) Lemma 18 (Pointwise variance). Proof. Without loss of generality, let x ∈ Ks (h). This implies that B(x, h) ∩ K` = φ for all 36 Y.-C. CHEN ` < s. By definition, Var(b pn (x)) = E(b pn (x) − E(b pn (x)))2    !2 n   kXi − xk kXi − xk 1 X K −E K =E h h nhd i=1      ! n  X 1 kX − xk kX − xk i i = 2 2d E K2 − n E2 K h h n h i=1    kX1 − xk 1 ≤ E K2 2d h nh   Z 1 2 ky − xk dP (y) = K h nh2d B(x,h)   Z 1 X 2 ky − xk = K ρ(y)dy h nh2d `≤s B(x,h)∩K` Z 1 X K 2 (kuk)ρmax du · h` ≤ nh2d `≤s x+uh∈B(x,h)∩K`  s    h 1 =O =O . nh2d nh2d−s Note that dy is integrating with respect to s-dimensional area and in the last inequality, we use the transform y = x + uh. Because x + uh has to be on K` , the change of variable gives dy = du · hs (the reason why we have hs is because both dy and du are differential s-form). The above derivation is for the case x ∈ Ks (h) so τ (x) = s. This proves the first assertion and the second assertion follows trivially from the first. Proof of Theorem 8. Without loss of generality, we pick a point x ∈ Ks (h). The difference has the following decomposition: (27) Cs† hd−s · pbn (x) − ρ(x) = Cs† hd−s · (b pn (x) − ph (x)) + Cs† hd−s · ph (x) − ρ(x). The former part is the stochastic variation and the latter part is the bias. The bias is uniformly controlled by Lemma 6: V Cs† hd−s · ph (x) − ρ(x) = O(h2 mmin ). Thus, all we need is to control the stochastic variation. It is well known that the quantity |b pn (x)−ph (x)| can be written as an empirical process (Einmahl and Mason, 2005; Giné and Guillou, 2002) and to control the supremum of the empirical process supx∈Ks Cs hd−s · |b pn (x) − ph (x)|, we need to uniformly bound the variance. By Lemma 18, the variance is uniformly bounded at rate O nh1 s . Therefore, by the assumption (K2) and applying Theorem 2.3 in Giné and Guillou (2002), we have ! r log n sup Cs† hd−s · (b pn (x) − ph (x)) = OP , nhs x∈Ks (h) 37 GENERALIZED CLUSTER TREES which together with the bias term proves the desired result for density estimation. The case of the gradient and the Hessian can be proved in a similar way as the density estimation case so we ignore the proof. The only difference is that the stochastic part has variance nh1s+2 and 1 . The extra +2 and +4 in the power of h come from taking the derivatives. nhs+4 Proof of Theorem 9. Recall that α bn (x) = 1 − Pbn ({y : pbn (y) ≥ pbn (x)}). Now we consider a modified version b n (x)), α en (x) = 1 − P ({y : pbn (y) ≥ pbn (x)}) = 1 − P (Ω b n (x) = {y : pbn (y) ≥ pbn (x)} = L b pb (x) . The idea of the proof is to bound |b where Ω αn (x) − α en (x)| first n and then bound |e αn (x) − α(x)|. Part 1: Bounding |b αn (x)− α en (x)|. This part can be bounded by a similar derivation as part (A) in the proof of Theorem 4. Here we just highlight the difference. First, instead of using Lpbn (x)+δ∞ ⊂ b n (x) = L b pb (x) ⊂ Lpb (x)−δ , we use Ω n n ∞ b n (x) = L b pb (x) ⊂ Aαb (x)−δ Aαbn (x)+δn,h,s ⊂ Ω ∪ KC (h). n n n,h,s (28) b pb (x)) in equation (28) can be derived as follows. For any The first inclusion (Aαbn (x)+δn,h,s ⊂ L n y ∈ Aαbn (x)+δn,h,s , by its definition α(y) ≥ α bn (x) + δn,h,s . Thus, α bn (y) ≥ α(y) − δn,h,s ≥ α bn (x). b αb (x) = L b pb (x) , which proves the first inclusion. To prove the second inclusion (L b pb ⊂ Thus, y ∈ A n n n b pb (x) ∩ KC (h), then this is automatically true so we focus Aαbn (x)−δn,h,s ∪ KC (h)), note that if y ∈ L n b pb (x) \K(h) (namely, y ∈ L b pb and is in good regions). y ∈ L b pb (x) implies pbn (y) ≥ pbn (x), on y ∈ L n n n which further implies α bn (y) ≥ α bn (x). Moreover, because y ∈ KC (h) (no contribution from a lower dimension manifold), Theorem 9 implies α(y) ≥ α b (y) − δn,h,s ≥ α bn (x) − δn,h,s , |{z} n |{z} y∈KC (h) b pb (x) y∈L n which further implies y ∈ Aαbn (x)−δn,h,s . This proves the second inclusion and equation (28). Because the set A1 = {A$ : $ ∈ [0, 1]} and A2 = {A$ ∪ KC (h) : $ ∈ [0, 1]} both have VC dimension 1, again we apply the VC theory (see, e.g., Theorem 2.43 in Wasserman 2006) to bound ! r log n |Pbn (Aαbn (x)+δn,h,s ) − P (Aαbn (x)+δn,h,s )| = OP n ! r log n |Pbn (Aαbn (x)−δn,h,s ∪ KC (h)) − P (Aαbn (x)−δn,h,s ∪ KC (h))| = OP . n 38 Y.-C. CHEN Finally, Lemma 19 implies P (KC (h)) = O(h2 V mmin ) and thus, P (Aαbn (x)−δn,h,s ∪ KC (h)) − P (Aαbn (x)+δn,h,s ) ≤ P (Aαbn (x)−δn,h,s ) − P (Aαbn (x)+δn,h,s ) + P (KC (h)) = P (Aαbn (x)−δn,h,s ) − P (Aαbn (x)+δn,h,s ) + O(h2 V mmin ). By definition of the α-level set A$ = {y : α(y) ≥ $}, P (A$ ) = 1 − $ (except for the case that x ∈ K0 is located at a point mass; but this will be a trivial case that the result holds). Therefore, P (Aαbn (x)−δn,h,s ) − P (Aαbn (x)+δn,h,s ) = 2δn,h,s . Putting all these elements into the part (A) of the proof of Theorem 4, we conclude that ! r V log n b n (x)) − P (Ω b n (x))| = 2δn,h,s + OP + O(h2 mmin ) = O(δn,h,s ). |Pbn (Ω n Part 2: Bounding |e αn (x) − α(x)|. By definition of α(x), 1 − α(x) (29) = P ({y : α(y) ≥ α(x)})   [ = P {y : τ (y) < τ (x)} {y : τ (y) = τ (x), ρ(y) ≥ ρ(x)} = P ({y : τ (y) < τ (x)}) + P ({y : τ (y) = τ (x), ρ(y) ≥ ρ(x)}) = P (Ω(x)) + P (D(x)), where Ω(x) = {y : τ (y) < τ (x)} and D(x) = {y : τ (y) = τ (x), ρ(y) ≥ ρ(x)}. We define E(x) = {y : τ (y) = τ (x), ρ(y) < ρ(x)} and Φ(x) = {y : τ (y) > τ (x)}, and then Ω(x), D(x), E(x), Φ(x) form a partition of K. Using the fact that Ω(x), D(x), E(x), Φ(x) is a partition of K, we bound the difference   b n (x)4(Ω(x) ∪ D(x)) |α(x) − α en (x)| = P Ω     b n (x) + P Ω b n (x)\(Ω(x) ∪ D(x)) = P (Ω(x) ∪ D(x))\Ω   b n (x) = P Ω(x)\Ω     b n (x) + P Ω b n (x) ∩ (E(x) ∪ Φ(x)) + P D(x)\Ω     b n (x) + P D(x)\Ω b n (x) = P Ω(x)\Ω (30)     b n (x) ∩ E(x) + P Ω b n (x) ∩ Φ(x) +P Ω       b n (x) ∩ K(h) + P b n (x) ∩ K(h) ≤ P Ω(x)\Ω D(x)\Ω | {z } | {z } (I) (II)    b n (x) ∩ E(x) ∩ K(h) + P Ω b n (x) ∩ Φ(x) ∩ K(h) + P (KC (h)) . +P Ω | {z } | {z } | {z }  (III) (IV) (V) GENERALIZED CLUSTER TREES 39 Our approach is to first control (I) and (IV) and then control (II) and (III). Note that Lemma 19 controls the quantity (V): (V ) ≤ O(h2 (31) V mmin ). Bounding (I) and (IV). Without loss of generality, we consider x ∈ Ks (h). Given a point x ∈ Ks (h), the contribution (I) is from a lower dimensional support, say y ∈ K` (h) with ` < s, such that α(y) > α(x) but pbn (x) < pbn (y). Namely, we wrongly estimate their ordering. The contribution (IV) is in a similar manner but it is for points in a higher dimensional support. The idea of bound log n these two components is that we will show that when h → 0, nh d+2 → 0, these two components do d not contribute at all with an overwhelming probability (a probability > 1 − A1 e−A2 ·nh → 1 for some A1 , A2 > 0). For any point inside Ks (h), the quantity ! r V log n . (32) δn,h,s = sup |Cs† hd−s · pbn (x) − ρ(x)| = O(h2 mmin ) + OP nhs x∈Ks (h) Therefore, pbn (x) ≤ ρ(x) + δn,h,s Cs† hd−s uniformly for every x ∈ Ks (h). Similarly, for any y ∈ K` (h) with ` < s, we obtain pbn (y) ≥ ρ(y) − δn,h,` C`† hd−` . Therefore, (33) C † ρmax + δn,h,s pbn (x) ≤ hs−` · `† · , bn (y) Cs ρmin − δn,h,` y∈K` (h) x∈Ks (h) p sup sup where ρmax and ρmin is the maximum and minimum Hausdorff density (across various support) from assumption (P2). Note that if the right-hand-side (33) is less than 1, then pbn (y) > pbn (x) for every y ∈ K` (h) and x ∈ Ks (h). Namely, we will be able to separate points in different dimensional supports if these points are in the good region K(h) and equation (33) is less than 1. Thus, when (34) max hs−` · `<s C`† ρmax + δn,h,s · < 1, Cs† ρmin − δn,h,` we have pbn (y) > pbn (x), ∀y ∈ K` (h), x ∈ Ks (h), ` < s. Because Ω(x) ∩ K(h) is the regions within K(h) that is inside a lower dimensional support compared to the point x, equation (34) implies   b n (x) ∩ K(h) = ∅ Ω(x)\Ω 40 Y.-C. CHEN    b n (x) ∩ K(h) = 0. A good news is that when h is sufficiently small, equation (34) and P Ω(x)\Ω holds whenever 1 max δn,h,` < ρmin `≤s 2 (note that the upper bound 12 ρmin is just a convenient choice). Since δn,h,` is just the supremum deviation of the KDE at the `-dimensional support, by Assumption (K2) and Talagrand’s inequality (Giné and Guillou, 2002; Einmahl and Mason, 2005), when h → 0, ` P (δn,h,` < ρmin ) ≥ 1 − A1 e−A2 ·nh for some constants A1 , A2 > 0 (possibly depending on `). Thus,   1 s P max δn,h,` < ρmin ≥ 1 − A3 e−A4 ·nh `≤s 2 for some constants A3 , A4 (possibly depending on s). Therefore, when nhs → ∞ (our assumption on h implies this),    b n (x) ∩ K(h) = 0 P Ω(x)\Ω s with a probability greater than or equal to 1 − A3 e−A4 ·nh → 1. Namely, quantity (I)= 0 with an overwhelming probability. Thus, we can ignore the contribution from (I). The similar analysis also holds for the case of (IV) since (IV) is also a contribution from wrongly estimating the probability from a different dimensional support. Note that in this case, (IV)= 0 when maxs≤` δn,h,` < 21 ρmin , which has a probability   1 d P max δn,h,` < ρmin ≥ 1 − A5 e−A6 ·nh , s≤` 2 for some constant A5 , A6 > 0. Thus, the requirement on h also implies that such a probability bound converges toward 1 extremely fast. Therefore, the contribution from both (I) and (IV) are 0 with an overwhelming probability so we can ignore them (their contribution will be of the order d OP (1 − A5 e−A6 ·nh ), which is much smaller than the other components). Bounding (II) and (III). We consider cases of (II) and (III) together. Again, we consider x ∈ Ks . Recall that bounds (II) and (III) are the probabilities within the regions   b n (x) ∩ E(x) ∩ K(h). b n (x) ∩ K(h), Ω D(x)\Ω Now define the region Ψ(x; h) = {y : τ (y) = τ (x)} ∩ K(h). Thus, we have    b n (x)4Ω(x) ∩ Ψ(x; h) (II) + (III) ≤ P Ω   (35) b n (x) ∩ Ψ(x; h))4(Ω(x) ∩ Ψ(x; h)) . = P (Ω The event b n (x) ∩ Ψ(x; h) = {y ∈ K(h) : pbn (y) ≥ pbn (x), τ (y) = τ (x), x ∈ K(h)} Ω  = y ∈ K(h) : Cs† hd−s · pbn (y) ≥ Cs† hd−s · pbn (x), τ (y) = τ (x) = s, x ∈ K(h) , 41 GENERALIZED CLUSTER TREES which can be viewed as the estimated density upper level set at level pbn (x) of the support Ks (h) (because τ (x) = s). Similarly, Ω(x) ∩ Ψ(x; h) is just the upper level set at level ρ(x) of the support Ks (h). Therefore, the difference can be bounded by Theorem 4: (II) + (III) ≤ ( O (δn,h,s ) , O (δn,h,s ) inf c∈Cs |p(x) − p(c)| > rn,h,s if s s+1  , otherwise , where rn,h,s is a deterministic quantity such that δn,h,s = oP (rn,h,s ). Thus, putting the above bound and equation (31) into equation (30), we have |α(x) − α en (x)| ≤ (I) + (II) + (III) + (IV ) + (V ) V ≤ O(h2 mmin ) ( O (δn,h,s ) ,  s + O (δn,h,s ) s+1 , ( O (δn,h,s ) ,  s = O (δn,h,s ) s+1 , inf c∈Cs |p(x) − p(c)| > rn,h,s if otherwise if inf c∈Cs |p(x) − p(c)| > rn,h,s otherwise , which, along with the fact that |b αn (x) − α en (x)| = O (δn,h,s ), proves the desired result. Before we move on to the proof of Theorem 10, we first give a lemma that quantifies the size of good regions. Lemma 19 (Size of good region). Assume (S, P2, K1–2). Define mmin from equation (9) of the main paper and m∗min = d − max{s < d : Ks ∩ Kd 6= ∅}. Let µ be the Lebesgue measure. Then ∗ µ(KC (h)) = O(hmmin ), P (KC (h)) = O(hmmin ). Proof. Case of the Lebesgue measure. By assumption (S), all supports Ks have Lebesgue measure µ(Ks ) = 0 except Kd . Thus, µ(KC (h)) = µ(KC d (h)). By the definition of m∗min , the quantity d−m∗min = max{s < d : Ks ∩Kd 6= ∅} denotes the support with the largest dimension that intersects the closure of Kd . Note that for any two compact sets A, B with dimensions d(a) and d(b) such that d(b) > d(a) and A ∩ B 6= φ, then the d(b)-dimensional Lebesgue measure (36) B ∩ (A ⊕ r) = O(rd(b)−d(a) ) 42 Y.-C. CHEN ∗ when r → 0. Thus, the set µ(Kd ∩ (Kd−m∗min ⊕ h)) shrinks at rate O(hmmin ). S S Recall that Kd (h) = Kd \( `<d K` ⊕ h) and KC d (h) = ( `<d K` ⊕ h). Because only sets in Kd have nonzero Lebesgue measure, we have C µ(KC d (h)) = µ(Kd (h) ∩ Kd ) = µ Kd ∩ ( [ ! K` ⊕ h) `<d   = µ Kd ∩ ( [ `≤d−m∗min K` ⊕ h) d−m∗min ≤ X µ (Kd ∩ (K` ⊕ h)) `=0 m∗min = O(h ∗ ) + o(hmmin ), which proves the first assertion. Case of the probability measure. The case of the probability measure is very similar to that of Lebesgue measure, but now we also need to consider lower-dimensional supports because of the singular probability measure. First, we expand the probability of bad regions by the following: P (KC (h)) = 1 − P (K(h)) [ = 1 − P ( K` (h)) `≤d =1− (37) =1− = d X `=0 = d X d X P (K` (h)) `=0 d X !! P `=0 K` \ [ s<` Ks ⊕ h !! P (K` ) − P K` \ [ Ks ⊕ h s<` !! P `=0 K` \ [ s<` Ks ⊕ h . Note that we use the fact that P (A) − P (A\B) = P (A ∩ B) in the last equality. We will show that !! \ [ (38) P K` Ks ⊕ h = O(hmmin ). s<`  T S for every `. For simplicity, we define KC s<` Ks ⊕ h . ` (h) = K` Without loss of generality, we consider the support K` and KC ` (h). For simplicity, by the definition of mmin , the largest lower-dimensional support that intersects the closure K` has a dimension lower GENERALIZED CLUSTER TREES 43 than or equal to K`−mmin . Note that if ` < mmin , it is easy to see that there will be no other lower dimensional support intersecting K` , so K` (h) = K` and there is nothing to prove. Thus, the set KC ` (h) can be rewritten as   \ [  KC Ks ⊕ h ` (h) = K` s≤`−mmin By equation (36), the `-dimensional Lebesgue measure µ` on the set KC ` (h) is at rate  mmin µ` KC ) + o(hmmin ). ` (h) = O(h By assumption (P2), the `-dimensional Lebesgue measure on K` implies that bound on the probability measure, so we have  mmin P KC ). ` (h) = O(h Because this works for every `, by equations (37) and (38), we have P (KC (h)) = O(hmmin ), which proves the result. Proof of Theorem 10. We first note that it is easy to see that m∗min ≥ mmin , so the rate of the integrated error is bounded by that of the probability error. Thus, we only prove the case for the probability error here. Because K0 , · · · , Kd form a partition of K, we separately analyze the probability error at each K` and then join them to get the final bound. For a support K` , we partition it into three subregions A, B, and C, where A = KC ` (h) = K` \K` (h) B = K` (h) ∩ {x : min |ρ(x) − ρ(c)| ≤ rn,h,s } (39) c∈Cs C = K` (h) ∩ {x : min |ρ(x) − ρ(c)| > rn,h,s }, c∈Cs h2 V mmin + log n δ nhs where rn,h,s = satisfies the requirement rn,h,s = oP (1). log n n,h,s m min Case A. By Lemma 19, P (A) = O(h ) and |b α(x) − α(x)| ≤ 1. Thus, Z (40) |b αn (x) − α(x)|dP (x) = O(hmmin ). A Case B. For set B, note that the generalized density ρ(x) behaves quadratically around critical points. in the difference in distance at √ So a difference in density level at rate δ results in a change √ rate δ. Thus, the `-dimensional Lebesgue measure µ` (B) = O( rn,h,s ), which by assumption (P2) s √ s+1 implies P (B) = O( rn,h,s ). By Theorem 9, |b αn (x) − α(x)| = δn,h,s uniformly for all x ∈ B. Thus, the error is Z  √ s s+1 (41) |b αn (x) − α(x)|dP (x) = O rn,h,s · δn,h,s . B 44 Y.-C. CHEN Case C. For points in this region, directly applying Theorem 9 yields Z (42) |b αn (x) − α(x)|dP (x) = O (δn,h,s ) . C By adding up equations (40), (41), and (42) and using the fact that O(hmmin ) are part of δn,h,s , we obtain Z (43) |b αn (x) − α(x)|dP (x) = O (δn,h,s ) . √ s s+1 = o(δn,h,s ) and rn,h,s · δn,h,s K` This works for every K` , which proves the desired bound. Proof of Lemma 11. First assertion. By assumption (B) and (P2), the first assertion is trivially true because when we move down the level α, the only situation that creates a new connected component is when α passes through the α-level of a local mode. Second assertion. For level sets, there are only two situations where a change in topology may occur: creation of a new connected component, and merging of two (or more) connected components. By the first assertion, we only need to focus on the merging case. Assume $ ∈ A be a level where only merging of connected components occurs. In addition, recall that ξ($) is the integer such that Ks ⊂ A$ for all s ≤ ξ(α) and Kξ($)+1 6⊂ A$ . For a sufficiently small , the difference between A$ and A$+ is in Kξ($)+1 . Thus, when we move  down, only the connected components in Kξ(α)+1 expand. When merging occurs, there are only two cases: two connected components in Kξ($)+1 meet each other or a connected component in Kξ($)+1 hits a lower-dimensional support. Note that there is no higher-dimensional supports in A$ because their ordering is less than any point in Kξ($) . The first case corresponds to a saddle point, which is an element in C. The second case corresponds to a DCP. Thus, $ must be either an α-level of a critical point or a DCP. Proof of Lemma 12. Critical points. Without loss of generality, let c be a critical point of ρ(x) on Ks . Recall that ph = E(b pn ) is the smoothed density function and gh = ∇ph and Hh = ∇∇ph are the corresponding gradient and Hessian. (2) The idea of the proof is to argue that when δn,h,s → 0, we can always find a critical point b c of pbn and a critical point ch of ph such that   1 kb c − ch k = OP , kch − ck = O(h). nhs+2 Then we use the triangle inequality to bound kb c − ck. Before we go to the details, we first define a useful set: e s (h) = {x : x ∈ Ks ⊕ h, x ∈ K / K` ⊕ h, ` < s} = (Ks ⊕ h)\ [ `<s (K` ⊕ h). e s is the regions around Ks but away from a lower dimensional support (K e s is thicker The set K than the ‘good region’ Ks ; Ks does not include regions around Ks ). Assumption (C) implies that 45 GENERALIZED CLUSTER TREES e s (h) when h is sufficiently small. Note that any point x ∈ K e s has a distance to Ks less than h, c∈K i.e., supx∈Ke s d(x, Ks ) ≤ h. Using the same bias analysis of ph in Lemma 6, one can prove that when h→0 (44) sup hd−s max {ph (x), kgh (x)kmax , kHh (x)kmax } ≤ U0 e s (h) x∈K e s (h), for some fix constant U0 . An intuitive explanation for Equation (44) is that within the set K the support Ks is the dominating structure (lowest dimensional support) so the smoothed version of these quantities will be diverging at the rate O(hs−d ). Rescaling them by O(hd−s ) will uniformly bound all of them (this is the same idea as Lemma 6). e s (h): when nhs+4 → ∞ In addition to equation (44), there is another useful fact about the region K log n and h → 0, ! r log n sup hd−s |b pn (x) − ph (x)| = OP nhs e s (h) x∈K ! r log n d−s sup h kb gn (x) − gh (x)kmax = OP (45) nhs+2 e s (h) x∈K ! r log n b n (x) − Hh (x)kmax = OP . sup hd−s kH nhs+4 e x∈Ks (h) The proof of these quantity follows the same way as the proof of Lemma 18 and Theorem 8. √ Moreover, the log n factor will disappear in equation (45) if the bound is taken for a given point (or a fixed sequence of points). We first show that kch − ck = O(h). When h → 0, we can always find a critical point ch of ph such that ch → c (because ph is essentially a smoothed version of the singular measure). Note that such a point ch serves as an ‘approximation’ of c in the function ph . Moreover, d(ch , Ks ) < h because regions outside h distance of Ks will not be affected by Ks . For any point x ∈ K, let πs (x) ∈ Ks be the projection from x onto Ks . Because Ks has positive reach, the projection πs (ch ) will be unique when h is less than the reach of Ks . Note that the fact that d(ch , Ks ) < h implies d(ch , πs (ch )) = d(ch , Ks ) < h. By assumption (C), there is a fixed distance between c and any lower dimensional support so πs (ch ) ∈ Ks (h) when h is sufficiently small (namely, the projected point will be in the good region). e s (h) Because d(ch , πs (ch )) < h and the (scaled) Hessian Cs† hd−s Hh is uniformly bounded within K (equation (44)), Taylor theory implies Cs† hd−s k gh (ch ) −gh (πs (ch ))kmax = O(kch − πs (ch )k) = O(h). | {z } =0 Note that gh (x) = ∇ph (x) so kgh (x)kmax ≥ k∇Ts (x) ph (x)kmax (recall that ∇Ts (x) is the gradient with respect to the tangent space so it has fewer degree of freedom than ∇). Thus, Cs† hd−s kgh (πs (ch ))kmax = O(h) ≥ kCs† hd−s ∇Ts (πs (ch )) gh (πs (ch ))kmax = k∇Ts (πs (ch )) ρ(πs (ch ))kmax + O(h2 V mmin ). 46 Y.-C. CHEN Note that the last equality is from Theorem 8. Because mmin ≥ 1, the above inequality further implies k∇Ts (πs (ch )) ρ(πs (ch ))kmax = O(h). (46) When h → 0, region on Ks with a low gradient of ρ(x) must be around a critical point since ρ on Ks is a Morse function (assumption (P2)). Because the eigenvalues of the Hessian of ρ(x) at c is uniformly bounded away from 0 (an natural outcome of a Morse function), the gradient changes linearly around c. As a result, equation (46) implies kπs (ch ) − ck = O(h). This, together with the fact that kπs (ch ) − ch k = O(h), q further implies that kch − ck = O(h).  1 e To prove that kb c − ch k = OP s+2 , by equation (45) the gradient of any point x ∈ Ks (h) is nh r hd−s (b gn (x) − gh (x)) = OP 1 nhs+2 ! . Plugging-in x = ch into the above equality and using equation (45), we obtain   ! r 1 hd−s gbn (ch ) − gh (ch ) = OP | {z } nhs+2 =0   = hd−s gbn (ch ) − gbn (b c) | {z } =0 d−s b h (ch )(ch − b =h H c) + OP (kch − b ck2 ) !! r log n = hd−s Hh (ch ) + OP (ch − b c) + OP (kch − b ck2 ) nhs+4 | {z } by (45) = hd−s Hh (ch )(ch − b c) + oP (kch − b ck). Since all eigenvalues of hd−s Hh (ch ) are uniformly bounded away from 0 when h → 0 (this follows fromq the fact that ρ(x) is a Morse function and K (2) (0) < 0), its inverse exists so kch − b ck = OP 1 s+2 q nh  . Thus, putting it altogether we obtain kb c − ck ≤ kch − b ck + kch − ck = O(h) + 1 OP , which proves the stability of critical points. nhs+2 Critical levels. To derive the rate of |b αn (b c) − α(c)|, we decompose it into |b αn (b c) − α(c)| ≤ |b αn (b c) − α bn (c)| + |b αn (c) − α(c)|. Because the KDE around b c behaves quadratically, i.e., for any µ ∈ Rd such that kµk is small, 2 pbn (b c + µ) − pbn (b c) = OP (kµ k) and thus    1 2 2 |b αn (b c) − α bn (c)| = O kb c − ck = O(h ) + OP , nhs+2 47 GENERALIZED CLUSTER TREES  s  s+1 which is dominated by the second term |b αn (c) − α(c)| = O δn,h,s (by Theorem 9). Thus, the  s  s+1 convergence rate is |b αn (b c) − α(c)| = O δn,h,s . Eigenvalues. For the eigenvalues, it is easy to see that when we are moving away from c along a direction that is normal to Ks , the estimated density is going down. Thus, these (d − s) directions must have negative eigenvalues (dimension of the normal subspace is d − s). In addition, the original generalized Hessian matrix at c has n(c) negative eigenvalues. So the total number of negative eigenvalues of the Hessian matrix of pbn at c is n(s) + d − s. Because b c is converging to c, the sign of negative eigenvalues also converges, which proves the lemma. Proof of Lemma 13. First assertion: Location of DCPs. By Theorem 8, the scaled KDE is uniformly consistent in both density estimation and gradient estimation in the good region K(h). (2) P The estimated DCPs are points satisfying ∇b pn (x) = 0. Therefore, when δn,h,d → 0, the only areas in K(h) such that ∇b pn (x) = 0 will be regions where ∇Tτ (x) (x) ρ(x) is small. This can only be the regions around the generalized critical points. As a result, we cannot have any DCPs within K(h) (2) P when δn,h,d → 0. Second assertion: Number of estimated critical points. This follows directly from Lemma 14 P (2) and Assumption (A) and from the fact that δn,h,d → 0. Third assertion: No local modes. By assumption (B), the only case where the creation of a connected component occurs is a (generalized) local mode. These population local modes correspond b Thus, any estimated local mode in D b does not have a population target so they are to elements in C. away from the population local modes and by first assertion, it has to be in the bad region KC (h). It is easy to see that we cannot have any estimated local mode under such a constraint when we P (2) have the gradient and Hessian consistency of the scaled KDE (δn,h,d → 0). Proof of Lemma 14. Let c be a DCP and $0 (c) be the corresponding α-level of merging. By assumption (A), c is a unique point for α0 (c) ∈ D and for any sufficiently small , there is a unique connected component C ∈ A$0 (c)+ and a support K` with ` ≤ ξ($0 (c)) such that x ∈ K` , c ∈ / C and d(c, C ) → 0 when  → 0. The idea of the proof is to find $ b + and $ b − such that the merging has not yet happened in the b n (b c) lies set A$ b + but the merging has happened in the set A$ b − . Then we know the actual value $ , A ]. within the interval [A$ − + b $ b Case: Lower bound. By Theorem 9, any point y ∈ K(h) satisfies |b αn (y) − α(y)| = δn,h,τ (y) . Thus, for any C defined as the connected component within A$0 (x)+ that is about to merge with K` , inf α bn (y) > $0 (x) − δn,h,ξ($0 (c))+1 . y∈C This is because inf y∈C α(y) ≥ $0 (c) by definition and for C ∩ K(h), we have the uniform bound from Theorem 9. For y ∈ C \K(h), the estimated α bn (y) will be influenced by K` , which is a lower dimensional support. So the estimated α value will be more than $0 (c) − δn,h,ξ($0 (c))+1 . Thus, we can pick the lower bound Aba− = $0 (c) − δn,h,ξ($0 (c))+1 . Case: Upper bound. To prove the upper bound, the idea is very simple. We show that when b $0 will not contain the set C e` ⊕ h where c ∈ C e` and C e` is a connected the α-level is high enough, A 48 Y.-C. CHEN component of A$0 . e` be defined as above. Because C e` is a subset of S Ks , the set C ∩ (C e` ⊕ h) is always Let C s≤` V C C 2 m e` ⊕ h)) ≤ P (K (h)) = O(m min ) by Lemma 19. within the bad region K (h). Thus, P (C ∩ (C e e e` ⊕ h)) ≤ NowV we consider the boundary ∂(C` ⊕ h) = {x : d(x, C` ) = h}. Because P (C ∩ (C 2 m min ), O(m V sup α(x) ≤ $0 (c) + O(m2 mmin ). e` ⊕h) x∈∂(C e` ⊕ h) we can apply Theorem 9 to bound α Moreover, outside the boundary ∂(C bn (x) − α(x). Thus, sup e` ⊕h) x∈∂(C α bn (x) ≤ $0 (c) + O(m2 V mmin ) + δn,h,ξ($0 (c))+1 . V V 2 mmin )+δ 2 mmin ) This suggests that A$ n,h,ξ($0 (c))+1 = a0 +δn,h,ξ($0 (c))+1 because O(m b + = a0 +O(m is part of the term δn,h,ξ($0 (c))+1 . Thus, the quantity α bn (b c) must lie within a0 ± δn,h,ξ($0 (c))+1 , which is the desired bound. Because there is a topological change in the upper level set for pbn at such α bn (b c), b c must be a critical point of pbn . This completes the proof. Proof of Theorem 15. The main idea is to show that there exists a constant a0 > 0 such that (47) max T (j) max |δn,h,s | < a0 =⇒ Tαbn ≈ Tα . j=0,1,2 s=0,··· ,d (0) Note that δn,h,s = δn,h,s . By assumption (A), there exists a constant a1 = min{|α1 − α2 | : α1 , α2 ∈ A, α1 6= α2 } > 0. Without loss of generality, let the elements in A be α1 > α2 > · · · > αm (assume A has m elements) and c(αj ) be the corresponding critical point or DCP for level αj . By Lemma 12 and 14, we can find a sequence of points b c1 , · · · , b cm such that each b cj is the estimator to c(αj ). Again, by Lemma 12 and 14, when (48) (0) max |δn,h,s | < s=0,··· ,d a1 , 2 we have α bn (b c1 ) > · · · > α bn (b cm ). (0) Namely, the ordering will be the same when maxs=0,··· ,d |δn,h,s | is sufficiently small. Thus, we need to prove that (1) there is no other connected component of α bn and (2) there is no other merging point to get the topological equivalent. b so there will be no extra connected By Lemma 13, there will be no estimated local mode in D components. In the proof of Lemma 14, we showed that each estimator of a DCP corresponds to a merging in the estimated level sets, and similarly, if connected components are merged at a saddle point or a local minimum, the corresponding estimator will be a merging point. To use the conclusion of Lemma 12, we need uniform consistency in both gradient and Hessian estimation. Namely, we need (1) (2) δn,h,s , δn,h,s to be sufficiently small. The gradient consistency regularizes the positions of estimators 49 GENERALIZED CLUSTER TREES of generalized critical points and the bound on the Hessian matrix guarantees that the eigenvalues retain the same sign. Thus, to apply Lemma 12, there is some a2 > 0 such that the conclusion of Lemma 12 holds whenever (j) max max |δn,h,s | < a2 . (49) j=1,2 s=0,··· ,d (1) To use Lemma 14, we need δn,h,s to be sufficiently small. This comes from Theorem 9. j Combining equations (48) and (49), we obtain equation (47). For the quantity δn,h,s , the slowest rate occurs at j = 2 and s = d. Thus, there are some constants c1 , c2 > 0 such that (50) where Zd = OP max (j) max |δn,h,s | < c1 h2 V m(x) j=0,1,2 s=0,··· ,d q log n nhd+4 + c2 Zd ,  is the stochastic variation. Recall that in the proof of Theorem 8, Zd is Zd = sup k∇∇b pn (x) − ∇∇ph (x)kmax . x∈K By Assumption (K2) and Talagrand’s inequality (Giné and Guillou, 2002; Einmahl and Mason, d+4 2005), there are constants c3 , c4 > 0 such that when nh log n → ∞ (51) d+4 ·t2 P (Zd > t) < c3 · e−c4 ·nh Thus, using equations (50) and (51), when h2 V m(x) < . a0 c1 , T (2) P (Tαbn ≈ Tα ) ≥ P ( max |δn,h,s | < a0 ) s=0,··· ,d   a0 ≥ 1 − P Zd > c2 a ≥ 1 − c3 · e −c4 ·nhd+4 ·( c 0 )2 2 d+4 = 1 − c3 · e−c5 ·nh , where c5 = c4 · ( ac20 )2 > 0. This proves the desired result. REFERENCES S. Balakrishnan, S. Narayanan, A. Rinaldo, A. Singh, and L. Wasserman. Cluster trees on manifolds. In Advances in Neural Information Processing Systems, 2012. A. Banyaga and D. Hurtubise. Lectures on Morse homology, volume 29. Springer Science & Business Media, 2013. Y. Baryshnikov, P. Bubenik, and M. Kahle. Min-type morse theory for configuration spaces of hard spheres. International Mathematics Research Notices, page rnt012, 2013. O. Bobrowski, S. Mukherjee, J. E. Taylor, et al. Topological consistency via kernel estimation. Bernoulli, 23(1): 288–328, 2017. P. Bubenik. Statistical topological data analysis using persistence landscapes. Journal of Machine Learning Research, 16(1):77–102, 2015. B. Cadre. Kernel estimation of density level sets. Journal of multivariate analysis, 97(4):999–1023, 2006. B. Cadre, B. Pelletier, and P. Pudlo. Clustering by estimation of density level sets at a fixed probability. 2009. URL https://hal.archives-ouvertes.fr/file/index/docid/397437/filename/tlevel.pdf. 50 Y.-C. CHEN G. Carlsson. Topology and data. Bulletin of the American Mathematical Society, 46(2):255–308, 2009. K. Chaudhuri and S. Dasgupta. Rates of convergence for the cluster tree. In Advances in Neural Information Processing Systems, pages 343–351, 2010. K. Chaudhuri, S. Dasgupta, S. Kpotufe, and U. von Luxburg. Consistent procedures for cluster tree estimation and pruning. IEEE Transactions on Information Theory, 60(12):7900–7912, 2014. F. Chazal, B. T. Fasy, F. Lecci, B. Michel, A. Rinaldo, and L. Wasserman. Robust topological inference: Distance to a measure and kernel distance. arXiv preprint arXiv:1412.7197, 2014. Y.-C. Chen. Supplementary proofs: Generalized cluster trees and singular measures. doi: COMPLETED BY THE TYPESETTER, 2016. Y.-C. Chen. A tutorial on kernel density estimation and recent advances. arXiv preprint arXiv:1704.03924, 2017. Y.-C. Chen and A. Dobra. Measuring human activity spaces with density ranking based on gps data. arXiv preprint arXiv:1708.05017, 2017. Y.-C. Chen, C. R. Genovese, and L. Wasserman. Density level sets: Asymptotics, inference, and visualization. arXiv:1504.05438, 2015a. Y.-C. Chen, C. R. Genovese, L. Wasserman, et al. Asymptotic theory for density ridges. The Annals of Statistics, 43 (5):1896–1928, 2015b. Y.-C. Chen, C. R. Genovese, L. Wasserman, et al. A comprehensive approach to mode clustering. Electronic Journal of Statistics, 10(1):210–241, 2016a. Y.-C. Chen, J. Kim, S. Balakrishnan, A. Rinaldo, and L. Wasserman. Statistical inference for cluster trees. arXiv preprint arXiv:1605.06416, 2016b. D. Cohen-Steiner, H. Edelsbrunner, and J. Harer. Stability of persistence diagrams. Discrete & Computational Geometry, 37(1):103–120, 2007. H. Edelsbrunner and J. Harer. Persistent homology-a survey. Contemporary mathematics, 453:257–282, 2008. H. Edelsbrunner and D. Morozov. Persistent homology: theory and practice. In Proceedings of the European Congress of Mathematics, pages 31–50, 2012. U. Einmahl and D. M. Mason. Uniform in bandwidth consistency of kernel-type function estimators. The Annals of Statistics, 33(3):1380–1403, 2005. J. Eldridge, M. Belkin, and Y. Wang. Beyond hartigan consistency: Merge distortion metric for hierarchical clustering. In Proceedings of The 28th Conference on Learning Theory, pages 588–606, 2015. B. T. Fasy, F. Lecci, A. Rinaldo, L. Wasserman, S. Balakrishnan, A. Singh, et al. Confidence sets for persistence diagrams. The Annals of Statistics, 42(6):2301–2339, 2014. H. Federer. Curvature measures. Trans. Am. Math. Soc, 93, 1959. G. Friedman. Singular intersection homology. Preprint, 2014. C. R. Genovese, M. Perone-Pacifico, I. Verdinelli, L. Wasserman, et al. On the path density of a gradient field. The Annals of Statistics, 37(6A):3236–3271, 2009. C. R. Genovese, M. Perone-Pacifico, I. Verdinelli, and L. Wasserman. Nonparametric ridge estimation. The Annals of Statistics, 42(4):1511–1545, 2014. E. Giné and A. Guillou. Rates of strong uniform consistency for multivariate kernel density estimators. In Annales de l’Institut Henri Poincare (B) Probability and Statistics, volume 38, pages 907–921. Elsevier, 2002. M. Goresky and R. MacPherson. Intersection homology theory. Topology, 19(2):135–162, 1980. M. Goresky and R. MacPherson. Stratified morse theory, volume 14. Springer Science & Business Media, 2012. J. A. Hartigan. Consistency of single linkage for high-density clusters. Journal of the American Statistical Association, 1981. B. P. Kent. Level Set Trees for Applied Statistics. PhD thesis, Carnegie Mellon University, 2013. J. Klemelä. Visualization of multivariate density estimates with level set trees. Journal of Computational and Graphical Statistics, 13(3), 2004. J. Klemelä. Visualization of multivariate density estimates with shape trees. Journal of Computational and Graphical Statistics, 15(2):372–397, 2006. J. Klemelä. Smoothing of multivariate data: density estimation and visualization, volume 737. John Wiley & Sons, 2009. S. Kpotufe and U. V. Luxburg. Pruning nearest neighbor cluster trees. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pages 225–232, 2011. T. Laloe and R. Servien. Nonparametric estimation of regression level sets. Journal of the Korean Statistical Society, 2013. J. Lee. Introduction to Smooth Manifolds, volume 218. Springer Science & Business Media, 2012. GENERALIZED CLUSTER TREES 51 E. Mammen and W. Polonik. Confidence regions for level sets. Journal of Multivariate Analysis, 122:202–214, 2013. D. M. Mason and W. Polonik. Asymptotic normality of plug-in level set estimates. The Annals of Applied Probability, 19(3):1108–1142, 2009. P. Mattila. Geometry of sets and measures in Euclidean spaces: fractals and rectifiability, volume 44. Cambridge university press, 1999. J. W. Milnor. Morse theory. Number 51. Princeton university press, 1963. I. Molchanov. Empirical estimation of distribution quantiles of random closed sets. Theory of Probability & Its Applications, 35(3):594–600, 1991. M. Morse. Relations between the critical points of a real function of n independent variables. Transactions of the American Mathematical Society, 27(3):345–396, 1925. M. Morse. The foundations of a theory of the calculus of variations in the large in m-space (second paper). Transactions of the American Mathematical Society, 32(4):599–631, 1930. W. Polonik. Measuring mass concentrations and estimating density contour clusters-an excess mass approach. The Annals of Statistics, pages 855–881, 1995. D. Preiss. Geometry of measures in Rn : distribution, rectifiability, and densities. Annals of Mathematics, 125(3): 537–643, 1987. A. Rinaldo and L. Wasserman. Generalized density clustering. The Annals of Statistics, 38(5):2678–2722, Oct. 2010. ISSN 0090-5364. . URL http://arxiv.org/abs/0907.3454. A. Rinaldo, A. Singh, R. Nugent, and L. Wasserman. Stability of density-based clustering. The Journal of Machine Learning Research, 13(1):905–948, 2012. D. W. Scott. Multivariate density estimation: theory, practice, and visualization. John Wiley & Sons, 2015. A. Singh, C. Scott, and R. Nowak. Adaptive hausdorff estimation of density level sets. The Annals of Statistics, 37 (5B):2760–2782, 2009. I. Steinwart. Adaptive density level set clustering. In COLT, pages 703–738, 2011. W. Stuetzle. Estimating the cluster tree of a density by analyzing the minimal spanning tree of a sample. J. Classification, 20(1):025–047, 2003. A. B. Tsybakov. On nonparametric estimation of density level sets. The Annals of Statistics, 25(3):948–969, 1997. L. W. Tu. An introduction to manifolds. Springer Science & Business Media, 2010. G. Walther. Granulometric smoothing. The Annals of Statistics, 25(6):2273–2299, 1997. L. Wasserman. All of nonparametric statistics. Springer Science & Business Media, 2006. L. Wasserman. Topological data analysis. arXiv preprint arXiv:1609.08227, 2016. Department of Statistics University of Washington Box 354322 Seattle, WA 98195 E-mail: [email protected]
10math.ST
Unspecified Journal Volume 00, Number 0, Pages 000–000 S ????-????(XX)0000-0 arXiv:1802.04774v1 [q-fin.MF] 13 Feb 2018 ASSET PRICE VOLATILITY AND PRICE EXTREMA CAREY CAGINALP AND GUNDUZ CAGINALP Abstract. The relationship between price volatilty and a market extremum is examined using a fundamental economics model of supply and demand. By examining randomness through a microeconomic setting, we obtain the implications of randomness in the supply and demand, rather than assuming that price has randomness on an empirical basis. Within a very general setting the volatility has an extremum that precedes the extremum of the price. A key issue is that randomness arises from the supply and demand, and the variance in the stochastic differential equation govening the logarithm of price must reflect this. Analogous results are obtained by further assuming that the supply and demand are dependent on the deviation from fundamental value of the asset. 1. Introduction 1.1. Overview. In financial markets two basic entities are expected relative price change and volatility, that is defined as the standard deviation of relative price change in a specified time period. The expected relative price change is, of course, at the heart of finance, while volatility is central to assessing risk in a portfolio. Volatility plays a central role in the pricing of options, which are contracts whereby the owner acquires the right, but not the obligation, to buy or sell at a particular price within a specified time interval. In classical finance, it is generally assumed that relative price change is random, but volatility is essentially constant [1]. In this way, price change and volatility are essentially decoupled in their treatment. In particular, the relative price change per unit time P −1 dP/dt = d log P/dt is given by a sum of a deterministic term that expresses the long term estimate for the growth, together with a stochastic term given by Brownian motion. Hence, the basic starting point for much of classical finance, particularly options pricing (see e.g., [2], [3]), is the stochastic equation for log P as a function of ω ∈ Ω (the sample space) and t given by (1.1) d log P = µdt + σdW. where W is Brownian motion, with ∆W := W (t)−W (t − ∆t) ∼ N (0, ∆t) , so W is normal with variance ∆t, mean 0, and independent increments (see [4], [5]). While µ and σ are often assumed to be constant, one can also stipulate deterministic and Received by the editors February 14, 2018. Key words and phrases. Volatility and Price Trend, Modelling Asset Price Dynamics, Price Extrema, Market Tops and Bottoms. c 2017 Carey Caginalp and Gunduz Caginalp 1 2 CAREY CAGINALP AND GUNDUZ CAGINALP time dependent or stochastic µ and σ. The stochastic differential equation above is short for the integral form (suppressing ω in notation) for arbitrary t1 < t2 Z t2 Z t2 σdW µdt + (1.2) log P (t2 ) − log P (t1 ) = t1 t1 For µ, σ constant, and ∆t := t2 − t1 , one can write (1.3) ∆ log P := log P (t2 ) − log P (t1 ) = µ∆t + σ∆W. The classical equation (1.1) can be regarded as partly an empirical model based on observations about volatility of prices. It also expresses the theoretical idea of infinite arbitrage that eliminates significant distortions from the expected return of the asset that are obtained by rational comparison with other assets such as risk free government bills. Hence, this equation can be regarded as a limiting case (as supply and demand approach infinity) of other equations involving finite supply and demand. Thus, it does not lend itself to modification based upon random changes in supply and demand. An examination of the relationship between volatility and price trends, tops and bottoms requires analysis of the more fundamental equations involving price change. A suitable framework for analyzing these problems is the asset flow approach based on supply/demand that have been studied in [6], [7], [8], [9] and references therein. An intriguing question that we address is the following. Suppose there is an event that is highly favorable for the fundamentals of an asset. There is the expectation that there will be a peak and a turning point, but no one knows when that will occur. By observing the volatility of price, can one determine whether, and when, a peak will occur in the future? In general, our goal is to delve deeper into the price change mechanism to understand the relationship between relative price change and volatility. Our starting point will be the basic supply/demand model of economics (see e.g., [10], [11], [12]). We argue that there is always randomness in supply and demand. However, for a given supply and demand, one cannot expect nearly the same level of randomness in the resulting price. Indeed, for actively traded equities, there are many market makers whose living consists of exploiting any price deviations from the optimal price determined by the supply/demand curves at that moment. While there will be no shortage of different opinions on the long term prospects of an investment, each particular change in the supply/demand curve will produce a clear, repeatable short term change in the price. Given the broad validity of the Central Limit Theorem, one can expect that the randomness in supply and demand of an actively traded asset on a given, small time interval will be normally distributed. Thus, supply and demand can be regarded as bivariate normally distributed random variables, with a correlation that will be close to −1 since the random factors that increase demand tend to decrease supply. In Sections 2 and 3 we explore the implications of this basic price equation that involves the ratio of demand/supply. By assuming that the supply and demand are normally distributed with a ratio of means that are characterized by a maximum or minimum, we prove that an extremum in the expectation of the price is preceded by an extremum in the price volatility. This means that given a situation in which one expects a market bottom based on fundamentals, the variance or volatility can be a forecasting tool for the extremum in the trading price. Furthermore, in pricing options, this approach shows that the assumption of constant volatility can ASSET PRICE VOLATILITY AND PRICE EXTREMA 3 be improved by understanding the relationship between the variance in price and the peaks and nadirs of expected price. Subsequently, in Section 3, we generalize the dependence on demand/supply in the basic model, and find that under a broad set of conditions one has nevertheless the result that the extremum in variance precedes the expected price extremum. In Section 4 we introduce the concept of price change that depends on supply and demand through the fundamental value. The trader motivations are assumed to be classical in that they depend only on fundamental value; however, the price equation involves the finiteness of assets, which is a non-classical concept. Without introducing non-classical concepts such as the dependence of supply and demand on price trend, we obtain a similar relationship between the volatility and the expected price. 1.2. General Supply/Demand model and heuristic ideas. We write the general price change model in terms of the price, P, the demand, D, and supply, S. In particular, the relative price change is equal to a function of the excess demand (see e.g., [10], [11]). That is, we have P −1 dP/dt = F (D/S − 1) where F must satisfy the requirements that F (0) = 0, i.e., there is no change in price if there is no excess demand, and F ′ (0) > 0, so that prices increase when excess demand is positive. Using a linearization, we write F (x) := cx, and absorb the constant, c, together with the time scale, τ, into the time variable, t, yielding the price equation: (1.4) D d log P = − 1. dt S The stochastic process for log P is defined by (1.5) d log P (t, ω) = a (t, ω) dt + b (t, ω) dW (t, ω) for some functions a and b in H2 [0, T ], the space of stochastic processes with a second moment integrable on [0, T ] (see [5]). The first function in (1.5) is clearly (1.6) a (t, ω) = D (t, ω) −1 S (t, ω) where D and S can also be taken as functions of P and other variable (see Section 4). The b (t, ω) is defined based on the nature of the hypothesized randomness. In any time interval ∆t, there is a random term in D and S. The assumption is that there are a number of agents who are motivated to place buy orders. The relative fraction is subject to randomness so that the deterministic demand, D(t), is multiplied by 1 + σ1 R (ω) for some random variable R (ω) and supply, S (t) , by 1 − σ1 R (ω). This yields, for sufficiently small σ1 =: σ/2 the approximation (1.7) D (t) {1 + σ1 R} D (t) D (t) D (t; ω) −1→ − 1= ˜ −1+ σR, S (t; ω) S (t) {1 − σ1 R} S (t) S (t) with σ being either constant, time dependent or stochastic. Note that we view the randomness as arising only from the σR term, so we can assume that D and S are deterministic functions of t at this point. Later on in this paper we consider additional dependence on D and S. By assuming that the random variable R is normal with variance ∆t and independent on increments, one obtains the stochastic 4 CAREY CAGINALP AND GUNDUZ CAGINALP process below (in which D (t) and S (t) are deterministic)   D (t) D (t) − 1 dt + σ (t, ω) dW (t, ω) . (1.8) d log P (t, ω) = S (t) S (t) We will specialize to σ deterministic or even constant below. If we were to assume that the supply and demand have randomness that is not necessarily the negative of one another, then we can write instead, (1.9) D (1 + σ1 R1 ) D = ˜ (1 + σ1 R1 + σ2 R2 ) − 1 . S (1 − σ2 R2 ) S yielding the analogous stochastic process,   D (t) D (t) (1.10) d log P (t, ω) = − 1 dt + {σ1 dW1 + σ2 dW2 } . S (t) S (t) 1.3. Derivation of the Stochastic Equation. We make precise the ideas above by starting again with (1.4) where D (t; ω) and S (t; ω) are random variables that are anticorrelated bivariate normals with means µD (t) and µS (t) and both have variance σ12 . We can regard the means as the deterministic part of the supply and demand at any time t, so that with Σ as the covariance matrix [13], we write (1.11)  2  σ1 (t) −1 (D (t; ω) , S (t; ω)) ∼ N (~ µ (t) , Σ) with ~µ := (µD , µS ) , Σ := . −1 σ12 (t) For any fixed t we have [14] the density of D/S (1.12) 1 + µD /µS e fD/S (x) = √ σ 2π µS1 (x + 1)2 − 21 (x−µD /µS )2  σ1 µS 2 (x+1)2 . Other approximations in different settings have been studied in [15], [16], [17] and references therein. For values of x near the mean of D/S (requiring µS >> σ1 that is generally valid in markets) one has  2 µD 2 (1.13) (x + 1) = +1 . µS 2  σ2 2 We can use this to approximate the density, using σR := µ21 µµDS + 1 as the S approximate variance of D/S, as (1.14) ( − 1 e fD/S (x) = ˜√ 2πσR x−µD /µS )2 2σ2 R ; ( − 1 e ˜√ f D −1 (x) = S 2πσR x−µD /µS +1)2 2σ2 R . With this expression for the density of R1 := D/S − 1, we can write the basic supply/demand price change equation as   µD ∆ log P 2 − 1, σR , =R ˜ 1∼N (1.15) ∆t µS ASSET PRICE VOLATILITY AND PRICE EXTREMA 5 where each variable depends on t and ω. Subtracting out the µµDS − 1, defining  2 2 R0 ∼ N 0, σR , and noting that R0 depends on t through σR , we write   µD (1.16) ∆ log P = ˜ − 1 ∆t + σR R0 ∆t. µS By definition of Brownian motion, we can write   µD (1.17) ∆ log P = ˜ − 1 ∆t + σR ∆W. µS With σ1 and µD held constant, an increase in µS leads to a decrease in the variance σR . We would like to approximate this under the condition that µD /µS ≈ 1. By rescaling the units of µD , µS , σ1 together and assuming that each of µD and µS are sufficiently close to 1 that we can consider the leading terms in a Taylor expansion, and write (1.18) µD = 1 + δ D , µS = 1 + δ S . Note that µD and µS will be nearly equal unless one is far from equilibirium. Ignoring the terms higher than first order one has  2 1 + δD σ12 2 1+ σR = 2 1 + δS (1 + δS ) (1.19) =4σ ˜ 12 (1 − 3δS + δD ) . We are considering −δS = δD =: δ so that (1.20) 2 σR = 4σ12 (1 + 4δ) . Using Taylor series approximation, one has 2 2   1+δ µD =1 ˜ + 4δ. = (1.21) µS 1−δ We can thus write the stochastic equation above as   µD µD (1.22) ∆ log P = ˜ − 1 ∆t + 2σ1 ∆W, µS µS so that the differential form is given in terms of f := µD /µS − 1 by (1.23) d log P (t) = f (t) dt + σ (f (t) + 1) dW (t) This is in agreement with the heuristic derivation above, with σ = 2σ1 and σ12 as the variance of each of S and D. 2. Location of extrema of supply/demand versus price 2.1. The deterministic model. We will show that if D/S − 1 is given by a deterministic function f , then the stochastic equation above will imply that the variance over a small time interval ∆t will have an extremum before the price has its extremum. Once we do this simplest case, it will generalize it to the situation where f := D/S − 1 is also stochastic, and show that the same result holds. To this end, first consider the simple, purely deterministic case: D d dP = − 1 =: f, i.e., log P (t) = f (t) (2.1) P −1 dt S dt 6 CAREY CAGINALP AND GUNDUZ CAGINALP 2.1.1. Case A (Maximum). Assume that f is a prescribed function of t that is C 1 (I) for I ⊃ (t0 , ∞) ⊃ (ta , tb ) satisfying: (i) f (t) > 0 on (ta , tb ) , f (t) < 0 on I \ (ta , tb ) and f + 1 > 0 on I; (ii) f ′ (t) > 0 if t < tm , f ′ (t) < 0 if t > tm , f ′ (tm ) = 0; (iii) f ′′ (t) < 0 if t ∈ (ta , tb ) . Then log P (t) is increasing on t ∈ (ta , tb ) and decreasing on t ∈ (tb , ∞) and has a maximum at tb . In other words, the peak of f occurs at tm while the peak of log P is attained at tb > tm . This demonstrates the simple idea that price peaks some time after the peak in demand/supply. In fact, during pioneering experiments Smith, Suchanek and Williams [18] observed that bids tend to dry up shortly before a market peak. The important role of the ratio of cash to asset value in a market bubble that was predicted in [6] was confirmed in experiments starting with [7]. 2.1.2. Case B (Minimum). Next we assume that f has a minimum, i.e. assume that f is a prescribed function of t that is C 1 (I) for I ⊃ (t0 , ∞) ⊃ (ta , tb ) . Also, suppose f + 1 is always positive. This is equivalent to D/S > 0, which is a general assumption in economics. Assume f has the following properties: (i) f (t) < 0 on (ta , tb ) , and f (t) > 0 on I \ (ta , tb ) but 1 + f > 0 on all of I; (ii) f ′ (t) < 0 if t < tm , f ′ (t) > 0 if t > tm , f ′ (tm ) = 0, (iii) f ′′ (t) > 0 if t ∈ (ta , tb ) . Then log P (t) is decreasing on t ∈ (ta , tb ) and increasing on t ∈ (ta , ∞) and has a minimum at tb . Hence, the situation is similar to the maximum case above. In both extrema of log P, the function f has the same type of extremum, and precedes the extremum of P. 2.2. The stochastic model. Recall that µD and µS are deterministic functions of time only. We model the problem as discussed above so the only randomness below is in the dW variable. The stochastic equation given by (1.23) for a continuous function f := µD /µS − 1, in the integral form, for any t1 < t2 and ∆ log P := log P (t2 ) − log P (t1 ) is Z t2 Z t2 σ (z) (f (z) + 1) dW (z) . f (z) dz + (2.2) ∆ log P = t1 t1 Note that for the time being we are assuming that σ and f may depend on time but are deterministic. We compute the expectation and variance of this quantity: Z t2 f (z) dz (2.3) E [∆ log P ] = t1 since f is deterministic and E [dW ] = 0; V ar [∆ log P ] = E Z t2 f (z) dz + (2.4) t2 t1 t1  Z − E Z t2 t1 f (z) dz + Z 2 σ (z) {f (z) + 1} dW (z) t2 t1 2 σ (z) {f (z) + 1} dW (z) . ASSET PRICE VOLATILITY AND PRICE EXTREMA 7 R The f (z) dz term is deterministic and vanishes when its expectation is subtracted. The expecation of the dW and the dzdW terms vanishes also. We are left with V ar [∆ log P ] = E Z t2 t1 = Z t2 t1 2 σ (z) {f (z) + 1} dW (z) 2 σ 2 (z) {f (z) + 1} dz using the standard result ([5], p. 68). We want to consider a small interval (t, t + ∆t) so we set t1 → t and t2 → t + ∆t. We have V (t, t + ∆t) := V ar [log P (t, t + ∆t) − log P (t)] Z t+∆t 2 (2.5) σ 2 (z) {f (z) + 1} dz. = t 1 1 V (t) := lim V (t, t + ∆t) = lim ∆t→0 ∆t ∆t→0 ∆t (2.6) 2 = σ 2 (t) {f (t) + 1} . Z t+∆t t 2 σ 2 (z) {f (z) + 1} dz 2 Example 2.1. For σ := 1, the maximum variance of ∆ log P will be when {f (z) + 1} is at a maximum, which is when f has its maximum, i.e., at tm . Likewise, the minimum variance will be when f is at a minimum (recall we assume f + 1 is always positive. This is equivalent to D/S > 0, which is a general economics assumption. We can formalize this for future reference by computing (for σ := 1) (2.7) d d d V (t) = {f (t) + 1}2 = 2 {f (t) + 1} f (t) . dt dt dt Since 1 + f (t) > 0 in all cases, we see that the derivative of V (t) is of the same sign as the derivative of f, so the limiting variance V (t) is increasing when f is increasing and vice-versa. Recall that log P increases so long as f > 0, and decreases when f < 0. In other words, for the peak case, one has f (t) > 0 if and only if t ∈ (ta , tb ) with a maximum at tm . When f has a peak, the maximum of V (t) will be at tm when f (t) has its maximum. For the nadir case, one has f (t) < 0 if and only if t ∈ (ta , tb ) with a minimum at tm . When f has a nadir, the minimum of V (t) and f (t) will coincide at tm . Note that when σ is not constant, the extrema will be dependent on the temporal change of the variance as well as that of f. To summarize, if the coefficient of dW is σ {1 + f (t)} with σ constant and f has an extremum at tm then V (t) will also have the same extremum (maximum or minimum) at tm so that the extremum in E log P will occur after the extremum in V (t) since ∂t E log P (t) = f (t) . 3. Additional Randomness In Supply and Demand We now consider additional randomness in D and S. 8 CAREY CAGINALP AND GUNDUZ CAGINALP 3.1. Stochastic supply and demand. Let f := D/S − 1 be a stochastic function such that −1 ≤ Ef and E |f | ≤ C1 . With X (t) := log P (t) and ∆X := X (t + ∆t) − X (t) , we write the SDE in differential and integral forms as (3.1) dX = f dt + σ (1 + f ) dW X (t + ∆t) − X (t) = (3.2) Z t+∆t f (s) ds + t Z t+∆t σ (s) (1 + f (s)) dW (s) . t where we will assume σ is a continuous, deterministic function of time, though we can allow it to be stochastic in most of the sequel. One has since EdW = 0 and E [dsdW ] = 0 again the identities Z t+∆t (3.3) E∆X = Ef (s) ds, t V ar [∆X] = E Z f ds + Z σ (1 + f ) dW 2  Z 2 Z − E f ds + σ (1 + f ) dW = V ar (3.4) Z  Z  Z 2 Z f ds + 2E f ds σ (1 + f ) dW + E σ (1 + f ) dW where all integrals are taken over the limits t and t + ∆t. 2 Lemma 3.1. Let sup[0,T ] E |f | ≤ C 2 . Then for some C depending on this bound, one has Z t+∆t Z t+∆t 3/2 (3.5) E f (s′ ) ds′ σ (s) {1 + f (s)} dW (s) ≤ C (∆t) . t t Proof. We apply the Schwarz inequality to obtain (3.6) E Z t+∆t ′ f (s ) ds t ′ Z t+∆t σ (s) {1 + f (s)} dW (s) t !2 1/2    !2 1/2  E f (s′ ) ds′ σ (s) {1 + f (s)} dW (s) .    t t R We bound each of these terms. Using the Schwarz inequality on the ds integral, we obtain using generic C throughout, !2 Z   ≤ E  Z t+∆t t+∆t (3.7) E t Z t+∆t f (s′ ) ds′ 2 ≤ C (∆t) . The second term is bounded using the fact that σ is deterministic, !2 Z Z t+∆t t+∆t E σ (s) {1 + f (s)} dW (s) = σ 2 (s) E {1 + f (s)}2 ds t (3.8) t ≤ C∆t. ASSET PRICE VOLATILITY AND PRICE EXTREMA 9 Taking the square roots of (3.7) and (3.8), and combining with (3.6) proves the lemma.  2 Lemma 3.2. Let σ be a continuous, deterministic function and assume sup[0,T ] E |f | ≤ C 2 . Then Z t+∆t 2 3/2 σ 2 (s) E {1 + f (s)} ds ≤ C (∆t) (3.9) V ar [∆X] − t Proof. Basic stochastic analysis yields (3.10) E Z t t+∆t 2 σ (s) {1 + f (s)} dW !2 = Z t+∆t t σ 2 (s) E {1 + f (s)}2 ds. Thus, using (3.4) and f ∈ H2 [0, T ] we have the result (3.9).  Now, we would like to determine the maximum of V (t) and whether it precede.s the maximum of the price. From the calculations above, one has 2 Lemma 3.3. In the general case, assuming E |f (t)| < C 2 on t ∈ [0, T ] but allowing stochastic σ such that Eσ 2 < C one has i h 1 2 V (t, t + ∆t) = E σ 2 (t) (1 + f (t)) . (3.11) V (t) := lim ∆t→0 ∆t 2 Lemma 3.4. Suppose sup[0,T ] E |f (t)| < C 2 and σ is a deterministic continuous function on t ∈ [0, T ] then one has V (t) = σ 2 {1 + Ef }2 + σ 2 V arf. and the extrema of V (t) occur at t such that n o  2 ′ ′ (3.12) 2σσ ′ [1 + Ef ] + V arf + σ 2 2 [1 + Ef ] (Ef ) + (V arf ) = 0. Proof. Using Lemma 3.3, we write o n   2 2 V (t) = σ 2 E 1 + 2f + f 2 = σ 2 1 + 2Ef + (Ef ) + Ef 2 − (Ef ) (3.13) 2 = σ 2 (1 + Ef ) + σ 2 V arf. Differentiation implies the second assertion.  2 Lemma 3.5. Suppose E |f (t)| < C 2 on t ∈ [0, T ], σ and V ar [f (t)] are constant in t. Then the extremum of V (t) occur for t such that (3.14) d Ef (t) = 0. dt R t+∆t 2 2 Proof. From the previous Lemma, we haveV (t, t + ∆t) := t σ (s) E [1 + f (s)] ds one has 1 2 (3.15) lim V (t, t + ∆t) = σ 2 (1 + Ef (t)) + V ar [f (t)] ∆t→0 ∆t 10 CAREY CAGINALP AND GUNDUZ CAGINALP Since we are assuming that V ar [f (t)] is constant in time, we obtain o ∂ n 2 ∂ 2 lim V (t, t + ∆t) = σ (1 + Ef (t)) ∂t ∆t→0 ∂t d (3.16) = 2σ 2 (1 + Ef (t)) Ef (t) . dt d Ef (t) = 0, i.e., at tm (by definition of tm ). Note Thus, the RHS vanishes only if dt that we have 1 + f > 0 so that 1 + Ef > 0.  2 3.2. Properties of f . The condition E |f | < C 2 is easily satisfied by introducing randomness in many forms. For the Lemma above, we would also like to satisfy V ar [f (t)] = const. For example, one may introduce f (t; ω) = e−at W (eat ) so that V arf (t; ω) = 1. Another way of attaining this (up to exponential order) is to define f as the stochastic process (3.17) df (t) = µ (t) dt + σf (t) dW (t) where µ and σ are both time dependent but deterministic. We can assume that f (t0 ) is a given, fixed value, and obtain (see e.g., [4], [5]) Z t 2 Z t (3.18) V ar [f (t)] = E σf (s) dW (s) = σf2 (s) ds t0 t0 since σf (s) is deterministic. Rt In particular, if one has σf (s) := e−s/2 , then V ar [f (t)] ≤ e−t0 while 0 0 σ (s) ds = 1 − e−t0 so one has approximately constant variance for t ≥ t0 for large t0 . In particular, one has Z d t 2 d V ar [f (t)] = σ (s) ds = σf2 (t) = e−t . (3.19) dt dt t0 f 3.3. General Coefficient of dW . The stochastic differential equation (3.1) entails a coefficient of dW that is proportional to D/S. One can also consider the implications of a coefficient that is proportional to the excess demand D/S − 1 or a monomial of it. More generally, we can write h (t) := g (f (t)) for an arbitrary continuous function g leading to the stochastic differential equation (3.20) d log P = f dt + σhdW, where σ can also be stochastic or deterministic function of time. From this stochastic equation one has immediately (3.21) dE [log P ] = Ef dt similar to the completely deterministic model, except that f is replaced by Ef. From the integral version of the stochastic model, we can write the expectation and variance as Z t+∆t (3.22) E [∆ log P ] = Ef (s) ds t ASSET PRICE VOLATILITY AND PRICE EXTREMA V (t, t + ∆t) := V ar [∆ log P ] = V ar "Z # t+∆t f (s) ds + 2E t (3.23) + Z t+∆t "Z 11 t+∆t σ (s) h (s) dW (s) t 2 E [σ (s) h (s)] ds. t The first two terms are bounded as in the previous section and are lower order in ∆t, yielding the following relation for V (t). Lemma 3.6. Let h (t) := g (f (t)) and σ satisfy Eh2 < C, Eσ 2 < C. Then one has 1 2 V (t, t + ∆t) = E [σ (t) h (t)] . (3.24) V (t) := lim ∆t→0 ∆t Next, we examine whether V (t) occurs prior to the extremum of log P (t) , and whether the type of extremum in V (t) is the same as for log P (t) . We explore this particular examples. Example 3.7. Consider the function g (z) = z q where q ∈ N. Let σ := 1 and f ∈ L2 [0, t] be deterministic. From the Lemma above, we obtain d d V (t) = 2qf (t)2q−1 f (t) . dt dt (a) When f := D/S − 1 has a maximum, note that on some interval (ta , tb ) it is positive (as demand exceeds supply) and f has its maximum for some value tm ∈ (ta , tb ) . The identity above implies that V (t) has a maximum when f has a maximum. Also, the defining stochastic equation above implies E log P has its maximum at tb > tm . (b) When f := D/S − 1 has a minimum, note that on some interval (ta , tb ) it is negative (as supply exceeds demand) and f has its minimum for some value tm ∈ (ta , tb ) . This time, the negativity of f on this interval implies V (t) still has a maximum when f has a minimum as E log P has its minimum at tb > tm . In both cases, whether E log P has a maximum or minimum at tb one sees that V (t) has a maximum at tm ∈ (ta , tb ) . So the extremum of expected price is preceded by a maximum in V (t) . V (t) = h (t)2 = f (t)2q , Example 3.8. (Symmetry between D and S and more general coefficients) If we hypothesize that the level of noise is proportional essentially to the magnitude (or its square) of the difference between D and S divided by the sum (which is a proxy for trading volume), then we can write that coefficient as 2 (3.25) σ # (D − S) 2. (D + S) We can consider a more general case in which we write, for example, for σ = const, p    D−S D dW − 1 dt + σ (3.26) d log P (t) = S D+S where p ∈ N can be either even or odd. Note that we can write all terms as functions of f := D/S − 1, so f + 2 = D/S + 1 > 0 since D and S are positive, and we have p  f dW. (3.27) d log P (t) = f dt + σ f +2 12 CAREY CAGINALP AND GUNDUZ CAGINALP We write (3.28) 2  f (t) V (t, t + ∆t) = E σ (t) V (t) := lim ∆t→0 ∆t f (t) + 1 If f is deterministic and σ is constant, we have upon differentiation, (3.29) d f 2p−1 df V (t) = 4pσ 2 2p+1 dt dt [f + 2] d Recalling f + 2 > 0 the sign of dt V depends only on f 2p−1 df /dt. Notice that it makes no difference whether p is even or odd. (a) If f has a single maximum at tm ∈ (ta , tb ) such that f (t) > 0 iff t ∈ (ta , tb ), and f < 0 iff t 6∈ [ta , tb ] then we have a relative maximum in V at tm and V has relative minima at ta and tb . (b) If f has a single minimum at tm ∈ (ta , tb ) such that f (t) < 0 iff t ∈ (ta , tb ) and f > 0 iff t 6∈ [ta , tb ] . Again, we have a relative maximum in V at tm and V has relative minima at ta and tb . Hence, we see that if the coefficient of dW is a deterministic term of the form p ((D − S) /(D + S)) and f has either a maximum or minimum, whether p is even or odd (i.e., the coefficient increases or decreases with excess demand), then the limiting volatility V has the same extremum. Example 3.9. Generalizing this concept further, we define a function H (z) such that H (z) > 0 for all z ∈ R and sgnH ′ (z) = sgn (z) . We consider the stochastic equation, with f deterministic 1/2   f dW d log P = f dt + σ H f +2   f (t) with σ = const. so that V (t) = σ 2 H f (t)+2 While in principle, f (t) := D (t) /S (t) − 1 ∈ (−1, ∞), except under conditions that are very far from equilibrium, one can assume f (t) ∈ (−a/2, a/2) for some small a, at least a ∈ (0, 1]. We compute   d d f σ −2 V = H dt dt f +2   2 f df (3.30) . = H′ 2 f + 2 (f + 2) dt Based on this calculation, we can conclude: (i) If f has a maximum, recalling that f := D/S − 1 is positive near the maximum, then dV/dt has the same sign as df /dt. So a maximum in V corresponds to a maximum in f. (ii) If f has a minimum, then f is negative near the minimum, so the identity above shows that dV/dt has the opposite sign as df /dt. Hence, a maximum in V corresponds to a minimum in f. Thus when f has either extremum, V has a maximum, and this maximum, precedes that of the extremum in the price, P, using the same reasoning as in earlier examples. ASSET PRICE VOLATILITY AND PRICE EXTREMA 13 4. Supply and Demand as a function of valuation. We consider the basic model (1.4) now with the excess demand, i.e., D/S − 1, depending on the valuation, Pa (t) , which can be regarded either as a stochastic or deterministic function. It is now commonly accepted in economics and finance that the trading price will often stray from the fundamental valuation [18], [19]. We write the price equation for the time evolution as d D Pa (t) (4.1) log P (t) = − 1 = log . dt S P (t) The right hand side of equation (1.4) is a linearization (as discussed in Section 1.3) and the right hand side of (4.1) has the same linearization as (Pa − P ) /P . The equation simply expresses the idea that undervaluation is a motivation to buy, while overvaluation is a motivation to sell, as one assumes in classical finance. The non-classical feature is the absence of infinite arbitrage. Analogous to Section 1.3, we write the stochastic version of (4.1) as   Pa (t, ω) Pa (t, ω) dW (t, ω) . dt + σ (t, ω) 1 + log (4.2) d log P (t, ω) = log P (t, ω) P (t, ω) At this point we allow both Pa and σ to be stochastic, with EPa2 < C and Eσ 2 < C but will specialize to given and deterministic Pa and σ after the first result. We also assume 1 + log (Pa /P ) > 0, i.e., Pa /P > e−1 , i.e., the fundamental value, Pa , and trading price, P, do not differ drastically. Notation 1. Let X := log P, Xa := log Pa , y := E log P, ya := E log Pa , z := 2 E (log P ) . When log Pa and log P are deterministic, we write lower case xa and x, respectively. The equation (4.2) is short for the integral form (using the notation above) for any t2 > t1 > t0 , Z t2 Z t2 σ (s, ω) (1 + Xa − X) dW (s) . Xa − Xds + (4.3) X (t2 ) − X (t1 ) = t1 t1 Noting that E (4.4) R f (t) dW = 0, we find the expectation of (4.3) as Z t2 Z t2 y (s) ds ya (s) ds − y (t2 ) − y (t1 ) = t1 t1 i.e., one has the ODE, with y0 := y (t0 ) := E [log P (t0 )] , d (4.5) y (t) = ya (t) − y (t) , y (t0 ) := y0 dt This has the unique solution, for known ya (t) , Z t t0 −t −t (4.6) y (t) = e y (t0 ) + e ya (s) es ds. t0 Note that if we eliminate randomness altogether, i.e., σ := 0 and deterministic Pa (t), Pa (t) d log P (t) = log , dt P (t) with solution Z t x (t) = et0 −t x (t0 ) + e−t es xa (s) ds. t0 14 CAREY CAGINALP AND GUNDUZ CAGINALP where x (t) := log P (t) and xa (t) := log Pa (t). We note that the solution of y (t) = E log P (t) of log P in terms of ya (t) = E log Pa (t) is the same as log P (t) in terms of log Pa (t), i.e. both expected value and deterministic log P satisfy the same equation. 4.1. The stochastic problem. We write the SDE (4.2) as dX = (Xa − X) dt + σ (1 + Xa − X) dW. (4.7) We say X is a solution to a SDE if X ∈ H2 [0, T ] and solves the integral version of the SDE for almost every ω ∈ Ω. The solution to the stochastic equation (4.2), X (t, ω) is unique, belongs to H2 [0, T ] and is continuous in t ∈ [0, T ] for almost every ω ∈ Ω ([5] p. 94). We denote the remaining set Γ, so that X (t, ω) is continuous in t for all ω ∈ Ω \ Γ. One has by basic measure theory (e.g., [20]), that for any measurable function such as X or X 2 one has Z t+∆t Z Z t+∆t E X (s, ω) ds = X (s, ω) dsdP (ω) t Ω = Z t Ω \ Γ Z t+∆t ...dP (ω) + t Z Z Γ t+∆t ...dP (ω) . t Thus from here on we can ignore the set Γ and assume that X (t, ω) is continuous when the expectation value is computed . Next, using (4.4) we compute the variance, of ∆X := X (t + ∆t, ω) − X (t, ω) and later we will determine the terms that vanish upon dividing by ∆t, 2 2 V (t, t + ∆t) := E [X (t + ∆t) − EX (t)] − (E [X (t + ∆t) − X (t)]) "Z #2 Z t+∆t t+∆t =E Xa − Xds + σ (1 + Xa − X) dW (s) (4.8) t − E t "Z t+∆t Xa − Xds + t Z #!2 t+∆t σ (1 + Xa − X) dW (s) t . Note that with ∆X := X (t + ∆t) − X (t) we have   P (t + ∆t) V (t, t + ∆t) = V ar [X (t + ∆t) − X (t)] = V ar log P (t)      ∆P ∆P . +1 ≃ V ar = V ar log P P (4.9) so that V (t, t + ∆t) is essentially a measure of the variance of relative price change. R t+∆t Since E t σ (1 + Xa − X) dW (s) = 0 one has "Z #2 Z t+∆t t (4.10) − E Z t t+∆t Xa − Xds + V (t, t + ∆t) = E t+∆t Xa − Xds t σ (1 + Xa − X) dW (s) !2 = V1 (t, t + ∆t) + V2 (t, t + ∆t) + V3 (t, t + ∆t) ASSET PRICE VOLATILITY AND PRICE EXTREMA 15 where V1 (t, t + ∆t) := E t+∆t Z Xa − Xds t V2 (t, t + ∆t) := 2E "Z t+∆t Xa − Xds t V3 (t, t + ∆t) := E (4.11) = t − E Z t+∆t Xa − Xds t !2 , # t+∆t Z σ (1 + Xa − X) dW (s) t !2 t+∆t Z σ (1 + Xa − X) dW (s) t Z !2 t+∆t 2 E [σ (1 + Xa − X)] ds Lemma 4.1. Let X be a solution to the SDE (4.7) with σ (t, ω) and Xa (t, ω) continuous for all t ∈ [0, T ] and all ω ∈ Ω, with bounded second moments. Then 2 (i) |V1 (t, t + ∆t)| ≤ C (∆t) so lim∆t→0 V1 (t, t + ∆t) /∆t = 0, and, (ii) |V2 (t, t + ∆t)| ≤ C (∆t)3/2 so lim∆t→0 V1 (t, t + ∆t) /∆t = 0. Proof. (i) (a) We consider the first term in V1 , namely, !2 Z !2 Z t+∆t Z t+∆t E Xa − Xds Xa − Xds dP (ω) = t Ω = t Z Ω \ Γ Z t t+∆t Xa − Xds !2 dP (ω) where we have omitted the set of measure zero, Γ, outside of which X is continuous 2 in t on a closed bounded interval. Hence, one can bound the integrand by C (∆t) . Thus we have !2 Z t+∆t 2 E Xa − Xds ≤ C (∆t) . t (i) (b) Similarly the second term can be bounded as !2 ! !2 Z t+∆t Z t+∆t Z E Xa − Xds = Xa − Xds dP (ω) t Ω \ Γ t 2 ≤ C (∆t) . Hence, part (i) of the lemma has been proven. (ii) Using the Schwarz inequality on the second term we have ( Z ! Z !) t+∆t t+∆t 1 V2 (t, t + ∆t) = E Xa − Xds σ (1 + Xa − X) dW (s) 2 t t  !2 1/2  !2 1/2 Z t+∆t Z t+∆t     ≤ E Xa − Xds E σ (1 + Xa − X) dW (s) .     t t 16 CAREY CAGINALP AND GUNDUZ CAGINALP Using continuity properties, we have the following bound on the first term,  !2 1/2 Z t+∆t   E Xa − Xds ≤ C (∆t) .   t For the second we use the basic property used above,  !2 1/2 (Z )1/2 Z t+∆t   t+∆t 2 E σ (1 + Xa − X) dW (s) = E [σ (1 + Xa − X)] ds   t t = (Z Ω \ Γ t+∆t Z t 2 E [σ (1 + Xa − X)] ds )1/2 ≤ C (∆t)1/2 . Hence, the proof of the second part of the lemma follows from the following bound:  !2 1/2  !2 1/2 Z t+∆t Z t+∆t     V2 (t, t + ∆t) ≤ E Xa − Xds E σ (1 + Xa − X) dW (s)     t t ≤ C (∆t) 3/2 This proves the second part of the Lemma.  Thus, Lemma 4.1 indicates that in analyzing V (t, t + ∆t) /∆t in the limit of ∆t → 0 amounts to analyzing V3 (t, t + ∆t) /∆t. At this point we assume that both Pa and σ are deterministic but need not be constant in time, and we now use lower case, xa := log Pa . Lemma 4.2. Let σ and Pa be deterministic, and X (t) as solution to the SDE (4.7). Then Z t+∆t Z t+∆t 2 σ 2 V ar [X (s)] ds. σ 2 [1 + xa (s) − EX (s)] ds + V3 (t, t + ∆t) = t t Proof. Using the expression (4.11) above, the identity follows upon adding and subtracting EX 2 (s) in the integrand.  Lemma 4.3. Let σ and Pa be deterministic and continuous. Then V3 (t, t + ∆t) V (t, t + ∆t) = lim ∆t→0 ∆t ∆t V (t) := lim ∆t→0 1 = lim ∆t→0 ∆t (4.12) (Z t+∆t 2 2 σ [1 + xa − y] + V ar [X] ds t 2 = σ 2 [1 + xa − y] + V ar [X] . ) ASSET PRICE VOLATILITY AND PRICE EXTREMA 17   Next, we will compute V ar [X] starting with E X 2 and assuming that Pa and σ are deterministic. Lemma 4.4. Let σ and xa be deterministic and continuous. Then z (t) := EX 2 (t) satisfies the ODE   dz 2 = σ 2 − 2 z + 2 − 2σ 2 xa y − 2σ 2 y + σ 2 (1 + xa ) dt 2 (4.13) z (t0 ) = y (t0 ) =: y02 . Lemma 4.5. Proof. The stochastic process for X (t), i.e., (4.7) can be written A (t, ω) := (xa − X) , B (t, ω) := σ (1 + xa − X) (4.14) dX (t, ω) = A (t, ω) dt + B (t, ω) dW (t) Ito’s formula provides the differential for a smooth function of X as   ∂f (X (t) , t) ∂f (X (t) , t) B 2 (t) ∂ 2 f (X (t) , t) dt df (X (t) , t) = + A (t) + ∂t ∂x 2 ∂x2 ∂f (X (t) , t) + B (t) (4.15) dW (t) . ∂x For f (x) := x2 we have then from Ito’s formula, i h   2 dX 2 = σ 2 − 2 X 2 + 2 − 2σ 2 xa X − 2σ 2 X + σ 2 (1 + xa ) dt (4.16) + σ (1 + xa − X) (2X) dW  Proof. Hence, we can write in the usual way, as EdW vanishes: (4.17) Z t     2 E X 2 (t) − X 2 (t0 ) = σ 2 − 2 EX 2 + 2 − 2σ 2 xa EX−2σ 2 EX+σ 2 (1 + xa ) ds t0 2 Using the notation y (t) := E (log P ) and z (t) := E (log P ) we have (4.18) Z t   2 z (t) − z (t0 ) = σ 2 − 2 z (t) + 2 − 2σ 2 xa y (t) − 2σ 2 y (t) + σ 2 (1 + xa ) ds. t0 Differentiation with respect to t yields the result and proves the lemma.  In the sequel, we assume for simplicity that σ is constant in time, and xa (t) is deterministic and smooth. We can solve for z directly but it will be more illuminating if we write the solution in the following form. Lemma 4.6. . Let xa be a continuous function. The unique solution to dz0 = −2z0 + 2xa y dt 2 z0 (t0 ) := y (t0 ) (4.19) (4.20) 2 is given by z0 (t) = y (t) . 18 CAREY CAGINALP AND GUNDUZ CAGINALP Proof. Note that xa = ya = EXa since Xa is deterministic under our current assumption. We know that y (t) is a solution to the equation d y (t) = ya (t) − y (t) , dt (4.21) y (t0 ) := y0 so we can substitute xa = y ′ + y into (22) and obtain z0′ + 2z0 = 2yy ′ + 2y 2 = 2y (y ′ + y) = 2xa y. 2 Hence, z0 (t) := y (t) solves (4.19) , (4.20) and from basic ODE theory, the solution is unique so long as xa is continuous.  Lemma 4.7. The unique solution to (4.13) is given by 2 z (t) := z0 (t) + σ 2 z1 (t) = y (t) + σ 2 z1 (t) with z1 (t) defined by (4.22) z1 (t) = Z t t0 2 2 e(2−σ )(s−t) [y (s) − (1 + xa (s))] ds. 2 Proof. Let z1 be defined by z (t) = z0 (t) + σ 2 z1 (t) = y (t) + σ 2 z1 (t) . Substituting into (4.13) yields    2 z0′ + σ 2 z1′ = σ 2 − 2 z0 + σ 2 z1 + 2 − 2σ 2 xa y − 2σ 2 y + σ 2 (1 + xa )   2 = σ 2 z0 − 2z0 + σ 2 − 2 σ 2 z1 + 2 − 2σ 2 xa y − 2σ 2 y + σ 2 (1 + xa ) so that the terms z0′ and −2z0 + 2xa y vanish from both sides.. Using z0 = y 2 we have left, upon dividing by σ 2 , the equation for z1  (25) z1′ + 2 − σ 2 z1 = [y − (1 + xa )]2 , and elementary methods yield the solution (4.22).  Note that although σ ∈ R was used in this proof, comparable result can be obtained in the general case in which σ is continuous and deterministic. Thus, Lemmas 4.6 and 4.7 yield the following identity for V ar [X (t)] . Theorem  4.8. Let σ ∈ R and xa (t) be deterministic and continuous. Let c := 2 − σ 2 and (4.23) σ 2 I (t, t + ∆t) := V ar [X (t + ∆t)] − V ar [X (t)] . 2 w (s) := [1 + xa (s) − y (s)] . Then one has the following identities: Z t 2 V ar [X (t)] = σ 2 (4.24) ec(s−t) [y (s) − (1 + xa (s))] ds (4.25) I (t, t + ∆t) = Z t t0 t+∆t ec(s−t) w (s) ds. ASSET PRICE VOLATILITY AND PRICE EXTREMA 19 Proof. The identities follow immediately from Lemma 4.7 and the definition of variance in terms of z and y. I.e., V ar [X (t)] = E [X (t)]2 − [EX (t)]2 2 = z (t) − y (t) = σ 2 z1 (t) Z t 2 2 =σ e(2−σ )(s−t) [1 + xa (s) − y (s)]2 ds. t0  Remark 4.9. The maximum value of V ar [X (t + ∆t)]−V ar [X (t)] occurs for t such  that the average weighted value of w (s) with exponential weighting of 2 − σ 2 is maximal on (t, t + ∆t) . Using the lemmas above, we obtain directly the following result. Theorem 4.10. Let xa be continuous. Then we have the identities, −1 lim σ −2 (∆t) ∆t→0 (4.26) V (t, t + ∆t) = lim σ −2 (∆t) ∆t→0 −1 V3 (t, t + ∆t) = w (t) + V ar [X (t)] Z t 2 σ −2 V (t) = w (t) + σ 2 e(2−σ) (s−t) w (s) ds i.e., t0 (4.27) V (t, t + ∆t) d d lim σ −2 = σ −2 V (t) dt ∆t→0 ∆t dt Z  t (2−σ)2 (s−t) = w′ (t) + σ 2 w (t) − σ 2 2 − σ 2 e w (s) ds. Q (t) := t0 5. Market Extrema The main objective of this section is to apply the results above understand the temporal relationship between the extrema of the (log) fundamental value, xa (t), and the expected (log) trading price, y (t) . 5.1. Price Maxima. Notation 2. Let t0 be the initial time, and tm be defined by x′a (tm ) = 0, i.e., the time at which the fundamental value, xa , attains its maximum. The time t∗ is defined as the first time at which y ′ (t∗ ) = xa (t∗ ) − y (t∗ ) vanishes, and the curves xa (t) and y (t) first intersect. Notation 3. Let x̂a (t) := et xa (t), ŷ (t) := et y (t) , ŷ0 := et0 ŷ (t0 ) . Condition σ . Let σ ∈ (0, 1) be a constant, so c := 2 − σ 2 ∈ (1, 2) . We will assume this condition throughout, though some results are valid without it. Condition C. (i) The function xa : [t0 , ∞) → (0, ∞) has the property that for some tm ∈ (0, ∞) one has (i) x′a (t) > 0 if t < tm ; x′a (tm ) = 0; x′a (t) < 0 if t > tm . 20 CAREY CAGINALP AND GUNDUZ CAGINALP (ii) Let y (t0 ) =: y0 ∈ (0, ∞) one has xa (t0 ) − x′a (t0 ) < y0 < xa (t0 ) . (iii) For some δ, m1 ∈ (0, ∞) one has −x′a (t) > m1 > 0 if t > tm + δ. Remarks. We set y0 =: y (t0 ) , so the two inequalities in Condition C (ii) state that initially (i.e., at t0 ) the price is below the fundamental value, i.e., undervaluation (y (t0 ) = y0 < xa (t0 ) ). Using the ODE y ′ = xa − y one has that the first inequality in Condition C (ii) is equivalent to x′a (t0 ) > y ′ (t0 ) > 0 stipulating that the valuation has begun to increase relative to trading price. Condition C (iii) can be relaxed to some extent although the condition then appears more technical. Condition E. With t∗ be defined as above, assume 2x′a (t∗ ) + σ 2 ec(t0 −t∗ ) < 0. Remarks. Note that this condition is satisfied automatically if t0 → −∞. So long as there is an interval (tm , t∗ ) on which x′a (t∗ ) < −σ 2 ec(t0 −t∗ ) (the latter is exponentially small if t∗ − t0 >> 1) the Condition E will be satisfied. Recalling that y (t) is given by (4.6), i.e., Z t x̂a (s) ds. (5.1) ŷ (t) = ŷ (t0 ) + t0 since ya = xa as the latter is deterministic. Initially, we have from C (ii) that xa (t0 ) > y (t0 ) . We want to first prove that y intersects with xa at some value t∗ and that this value t∗ occurs after tm (i.e., the time at which xa has its peak). Theorem 5.1. Assume that C holds. Then there exists a least value t∗ ∈ (tm , ∞) such that for t < t∗ one has y (t) < xa (t) , and, y (t∗ ) < xa (t∗ ) , i.e., Z t∗ x̂a (s) ds = x̂a (t∗ ) . (5.2) ŷ (t∗ ) = ŷ0 + t0 ′ Since y = xa − y, the maximum of y is attained at t∗ . Rt Proof. Let I (t) := x̂a (t) − ŷ0 − t0 x̂a (s) ds, so I (t0 ) > 0 by condition C (ii) . Computing the derivative and using Condition C (i) yields I ′ (t) = x̂′a (t) − x̂a (t) = et x′a (t) > 0 if t < tm . Hence, one has I (t) < 0 if t < tm . On the other hand, by Condition C (iii), when t > tm + δ one has I ′ (t) = et x′a (t) ≤ etm (−m1 ) so that I (t∗ ) = 0 for some finite t∗ > tm .  Lemma 5.2. Under C (i) , (ii) there exists a t1 ∈ (t0 , tm ) such that w′ (t1 ) = 0, w′ (t) > 0 if t ∈ [t0 , t1 ), and w′ (t) < 0 if tm < t < t∗ . Consequently, we have (5.3) t0 < t1 < tm < t∗ . ASSET PRICE VOLATILITY AND PRICE EXTREMA 21 Proof. Recall (4.26) and note w′ = 2 [1 + xa − y] (x′a − y ′ ) , whose sign is determined by S (t) := x′a (t) − y ′ (t) = x′a (t) − xa (t) + y (t) when t < t∗ [i.e., when xa (t) > y (t)]. For t0 we have from C (ii) that S (t0 ) > 0. For tm < t < t∗ we have from C (i) that x′a (t) < 0 while y ′ (t) = xa (t)−y (t) > 0 as noted earlier in the proof, yielding S (t) = x′a (t) − xa (t) + y (t) < 0. By continuity, there exists a t1 ∈ (t0 , tm ) such that S (t1 ) = 0 and S (t) > 0 for t < t1 . I.e., t1 is the first crossing for S (t) and hence for w (t) . The ordering (5.3) thus follows.  Lemma 5.3. Assuming Condition C, one has Q (t1 ) > 0. Proof. Since t1 < tm < t∗ one has xa (t1 ) > y (t1 ) and consequently w (t1 ) exceeds 1 and is thus positive. Hence, we can replace w (s) by w (t1 ) in the integral, and factor, in order to obtain the inequality Z t1 ec(s−t1 ) w (t1 ) ds Q (t1 ) ≥ 0 + σ 2 w (t1 ) − σ 2 c t0 o n  2 = σ w (t1 ) 1 − 1 − ec(t0 −t1 ) = σ 2 w (t1 ) ec(t0 −t1 ) > 0.  Lemma 5.4. If Conditions C and E hold, then Q (t∗ ) < 0. Proof. We write Q (t∗ ) = w′ (t∗ ) + σ 2 w (t∗ ) − σ 2 c Z t∗ ec(s−t∗ ) w (s) ds, t0 and note that for any t ≤ t∗ one has xa (t) > y (t) by Thm 5.1. Consequently, we have the inequality w (t) = [1 + xa (t) − y (t)]2 ≥ 1 = w (t∗ ) . By using this mimimum value of w that is subtracted, we have Z t∗ ′ 2 2 ec(s−t∗ ) 1ds. Q (t∗ ) ≤ w (t∗ ) + σ w (t∗ ) − σ c t0 ′ Also, from Thm 5.1, we have y (t∗ ) = xa (t∗ ) − y (t∗ ) = 0, so a computation yields w′ (t∗ ) = 2 [1 + xa (t∗ ) − y (t∗ )] (x′a (t∗ ) − 0) = 2x′a (t∗ ) . Using w (t∗ ) = 1, and evaluating the integral, one obtains Q (t∗ ) ≤ 2x′a (t∗ ) + σ 2 ec(t0 −t∗ ) < 0. The last inequality follows from Condition E.  22 CAREY CAGINALP AND GUNDUZ CAGINALP Hence, recalling that t0 < t1 < tm < t∗ , we obtain the result that the maximum of Q, the limiting volatility precedes the peak of y (t), which occurs at t∗ . Theorem 5.5. There exists a tv ∈ (t1 , t∗ ) such that Q′ (tv ) = 0. In summary, the derivative of y catches up to xa at t1 . Recalling (4.27), we see that Q (tv ) = σ −2 dV (tv ) /dt = 0 corresponds to a maximum in V, and this occurs after t1 and before tm where xa has its peak. The peak of xa precedes the peak of y at t∗ . Thus, V has a maximum prior to the maxima of xa and y. 5.2. Price Minima. Using notation analogous to those of the price maximum, we will prove below that t0 < t1 < tm < t∗ where t0 is the initial time, w′ (t1 ) = 0, tm is by the assumption the minumum of xa so x′a (tm ) = 0, and t∗ is the point at which xa (t∗ ) = y (t∗ ) . Also, since we have the equation y ′ = xa − y, it is also the point at which y ′ (t∗ ) = 0, so it is the minimum in y (t) = E log P (t) . Furthermore, we will show that Q (t∗ ) > 0, and Q (t0 ) < 0. This will then imply that there exists te ∈ (t0 , t∗ ) such that Q (te ) = 0. Hence, there is a minimum in the variance per unit time. This means that there is a minimum in the limiting volatility, V, prior to the minimum in the expected log price, y. In addition, we show that at t1 , which occurs before tm, we have Q (t1 ) ≤ σ 2 w (t1 ) ec(t0 −t1 ) so that if t1 − t0 >> 1 then Q (t1 ) =0 ˜ and the change in the limiting volatility is near zero at this point. Condition C̃. For xa : [t0 , ∞) → (0, ∞) and y (t0 ) =: y0 ∈ (0, ∞) there are the following conditions that will be imposed for the lemmas. (i) For some tm ∈ (t0 , ∞) one has x′a (t) < 0 if t < tm , x′a (tm ) = 0, x′a (t) > 0 if t > tm . (ii) For some y (t0 ) =: y0 ∈ (0, ∞) one has xa (t0 ) < y (t0 ) < xa (t0 ) − x′a (t0 ) , (iii) For all t ∈ (t0 , ∞) one has x′a (t) > −1. (iv) For some δ, m1 ∈ (0, ∞) one has −x′a (t0 ) ∈ (0, 1) . x′a (t) > m1 > 0 if t > tm + δ. (v) For some y (t0 ) =: y0 ∈ (0, ∞) , one has y (t0 ) < σ2 −2x′a (t0 ) . + x (t ) − a 0 (2 − σ 2 ) 2 − σ2 Note that neither Condition C̃ (v) nor C̃ (ii) imply the other. Lemma 5.6. Under Condition C̃, there exists a least t∗ ∈ (tm , ∞) such that y (t∗ ) = xa (t∗ ) , i.e., (5.2) holds and xa (t) < y (t) if t < t∗ . Proof. First let I (t) := x̂a (t) − ŷ (t) , so I ′ (t) = et x′a (t) .For t < tm we have from C̃ (i) that x′a (t) < 0 so that I ′ (t) < 0 as well. Since I (t0 ) = x̂a (t0 ) − ŷ (t0 ) < 0 by C̃ (ii) we see that I (t) < 0 for t < tm . Hence, one cannot have xa (t) = y (t) for t < tm . ASSET PRICE VOLATILITY AND PRICE EXTREMA 23 Next, we want to prove that there exists t∗ ∈ (tm , ∞) such that y (t∗ ) = xa (t∗ ) . We use C̃ (iv) so that x′a (t) > m1 > 0 f or t > tm + δ. Then I ′ (t) = et x′a (t) > etm m1 f or all t > tm + δ. Since I (t0 ) is a finite, negative value, and the derivative of I is bounded below by a positive number, there exists a least t∗ such that I (t∗ ) = 0, i.e., xa (t∗ ) = y (t∗ ) . Since we showed above that one cannot have t∗ < tm , the conclusion follows.  Lemma 5.7. Suppose that C̃ holds. Then for all t ∈ (t0 , ∞) one has J (t) := 1 + xa (t) − y (t) > 0. Proof. Let Jˆ (t) := et J (t) . From C̃ (ii) one has that J (t0 ) > 0 since 0 < xa (t0 ) − y (t0 ) − x′a t0 < xa (t0 ) − y (t0 ) + 1. Hence, Jˆ (t) > 0 also. Next, differentiating J (t) we write dJˆ = et {1 + x′a (t)} . dt By C̃ (ii) one has x′a (t) > −1 for all t ∈ (t0 , ∞) yielding dJˆ (t) > 0 f or all t ∈ (t0 , ∞) . dt Combined with J (t0 ) > 0, we conclude Jˆ (t) > 0 for all t ∈ (t0 , ∞) . The conclusion follows.  Lemma 5.8. Assume C̃. Then for t : tm < t < t∗ one has w′ (t) > 0. Also, there exists t1 < tm such that w′ (t1 ) = 0 and w′ (t) < 0 for t < t1 . Thus, we have established that t0 < t1 < tm < t∗ . Proof. Recall that w′ (t) = 2 [1 + xa (t) − y (t)] {x′a (t) − y ′ (t)} . Since C̃ holds, Lemma 5.7 implies J = 1 + xa − y > 0 for all t ∈ (t0 , ∞) . Hence, the sign of w′ (t) is determined by the sign of S (t) := x′a (t) − y ′ (t) . For tm < t one has x′a (t) > 0 and for t < t∗ one has y ′ (t) = xa (t) − y (t) < 0 by definition of t∗ . Hence, S (t) > 0 for tm < t < t∗ . Also, by C̃ (ii) S (t0 ) = x′a (t0 ) − y ′ (t0 ) = x′a (t0 ) − xa (t0 ) + y (t0 ) < 0. By continuity then, one has the existence of t1 ∈ (t0 , tm ) such that w′ (t1 ) = 0 and w′ (t) < 0 for t0 < t < t1 . Note that for t ∈ (t1 , tm ) we have no assertion on w′ (t) .  24 CAREY CAGINALP AND GUNDUZ CAGINALP Lemma 5.9. Under Conditions C̃ one has Q (t∗ ) > 0. Proof. For t < t∗ we have y (t) > xa (t) , and for all t ∈ (t0 , ∞) Lemma 5.7 applies, so together one has 1 > 1 + xa (t) − y (t) > 0. Thus, we have w (t) := 2 [1 + xa (t) − y (t)] < 1 = w (t∗ ) . Thus in the identity for Q (t∗ ) below, we can replace w (s) by its maximum value, w (t∗ ) = 1, thereby diminishing the RHS: Z t∗ ec(s−t∗ ) w (s) ds Q (t∗ ) = w′ (t∗ ) + σ 2 w (t∗ ) − σ 2 c t0 t∗ Z ec(s−t∗ ) 1ds ≥ w′ (t∗ ) + σ 2 w (t∗ ) − σ 2 c t0 i h = w′ (t∗ ) + σ 2 w (t∗ ) − σ 2 1 − ec(t0 −t∗ ) i h = 2x′a (t∗ ) + σ 2 · 1 − σ 2 1 − ec(t0 −t∗ ) = 2x′a (t∗ ) + σ 2 ec(t0 −t∗ ) . where we have used the fact that w′ (t∗ ) = xa (t∗ ) − y (t∗ ) = xa (t∗ ) since y ′ (t∗ ) = xa (t∗ ) − y (t∗ ) = 0. Finally, since t∗ > tm one has x′a (t∗ ) > 0, and we see that both terms are positive.  Lemma 5.10. Under Conditions C̃ we have Q (t0 ) < 0. Rt Proof. From the definition of Q and the fact that t00 = 0, we have Q (t0 ) = w′ (t0 ) + σ 2 w (t0 ) . Using the definition of w and the calculation of w′ we have (with all functions evaluated at t0 : 2 Q (t0 ) = 2 [1 + xa − y] (x′a − y ′ ) + σ 2 [1 + xa − y]  = [1 + xa − y] 2 (x′a − y ′ ) + σ 2 [1 + xa − y]  = [1 + xa − y] 2 (x′a − xa + y) + σ 2 [1 + xa − y] using y ′ = xa − y. Lemma 5.7 implies that the first term [1 + xa − y] is positive. Thus, Q (t0 ) < 0 if and only if (x′a − xa + y) + σ2 (1 + xa − y) < 0 at t0 2 which is equivalent to Condition C̃ (v) . Lemma 5.11. At t1 (recalling w′ (t1 ) = 0) one has Q (t1 ) ≤ σ 2 w (t1 ) ec(t0 −t1 ) .  ASSET PRICE VOLATILITY AND PRICE EXTREMA 25 Proof. Since w′ (t1 ) = 0, one has 2 2 Q (t1 ) = σ w (t1 ) − σ c = σ 2 w (t1 ) c Z t1 −∞ Z t1 ec(s−t1 ) w (s) ds. t0 ec(s−t1 ) ds − σ 2 c = σ 2 w (t1 ) ec(t0 −t1 ) + σ 2 c Z t1 t0 Z t1 ec(s−t1 ) w (s) ds t0 ec(s−t1 ) [w (t1 ) − w (s)] ds. Since w′ (t) < 0 for t < t1 by Lemma 3, the integral term is negative, yielding the result.  Remarks. 1. Note that once xa is specified, then y is known, so one can determine whether, in fact, Z t1 ec(s−t1 ) [w (t1 ) − w (s)] ds < 0. (*) Q (t1 ) = σ 2 w (t1 ) ec(t0 −t1 ) + σ 2 c t0 ′ ′ Since w (t1 ) = 0 and w (t) < 0 for t < t1 , the second term will be negative for any t0 < t1 . 2. For sufficiently large t1 − t0 , the first term is exponentially small, so that a typical xa will satisfy the inequality (∗) . Another criterion for obtaining a negative value for Q (t) (so we can use it in conjunction with Q (t∗ ) > 0 to obtain for some te , the value Q (te ) = 0, is below. Lemma 5.12. Let t2 be any positive real satisfying t2 < t1 (i.e., t0 < t2 < t1 < tm < t∗ ). Then (**) Z t2    ec(s−t2 ) σ 2 [w (t2 ) − w (s)] + w′ (t2 ) . Q (t2 ) = ec(t0 −t2 ) σ 2 w (t2 ) + w′ (t2 ) +c t0 Proof. Follows from the definition of Q using Z Z t0 Z t2 ec(s−t2 ) ds + c ec(s−t2 ) ds = c 1=c −∞ −∞ t2 ec(s−t2 ) ds. t0  Remark. Note that since t2 < t1 one has w′ (t) < 0 for t ≤ t2 and also w (t2 ) − w (s) < 0 for s < t2 . Hence the integrand is negative. The term w′ (t2 ) is also negative. So the only positive term is σ 2 w (t2 ) ec(t0 −t2 ) which will be exponentially small if t2 − t0 >> 1. In particular, Q (t2 ) < 0 in the limit as t0 → −∞. In conclusion, we have shown that the limiting volatility V (t) attains its extremum prior to that of the expected logarithm of the price, y (t). Moreover, V (t) has the same type of extremum (maximum or minimum) as y (t) . References [1] Bodie, Z., Kane, A., Marcus, A. 2010. Investments, 10 Ed., McGraw Hill, New York. [2] Black, F., Scholes, M. 1973. The pricing of options and corporate liabilities. J. Political Economy 81, 637-654. [3] Wilmott, P., Howison, S. and Dewynne, J. 2008. The Mathematics of Financial Derivatives, Cambridge Univ Press, Cambridge. 26 CAREY CAGINALP AND GUNDUZ CAGINALP [4] Billingsley, P. 2012. Probability and Measure, Anniversary Ed., Wiley, Hoboken, NJ. [5] Schuss Z. 2010 Theory and Applications of Stochastic Processes, An Analytical Approach, Springer, New York. [6] Caginalp, G., Balevonich, D. 1999. Asset flow and momentum: Deterministic and stochastic equations. Phil. Trans. Royal Soc., Math, Phys., Engr. 357, 2119-2113. [7] Caginalp, G., Porter, D., and Smith, V. 1998. Initial cash/asset ratio and asset prices: an experimental study. Proc. Nat. Acad. Sciences, 95, 756-761. [8] H. Merdan, H. and Alisen, M. 2011. A mathematical model for asset pricing, Applied Mathematics and Computation, 218, 1449-1456. [9] Merdan, H. and Cakmak, H. 2012. Liquidity Effect on the Asset Price Forecasting, Journal of Nonlinear Systems and Applications (2012) 82-87. [10] Watson, D., Getz, M. 1981. Price Theory and Its Uses. University Press of America, Lanham, MD. [11] Hirshleifer, J. and Glazer, A., 1997. Price Theory and its Applications, Prentice Hall, Engelwood Cliffs, NJ. [12] Plott, C. and Salmon, T. 2004. The simultaneous, ascending auction: dynamics of price adjustment in experiments and in the UK3G spectrum auction. Journal of Economic Behavior and Organization, 53,. 353-383. [13] Tong, Y. 1990. The Multivariate Normal Distribution, Springer-Verlag, New York. [14] Caginalp, C. & Caginalp, G. 2017 The quotient of normal random variables and application to asset price fat tails. Preprint. [15] Dı́az-Francés, E. & Rubio, F. J. 2013. On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Stat. Papers, 54, 1-15. [16] Hinkley, D. 1969. On the ratio of two correlated normal random variables, Biometrika, 56, 635–639. [17] Hinkley D. 1970. Correction: On the Ratio of Two Correlated Normal Random Variables. Biometrika, 57, 683. [18] Smith, V.L., Suchanek, G.L. and Williams, A.W., 1988. Bubbles, crashes, and endogenous expectations in experimental spot asset markets. Econometrica 56, 1119-1151. [19] Shefrin, H. 2005. A Behavioral Approach to Asset Pricing, Elsevier Academic Press, Burlington, MA. [20] Rudin, W. 1986. Real and Complex Analysis 3rd Ed. McGraw-Hill. Department of Mathematical Sciences, Carnegie Mellon University, Pittsburgh PA 15213 and Mathematics Department, University of Pittsburgh, Pittsburgh, PA 15260 E-mail address: carey [email protected] URL: http://www.pitt.edu/~careycag/ Mathematics Department, University of Pittsburgh, Pittsburgh, PA 15260 E-mail address: [email protected] URL: http://www.pitt.edu/~caginalp/
10math.ST
Scheduling under Linear Constraints Kameng Nipa , Zhenbo Wanga,∗, Zizhuo Wangb arXiv:1510.08551v1 [cs.DS] 29 Oct 2015 a Department b Department of Mathematical Sciences, Tsinghua University, Beijing, China of Industrial and Systems Engineering, University of Minnesota, MN, USA Abstract We introduce a parallel machine scheduling problem in which the processing times of jobs are not given in advance but are determined by a system of linear constraints. The objective is to minimize the makespan, i.e., the maximum job completion time among all feasible choices. This novel problem is motivated by various real-world application scenarios. We discuss the computational complexity and algorithms for various settings of this problem. In particular, we show that if there is only one machine with an arbitrary number of linear constraints, or there is an arbitrary number of machines with no more than two linear constraints, or both the number of machines and the number of linear constraints are fixed constants, then the problem is polynomial-time solvable via solving a series of linear programming problems. If both the number of machines and the number of constraints are inputs of the problem instance, then the problem is NP-Hard. We further propose several approximation algorithms for the latter case. Keywords: parallel machine scheduling, linear programming, computational complexity, approximation algorithm 1. Introduction A scheduling problem aims to allocate resources to jobs, so as to meet a specific objective, e.g., to minimize the makespan or the total completion time. One common assumption in the classical scheduling problem is that the processing times of jobs are deterministic and are given in advance. However, in practice, the processing times are usually uncertain/unknown or could be part of the decisions. A number of works in the literature have proposed various scheduling models in which the processing times are uncertain/unknown, such as the stochastic scheduling problem (Möhring et al., 1984, 1999; Dean, 2005) and the robust scheduling problem (Daniels & Kouvelis, 1995; Kasperski, 2005; Kasperski & Zielinski, 2008). In the stochastic scheduling problem, it ∗ Corresponding author Email addresses: [email protected] (Kameng Nip), [email protected] (Zhenbo Wang), [email protected] (Zizhuo Wang) Preprint submitted to Elsevier March 26, 2018 is assumed that the processing times are random variables and the expected makespan is considered. In the robust scheduling problem, it is assumed that the processing time of each job belongs to a certain set and the objective is to find a robust schedule under some performance criterion (e.g., minimize the maximum absolute deviation of total completion time, or the total lateness). Note that in either the stochastic or the robust scheduling problems, the processing times are still exogenously given. In the presented paper, we introduce a new scheduling model. In our model, the processing times of jobs are not exogenously given, instead they can be chosen as part of the decisions, but they must satisfy a set of linear constraints. We call this problem the “scheduling under linear constraints” (SLC) problem. Note that the SLC problem reduces to the classical parallel machine scheduling problem P ||Cmax when the processing times of jobs are given (or equivalently, when the linear constraints have a unique solution). This problem is related to the scheduling problem with controllable processing times studied in the literature (Nowicki & Zdrzalka, 1988, 1990; Shabtay & Steiner, 2007). In the latter problem, the processing times of jobs are controlled by factors such as the starting times and the sequence of the jobs, while in our problem, the processing times are part of the decision variables. The SLC problem is also related to the lot sizing and scheduling problem in production planning, which decides the type and amount of jobs to process at each time period over a time horizon (Drexl & Haase, 1995; Drexl & Kimms, 1997; Haase, 1994). However, in the SLC problem, each task must be completed in a consecutive time interval, while in the lot sizing and scheduling problem, an activity can be scheduled in multiple non-consecutive periods. Furthermore, the objective of the lot sizing and scheduling problem is to minimize the total costs, including the setup costs, the inventory holding costs, etc, which is significantly different from the objective in our problem (Kreipl & Pinedo, 2004). In the following, we provide a few examples that motivate the study of the SLC problem. 1. Industrial Production Problem. Perhaps the earliest motivation for the scheduling problem came from manufacturing (e.g., see Pinedo, 2009, 2012). Suppose a manufacturer requires certain amounts of different raw metals, and he needs to extract them from several alloys. There are several machines that can extract the alloys in parallel. We focus on the procedure of extracting the alloys, of which the goal is to finish as early as possible. In this problem, the processing times of extracting each alloy depend on the processing quantities, and traditionally, they are predetermined in advance. However, in practice, those quantities are determined by the demands of the raw metals and can be solved as a feasible solution to a blending problem (Danø, 1960; Eiselt & Sandblom, 2007). Sometimes, each alloy also has its own maximum quantity. An example of such a scenario is given in Table 1. In the example shown in Table 1, the demand of iron is 56, and each unit of alloy 1 contains 24 units of iron, each unit of alloy 2 contains 8 2 Composition 1 24 3 .. . 2 8 3 .. . Alloy 3 3 3 .. . aluminium Max. of alloy 1 2 3 .. . 4 33 1 0 0 .. . n 0 iron copper .. . Demand ··· ··· ··· .. . n 2 1 .. . 137 ··· 100 0 1 0 .. . 0 0 1 .. . ··· ··· ··· .. . 0 0 0 .. . 0 0 ··· 1 ≥ 56 ≥ 30 .. . ≥ 1000 Quantity ≤ 10 ≤7 ≤ 20 .. . ≤ 15 Table 1: Example for the Industrial Production Problem units of iron, etc. Let xi be the quantity of alloy i to be extracted. Then the requirement on the demand of iron can be represented as a linear inequality 24x1 + 8x2 + 3x3 + · · · + 2xn ≥ 56. Furthermore, the maximum amount of alloy 1 available is 10, which can be represented as a linear inequality x1 ≤ 10. Similarly, we can write linear constraints for the demand of other metals and the quantity for other alloys. In this problem, the decision maker needs to determine the nonnegative job quantities x1 , . . . , xn satisfying the above linear constraints, and then assign these jobs to the parallel machines such that the last completion time is minimized. This problem can be viewed as a minimum makespan parallel machine scheduling problem, where the processing times of jobs satisfy some linear constraints. 2. Advertising Media Selection Problem. A company has several parallel broadcast platforms which can broadcast advertisements simultaneously, such as multiple screens in a shopping mall or different spots on a website. There is a customer who wants to broadcast his advertisements (ad 1, . . . , n) on these platforms.1 It is required that each individual advertisement must be broadcast without interruption and the running time of each advertisement has to satisfy some linear constraints. The company needs to decide the running times xi allocated to each advertisement i, and also which advertisement should be released on which platform as well as the releasing order. The objective is to minimize the completion time. An example of such a problem is given in Table 2. Similar to the first example, the above-described problem can be naturally 1 This example can be easily extended to cases with multiple customers. 3 sum of attractions to women attractions to men attractions to teens .. . max time for ad 1 min time for ad 1 max time for ad 2 .. . each unit time broadcast provides ad 1 ad 2 ad 3 ··· ad n 20 100 100 ··· 10 15 10 0 ··· 80 30 0 30 ··· 100 .. .. .. .. .. . . . . . 1 0 0 ··· 0 1 0 0 ··· 0 0 1 0 ··· 0 .. .. .. .. .. . . . . . ≥ 500 ≥ 500 ≥ 200 .. . ≤ 20 ≥ 10 ≤ 35 .. . Table 2: Example for the Advertising Media Selection Problem formulated as a minimum makespan parallel machine scheduling problem in which the parameters (running times of the advertisements) are determined by a system of linear constraints. 3. Transportation Problem. Both linear programming and machine scheduling problems have extensive applications in the field of transportation management (Eiselt & Sandblom, 2007; Pinedo, 2009, 2012). The parallel machine scheduling problem has many similarities with the transportation scheduling models. For example, a fleet of tankers or a number of workers can be considered as a parallel machine environment, and transporting or handling cargo is analogous to processing a job (Pinedo, 2009). Meanwhile, the transportation problem can be formulated as a linear program. Let xij be the capacity of cargo that needs to be transported from origin i to destination j. They often have to satisfy certain supply and demand constraints, which are usually linear constraints. In practice, the decision maker decides how to assign cargo (jobs) to tankers or workers (parallel processors), so as to finish the handling as quickly as possible. This is a parallel machine scheduling problem. And the processing times usually depend on xij s, which have to satisfy some linear constraints as mentioned above. This also leads to a parallel machine scheduling problem with linear constraints. In this paper, we study the SLC problem, discussing the computational complexity and algorithms for this problem under various settings. In particular, we show that if there is only one machine with an arbitrary number of linear constraints, or there is an arbitrary number of machines with no more than two linear constraints, or both the number of machines and the number of linear constraints are fixed constants, then the problem is polynomial-time solvable via solving a series of linear programming problems. If both the number of 4 machines and the number of constraints are inputs of the problem instance, then the problem is NP-Hard. We further propose several approximation algorithms for the latter case. We summarize our results in Table 3. In Table 3, the parameters n, m, k stand for the number of jobs, machines and constraints, respectively. The upper line in each cell indicates the computational complexity of the problem, where P refers to polynomial-time solvable and ? refers to complexity unknown; the lower line indicates the running time if the problem is polynomial-time solvable, or the performance ratios of our approximation algorithms if it is NP-Hard. The superscripts indicate the section where the corresponding result appears. The parameter L is the input size of the problem and K is a value depending on k and m whose explicit expression will be given in Section 5.2. k=1 m=1 P O(n) m≥2 [3.2] [3.2] O(n) m≥2 P O(n) [3.2] k ≥ 3 (fixed) k ≥ 3 (input) P P P 2 O(n L) P (fixed) (input) k=2 [4.1] 3 O(n L) P [3.1] O((n + k)3 L)[3.1] P NP-Hard m+k−1 ] L)[4.1] O(nmin{m+1,4} L)[4.1,5.1O(n P 4 O(n L) [5.1] PTAS[4.2] ? Strongly NP-Hard m ,2 min{ m−K − 1 [5.2] } m Table 3: Summary of Results One interesting conclusion from our result is that although parallel machine scheduling is in general an intractable problem, a seemingly more complicated problem — parallel machine scheduling with linear constraints — can be simpler and tractable in many cases. This suggests that instead of finding a feasible solution to the linear constraints and then assigning it to the machines, a decision maker should consider them jointly. In other words, it is often beneficial to consider the problem with a big-picture perspective. The remainder of the paper is organized as follows: In Section 2, we formally state the problem studied in this paper and briefly review some existing results. We study the simplest case in which there is only one machine or one constraint in Section 3. In Section 4, we consider the case with at least two but still a fixed number of machines. In Section 5, we investigate the case where the number of machines is an input of the instance. Finally, some concluding remarks are provided in Section 6. 2. Problem Description The scheduling problem under linear constraints is formally defined as below: 5 Definition 1. Given m identical machines and n jobs. The processing times of the jobs are nonnegative and satisfy k linear inequalities. The goal of the scheduling problem under linear constraints (SLC) is to determine the processing times of the jobs such that they satisfy the linear constraints and to assign the jobs to the machines to minimize the makespan. Formally, let xi be the processing time of job i. The processing times x = (x1 , . . . , xn ) should satisfy Ax ≥ b, x ≥ 0, (1) where A ∈ Rk×n and b ∈ Rk×1 . Parallel machine scheduling with the objective of minimizing the makespan is one of the most basic models in various scheduling problems (e.g., see Chen et al., 1998). This problem is NP-Hard even if there are only two machines, and it is strongly NP-Hard when the number of machines is an input of the instance (Gary & Johnson, 1979). On the algorithmic side, Graham (1966) proposed a 1 )-approximation algorithm for parallel machine scheduling with m ma(2 − m chines. This method, known as the list scheduling (LS) rule, is in fact one of the earliest approximation algorithms. Later, Graham (1969) presented the 1 longest processing time (LPT) rule with an approximation ratio of ( 43 − 3m ) and a polynomial-time approximation scheme (PTAS) when the number of machines is fixed. For the case of a fixed number of machines, Sahni (1976) further proposed a fully polynomial-time approximation scheme (FPTAS). When the number of machines is an input, Hochbaum & Shmoys (1987) showed that a PTAS exists. At first sight, the SLC problem can be formulated as the following optimization problem: min s.t. Pm t y =1 Pnj=1 ij x i=1 i yij ≤ t Ax ≥ b x, t ≥ 0 yij ∈ {0, 1} ∀i = 1, . . . , n ∀j = 1, . . . , m ∀i, j, where yij = 1 indicates that job i is assigned to machine j. This can be viewed as a nonconvex mixed integer (binary) quadratic programming problem (Burer & Letchford, 2012; Köppe, 2011) or a mixed integer (binary) bilinear programming problem (Adams & Sherali, 1993; Gupte et al., 2013). In general, such problems are NP-Hard and extremely hard to solve. In fact, it is unknown whether the mixed integer quadratic programming problem lies in NP (Burer & Letchford, 2012; Jeroslow, 1973). However, with the special structure of the problem, we will show that several cases of the SLC problem can be solved in polynomial time or approximated within a constant factor. 6 3. Single Machine or Single Constraint 3.1. Single Machine If there is only one machine, then the classical parallel machine scheduling problem becomes trivial since the makespan is simply the total processing time. For the SLC problem, it is equivalent to solving the following linear program: n P min xi i=1 (LP1) s.t. Ax ≥ b x ≥ 0. Therefore, we have the following conclusion. We refer the readers to Ye (1997) for the complexity of the interior point methods. Theorem 1. The SLC problem with a single machine can be solved in polynomial time, in particular, in O((n + k)3 L) time by the interior point methods, where L is the size of input length. 3.2. Single Constraint In this subsection, we study the SLC problem with only one constraint, that is, k = 1 and A is a 1 × n matrix. In this case, the linear constraints can be written as n X i=1 ai xi ≥ b, x ≥ 0. Without loss of generality, we assume that a1 ≥ a2 ≥ · · · ≥ an and b ≥ 0. If all ai are nonpositive, then this problem is trivial (all xi = 0 if b = 0, or infeasible if b > 0). Therefore, we assume that there is at least one ai > 0. We define n′ = min{max{i|ai > 0}, m}, where m is the number of machines, and Pn′ σ = i=1 ai . We have the following result: Theorem 2. For the SLC problem with one constraint, the optimal decisions are x1 = · · · = xn′ = b/σ and xi = 0 otherwise, and the optimal makespan is b/σ. Proof. Consider the following linear program: min s.t. (LP2) t n P i=1 n P i=1 ai xi ≥ b xi ≤ mt xi ≤ t x, t ≥ 0. 7 ∀i = 1, . . . , n Note that (LP2) can be viewed as a relaxation of the SLC problem, since any optimal solution to the SLC problem is feasible to (LP2) by choosing x as the processing times and t as its makespan. Suppose we have an optimal solution (x, t) to (LP2). If it is also feasible to the SLC problem, that is, the jobs have processing times x and can be assigned to the m machines with makespan at most t, then it must also be optimal to the SLC problem. The dual problem of (LP2) is max s.t. (DP2) bu ai u − y i − v ≤ 0 n P yi + mv ≤ 1 ∀i = 1, . . . , n i=1 u, v, y ≥ 0. Let xi = b/σ for i = 1, . . . , n′ and xi = 0 otherwise, and t = b/σ be a primal solution. If n′ < m, then let u = 1/σ, v = 0, yi = ai /σ for i = 1, . . . , n′ and yi = 0 otherwise be a dual solution; if n′ = m, let u = 1/σ, v = am /σ, yi = (ai − am )/σ for i = 1, . . . , m and yi = 0 otherwise be a dual solution. In either case, we can verify that (x, t) and (u, v, y) are both feasible and have the same objective values. Consequently, (x, t) is an optimal solution to (LP2). Since n′ ≤ m and all the jobs have processing times either t = b/σ or 0, we can see that (x, t) is feasible to the SLC problem, and hence it is optimal.  4. Fixed Number of Machines (m ≥ 2) In this section, we discuss the case where the number of machines m is at least two but is still a fixed constant. We consider two further cases: when the number of constraints is also fixed and when the number of constraints is an input of an instance. 4.1. Fixed Number of Constraints (k ≥ 2) We show that when both m and k are at least two but are still fixed constants, the SLC problem is polynomial-time solvable. First, we prove the following property of the SLC problem: Lemma 1. The SLC problem has an optimal solution in which at most m+k−1 jobs have nonzero processing times. Proof. We prove that given any optimal solution to the SLC problem, we can find an optimal solution that satisfies the desired property. To show this, suppose we have an optimal solution to the SLC problem in which Il is the set of jobs that are assigned to machine l. We construct the following linear program: (LP3) min s.t. t Ax P ≥b xi ≤ t i∈Il x, t ≥ 0. 8 ∀l = 1, . . . , m It can be seen that any optimal solution to (LP3) is optimal to the SLC problem. Note that there are totally m + k linear constraints (except for the nonnegative constraints) in (LP3), therefore each of its basic feasible solutions has at most m+ k nonzero entries. Now consider the variable t in any basic feasible solution. If t = 0, then all the processing times are zero and the lemma holds. Otherwise, there are at most m + k − 1 nonzero xi s in this basic feasible solution. This implies that there exists an optimal solution which has at most m + k − 1 nonzero processing times and thus the lemma holds.  By Lemma 1, there exists an optimal solution that contains a constant number of nonzero processing times. In view of this, we can find the optimal solution by enumeration. Our approach is to first enumerate all the nonzero processing time jobs and fix their assignments. Then we solve (LP3) to find the best processing times. We denote J as the job set and state the details of this procedure in Algorithm 1: Algorithm 1 Enumeration algorithm for fixed m and fixed k 1: for each subset J ′ of J with m + k − 1 jobs do 2: for each possible assignment of the jobs in J ′ to the m machines do 3: Solve (LP3) while setting xi = 0 for i 6∈ J ′ . 4: if (LP3) is feasible then 5: Let the processing times of jobs be the optimal solution to (LP3), and record the schedule and the makespan. 6: end if 7: end for 8: end for 9: return the schedule with the smallest makespan among all these iterations and its corresponding processing times. Theorem 3. Algorithm 1 returns an optimal solution to the SLC problem and its computational complexity is O(nm+k−1 L). Proof. The optimality follows from Lemma 1, and the fact that there must be an assignment in the enumeration which is identical to the assignment in the true optimal solution. Then when one solves (LP3) with that assignment, an optimal solution will be obtained. Now we study time of Algorithm 1. There are at most   the total running  n O (m + k − 1)m = O(nm+k−1 ) cases in the enumeration algom+k−1 rithm. In each case, we need to solve one linear program (LP3), which has m+k variables (m + k − 1 for x and 1 for t) and the same number of constraints. The running time for solving the linear program is O((m+k)3 L). Therefore, in total,  Algorithm 1 requires O nm+k−1 (m + k)3 L = O(nm+k−1 L) operations. 9 We close this subsection by considering the simple cases where m = 1 and k = 2. In Section 3.1, we show that these cases can be solved in O(n3 L) time via solving the linear program (LP1). Notice that using the enumeration algorithm above, the worst-case running time in this case can be improved to O(n2 L). 4.2. Arbitrary Number of Constraints (k ≥ 2) Now we consider the case in which the number of constraints k is also an input in the problem. In this case, it is easy to see that the classical parallel machine scheduling problem is a special case of the SLC problem, as we can set A in (1) to be an identity matrix and b to be the predetermined processing times of the jobs. Therefore, the hardness result for the parallel machine scheduling problem also stands for the SLC problem, i.e., the SLC problem is NP-Hard when the number of machines is fixed and is strongly NP-Hard when the number of machines is an input (Gary & Johnson, 1979). In the following, we focus on designing approximation algorithms for this case. We first design a PTAS for the case where the number of machines is fixed and the number of constraints is an input. The result is based on guessing the optimal values of the large jobs and the PTAS for the parallel machine scheduling problem with a fixed number of machines by Graham (1969). Before describing our algorithm, we define P to be the optimal value of the following linear program: min n P xi i=1 s.t. Ax ≥ b x ≥ 0. Apparently, P is an upper bound and P/m is a lower bound of the optimal makespan to the SLC problem. In addition, P is polynomial in the input sizes, n and k. We use ⌈x⌉ to denote the smallest integer that is greater than or equal to x. The PTAS for this case is described in Algorithm 2. Theorem 4. Algorithm 2 is a PTAS for the SLC problem when the number of constraints k is an input of the instance, and the number of machines m is a fixed constant. Proof. First we calculate   the computational complexity of Algorithm 2. Fixing n ǫ, Step 3 requires enumerations. Note that (1 + ǫ)l−2 ǫP/m < P , thus h 2 m l < log m ǫ /log (1 + ǫ) + 2 ≤ ǫ log ǫ + 2, where the last inequality follows from the fact that log(1 + ǫ) ≥ ǫ/2 when 0 < ǫ < 1. Therefore, the number of h iterations in Step 4 is lh ≤ ( 2ǫ log m ǫ + 2) , which is polynomially bounded by the input size. In each iteration, solving the linear program (LP4) requires O((n + k)3 L) operations. The number of iterations in Step 9 is O(mh ) and the list scheduling requires O(n log n) time. By the fact that m and ǫ are fixed constants, the total running time is polynomial time. 10 Algorithm 2 PTAS for fixed m and arbitrary k 1: Given ǫ ∈ (0, 1) and P defined as before. 2: Let h = ⌈(m − 1)/ǫ⌉, and divide [0, P ] into T0 = 0, T1 = ǫP/m, . . . , Ti+1 = (1 + ǫ)i ǫP/m, . . . , Tl−1 = (1 + ǫ)l−2 ǫP/m, Tl = P , where l is defined such that (1 + ǫ)l−2 ǫP/m < P ≤ (1 + ǫ)l−1 ǫP/m. 3: for each subset J h of J with h jobs do 4: for each combination of Pi ∈ {T1 , . . . , Tl }, i ∈ J h do 5: Set Qi = Tj−1 if Pi = Tj , ∀i ∈ J h 6: Let J r = J \ J h . Solve the following linear program: min n P xi i=1 (LP4) 7: 8: 9: 10: 11: 12: 13: 14: 15: s.t. Ax ≥ b xj ≤ xi Qi ≤ xi ≤ Pi x ≥ 0. ∀j ∈ J r , i ∈ J h ∀i ∈ J h if (LP4) is feasible then Let the processing times of jobs be the optimal solution to (LP4), and J 0 be the jobs in J h that have processing times in [T0 , T1 ]. for each possible assignment of the jobs in J h \ J 0 to the m machines do Apply list scheduling to the remaining jobs in J 0 ∪ J r , and record the schedule and the processing times. end for end if end for end for return the schedule with the smallest makespan among all these iterations and its corresponding processing times. Now we prove that the returned schedule has a makespan no larger than ∗ 1 + ǫ of the optimal makespan. Let x∗ and Cmax be the processing times and the makespan of the true optimal solution, respectively. We consider the iteration in Algorithm 2 in which the jobs of J h are exactly the h largest jobs in the optimal schedule, the value x∗i falls in [Qi , Pi ] for each i ∈ J h , and the assignment of jobs in J h \ J 0 is the same as those of the optimal solution, where J 0 are the jobs in J h which have processing times in [T0 , T1 ] = [0, ǫP/m]. In this iteration, the linear program must be feasible as x∗ is a feasible solution to (LP4). Denote the processing times and the makespan returned in this iteration by x and Cmax , respectively. We study the last completed job j of the schedule. First, suppose that j is in J h \ J 0 . Consider the schedule in which we keep only the jobs in J h \ J 0 , and the jobs are assigned to the same machines as the optimal schedule. We denote Cx∗ and Cx as the makespans 11 of the above schedule with processing times x∗ and x respectively. Notice that xi ≤ (1 + ǫ)x∗i for all i ∈ J h \ J 0 by the third set of constraints of (LP4), therefore Cx ≤ (1 + ǫ)Cx∗ . By Step 9 of the algorithm, the last completed job j ∈ J h \ J 0 implies that the machine that job j is assigned to only contains jobs in J h \ J 0 . Therefore, Cmax = Cx in this case and it follows that Cmax = Cx ≤ ∗ . (1 + ǫ)Cx∗ ≤ (1 + ǫ)Cmax Next we consider the case in which the last completed job j is in J 0 ∪ J r . ∗ There are two further cases. If j ∈ J 0 , then we have xj ≤ ǫP/m ≤ ǫCmax ≤ mǫ ∗ C , since P/m is a lower bound of the optimal makespan to the problem. m−1 max If P j ∈ J r , then since j is not one of the largest h jobs, we must have xj ≤ n 1 ∗ and x is the optimal solution to i=1 xi . And since x is feasible h Pn to (LP4)P n mǫ ∗ ∗ (LP4), it follows that xj ≤ h1 i=1 xi ≤ h1 i=1 x∗i ≤ m h Cmax ≤ m−1 Cmax . mǫ ∗ 0 r Therefore, xj ≤ m−1 Cmax for all job j in J ∪ J . Then since the jobs in J 0 ∪ J r are scheduled by list scheduling, we have Cmax ≤     n n 1 X 1 1 1 X ∗ ∗ xi + 1 − xi + 1 − xj ≤ xj ≤ (1 + ǫ) Cmax m i=1 m m i=1 m where the first inequality is because j is the last job in the schedule and we used the list scheduling rule, the second inequality is because xi s are optimal mǫ ∗ Cmax as to (LP4) in that iteration, and the last inequality is because xj ≤ m−1 discussed above. Finally, note that the makespan returned by Algorithm 2 cannot be worse than this schedule, thus Theorem 4 holds.  5. Arbitrary Number of Machines (m ≥ 2) In this section, we discuss the case where the number of machines is an input. We first consider the case where there are two constraints, and then look at the case with more than two constraints. 5.1. Two Constraints (k = 2) In this section, we demonstrate that when there are only two constraints, the SLC problem can be solved in polynomial time even if the number of machines is an input of the instance. We start from the following linear program, which is similar to (LP2): min s.t. (LP5) t n P i=1 n P a1i xi ≥ b1 a2i xi ≥ b2 i=1 n P i=1 xi ≤ mt xi ≤ t x, t ≥ 0. 12 ∀i = 1, . . . , n Next, we show that all basic feasible solutions of (LP5) are feasible to the SLC problem. Then since any optimal solution to the SLC problem is feasible to (LP5) by choosing t as its makespan, we know that the optimal basic feasible solution to (LP5) must also be an optimal solution to the SLC problem. We start from the following lemma: Lemma 2. In any basic feasible solution of (LP5), there are at most two variables in x satisfying 0 < xi < t. And it must be one of the following cases: (a) exactly m variables in x satisfying xi = t with all other xi = 0; (b) exactly m − 1 variables in x satisfying xi = t, and at most two variables in x satisfying 0 < xi < t with sum at most t; or (c) no more than m − 2 variables in x satisfying xi = t, and at most two variables in x satisfying 0 < xi < t. Proof. If t = 0, then the lemma trivially holds. Otherwise, we count the number of nonzero variables in the basic feasible solution. We add a slack variable zi to the constraint xi ≤ t so that it is represented as xi + zi = t, ∀i = 1, . . . , n. For any fixed i, if xi = 0 or xi = t, then the number of nonzeros (among xi and zi ) in the equality xi + zi = t is exactly one, otherwise it is two. However, since there are n + 3 constraints in total, there are at most n + 3 nonzero entries in a basic feasible solution of which at most n + 2 are in xi and zi . Therefore, for any basic feasible solution, there can only be at most two indices i ∈ {1, . . . , n} such that 0 < xi < t. The remainder of the lemma follows immediately.  Lemma 2 can be used directly to obtain an algorithm for the SLC problem. We describe it as the LP-based algorithm (Algorithm 3). Notice that in Step 3 of Algorithm 3, Lemma 2 guarantees that the sum of the processing times of the remaining jobs (at most two) is at most t if there is only one idle machine. Therefore, the returned schedule is feasible and the makespan is t, the optimal value of (LP5). Thus, we find an optimal solution to the SLC problem. Algorithm 3 LP-based algorithm for arbitrary m and k = 2 1: Find an optimal basic feasible solution (x, t) to the linear program (LP5), and let x be the processing times of the jobs. 2: Schedule the jobs with processing times xi = t solely. 3: For the remaining (at most two) jobs with 0 < xi < t, if there is only one idle machine, assign these jobs on that machine; otherwise, assign the jobs each on a solo machine. 4: Return x, Cmax = t, and the schedule. The main computation in Algorithm 3 is to find an optimal basic feasible solution. In Korte & Vygen (2012) (Theorem 4.16), a technique is introduced to transform a feasible solution in a linear program to a basic feasible solution by eliminating the inequality constraints one by one, and in each round, it solves a linear program, which requires O(n3 L) operations. Thus the total running time of Algorithm 3 is O(n4 L). 13 Theorem 5. The SLC problem with arbitrary machines and k = 2 constraints can be solved in O(n4 L) by the LP-based algorithm. Note that the LP-based algorithm can also be applied if the number of machines is fixed. When the number of machines is large, the performance of the LP-based algorithm is better than the enumeration algorithm we presented in Theorem 3, which requires O(nm+1 L) operations. 5.2. Fixed or Arbitrary Number of Constraints (k ≥ 3) As mentioned in the previous section, the SLC problem is strongly NP-Hard if the number of constraints is an input of the instance. In this section, we design two approximation algorithms for this case. The first one is derived from the property of parallel machine scheduling problems, and the other one is based on the technique of linear programming. Notice that the approximation algorithms can also be applied to the case where the number of constraints is fixed and greater than two, however, the complexity of that case remains unknown. First, we design a simple approximation algorithm by adapting the wellknown list scheduling rule (Graham, 1966). We first decide the processing times by solving a specific linear program, and then schedule the jobs via the list scheduling rule. The details are given in Algorithm 4. Algorithm 4 Modified list scheduling algorithm for arbitrary k and m 1: Solve the linear program below: min (LP6) 2: 3: s.t. 1 m n P i=1 xi + 1 − Ax ≥ b xi ≤ z x ≥ 0, z ≥ 0. 1 m  z ∀i = 1, . . . , n Denote the optimal solution as x and z. Let x be the processing times of the jobs. Schedule the jobs by the list scheduling rule. Return x and Cmax . We prove that the modified list scheduling algorithm has the same approximation ratio for the SLC problem as for the classical parallel machine scheduling problem. 1 )-approximation Theorem 6. The modified list scheduling algorithm is a (2− m algorithm for the SLC problem. Proof. The running time for solving the linear program is O((n + k)3 L), and for list scheduling is O(n log m). Therefore the total running time is O((n + k)3 L + n log m), which is polynomial in the input size. 14 ∗ Let x∗ , x∗max and Cmax be the processing times, the maximum of the processing times and the makespan of an optimal schedule, respectively. Let x, xmax , and Cmax be those returned by Algorithm 4. Consider the last completed job j. By the list scheduling rule, we have Cmax ≤ ≤     n n 1 1 X 1 1 X xi + 1 − xj ≤ xi + 1 − xmax m i=1 m m i=1 m     n 1 X ∗ 1 1 ∗ ∗ x + 1− xmax ≤ 2 − Cmax . m i=1 i m m The second last inequality holds since the linear program (LP6) returns the minimum value of such an objective function. And this bound is tight from the tight example of the list scheduling rule for the classical problem.  The second approximation algorithm is based on the idea presented in Section 5.1. However, it is not clear how to directly extend (LP5) to obtain an optimal solution in polynomial time. To see this, consider a simple example with n = 4, m = 3, and k = 3, and the constraints are x1 +x2 = x1 +x3 = x1 +x4 = 5. If we try to generalize (LP5), we will get the following linear program: min t s.t. x1 + x2 = x1 + x3 = x1 + x4 = 5 x1 + x2 + x3 + x4 ≤ 3t 0 ≤ x1 , x2 , x3 , x4 ≤ t. It can be verified that the unique optimal solution to this linear program is (x1 , x2 , x3 , x4 , t) = (3, 2, 2, 2, 3). However, the jobs with processing times x2 , x3 , x4 can not be assigned to the two remaining machines with makespan not exceeding three. Therefore, (LP5) may not give a feasible solution to the SLC problem in this case. In the following, we modify it to derive an approximation algorithm. We consider the following linear program: min s.t. (LP7) n P i=1 t Ax ≥ b xi ≤ (m − K) t xi ≤ t x ≥ 0, ∀i = 1, . . . , n where K is defined as: ( k , m − k+1−m K= k max ⌈k̃⌉ − k+1−⌈ , ⌊k̃⌋ − k̃⌉ 15 if k̃ > m, k k+1−⌊k̃⌋  , if k̃ ≤ m, √ where k̃ = k + 1 − k and ⌊x⌋ is the largest integer that is less than or equal to x. Notice that K = 0 for k = 1, 2 and 0 < K ≤ min{m, k} for k ≥ 3 (see Table 4 for various values of K), and K is a rational number since k and m are integers. When k = 2, (LP7) reduces to (LP5), as considered in Section 5.1. If k ≥ 3, however, the optimal solution to the SLC problem may not be feasible to this linear program. Therefore, the optimal solution to (LP7) may not be an optimal solution to the SLC problem. Nevertheless, we prove that the optimal solution to (LP7) is still feasible and has an objective value no larger than a factor of the optimal makespan. k 1 2 3 4 5 10 20 50 100 k̃ = k + 1 − 1 1.59 2.27 3 3.76 7.84 16.53 43.93 91 √ k K m = 100 0 0 0.50 1 1.50 4.67 12 36.86 81 m = 10 0 0 0.50 1 1.50 4.67 8.18 8.78 8.90 ratio m/(m − K) m = 100 m = 10 1 1 1 1 1.0050 1.0526 1.0101 1.1111 1.0152 1.1765 1.0490 1.8750 1.1364 5.5000 1.5837 8.2000 5.2632 9.1000 Table 4: Values of K and the Approximate Ratios for Different k and m Similar to the case where k = 2, we have the following property: Lemma 3. There are at most k variables in x satisfying 0 < xi < t for any basic feasible solution of the linear program (LP7). We omit the proof which is analogous to that of Lemma 2. Lemma 4. For each basic feasible solution of the linear program (LP7) with t > 0, if it has exactly l variable(s) in x satisfying xi = t, where l ∈ {m − ⌈K⌉, m−⌈K⌉−1, . . . , max{m−k, 0}}, then it has additionally at most k variables in x with each processing time 0 < xi < t and their total processing time is at k t. most k+1−m+l Proof. Notice that there are at most m − ⌈K⌉ variables in x satisfying xi = t by the second set of constraints of (LP7), and at most k variables in x satisfying 0 < xi < t by Lemma 3. If there are exactly l variable(s) in x satisfying xi = t, then the sum of the remaining (at most) k variables in x satisfying 0 < xi < t is no larger than (m − l − K) t. It remains to show that m − l − K is no greater k than k+1−m+l . k for x ∈ {1, . . . , k}. It is easy For this, we define a function f (x) = x − k+1−x to see that f (x) is increasing when x ≤ k̃ and decreasing when x ≥ k̃. Therefore, k when k̃ > m, we have m − l − K = m − l − f (m) ≤ m − l − f (m − l) = k+1−m+l ; 16 when k̃ ≤ m, we have m − l − K = m − l − k k+1−m+l . max x∈{1,...,k} f (x) ≤ m − l − f (m − l) = Therefore, the lemma holds.  Lemma 5. Let (x, t) be a basic feasible solution of (LP7), then we can construct a feasible schedule of the SLC problem with a makespan of at most t. Proof. If k ≤ m and this basic feasible solution has at most m − k variables in x satisfying xi = t (those jobs must be assigned solely), then by Lemma 3, there are at most k variables in x satisfying 0 < xi < t and those corresponding jobs can also be assigned solely and we are done. Next, we consider the case where m < k or m ≥ k but there are more than m − k variables in x such that xi = t. Let l denote the number of variables in x such that xi = t. By the case assumption and the constraint in (LP7), l ∈ {m − ⌈K⌉, m − ⌈K⌉ − 1, . . . , max{m − k, 0}}. Without loss of generality, we can assume there are exactly k jobs having processing times xi < t, with some jobs having possibly zero processing times. We now show how to construct a feasible schedule with a makespan at most t. First, we assign the l jobs with processing times xi = t to l machines solely. Then we find the smallest k + 1 − m + l jobs with processing times smaller than t. We claim that these jobs have a total processing time of at most t, and hence can be fit into a single machine. If not, it follows that any k + 1 − m + l of the k jobs with processing times smaller than t have a total processing time greater than t. Then we have the following k inequalities (mod k for each index): x1 + x2 + · · · + xk+1−m+l > t, x2 + x3 + · · · + xk+2−m+l > t, .. . (2) xk−1 + xk + · · · + xk−1−m+l > t, xk + x1 + · · · + xk−m+l > t. On the one hand, summing up inequalities in (2) we obtain (k + 1 − m + l)(x1 + k t. On the other hand, by x2 + · · · + xk ) > kt, or x1 + x2 + · · · + xk > k+1−m+l Lemma 4, the total processing time of the jobs with processing times xi < t is k t, which leads to a contradiction. Finally, there are at most at most k+1−m+l k − (k + 1 − m + l) = m − l − 1 jobs each with processing time smaller than t, and m − l − 1 remaining machines. Assigning these jobs solely provides a feasible solution with a makespan of at most t.  Similar to LP-based algorithm for k = 2, we can find an optimal basic feasible solution of (LP7) in polynomial time and obtain a feasible approximated schedule for the SLC problem. We also call it LP-based algorithm and summarize it in Algorithm 5. Next we study its approximation ratio. Theorem 7. The schedule returned by the LP-based algorithm has a makespan m ∗ ∗ of Cmax = t ≤ m−K Cmax , where Cmax is the optimal makespan of the problem. 17 Algorithm 5 LP-based algorithm for general SLC 1: Find an optimal basic feasible solution (x, t) of the linear program (LP7), and let x be the processing times of the jobs. 2: Let l be the number of jobs with processing times xi = t. Schedule these jobs solely. If there is any remaining job, continue the following process. 3: Find the smallest k + 1 − m + l jobs with processing time 0 < xi < t, and schedule them in a single machine. 4: Schedule the remaining jobs in the remaining m − l − 1 machines solely. 5: Return x, Cmax = t, and the schedule. ∗ Proof. Let x∗ be the optimal schedule with makespan Cmax . It suffices to m ∗ ∗ show that (x , m−K Cmax ) is a feasible solution to (LP7). If that holds, then since Algorithm 5 provides a schedule with makespan t, the optimal value of (LP7), the results hold. To show that, note that x∗ satisfies the first set ∗ of linear constraints of (LP7). Cmax is the optimal makespan implies that n P m m ∗ ∗ ∗ ∗ x∗i ≤ mCmax = (m − K) m−K Cmax , and x∗i ≤ Cmax ≤ m−K Cmax for each i. i=1 m ∗ Cmax ) is a feasible solution. Thus the theorem holds. Therefore, (x∗ , m−K  We show some examples of the ratios m/(m − K) in Table 4. We can see that the LP-based algorithm performs well when k is relatively small. The performance deteriorates when k becomes large. Furthermore, if k is a fixed constant, the approximate ratio is close to one when m is sufficiently large. Finally, we note that in practice one can apply both approximation algorithms 4 and 5, and choose the one that gives a better solution. The approxim 1 mation ratio of the combined algorithm will be min{ m−K ,2 − m }. 6. Conclusion In this paper, we present a scheduling problem in which the processing times of jobs satisfy a set of linear constraints. We discuss the computational complexity and propose several algorithms for the problem. There are two open questions left: whether the case with a fixed number of constraints (more than two) and an arbitrary number of machines is polynomial-time solvable or not (Section 5.2), and how to design an FPTAS or prove that it does not exist for the case with an arbitrary number of constraints and a fixed number of machines (Section 4.2). The current research may inspire further explorations about the scheduling problems with other machine environments, such as uniformly related parallel scheduling, shop scheduling problems, or under various restrictions, e.g., precedences and release dates, or minimizing other objective criterion. One can also consider other combinatorial optimization problems under linear constraints. 18 Acknowledgments Zhenbo Wang’s research has been supported by NSFC No. 11371216. References Adams, W. P., & Sherali, H. D. (1993). Mixed-integer bilinear programming problems. Mathematical Programming, 59 , 279–305. Burer, S., & Letchford, A. N. (2012). Non-convex mixed-integer nonlinear programming: A survey. Surveys in Operations Research and Management Science, 17 , 97–106. Chen, B., Potts, C. N., & Woeginger, G. J. (1998). A review of machine scheduling: Complexity, algorithms and approximability. In D.-Z. Du, & P. M. Pardalos (Eds.), Handbook of Combinatorial Optimization (pp. 21–169). Springer US. Daniels, R., & Kouvelis, P. (1995). Robust scheduling to hedge against processing time uncertainty in single-stage production. Management Science, 41 , 363–376. Danø, S. (1960). Linear Programming in Industry, Theory and Applications: An Introduction. Vienna: Springer-Verlag. Dean, B. C. (2005). Approximation algorithms for stochastic scheduling problems. Ph.D. thesis Massachusetts Institute of Technology Boston. Drexl, A., & Haase, K. (1995). Proportional lotsizing and scheduling. International Journal of Production Economics, 40 , 73 – 87. Drexl, A., & Kimms, A. (1997). Lot sizing and scheduling: Survey and extensions. European Journal of Operational Research, 99 , 221 – 235. Eiselt, H. A., & Sandblom, C. L. (2007). Linear Programming and its Applications. Berlin Heidelberg: Springer-Verlag. Gary, M. R., & Johnson, D. S. (1979). Computers and Intractability: A Guide to the Theory of NP-Completeness. San Francisco: W. H. Freeman and Co. Graham, R. L. (1966). Bounds for certain multiprocessing anomalies. Bell System Technical Journal , 45 , 1563–1581. Graham, R. L. (1969). Bounds on multiprocessor timing anomalies. SIAM Journal on Applied Mathematics, 17 , 416–429. Gupte, A., Ahmed, S., Cheon, M., & Dey, S. (2013). Solving mixed integer bilinear problems using MILP formulations. SIAM Journal on Optimization, 23 , 721–744. 19 Haase, K. (1994). Lotsizing and Scheduling for Production Planning. Berlin Heidelberg: Springer-Verlag. Hochbaum, D. S., & Shmoys, D. B. (1987). Using dual approximation algorithms for scheduling problems: Theoretical and practical results. Journal of the ACM , 34 , 144–162. Jeroslow, R. (1973). There cannot be any algorithm for integer programming with quadratic constraints. Operations Research, 21 , 221–224. Kasperski, A. (2005). Minimizing maximal regret in the single machine sequencing problem with maximum lateness criterion. Operations Research Letters, 33 , 431–436. Kasperski, A., & Zielinski, P. (2008). A 2-approximation algorithm for interval data minmax regret sequencing problems with the total flow time criterion. Operations Research Letters, 36 , 343–344. Köppe, M. (2011). On the complexity of nonlinear mixed-integer optimization. In J. Lee, & S. Leyffer (Eds.), Mixed-Integer Nonlinear Programming. IMA Volumes in Mathematics and its Applications (pp. 533–558). Berlin: Springer volume 154. Korte, B., & Vygen, J. (2012). Combinatorial Optimization: Theory and Algorithms. (4th ed.). Berlin Heidelberg: Springer-Verlag. Kreipl, S., & Pinedo, M. L. (2004). Planning and scheduling in supply chains: An overview of issues in practice. Production and Operations Management , 13 , 77–92. Möhring, R. H., Radermacher, F. J., & Weiss, G. (1984). Stochastic scheduling problems I: General strategies. ZOR - Zeitschrift für Operations Research, 28 , 193–260. Möhring, R. H., Schulz, A. S., & Uetz, M. (1999). Approximation in stochastic scheduling: The power of LP-based priority policies. Journal of the ACM , 46 , 924–942. Nowicki, E., & Zdrzalka, S. (1988). A two-machine flow shop scheduling problem with controllable job processing times. European Journal of Operational Research, 34 , 208–220. Nowicki, E., & Zdrzalka, S. (1990). A survey of results for sequencing problems with controllable processing times. Discrete Applied Mathematics, 26 , 271– 287. Pinedo, M. (2009). Planning and Scheduling in Manufacturing and Services. New York: Springer Science + Business Media. Pinedo, M. (2012). Scheduling: Theory, Algorithms, and Systems. New York: Springer Science + Business Media. 20 Sahni, S. (1976). Algorithms for scheduling independent tasks. Journal of the ACM , 23 , 116–127. Shabtay, D., & Steiner, G. (2007). A survey of scheduling with controllable processing times. Discrete Applied Mathematics, 155 , 1643–1666. Ye, Y. (1997). Interscience. Interior Point Algorithms: Theory and Analysis. 21 Wiley-
8cs.DS
arXiv:1604.00685v1 [math.ST] 3 Apr 2016 A Constructive Definition of the Beta Process JOHN PAISLEY1,* and MICHAEL I. JORDAN2,** 1 Department of Electrical Engineering, Columbia University E-mail: * [email protected] 2 Department of Statistics and Department of EECS, University of California, Berkeley E-mail: ** [email protected] We derive a construction of the beta process that allows for the atoms with significant measure to be drawn first. Our representation is based on an extension of the Sethuraman (1994) construction of the Dirichlet process, and therefore we refer to it as a stick-breaking construction. Our first proof uses a limiting case argument of finite arrays. To this end, we present a finite sieve approximation to the beta process that parallels that of Ishwaran & Zarepour (2002) and prove its convergence to the beta process. We give a second proof of the construction using Poisson process machinery. We use the Poisson process to derive almost sure truncation bounds for the construction. We conclude the paper by presenting an efficient sampling algorithm for beta-Bernoulli and beta-negative binomial process models. Keywords: beta processes, Poisson processes, Bayesian nonparametrics. 1. Introduction Stick-breaking constructions play an important role in Bayesian nonparametric models because they allow for the construction of infinite dimensional discrete measures with sparse weights (Sethuraman, 1994; Ishwaran & James, 2001). The canonical stickbreaking construction was derived by Sethuraman (1994) for the Dirichlet process (Ferguson, 1973). According to this construction, given a probability measure G0 and constant α > 0, the random probability measure G= ∞ X i=1 Vi i−1 Y (1 − Vj )δθi , iid Vi ∼ Beta(1, α), iid θi ∼ G0 (1) j=1 is a Dirichlet process, denoted G ∼ DP(αG0 ). Dirichlet processes have a very developed literature in Bayesian nonparametrics (see, e.g., Hjort et al. (2010)). A recently growing research area within Bayesian nonparametrics has been on beta process priors and associated models. The beta process has been presented and developed in the statistics literature for applications in survival analysis (Hjort, 1990; Muliere & Walker, 1997; Kim & Lee, 2001; Lee & Kim, 2004). Recent developments in the statistical machine learning literature have found beta processes useful for nonparametric latent factor models (Griffiths & Ghahramani, 2006; Thibaux & Jordan, 2007); this perspective 1 2 Paisley and Jordan has found many applications (Williamson et al., 2010; Fox et al., 2010; Paisley & Carin, 2009; Zhou et al., 2012; Broderick et al., 2012a). As with the Dirichlet process, representations are needed for working with the beta process. A marginalized representation for the beta-Bernoulli process called the Indian buffet process (IBP) (Griffiths & Ghahramani, 2006) was recently presented that has the beta process as the underlying DeFinetti mixing measure (Thibaux & Jordan, 2007). Therefore, the IBP stands in similar relation to the beta process as the Chinese restaurant process does to the Dirichlet process (Aldous, 1985). Recently, Paisley et al. (2010) presented a method for explicitly constructing beta processes based on the notion of stick-breaking, and further developed these ideas in Paisley et al. (2012). In this paper we collect these results and also present new results on asymptotically correct finite approximations to the beta process, truncation bounds for working with the beta-negative Binomial process, and posterior sampling for the beta-Bernoulli and beta-negative binomial processes. The paper is organized as follows: In Section 2 we review the beta process and its connection to the Poisson process. We present a finite approximation to the beta process in Section 3 and prove that it has the correct asymptotic distribution. We use this approximation in Section 4 in our first proof of the stick-breaking construction of the beta process and present a second proof using the Poisson process machinery. In Section 5 we derive bounds on truncated stick-breaking approximations for models based on the beta-Bernoulli and beta-negative binomial processes. We then present simple posterior sampling schemes for these two processes in Section 6. 2. Beta processes Beta processes comprise a class of completely random measures (Kingman, 1967). They are defined on an abstract measurable space (Θ, A), are almost surely discrete, and have the property that the mass of any particular atom lies in the interval (0, 1]. The beta process has an underlying Poisson process driving it on the space (Θ × [0, 1], A ⊗ B). We use this representation in the following definition. Definition 1 (Beta process). Let N be a Poisson random measure on (Θ × [0, 1], A⊗ B) with mean measure ν(dθ, dπ) = α(θ)π −1 (1−π)α(θ)−1 dπµ(dθ), where µ is a diffuse σ-finite measure and the function α(θ) is strictly positive and finite. For a compact set A ∈ A, define the completely random measure Z N (dθ, dπ)π. H(A) = A×[0,1] Then H is a beta process with concentration α(·) and base µ, denoted H ∼ BP(α, µ). The Poisson random measure N (dθ, dπ) is a random counting measure such that for S ∈ A ⊗ B, the distribution of N (S) is Poisson with parameter ν(S). It is also completely random, since for any collection of pairwise disjoint sets S1 , . . . , Sk ∈ A ⊗ B, A Constructive Definition of the Beta Process 3 the random variables N (S1 ), . . . , N (Sk ) are independent, which by extension proves that H is completely random (Çinlar, 2011). A fundamental aspect of the study of Poisson random measures is analyzing how they behave when integrated against a function—in this case studying the integral R N (dθ, dπ)f (θ, π) over subsets of Θ × [0, 1]. Definition 1 is the special case where f (θ, π) = π and the integral is taken over the entire interval [0, 1] in the π dimension. It follows (Çinlar, 2011) that for t < 0 the Laplace functional of H is ) ( Z  (2) ν(dθ, dπ) 1 − etπ , E etH(A) = exp − A×[0,1] with mean measure ν given in Definition 1, ν(dθ, dπ) = α(θ)π −1 (1 − π)α(θ)−1 dπµ(dθ). (3) The beta process is completely characterized by the mean measure of its underlying Poisson random measure. We divide this mean measure into two measures: A σ-finite and diffuse base measure µ, and a transition probability kernel λ(θ, dπ) = α(θ)π −1 (1 − π)α(θ)−1 dπ, which is a measure on [0, 1] for each θ called the Lévy measure. By defining the beta process as in Definition 1 Rits existence immediately follows from 1 the well-studied Poisson process machinery; since 0 (|π| ∧ 1)λ(θ, dπ) = 1 < ∞, by Campbell’s theorem it follows that H(A) is finite almost surely. The form of Equation (2) shows that H is a pure-jump process, and the fact that λ(θ, [0, 1]) = ∞, but λ(θ, [ǫ, 1]) < ∞ for all θ and ǫ > 0 ensures that H has an infinite number of jumps in any set A ∈ A for which µ(A) > 0, but only a finite number of magnitude greater than ǫ. Since H is a pure-jump process with an infinite number of jumps, it can be written as a sum over delta measures; it will later be convenient to use two indices for this process. We can therefore write H as either H= ∞ X i=1 πi δθi , or equivalently H= Ci ∞ X X πij δθij , (4) i=1 j=1 where Ci is a random variable that will appear later and is finite almost surely. We will also slightly abuse notation by letting θ ∈ H indicate an atom that has nonzero measure according to H. As shown, a beta process is equivalently represented as a function of a Poisson random measure on the extended space Θ × [0, 1]. We indicate the set of atoms of this Poisson random measure by Π = {(θ, π)}, which is the set of locations with measure one according to N . The following two general lemmas about the resulting Poisson point process Π will be used later in this paper. Lemma 1 (Marked Poisson process (Çinlar (2011), Theorem 6.3.2)). Let Π∗ be a Poisson process on Θ with mean measure µ. For each θ ∈ Π∗ associate a random variable π drawn from a transition probability kernel λ(θ, ·) from (Θ, A) into ([0, 1], B). Then the set Π = {(θ, π)} is a Poisson process on Θ × [0, 1] with mean measure µ(dθ)λ(θ, dπ). 4 Paisley and Jordan Lemma 2 (Superposition property (Kingman (1993), Ch. 2, Sec. 2)). Let Π1 , Π2 , . . . be a countable collection of independent Poisson processes on Θ×[0, 1]. Let Πi have mean S∞ Π measure ν . Then the superposition Π = i=1 i is a Poisson process with mean measure P∞ i ν = i=1 νi . In the next section we will present a finite approximation of the beta process and prove that it is asymptotically distributed as a beta process. We will then use this finite approximation in our derivation of the stick-breaking construction presented in Section 4. 3. A finite approximation of the beta process In this section and we consider beta processes with a constant concentration function, α(θ) = α. In this case, the beta process with constant concentration can be approximated using a finite collection of beta random variables and atoms drawn from a base distribution as follows: Definition 2 (Beta prior sieves). Let α(θ) = α and µ be a diffuse and finite measure on (Θ, A). For an integer K > µ(Θ), we define a finite approximation to the beta process PK as HK = k=1 πk δθk , where πk ∼ Beta(αµ(Θ)/K, α(1 − µ(Θ)/K)) and θk ∼ µ/µ(Θ), with all random variables drawn independently. This is similar in spirit to approximations of the Dirichlet process using finite Dirichlet distributions and i.i.d. atoms. Ishwaran & Zarepour (2002) proved that such an approximation converges in the limit to a Dirichlet process under certain parameterizations. We present a proof of the following corresponding result. Theorem 1 (Convergence of finite approximation). For the finite approximation of the beta process given in Definition 2, limK→∞ HK converges in distribution to H ∼ BP(α, µ). Proof. We prove that the Laplace functional of HK given in Definition 2 converges to the Laplace functional of a beta process given in Equations (2) and (3) with α and µ satisfying the conditions of Definition 2. Let H := limK→∞ HK and let t < 0 and A ∈ A. By the dominated convergence theorem and the independence of all random variables, E etH(A) = = lim E etHK (A) iK h lim EetπI(θ∈A) , K→∞ K→∞ (5) A Constructive Definition of the Beta Process 5 P where HK (A) = K k=1 πk I(θk ∈ A). Using the tower property of conditional expectation and the law of total probability, the expectation in (5) is equal to h h ii E etπI(θ∈A) = E E etπI(θ∈A) I(θ ∈ A) + etπI(θ∈A) I(θ 6∈ A)|θ P(θ ∈ A)E etπ + P(θ 6∈ A) µ(A) µ(A) tπ Ee + 1 − . µ(Θ) µ(Θ) = = (6) Again we use the fact that θ ∼ µ/µ(Θ) and is independent of π. The Laplace transform of π ∼ Beta(αµ(Θ)/K, α(1 − µ(Θ)/K)) is E etπ = 1 + ∞ s s−1 X t Y s=1 s! αµ(Θ) K r=0 +r . α+r (7) Using this in Equation (6) and manipulating the result gives E etπI(θ∈A) = = 1+ ∞ s−1 µ(A) X ts Y µ(Θ) s=1 s! r=0 αµ(Θ) K +r α+r ∞ s−1 1 µ(A) X ts Y r + O( 2 ) 1+ K s=1 s! r=1 α + r K (8) (9) ∞ = = = = µ(A) X ts αΓ(α)Γ(s) 1 + O( 2 ) K s=1 s! Γ(α + s) K Z ∞ 1 µ(A) X ts 1 1+ απ s−1 (1 − π)α−1 dπ + O( 2 ) K s=1 s! 0 K ! Z 1 X ∞ (tπ)s 1 µ(A) απ −1 (1 − π)α−1 dπ + O( 2 ) 1+ K s! K 0 s=1 Z 1  1 µ(A) etπ − 1 απ −1 (1 − π)α−1 dπ + O( 2 ). 1+ K K 0 1+ (10) (11) (12) (13) In Equation (9) we use the convention that the product equals one when s = 1. Taking the limit of Equation (5) using the value in Equation (13), the O(K −2 ) term disappears and we have the familiar exponential limit,   Z 1 iK h  −1 tπ α−1 tπI(θ∈A) e − 1 απ (1 − π) dπ , (14) = exp µ(A) lim Ee K→∞ 0 which we recognize as the Laplace transform of a beta process H(A) drawn from a beta process. Since this is true for all A ∈ A, we get the corresponding Laplace functional of a beta process. 6 Paisley and Jordan 4. A stick-breaking construction of the beta process Because the beta process is an infinite jump process, efficient methods are necessary for finding these jump locations. The stick-breaking construction of the beta process is one such method that stands in similar relation to the beta process as the Sethuraman (1994) construction does to the Dirichlet process. Indeed, because we directly use results from Sethuraman (1994), the form of the construction is very similar to Equation (1). Theorem 2 (Stick-breaking construction of the beta process). Let µ be a diffuse and finite measure on (Θ, A) and α(θ) be a strictly positive and finite function on Θ. The following is a constructive definition of the beta process H ∼ BP(α, µ), H= Ci ∞ X X (i) Vij i=1 j=1 iid Ci ∼ Pois(µ(Θ)), (l) i−1 Y (l) (1 − Vij )δθij , (15) l=1 ind Vij | θij ∼ Beta(1, α(θij )), iid θij ∼ µ/µ(Θ). This construction sequentially incorporates into H a Poisson-distributed number of atoms drawn i.i.d. from µ/µ(Θ), with each group in this sequence indexed by i. The atoms receive weights in (0, 1] drawn independently as follows: Using an atom-specific stick-breaking construction, an atom in group i throws away the first i − 1 breaks of its stick and keeps the ith break as its weight. We present a straightforward extension of Theorem 2 to σ-finite µ. Corollary 1 (A σ-finite extension). Let (Ek ) be a partition of Θ, where each Ek is compact and therefore µ(Ek ) < ∞. The construction of Theorem 2 can be extended to this case by constructing independent beta processes over each Ek and obtaining the full beta process by summing the beta process over each set. For the remainder of the paper we will assume µ(Θ) = γ < ∞. Several inference algorithms have been presented for this construction (Paisley et al., 2010, 2011, 2012) using both MCMC and variational methods. Recently, Broderick et al. (2012a) extended Theorem 2 to beta processes with power-law behavior. Theorem 3 (A power-law extension (Broderick et al., 2012a)). Working within the setup of Theorem 2 with α(θ) equal to the constant α, let β be a discount parameter in (ℓ) (0, 1). Construct H similar to Theorem 2, with the exception that Vij ∼ Beta(1 − β, α + iβ). Then H exhibits power law behavior of Type I and II, but not of Type III. 4.1. Proof of Theorem 2 via the finite approximation We first prove the construction for constant α(θ) by constructing finite arrays of random variables and considering their limit. To this end, working with the finite approximation A Constructive Definition of the Beta Process 7 in Definition 2, we represent each beta-distributed random variable by the stick-breaking construction of Sethuraman (1994). That is, we apply the constructive definition of a Dirichlet distribution to the beta distribution, which is the two-dimensional special case. Using this construction, we can draw π ∼ Beta(a, b) as follows. Lemma 3 (Constructing a beta random variable (Sethuraman, 1994)). Draw an infinite sequence of random variables (V1 , V2 , . . . ) i.i.d. Beta(1, a + b) and a second sequence Qi−1 P a ). Construct π = ∞ (Y1 , Y2 , . . . ) i.i.d. Bern( a+b j=1 (1 − Vj )I(Yi = 1). Then π has i=1 Vi a Beta(a, b) distribution. Practical applications have led to the study of almost sure truncations of stick-breaking processes (Ishwaran & James, 2001). By extension, an almost sure truncation of a beta random variable is constructed by truncating the sum in Lemma 3 at level R. As R → ∞ this truncated random variable converges to a beta-distributed random variable. Using an R-truncated beta random variable, a corollary of Theorem 1 and Lemma 3 is, Corollary 2. Under the prior assumptions of Definition 2, draw two K × R arrays of independent random variables, Vki ∼ Beta(1, α) and Yki ∼ Bern(µ(Θ)/K), and draw θk i.i.d. µ/µ(Θ) for k = 1, . . . , K. Let (R) HK = R X K X i=1 k=1 (R) Then HK R → ∞. Vki i−1 Y (1 − Vki′ )I(Yki = 1)δθk . i′ =1 converges in distribution to H ∼ BP(α, µ) by letting K → ∞ and then First proof of Theorem 2. We show that Theorem 2 with a constant function α(θ) results from Corollary 2 in the limit as K → ∞ and R → ∞. We first note that column sums of Y are marginally distributed as Bin(K, µ(Θ)/K), and are independent. This value gives the number of atoms receiving probability mass at step i, with Yki = 1 indicating the kth indexed atom is one of them. Let the set IiK = {k : Yki = 1} be the index set of these atoms at finite approximation level K. This set is constructed by selecting CiK ∼ Bin(K, µ(Θ)/K) values from {1, . . . , K} uniformly without replacement. In the limit K → ∞, CiK → Ci with Ci ∼ Pois(µ(Θ)). Given k ∈ IiK , we know that πk has weight added to it from the ith break of its own stick-breaking construction. As a matter of accounting, we are interested other values i′ for which Yki′ = 1, particularly when i′ < i. We next show that in the limit K → ∞, the index values in the set Ii := Ii∞ are always unique from those in previous sets (i′ < i), meaning for a given column L ≤ R, we see new index values with probability equal to one. We are therefore always adding probability mass to new atoms. Let E be the event that there exists a number k ∈ Ii ∩ Ii′ for i 6= i′ and i, i′ ≤ L ≤ R. We can bound the 8 Paisley and Jordan probability of this event as follows: S PK ( i′ <i≤L IiK ∩ IiK′ 6= ∅ | µ) ≤ ≤ X PK (IiK ∩ IiK′ 6= ∅ | µ) i′ <i≤L K X X PK (Yki Yki′ = 1|µ) i′ <i≤L k=1 ≤ L(L − 1) µ(Θ)2 . 2 K (16) Therefore, for any finite integer L ≤ R, in the limit K → ∞ the atoms θk , k ∈ IL , are different from all previously observed atoms with probability one since µ is a diffuse measure. Since this doesn’t depend on R, we can let R → ∞. The proof concludes by recognizing that the resulting process is equivalent to (15)  4.2. Proof of Theorem 2 via Poisson processes In this section, we give a second proof based on the the Poisson process that is extended to a non-constant α(θ). Specifically, we show that the construction of Theorem 2 has the distribution of a beta process by showing that its Laplace functional has the form given in Equations (2) and (3). To this end, we use the following lemma to obtain an equivalent representation of Theorem 2. Lemma 4. Qr Let (V1 , . . . , Vr ) be i.i.d. Beta(1, α). If T ∼ Gamma(r, α), then the random variables j=1 (1 − Vj ) and exp{−T } are equal in distribution. Proof. ln(1 − Vk ). By a change of variables, ξk ∼ Exp(α). The function Q Define ξk = −P r − ln rj=1 (1 − Vj ) = k=1 ξk , where the ξk are i.i.d. because Vk are i.i.d. Therefore Pr T := k=1 ξk has a Gam(r, α) distribution and the result follows. Using Lemma 4, we have a construction of H equivalent to that given in Theorem 2, H= C1 X V1j δθ1j + j=1 iid Vij | θij ∼ Beta(1, α(θij )), Ci ∞ X X Vij e−Tij δθij , iid Ci ∼ Pois(µ(Θ)), (17) i=2 j=1 ind Tij | θij ∼ Gam(i − 1, α(θij )), iid θij ∼ µ/µ(Θ). Second proof of Theorem 2. By applying Lemmas 1 and 2, we observe PCithat the construction in (17) has an underlying Poisson process as follows: Let Hi := j=1 πij δθij P∞ and H = i=1 Hi , where π1j = V1j and πij := Vij e−Tij , i > 1. The set of atoms in each Hi forms an independent Poisson process Π∗i on Θ with mean measure µ. The atoms in Poisson process Π∗i are marked with weights π ∈ [0, 1] conditioned on θ that are independent λi , where λi is the probability measure on πij , which we derive later. A Constructive Definition of the Beta Process 9 It follows from Lemma 1 that each Hi is a function of an Poisson process Πi = {(θi , πi )} on Θ × [0, 1] with mean Lemma 2 H isPa function of a S∞measure µ × λi . Therefore, byP ∞ ∞ Poisson process Π = i=1 Πi with mean measure ν = i=1 νi = µ × i=1 λi . We see that calculating ν for (17) amounts to summing the Lévy measures λi . These measures fall into two cases, which we give below. Case i = 1 : Since V1j | θ1j ∼ Beta(1, α(θ1j )), the Poisson process Π1 underlying H1 has mean measure µ × λ1 , with Lévy measure λ1 (dπ) = α(θ)(1 − π)α(θ)−1 dπ. (18) We write λ1 (dπ) = f1 (π|α, θ)dπ where f1 (π|α, θ) is the density of ν1 with respect to Lebesgue measure dπ. Case i > 1 : The Lévy measure of the Poisson process Πi underlying Hi for i > 1 requires more work to derive its associated density fi . Recall that πij := Vij exp{−Tij }, where Vij | θij ∼ Beta(1, α(θij )) and Tij | θij ∼ Gamma(i − 1, α(θij )). First, let Wij := i−1 α(θ)−1 (− ln w)i−2 . exp{−Tij }. Then by a change of variables, pW (w|i, α, θ) = α(θ) (i−2)! w Using the product distribution formula for two random variables (Rohatgi, 1976), the density of πij = Vij Wij is fi (π|α, θ) = Z 1 w−1 pV (π/w|α, θ)pW (w|i, α, θ)dw (19) π = α(θ)i (i − 2)! Z 1 π w−1 (ln 1 i−2 ) (w − π)α(θ)−1 dw. w This integral does not have a closed-form solution. Calculating λ : We have decomposed the Σ-finite measure λ into a sequence of finite measures that can be added to calculate the mean measure of the Poisson process underlying (15). Since ν(dθ, dπ) = ∞ X (µ × λi )(dθ, dπ) = µ(dθ)dπ ∞ X fi (π|α, θ), i=1 i=1 P∞ by showing that i=1 fi (π|α, θ) = α(θ)π −1 (1 − π)α(θ)−1 , we completeP the proof. From ∞ Equations (18) and (19) we have that that λ(dπ) = α(θ)(1−π)α(θ)−1 dπ+ i=2 fi (π|α, θ)dπ, where Z 1 ∞ ∞ X X α(θ)i π 1 fi (π|α, θ) = wα(θ)−2 (ln )i−2 (1 − )α(θ)−1 dw (i − 2)! π w w i=2 i=2 Z 1 ∞ X α(θ)i−2 π 1 = α(θ)2 wα(θ)−2 (1 − )α(θ)−1 dw (ln )i−2 w (i − 2)! w π i=2 Z 1 = α(θ)2 w−2 (1 − π/w)α(θ)−1 dw . (20) π 10 Paisley and Jordan The second equality is by monotone convergence and Fubini’s theorem and leads to an α(θ) . Adding the two terms exponential power series. The last integral is equal to α(θ)(1−π) π shows that the mean measure equals that of a beta process given in Equation (3).  5. Almost sure truncations of the beta process Truncated beta processes can be used in MCMC sampling schemes, and also arise in the variational inference setting (Doshi-Velez et al., 2009; Paisley et al., 2011; ?). Poisson process representations are useful for characterizing the part of the beta process that is being thrown away in the truncation. Consider a stick-breaking construction of the beta P process truncated after group R, defined as H (R) = R i=1 Hi . The part being discarded, H − H (R) , has an underlying Poisson process with mean measure + νR (dθ, dπ) := ∞ X i=R+1 νi (dθ, dπ) = µ(dθ) × ∞ X λi (dπ), (21) i=R+1 and a corresponding counting measure NR+ (dθ, dπ). This measure contains information about the missing atoms; for example, the number of missing atoms having weight π ≥ ǫ + (Θ, [ǫ, 1]). is Poisson distributed with parameter νR For truncated beta processes, a measure of closeness to the true beta process is helpful when selecting truncation levels. We derive approximation error bounds in the context of the beta-Bernoulli process. The definition of the Bernoulli process is Definition 3 (Beta-Bernoulli process). Draw a beta process H ∼ BP(α, µ) on (Θ, A) with µ finite. Define a process X on the atoms of H such that X({θ})|H ∼ Bern(H({θ})) independently for all θ ∈ H. Then X is a Bernoulli process, denoted X | H ∼ BeP(H). Returning to the bound, let data Yn ∼ f (Xn , φn ), where Xn is a Bernoulli process taking either H or H (R) as parameters, and φn is a set of additional parameters (which could be globally shared). Let Y = (Y1 , . . . , YM ). One measure of closeness is the total variation distance between the marginal density of Y under the beta process, denoted m∞ (Y), and the process truncated at group R, denoted mR (Y). This measure originated with work on truncated Dirichlet processes in Ishwaran & James (2001) and was extended to the beta process in Doshi-Velez et al. (2009). After slight modification to account for truncating groups rather than atoms, we have Z 1 |mR (Y) − m∞ (Y)|dY ≤ P {∃(i, j), i > R, 1 ≤ n ≤ M : Xn (θij ) 6= 0} . (22) 2 We derive this bound in the appendix. In words, this says that one half the total variation between mR and m∞ is less than one minus the probability that, in M Bernoulli processes with parameter H ∼ BP(α, µ), Xn (θ) = 0 for all θ ∈ Hi when i > R. In Doshi-Velez et al. (2009) and Paisley et al. (2011), a looser version of this bound was obtained. Using the Poisson process representation of H, we can give an exact form of this bound. A Constructive Definition of the Beta Process 11 iid Theorem 4 (Truncated stick-breaking constructions). Let X1:M ∼ BeP(H) with H ∼ BP(α, µ) constructed as in (15). For a truncation level R, let E be the event that there exists an index (i, j) with i > R such that Xn (θij ) = 1. Then the bound in (22) equals ) ( Z  + M . P(E) = 1 − exp − νR (Θ, dπ) 1 − (1 − π) (0,1]   k k−1 Proof (Simple functions) Let the set Bnk = k−1 n , n and bnk = n , where n and k ≤ n arePpositive integers. Approximate the variable π ∈ [0, 1] with the simple Q function n gn (π) = k=1 bnk 1Bnk (π). We calculate the truncation error term, P(E c ) = E[ i>R,j (1− πij )M ], by approximating with gn , re-framing the problem as a Poisson process with mean + and counting measures νR and NR+ (Θ, B), and then taking a limit: E hY i>R,j (1 − πij )M i = lim n→∞ = exp n Y k=2 ( i h + E (1 − bnk )M·NR (Θ,Bnk ) lim − n→∞ n X + νR (Θ, Bnk ) (23) M 1 − (1 − bnk ) k=2 )  . For a fixed n, this approach divides the interval [0, 1] into disjoint regions that can be analyzed separately as independent Poisson processes. Each region uses the approximation π ≈ gn (π), with limn→∞ gn (π) = π, and NR+ (Θ, B) counts the number of atoms with + , the weights that fall in the interval B. Since NR+ is Poisson distributed with mean νR expectation follows.  One can use approximating simple functions to give an arbitrarily close approximation + + of Theorem 3; since νR = νR−1 − νR and ν0+ = ν, performing a sweep of truncation levels requires approximating only one additional integral for each increment of R. From the Poisson process, we also have the following analytical bound, which we present for a constant α(θ) = α. Corollary 3 (A bound on Theorem 4). Given the setup in Theorem 4 with α(θ) = α, an upper bound on P(E) is (  R ) α P(E) ≤ 1 − exp −µ(Θ)M . 1+α Proof. From the proof of Theorem 4, we have Q Q P(E) = 1 − E[ i>R,j (1 − πij )M ] ≤ 1 − E[ i>R,j (1 − πij )]M . This second expectation can be calculated as Rin Theorem 4 with M replaced by a one. 1 + We therefore wish to calculate the negative of 0 πνR (Θ, dπ). Let qr be the distribution of theP rth break from a Beta(1, α) stick-breaking process. Then this integral is equal to α r α R −1 ( 1+α µ(Θ) ∞ ) , this solves to µ(Θ)( 1+α ) . r=R+1 Eqr [π]. Since Eqr [π] = α 12 Paisley and Jordan R1 + We observe that the term in the exponential equals the negative of M 0 πνR (Θ, dπ), which is the expected number of missing ones in M observations from the truncated Bernoulli process. Other stochastic processes can also take H as parameter. The negative binomial process is one such process (Broderick et al., 2012b; Zhou & Carin, 2012; Heaukulani & Roy, 2013) and has the following definition. Definition 4 (Beta-Negative binomial process). Draw a beta process H ∼ BP(α, µ) on (Θ, A) with µ finite. Define a process X on the atoms of H such that X({θ})|H ∼ NegBin(r, H({θ})) independently for all θ ∈ H, where r > 0. Then X is a negative binomial process, denoted X | H ∼ NBP(H). In the derivation in the appendix, we show how the inequality in Equation (22) applies to the beta-negative binomial process as well. The only difference is in calculating the probability of the event we call E above. This results in the following. Corollary 4 (A negative binomial extension). iid X1:M ∼ NBP(r, H) we have ( Z P(E) = 1 − exp − (0,1] P(E) ≤ ( Given the setup in Theorem 4, but with + νR (Θ, dπ) 1 − exp −µ(Θ)M r  α 1+α Mr 1 − (1 − π) R ) )  , . Q Q Proof. After recognizing that P(E c ) = E[ i>R,j (1 − πij )Mr ] ≥ E[ i>R,j (1 − πij )]Mr for this problem, proof of the first line follows from the proof of Theorem 4 and proof of the second line follows from the proof of Corollary 3. 6. Posterior inference for the beta process We present a simple method for sampling from the posterior of the beta-Binomial and beta-negative binomial processes. We show that posterior sampling can be separated into two parts: Sampling the weights of the almost surely finite number of observed atoms and sampling the weights of the infinitely remaining unobserved atoms. To this end, we will need the following lemma for sampling from a beta distribution. Lemma 5 (Product representation of a beta random variable). Let η1 ∼ Beta(a1 , a2 ), η2 ∼ Beta(b1 , b2 ) and η3 ∼ Beta(a1 + a2 , b1 + b2 ), all independently. If we define the weighted average π = η3 η1 + (1 − η3 )η2 , then π ∼ Beta(a1 + b1 , a2 + b2 ). Proof. This is a special case of Lemma 3.1 in Sethuraman (1994). A Constructive Definition of the Beta Process 13 6.1. Sampling from the posterior of the beta-Bernoulli process The beta process is conjugate to the Bernoulli process (Kim, 1999), which is evident using the following hierarchical representation for the beta-Bernoulli process (see the appendix for details) iid Xi (dθ) | H ∼ Bern(H(dθ)), H(dθ) ∼ Beta{α(θ)µ(dθ), α(θ)(1 − µ(dθ))}. (24) Let the count statistics from n independent Bernoulli processes be M1 (dθ) := n X Xi (dθ), M0 (dθ) := n X (1 − Xi (dθ)) . i=1 i=1 Using the count functions M1 and M0 , the posterior distribution of H is H(dθ) | X1 , . . . , Xn ∼ Beta{α(θ)µ(dθ) + M1 (dθ), α(θ)(1 − µ(dθ)) + M0 (dθ)}. (25) In light of Lemma 5, we can sample from the distribution in Equation (25) as follows, H(dθ) | X1 , . . . , Xn = η(dθ)P (dθ) + (1 − η(dθ))H ′ (dθ), ind η(dθ) ∼ Beta(n, α(θ)), ind P (dθ) ∼ Beta (M1 (dθ), M0 (dθ)) , ind H ′ ∼ BP(α, µ). (26) Therefore, drawing from the posterior involves sampling from an uncountably infinite set of beta distributions. Fortunately we can separate this into an observed countable set of atoms, and the remaining unobserved and uncountable locations (Kingman, 1967). Let Ω = {θ : M1 (dθ) > 0}. Then Ω is almost surely finite (Thibaux & Jordan, 2007) and can be referred to as the set of “observed” atoms. We note that for all θ 6∈ Ω, P (dθ) = 0 a.s., whereas P (dθ) > 0 a.s. if θ ∈ Ω. H ′ (dθ) = 0 a.s. for all θ ∈ Ω since µ is diffuse. To sample from this posterior, the weighted probabilities η(dθ)P (dθ) can be drawn first for all θ ∈ Ω. Then H ′ can be drawn using a truncated stick-breaking construction of the beta process following which an atom θ ∈ H ′ is weighted by 1 − η(θ) ∼ Beta(α(θ), n) This can be drawn separately since an atom in H ′ is a.s. not in Ω.1 6.2. Sampling from the posterior of the beta-NB process Sampling from the posterior of the beta-negative Binomial process follows a procedure almost identical to the beta-Bernoulli process. In this case the hierarchical process is iid Xi (dθ)|H ∼ NegBin(r, H(dθ)), H(dθ) ∼ Beta{α(θ)µ(dθ), α(θ)(1 − µ(dθ))}. (27) Therefore, the posterior distribution is H(dθ) | X1 , . . . , Xn ∼ Beta{α(θ)µ(dθ) + 1A P i Xi (dθ), α(θ)(1 − µ(dθ)) + nr}. similar posterior sampling method can be used for Dirichlet processes as well. (28) 14 Paisley and Jordan Again using Lemma 5, we can sample from the distribution in Equation (28) as follows, H(dθ) | X1 , . . . , Xn = η(dθ)P (dθ) + (1 − η(dθ))H ′ (dθ), (29) P P ind ind ind η(dθ) ∼ Beta( i Xi (dθ) + nr, α(θ)), P (dθ) ∼ Beta ( i Xi (dθ), nr) , H ′ ∼ BP(α, µ). As with the beta-Bernoulli process, we can separate this into sampling the observed and unobserved P atoms; an atom θ is again considered to be observed and contained in the set Ω if i Xi (dθ) > 0 and Ω is again a.s. finite (Broderick et al., 2012b). A sample from the posterior of H can be constructed by adding delta measures η(dθk )P (dθk )δθk at each θk ∈ Ω. We construct the remaining atoms by sampling H ′ from a truncated stick-breaking construction of the beta process and down-weighting the measure on an atom θ ∈ H ′ by multiplying H ′ (dθ) with a Beta(α(θ), nr) random variable. 7. Conclusion We have presented a constructive definition of the beta process. We showed how this construction follows naturally by using the special case of the Sethuraman (1994) construction applied to the beta distribution. To this end, we presented a finite approximation of the beta process and proved that it has the correct limiting distribution. We also proved and gave further truncation analysis of the construction using the Poisson process theory. In the final section, we showed how posterior sampling of the beta process can be done easily by separating the atomic from the non-atomic parts of the posterior distribution. This produces a set of atoms whose weights can be sampled from an atom-specific beta posterior distribution, and a sample from the beta process prior using the stick-breaking construction that is subsequently down-weighted. References Aldous, D. (1985). Exchangeability and related topics. In École d’été de probabilités de Saint-Flour, XIII—1983, vol. 1117 of Lecture Notes in Mathematics. Springer, pp. 1–198. Broderick, T., Jordan, M. & Pitman, J. (2012a). Beta processes, stick-breaking, and power laws. Bayesian Analysis 7, 439–476. Broderick, T., Mackey, L., Paisley, J. & Jordan, M. (2012b). Combinatorial clustering and the beta negative binomial process. arXiv:1111.1802 . Çinlar, E. (2011). Probability and Stochastics. Springer. Doshi-Velez, F., Miller, K., Van Gael, J. & Teh, Y. (2009). Variational inference for the Indian buffet process. In International Conference on Artificial Intelligence and Statistics. Clearwater Beach, FL. Ferguson, T. (1973). A Bayesian analysis of some nonparametric problems. The Annals of Statistics 1, 209–230. A Constructive Definition of the Beta Process 15 Fox, E., Sudderth, E., Jordan, M. I. & Willsky, A. S. (2010). Sharing features among dynamical systems with beta processes. In Advances in Neural Information Processing. Vancouver, B.C. Griffiths, T. & Ghahramani, Z. (2006). Infinite latent feature models and the Indian buffet process. In Advances in Neural Information Processing. Vancouver, Canada. Heaukulani, C. & Roy, D. (2013). The combinatorial structure of beta negative binomial processes. arXiv:1401.0062 . Hjort, N. (1990). Nonparametric Bayes estimators based on beta processes in models for life history data. Annals of Statistics 18, 1259–1294. Hjort, N., Holmes, C., Müller, P. & Walker, S., eds. (2010). Bayesian nonparametrics: Principles and practice. Cambridge University Press. Ishwaran, H. & James, L. (2001). Gibbs sampling methods for stick-breaking priors. Journal of the American Statistical Association 96, 161–173. Ishwaran, H. & Zarepour, M. (2002). Dirichlet prior sieves in finite normal mixtures. Statistica Sinica 12, 941–963. Kim, Y. (1999). Nonparametric bayesian estimators for counting processes. Annals of Statistics 27, 562–588. Kim, Y. & Lee, J. (2001). On posterior consistency of survival models. Annals of Statistics 29, 666–686. Kingman, J. (1967). Completely random measures. Pacific Journal of Mathematics 21, 59–78. Kingman, J. (1993). Poisson Processes. Oxford University Press. Lee, J. & Kim, Y. (2004). A new algorithm to generate beta processes. Computational Statistics and Data Analysis 47, 441–453. Muliere, P. & Walker, S. (1997). Beta-stacy processes and a generalization of the plya-urn scheme. Annals of Statistics 25, 1762–1780. Paisley, J., Blei, D. & Jordan, M. (2012). Stick-breaking beta processes and the Poisson process. In International Conference on Artificial Intelligence and Statistics. La Palma, Canary Islands. Paisley, J. & Carin, L. (2009). Nonparametric factor analysis with beta process priors. In International Conference on Machine Learning. Montreal, Canada. Paisley, J., Carin, L. & Blei, D. (2011). Variational inference for stick-breaking beta process priors. In International Conference on Machine Learning. Seattle, WA. Paisley, J., Zaas, A., Ginsburg, G., Woods, C. & Carin, L. (2010). A stick-breaking construction of the beta process. In International Conference on Machine Learning. Haifa, Israel. Rohatgi, V. (1976). An Introduction to Probability Theory and Mathematical Statistics. John Wiley & Sons. Sethuraman, J. (1994). A constructive definition of Dirichlet priors. Statistica Sinica 4, 639–650. Thibaux, R. & Jordan, M. (2007). Hierarchical beta processes and the Indian buffet process. In International Conference on Artificial Intelligence and Statistics. San Juan, Puerto Rico. Volterra, V. (1959). Theory of functionals and of integral and integro-differential equa- 16 Paisley and Jordan tions. Dover Publications. Williamson, S., Wang, C., Heller, K. & Blei, D. (2010). The IBP compound Dirichlet process and its application to focused topic modeling. In International Conference on Machine Learning. Haifa, Israel. Zhou, M. & Carin, L. (2012). Negative binomial process count and mixture modeling. arXiv:1209.3442 . Zhou, M., Chen, H., Paisley, J., Ren, L., Li, L., Xing, Z., Dunson, D., Sapiro, G. & Carin, L. (2012). Nonparametric bayesian dictionary learning for analysis of noisy and incomplete images. IEEE Transactions on Image Processing 21, 130–144. Appendix A1. Derivation of the almost sure truncation bound We derive the inequality of Equation (22) by calculating the total variation distance between the marginal distributions of data Y := Y1 , . . . , Yn under a beta-Bernoulli and beta-negative binomial process, and those same processes with the stick-breaking construction for the underlying beta process truncated after group R, denoted H (R) . We write these marginals as m∞ (Y) and mR (Y) respectively. For the sequence of Bernoulli or negative binomial processes X := X1 , . . . , Xn , we let π∞ (X) be the marginal distribution of the selected process under a beta process prior, and π R (X) the corresponding marginal under an R-truncated beta process. The domain of integration for X is {0, 1}∞×n for the Bernoulli process and {0, ∞}∞×n for the negative binomial process. We write this generically as {0, y}∞×n below. The total variation of these two marginal distributions can be bounded as follows, Z |m∞ (Y) − mR (Y)|dY = Z n Y X f (Yi |Xi ){π R (X) − π ∞ (X)} dY ΩY X∈{0,y}∞×n i=1 ΩY ≤ X X∈{0,y}∞×n = X Z n Y f (Yi |Xi )dY |πR (X) − π ∞ (X)| ΩY i=1 |πR (X) − π ∞ (X)| . (30) X∈{0,y}∞×n We observe PR that the rows of X are independent under both priors. Let XR be the first R̃ := i=1 Ci rows of X, which is random and a.s. finite, and let XR+ be the remaining rows. Under the truncated prior, πR (XR+ = 0) = 1, while the two processes share the A Constructive Definition of the Beta Process 17 same measure for XR , πR (XR ) = π ∞ (XR ). The sequence in (30) continues as follows, X X |π R (XR )π R (XR+ ) − π ∞ (XR )π ∞ (XR+ )| |πR (X) − π ∞ (X)| = X XR ∈{0,y}R̃×n XR+ ∈{0,y}∞×n X = |πR (XR ) − π ∞ (XR )π ∞ (XR+ )| XR ∈{0,y}R̃×n XR+ =0 + X π ∞ (XR )π ∞ (XR+ ) XR ∈{0,y}R̃×n XR+ 6=0 = 1 − π∞ (XR+ = 0) + π∞ (XR+ 6= 0) = 2(1 − π ∞ (XR+ = 0)). (31) The result follows by observing that this is two times the probability of the event considered in Equation (22). A2. An alternate definition of the beta process Though the form of the Lévy measure λ in Equation (3) is suggestive of a beta distribution, the following second definition of the beta process makes the relationship of the beta process to the beta distribution more explicit in the infinitesimal case. Definition 5 (The beta process II). Let µ be a diffuse σ-finite measure on (Θ, A) and let α(θ) be a finite strictly positive function on Θ. For all infinitesimal sets dθ ∈ A, let ind H(dθ) ∼ Beta{α(θ)µ(dθ), α(θ)(1 − µ(dθ))}. Then H is a beta process, denoted H ∼ BP(α, µ). It isn’t immediately obvious that Definitions 1 and 5 are of the same stochastic process. This was proved by Hjort (1990) in the context of survival analysis, where µ was a measure on R+ , and the proof there heavily relied on this one-dimensional structure. We give a proof of this equivalence, stated in the following theorem, using more general spaces. Theorem 5. Definitions 1 and 5 are of the same stochastic process. Proof. We prove the equivalence of Definitions 1 and 5 by showing that the the Laplace transform of H(A) from Definition 5 has the form of Equation (2) with the mean measure given in Equation (3). Since their Laplace transforms are equal, the equivalence follows. The proof essentially follows the same pattern as the proof of Theorem 1 with a change in notation to account for working with measures on infinitesimal sets as opposed to an asymptotic analysis of a finite approximation. 18 Paisley and Jordan R Let H be as in Definition 5. We calculate the Laplace transform of H(A) = dθ∈A H(dθ), where by definition H(dθ) is beta-distributed with parameters α(θ)µ(dθ) and α(θ)(1 − µ(dθ)). For t < 0, the Laplace transform of H(A) can be written as R Y E e dθ∈A tH(dθ) = E etH(dθ) (32) dθ∈A = Y dθ∈A ∞ k k−1 X t Y α(θ)µ(dθ) + r 1+ k! r=0 α(θ) + r k=1 ! . (33) The first equality uses the property that an exponential of a sum factorizes into a product of exponentials, which has the given product integral extension. The independence in Definition 5 allows for the expectation to be brought inside the product. The second equality is the Laplace transform of a beta random variable with the given parameterization. The remainder is simply a manipulation of Equation (33) until it reaches the desired form. We first present the sequence of equalities, followed by line-by-line explanations. Continuing from Equation (33), ! ∞ k k−1 Y X r t Y H(A) (34) Ee = 1 + µ(dθ) k! r=1 α(θ) + r dθ∈A k=1 ! ∞ k Y X t Γ(k)Γ(α(θ)) = 1 + α(θ)µ(dθ) (35) k! Γ(α(θ) + k) dθ∈A k=1 ! ∞ k Z 1 Y X t = 1 + α(θ)µ(dθ) π k−1 (1 − π)α(θ)−1 dπ (36) k! 0 dθ∈A k=1  Z 1 Y  P∞ (tπ)k  −1 α(θ)−1 π (1 − π) dπ (37) = 1 + α(θ)µ(dθ) k=1 k! dθ∈A = 0  Z 1 Y  (etπ − 1)π −1 (1 − π)α(θ)−1 dπ . 1 + α(θ)µ(dθ) dθ∈A (38) 0 We derive this sequence as follows: Equation (34) uses the fact that µ is a diffuse measure—we can pull out the r = 0 term and disregard any terms with µ(dθ)k for k > 1 since this integrates to zero; Equation (35) uses the equality Γ(c + 1) = cΓ(c); Equation (36) recognizes the fraction of gamma functions as the normalizing constant of a beta distribution with parameters k and α(θ); Equation (37) uses monotone convergence and Fubini’s theorem to swap the summation and integral, which simplifies to Equation (38) as a result of the exponential power series. For the final step, we invert the product integral back into an exponential function of an integral; for a diffuse measure κ, we use the product integral equality (Volterra, 1959) R R Q dθ∈A (1 + κ(dθ)) = exp dθ∈A ln(1 + κ(dθ)) = exp dθ∈A κ(dθ). A Constructive Definition of the Beta Process 19 We note that the result of Equation (38) satisfies this condition since the right-most term, which corresponds to κ(dθ), is a finite number multiplied by an infinitesimal measure.2 In light of Equation (38), the above product integral equality leads to Ee tH(A)  Z = exp − dθ∈A Z 0 1 tπ (1 − e )α(θ)π −1 α(θ)−1 (1 − π)  dπµ(dθ) . (39) This is the Laplace functional of the integral form of the beta process given in Definition 1 using Poisson random measures. By uniqueness of the Laplace functional, the H given in both definitions share the same law, and so they are equivalent. A3. A second proof of Theorem 4 using the Poisson process Let U ∈ {0, 1}M . By the marking theorem for Poisson processes, the set {(θ, π, U )} constructed from groups R+ 1 and higher is a Poisson process on Θ × [0, 1]× {0, 1}M with + mean measure νR (dθ, dπ)Q(π, U ) and a corresponding counting measure NR+ (dθ, dπ, U ), where Q(π, ·) is a transition probability measure on the space {0, 1}M . Let A = {0, 1}M \0, where 0 is the zero vector. Then Q(π, A) is the probability of this set with respect to a Bernoulli process with parameter π, and therefore Q(π, A) = 1−(1−π)M . The probability P(E) equals 1 − P(E c ), which is equal to 1 − P(NR+ (Θ, [0, 1], A) = 0). The theorem + Rfollows+since NR (Θ, [0, 1], A) is a Poisson-distributed random variable with parameter  (0,1] νR (Θ, dπ)Q(π, A). P (−1)n+1 κ(dθ)n since give a sense of how this equality arises, we note that ln(1 + κ(dθ)) = ∞ n=1 n! |κ(dθ)| < 1, and all terms with n > 1 integrate to zero due to a lack of atoms, leaving only κ(dθ). 2 To
10math.ST
FIAT CATEGORIFICATION OF THE SYMMETRIC INVERSE SEMIGROUP ISn AND THE SEMIGROUP Fn∗ arXiv:1605.03880v2 [math.RA] 27 Mar 2017 PAUL MARTIN AND VOLODYMYR MAZORCHUK Abstract. Starting from the symmetric group Sn , we construct two fiat 2categories. One of them can be viewed as the fiat “extension” of the natural 2-category associated with the symmetric inverse semigroup (considered as an ordered semigroup with respect to the natural order). This 2-category provides a fiat categorification for the integral semigroup algebra of the symmetric inverse semigroup. The other 2-category can be viewed as the fiat “extension” of the 2-category associated with the maximal factorizable subsemigroup of the dual symmetric inverse semigroup (again, considered as an ordered semigroup with respect to the natural order). This 2-category provides a fiat categorification for the integral semigroup algebra of the maximal factorizable subsemigroup of the dual symmetric inverse semigroup. 1. Introduction and description of the results Abstract higher representation theory has its origins in the papers [BFK, CR, Ro1, Ro2] with principal motivation coming from [Kh, Str]. For finitary 2-categories, basics of 2-representation theory were developed in [MM1, MM2, MM3, MM4, MM5, MM6] and further investigated in [GrMa1, GrMa2, Xa, Zh1, Zh2, Zi, CM, MZ, MaMa, KMMZ], see also [KiMa1] for applications. For different ideas on higher representation theory, see also [FB, BBFW, El, Pf, Ka] and references therein. The major emphasis in [MM1, MM2, MM3, MM4, MM5, MM6] is on the study of so-called fiat 2-categories, which are 2-categorical analogues of finite dimensional algebras with involution. Fiat 2-categories appear naturally both in topology and representation theory. They have many nice properties and the series of papers mentioned above develops an essential starting part of 2-representation theory for fiat categories. Many examples of 2-categories appear naturally in semigroup theory, see [KuMa2, GrMa1, GrMa2, Fo]. The easiest example is the 2-category associated to a monoid with a fixed admissible partial order, see Subsection 4.1 for details. Linear analogues of these 2-categories show up naturally in representation theory, see [GrMa1, GrMa2]. A classical example of an ordered monoid is an inverse monoid with respect to the natural partial order. There is a standard linearization procedure, which allows one to turn a 2-category of a finite ordered monoid into a finitary 2-category, see Subsection 3.2 for details. One serious disadvantage with linearizations of 2-categories associated to finite ordered monoids is the fact that they are almost never fiat. The main reason for that is lack of 2-morphisms which start from the identity 1-morphism. In the present paper we construct two natural “extensions” of the symmetric group to 2-categories whose linearizations are fiat. One of them becomes a nice 2-categorical analogue (categorification) for the symmetric inverse semigroup ISn . The other one 1 2 PAUL MARTIN AND VOLODYMYR MAZORCHUK becomes a nice 2-categorical analogue for the maximal factorizable subsemigroup Fn∗ in the dual symmetric inverse semigroup In∗ . The main novel component of the present paper is in the definitions and constructions of the main objects. To construct our 2-categories, we, essentially, have to define three things: • sets of 2-morphisms between elements of Sn ; • horizontal composition of 2-morphisms; • vertical composition of 2-morphisms. In the case which eventually leads to ISn , we view elements of Sn as binary relations in the obvious way and define 2-morphisms between two elements of Sn as the set of all binary relations contained in both these elements. We chose vertical composition to be given by intersection of relations and horizontal composition to be given by the usual composition of relations. Although all these choices are rather natural, none of them seems to be totally obvious. Verification that this indeed defines a 2-category requires some technical work. In the case which eventually leads to Fn∗ , we do a similar thing, but instead of binary relations, we realize Sn inside the partition monoid. For 2-morphisms between elements σ and τ in Sn , we use those partitions which contain both σ and τ . All details on both constructions and all verifications can be found in Section 2. Section 3 recalls the theory of k-linear 2-categories and gives explicit constructions for a finitary k-linear 2-category starting from a finite 2-category. In Section 4 we establish that our constructions lead to fiat 2-categories. We also recall, in more details, the standard constructions of finitary 2-categories, starting from ISn and Fn∗ , considered as ordered monoids, and show that the 2-categories obtained in this way are not fiat. In Section 5 we make the relation between our constructions and ISn and Fn∗ precise. In fact, we show that the decategorification of our first construction is isomorphic to the semigroup algebra Z[ISn ], with respect to the so-called Möbius basis in Z[ISn ], cf. [Ste, Theorem 4.4]. Similarly, we show that the decategorification of our second construction is isomorphic to the semigroup algebra Z[Fn∗ ], with respect to a similarly defined basis. We complete the paper with two explicit examples in Section 6. Acknowledgment. The main part of this research was done during thew visit of the second author to University of Leeds in October 2014. Financial support of EPSRC and hospitality of University of Leeds are gratefully acknowledged. The first author is partially supported by EPSRC under grant EP/I038683/1. The second author is partially supported by the Swedish Research Council and Göran Gustafsson Foundation. We thank Stuart Margolis for stimulating discussions. 2. Two 2-categorical “extensions” of Sn 2.1. 2-categories. A 2-category is a category enriched over the monoidal category Cat of small categories. This means that a 2-category C consists of • objects i, j, . . . ; • small morphism categories C(i, j); • bifunctorial compositions; FIAT CATEGORIFICATION OF ISn AND Fn∗ • identity objects 3 1i ∈ C (i, i); which satisfy the obvious collection of (strict) axioms. Objects in morphism categories are usually called 1-morphisms (for example, all 1i are 1-morphisms) while morphisms in morphism categories are usually called 2-morphisms. Composition of 2-morphisms inside a fixed C (i, j) is called vertical and denoted ◦1 . Composition of 2-morphisms coming from the bifunctorial composition in C is called horizontal and denoted ◦0 . We refer the reader to [Mac, Le] for more details on 2-categories. The main example of a 2-category is Cat itself, where • objects are small categories; • 1-morphisms are functors; • 2-morphisms are natural transformations; • composition is the usual composition; • identity 1-morphisms are identity functors. 2.2. First 2-category extending Sn . For n ∈ N := {1, 2, 3, . . . }, consider the set n = {1, 2, . . . , n} and let Sn denote the symmetric group of all bijective transformations of n under composition. We consider also the monoid Bn = 2n×n of all binary relations on n which is identified with the monoid of n×n-matrices over the Boolean semiring B := {0, 1} by taking a relation to its adjacency matrix. Note that Bn is an ordered monoid with respect to usual inclusions of binary relations. We identify Sn with the group of invertible elements in Bn in the obvious way. We now define a 2-category A = A n . To start with, we declare that • A has one object i; • 1-morphisms in A are elements in Sn ; • composition · of 1-morphisms is induced from Sn ; • the identity 1-morphism is the identity transformation idn ∈ Sn . It remains to define 2-morphisms in A and their compositions. • For π, σ ∈ Sn , we define HomA (π, σ) as the set of all α ∈ Bn such that α ⊆ π ∩ σ. • For π, σ, τ ∈ Sn , and also for α ∈ HomA (π, σ) and β ∈ HomA (σ, τ ), we define β ◦1 α := β ∩ α. • For π ∈ Sn , we define the identity element in HomA (π, π) to be π. • For π, σ, τ, ρ ∈ Sn , and also for α ∈ HomA (π, σ) and β ∈ HomA (τ, ρ), we define β ◦0 α := βα, the usual composition of binary relations. Proposition 1. The construct A above is a 2-category. Proof. Composition · of 1-morphisms is associative as Sn is a group. The vertical composition ◦1 is clearly well-defined. It is associative as ∩ is associative. If we have α ∈ HomA (π, σ) or α ∈ HomA (σ, π), then α ⊆ π and thus α ∩ π = α. Therefore π ∈ HomA (π, π) is the identity element. Let us check that the horizontal composition ◦0 is well-defined. From α ⊆ π and β ⊆ τ and the fact that Bn is ordered, we have βα ⊆ τ α ⊆ τ π. Similarly, from α ⊆ σ and β ⊆ ρ and the fact that Bn is ordered, we have βα ⊆ ρα ⊆ ρσ. It follows 4 PAUL MARTIN AND VOLODYMYR MAZORCHUK that βα ∈ HomA (τ π, ρσ) and thus ◦0 is well-defined. Its associativity follows from the fact that usual composition of binary relations is associative. It remains to check the interchange law, that is the fact that, for any 1-morphisms π, σ, ρ, τ, µ, ν and for any α ∈ HomA (π, σ), β ∈ HomA (τ, µ), γ ∈ HomA (σ, ρ) and δ ∈ HomA (µ, ν), we have (2.1) (δ ◦0 γ) ◦1 (β ◦0 α) = (δ ◦1 β) ◦0 (γ ◦1 α). Assume first that σ = µ = idn . In this case both α, β, γ and δ are subrelations of the identity relation idn . Note that, given two subrelations x and y of the identity relation idn , their product xy as binary relations equals x ∩ y. Hence, in this particular case, both sides of (2.1) are equal to α ∩ β ∩ γ ∩ δ. Before proving the general case, we will need the following two lemmata: Lemma 2. Let π, σ, τ, ρ ∈ Sn . (i) Left composition with π induces a bijection from HomA (σ, τ ) to HomA (πσ, πτ ). (ii) For any α ∈ HomA (σ, τ ) and β ∈ HomA (τ, ρ), we have π ◦0 (β ◦1 α) = (π ◦0 β) ◦1 (π ◦0 α). Proof. Left composition with π maps an element (y, x) of α ∈ HomA (σ, τ ) to (π(y), x) ∈ HomA (πσ, πτ ). As π is an invertible transformation of n, multiplying with π −1 returns (π(y), x) to (y, x). This implies claim (i). Claim (ii) follows from claim (i) and the observation that composition with invertible maps commutes with taking intersections.  Lemma 3. Let π, σ, τ, ρ ∈ Sn . (i) Right composition with π induces a bijection from HomA (σ, τ ) to HomA (σπ, τ π). (ii) For any α ∈ HomA (σ, τ ) and β ∈ HomA (τ, ρ), we have (β ◦1 α) ◦0 π = (β ◦0 π) ◦1 (α ◦0 π). Proof. Analogous to the proof of Lemma 2.  Using Lemmata 2 and 3 together with associativity of ◦0 , right multiplication with σ −1 and left multiplication with µ−1 reduces the general case of (2.1) to the case σ = µ = idn considered above. This completes the proof.  2.3. Second 2-category extending Sn . For n ∈ N, consider the corresponding partition semigroup Pn , see [Jo, Mar1, Mar2, Maz1]. Elements of Pn are partitions of the set n := {1, 2, . . . , n, 1′ , 2′ , . . . , n′ } into disjoint unions of non-empty subsets, called parts. Alternatively, one can view elements of Pn as equivalence relations on n. Multiplication (ρ, π) 7→ ρπ in Pn is given by the following mini-max algorithm, see [Jo, Mar1, Mar2, Maz1] for details: • Consider ρ as a partition of {1′ , 2′ , . . . , n′ , 1′′ , 2′′ , . . . , n′′ } using the map x 7→ x′ and x′ → 7 x′′ , for x ∈ n. • Let τ be the minimum, with respect to inclusions, partition of {1, 2, . . . , n, 1′ , 2′ , . . . , n′ , 1′′ , 2′′ , . . . , n′′ }, such that each part of both ρ and π is a subset of a part of τ . FIAT CATEGORIFICATION OF ISn AND Fn∗ 5 • Let σ be the maximum, with respect to inclusions, partition of {1, 2, . . . , n, 1′′ , 2′′ , . . . , n′′ }, such that each part of σ is a subset of a part of τ . • Define the product ρπ as the partition of n induced from σ via the map x′′ 7→ x′ , for x ∈ n. Note that Sn is, naturally, a submonoid of Pn . Moreover, Sn is the maximal subgroup of all invertible elements in Pn . A part of ρ ∈ Pn is called a propagating part provided that it intersects both sets {1, 2, . . . , n} and {1′ , 2′ , . . . , n′ }. Partitions in which all parts are propagating are called propagating partitions. The set of all propagating partitions in Pn is denoted by PPn , it is a submonoid of Pn . The monoid Pn is naturally ordered with respect to refinement: ρ ≤ τ provided that each part of ρ is a subset of a part in τ . With respect to this order, the partition of n with just one part is the maximum element, while the partition of n into singletons is the minimum element. This order restricts to PPn . As elements of Pn are just equivalence relations, the poset Pn is a lattice and we denote by ∧ and ∨ the corresponding meet and join operations, respectively. The poset PPn is a sublattice in Pn with the same meet and join. As Sn ⊂ PPn , all meets and joins in Pn of elements from Sn belong to PPn . We now define a 2-category B = B n . Similarly to Subsection 2.2, we start by declaring that • B has one object i; • 1-morphisms in B are elements in Sn ; • composition of 1-morphisms is induced from Sn ; • the identity 1-morphism is the identity transformation idn . It remains to define 2-morphisms in B and their compositions. • For π, σ ∈ Sn , we define HomB (π, σ) as the set of all α ∈ PPn such that we have both, π ≤ α and σ ≤ α. • For π, σ, τ ∈ Sn , and also any α ∈ HomB (π, σ) and β ∈ HomB (σ, τ ), we define β ◦1 α := β ∨ α. • For π ∈ Sn , we define the identity element in HomB (π, π) to be π. • For π, σ, τ, ρ ∈ Sn , and also any α ∈ HomB (π, σ) and β ∈ HomB (τ, ρ), we define β ◦0 α := βα, the usual composition of partitions. Proposition 4. The construct B above is a 2-category. Proof. The vertical composition ◦1 is clearly well-defined. It is associative as ∨ is associative. If α ∈ HomB (π, σ) or α ∈ HomB (σ, π), then π ≤ α and thus α∨π = α. Therefore π ∈ HomB (π, π) is the identity element. Let us check that the horizontal composition ◦0 is well-defined. From π ≤ α and τ ≤ β and the fact that Pn is ordered, we have τ π ≤ τ α ≤ βα. Similarly, from σ ≤ α and ρ ≤ β and the fact that Pn is ordered, we have ρσ ≤ ρα ≤ βα. It follows that βα ∈ HomB (τ π, ρσ) and thus ◦0 is well-defined. Its associativity follows from the fact that usual composition of partitions is associative. 6 PAUL MARTIN AND VOLODYMYR MAZORCHUK It remains to check the interchange law (2.1). For this we fix any 1-morphisms π, σ, ρ, τ, µ, ν and any α ∈ HomB (π, σ), β ∈ HomB (τ, µ), γ ∈ HomB (σ, ρ) and δ ∈ HomB (µ, ν). Assume first that σ = µ = idn . In this case both α, β, γ and δ are partitions containing the identity relation idn . Note that, given two partitions x and y containing the identity relation idn , their product xy as partitions equals x ∨ y. Hence, in this particular case, both sides of (2.1) are equal to α ∨ β ∨ γ ∨ δ. Before proving the general case, we will need the following two lemmata: Lemma 5. Let π, σ, τ, ρ ∈ Sn . (i) Left composition with π induces a bijection between the sets HomB (σ, τ ) and HomB (πσ, πτ ). (ii) For any α ∈ HomB (σ, τ ) and β ∈ HomB (τ, ρ), we have π ◦0 (β ◦1 α) = (π ◦0 β) ◦1 (π ◦0 α). Proof. Left composition with π simply renames elements of {1′ , 2′ , . . . , n′ } in an invertible way. This implies claim (i). Claim (ii) follows from claim (i) and the observation that composition with invertible maps commutes with taking unions.  Lemma 6. Let π, σ, τ, ρ ∈ Sn . (i) Right composition with π induces a bijection between the sets HomB (σ, τ ) and HomB (σπ, τ π). (ii) For any α ∈ HomB (σ, τ ) and β ∈ HomB (τ, ρ), we have (β ◦1 α) ◦0 π = (β ◦0 π) ◦1 (α ◦0 π). Proof. Analogous to the proof of Lemma 5.  Using Lemmata 5 and 6 together with associativity of ◦0 , right multiplication with σ −1 and left multiplication with µ−1 reduces the general case of (2.1) to the case σ = µ = idn considered above. This completes the proof.  3. 2-categories in the linear world For more details on all the definitions in Section 3, we refer to [GrMa2]. 3.1. Finitary 2-categories. Let k be a field. A k-linear category C is called finitary provided that it is additive, idempotent split and Krull-Schmidt (cf. [Ri, Section 2.2]) with finitely many isomorphism classes of indecomposable objects and finite dimensional homomorphism spaces. A 2-category C is called prefinitary (over k) provided that (I) C has finitely many objects; (II) each C (i, j) is a finitary k-linear category; (III) all compositions are biadditive and k-linear whenever the notion makes sense. Following [MM1], a prefinitary 2-category C is called finitary provided that (IV) all identity 1-morphisms are indecomposable. FIAT CATEGORIFICATION OF ISn AND Fn∗ 7 3.2. k-linearization of finite categories. For any set X, let us denote by k[X] the vector space (over k) of all formal linear combinations of elements in X with coefficients in k. Then we can view X as the standard basis in k[X]. By convention, k[X] = {0} if X = ∅. Let C be a finite category, that is a category with a finite number of morphisms. Define the k-linearization Ck of C as follows: • the objects in Ck and C are the same; • we have Ck (i, j) := k[C(i, j)]; • composition in Ck is induced from that in C by k-bilinearity. 3.3. k-additivization of finite categories. Assume that objects of the category C are 1, 2,. . . , k. For C as in Subsection 3.2, define the additive k-linearization Ck⊕ of C in the following way: • objects in Ck⊕ are elements in Zk≥0 , we identify (m1 , m2 , . . . , mk ) ∈ Zk≥0 with the symbol 1 ⊕ · · · ⊕ 1 ⊕ 2 ⊕ · · · ⊕ 2 ⊕ · · · ⊕ k ⊕ · · · ⊕ k; | {z } | {z } | {z } m1 times m2 times mk times • the set Ck⊕ (i1 ⊕ i2 ⊕ · · · ⊕ il , j1 ⊕ j2 ⊕ · · · ⊕ jm ) is given by the set of all matrices of the form   f11 f12 . . . f1l  f21 f22 . . . f2l     .. .. ..  ..  . . . .  fm1 fm2 ... fml where fst ∈ Ck (it , js ); • composition in Ck⊕ is given by the usual matrix multiplication; • the additive structure is given by addition in Zk≥0 . One should think of Ck⊕ as the additive category generated by Ck . 3.4. k-linearization of finite 2-categories. Let now C be a finite 2-category. We define the k-linearization C k of C over k as follows: • C k and C have the same objects; • we have C k (i, j) := C(i, j)⊕ k ; • composition in C k is induced from composition in C by biadditivity and k-bilinearity. By construction, the 2-category C k satisfies conditions (I) and (III) from the definition of a finitary 2-category. A part of condition (II) related to additivity and finite dimensionality of morphism spaces is also satisfied. Therefore, the 2-category C k is finitary if and only if, the 2-endomorphism k-algebra of every 1-morphism in C k is local. 8 PAUL MARTIN AND VOLODYMYR MAZORCHUK 3.5. k-finitarization of finite 2-categories. Let C be a finite 2-category. Consider the 2-category C k . We define the finitarization kC of C k as follows: • kC and C k have the same objects; • kC(i, j) is defined to be the idempotent completion of C k (i, j); • composition in kC is induced from composition in C. By construction, the 2-category kC is prefinitary. Therefore, the 2-category kC is finitary if and only if, the 2-endomorphism k-algebra of every identity 1-morphism in kC is local. 3.6. Idempotent splitting. Let C be a prefinitary 2-category. If C does not satisfy condition (IV), then there is an object i ∈ C such that the endomorphism algebra EndkC (1i ) is not local, that is, contains a non-trivial idempotent. In this subsection we describe a version of “idempotent splitting”, for all EndkC (1i ), to turn C into a finitary 2-category which we denote by C . For i ∈ C, the 2-endomorphism algebra of 1i is equipped with two unital associative operations, namely, ◦0 and ◦1 . These two operations satisfy the interchange law. By the classical Eckmann-Hilton argument (see, for example, [EH] or [Ko, Subsection 1.1]), both these operations, when restricted to the 2-endomorphism algebra of 1i , must be commutative and, in fact, coincide. Therefore we can unambiguously (j) speak about the commutative 2-endomorphism algebra EndC (1i ). Let εi , where j = 1, 2, . . . , ki , be a complete list of primitive idempotents in EndC (1i ). Note (j) that the elements εi are identities in the minimal ideals of EndC (1i ) and hence are canonically determined (up to permutation). We now define a new 2-category, which we denote by C , in the following way: • Objects in C are i(s) , where i ∈ C and s = 1, 2, . . . , ki . • 1-morphisms in C(i(s) , j(t) ) are the same as 1-morphisms in C (i, j). • for 1-morphisms F, G ∈ C (i(s) , j(t) ), the set HomC (F, G) equals (t) (s) εj ◦0 HomC (F, G) ◦0 εi . • The identity 1-morphism in C (i(s) , i(s) ) is 1i . • All compositions are induced from C . Lemma 7. Let C be a prefinitary 2-category. Then the construct C is a finitary 2-category. Proof. The fact that C is a 2-category follows from the fact that C is a 2-category, by construction. For C , conditions (I), (II) and (III) from the definition of a prefinitary 2-category, follow from the corresponding conditions for the original category C . It remains to show that C satisfies (IV). By construction, the endomorphism algebra of the identity 1-morphism 1i in C (i(s) , i(s) ) is εi ◦0 EndC (1i ) ◦0 εi . (s) (s) (s) The latter algebra is local as εi is a minimal idempotent. This means that condition (IV) is satisfied and completes the proof.  FIAT CATEGORIFICATION OF ISn AND Fn∗ 9 Starting from C and taking, for each i ∈ C , a direct sum of i(s) , where s = 1, 2, . . . , ki , one obtains a 2-category biequivalent to the original 2-category C . The 2-categories C and C are, clearly, Morita equivalent in the sense of [MM4]. Warning: Despite of the fact that C (i(s) , j(t) ) and C(i, j) have the same 1morphisms, these two categories, in general, have different indecomposable 1-morphisms as the sets of 2-morphisms are different. In particular, indecomposable 1-morphisms in C(i, j) may become isomorphic to zero in C (i(s) , j(t) ). We note that the operation of idempotent splitting is also known as taking Cauchy completion or Karoubi envelope. 4. Comparison of kA n and kB n to 2-categories associated with ordered monoids ISn and Fn∗ 4.1. 2-categories and ordered monoids. Let (S, ·, 1) be a monoid and ≤ be an admissible order on S, that is a partial (reflexive) order such that s ≤ t implies both sx ≤ tx and xs ≤ xt, for all x, s, t ∈ S. Then we can associate with S a 2-category S = S S = S (S,·,1,≤) defined as follows: • S has one object i; • 1-morphisms are elements in S; • for s, t ∈ S, the set HomS (s, t) is empty if s 6≤ t and contains one element (s, t) otherwise; • composition of 1-morphisms is given by ·; • both horizontal and vertical compositions of 2-morphism are the only possible compositions (as sets of 2-morphisms are either empty or singletons); • the identity 1-morphism is 1. Admissibility of ≤ makes the above well-defined and ensures that S becomes a 2-category. A canonical example of the above is when S is an inverse monoid and ≤ is the natural partial order on S defined as follows: s ≤ t if and only if s = et for some idempotent e ∈ S. 4.2. (Co)ideals of ordered semigroups. Let S be a semigroup equipped with an admissible order ≤. For a non-empty subset X ⊂ S, let X ↓ := {s ∈ S : there is x ∈ X such that s ≤ x} denote the lower set or ideal generated by X. Let X ↑ := {s ∈ S : there is x ∈ X such that x ≤ s} denote the upper set or coideal generated by X. Lemma 8. For any subsemigroup T ⊂ S, both T ↓ and T ↑ are subsemigroups of S. Proof. We prove the claim for T ↓ , for T ↑ the arguments are similar. Let a, b ∈ T ↓ . Then there exist s, t ∈ T such that a ≤ s and b ≤ t. As ≤ is admissible, we have ab ≤ sb ≤ st. Now, st ∈ T as T is a subsemigroup, and thus ab ∈ T ↓ .  10 PAUL MARTIN AND VOLODYMYR MAZORCHUK 4.3. The symmetric inverse monoid. For n ∈ N, we denote by ISn the symmetric inverse monoid on n, see [GaMa]. It consists of all bijections between subsets of n. Alternatively, we can identify ISn with Sn↓ inside the ordered monoid Bn . The monoid ISn is an inverse monoid. The natural partial order on the inverse monoid ISn coincides with the inclusion order inherited from Bn . The group Sn is the group of invertible elements in ISn . 4.4. The dual symmetric inverse monoid. For n ∈ N, we denote by In∗ the dual symmetric inverse monoid on n, see [FL]. It consists of all bijections between quotients of n. Alternatively, we can identity In∗ with PPn in the obvious way. The monoid In∗ is an inverse monoid. The natural partial order on the inverse monoid In∗ coincides with the order inherited from Pn . The group Sn is the group of invertible elements in In∗ . We also consider the maximal factorizable submonoid Fn∗ of In∗ , that is the submonoid of all elements which can be written in the form σε, where σ ∈ Sn and ε is an idempotent in In∗ . Idempotents in In∗ are exactly the identity transformations of quotient sets of n, equivalently, idempotents in In∗ coincide with the principal coideal in Pn generated by the identity element. Lemma 9. The monoid Fn∗ coincides with the subsemigroup Sn↑ of PPn . Proof. As Sn↑ contains both Sn and all idempotents of In∗ , we have Fn∗ ⊂ Sn↑ . On the other hand, let ρ ∈ Sn↑ . Then σ ≤ ρ for some σ ∈ Sn . This means that idn ≤ ρσ −1 . Hence ρσ −1 is an idempotent and ρ = (ρσ −1 )σ ∈ Fn∗ .  4.5. Fiat 2-categories. Following [MM1], we say that a finitary 2-category C is fiat provided that there exists a weak anti-involution ⋆ : C → C co,op , such that, for any objects i, j ∈ C and any 1-morphism F ∈ C(i, j), there are 2-morphisms η : 1i → F⋆ F and ε : FF⋆ → 1j such that (ε ◦0 idF ) ◦1 (idF ◦0 η) = idF and (idF⋆ ◦0 ε) ◦1 (η ◦0 idF⋆ ) = idF⋆ . This means that F and F⋆ are biadjoint in C and hence also in any 2-representation of C . The above property is usually called existence of adjunction 2-morphisms. There are various classes of 2-categories whose axiomatization covers some parts of the axiomatization of fiat 2-categories, see, for example, compact categories, rigid categories, monoidal categories with duals and 2-categories with adjoints. 4.6. Comparison of fiatness. Theorem 10. Let n ∈ N. (i) Both 2-categories, kA n and kB n , are fiat. (ii) Both 2-categories, kS ISn and kS Fn∗ , are finitary but not fiat. Proof. The endomorphism algebra of any 1-morphism in kS ISn is k, by definition. Therefore kS ISn is finitary by construction. The category kS ISn cannot be fiat as it contains non-invertible indecomposable 1-morphisms but it does not contain any non-zero 2-morphisms from the identity 1-morphism to any non-invertible indecomposable 1-morphism. Therefore adjunction 2-morphisms for non-invertible indecomposable 1-morphisms cannot exist. The same argument also applies to kS Fn∗ , proving claim (ii). FIAT CATEGORIFICATION OF ISn AND Fn∗ 11 By construction, the 2-category kA n satisfies conditions (I), (II) and (III) from the definition of a finitary 2-category. Therefore the 2-category kA n is a finitary 2-category by Lemma 7. Let us now check existence of adjunction 2-morphisms. Recall that an adjoint to a direct sum of functors is a direct sum of adjoints to components. Therefore, as kA n is obtained from (A n )k by splitting idempotents in 2-endomorphism rings, it is enough to check that adjunction 2-morphisms exist in (A n )k . Any 1-morphism in (A n )k is, by construction, a direct sum of σ ∈ Sn . Therefore it is enough to check that adjunction 2-morphisms exist in A n . In the latter category, each 1-morphism σ ∈ Sn is invertible and hence both left and right adjoint to σ −1 . This implies existence of adjunction 2-morphisms in A n . The above shows that the 2-category kA n is fiat. Similarly one shows that the 2-category kB n is fiat. This completes the proof.  5. Decategorification 5.1. Decategorification via Grothendieck group. Let C be a finitary 2-category. A Grothendieck decategorification [C ] of C is a category defined as follows: • [C] has the same objects as C . • For i, j ∈ C, the set [C ](i, j) coincides with the split Grothendieck group [C(i, j)]⊕ of the additive category C (i, j). • The identity morphism in [C ](i, i) is the class of 1i . • Composition in [C] is induced from composition of 1-morphisms in C . We refer to [Maz2, Lecture 1] for more details. For a finitary 2-category C , the above allows us to define the decategorification of C as the Z-algebra M AC := [C](i, j) i,j∈C with the induced composition. The algebra AC is positively based in the sense of [KiMa2] with respect to the basis corresponding to indecomposable 1-morphisms in C. 5.2. Decategorifications of kA n and kS ISn . Theorem 11. We have AkA n ∼ = Z[ISn ]. = AkS ISn ∼ Proof. Indecomposable 1-morphisms in kS ISn correspond exactly to elements of ISn , by construction. This implies that AkS ISn ∼ = Z[ISn ] where an indecomposable 1-morphism σ on the left hand side is mapped to itself on the right hand side. So, we only need to prove that AkA n ∼ = Z[ISn ]. For σ ∈ ISn , set (5.1) σ := X (−1)|σ\ρ| ρ ∈ Z[ISn ]. ρ⊂σ Then {σ : σ ∈ ISn } is a basis in Z[ISn ] which we call the Möbius basis, see, for example, [Ste, Theorem 4.4]. The endomorphism monoid EndA n (idn ) is, by construction, canonically isomorphic to the Boolean 2n of n with both ◦0 and ◦1 being equal to the operation on 2n of taking the intersection. We identify elements in EndA n (idn ) and in 2n in the 12 PAUL MARTIN AND VOLODYMYR MAZORCHUK obvious way. With this identification, in the construction of kA n , we can take, for X ⊂ n, X (X) (5.2) εi = (−1)|X|−|Y | Y. Y ⊆X For σ ∈ Sn and X, Y ⊂ n, consider the element (5.3) (Y ) εi (X) ◦ 0 σ ◦ 0 εi ∈ EndkA n (σ) and write it as a linear combination of subrelations of σ (this is the standard basis in EndkA n (σ)). A subrelation ρ ⊂ σ may appear in this linear combination with a non-zero coefficient only if ρ consist of pairs of the form (y, x), where x ∈ X and y ∈Y. Assume that σ(X) = Y . Then the relation [ ρσ = {(σ(x), x)}, x∈X clearly, appears in the linear combination above with coefficient one. Moreover, the (X) (Y ) idempotent properties of εi and εi imply that the element in (5.3) is exactly ρσ . Assume that σ(X) 6= Y . Then the inclusion-exclusion formula implies that any subrelation of σ appears in the linear combination above with coefficient zero. This means that the 1-morphism σ ∈ kA n (i(Y ) , i(X) ) is zero if and only if σ(X) 6= Y . If |X| = |Y | and σ, π ∈ Sn are such that σ(x) = π(x) ∈ Y , for all x ∈ X, then ρσ = ρπ ∈ HomkA n (σ, π) ∩ HomkA n (π, σ) gives rise to an isomorphism between σ and π in kA n (i(Y ) , i(X) ). If σ(x) 6= π(x), for some x ∈ X, then any morphism in HomkA n (σ, π) is a linear combination of relations which are properly contained in both ρσ and ρπ . Therefore σ and π are not isomorphic in kA n . Consequently, isomorphism classes of indecomposable 1-morphisms in the category kA n (i(Y ) , i(X) ) correspond precisely to elements in ISn with domain X and image Y . Composition of these indecomposable 1-morphisms is inherited from Sn . By comparing formulae (5.1) and (5.2), we see that composition of 1-morphisms in kA n corresponds to multiplication of the Möbius basis elements in Z[ISn ]. This completes the proof of the theorem.  Theorem 11 allows us to consider kA n and S ISn as two different categorifications of ISn . The advantage of kA n is that this 2-category is fiat. The construction we use in our proof of Theorem 11 resembles the partialization construction from [KuMa1]. 5.3. Decategorifications of kB n and kS Fn∗ . Theorem 12. We have AkB n ∼ = Z[Fn∗ ]. = AkSFn∗ ∼ Proof. Using the Möbius function for the poset of all quotients of n with respect to ≤ (see, for example, [Rot, Example 1]), Theorem 12 is proved mutatis mutandis Theorem 11.  FIAT CATEGORIFICATION OF ISn AND Fn∗ 13 Theorem 12 allows us to consider kB n and S Fn∗ as two different categorifications of Fn∗ . The advantage of kB n is that this 2-category is fiat. The immediately following examples are in low rank, but show that these constructions can be worked with at the concrete as well as the abstract level. In particular, they illustrate the difference between the two constructions. 6. Examples for n = 2 6.1. Example of F2∗ . The monoid F2∗ consists of three elements which we write as follows:       1 2 1 2 {1, 2} ǫ := , σ := , τ := . 1 2 2 1 {1, 2} These are identified with the following partitions of {1, 2, 1′, 2′ }:    ǫ ↔ {1, 1′}, {2, 2′ } , σ ↔ {1, 2′ }, {2, 1′} , τ ↔ {1, 2, 1′ , 2′ } . The symmetric group S2 consists of ǫ and σ. Here is the table showing all 2-morphisms in B 2 from x to y: y\x ǫ σ τ ǫ ǫ, τ τ τ σ τ σ, τ τ τ τ τ τ The 2-endomorphism algebra of both ǫ and σ in (B 2 )k is isomorphic to k ⊕ k where the primitive idempotents are τ and ǫ − τ , in the case of ǫ, and τ and σ − τ , in the case of σ. The 2-category kB 2 has three isomorphism classes of indecomposable 1-morphisms, namely τ , ǫ − τ and σ − τ . The 2-category kB 2 has two objects, iτ and iǫ−τ . The indecomposable 1-morphisms in kB 2 give indecomposable 1-morphisms in kB 2 from x to y as follows: y\x iǫ−τ iτ iǫ−τ ǫ − τ, σ − τ ∅ 6.2. Example of IS2 . We write elements of IS2     1 2 1 2 ǫ := , σ := , 1 2 2 1      1 2 1 2 α := , β := , γ := 1 ∅ 2 ∅ The symmetric group S2 consists of ǫ and σ. iτ ∅ τ as follows:   1 2 τ := , ∅ ∅   1 2 1 , δ := ∅ 1 ∅ 2 2  . 14 PAUL MARTIN AND VOLODYMYR MAZORCHUK Here is the table showing all 2-morphisms in A 2 from x to y: y\x ǫ σ τ α β γ δ ǫ ǫ, α, δ, τ τ τ α, τ τ τ α, τ σ τ σ, β, γ, τ τ τ β, τ β, τ τ τ τ τ τ τ τ τ τ α α, τ τ τ α, τ τ τ τ β τ β, τ τ τ β, τ τ τ γ τ γ, τ τ τ τ γ, τ τ δ δ, τ τ τ τ τ τ δ, τ The 2-endomorphism algebra of ǫ in (A 2 )k is isomorphic to k ⊕ k ⊕ k ⊕ k where the primitive idempotents are τ , α − τ , δ − τ and ǫ − α − δ + τ . Similarly one can describe the 2-endomorphism algebra of σ in (A 2 )k . The 2-endomorphism algebra of α in (A 2 )k is isomorphic to k ⊕ k where the primitive idempotents are τ and α−τ . Similarly one can describe the 2-endomorphism algebras of β, γ and δ. The 2-category kA 2 has seven isomorphism classes of indecomposable 1-morphisms, namely τ, α − τ, β − τ, γ − τ, δ − τ, ǫ − α − δ + τ, σ − β − γ + τ. The 2-category kA 2 has four objects, iτ , iα−τ , iδ−τ and iǫ−α−δ+τ . The indecomposable 1-morphisms in kA 2 give indecomposable 1-morphisms in kA 2 from x to y as follows: y\x iǫ−α−δ+τ iα−τ iδ−τ iτ iǫ−α−δ+τ ǫ − α − δ + τ, σ − β − γ + τ ∅ ∅ ∅ iα−τ ∅ α−τ β−τ ∅ iδ−τ ∅ γ−τ δ−τ ∅ iτ ∅ ∅ ∅ τ This table can be compared with [MS, Figure 1]. References [BBFW] [BFK] [CM] [CR] [EH] [El] [FL] [FB] [Fo] [GaMa] [GrMa1] J. Baez, A. Baratin, L. Freidel, D. Wise. Infinite-dimensional representations of 2groups. Mem. Amer. Math. Soc. 219 (2012), no. 1032, vi+120 pp. J. Bernstein, I. Frenkel, M. Khovanov. A categorification of the Temperley-Lieb algebra and Schur quotients of U (sl2 ) via projective and Zuckerman functors. Selecta Math. (N.S.) 5 (1999), no. 2, 199–241. A. Chan, V. Mazorchuk. Diagrams and discrete extensions for finitary 2representations. Preprint arXiv:1601.00080 J. Chuang, R. Rouquier. Derived equivalences for symmetric groups and sl2 -categorification. Ann. of Math. (2) 167 (2008), no. 1, 245–298. B. Eckmann, P. Hilton. Group-like structures in general categories. I. Multiplications and comultiplications. Math. Ann. 144/145 (1962), 227–255. J. Elgueta. Representation theory of 2-groups on Kapranov and Voevodsky’s 2-vector spaces. Adv. Math. 213 (2007), 53-92. D. FitzGerald, J. Leech. Dual symmetric inverse monoids and representation theory. J. Austral. Math. Soc. Ser. A 64 (1998), no. 3, 345–367. M. Forrester-Barker. Representations of crossed modules and Cat1 -groups. Ph.D. Thesis, University of Wales, Bangor, 2003. L. Forsberg. Multisemigroups with multiplicities and complete ordered semi-rings. Preprint arXiv:1510.01478. To appear in Beiträge zur Algebra und Geometrie. O. Ganyushkin, V. Mazorchuk. Classical finite transformation semigroups. An introduction. Algebra and Applications, 9. Springer-Verlag London, Ltd., London, 2009. A.-L. Grensing, V. Mazorchuk. Categorification of the Catalan monoid. Semigroup Forum 89 (2014), no. 1, 155–168. FIAT CATEGORIFICATION OF ISn AND Fn∗ [GrMa2] [Jo] [Ka] [Kh] [KMMZ] [KiMa1] [KiMa2] [Ko] [KuMa1] [KuMa2] [Le] [MaMa] [Mac] [Mar1] [Mar2] [Maz1] [Maz2] [MM1] [MM2] [MM3] [MM4] [MM5] [MM6] [MS] [MZ] [Pf] [Ri] [Rot] [Ro1] [Ro2] 15 A.-L. Grensing, V. Mazorchuk. Finitary 2-categories associated with dual projection functors. Preprint arXiv:1501.00095. To appear in Commun. Contemp. Math. V. Jones. The Potts model and the symmetric group. In: Subfactors: Proceedings of the Taniguchi Symposium on Operator Algebras (Kyuzeso, 1993), River Edge, NJ, World Sci. Publishing, 1994, pp. 259–267. K. Kapranov, V. Voevodsky. 2-categories and Zamolodchikov tetrahedra equations. Algebraic groups and their generalizations: quantum and infinite-dimensional methods (University Park, PA, 1991), 177–259, Proc. Sympos. Pure Math., 56, Part 2, Amer. Math. Soc., Providence, RI, 1994. M. Khovanov. A categorification of the Jones polynomial. Duke Math. J. 101 (2000), no. 3, 359–426. T. Kildetoft, M. Mackaay, V. Mazorchuk, J. Zimmermann. Simple transitive 2representations of small quotients of Soergel bimodules. Preprint arXiv:1605.01373 T. Kildetoft, V. Mazorchuk. Parabolic projective functors in type A. Adv. Math. 301 (2016), 785–803. T. Kildetoft, V. Mazorchuk. Special modules over positively based algebras. Doc. Math. 21 (2016), 1171–1192. J. Kock. Note on commutativity in double semigroups and two-fold monoidal categories. J. Homotopy Relat. Struct. 2 (2007), no. 2, 217–228. G. Kudryavtseva, V. Mazorchuk. Partialization of categories and inverse braidpermutation monoids. Internat. J. Algebra Comput. 18 (2008), no. 6, 989–1017. G. Kudryavtseva, V. Mazorchuk. On multisemigroups. Port. Math. 72 (2015), no. 1, 47–80. T. Leinster. Basic Bicategories. Preprint arXiv:math/9810017 M. Mackaay, V. Mazorchuk. Simple transitive 2-representations for some 2subcategories of Soergel bimodules. J. Pure Appl. Algebra 221 (2017), no. 3, 565–587. S. Mac Lane. Categories for the working mathematician. Second edition. Graduate Texts in Mathematics 5. Springer-Verlag, New York, 1998. P. P. Martin. Potts models and related problems in statistical mechanics. World Scientific, Singapore, 1991. P. P. Martin. Temperley-Lieb algebras for non-planar statistical mechanics — the partition algebra construction. Journal of Knot Theory and its Ramifications 3 (1994), no. 1, 51–82. V. Mazorchuk. Endomorphisms of Bn , PBn and Cn . Comm. Algebra 30 (2002), no. 7, 3489–3513. V. Mazorchuk. Lectures on algebraic categorification. QGM Master Class Series. European Mathematical Society (EMS), Zürich, 2012. x+119 pp. V. Mazorchuk, V. Miemietz. Cell 2-representations of finitary 2-categories. Compositio Math. 147 (2011), 1519–1545. V. Mazorchuk, V. Miemietz. Additive versus abelian 2-representations of fiat 2-categories. Moscow Math. J. 14 (2014), no. 3, 595–615. V. Mazorchuk, V. Miemietz. Endmorphisms of cell 2-representations. Int. Math. Res. Notes, Vol. 2016, No. 24, 7471–7498. V. Mazorchuk, V. Miemietz. Morita theory for finitary 2-categories. Quantum Topol. 7 (2016), no. 1, 1–28. V. Mazorchuk, V. Miemietz. Transitive 2-representations of finitary 2-categories. Trans. Amer. Math. Soc. 368 (2016), no. 11, 7623–7644. V. Mazorchuk, V. Miemietz. Isotypic faithful 2-representations of J -simple fiat 2categories. Math. Z. 282 (2016), no. 1-2, 411–434. V. Mazorchuk, C. Stroppel. G(l, k, d)-modules via groupoids. J. Algebraic Combin. 43 (2016), no. 1, 11–32. V. Mazorchuk, X. Zhang. Simple transitive 2-representations for two non-fiat 2categories of projective functors. Preprint arXiv:1601.00097 H. Pfeiffer. 2-Groups, trialgebras and their Hopf categories of representations. Adv. Math. 212 (2007), 62-108. C. M. Ringel. Tame algebras and integral quadratic forms. Lecture Notes in Mathematics 1099. Springer-Verlag, Berlin, 1984. G.-C. Rota. On the foundations of combinatorial theory. I. Theory of Möbius functions. Z. Wahrscheinlichkeitstheorie und Verw. Gebiete 2 (1964), 340–368. R. Rouquier. 2-Kac-Moody algebras. Preprint arXiv:0812.5023. R. Rouquier. Quiver Hecke algebras and 2-Lie algebras. Algebra Colloquium 19 (2012), 359–410. 16 [Ste] [Str] [Xa] [Zh1] [Zh2] [Zi] PAUL MARTIN AND VOLODYMYR MAZORCHUK B. Steinberg. Möbius functions and semigroup representation theory. J. Combin. Theory Ser. A 113 (2006), no. 5, 866–881. C. Stroppel. Categorification of the Temperley-Lieb category, tangles, and cobordisms via projective functors. Duke Math. J. 126 (2005), no. 3, 547–596. Q. Xantcha. Gabriel 2-Quivers for Finitary 2-Categories. J. Lond. Math. Soc. (2) 92 (2015), no. 3, 615–632. X. Zhang. Duflo involutions for 2-categories associated to tree quivers. J. Algebra Appl. 15 (2016), no. 3, 1650041, 25 pp. X. Zhang. Simple transitive 2-representations and Drinfeld center for some finitary 2-categories. Preprint arXiv:1506.02402. To appear in J. Pure Appl. Algebra. J. Zimmermann. Simple transitive 2-representations of Soergel bimodules in type B2 . J. Pure Appl. Algebra 221 (2017), no. 3, 666–690. P. M.: Department of Pure Mathematics, University of Leeds, Leeds, LS2 9JT, UK, e-mail: [email protected] V. M: Department of Mathematics, Uppsala University, Box. 480, SE-75106, Uppsala, SWEDEN, email: [email protected]
4math.GR
Temporal Action Detection with Structured Segment Networks Yue Zhao1 , Yuanjun Xiong1 , Limin Wang2 , Zhirong Wu1 , Xiaoou Tang1 , and Dahua Lin1 arXiv:1704.06228v2 [cs.CV] 18 Sep 2017 1 Department of Information Engineering, The Chinese University of Hong Kong 2 Computer Vision Laboratory, ETH Zurich, Switzerland Abstract Detecting actions in untrimmed videos is an important yet challenging task. In this paper, we present the structured segment network (SSN), a novel framework which models the temporal structure of each action instance via a structured temporal pyramid. On top of the pyramid, we further introduce a decomposed discriminative model comprising two classifiers, respectively for classifying actions and determining completeness. This allows the framework to effectively distinguish positive proposals from background or incomplete ones, thus leading to both accurate recognition and localization. These components are integrated into a unified network that can be efficiently trained in an end-to-end fashion. Additionally, a simple yet effective temporal action proposal scheme, dubbed temporal actionness grouping (TAG) is devised to generate high quality action proposals. On two challenging benchmarks, THUMOS14 and ActivityNet, our method remarkably outperforms previous state-of-the-art methods, demonstrating superior accuracy and strong adaptivity in handling actions with various temporal structures. 1 Figure 1. Importance of modeling stage structures in action detection. We slide window detectors through a video clip with an action instance of “Tumbling” (green box). Top: The detector builds features without any stage structure of the action, e.g. average pooling throughout the window. It produces high responses whenever it sees any discriminative snippet related to tumbling, making it hard to localize the instance. Bottom: SSN detector utilizes stage structures (starting, course, and ending) via structured temporal pyramid pooling. Its response is only significant when the window is well aligned. 1. Introduction Temporal action detection has drawn increasing attention from the research community, owing to its numerous potential applications in surveillance, video analytics, and other areas [30, 25, 56, 38]. This task is to detect human action instances from untrimmed, and possibly very long videos. Compared to action recognition, it is substantially more challenging, as it is expected to output not only the action category, but also the precise starting and ending time points. Over the past several years, the advances in convolutional neural networks have led to remarkable progress in video analysis. Notably, the accuracy of action recognition 1 Code has been significantly improved [40, 45, 10, 50, 52]. Yet, the performances of action detection methods remain unsatisfactory [57, 56, 42]. For existing approaches, one major challenge in precise temporal localization is the large number of incomplete action fragments in the proposed temporal regions. Traditional snippet based classifiers rely on discriminative snippets of actions, which would also exist in these incomplete proposals. This makes them very hard to distinguish from valid detections (see Fig. 1). We argue that tackling this challenge requires the capability of temporal structure analysis, or in other words, the ability to identify different stages e.g. starting, course, and ending, which to- available at http://yjxiong.me/others/ssn 1 gether decide the completeness of an actions instance. Structural analysis is not new in computer vision. It has been well studied in various tasks, e.g. image segmentation [21], scene understanding [17], and human pose estimation [2]. Take the most related object detection for example, in deformable part based models (DPM) [9], the modeling of the spatial configurations among parts is crucial. Even with the strong expressive power of convolutional networks [13], explicitly modeling spatial structures, in the form of spatial pyramids [23, 15], remains an effective way to achieve improved performance, as demonstrated in a number of state-of-the-art object detection frameworks, e.g. Fast R-CNN [12] and region-based FCN [24]. In the context of video understanding, although temporal structures have played an crucial role in action recognition [29, 49, 33, 53], their modeling in temporal action detection was not as common and successful. Snippet based methods [25, 42] often process individual snippets independently without considering the temporal structures among them. Later works attempt to incorporate temporal structures, but are often limited to analyzing short clips. SCNN [38] models the temporal structures via the 3D convolution, but its capability is restricted by the underlying architecture [45], which is designed to accommodate only 16 frames. The methods based on recurrent networks [5, 27] rely on dense snippet sampling and thus are confronted with serious computational challenges when modeling long-term structures. Overall, existing works are limited in two key aspects. First, the tremendous amount of visual data in videos restricts their capability of modeling long-term dependencies in an end-to-end manner. Also, they neither provide explicit modeling of different stages in an activity (e.g. starting and ending) nor offer a mechanism to assess the completeness, which, as mentioned, is crucial for accurate action detection. In this work, we aim to move beyond these limitations and develop an effective technique for temporal action detection. Specifically, we adopt the proven paradigm of “proposal+classification”, but take a significant step forward by utilizing explicit structural modeling in the temporal dimension. In our model, each complete activity instance is considered as a composition of three major stages, namely starting, course, and ending. We introduce structured temporal pyramid pooling to produce a global representation of the entire proposal. Then we introduce a decomposed discriminative model to jointly classify action categories and determine completeness of the proposals, which work collectively to output only complete action instances. These components are integrated into a unified network, called structured segment network (SSN). We adopt the sparse snippet sampling strategy [52], which overcomes the computational issue for long-term modeling and enables efficient end-to-end training of SSN. Additionally, we propose to use multi-scale grouping upon the temporal actionness signal to generate action proposals, achieving higher temporal recall with less proposals to further boost the detection performance. The proposed SSN framework excels in the following aspects: 1) It provides an effective mechanism to model the temporal structures of activities, and thus the capability of discriminating between complete and incomplete proposals. 2) It can be efficiently learned in an end-to-end fashion (5 to 15 hours over a large video dataset, e.g. ActivityNet), and once trained, can perform fast inference of temporal structures. 3) The method achieves superior detection performance on standard benchmark datasets, establishing new state-of-the-art for temporal action detection. 2. Related Work Action Recognition. Action recognition has been extensively studied in the past few years [22, 47, 40, 45, 50, 52, 58]. Earlier methods are mostly based on hand-crafted visual features [22, 47]. In the past several years, the wide adoption of convolutional networks (CNNs) has resulted in remarkable performance gain. CNNs are first introduced to this task in [20]. Later, two-stream architectures [40] and 3D-CNN [45] are proposed to incorporate both appearance and motion features. These methods are primarily frame-based and snippet-based, with simple schemes to aggregate results. There are also efforts that explore long-range temporal structures via temporal pooling or RNNs [50, 28, 5]. However, most methods assume welltrimmed videos, where the action of interest lasts for nearly the entire duration. Hence, they don’t need to consider the issue of localizing the action instances. Object Detection. Our action detection framework is closely related to object detection frameworks [9, 13, 35] in spatial images, where detection is performed by classifying object proposals into foreground classes and a background class. Traditional object proposal methods rely on dense sliding windows [9] and bottom-up methods that exploit low-level boundary cues [46, 59]. Recent proposal methods based on deep neural networks show better average recall while requiring less candidates [35]. Deep models also introduce great modeling capacity for capturing object appearances. With strong visual features, spatial structural modeling [23] remains a key component for detection. In particular, the RoI pooling [12] is introduced to model the spatial configuration of object with minimal extra cost. The idea is further reflected in R-FCN [24] where the spatial configuration is handled with the position sensitive pooling. Temporal Action Detection. Previous works on activity detection mainly use sliding windows as candidates and focus on designing hand-crafted feature representations for classification [11, 44, 30, 25, 57, 18]. Recent works incorporate deep networks into the detection frameworks and Tumbling Instance Activity: Tumbling CNN CNN CNN CNN Complete Tumbling? Yes. CNN CNN CNN CNN CNN Figure 2. An overview of the structured segment network framework. On a video from ActivityNet [8] there is a candidate region (green box). We first build the augmented proposal (yellow box) by extending it. The augmented proposal is divided into starting (orange), course (green), and ending (blue) stages. An additional level of pyramid with two sub-parts is constructed on the course stage. Features from CNNs are pooled within these five parts and concatenated to form the global region representations. The activity classifier and the completeness classifier operate on the the region representations to produce activity probability and class conditional completeness probability. The final probability of the proposal being positive instance is decided by the joint probability from these two classifiers. During training, we sparsely sample L = 9 snippets from evenly divided segments to approximate the dense temporal pyramid pooling. obtain improved performance [56, 38, 3]. S-CNN [38] proposes a multi-stage CNN which boosts accuracy via a localization network. However, S-CNN relies on C3D [45] as the feature extractor, which is initially designed for snippetwise action classification. Extending it to detection with possibly long action proposals needs enforcing an undesired large temporal kernel stride. Another work [56] uses Recurrent Neural Network (RNN) to learn a glimpse policy for predicting the starting and ending points of an action. Such sequential prediction is often time-consuming for processing long videos and it does not support joint training of the underlying feature extraction CNN. Our method differs from these approaches in that it explicitly models the action structure via structural temporal pyramid pooling. By using sparse sampling, we further enable efficient end-toend training. Note there are also works on spatial-temporal detection [14, 55, 26, 51, 32] and temporal video segmentation [16], which are beyond the scope of this paper. 3. Structured Segment Network The proposed structured segment network framework, as shown in Figure 2, takes as input a video and a set of temporal action proposals. It outputs a set of predicted activity instances each associated with a category label and a temporal range (delimited by a starting point and an ending point). From the input to the output, it takes three key steps. First, the framework relies on a proposal method to produce a set of temporal proposals of varying durations, where each proposal comes with a starting and an ending time. The proposal methods will be discussed in detail in Section 5. Our framework considers each proposal as a composition of three consecutive stages, starting, course, and ending, which respectively capture how the action starts, proceeds, and ends. Thus upon each proposal, structured temporal pyramid pooling (STPP) are performed by 1) splitting the proposal into the three stages; 2) building temporal pyramidal representation for each stage; 3) building global representation for the whole proposal by concatenating stagelevel representations. Finally, two classifiers respectively for recognizing the activity category and assessing the completeness will be applied on the representation obtained by STPP and their predictions will be combined, resulting in a subset of complete instances tagged with category labels. Other proposals, which are considered as either belonging to background or incomplete, will be filtered out. All the components outlined above are integrated into a unified network, which will be trained in an end-to-end way. For training, we adopt the sparse snippet sampling strategy [52] to approximate the temporal pyramid on dense samples. By exploiting the redundancy among video snippets, this strategy can substantially reduce the computational cost, thus allowing the crucial modeling of long-term temporal structures. 3.1. Three-Stage Structures At the input level, a video can be represented as a sequence of T snippets, denoted as (St )Tt=1 . Here, one snip- pet contains several consecutive frames, which, as a whole, is characterized by a combination of RGB images and an optical flow stack [40]. Consider a given set of N proposals P = {pi = [si , ei ]}N i=1 . Each proposal pi is composed of a starting time si and an ending time ei . The duration of pi is thus di = ei − si . To allow structural analysis and particularly to determine whether a proposal captures a complete instance, we need to put it in a context. Hence, we augment each proposal pi into p0i = [s0i , e0i ] with where s0i = si −di /2 and e0i = ei + di /2. In other words, the augmented proposal p0i doubles the span of pi by extending beyond the starting and ending points, respectively by di /2. If a proposal accurately aligns well with a groundtruth instance, the augmented proposal will capture not only the inherent process of the activity, but also how it starts and ends. Following the three-stage notion, we divide the augmented proposal p0i into three consecutive intervals: psi = [s0i , si ], pci = [si , ei ], and pei = [ei , e0i ], which are respectively corresponding to the starting, course, and ending stages. 3.2. Structured Temporal Pyramid Pooling As mentioned, the structured segment network framework derives a global representation for each proposal via temporal pyramid pooling. This design is inspired by the success of spatial pyramid pooling [23, 15] in object recognition and scene classification. Specifically, given an augmented proposal p0i divided into three stages psi , pci , and pei , we first compute the stage-wise feature vectors fis , fic , and fie respectively via temporal pyramid pooling, and then concatenate them into a global representation. Specifically, a stage with interval [s, e] would cover a series of snippets, denoted as {St |s ≤ t ≤ e}. For each snippet, we can obtain a feature vector vt . Note that we can use any feature extractor here. In this work, we adopt the effective two-stream feature representation first proposed in [40]. Based on these features, we construct a L-level temporal pyramid where each level evenly divides the interval into Bl parts. For the i-th part of the l-th level, whose interval is [sli , eli ], we can derive a pooled feature as (l) ui = eli X 1 vt . |eli − sli + 1| t=s (1) li Then the overall representation of this stage can be obtained by concatenating the pooled features across all parts at all (l) levels as fic = (ui |l = 1, . . . , L, i = 1, . . . , Bl ). We treat the three stages differently. Generally, we observed that the course stage, which reflects the activity process itself, usually contains richer structure e.g. this process itself may contain sub-stages. Hence, we use a two-level pyramid, i.e. L = 2, B1 = 1, and B2 = 2, for the course stage, while using simpler one-level pyramids (which essentially reduce to standard average pooling) for starting and ending pyramids. We found empirically that this setting strikes a good balance between expressive power and complexity. Finally, the stage-wise features are combined via concatenation. Overall, this construction explicitly leverages the structure of an activity instance and its surrounding context, and thus we call it structured temporal pyramid pooling (STPP). 3.3. Activity and Completeness Classifiers On top of the structured features described above, we introduce two types of classifiers, an activity classifier and a set of completeness classifiers. Specifically, the activity classifier A classifies input proposals into K + 1 classes, i.e. K activity classes (with labels 1, . . . , K) and an additional “background” class (with label 0). This classifier restricts its scope to the course stage, making predictions based on the corresponding feature fic . The completeness classifiers {Ck }K k=1 are a set of binary classifiers, each for one activity class. Particularly, Ck predicts whether a proposal captures a complete activity instance of class k, based on the global representation {fis , fic , fie } induced by STPP. In this way, the completeness is determined not only on the proposal itself but also on its surrounding context. Both types of classifiers are implemented as linear classifiers on top of high-level features. Given a proposal pi , the activity classifier will produce a vector of normalized responses via a softmax layer. From a probabilistic view, it can be considered as a conditional distribution P (ci |pi ), where ci is the class label. For each activity class k, the corresponding completeness classifier Ck will yield a probability value, which can be understood as the conditional probability P (bi |ci , pi ), where bi indicates whether pi is complete. Both outputs together form a joint distribution. When ci ≥ 1, P (ci , bi |pi ) = P (ci |pi ) · P (bi |ci , pi ). Hence, we can define a unified classification loss jointly on both types of classifiers. With a proposal pi and its label ci : Lcls (ci , bi ; pi ) = − log P (ci |pi ) − 1(ci ≥1) log P (bi |ci , pi ). (2) Here, the completeness term P (bi |ci , pi ) is only used when ci ≥ 1, i.e. the proposal pi is not considered as part of the background. Note that these classifiers together with STPP are integrated into a single network that is trained in an endto-end way. During training, we collect three types of proposal samples: (1) positive proposals, i.e. those overlap with the closest groundtruth instances with at least 0.7 IoU; (2) background proposals, i.e. those that do not overlap with any groundtruth instances; and (3) incomplete proposals, i.e. those that satisfy the following criteria: 80% of its own span is contained in a groundtruth instance, while its IoU with that instance is below 0.3 (in other words, it just covers a small part of the instance). For these proposal types, we respectively have (ci > 0, bi = 1), ci = 0, and (ci > 0, bi = 0). Each mini-batch is ensured to contain all three types of proposals. 3.4. Location Regression and Multi-Task Loss With the structured information encoded in the global features, we can not only make categorical predictions, but also refine the proposal’s temporal interval itself by location regression. We devise a set of location regressors {Rk }K k=1 , each for an activity class. We follow the design in RCNN [13], but adapting it for 1D temporal regions. Particularly, for a positive proposal pi , we regress the relative changes of both the interval center µi and the span φi (in log-scale), using the closest groundtruth instance as the target. With both the classifiers and location regressors, we define a multi-task loss over an training sample pi , as: Lcls (ci , bi ; pi ) + λ · 1(ci ≥1 & bi =1) Lreg (µi , φi ; pi ). (3) Here, Lreg uses the smooth L1 loss function [12]. 4. Efficient Training and Inference with SSN The huge amount of frames poses a serious challenge in computational cost to video analysis. Our structured segment network also faces this challenge. This section presents two techniques which we use to reduce the cost and enable end-to-end training. Training with sparse sampling. The structured temporal pyramid, in its original form, rely on densely sampled snippets. This would lead to excessive computational cost and memory demand in end-to-end training over long proposals – in practice, proposals that span over hundreds of frames are not uncommon. However, dense sampling is generally unnecessary in our framework. Particularly, the pooling operation is essentially to collect feature statistics over a certain region. Such statistics can be well approximated via a subset of snippets, due to the high redundancy among them. Motivated by this, we devise a sparse snippet sampling scheme. Specifically, given a augmented proposal p0i , we evenly divide it into L = 9 segments, randomly sampling only one snippet from each segment. Structured temporal pyramid pooling is performed for each pooling region on its corresponding segments. This scheme is inspired by the segmental architecture in [52], but differs in that it operates within STPP instead of a global average pooling. In this way, we fix the number of features needed to be computed regardless of how long the proposal is, thus effectively reducing the computational cost, especially for modeling long-term structures. More importantly, this enables end-to-end training of the entire framework over a large number of long proposals. Inference with reordered computation. In testing, we sample video snippets with a fixed interval of 6 frames, and construct the temporal pyramid thereon. The original formulation of temporal pyramid first computes pooled features and then applies the classifiers and regressors on top which is not efficient. Actually, for each video, hundreds of proposals will be generated, and these proposals can significantly overlap with each other – therefore, a considerable portion of the snippets and the features derived thereon are shared among proposals. To exploit this redundancy in the computation, we adopt the idea introduced in position sensitive pooling [24] to improve testing efficiency. Note that our classifiers and regressors are both linear. So the key step in classification or regression is to multiply a weight matrix W with the global feature vector f . Recall that f itself is a concatenation of multiple features, each pooled over a certain Pinterval. Hence the computation can be written as Wf = j Wj fj , where j indexes different regions along the pyramid. Here, fj is obtained by average pooling over all snippet-wise features within the region rj . Thus, we have Wj fj = Wj · Et∼rj [vt ] = Et∼rj [Wj vt ] . (4) Et∼rj denotes the average pooling over rj , which is a linear operation and therefore can be exchanged with the matrix multiplication. Eq (4) suggests that the linear responses w.r.t. the classifiers/regressors can be computed before pooling. In this way, the heavy matrix multiplication can be done in the CNN for each video over all snippets, and for each proposal, we only have to pool over the network outputs. This technique can reduce the processing time after extracting network outputs from around 10 seconds to less than 0.5 second per video on average. 5. Temporal Region Proposals In general, SSN accepts arbitrary proposals, e.g. sliding windows [38, 57]. Yet, an effective proposal method can produce more accurate proposals, and thus allowing a small number of proposals to reach a certain level of performance. In this work, we devise an effective proposal method called temporal actionness grouping (TAG). This method uses an actionness classifier to evaluate the binary actionness probabilities for individual snippets. The use of binary actionness for proposals is first introduced in spatial action detection by [51]. Here we utilize it for temporal action detection. Our basic idea is to find those continuous temporal regions with mostly high actionness snippets to serve as proposals. To this end, we repurpose a classic watershed algorithm [37], applying it to the 1D signal formed by a sequence of complemented actionness values, as shown in Figure 3. Imagine the signal as 1D terrain with heights and basins. This algorithm floods water on this terrain with different “water level” (γ), resulting in a set of “basins” covered by water, denoted by G(γ). Intuitively, each “basin” 6.1. Experimental Settings Figure 3. Visualization of the temporal actionness grouping process for proposal generation. Top: Actionness probabilities as a 1D signal sequence. Middle: The complement signal. We flood it with different levels γ. Bottom: Regions obtained by different flooding levels. By merging the regions according to the grouping criterion, we get the final set of proposals (in orange color). corresponds to a temporal region with high actionness. The ridges above water then form the blank areas between basins, as illustrated in Fig. 3. Given a set of basins G(γ), we devise a grouping scheme similar to [34], which tries to connect small basins into proposal regions. The scheme works as follows: it begins with a seed basin, and consecutively absorbs the basins that follow, until the fraction of the basin durations over the total duration (i.e. from the beginning of the first basin to the ending of the last) drops below a certain threshold τ . The absorbed basins and the blank spaces between them are then grouped to form a single proposal. We treat each basin as seed and perform the grouping procedure to obtain a set of proposals denoted by G0 (τ, γ). Note that we do not choose a specific combination of τ and γ. Instead we uniformly sample τ and γ from ∈ (0, 1) with an even step of 0.05. The combination of these two thresholds leads to multiple sets of regions. We then take the union of them. Finally, we apply non-maximal suppression to the union with IoU threshold 0.95, to filter out highly overlapped proposals. The retained proposals will be fed to the SSN framework. 6. Experimental Results We conducted experiments to test the proposed framework on two large-scale action detection benchmark datasets: ActivityNet [8] and THUMOS14 [19]. In this section we first introduce these datasets and other experimental settings and then investigate the impact of different components via a set of ablation studies. Finally we compare the performance of SSN with other state-of-the-art approaches. Datasets. ActivityNet [8] has two versions, v1.2 and v1.3. The former contains 9682 videos in 100 classes, while the latter, which is a superset of v1.2 and was used in the ActivityNet Challenge 2016, contains 19994 videos in 200 classes. In each version, the dataset is divided into three disjoint subsets, training, validation, and testing, by 2:1:1. THUMOS14 [19] has 1010 videos for validation and 1574 videos for testing. This dataset does not provide the training set by itself. Instead, the UCF101 [43], a trimmed video dataset is appointed as the official training set. Following the standard practice, we train out models on the validation set and evaluate them on the testing set. On these two sets, 220 and 212 videos have temporal annotations in 20 classes, respectively. 2 falsely annotated videos (“270”,“1496”) in the test set are excluded in evaluation. In our experiments, we compare with our method with the states of the art on both THUMOS14 and ActivityNet v1.3, and perform ablation studies on ActivityNet v1.2. Implementation Details. We train the structured segment network in an end-to-end manner, with raw video frames and action proposals as the input. Two-stream CNNs [40] are used for feature extraction. We also use the spatial and temporal streams to harness both the appearance and motion features. The binary actionness classifiers underlying the TAG proposals are trained with [52] on the training subset of each dataset. We use SGD to learn CNN parameters in our framework, with batch size 128 and momentum 0.9. We initialize the CNNs with pre-trained models from ImageNet [4]. The initial learning rates are set to 0.001 for RGB networks and 0.005 for optical flow networks. In each minibatch, we keep the ratio of three types of proposals, namely positive, background, and incomplete, to be 1:1:6. For the completeness classifiers, only the samples with loss values ranked in the first 1/6 of a minibatch are used for calculating gradients, which resembles online hard negative mining [39]. On both versions of ActivityNet, the RGB and optical flow branches of the two-stream CNN are respectively trained for 9.5K and 20K iterations, with learning rates scaled down by 0.1 after every 4K and 8K iterations, respectively. On THUMOS14, these two branches are respectively trained for 1K and 6K iterations, with learning rates scaled down by 0.1 per 400 and 2500 iterations. Evaluation Metrics. As both datasets originate from contests, each dataset has its own convention of reporting performance metrics. We follow their conventions, reporting mean average precision (mAP) at different IoU thresholds. On both versions of ActivityNet, the IoU thresholds are {0.5, 0.75, 0.95}. The average of mAP values with IoU thresholds [0.5:0.05:0.95] is used to compare the performance between different methods. On THUMOS14, the IoU thresholds are {0.1, 0.2, 0.3, 0.4, 0.5}. The mAP at 0.5 Average mAP (%) Max Pool Average Pool (1)-0 13.1 4.48 (1,2)-0 13.5 4.34 (1)-1 18.3 24.3 (1,2)-1 18.4 24.6 Table 2. Comparison between different temporal pooling settings. The setting (1,2)-1 is used in the SSN framework. Please refer to Sec. 6.2 for the definition of these settings. trained on THUMOS14 achieves 48.9% in Table 1. Finally, we evaluate the proposal methods in the context of action detection. The detection mAP values using sliding window proposals and TAG proposals are shown in Table 3. The results confirm that, in most cases, the improved proposals can result in improved detection performance. Figure 4. Recall rate at different tIoU thresholds on ActivityNet v1.2. High recall rates at high IoU thresholds (> 0.7) indicate better proposal quality. Proposal Method Sliding Windows SCNN-prop [38] TAP [7] DAP [6] TAG THUMOS14 # Prop. AR 204 21.2 200 20.0 200 23.0 200 37.0 200 48.9 ActivityNet v1.2 # Prop. AR 100 34.8 90 14.9 100 12.1 100 71.7 Table 1. Comparison between different temporal action proposal methods with same number of proposals. “AR” refers to the average recall rates. “-” indicates the result is not available. IoU is used for comparing results from different methods. 6.2. Ablation Studies Temporal Action Proposal. We compare the performance of different action proposal schemes in three aspects, i.e. recall, quality, and detection performance. Particularly, we compare our TAG scheme with common sliding windows as well as other state-of-the-art proposal methods, including SCNN-prop, a proposal networks presented in [38], TAP [7], DAP [6]. For the sliding window scheme, we use 20 exponential scales starting from 0.3 second long and step sizes of 0.4 times of window lengths. We first evaluate the average recall rates, which are summarized in Table 1. We can see that TAG proposal have higher recall rates with the same number of proposals. Then we investigate the quality of its proposals. We plot the recall rates from different proposal methods at different IoU thresholds in Fig. 4. We can see TAG retains relatively high recall at high IoU thresholds, demonstrating that the proposals from TAG are generally more accurate. In experiments we also tried applying the actionness classifier trained on ActivityNet v1.2 directly on THUMOS14. We can still achieve a reasonable average recall of 39.6%, while the one Structured Temporal Pyramid Pooling. Here we study the influence of different pooling strategies in STPP. We denote one pooling configuration as (B1 , . . . , BK )−A, where K refers to the number of pyramid levels for the course stage and B1 , . . . , BK the number of regions in each level. A = 1 indicates we use augmented proposal and model the starting and ending stage, while A = 0 indicates we only use the original proposal (without augmentation). Additionally we compare two within-region pooling methods: average and max pooling. The results are summarized in Table 2. Note that these configurations are evaluated in the stage-wise training scenario. We observe that cases where A = 0 have inferior performance, showing that the introduction of the stage structure is very important for accurate detection. Also, increasing the depth of the pyramids for the course stage can give slight performance gain. Based on these results, we fix the configuration to (1, 2) − 1 in later experiments. Classifier Design. In this work, we introduced the activity and completeness classifiers which work together to classify the proposal. We verify the importance of this decomposed design by studying another design that replaces it with a single set of classifiers, for which both background and incomplete samples are uniformly treated as negative. We perform similar negative sample mining for this setting. The results are summarized in Table 3. We observe that using only one classifier to distinguish positive samples from both background and incomplete would lead to worse result even with negative mining, where mAP decreased from 23.7% to 17.9%. We attribute this performance gain to the different natures of the two negative proposal types, which require different classifiers to handle. Location Regression & Multi-Task Learning. Because of the contextual information contained in the starting and ending stages of the global region features, we are able to perform location regression. We measure the contribution of this step to the detection performance in Table 3. From the results we can see that the location regression and multitask learning, where we train the classifiers and the regres- Stage-Wise End-to-End STPP X X X X X Act. + Comp. X X X X Loc. Reg. X X SW 0.56 5.99 16.4 18.1 TAG 4.82 17.9 24.6 24.9 24.8 25.9 Table 3. Ablation study on ActivityNet [8] v1.2. Overall, end-toend training is compared against stage wise training. We evaluate the performance using both sliding window proposals (“SW”) and TAG proposals (“TAG”), measured by mean average precision (mAP). Here, “STPP” refers to structure temporal pyramid pooling. “Act. + Comp.” refers to the use of two classifiers design. “Loc. Reg” denotes the use the location regression. sors together in an end-to-end manner, always improve the detection accuracy. Training: Stage-wise v.s. End-to-end. While the structured segment network is designed for end-to-end training, it is also possible to first densely extract features and train the classifiers and regressors with SVM and ridge regression, respectively. We refer to this training scheme as stagewise training. We compare the performance of end-to-end training and stage-wise training in Table 3. We observe that models from end-to-end training can slightly outperform those learned with stage-wise training under the same settings. This is remarkable as we are only sparsely sampling snippets in end-to-end training, which also demonstrates the importance of jointly optimizing the classifiers and feature extractors and justifies our framework design. Besides, end-to-end training has another major advantage that it does not need to store the extracted features for the training set, which could become quite storage intensive as training data grows. 6.3. Comparison with the State of the Art Finally, we compare our method with other state-of-theart temporal action detection methods on THUMOS14 [19] and ActivityNet v1.3 [8], and report the performances using the metrics described above. Note that the average action duration in THUMOS14 and ActivityNet are 4 and 50 seconds. And the average video duration are 233 and 114 seconds, respectively. This reflects the distinct natures of these datasets in terms of the granularities and temporal structures of the action instances. Hence, strong adaptivity is required to perform consistently well on both datasets. THUMOS14. On THUMOS 14, We compare with the contest results [48, 31, 36] and those from recent works, including the methods that use segment-based 3D CNN [38], score pyramids [57], and recurrent reinforcement learning [56]. The results are shown in Table 4. In most cases, the proposed method outperforms previous state-of-the-art methods by over 10% in absolute mAP values. THUMOS14, mAP@α Method 0.1 0.2 0.3 Wang et. al. [48] 18.2 17.0 14.0 Oneata et. al. [31] 36.6 33.6 27.0 Richard et. al. [36] 39.7 35.7 30.0 S-CNN [38] 47.7 43.5 36.3 Yeung et. al. [56] 48.9 44.0 36.0 Yuan et. al. [57] 51.4 42.6 33.6 SSN 60.3 56.2 50.6 SSN* 66.0 59.4 51.9 0.4 11.7 20.8 23.2 28.7 26.4 26.1 40.8 41.0 0.5 8.3 14.4 15.2 19.0 17.1 18.8 29.1 29.8 Table 4. Action detection results on THUMOS14, measured by mAP at different IoU thresholds α. The upper half of the table shows challenge results back in 2014. “SSN*” indicates metrics calculated in the PASCAL-VOC style used by ActivityNet [8]. ActivityNet v1.3 (testing), mAP@α Method 0.5 0.75 0.95 Average Wang et. al. [54] 42.48 2.88 0.06 14.62 Singh et. al. [41] 28.67 17.78 2.88 17.68 Singh et. al. [42] 36.40 11.05 0.14 17.83 SSN 43.26 28.70 5.63 28.28 Table 5. Action detection results on ActivityNet v1.3, measured by mean average precision (mAP) for different IoU thresholds α and the average mAP of IoU thresholds from 0.5 to 0.95. ActivityNet. The results on the testing set of ActivityNet v1.3 are shown in Table 5. For references, we list the performances of highest ranked entries in the ActivityNet 2016 challenge. We submit our results to the test server of ActivityNet v1.3 and report the detection performance on the testing set. The proposed framework, using a single model instead of an ensemble, is able to achieve an average mAP of 28.28 and perform well at high IOU thresholds, i.e., 0.75 and 0.95. This clearly demonstrates the superiority of our method. Visualization of the detection results can be found in the supplementary materials [1]. 7. Conclusion In this paper, we presented a generic framework for temporal action detection, which combines a structured temporal pyramid with two types of classifiers, respectively for predicting activity class and completeness. With this framework, we achieved significant performance gain over stateof-the-art methods on both ActivityNet and THUMOS14. Moreover, we demonstrated that our method is both accurate and generic, being able to localize temporal boundaries precisely and working well for activity classes with very different temporal structures. Acknowledgment. This work is partially supported by the Big Data Collaboration Research grant from SenseTime Group (CUHK Agreement No. TS1610626), the General Research Fund (GRF) of Hong Kong (No. 14236516) and the Early Career Scheme (ECS) of Hong Kong (No. 24204215). References [1] Supplementary materials. http://yjxiong.me/ others/ssn/supp.pdf. 8 [2] M. Andriluka, S. Roth, and B. Schiele. Pictorial structures revisited: People detection and articulated pose estimation. In CVPR, pages 1014–1021. IEEE, 2009. 2 [3] R. De Geest, E. Gavves, A. Ghodrati, Z. Li, C. Snoek, and T. Tuytelaars. Online action detection. In ECCV, pages 269– 284. Springer, 2016. 3 [4] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and F. Li. ImageNet: A large-scale hierarchical image database. In CVPR, pages 248–255, 2009. 6 [5] J. Donahue, L. Anne Hendricks, S. Guadarrama, M. Rohrbach, S. Venugopalan, K. Saenko, and T. Darrell. Long-term recurrent convolutional networks for visual recognition and description. In CVPR, pages 2625–2634, 2015. 2 [6] V. Escorcia, F. Caba Heilbron, J. C. Niebles, and B. Ghanem. Daps: Deep action proposals for action understanding. In B. Leibe, J. Matas, N. Sebe, and M. Welling, editors, ECCV, pages 768–784, 2016. 7 [7] B. G. Fabian Caba Heilbron, Juan Carlos Niebles. Fast temporal activity proposals for efficient detection of human actions in untrimmed videos. In CVPR, pages 1914–1923, 2016. 7 [8] B. G. Fabian Caba Heilbron, Victor Escorcia and J. C. Niebles. Activitynet: A large-scale video benchmark for human activity understanding. In CVPR, pages 961–970, 2015. 3, 6, 8 [9] P. F. Felzenszwalb, R. B. Girshick, D. McAllester, and D. Ramanan. Object detection with discriminatively trained partbased models. IEEE TPAMI, 32(9):1627–1645, 2010. 2 [10] B. Fernando, E. Gavves, J. O. M., A. Ghodrati, and T. Tuytelaars. Modeling video evolution for action recognition. In CVPR, pages 5378–5387, 2015. 1 [11] A. Gaidon, Z. Harchaoui, and C. Schmid. Temporal localization of actions with actoms. IEEE TPAMI, 35(11):2782– 2795, 2013. 2 [12] R. Girshick. Fast r-cnn. In ICCV, pages 1440–1448, 2015. 2, 5 [13] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, pages 580–587, 2014. 2, 5 [14] G. Gkioxari and J. Malik. Finding action tubes. In CVPR, pages 759–768, June 2015. 3 [15] K. He, X. Zhang, S. Ren, and J. Sun. Spatial pyramid pooling in deep convolutional networks for visual recognition. In ECCV, pages 346–361. Springer, 2014. 2, 4 [16] M. Hoai, Z.-Z. Lan, and F. De la Torre. Joint segmentation and classification of human actions in video. In CVPR, pages 3265–3272. IEEE, 2011. 3 [17] D. Hoiem, A. A. Efros, and M. Hebert. Putting objects in perspective. IJCV, 80(1):3–15, 2008. 2 [18] M. Jain, J. C. van Gemert, H. Jégou, P. Bouthemy, and C. G. M. Snoek. Action localization by tubelets from motion. In CVPR, June 2014. 2 [19] Y.-G. Jiang, J. Liu, A. Roshan Zamir, G. Toderici, I. Laptev, M. Shah, and R. Sukthankar. THUMOS challenge: Action recognition with a large number of classes. http: //crcv.ucf.edu/THUMOS14/, 2014. 6, 8 [20] A. Karpathy, G. Toderici, S. Shetty, T. Leung, R. Sukthankar, and L. Fei-Fei. Large-scale video classification with convolutional neural networks. In CVPR, pages 1725–1732, 2014. 2 [21] J. Lafferty, A. McCallum, F. Pereira, et al. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In ICML, volume 1, pages 282–289, 2001. 2 [22] I. Laptev. On space-time interest points. IJCV, 64(2-3), 2005. 2 [23] S. Lazebnik, C. Schmid, and J. Ponce. Beyond bags of features: Spatial pyramid matching for recognizing natural scene categories. In CVPR, volume 2, pages 2169–2178. IEEE, 2006. 2, 4 [24] Y. Li, K. He, J. Sun, et al. R-fcn: Object detection via regionbased fully convolutional networks. In NIPS, pages 379–387, 2016. 2, 5 [25] P. Mettes, J. C. van Gemert, S. Cappallo, T. Mensink, and C. G. Snoek. Bag-of-fragments: Selecting and encoding video fragments for event detection and recounting. In ICMR, pages 427–434, 2015. 1, 2 [26] P. Mettes, J. C. van Gemert, and C. G. Snoek. Spot on: Action localization from pointly-supervised proposals. In ECCV, pages 437–453. Springer, 2016. 3 [27] A. Montes, A. Salvador, S. Pascual, and X. Giro-i Nieto. Temporal activity detection in untrimmed videos with recurrent neural networks. In NIPS Workshop, 2016. 2 [28] J. Y.-H. Ng, M. Hausknecht, S. Vijayanarasimhan, O. Vinyals, R. Monga, and G. Toderici. Beyond short snippets: Deep networks for video classification. In CVPR, pages 4694–4702, 2015. 2 [29] J. C. Niebles, C.-W. Chen, and L. Fei-Fei. Modeling temporal structure of decomposable motion segments for activity classification. In ECCV, pages 392–405. Springer, 2010. 2 [30] D. Oneata, J. Verbeek, and C. Schmid. Action and event recognition with fisher vectors on a compact feature set. In ICCV, pages 1817–1824, 2013. 1, 2 [31] D. Oneata, J. Verbeek, and C. Schmid. The lear submission at thumos 2014. In THUMOS Action Recognition Challenge, 2014. 8 [32] X. Peng and C. Schmid. Multi-region two-stream r-cnn for action detection. In ECCV. Springer, 2016. 3 [33] H. Pirsiavash and D. Ramanan. Parsing videos of actions with segmental grammars. In CVPR, pages 612–619, 2014. 2 [34] J. Pont-Tuset, P. Arbeláez, J. Barron, F. Marques, and J. Malik. Multiscale combinatorial grouping for image segmentation and object proposal generation. In arXiv:1503.00848, March 2015. 6 [35] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NIPS, pages 91–99, 2015. 2 [36] A. Richard and J. Gall. Temporal action detection using a statistical language model. In CVPR, pages 3131–3140, 2016. 8 [37] J. B. Roerdink and A. Meijster. The watershed transform: Definitions, algorithms and parallelization strategies. Fundamenta informaticae, 41(1, 2):187–228, 2000. 5 [38] Z. Shou, D. Wang, and S.-F. Chang. Temporal action localization in untrimmed videos via multi-stage CNNs. In CVPR, pages 1049–1058, 2016. 1, 2, 3, 5, 7, 8 [39] A. Shrivastava, A. Gupta, and R. Girshick. Training regionbased object detectors with online hard example mining. In CVPR, pages 761–769, 2016. 6 [40] K. Simonyan and A. Zisserman. Two-stream convolutional networks for action recognition in videos. In NIPS, pages 568–576, 2014. 1, 2, 4, 6 [41] B. Singh, T. K. Marks, M. Jones, O. Tuzel, and M. Shao. A multi-stream bi-directional recurrent neural network for finegrained action detection. In CVPR, pages 1961–1970, 2016. 8 [42] G. Singh and F. Cuzzolin. Untrimmed video classification for activity detection: submission to activitynet challenge. CoRR, abs/1607.01979, 2016. 1, 2, 8 [43] K. Soomro, A. R. Zamir, and M. Shah. Ucf101: A dataset of 101 human actions classes from videos in the wild. arXiv:1212.0402, 2012. 6 [44] K. Tang, B. Yao, L. Fei-Fei, and D. Koller. Combining the right features for complex event recognition. In CVPR, pages 2696–2703, 2013. 2 [45] D. Tran, L. D. Bourdev, R. Fergus, L. Torresani, and M. Paluri. Learning spatiotemporal features with 3D convolutional networks. In ICCV, pages 4489–4497, 2015. 1, 2, 3 [46] K. E. Van de Sande, J. R. Uijlings, T. Gevers, and A. W. Smeulders. Segmentation as selective search for object recognition. In ICCV, pages 1879–1886, 2011. 2 [47] H. Wang and C. Schmid. Action recognition with improved trajectories. In ICCV, pages 3551–3558, 2013. 2 [48] L. Wang, Y. Qiao, and X. Tang. Action recognition and detection by combining motion and appearance features. In THUMOS Action Recognition Challenge, 2014. 8 [49] L. Wang, Y. Qiao, and X. Tang. Latent hierarchical model of temporal structure for complex activity classification. IEEE TIP, 23(2):810–822, 2014. 2 [50] L. Wang, Y. Qiao, and X. Tang. Action recognition with trajectory-pooled deep-convolutional descriptors. In CVPR, pages 4305–4314, 2015. 1, 2 [51] L. Wang, Y. Qiao, X. Tang, and L. Van Gool. Actionness estimation using hybrid fully convolutional networks. In CVPR, pages 2708–2717, 2016. 3, 5 [52] L. Wang, Y. Xiong, Z. Wang, Y. Qiao, D. Lin, X. Tang, and L. Van Gool. Temporal segment networks: Towards good practices for deep action recognition. In ECCV, pages 20– 36, 2016. 1, 2, 3, 5, 6 [53] P. Wang, Y. Cao, C. Shen, L. Liu, and H. T. Shen. Temporal pyramid pooling based convolutional neural network for action recognition. IEEE TCSVT, 2016. 2 [54] R. Wang and D. Tao. UTS at activitynet 2016. In AcitivityNet Large Scale Activity Recognition Challenge 2016, 2016. 8 [55] P. Weinzaepfel, Z. Harchaoui, and C. Schmid. Learning to track for spatio-temporal action localization. In ICCV, pages 3164–3172, 2015. 3 [56] S. Yeung, O. Russakovsky, G. Mori, and L. Fei-Fei. Endto-end learning of action detection from frame glimpses in videos. In CVPR, pages 2678–2687, 2016. 1, 3, 8 [57] J. Yuan, B. Ni, X. Yang, and A. A. Kassim. Temporal action localization with pyramid of score distribution features. In CVPR, pages 3093–3102, 2016. 1, 2, 5, 8 [58] B. Zhang, L. Wang, Z. Wang, Y. Qiao, and H. Wang. Realtime action recognition with enhanced motion vector CNNs. In CVPR, pages 2718–2726, 2016. 2 [59] C. L. Zitnick and P. Dollár. Edge boxes: Locating object proposals from edges. In ECCV, pages 391–405, 2014. 2
1cs.CV
Superpixel Based Segmentation and Classification of Polyps in Wireless Capsule Endoscopy Omid Haji Maghsoudi arXiv:1710.07390v1 [cs.CV] 20 Oct 2017 Department of Bioengineering College of Engineering Temple University Philadelphia, PA, USA, 19122 Email: [email protected] Abstract—Wireless Capsule Endoscopy (WCE) is a relatively new technology to record the entire GI trace, in vivo. The large amounts of frames captured during an examination cause difficulties for physicians to review all these frames. The need for reducing the reviewing time using some intelligent methods has been a challenge. Polyps are considered as growing tissues on the surface of intestinal tract not inside of an organ. Most polyps are not cancerous, but if one becomes larger than a centimeter, it can turn into cancer by great chance. The WCE frames provide the early stage possibility for detection of polyps. Here, the application of simple linear iterative clustering (SLIC) superpixel for segmentation of polyps in WCE frames is evaluated. Different SLIC superpixel numbers are examined to find the the highest sensitivity for detection of polyps. The SLIC superpixel segmentation is promising to improve the results of previous studies. Finally, the superpixels were classified using a support vector machine (SVM) by extracting some texture and color features. The classification results showed a sensitivity of 91%. I. I NTRODUCTION Wireless capsule endoscopy (WCE) is a new device which can investigate the entire gastrointestinal (GI) tract without any pain and it has been used to detect small bowel abnormalities such as polyps, tumor, bleeding, ulcers, Crohns disease, and Celiac. While the conventional methods are considered as painful and invasive methods. It records around 55000 frames in an examination which takes at least eight hours [1]. The WCE is illustrated in Fig. 1. Image processing have been used to solve problems in different applications like cell movement detection [2], animal locomotion [3], [4], or robotic [5]. Considering a large number of frames captured, it is essential to use an intelligent software or automatic method for reviewing these frames. There have been various investigations to help physicians for finding tumors [6], [7], [8], bleeding [9], [10], [11], [12], Crohn’s disease [13], [14], and different organs [15], [16], [17]. A polyp is one of the most common diseases in the intestine among adults with a percentage of 30% to 50%. For people more than 50 years old, this percentage goes up to 90% [18]. Most polyps are not cancerous, but if one becomes larger than a centimeter, it can turn into cancer by great chance. Therefore, it is necessary to detect the polyps in the early stages. There have been some methods tried to address this need. In the most recent study, a method was proposed to distinguish between the frames containing polyps and the one which is completely normal [18]. Five different features, single scale-invariant feature transform (SIFT), local binary pattern (LBP), uniform LBP, complete local binary pattern (CLBP), and Histogram of Oriented Gradients (HOG), were extracted from the WCE frames. The extracted features were classified using two well-known classifiers, support vector machine and Fisher’s linear discriminated analysis. The highest accuracy, specificity, and sensitivity for detection of frames containing Polyp were respectively 93%, 94%, and 87%. Another method was designed to segment the polyps in the WCE frames using two steps: first combined Log Gabor filters and SUSAN edge detector to produce potential polyp segments and then applied geometric features to outline final polyps [20]. A method was presented to detect mucosal polyps [21]. The method used edge detection techniques following by Hough transform to extract shape features and then the extracted texture features. The extracted features were provided for a Cascade Adaboost to classify the frames. The results showed a sensitivity of 91% and a specificity of 95%. As mentioned, the available methods for detection of polyp region in the WCE frames are based on edge detection from grayscale image. This causes a huge disadvantage for this method as changes in contrast and signal to noise can affect the results easily. If the contrast between polyps and normal tissues cannot be noticed, it will lead to misdetection of the region. However, as the previous studies have shown, using texture and color information would be enough to find the Fig. 1. Wireless capsule endoscopy made by Given Imaging [19]. frames containing the polyps but not to segment the region. To avoid this, we can use a consistent property of the tissue which is the color information, the RGB color space or the HSV color space. The main contribution of this study is to show the superpixel application for segmentation of polyps in the WCE frames following by classifying the superpixels. Having an accurate method for segmentation of diseases will lead to the more accurate detection of frames having these abnormalities region. We propose and evaluate a method to segment the polyp regions. Then, we extract some texture and color features and feed these features to an SVM to classify the regions. II. M ETHODS A. SLIC Superpixel Segmentation Segmentation has played a great role in different applciations [22]. Superpixel contracts and groups uniform pixels in an image and it has been widely used in many computer vision for segmentation, object recognition, and tracking objects in videos. The superpixel concept was presented as defining the perceptually uniform regions using the normalized cuts (NCuts) algorithm. [23], [24]. Here, we use simple linear iterative clustering (SLIC) superpixel segmentation on different color images [25]. The key parameter for SLIC is the size of superpixel. First, N centers are defined as cluster centers. Then, to avoid keeping the center to be on the edge of an object, the center is transferred to the lowest gradient position in a 3 × 3 neighborhood. The next step is clustering, as each of the pixels is associated with the nearest cluster center based on color information. It means that two coordinate components (x and y) depict the location of the segment and three components (for example in the RGB color space, R, G, and B) are derived from color channels. SLIC tries to minimize a distance (a Euclidean distance in 5D space) function is defined as follow [3]: q Dc = (Rj − Ri )2 + (Gj − Gi )2 + (Bj − Bi )2 , (1) q Dp = (xj − xi )2 + (yj − yi )2 , (2) s Dc Dp 2 D = ( )2 + ( ) . (3) Nc Np where Nc and Np are respectively maximum distances within a cluster used to normalized the color and spatial proximity. It should be said that SLIC is not letting the region grows more than twice of cluster radius; therefore, SLIC size plays an important role on how the segmentation is performed. Fig. 2. SLIC superpixel segmented regions for a sample frame. A, b, c, d, e, f, g, and h are respectively original frame, manual outlined region for polyp, SLIC by 25, 50, 100, 200, 400, and 800. The calculated GRILBP was mapped into a histogram having 32 bins providing 32 features for a classifier. • A total of 18 Haralick features using gray level cooccurrence matrix (GLCM) were extracted from each of the generated GRILBP results, grayscale image, red, green, blue, and hue channels [12]. These features are included autocorrelation, cluster prominence, energy, cluster shade, dissimilarity, contrast, entropy, homogeneity, maximum probability, correlation, the sum of variance squares, sum average, sum variance, sum entropy, difference variance, difference entropy, information measure of correlation and inverse difference momentum. Therefore, 108 features were extracted using the Haralick features. • In addition to the Haralick features, statistical features including Mean, Variance, Skewness, and Kurtosis were extracted from the same six images mentioned above. In total, 164 features were extracted to feed an SVM to classify the superpixels to two classes: normal and polyp. The SVM used least square as a statistic measure and Gaussian radial basis function as training kernel. The steps are summarized in Fig. 3. III. R ESULTS 43 frames containing polyps from 5 patients were used in this study. Each of the frames was captured by an 8-bit color depth and the resolution 576 × 576. The polyp region in the frames was manually outlined. To evaluate the SLIC superpixel for detection of polyps in the WCE frames, SLIC was applied on the frame by 6 different sizes: 25, 50, 100, 200, 400, and 800. The maximum size of SLIC is coming from the fact the minimum polyp size was 150 pixels. As a number of pixels after creating superpixels by SLIC can be up to twice of the initial size [25], the following B. Features and Classifier The following features were extracted from the generated superpixels: • Grayscale and rotation invariant local binary pattern (GRILBP) was calculated for blocks of 3 × 3 pixels [26]. Fig. 3. The flowchart sumerizing the steps. TABLE I T HE FRAME BASED RESULTS FOR 16 POLYP AND 21 NORMAL FRAMES ( THE CONFUSION MATRIX ). Predicted as Polyp Predicted as Normal Polyp Frames 15 1 Normal Frames 2 19 our database and the results are shown in TABLE I. Fig. 4. Four measurements are graphed for different SLIC superpixel numbers. The sensitivity, specificity, accuracy, and precision are in red, blue, green, and purple, respectively. calculation helps us to find the maximum required superpixel size for detection of a region by 150 pixels: M aximum required SLIC size = (576 ∗ 576)/(2 ∗ 150) (4) Fig. 2 shows how the SLIC superpixel size can affect on segmentation of regions. The segmented region using the proposed method was compared with a manual outlined region of the frame. Sensitivity, specificity, accuracy, and precision are measured to do this comparison [15]. The results are graphed in Fig. 2 and quantified in Fig. 4. By evaluating the segmentation of polyps using SLIC method, it was noticed that superpixels could segment the polyp region very accurate; therefore, the remained question was how accurate the superpixels can be classified into the polyps and normal region. Therefore, the 164 features were extracted and normalized between 0 and 1. The normalized features were fed to the SVM. Three patients were randomly selected which created 27 frames for the training of SVM. The other 16 frames from two patients were used to test the classification. The outcome of SVM was evaluated based on two aspects: frame and pixel-based detection. Pixel-based detection evaluation reported the results considering how accurate the superpixels were classified as polyps and normal and the frame based detection considered a frame as polyp if there was just one superpixel in that frame classified as a polyp. The pixel-based evaluation was performed just for the frames having polyps (16 frames assigned for SVM testing) and the results are illustrated in Fig. 5. As seen in Fig. 5, the measures reached to peak after 100 superpixels and dropped dramatically after 200 superpixels. A possible reason can be the fact that when the number of superpixels is getting higher, the texture information might reduce. This limit has been seen after 200 superpixels in this study; therefore, the optimum number of superpixel can be considered as 100 as it reached the peak and generating 100 superpixels is faster than 200. Therefore, we used 100 superpixels for the frame based evaluation. In addition, to have balanced classification frame numbers, 21 frames containing normal regions were added to IV. C ONCLUSION The possibility of polyps segmentation in the WCE frames was evaluated using SLIC superpixel method. The SLIC superpixel was applied on the frame with different sizes to study the effect of SLIC size for the segmentation. By increasing the size of SLIC superpixel, the four measures increased as expected because it is getting closer to pixel segmentation. It can be seen in Fig. 4 that the four measures, sensitivity, specificity, accuracy, and precision, were higher than 98%. This gave us the possibility to detect the polyp regions very accurate; therefore, texture and color features were extracted, and then, an SVM classifier was utilized to differentiate between polyp and normal regions. The outcome of the classifier was evaluated in two ways: frame and pixel-based detection. The pixel-based method results are illustrated in Fig. 5; the results show that the sensitivity, specificity, and accuracy were increasing then decreasing by growing the number of superpixels. These measures remained almost constant after 100 superpixels and dropped after 200. Therefore, 100 superpixels were considered as an optimum number of superpixels and the frame based aspect was studied for 100 superpixels; the frame based detection results showed a sensitivity of 93.75%; the detail can be found in TABLE I. Compared to the available frame based methods for detection of polyps, the sensitivity was reported 93% [18], our results indicated 0.75% higher in sensitivity. Our method also met the same detection rate for pixel-based detection. This results could have been predicted because the superpixel segmentation was so accurate as seen in Fig. 4. The accurate segmentation following by feature extraction and a good classifier lead to high accurate result for classification seen in Fig 5. We will try to merge the superpixels with more efficient methods that might improve the results we presented here. That being said that the geometry features were not used in our study; by merging the superpixels, we might be able to use these types of features which can improve the detection rate. Deep learning [27], [28] can be used to improve the classification and feature extraction process. V. ACKNOWLEDGEMENTS We have been grateful for getting help from Dr. Hossein Asl Soleimani. Fig. 5. The pixel-based results after using SVM. The sensitivity, specificity, and accuracy are in red, blue, green, and purple, respectively. The error bars show the measures standard deviation between the testing frames. R EFERENCES [1] B. Li, M. Q.-H. Meng, and J. Y. Lau, “Computer-aided small bowel tumor detection for capsule endoscopy,” Artificial Intelligence in Medicine, vol. 52, no. 1, pp. 11–16, 2011. [2] R. Penjweini, S. Deville, O. Haji Maghsoudi, K. Notelaers, A. Ethirajan, and M. Ameloot, “Investigating the effect of poly-l-lactic acid nanoparticles carrying hypericin on the flow-biased diffusive motion of hela cell organelles,” Journal of Pharmacy and Pharmacology, 2017. [3] O. Haji Maghsoudi, A. V. Tabrizi, B. Robertson, and A. Spence, “Superpixels based marker tracking vs. hue thresholding in rodent biomechanics application,” in The 51st Asilomar Conference on Signals, Systems and Computers. IEEE, 2017. [4] O. H. Maghsoudi, A. V. Tabrizi, B. Robertson, P. Shamble, and A. J. Spence”, “A rodent paw tracker using support vector machine,” Signal Processing in Medicine and Biology Symposium (SPMB), pp. 1–2, 2016. [5] T. Pire, T. Fischer, J. Civera, P. De Cristóforis, and J. J. Berlles, “Stereo parallel tracking and mapping for robot localization,” in Intelligent Robots and Systems (IROS), 2015 IEEE/RSJ International Conference on. IEEE, 2015, pp. 1373–1378. [6] M. Alizadeh, H. S. Zadeh, and O. H. Maghsoudi, “Segmentation of small bowel tumors in wireless capsule endoscopy using level set method,” in Computer-Based Medical Systems (CBMS), 2014 IEEE 27th International Symposium on. IEEE, 2014, pp. 562–563. [7] D. J. Barbosa, J. Ramos, and C. S. Lima, “Detection of small bowel tumors in capsule endoscopy frames using texture analysis based on the discrete wavelet transform,” Engineering in Medicine and Biology Society, 2008. EMBS 2008. 30th Annual International Conference of the IEEE, pp. 3012–3015, 2008. [8] A. Mahdi, H. Omid, S. Kaveh, R. Hamid, K. Alireza, and T. Alireza, “Detection of small bowel tumor in wireless capsule endoscopy images using an adaptive neuro-fuzzy inference system.” Journal of biomedical research, 2017. [9] P. Guobing, X. Fang, and C. Jiaoliao, “A novel algorithm for color similarity measurement and the application for bleeding detection in wce,” International Journal of Image, Graphics and Signal Processing, vol. 3, no. 5, p. 1, 2011. [10] G. Pan, G. Yan, X. Qiu, and J. Cui, “Bleeding detection in wireless capsule endoscopy based on probabilistic neural network,” Journal of medical systems, vol. 35, no. 6, pp. 1477–1484, 2011. [11] B. Li and M. Q.-H. Meng, “Computer-aided detection of bleeding regions for capsule endoscopy images,” IEEE Transactions on Biomedical Engineering, vol. 56, no. 4, pp. 1032–1039, 2009. [12] O. H. Maghsoudi, M. Alizadeh, and M. Mirmomen, “A computer aided method to detect bleeding, tumor, and diseases regions in wireless capsule endoscopy,” Signal Processing in Medicine and Biology Symposium (SPMB), pp. 1–6, 2016. [13] F. Argüelles-Arias, J. Rodrı́guez-Oballe, C. Duarte-Chang, L. CastroLaria, J. M. Garcı́a-Montes, Á. Caunedo-Álvarez, and J. M. Herrerı́asGutiérrez, “Capsule endoscopy in the small bowel crohns disease,” Gastroenterology research and practice, vol. 2014, 2014. [14] R. Kumar, Q. Zhao, S. Seshamani, G. Mullin, G. Hager, and T. Dassopoulos, “Assessment of crohns disease lesions in wireless capsule [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] endoscopy images,” IEEE Transactions on biomedical engineering, vol. 59, no. 2, pp. 355–362, 2012. O. HajiMaghsoudi, A. Talebpour, H. Soltanian-zadeh, and H. A. Soleimani, “Automatic informative tissue’s discriminators in wce,” Imaging Systems and Techniques (IST), 2012 IEEE International Conference on, pp. 18–23, 2012. J. Lee, J. Oh, S. K. Shah, X. Yuan, and S. J. Tang, “Automatic classification of digestive organs in wireless capsule endoscopy videos,” in Proceedings of the 2007 ACM symposium on Applied computing. ACM, 2007, pp. 1041–1045. O. Haji-Maghsoudi, A. Talebpour, H. Soltanian-Zadeh, and N. Hajimaghsoodi, “Automatic organs’ detection in wce,” in Artificial Intelligence and Signal Processing (AISP), 2012 16th CSI International Symposium on. IEEE, 2012, pp. 116–121. Y. Yuan, B. Li, and M. Q.-H. Meng, “Improved bag of feature for automatic polyp detection in wireless capsule endoscopy images,” IEEE Transactions on Automation Science and Engineering, vol. 13, no. 2, pp. 529–535, 2016. “Pillcam given imaging,” http://www.givenimaging.com/en-int/ Innovative-Solutions/Capsule-Endoscopy/Pillcam-SB/PillCam-SB-3/ Pages/default.aspx, accessed: 2017-08-21. A. Karargyris and N. Bourbakis, “Detection of small bowel polyps and ulcers in wireless capsule endoscopy videos,” IEEE transactions on BioMedical Engineering, vol. 58, no. 10, pp. 2777–2786, 2011. J. Silva, A. Histace, O. Romain, X. Dray, and B. Granado, “Toward embedded detection of polyps in wce images for early diagnosis of colorectal cancer,” International Journal of Computer Assisted Radiology and Surgery, vol. 9, no. 2, pp. 283–293, 2014. S. Minaee and Y. Wang, “Screen content image segmentation using robust regression and sparse decomposition,” IEEE Journal on Emerging and Selected Topics in Circuits and Systems, vol. 6, no. 4, pp. 573–584, 2016. Z. Li, X. M. Wu, and S. F. Chang, “Segmentation using superpix- els: A bipartite graph partitioning approach,” in Proc. IEEE CVPR, p. 789796, 2012. A. Levinshtein, A. Stere, K. Kutulakos, D. Fleet, S. Dickinson, and K. Siddiqi, “Turbopixels: Fast superpixels using geometric flows,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 31, p. 22902297, 2009. R. Achanta, A. Shaji, A. Lucchi, P. Fua, and S. Susstrunk, “Slic superpixels compared to state-of-the-art superpixel methods,” IEEE Trans. Pattern Anal. Mach. Intell., vol. 34, pp. 2274–2281, 2012. T. Ojala, M. Pietikäinen, and T. Mäenpää, “Gray scale and rotation invariant texture classification with local binary patterns,” in European Conference on Computer Vision. Springer, 2000, pp. 404–420. S. Minaee and Y. Wang, “Palmprint recognition using deep scattering convolutional network,” arXiv preprint arXiv:1603.09027, 2016. S. Minaee, A. Abdolrashidiy, and Y. Wang, “An experimental study of deep convolutional features for iris recognition,” in Signal Processing in Medicine and Biology Symposium (SPMB), 2016 IEEE. IEEE, 2016, pp. 1–6.
1cs.CV
Scrum for Cyber-Physical Systems: A Process Proposal Stefan Wagner University of Stuttgart Institute for Software Technology Stuttgart, Germany arXiv:1703.06712v1 [cs.SE] 20 Mar 2017 [email protected] ABSTRACT 1. Agile development processes and especially Scrum are changing the state of the practice in software development. Many companies in the classical IT sector have adopted them to successfully tackle various challenges from the rapidly changing environments and increasingly complex software systems. Companies developing software for embedded or cyber-physical systems, however, are still hesitant to adopt such processes. Despite successful applications of Scrum and other agile methods for cyber-physical systems, there is still no complete process that maps their specific challenges to practices in Scrum. We propose to fill this gap by treating all design artefacts in such a development in the same way: In software development, the final design is already the product, in hardware and mechanics it is the starting point of production. We sketch the Scrum extension Scrum CPS by showing how Scrum could be used to develop all design artefacts for a cyber physical system. Hardware and mechanical parts that might not be available yet are simulated. With this approach, we can directly and iteratively build the final software and produce detailed models for the hardware and mechanics production in parallel. We plan to further detail Scrum CPS and apply it first in a series of student projects to gather more experience before testing it in an industrial case study. Embedded software systems, mobile and desktop applications as well as Internet and cloud systems are converging into large, complex and distributed systems that interact with the real world via sensors and actuators. For this new kind of systems, the term cyber-physical systems has been coined. “Cyber-physical systems (CPS) are physical and engineered systems whose operations are monitored, coordinated, controlled and integrated by a computing and communication core.” [7] Building these complex systems is still a challenge. For example, good software engineering processes are essential to get reliable CPS [5]. In the classical information system development, agile approaches have gained a large acceptance and provide many advantages beyond traditional approaches. Even for embedded software, agile development is more and more accepted. Salo and Abrahmsson [9] conclude from a survey with European embedded software development organisations that “The results also indicate that the appreciation of the agile methods and their individual practices appears to increase once adopted and applied in practice.” Categories and Subject Descriptors K.6.3 [Management of Computing and Information Systems]: System Management; D.2.9 [Software Engineering]: Management—Software process models General Terms Management, Standardization 1.1 INTRODUCTION Problem Statement Yet, outside of software development, agile development process are not widely used. “Agile system engineering practices have matured for software projects while hardware system engineering continues to embrace classical development techniques.” [4] A general barrier for using agile methods for hardware development is the higher difficulty in modifying hardware. In addition, there is no clearly defined, detailed description how Scrum should be used for hardware development and how the integration with software development should work which is essential for CPS. Lee [5] describes challenges and research directions in cyber-physical systems and proposes, among others, to “Rethink the hardware/software split”. Keywords Scrum, Agile, Cyber-physical c ACM. This is the author’s version of the work. It is posted here for your personal use. Not for redistribution. The definitive Version of Record was published in Proceedings of the 1st International Workshop on Rapid Continuous Software Engineering, https://doi.org/10.1145/2593812.2593819. 1.2 Research Objectives We have the general goal to provide a clearly described, detailed and applicable Scrum variation for CPS development called Scrum CPS together with empirical evidence that it works for developing such systems. Scrum CPS shall give concrete guidelines how to build all parts of a CPS and ensure their integration. In this paper, we aim to provide a first sketch of Scrum CPS for further discussions. 1.3 Contribution This paper is only a first step to reach our objectives. We proposes a first draft of Scrum CPS based on a discussion of CPS challenges and existing work. Its innovation is the explicit handling of concurrent hardware and software development and a concentration on building explicit design models for hardware components that can be simulated together with the development to enable early software- and hardware-in-the-loop tests. 2. RELATED WORK The original way to manage more than one Scrum team working on the same product is the Scrum of Scrums [8]. It is an additional Scrum on top of the other teams composed of members of each of these teams. They are chosen in a way so that they can best discuss the inter-team dependencies. This approach, however, does not prescribe any common and fixed synchronisation points which are necessary for the complex interplay of different hardware/software components in an CPS. Leffingwell [6] introduces the concept of an Agile Release Train (ART) as a metaphor for synchronising agile teams. In certain intervals (cadence) the Scrum teams working in parallel have to put their increments on the release train to create a (potential) release. These intervals comprise several sprints. A team can also decide to put no new features on the train and only adapt their interfaces to the changes made by other teams and their features and components. We see this as a good fit to the diverse components needed to be developed for a CPS and employ the ART in our proposed process. Xie et al. [12] describe a preliminary systematic review on empirical studies of the use of agile methods in embedded software development. They describe relevant characteristics of embedded software development such as hardware dependence or specific development environments. We take these characteristics and discussed responses into account but the review is rather brief. Shen et al. [10] provide a more comprehensive systematic review on agile in embedded software development. They give a good overview on the literature describing the experiences so far. They conclude that the state of theory as well as “research on applying agile methods to embedded software development is distinctly not mature |. . . ]”. We describe a theoretical proposal in this paper which we plan to flesh out in more detail and then empirically evaluate in future projects. Srinivasan, Dobrin and Lundqvist [11] also describe the state of the art in agile for embedded systems development. They concentrate more on the organisational change aspect of introducing such methods while we propose a concrete process. Similarly, Cawley, Wang and Richardson [2] discuss the state of the art in using lean and agile methods in regulated, safety-critical systems. They conclude that corresponding standards can be mapped to agile practices although not always satisfactorily. Further issues are discussed, for example that refactoring can invalidate earlier certification. They state that “It would be useful to look at the governance of Lean/Agile software development in these domains with a view to identifying how to design policies and product lifecy- cles [. . . ]”. W react to this challenge with an explicit process variation for safety-critical systems. Huang, Darrin and Knuth [4] describe positive experiences with using Scrum and XP practices in systems engineering for satellite development. They stress that development phases had to change but describe not in detail how different Scrums are used to achieve this. They give, for example, the closeness to the sponsors as a positive effect of agile system engineering. Cordeiro et al. [3] give the most detailed agile methodology for developing embedded software. They use some practices of XP and Scrum to achieve a highly iterative process. We will build on their work, concentrate on clear guidelines for applying Scrum and extend it to CPS. 3. SCRUM CPS We propose the Scrum variation called Scrum CPS as a clearly described and defined process for the agile development of cyber-physical systems. To address the real needs in developing CPS, we first look at the challenges posed by CPS development onto the development process. We summarise the major challenges with our proposed solutions in Tab. 1. The central idea of the Scrum CPS process is sketched in Fig. 1. We designate a sprint either as design sprint or hardware sprint. The initial sprints are always design sprints starting with central parts of the architecture of the CPS. As software is design and product at the same time, we can already build operational software. This software is developed and tested together with hardware simulations from design models we build in parallel. The produced hardware designs (together with potentially other items from the product backlog) become part of the sprint backlog for the subsequent hardware sprint. The hardware sprint refines and extends the design models and builds the actual hardware. First we produce prototypes and later the blueprints for the final hardware. At the end of the hardware sprints, we get potentially shippable product increments as well as modifications for the product backlog which can then be introduced into design sprints. A product increment is then really a combination of software and hardware that could be given to a user – although the hardware might still be crude, it would be useable. To ensure that these different sprints are synchronised and produce a coherent CPS, we adopt the ida of an Agile Release Train (ART) from [6] as shown in Fig. 2. The whole execution of the process is structured into cascades with a potential release at the end. Before each release, there can be several sprints by each team. Yet, any team knows that they have to deliver something for the release. In the worst case, they will deliver the last version with possibly adapted interfaces only. In the following, we discuss the two types of sprints in more detail and propose variations depending on the concrete application area of the CPS. 3.1 Design Sprints Design sprints are responsible for the system design. They produce designs for hardware and software components. While for hardware this means an executable description of an abstraction of the future hardware, the design for software is the software itself. We often differentiate in software engineering between design and implementation. Design then contains architecture descriptions with the proposed decom- Daily Scrum Design Sprint Planning Design Sprint Backlog Design Sprint Retrospective Product Backlog Design Sprint Execution Design Sprint Review Potentially shipable software increment and hardware design Hardware Sprint Planning e.g. Hardware NFA Hardware Design Hardware Sprint Backlog Hardware Sprint Retrospective Hardware Sprint Review Potentially shipable product increment Hardware Sprint Execution Daily Scrum Figure 1: An overview of the Scrum CPS process Product Backlog Potential Release automatic, and synthesis is automated using a free tool chain.” This then produces a suitable basis for the sprint backlog of further design sprints as well as hardware sprints. Further challenges, we have not yet explicitly incorporated into the design sprint process are how to handle the complexities of highly networked and real-time components. We will need to work on that in more detail to understand whether it can be addressed by the process itself or if it is a matter of the modelling and development methods used. Figure 2: The Agile Release Train 3.2 position into components or interface descriptions. As in Scrum in general, this will be used and created in Scrum CPS as well where appropriate. Yet, in comparison to hardware, software itself is still a design because there is no manufacturing step in the process. Hence, we can see software itself on the same level as detailed, behavioural hardware designs. This means, we produce workable software together with hardware designs we can simulate and, thereby, “integrate” the software and hardware designs in early design sprints. In some sense, because working software is created first, we could call this software-driven system engineering. Using software and hardware designs, we can – fitting to usual agile ways of development – test from the first sprint on using software-in-the-loop tests. The hardware could be designed, for example, with the rapid hardware definition language (Rapid HDL) as proposed in [1]. It allows to script hardware using “reusable software objects, communication between hardware and software is Hardware Sprints The result of the design sprints are “only” design models we can simulate. This is already a very good basis for further hardware development as the models show how hardware and software will need to interact. Yet, there are many more detailed decisions to be made in hardware development. This depends to a large degree on what kind of hardware we need to build. It also might make sense to structure the hardware development into separate Scrum teams working on electrics, electronics and mechanics, for example. Based on the design models and further detailing, the hardware engineers build prototypes which show certain aspects of the future hardware. This includes laying out the hardware designs and creating a bill of materials. Then we order the prototypes or assemble them ourselves. Programmable logical devices can play the role of quickly adaptable hardware. This was, for example, already recognised in the development of the first Macintosh at Apple: “Burrell Smith developed a unique hardware design style based on programmable array logic chips (PAL chips), which enabled him to make changes much faster than traditional techniques allowed, almost with Table 1: Major Process Challenges and Solutions in Scrum CPS (adapted and extended from [7]) Software/ CPS consist potentially of new softhardware ware, electrical, electronic and mechanco-design ical components. They all need their own timelines for development but need to be synchronised. We use the Agile Release Train as method to structure the different Scrum teams. In addition, we define always a major design team which initially and regularly looks at the overall CPS architecture. Robustness, safety, security Early and comprehensive design using software directly as well as design models that we can simulate help to detect quality problems early in software- and hardware-in-the-loop tests. Architecture By using detailed design models together with simulations we build early consistent and global architectures. Bringing the design models into the sprint backlog of hardware sprints, we ensure that all components reflect this architecture. Real-time Again, the early design models can reabstrac- veal bottlenecks and problems with realtions time constraints. In addition, the possibility of early prototypes and hardwarein-the-loop tests can be used to assure such constraints. Sensor and mobile networks CPS emphasise the connectedness of many quite different components. To some degree, the availability of models for simulations and in-the-loop tests helps to test these aspects. In addition, the Agile Release Train ensures compatible interfaces between components connected via networks. Model- For everything but software directly, based Scrum CPS demands model-based dedevelop- velopment. We always build models ment we can simulate together for all components including the created software. Verification, validation, certification Scrum CPS enforces an early verification and allows the developers to regularly and comparably early validate the system with stakeholders. Certification is more problematic and needs a mapping of the applicable standard to Scrum CPS. the fluidity of software.”1 Hence, we can now test important aspects to refine the hardware designs and add additional or changed items to the product backlog so they can be worked on in the next design sprints. Depending on the nature of the prototypes, we aim to run hardware-in-the-loop tests with the prototypes and the existing software from the design sprints. As soon as any hardware prototypes are available, the sprint will contain inspections, such as visual inspections, multi-meter checks and turn-on tests. Based on these inspections and tests, we probably need to debug the prototype. This will lead to changes in the design for the design sprints. After several hardware sprints and a synchronisation with the design sprints that the design is stable, we will take the final steps to mass produce the hardware. 3.3 Variations In the following, we will discuss some potential variations of Scrum CPS depending on the nature of the components of the system. 3.3.1 Safety-Critical Components In many cases, because of the close connection to the physical world, at least parts of an CPS are safety-critical. Safety-critical means here that the component can create hazards for the system environment that can lead to accidents harming people or with other catastrophic consequences. These components and the system containing these components need to be developed with special care to avoid these consequences. In particular, the development organisation needs to follow applicable standards for the corresponding domain of the component. For electronic and software components, the IEC 61508 needs to be followed. Certain domains have created specific standards, such as the ISO 26262 for such components in automotive systems. Those standards usually prescribe various aspects of the process, sometimes also specific methods and product properties. Depending on the standard, we might need to modify Scrum CPS to conform with it. Some aspects are easy to achieve or at least not more difficult in a Scrum setting. For example, MC/DC test coverage or traceability links from requirements to code is often required for higher safety integrity levels. These would be good candidates for inclusion into the definition of done of a sprint. 3.3.2 New Cloud Components In the design sprints, we assumed so far that we only build design models for the hardware components but build the concrete software components as in the final product. A variation could be used for the more cloud-dependent parts of the CPS. Maybe the cloud part is not yet available or we do not want to reveal it yet. Then it might be acceptable to only build a simulation of the cloud service. 3.3.3 Hardware Design Language Scrum CPS assumes that the hardware design is always an executable simulation. Scrum CPS does not prescribe what modelling language should be used for the simulation. This could simply be the programming language used to build the other, productive software over general purpose modelling languages, such as SysML with corresponding 1 http://www.folklore.org/StoryView.py?project= Macintosh&story=The_Macintosh_Spirit.txt tools, to specialised modelling languages and tools, such as Matlab Simulink and Stateflow. This might change the process and when and how it is able to run software- and hardware-in-the-loop tests. 4. EXAMPLE: FITNESS TRACKING To make the process proposal more concrete, we apply it to a hypothetical fitness tracking CPS. The purpose of the system is to track the movements of a person and to give feedback to motivate her or him to exercise more. The system consists of a smart wristlet with sensors, actuators and a small screen, a smartphone app on a modern smartphone and a cloud service with a corresponding web interface. This structure is shown in Fig. 3. Smartphone App Smart wristlet Cloud & Web Interface Figure 3: Overview of the Fitness Tracking CPS The wristlet tracks the movements of the person, connects via Bluetooth to the smartphone for syncing the movement data and shows a movement score. With the synced information, it also vibrates when more movement is needed, and it suggests activity via the small screen. The smartphone app connects to the cloud service via Internet. The cloud service captures all the movement data and personal configurations. It also allows social functions such as comparing one’s results with those of friends. We chose this example because it is a well-known type of system and it contains only a small portion of hardware development. This limits the representativeness of the examples but allows a more thorough discussion. We assume we only have to develop the wristlet hardware. All smartphone and server hardware is standard. Following Scrum CPS, we start with creating a product backlog. We cannot go into details of the backlog but discuss some examples. In general, the above mentioned vision should be adequately represented. Example backlog items will be more general, design-oriented, such as “As a user, I want to be able to see my movement data in numerical and diagrammatical form on my smartphone.”, as well as more concrete software or hardware related items, such as “As a user, I want to be able to connect my wristlet to my smartphone.” Let us assume we have two teams of about 10 people available to build our CPS. As we have hardware development involved, we go for a 90-days cadence with 30-days sprints. Next, we plan the first sprints which will be design sprints for both teams. As the biggest innovation and value for the product owner will be in the wristlet itself, one team starts with a design sprint for it. This fits also to the expectation that there will be more hardware sprints needed to develop the wristlet. An early concentration on its design helps to avoid waiting for the hardware later. The other team chooses the second highest area of value: the smartphone app. Both teams select the corresponding backlog item for their sprint backlogs and start the sprint executions. In the executions, we follow the regular Scrum practices like Daily Scrums. We build the hardware design as CAD models and in Rapid HDL. In parallel, we start with implementing the first stories in software to be run on the hardware to be developed and the smartphone. We close the sprint with software-in-the-loop tests. In the next sprint planning, we decide to continue with design sprints for both teams as we have several more designrelated backlog items for the wristlet. We select them into the sprint backlog for one team and smartphone app items in the backlog for the other team. We execute the sprint as above but decide after the tests that the hardware design is ready to be built as a prototype. Hence, in the following sprints, we have one hardware sprint for the wristlet and a design (software) sprint for the smartphone app. In the hardware sprint, we build up the first hardware prototype and improve it while running the existing software on it. In the design sprint, we extend and improve the corresponding software. We can now run also hardware-in-the-loop tests to assure the quality of the product increment. Both sprints also are allowed to give feedback for changing the product backlog based on the experiences of the sprint. After these three sprints, we have reached our first synchronisation point where each team has to put its cargo onto the release train. This means, we have a first version of the CPS we can show to (potential) customers or marketing and get feedback. As we still have prototype hardware, we will not make a full release out of it, however. In the next sprints, we extend the system sprint by sprint by the smartphone app and the cloud service. In the hardware sprints, we iteratively improve the hardware and finally give it to a full assembly. The last sprints implement the last missing backlog items and concentrate on system testing the whole CPS. 5. CONCLUSIONS In this paper, we have proposed a variation of Scrum called Scrum CPS for a clear definition of how to use Scrum for developing cyber-physical systems to gain all the benefits that agile development has to offer for software-only developments. There is a series of challenges in CPS in general and several of them also influence the needed contents of a corresponding development process. We have briefly discussed these challenges and mapped them to our process proposal. Using a hypothetical example of a fitness tracker CPS, we discussed the application of the process. This brief sketch can only be a start. We are in the process of further detailing Scrum CPS to make it usable in real CPS projects. Using this description, we plan to work with other research groups in electrical and mechanical engineering to apply Scrum CPS in student projects. We will closely monitor these projects to better understand its benefits and problems to further improve it. With the improved process description, we aim to run case studies in industry for further validate the approach. 6. ACKNOWLEDGEMENTS I would like to thank Jan-Peter Ostberg who gave valuable feedback on a first draft of this paper. 7. REFERENCES [1] J. N. Allen, H. S. Abdel-Aty-Zohdy, and R. L. Ewing. Agile hardware development with rapid hardware definition language. In 2009 IEEE International Conference on Electro/Information Technology (EIT’09), pages 383–388. IEEE, 2009. [2] O. Cawley, X. Wang, and I. Richardson. Lean/agile software development methodologies in regulated environments – state of the art. In Proc. Lean Enterprise Software and Systems, volume 65 of LNBIP, pages 31–36. Springer, 2010. [3] L. Cordeiro, C. Mar, E. Valentin, F. Cruz, D. Patrick, R. Barreto, and V. Lucena. An agile development methodology applied to embedded control software under stringent hardware constraints. In ACM SIGSOFT Software Engineering Notes, page 5. ACM, 2008. [4] P. M. Huang, A. G. Darrin, and A. A. Knuth. Agile hardware and software system engineering for innovation. In Proc. 2012 IEEE Aerospace Conference, pages 1–10. IEEE, 2012. [5] E. A. Lee. Cyber-physical systems-are computing foundations adequate. In Proc. NSF Workshop on Cyber-Physical Systems, 2006. [6] D. Leffingwell. Agile Software Requirements. Lean Requirements Practices for Teams. Programs, and the Enterprise. Addison-Wessley, 2011. [7] R. R. Rajkumar, I. Lee, L. Sha, and J. Stankovic. Cyber-physical systems: the next computing revolution. In Proc. 47th Design Automation Conference, pages 731–736. ACM, 2010. [8] K. Rubin. Essential Scrum. A Practical Guide to the Most Popular Agile Process. Addison-Wessley, 2013. [9] O. Salo and P. Abrahamsson. Agile methods in european embedded software development organisations: a survey on the actual use and usefulness of extreme programming and scrum. IET Software, 2(1):58–64, 2008. [10] M. Shen, W. Yang, G. Rong, and D. Shao. Applying agile methods to embedded software development: A systematic review. In Proc. 2nd International Workshop on Software Engineering for Embedded Systems (SEES), pages 30–36. IEEE, 2012. [11] J. Srinivasan and R. Dobrin. ’state of the art’ in using agile methods for embedded systems development. In Proc. 33rd Annual IEEE Computer Software and Applications Conference (COMPSAC’09), pages 522–527. IEEE, 2009. [12] M. Xie, M. Shen, G. Rong, and D. Shao. Empirical studies of embedded software development using agile methods: a systematic review. In Proc. 2nd International Workshop on Evidential Assessment of Software Technologies (EAST 2012), pages 21–26. ACM, 2012.
3cs.SY
On The Hardness of Approximate and Exact (Bichromatic) Maximum Inner Product arXiv:1802.02325v2 [cs.CC] 6 Mar 2018 Lijie Chen∗ MIT Abstract In this paper we study the (Bichromatic) Maximum Inner Product Problem (Max-IP), in which we are given sets A and B of vectors, and the goal is to find a ∈ A and b ∈ B maximizing inner product a · b. Max-IP is very basic and serves as the base problem in the recent breakthrough of [Abboud et al., FOCS 2017] on hardness of approximation for polynomial-time problems. It is also used (implicitly) in the argument for hardness of exact ℓ2 -Furthest Pair (and other important problems in computational geometry) in poly-log-log dimensions in [Williams, SODA 2018]. We have three main results regarding this problem. • Characterization of Multiplicative Approximation. First, we study the best multiplicative approximation ratio for Boolean Max-IP in sub-quadratic time. We show that, for Max-IP with two Ω(1) sets of n vectors from {0, 1}d, there is an n2−Ω(1) time (d/ log n) -multiplicative-approximating algorithm, and we show this is conditionally optimal, as such a (d/ log n)o(1) -approximating algorithm would refute SETH. • Characterization of Additive Approximation.Second, we achieve a similar characterization for the best additive approximation error to Boolean Max-IP. We show that, for Max-IP with two sets of n vectors from {0, 1}d, there is an n2−Ω(1) time Ω(d)-additive-approximating algorithm, and this is conditionally optimal, as such an o(d)-approximating algorithm would refute SETH [Rubinstein, STOC 2018]. ∗ • 2O(log n) -dimensional Hardness for Exact Max-IP Over The Integers. Last, we revisit the hardness of solving Max-IP exactly for vectors with integer entries. We show that, under SETH, ∗ for Max-IP with sets of n vectors from Zd for some d = 2O(log n) , every exact algorithm requires n2−o(1) time. With the reduction from [Williams, SODA 2018], it follows that ℓ2 -Furthest Pair ∗ and Bichromatic ℓ2 -Closest Pair in 2O(log n) dimensions require n2−o(1) time. The lower bound in our first result is a direct corollary of the new MA protocol for Set-Disjointness introduced in [Rubinstein, STOC 2018]. Our algorithms utilize the polynomial method and simple random sampling. Our second result follows from a new dimensionality self reduction from the Orthogonal Vectors problem ∗for n vectors from {0, 1}d to n vectors from Zℓ using Chinese Remainder Theorem, where ℓ = 2O(log d) , dramatically improving the previous reduction in [Williams, SODA 2018]. We also establish a connection between conditional lower bounds for exact Max-IP with integer entries and NP·UPP communication protocols for Set-Disjointness, parallel to the connection between conditional lower bounds for approximating Max-IP and MA communication protocols for Set-Disjointness. Moreover,as a side product, we protocol for Set-Disjointness with com obtain an MA communication p  √ n log n log log n , slightly improving the O n log n bound [Aaronson and Wigderson, plexity O √ TOCT 2009], and approaching the Ω( n) lower bound [Klauck, CCC 2003]. ∗ Email: [email protected]. Supported by an Akamai Fellowship. 1 1 Introduction We study the following fundamental problem from similarity search and statistics, which asks to find the most correlated pair in a dataset: Definition 1.1 (Bichromatic Maximum Inner Product (Max-IP)). For n, d ∈ N, the Max-IPn,d problem is defined as: given two sets A, B of vectors from {0, 1}d compute OPT(A, B) := max a · b. a∈A,b∈B We use Z-Max-IPn,d (R-Max-IPn,d ) to denote the same problem, but with A, B being sets of vectors from Zd (Rd ). Hardness of Approximation Max-IP. A natural brute-force algorithm solves Max-IP in O(n2 · d)-time. Assuming SETH1 , there is no n2−Ω(1) -time algorithm for Max-IPn,d when d = ω(log n) [Wil05]. Despite being one of the most central problems in similarity search and having numerous applications [IM98, AI06, RR+ 07, RG12, SL14, AINR14, AIL+ 15, AR15, NS15, SL15, Val15, AW15, KKK16, APRS16, TG16, CP16, Chr17], until recently it was unclear whether there could be a near-linear-time, 1.1approximating algorithm, before the recent breakthrough of Abboud, Rubinstein and Williams [ARW17] (see [ARW17] for a thorough discussion on the state of affairs on hardness of approximation in P before their work). In [ARW17], a framework for proving inapproximability results for problems in P is established (the distributed PCP framework), from which it follows: 1−o(1) Theorem 1.2 ([ARW17]). Assuming SETH, there is no 2(log n) time algorithm for Max-IPn,no(1) . -multiplicative-approximating n2−Ω(1) - Theorem 1.2 is an exciting breakthrough for hardness of approximation in P, implying other important inapproximability results for a host of problems including Bichromatic LCS Closest Pair Over Permutations, Approximate Regular Expression Matching, and Diameter in Product Metrics [ARW17]. However, we still do not have a complete understanding of the approximation hardness of Max-IP yet. For instance, consider the following two concrete questions: Question 1. Is there a (log n)-multiplicative-approximating n2−Ω(1) -time algorithm for Max-IPn,log2 n ? What about a 2-multiplicative-approximating for Max-IPn,log2 n ? Question 2. Is there a (d/ log n)-additive-approximating n2−Ω(1) -time algorithm for Max-IPn,d ? We note that the lower bound from [ARW17] cannot answer Question 1. Tracing the details of their proofs, one can see that it only shows approximation hardness for dimension d = logω(1) n. Question 2 concerning additive approximation is not addressed at all by [ARW17]. Given the importance of Max-IP, it is interesting to ask: For what ratios r do n2−Ω(1) -time r-approximation algorithms exist for Max-IP? Does the best-possible approximation ratio (in n2−Ω(1) time) relate to the dimensionality, in some way? In an important recent work, Rubinstein [Rub18] improved the distributed PCP construction in a very crucial way, from which one can derive more refined lower bounds on approximating Max-IP. Building on its technique, in this paper we provide full characterizations, determining essentially optimal multiplicative approximations and additive approximations to Max-IP, under SETH. 1 SETH (Strong Exponential Time Hypothesis) states that for every ε > 0 there is a k such that k-SAT cannot be solved in O((2 − ε)n ) time [IP01]. 2 Hardness of Exact Z-Max-IP. Recall that from [Wil05], there is no n2−Ω(1) -time algorithm for exact Boolean Max-IPn,ω(log n) . Since in real life applications of similarity search, one often deals with realvalued data instead of just Boolean data, it is natural to ask about Z-Max-IP (which is certainly a special case of R-Max-IP): what is the maximum d such that Z-Max-IPn,d can be solved exactly in n2−Ω(1) time? Besides being interesting in its own right, there are also reductions from Z-Max-IP to ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair. Hence, lower bounds for Z-Max-IP imply lower bounds for these two famous problems in computational geometry (see [Wil18] for a discussion on this topic). Prior to our work, it was implicitly shown in [Wil18] that: Theorem 1.3 ([Wil18]). Assuming SETH, there is no n2−Ω(1) -time algorithm for Z-Max-IPn,ω((log log n)2 ) with vectors of O(log n)-bit entries. However, the best known algorithm for Z-Max-IP runs in n2−Θ(1/d) time [Mat92, AESW91, Yao82]2 , hence there is still a gap between the lower bound and the best known upper bounds. To confirm these algorithms are in fact optimal, we would like to prove a lower bound with ω(1) dimensions. In this paper, we significantly strength the previous lower bound from ω((log log n)2 ) dimensions to ∗ O(log∗ n) 2 dimensions (2O(log n) is an extremely slow-growing function, see preliminaries for its formal definition). 1.1 Our Results We use OVn,d to denote the Orthogonal Vectors problem: given two sets of vectors A, B each consisting of n vectors from {0, 1}d , determine whether there are a ∈ A and b ∈ B such that a · b = 0.3 Similarly, we use Z-OVn,d to denote the same problem except for that A, B consists of vectors from Zd (which is also called Hopcroft’s problem). All our results are based on the following widely used conjecture about OV: Conjecture 1.4 (Orthogonal Vectors Conjecture (OVC) [Wil05, AVW14]). For every ε > 0, there exists a c ≥ 1 such that OVn,d requires n2−ε time when d = c log n. OVC is a plausible conjecture as it is implied by the popular Strong Exponential Time Hypothesis [IP01, CIP09] on the time complexity of solving k-SAT [Wil05, WY14]. Characterizations of Hardness of Approximate Max-IP The first main result of our paper characterizes when there is a truly sub-quadratic time (n2−Ω(1) time, for some universal constant hidden in the big-Ω) t-multiplicative-approximating algorithm for Max-IP, and characterizes the best-possible additive approximations as well. We begin with formal definitions of these two standard types of approximation: • We say an algorithm A for Max-IPn,d (Z-Max-IPn,d ) is t-multiplicative-approximating, if for all ] ] A, B, A outputs a value OPT(A, B) such that OPT(A, B) ∈ [OPT(A, B), OPT(A, B) · t]. • We say an algorithm A for Max-IPn,d (Z-Max-IPn,d ) is t-additive-approximating, if for all A, B, A ] ] outputs a value OPT(A, B) such that |OPT(A, B) − OPT(A, B)| ≤ t. • To avoid ambiguity, we call an algorithm computing OPT(A, B) exactly an exact algorithm for Max-IPn,d (Z-Max-IPn,d ). 2 [AESW91, Yao82] are for ℓ2 -Furthest Pair or Bichromatic ℓ2 -Closest Pair. They also work for Z-Max-IP as there are reductions from Z-Max-IP to these two problems, see [Wil18] or Lemma 4.5 and Lemma 4.6. 3 Here we use the bichromatic version of OV instead of the monochromatic one for convenience, as they are equivalent. 3 Multiplicative Approximations for Max-IP. In the multiplicative case, our characterization (formally stated below) basically says that there is a t-multiplicative-approximating n2−Ω(1) -time algorithm for Max-IPn,d if and only if t = (d/ log n)Ω(1) . Note that in the following theorem we require d = ω(log n), since in the case of d = O(log n), there are n2−ε -time algorithms for exact Max-IPn,d [AW15, ACW16]. Theorem 1.5. Letting ω(log n) < d < no(1) and t ≥ 2,4 the following holds: 1. There is an n2−Ω(1) -time t-multiplicative-approximating algorithm for Max-IPn,d if t = (d/ log n)Ω(1) , and under SETH (or OVC), there is no n2−Ω(1) -time t-multiplicative-approximating algorithm for Max-IPn,d if t = (d/ log n)o(1) .   log t 2. Moreover, let ε = min , 1 . There are t-multiplicative-approximating deterministic log(d/ log n) algorithms for Max-IPn,d running in time     2+o(1)−0.31· −1 1 0.31 ε + 2 O n = O n2+o(1)−Ω(ε) or time  O n 2−0.17· 1 ε−1 + 0.17 2    · polylog(n) = O n2−Ω(ε) · polylog(n) . Remark 1.6. The first algorithm is slightly faster, but only truly quadratic when ε = Ω(1), while the second algorithm still gets a non-trivial speed up over the brute force algorithm as long as ε = ω(log log n/ log n). We remark here that the above algorithms indeed work for the case where the sets consisting of nonnegative reals (i.e., R+ -Max-IP):   log t o(1) , 1 , there is a tCorollary 1.7. Assuming ω(log n) < d < n and letting ε = min log(d/ log n) multiplicative-approximating deterministic algorithm for R+ -Max-IPn,d running in time   O n2−Ω(ε) · polylog(n) . The lower bound is a direct corollary of the new improved MA protocols for Set-Disjointness from [Rub18], which is based on Algebraic Geometry codes. Together with the framework of [ARW17], that MA-protocol implies a reduction from OV to approximating Max-IP. Our upper bounds are application of the polynomial method [Wil14, AWY15]: defining appropriate sparse polynomials for approximating Max-IP on small groups of vectors, and use fast matrix multiplication to speed up the evaluation of these polynomials on many pairs of points. Via the known reduction from Max-IP to LCS-Pair in [ARW17], we also obtain a more refined lower bound for approximating the LCS Closest Pair problem (defined below). Definition 1.8 (LCS Closest Pair). The LCS-Closest-Pairn,d problem is: given two sets A, B of n strings from Σd (Σ is a finite alphabet), determine max LCS(a, b), a∈A,b∈B where LCS(a, b) is the length of the longest common subsequence of strings a and b. Corollary 1.9 (Improved Inapproximability for LCS-Closest-Pair). Assuming SETH (or OVC), for every t ≥ 2, t-multiplicative-approximating LCS-Closest-Pairn,d requires n2−o(1) time, if d = tω(1) · log5 n. 4 Note that t and d are both functions of n, we assume they are computable in no(1) time throughout this paper for simplicity. 4 √ A Different Approach Based on Approximate Polynomial for OR. Making use of the O( n)-degree approximate polynomial for OR [BCDWZ99, dW08], we also give a completely different proof for the hardness of multiplicative approximation to {−1, 1}-Max-IP.5 Lower bound from that approach is inferior to Theorem 1.5: in particular, it cannot achieve a characterization. √ It is asked in [ARW17] that whether we can make use of the O( n) BQP communication protocol for Set-Disjointness [BCW98] √ to prove conditional lower bounds. Indeed, that quantum communication protocol is based on the O( n)-time quantum query algorithm for OR (Grover’s algorithm [Gro96]), which induces the needed approximate polynomial for OR. Hence, the following theorem in some sense answers their question in the affirmative: Theorem 1.10 (Informal). Assuming SETH (or OVC), there is no n2−Ω(1) time no(1) -multiplicative-approximating algorithm for {−1, 1}-Max-IPn,no(1) . The full statement can be found in Theorem C.1 and Theorem C.2. Additive Approximations for Max-IP. Our characterization for additive approximations to Max-IP says that there is a t-additive-approximating n2−Ω(1) -time algorithm for Max-IPn,d if and only if t = Ω(d). Theorem 1.11. Letting ω(log n) < d < no(1) and 0 ≤ t ≤ d, the following holds: 1. There is an n2−Ω(1) -time t-additive-approximating algorithm for Max-IPn,d if t = Ω(d), and under SETH (or OVC), there is no n2−Ω(1) -time t-additive-approximating algorithm for Max-IPn,d if t = o(d). 2. Moreover, letting ε = t , there is an d   1/3 −1 O n2−Ω(ε / log ε ) time, t-additive-approximating randomized algorithm for Max-IPn,d when ε ≫ log6 log n/ log3 n. The lower bound above is already established in [Rub18], while the upper bound works by reducing the problem to the d = O(log n) case via random-sampling coordinates, and solving the reduced problem via known methods [AW15, ACW16]. Remark 1.12. We want to remark here that the lower bounds for approximating Max-IP are direct corollaries of the new MA protocols for Set-Disjointness in [Rub18]. Our main contribution is providing the complementary upper bounds to show that these lower bounds are indeed tight assuming SETH. All-Pair-Max-IP. Finally, we remark here that our algorithms (with slight adaptions) also work for the following stronger problem6 : All-Pair-Max-IPn,d , in which we are given two sets A and B of n vectors from {0, 1}d , and for each x ∈ A we must compute OPT(x, B) := max x · y. An algorithm is ty∈B multiplicative-approximating (additive-approximating) for All-Pair-Max-IP if for all OPT(x, B)’s, it computes corresponding approximating answers. 5 6 That is, Max-IP with sets A and B being n vectors from {−1, 1}d . Since All-Pair-Max-IP is stronger than Max-IP, lower bounds for Max-IP automatically apply for All-Pair-Max-IP. 5 Corollary 1.13. Suppose ω(log n) < d < no(1) , and let   log t min(t, d) , 1 and εA := . εM := min log(d/ log n) d 1/3 There is an n2−Ω(εM ) polylog(n) time t-multiplicative-approximating algorithm and an n2−Ω(εA time t-additive-approximating algorithm for All-Pair-Max-IPn,d , when εA ≫ log6 log n/ log3 n. Hardness of Exact Z-Max-IP in 2O(log ∗ n) / log ε−1 A ) Dimensions Thirdly, we show that Z-Max-IP is hard to solve in n2−Ω(1) time, even with 2O(log ∗ n) -dimensional vectors: Theorem 1.14. Assuming SETH (or OVC), there is a constant c such that any exact algorithm for Z-Max-IPn,d ∗ for d = clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. As direct corollaries of the above theorem, using reductions implicit in [Wil18], we also conclude hard∗ ness for ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair under SETH (or OVC) in 2O(log n) dimensions. ∗ Theorem 1.15 (Hardness of ℓ2 -Furthest Pair in clog n Dimensions). Assuming SETH (or OVC), there is a ∗ constant c such that ℓ2 -Furthest Pair in clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. ∗ Theorem 1.16 (Hardness of Bichromatic ℓ2 -Closest Pair in clog n Dimensions). Assuming SETH (or OVC), ∗ there is a constant c such that Bichromatic ℓ2 -Closest Pair in clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. The above lower bounds on ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair are in sharp contrast with the case of ℓ2 -Closest Pair, which can be solved in 2O(d) · n logO(1) n time [BS76, KM95, DHKP97]. Improved Dimensionality Reduction for OV and Hopcroft’s Problem Our hardness of Z-Max-IP is established by a reduction from Hopcroft’s problem, whose hardness is in turn derived from the following significantly improved dimensionality reduction for OV. Lemma 1.17 (Improved Dimensionality Reduction for OV). Let 1 ≤ ℓ ≤ d. There is an   log∗ d ·(d/ℓ)) O n · ℓO(6 · poly(d) -time log∗ d ·(d/ℓ)) reduction from OVn,dto ℓO(6  ∗ O d/ℓ · log ℓ · 6log d . instances of Z-OVn,ℓ+1 , with vectors of entries with bit-length Comparison with [Wil18]. Comparing to the old construction in [Wil18], our reduction here is more efficient when ℓ is much smaller than d (which is the case we care about). That is, in [Wil18], OVn,d can be n log∗ d od/ℓ instances in our improved one. So, for reduced to dd/ℓ instances of Z-OVn,ℓ+1 , while we get ℓ6 log ∗ d ∗ example, when ℓ = 7log d , the old reduction yields dd/7 = nω(1) instances (recall that d = c log n for ∗ o(1) an arbitrary constant c), while our improved one yields only n instances, each with 2O(log n) dimensions. From Lemma 1.17, the following theorem follows in the same way as in [Wil18]. ∗ Theorem 1.18 (Hardness of Hopcroft’s Problem in clog n Dimensions). Assuming SETH (or OVC), there is a constant c such that Z-OVn,clog∗ n with vectors of O(log n)-bit entries requires n2−o(1) time. 6 Connection between Z-Max-IP lower bounds and NP · UPP communication protocols We also show a new connection between Z-Max-IP and a special type of communication protocol. Let us first recall the Set-Disjointness problem: Definition 1.19 (Set-Disjointness). Let n ∈ N, in Set-Disjointness (DISJn ), Alice holds a vector X ∈ {0, 1}n , Bob holds a vector Y ∈ {0, 1}n , and they want to determine whether X · Y = 0. Recall that in [ARW17], the hardness of approximating Max-IP is established via a connection to MA communication protocols (in particular, a fast MA communication protocol for Set-Disjointness). Our lower bound for (exact) Z-Max-IP can also be connected to similar NP · UPP protocols (note that MA = NP · promiseBPP). Formally, we define NP · UPP protocols as follows: Definition 1.20. For a problem Π with inputs x, y of length n (Alice holds x and Bob holds y), we say a communication protocol is an (m, ℓ)-efficient NP · UPP communication protocol if the following holds: • There are three parties Alice, Bob and Merlin in the protocol. • Merlin sends Alice and Bob an advice string z of length m, which is a function of x and y. • Given y and z, Bob sends Alice ℓ bits, and Alice decides to accept or not.7 They have an unlimited supply of private random coins (not public, which is important) during their conversation. The following conditions hold: – If Π(x, y) = 1, then there is an advice z from Merlin such that Alice accepts with probability ≥ 1/2. – Otherwise, for all possible advice strings from Merlin, Alice accepts with probability < 1/2. Moreover, we say the protocol is (m, ℓ)-computational-efficient, if in addition the probability distributions of both Alice and Bob’s behavior can be computed in poly(n) time given their input and the advice. Our new reduction from OV to Max-IP actually implies a super-efficient NP · UPP protocol for SetDisjointness. Theorem 1.21. For all 1 ≤ α ≤ n, there is an   ∗ α · 6log n · (n/2α ), O(α) -computational-efficient NP · UPP communication protocol for DISJn . For example, when α = 3 log∗ n, Theorem 1.21 implies there is an O(o(n), O(log∗ n))-computationalefficient NP · UPP communication protocol for DISJn . Moreover, we show that if the protocol of The∗ orem 1.21 can be improved a little (removing the 6log n term), we would obtain the desired hardness for Z-Max-IP in ω(1)-dimensions. Theorem 1.22. Assuming SETH (or OVC), if there is an increasing and unbounded function f such that for all 1 ≤ α ≤ n, there is an (n/f (α), α) -computational-efficient NP · UPP communication protocol for DISJn , then Z-Max-IPn,ω(1) requires n2−o(1) time with vectors of polylog(n)-bit entries. The same holds for ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair. 7 In UPP, actually one-way communication is equivalent to the seemingly more powerful one in which they communicate [PS86]. 7 Improved MA Protocols for Set-Disjointness √ Finally, we also obtain a new MA protocol for Set-Disjointness, which improves on the previous O( n log n) √ protocol in [AW09], and is closer to the Ω( n) lower bound by [Kla03]. Like the protocol in [AW09], our new protocol also works for the following slightly harder problem Inner Product. Definition 1.23 (Inner Product). Let n ∈ N, in Inner Product (IPn ), Alice holds a vector X ∈ {0, 1}n , Bob holds a vector Y ∈ {0, 1}n , and they want to compute X · Y . Theorem 1.24. There is an MA protocol for DISJn and IPn with communication complexity p  O n log n log log n . √ In [Rub18], the author asked whether the MA communication complexity of DISJ (IP) is Θ( n) or p Θ( n log n), and suggested that Ω(n log n) may be necessary p result makes progress on that √ for IP. Our question by showing that the true complexity lies between Θ( n) and Θ( n log n log log n). 1.2 Intuition for Dimensionality Self Reduction for OV ∗ The 2O(log n) factor in Lemma 1.17 is not common in theoretical computer science8 , and our new reduction for OV is considerably more complicated than the polynomial-based construction from [Wil18]. Hence, it ∗ is worth discussing the intuition behind Lemma 1.17, and the reason why we get a factor of 2O(log n) . A Direct Chinese Remainder Theorem Based Approach. We first discuss a direct reduction based on the Chinese Remainder Theorem (CRT) (see Theorem 2.5 for a formal definition). CRT says that given a collection of primes q1 , . . . , qb , and a collection of integers r1 , . . . , rb , there exists a unique integer t = CRR({ri }; {qi }) such that t ≡ ri (mod qi ) for each i ∈ [b] (CRR stands for Chinese Remainder Representation). Now, let b, ℓ ∈ N, suppose we would like to have a dimensionality reduction ϕ from {0, 1}b·ℓ to Zℓ . We can partition an input x ∈ {0, 1}b·ℓ into ℓ blocks, each of length b, and represent each block via CRT: that is, for a block z ∈ {0, 1}b , we map it into a single integer ϕblock (z) := CRR({zi }; {qi }), and the concatenations of ϕblock over all blocks of x is ϕ(x) ∈ Zℓ . The key idea here is that, for z, z ′ ∈ {0, 1}b , ϕblock (z) · ϕblock (z ′ ) (mod qi ) is simply zi · zi′ . That is, the multiplication between two integers ϕblock (z) · ϕblock (z ′ ) simulates the coordinate-wise multiplication between two vectors z and z ′ ! Therefore, if we make all primes qi larger than ℓ, we can in fact determine x · y from ϕ(x) · ϕ(y), by looking at ϕ(x) · ϕ(y) (mod qi ) for each i. That is, x · y = 0 ⇔ ϕ(x) · ϕ(y) ≡ 0 b Y Hence, let V be the set of all integer 0 ≤ v ≤ ℓ · i=1 (mod qi ) !2 qi for all i. that v ≡ 0 (mod qi ) for all i ∈ [b], we have x · y = 0 ⇔ ϕ(x) · ϕ(y) ∈ V. The reduction is completed by enumerating all integers v ∈ V , and appending corresponding values to make ϕA (x) = [ϕ(x), −1] and ϕB (y) = [ϕ(y), v] (this step is from [Wil18]). Note that a nice property for ϕ is that each ϕ(x)i only depends on the i-th block of x, and the mapping is the same on each block (ϕblock ); we call this the block mapping property.   ∗ ∗ Other examples include an O 2O(log n) n4/3 algorithm for Z-OVn,3 [Mat93], O 2O(log n) n log n algorithms (Fürer’s ∗ algorithm with its modifications) for Fast Integer Multiplication [Für09, CT15, HVDHL16] and an old O(nd/2 2O(log n) ) time algorithm for Klee’s measure problem [Cha08]. 8 8 Analysis of the Direct Reduction. To continue building intuition, let us analyze the above reduction. The b Y qi . These primes qi have to size of V is the number of Z-OVn,ℓ+1 instances we create, and |V | ≥ i=1 be all distinct, and it follows that b Y qi is bΘ(b) . Since we want to create at most no(1) instances (or nε for i=1 arbitrarily small ε), we need to set b ≤ log n/ log log n. Moreover, to base our hardness on OVC which deals with c log n-dimensional vectors, we need to set b · ℓ = d = c · log n for an arbitrary constant c. Therefore, we must have ℓ ≥ log log n, and the above reduction only obtains the same hardness result as [Wil18]. Key Observation: “Most Space Modulo qi ” is Actually Wasted. To improve the above reduction, we need to make |V | smaller. Our key observation about ϕ is that, for the primes qi ’s, they are mostly larger than b ≫ ℓ, but ϕ(x) · ϕ(y) ∈ {0, 1, . . . , ℓ} (mod qi ) for all these qi ’s. Hence, “most space modulo qi ” is actually wasted. Make More “Efficient” Use of the “Space”: Recursive Reduction. Based on the previous observation, we want to use the “space modulo qi ” more efficiently. It is natural to consider a recursive reduction. We will require all our primes qi ’s to be larger than b. Let bmicro be a very small integer compared to b, and let ψ : {0, 1}bmicro ·ℓ → Zℓ with a set Vψ and a block mapping ψblock be a similar reduction on a much smaller input: for x, y ∈ {0, 1}bmicro ·ℓ , x · y = 0 ⇔ ψ(x) · ψ(y) ∈ Vψ . We also require here that ψ(x) · ψ(y) ≤ b for all x and y. For an input x ∈ {0, 1}b·ℓ and a block z ∈ {0, 1}b of x, our key idea is to partition z again into b/bmicro “micro” blocks each of size bmicro . And for a block z in x, let z 1 , . . . , z b/bmicro be its b/bmicro micro blocks, b/b b/b we map z into an integer ϕblock (z) := CRR({ψblock (zi )}i=1micro ; {qi }i=1micro ). Now, given two blocks z, z ′ ∈ {0, 1}b , we can see that ϕblock (z) · ϕblock (z ′ ) ≡ ψblock (zi ) · ψblock (zi′ ) (mod qi ). That is, ϕ(x) · ϕ(y) (mod qi ) in fact is equal to ψ(x[i] ) · ψ(y [i] ), where x[i] is the concatenation of the i-th micro blocks of x in each block, and y [i] is defined similarly. Hence, we can determine whether x[i] · y [i] = 0 from ϕ(x) · ϕ(y) (mod qi ) for all i, and therefore also determine whether x · y = 0 from ϕ(x) · ϕ(y). We can now observe that |V | ≤ bΘ(b/bmicro ) , smaller than before; thus we get an improvement, depending on how large can bmicro be. Clearly, the reduction ψ can also be constructed from even smaller reductions, and after recursing Θ(log∗ n) times, we can switch to the direct construction discussed before. By a straightforward (but tedious) calculation, we can derive Lemma 1.17. ∗ High-Level Explanation on the 2O(log n) Factor. Ideally, we want to have a reduction from OV to Z-OV ∗ with only ℓO(b) instances, in other words, we want |V | = ℓO(b) . The reason we need to pay an extra 2O(log n) factor in the exponent is as follows: b/bmicro Y In our reduction, |V | is at least qi , which is also the bound on each coordinate of the reduction: i=1 b/bmicro ψ(x)i equals to a CRR encoding of a vector with b/b {qi }i=1micro , whose value can be as large as Y i=1 qi − 1. That is, all we want is to control the upper bound on the coordinates of the reduction. Suppose we are constructing an “outer” reduction ϕ : {0, 1}b·ℓ → Zℓ from the “micro” reduction ψ : {0, 1}bmicro ·ℓ → Zℓ with coordinate upper bound Lψ (ψ(x)i ≤ Lψ ), and let Lψ = ℓκ·bmicro (that is, κ is 9 the extra factor comparing to the ideal case). Recall that we have to ensure qi > ψ(x) · ψ(y) to make our construction work, and therefore we have to set qi larger than L2ψ . b/bmicro Then the coordinate upper bound for ϕ becomes Lϕ = Y i=1 qi ≥ (Lψ )2·b/bmicro = ℓ2κ·b . Therefore, we can see that after one recursion, the “extra factor” κ at least doubles. Since our recursion proceeds in ∗ Θ(log∗ n) rounds, we have to pay an extra 2O(log n) factor on the exponent. 1.3 Related Works SETH-based Conditional Lower Bound. SETH is one of the most fruitful conjectures in the FineGrained Complexity. There are numerous conditional lower bounds based on it for problems in P among different areas, including: dynamic data structures [AV14], computational geometry [Bri14, Wil18, DKL16], pattern matching [AVW14, BI15, BI16, BGL16, BK18], graph algorithms [RV13, GIKW17, AVY15, KT17]. See [Vas18] for a very recent survey on SETH-based lower bounds (and more). Communication Complexity and Conditional Hardness. The connection between communication protocols (in various model) for Set-Disjointness and SETH dates back at least to [PW10], in which it is shown that a sub-linear, computational efficient protocol for 3-party Number-On-Forehead Set-Disjointness probe lem would refute SETH. And it is worth mentioning that [AR18]’s result builds on the O(log n) IP communication protocol for Set-Disjointness in [AW09]. Distributed PCP. Using Algebraic Geometry codes, [Rub18] obtains a better MA protocol, which in turn improves the efficiency of the previous distributed PCP construction of [ARW17]. He then shows the n2−o(1) time hardness for 1 + o(1)-approximation to Bichromatic Closest Pair and o(d)-additive approximation to Max-IPn,d with this new technique. [KLM17] use the Distributed PCP framework to derive inapproximability results for k-Dominating Set under various assumptions. In particular, building on the techniques of [Rub18], it is shown that under SETH, k-Dominating Set has no (log n)1/ poly(k,e(ε)) approximation in nk−ε time9 . Ω   √ log n log log n Hardness of Approximation in P. Making use of Chebychev embeddings, [APRS16] prove a 2 inapproximability lower bound on {−1, 1}-Max-IP.10 [AB17] take an approach different from Distributed PCP, and shows that under certain complexity assumptions, LCS does not have a deterministic 1 + o(1)approximation in n2−ε time. They also establish a connection with circuit lower bounds and show that the existence of such a deterministic algorithm implies ENP does not have non-uniform linear-size Valiant Series Parallel circuits. In [AR18], it is improved to that any constant factor approximation deterministic algorithm for LCS in n2−ε time implies that ENP does not have non-uniform linear-size NC1 circuits. See [ARW17] for more related results in hardness of approximation in P. Organization of the Paper In Section 2, we introduce the needed preliminaries for this paper. In Section 3, we prove our characteri∗ zations for approximating Max-IP and other related results. In Section 4, we prove 2O(log n) dimensional hardness for Z-Max-IP and other related problems. In Section 5, we establish the connection between 9 10 where e : R+ → N is some function which is improved by Theorem 1.10 10 NP · UPP communication protocols p  and SETH-based lower bounds for exact Z-Max-IP. In Section 6, we n log n log log n MA protocol for Set-Disjointness. present the O 2 Preliminaries We begin by introducing some notation. For an integer d, we use [d] to denote the set of integers from 1 to d. For a vector u, we use ui to denote the i-th element of u. We use log(x) to denote the logarithm of x with respect to base 2 with ceiling as appropriate, and ln(x) to denote the natural logarithm of x. In our arguments, we use the iterated logarithm function log∗ (n), which is defined recursively as follows: ( 0 n ≤ 1; ∗ log (n) := ∗ log (log n) + 1 n > 1. 2.1 Fast Rectangular Matrix Multiplication Similar to previous algorithms using the polynomial method, our algorithms make use of the algorithms for fast rectangular matrix multiplication. Theorem 2.1 ([GU18]). There is an N 2+o(1) time algorithm for multiplying two matrices A and B with size N × N α and N α × N , where α > 0.31389. Theorem 2.2 ([Cop82]). There is an N 2 · polylog(N ) time algorithm for multiplying two matrices A and B with size N × N α and N α × N , where α > 0.172. 2.2 Number Theory Here we recall some facts from number theory. In our reduction from OV to Z-OV, we will apply the famous prime number theorem, which supplies a good estimate of the number of primes smaller than a certain number. See e.g. [Apo13] for a reference on this. Theorem 2.3 (Prime Number Theorem). Let π(n) be the number of primes ≤ n, then we have π(n) = 1. n→∞ n/ ln n lim From a simple calculation, we obtain: Lemma 2.4. There are 10n distinct primes in [n + 1, n2 ] for a large enough n. Proof. For a large enough n, from the prime number theorem, the number of primes in [n + 1, n2 ] is equal to π(n2 ) − π(n) ∼ n2 /2 ln n − n/ ln n ≫ 10n. Next we recall the Chinese remainder theorem, and Chinese remainder representation. 11 Theorem 2.5. Given d pairwise co-prime integers q1 , q2 , . . . , qd , and d integers r1 , r2 , . . . , rd , there is d Y qi such that exactly one integer 0 ≤ t < i=1 t ≡ ri (mod qi ) for all i ∈ [d]. We call this t the Chinese remainder representation (or the CRR encoding) of the ri ’s (with respect to these qi ’s). We also denote t = CRR({ri }; {qi }) for convenience. We sometimes omit the sequence {qi } for simplicity, when it is clear from the context. Moreover, t can be computed in polynomial time with respect to the total bits of all the given integers. 2.3 Communication Complexity In our paper we will make use of a certain kind of MA protocol, we call them (m, r, ℓ, s)-efficient protocols11 . Definition 2.6. We say an MA Protocol is (m, r, ℓ, s)-efficient for a communication problem, if in the protocol: • There are three parties Alice, Bob and Merlin in the protocol, Alice holds input x and Bob holds input y. • Merlin sends an advice string z of length m to Alice, which is a function of x and y. • Alice and Bob jointly toss r coins to obtain a random string w of length r. • Given y and w, Bob sends Alice a message of length ℓ. • After that, Alice decides whether to accept or not. – When the answer is yes, Merlin has exactly one advice such that Alice always accept. – When the answer is no, or Merlin sends the wrong advice, Alice accepts with probability at most s. 2.4 Derandomization We make use of expander graphs to reduce the amount of random coins needed in one of our communication protocols. We abstract the following result for our use here. Theorem 2.7 (see e.g. Theorem 21.12 and Theorem 21.19 in [AB09]). Let m be an integer, and set B ⊆ [m]. Suppose |B| ≥ m/2. There is a universal constant c1 such that for all ε < 1/2, there is a −1 −1 poly(log m, log ε−1 )-time computable function F : {0, 1}log m+c1 ·log ε → [m]c1 ·log ε , such that Pr −1 w∈{0,1}log m+c1 ·log ε [a ∈ / B for all a ∈ F(w)] ≤ ε, here a ∈ F(w) means a is one of the element in the sequence F(w). 11 Our notations here are adopted from [KLM17]. They also defined similar k-party communication protocols, while we only discuss 2-party protocols in this paper. 12 3 Hardness of Approximate Max-IP In this section we prove our characterizations of approximating Max-IP. 3.1 The Multiplicative Case We begin with the proof of Theorem 1.5. We recap it here for convenience. Reminder of Theorem 1.5 Letting ω(log n) < d < no(1) and t ≥ 2, the following holds: 1. There is an n2−Ω(1) -time t-multiplicative-approximating algorithm for Max-IPn,d if t = (d/ log n)Ω(1) , and under SETH (or OVC), there is no n2−Ω(1) -time t-multiplicative-approximating algorithm for Max-IPn,d if t = (d/ log n)o(1) .   log t , 1 . There are t-multiplicative-approximating deterministic 2. Moreover, let ε = min log(d/ log n) algorithms for Max-IPn,d running in time     2+o(1)−0.31· −1 1 0.31 ε + 2 = O n2+o(1)−Ω(ε) O n or time  O n 2−0.17· 1 ε−1 + 0.17 2    · polylog(n) = O n2−Ω(ε) · polylog(n) . In Lemma 3.2, we construct the desired approximate algorithm and in Lemma ?? we prove the lower bound. The Algorithm First we need the following simple lemma, which says that the k-th root of the sum of the k-th powers of non-negative reals gives a good approximation to their maximum. Lemma 3.1. Let S be a set of non-negative real numbers, k be an integer, and xmax := max x. We have x∈S X xk x∈S !1/k Proof. Since X x∈S xk ! i h ∈ xmax , xmax · |S|1/k . i h ∈ xkmax , |S| · xkmax , the lemma follows directly by taking the k-th root of both sides. 13  log t , 1 , there are tlog(d/ log n) multiplicative-approximating deterministic algorithms for Max-IPn,d running in time     2+o(1)−0.31· −1 1 0.31 ε + 2 O n = O n2+o(1)−Ω(ε) Lemma 3.2. Assuming ω(log n) < d < no(1) and letting ε = min or time  O n 2−0.17·     · polylog(n) = O n2−Ω(ε) · polylog(n) . 1 ε−1 + 0.17 2   log t Proof. Let d = c · log n. From the assumption, we have c = ω(1), and ε = min , 1 . When log c log t > log c, we simply use a c-multiplicative-approximating algorithm instead, hence in the following we assume log t ≤ log c. We begin with the first algorithm here. Construction and Analysis of the Power of Sum Polynomial Pr (z). Let r be a parameter to be specified later and z be a vector from {0, 1}d , consider the following polynomial !r d X zi . Pr (z) := i=1 Observe that since each zi takes value in {0, 1}, we have zik = zi for k ≥ 2. Therefore, by expanding out the polynomial and replacing all zik with k ≥ 2 by zi , we can write Pr (z) as X Pr (z) = cS · zS . S⊆[d],|S|≤r In which zS := Y zi , and the cS ’s are the corresponding coefficients. Note that Pr (z) has i∈S m := r   X d k=0 k ≤  ed r r terms. Then consider Pr (x, y) := Pr (x1 · y1 , x2 · y2 , . . . , xd · yd ), plugging in zi := xi · yi , it can be written as X Pr (x, y) := cS · xS · yS , S⊆[d],|S|≤r where xS := Y xi , and yS is defined similarly. i∈S Construction and Analysis of the Batch Evaluation Polynomial Pr (X, Y ). Now, let X and Y be two sets of b = tr/2 vectors from {0, 1}d , we define X X Pr (X, Y ) := Pr (x, y) = (x · y)r . x∈X,y∈Y x∈X,y∈Y By Lemma 3.1, we have Pr (X, Y )1/r ∈ [OPT(X, Y ), OPT(X, Y ) · t] , recall that OPT(X, Y ) := max x · y. x∈X,y∈Y 14 Embedding into Rectangle Matrix Multiplication. Now, for x, y ∈ {0, 1}d , we define the mapping φx (x) as φx (x) := (cS1 · xS1 , cS2 · xS2 , . . . , cSm · xSm ) and φy (y) := (yS1 , yS2 , . . . , ySm ) , where S1 , S2 , . . . , Sm is an enumeration of all sets S ⊆ [d] and |S| ≤ r. From the definition, it follows that φx (x) · φy (y) = Pr (x, y) for every x, y ∈ {0, 1}d . Then for each X and Y , we map them into m-dimensional vectors φX (X) and φY (Y ) simply by a summation: X X φX (X) := φx (x) and ΦY (Y ) := φy (y). x∈X y∈Y We can see φX (X) · φY (Y ) = X x∈X φx (x) · X φy (y) = y∈Y XX Pr (x, y) = Pr (X, Y ). x∈X y∈Y Given two sets A, B of n vectors from {0, 1}d , we split A into n/b sets A1 , A2 , . . . , An/b of size b, and split B in the same way as well. Then we construct a matrix MA (MB ) of size n/b × m, such that the i-th row of MA (MB ) is the vector ΦX (Ai )(ΦY (Bi )). After that, the evaluation of Pr (Ai , Bj ) for all i, j ∈ [n/b] can be reduced to compute the matrix product MA · MBT . After knowing all Pr (Ai , Bj )’s, we simply compute the maximum of them, whose r-th root gives us a t-multiplicative-approximating answer of the original problem. Analysis of the Running Time. Finally, we are going to specify the parameter r and analyze the time complexity. In order to utilize the fast matrix multiplication algorithm from Theorem 2.1, we need to have m ≤ (n/b)0.313 , then our running time is simply (n/b)2+o(1) = n2+o(1) /b2 . We are going to set r = k · log n/ log c, and our choice of k will satisfy k = Θ(1). We have m≤ and therefore  e·d r r ≤  c log n · e k · log n/ log c k·log n/ log c ,  . c log c log m ≤ k · log n log log c. +1 k Since c = ω(1) and k = Θ(1), we have log m ≤ (1 + o(1)) · k log n = k log n + o(log n). 15 Plugging in, we have m ≤ (n/b)0.313 ⇐= log m ≤ 0.313 · (log n − log b) ⇐= k log n ≤ 0.31 · (log n − log b) ⇐= 0.31 · (r/2) · log t + k log n ≤ 0.31 log n 0.31 log n · k · log t · + k log n ≤ 0.31 log n ⇐= log c 2   log t 0.31 · ⇐= k · 1 + ≤ 0.31 log c 2 0.31 0.31 ⇐= k = = . log t 0.31 1 + 0.31 1 + log c · 2 2 ·ε (b = tr/2 ) (r = k · log n/ log c) Note since ε ∈ [0, 1], k is indeed Θ(1). Finally, with our choice of k specified, our running time is n2+o(1) /b2 = n2+o(1) /tr . By a simple calculation, log tr = r · log t = k · log n/ log c · log t ) ( 0.31 log t · = log n · log c 1 + 0.31 2 ·ε 0.31ε 1 + 0.31 2 ·ε 0.31 = log n · −1 0.31 . ε + 2 = log n · Hence, our running time is n2+o(1) /tr = n 2+o(1)− 0.31 ε−1 + 0.31 2 as stated. The Second Algorithm. The second algorithm follows exactly the same except for that we apply Theorem 2.2 instead, hence the constant 0.31 is replaced by 0.17. Generalization to Non-negative Real Case Note that Lemma 3.1 indeed works for a set of non-negative reals, we can observe that the above algorithm in fact works for R+ -Max-IPn,d (which is the same as Max-IP except for that the sets consisting of nonnegative reals):12   log t o(1) Reminder of Corollary 1.7 Assuming ω(log n) < d < n and letting ε = min ,1 , log(d/ log n) there is a t-multiplicative-approximating deterministic algorithm for R+ -Max-IPn,d running in time   O n2−Ω(ε) · polylog(n) . 12 In the following we assume a real RAM model of computation for simplicity. 16 Proof Sketch. We can just use the same algorithm in Lemma 3.2, the only difference is on the analysis of the number of terms in Pr (z): since no longer Boolean, Pr (z) is no longer multi-linear, and we need to  z is  d+r switch to a general upper bound on the number of terms for r-degree polynomials of d variables. r This corollary then follows by a similar calculation as in Lemma 3.2. The Lower Bound The lower bound follows directly from the new MA protocol for Set-Disjointness in [Rub18]. We present an explicit proof here for completeness. Before proving the lower bound we need the following reduction from OV to t-multiplicative-approximating Max-IP. Lemma 3.3 (Implicit in Theorem 4.1 of [Rub18]). There is a universal constant c1 such that, for every integer c, reals ε ∈ (0, 1] and τ ≥ 2, OVn,c log n can be reduced to nε Max-IPn,d instances (Ai , Bi ) for i ∈ [nε ], such that: • d = τ poly(c/ε) · log n. • Letting T = c log n · τ c1 , if there is a ∈ A and b ∈ B such that a · b = 0, then there exists an i such that OPT(Ai , Bi ) ≥ T . • Otherwise, for all i we must have OPT(Ai , Bi ) ≤ T /τ . The reduction above follows directly from the new MA communication protocols in [Rub18] together with the use of expander graphs to reduce the amount of random coins. A proof for the lemma above can be found in Appendix D. Now we are ready to show the lower bound on t-multiplicative-approximating Max-IP. Corollary 3.4. Assuming SETH (or OVC), and letting d = ω(log n) and t ≥ 2. There is no n2−Ω(1) -time t-multiplicative-approximating algorithm for Max-IPn,d if t = (d/ log n)o(1) . Proof. Let c = d/ log n, then t = co(1) (recall that t and d are two functions of n). ′ Suppose for contradiction that there is an n2−ε time t(n)-multiplicative-approximating algorithm A for Max-IP(n, d) for some ε′ > 0. Let ε = ε′ /2. Now, for every constant c2 , we apply the reduction in Lemma 3.3 with τ = t to reduce an OVn,c2 log n instance to nε Max-IPn,tpoly(c2 /ε) ·log n ≡ Max-IPn,tO(1) ·log n instances. Since t = co(1) , which means for sufficiently large n, tO(1) · log n = co(1) · log n = o(d), and it in turn implies that for sufficiently large n, nε calls to A are enough to solve the OVn,c2 log n instance. ′ Therefore, we can solve OVn,c2 log n in n2−ε · nε = n2−ε time for all constant c2 . Contradiction to OVC. Finally, the correctness of Theorem 1.5 follows directly from Lemma 3.2 and Corollary 3.4. 17 3.2 The Additive Case In this subsection we prove Theorem 1.11. We first recap it here for convenience. Reminder of Theorem 1.11 Letting ω(log n) < d < no(1) and 0 ≤ t ≤ d, the following holds: 1. There is an n2−Ω(1) -time t-additive-approximating algorithm for Max-IPn,d if t = Ω(d), and under SETH (or OVC), there is no n2−Ω(1) -time t-additive-approximating algorithm for Max-IPn,d if t = o(d). 2. Moreover, letting ε = t , there is an d   1/3 −1 O n2−Ω(ε / log ε ) time, t-additive-approximating randomized algorithm for Max-IPn,d when ε ≫ log6 log n/ log3 n. We proceed similarly as in the multiplicative case by establishing the algorithm first. The Algorithm The algorithm is actually very easy, we simply apply the following algorithm from [ACW16]. Lemma 3.5 (Implicit in Theorem 5.1 in [ACW16]). Assuming ε ≫ log6 log(d log n)/ log3 n, there is an  d ) 2−Ω ε1/3 / log( ε log n n time ε · d-additive-approximating randomized algorithm for Max-IPn,d . Lemma 3.6. Let ε = min(t, d) , there is an d   1/3 −1 O n2−Ω(ε / log ε ) time, t-additive-approximating randomized algorithm for Max-IPn,d when ε ≫ log6 log n/ log3 n. Proof. When t > d the problem becomes trivial, so we can assume t ≤ d, and now t = ε · d. Let ε1 = ε/2 and c1 be a constant to be specified later. Given an Max-IPn,d instance with two sets A and e and B e and d1 = c1 ·ε−2 ·log n B of vectors from {0, 1}d , we create another Max-IPn,d1 instance with sets A 1 as follows: • Pick d1 uniform random indices i1 , i2 , i3 , . . . , id1 ∈ [d], each ik is an independent uniform random number in [d]. e from A by reducing each a ∈ A into ã = (ai , ai , . . . , ai ) ∈ {0, 1}d1 and B e • Then we construct A 1 2 d1 from B in the same way. 18 Note for each a ∈ A and b ∈ B, by a Chernoff bound, we have # " ã · b̃ a · b 2 − ≥ ε1 < 2e−2d1 ε1 = 2n−2·c1 . Pr d1 d By setting c1 = 2, the above probability is smaller than 1/n3 . Hence, by a simple union bound, with probability at least 1 − 1/n, we have e a · eb a · b − ≤ ε1 d1 d for all a ∈ A and b ∈ B. Hence, it means that this reduction only changes the “relative inner a·b e a · eb product”( or ) of each pair by at most ε1 . Hence the maximum of the “relative inner product” d d1 e B)/d e 1 | ≤ ε1 . also changes by at most ε1 , and we have |OPT(A, B)/d − OPT(A, e and B e with error ε = ε1 to Then we apply the algorithm in Lemma 3.5 on the instance with sets A e e and our final answer is simply O · d. obtain an estimate O, d1 e B)/d e 1 − O/d e 1 | ≤ ε1 , and therefore we have From the guarantee from Lemma 3.5, we have |OPT(A, e |OPT(A, B)/d − O/d1 | ≤ 2ε1 = ε, from which the correctness of our algorithm follows directly. For the running time, note that the reduction part runs in linear time O(n · d), and the rest takes  d1 1/3 −1 2−Ω ε1/3 / log( ε log ) n 1 n = n2−Ω(ε / log ε ) time. The Lower Bound The lower bound is already established in [Rub18], we show it follows from Lemma 3.3 here for completeness. Lemma 3.7 (Theorem 4.1 of [Rub18]). Assuming SETH (or OVC), and letting d = ω(log n) and t > 0, there is no n2−Ω(1) -time t-additive-approximating randomized algorithm for Max-IPn,d if t = o(d). ′ Proof. Recall that t and d are all functions of n. Suppose for contradiction that there is an n2−ε time t(n)-additive-approximating algorithm A for Max-IP(n, d) for some ε′ > 0. Let ε = ε′ /2. Now, for every constant c2 , we apply the reduction in Lemma 3.3 with τ = 2 to reduce an OVn,c2 log n instance to nε Max-IPn,2poly(c2 /ε) ·log n ≡ Max-IPn,d1 where d1 = O(1) · log n instances. In addition, from Lemma 3.3, to solve the OVc2 log n instance, we only need to distinguish an T additive gap of = Ω(log n) = Ω(d1 ) for these Max-IP instances obtained via the reduction. 2 This can be solved, via nε calls to A as follows: for each Max-IPn,d1 instance I we get, since d = ω(log n), which means for a sufficiently large n, d1 = O(log n) ≪ d, and we can duplicate each coordinate d/d1 times (for simplicity we assume d1 |d here), to obtain an Max-IPn,d instance I new , such that OPT(I new ) = d/d1 · OPT(I). Then A can be used to estimate OPT(I new ) within an additive error 19 d1 , it can also be used to estimate OPT(I) within an additive error d o(d1 ) = o(log n) ≤ T /2 for sufficiently large n. ′ Therefore, we can solve OVn,c2 log n in n2−ε · nε = n2−ε time for all constant c2 . Contradiction to OVC. t = o(d). Scaling its estimate by Finally, the correctness of Theorem 1.11 follows directly from Lemma 3.6 and Lemma 3.7. 3.3 Adaption for All-Pair-Max-IP Now we sketch the adaption for our algorithms to work for the All-Pair-Max-IP problem. Reminder of Corollary 1.13 Suppose ω(log n) < d < no(1) , and let   min(t, d) log t , 1 and εA := . εM := min log(d/ log n) d 1/3 There is an n2−Ω(εM ) polylog(n) time t-multiplicative-approximating algorithm and an n2−Ω(εA time t-additive-approximating algorithm for All-Pair-Max-IPn,d , when εA ≫ log6 log n/ log3 n. / log ε−1 A ) Proof Sketch. Note that the algorithm in Lemma 3.5 from [ACW16] actually works for the All-Pair-Max-IPn,d . Hence, we can simply apply that algorithm after the coordinate sampling phase, and obtain a t-additiveapproximating algorithm for All-Pair-Max-IPn,d . For t-multiplicative-approximating algorithm, suppose we are given with two sets A and B of n vectors from {0, 1}d . Instead of partitioning both of them into n/b subsets Ai ’s and Bi ’s (the notations used here are the same as in the proof of Lemma 3.2), we only partition B into n/b subsets B1 , B2 , . . . , Bn/b of size X b, and calculate Pr (x, Bi ) := Pr (x, y) for all x ∈ A and i ∈ [n/b] using similar reduction to rectangle y∈Bi matrix multiplication as in Lemma 3.2. By a similar analysis, these can be done in n2−Ω(εM ) · polylog(n) time, and with these informations we can compute the t-multiplicative-approximating answers for the given All-Pair-Max-IPn,d instance. 3.4 Improved Hardness for LCS-Closest Pair Problem We finish this section with the proof of Corollary 1.9. First we abstract the reduction from Max-IP to LCS-Closest-Pair in [ARW17] here. Lemma 3.8 (Implicit in Theorem 1.6 in [ARW17]). For big enough t and n, t-multiplicative-approximating Max-IPn,d reduces to t/2-multiplicative-approximating LCS-Closest-Pairn,O(d3 log2 n) . Now we are ready to prove Corollary 1.9 (restated below for convenience). Reminder of Corollary 1.9 Assuming SETH (or OVC), for every t ≥ 2, t-multiplicative-approximating LCS-Closest-Pairn,d requires n2−o(1) time, if d = tω(1) · log5 n. Proof. From Lemma ??, assuming SETH (or OVC), for every t ≥ 2, we have that 2t-multiplicativeapproximating Max-IPn,d requires n2−o(1) time if d = tω(1) · log n. Then from Lemma 3.8, we immediately have that t-multiplicative-approximating LCS-Closest-Pairn,d3 ·log2 n = LCS-Closest-Pairn,tω(1) ·log5 n requires n2−o(1) time. 20 4 Hardness of Exact Z-Max-IP, Hopcroft’s Problem and More In this section we show hardness of Hopcroft’s problem, exact Z-Max-IP, ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair. Essentially our results follow from the framework of [Wil18], in which it is shown that hardness of Hopcroft’s problem implies hardness of other three problems, and is implied by dimensionality reduction for OV. ℓ2 -furthestn,2O(log∗ n) OVn,c log n Z-OVn,2O(log∗ n) Z-Max-IPn,2O(log∗ n) Bichrom.-ℓ2 -closestn,2O(log∗ n) Figure 1: A diagram for all reductions in this section. The Organization of this Section In Section 4.1 we prove the improved dimensionality reduction for OV. In Section 4.2 we establish the ∗ hardness of Hopcroft’s problem in 2O(log n) dimensions with the improved reduction. In Section 4.3 we show Hopcroft’s problem can be reduced to Z-Max-IP and thus establish the hardness for the later one. In Section 4.4 we show Z-Max-IP can be reduced to ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair, therefore the hardness for the later two problems follow. See Figure 1 for a diagram of all reductions covered in this section. The reduction in last three subsections are all from [Wil18] (either explicit or implicit), we make them explicit here for our ease of exposition and for making the paper self-contained. 4.1 Improved Dimensionality Reduction for OV We begin with the improved dimensionality reduction for OV. The following theorem is one of the technical cores of this paper, which makes use of the CRR encoding (see Theorem 2.5) recursively. Theorem 4.1. Let b, ℓ be two sufficiently large integers. There is a reduction ψb,ℓ : {0, 1}b·ℓ → Zℓ and a set Vb,ℓ ⊆ Z, such that for every x, y ∈ {0, 1}b·ℓ , x · y = 0 ⇔ ψb,ℓ (x) · ψb,ℓ (y) ∈ Vb,ℓ and log∗ (b) ·b 0 ≤ ψb,ℓ (x)i < ℓ6 for all possible x and i ∈ Moreover, the computation of ψb,ℓ (x) takes poly(b · ℓ) time, and the set Vb,ℓ  [ℓ]. log  ∗ (b) O(6 ·b) can be constructed in O ℓ · poly(b · ℓ) time. Remark 4.2. We didn’t make much effort to minimize the base 6 above to keep the calculation clean, it can be replaced by any constant > 2 with a tighter calculation. 21 Proof. We are going to construct our reduction in a recursive way. ℓ will be the same throughout the proof, hence in the following we use ψb (Vb ) instead of ψb,ℓ (Vb,ℓ ) for simplicity. Direct CRR for small b: When b < ℓ, we use a direct Chinese remainder representation of numbers. We pick b primes q1 , q2 , . . . , qb in [ℓ + 1, ℓ2 ], and use them for our CRR encoding. Let x ∈ {0, 1}b·ℓ , we partition it into ℓ equal size groups, and use xi to denote the i-th group, which is the sub-vector of x from the ((i − 1) · b + 1)-th bit to the (i · b)-th bit. Then we define ψb (x) as  n o      b 1 b 2 b ψb (x) := CRR xj j=1 , CRR xj j=1 , . . . , CRR xℓj . j=1 That is, the i-th coordinate of ψb (x) is the CRR encoding of the i-th sub-vector xi with respect to the primes qj ’s. Now, for x, y ∈ {0, 1}b·ℓ , note that for j ∈ [b], ψb (x) · ψb (y) (mod qj ) ℓ    X b CRR xij j=1 · CRR yji ≡ ≡ Since the sum ℓ X i=1 i=1 ℓ X i=1  (mod qj ) (mod qj ). xij · yji is in [0, ℓ], and qj > ℓ, we can see ℓ X i=1 Therefore, x · y = xij · yji b j=1 ℓ b X X j=1 i=1 xij · yji = 0 ⇔ ψb (x) · ψb (y) ≡ 0 xij · yji = 0 is equivalent to that ψb (x) · ψb (y) ≡ 0 for every j ∈ [b]. Finally, we have 0 ≤ ψb (x)i < b Y j=1 (mod qj ) log∗ (b) ·b pj < ℓ2·b ≤ ℓ6 . Therefore log ∗ (b) ·2b+1 ψb (x) · ψb (y) < ℓ6 log ∗ (b) ·2b+1 and we can set Vb to be the set of all integers in [0, ℓ6 to see that b·ℓ (mod qj ). ] that is 0 modulo all the pj ’s, and it is easy x · y ⇔ ψb (x) · ψb (y) ∈ Vb for all x, y ∈ {0, 1} . 22 , Recursive Construction for larger b: When b ≥ ℓ, suppose the theorem holds for all b′ < b. Let bmicro be the number such that (we ignore the rounding issue here and pretend that bmicro is an integer for simplicity), log∗ (bmicro ) ·b micro ℓ6 = b. Then we pick b/bmicro primes p1 , p2 , . . . , pb/bmicro in [(b2 ℓ), (b2 ℓ)2 ], and use them as our reference primes in the CRR encodings. Let x ∈ {0, 1}b·ℓ , as before, we partition x into ℓ equal size sub-vectors x1 , x2 , . . . , xℓ , where xi consists of the ((i − 1) · b + 1)-th bit of x to the (i · b)-th bit of x. Then we partition each xi again into b/bmicro micro groups, each of size bmicro . We use xi,j to denote the j-th micro group of xi after the partition. Now, we use x[j] to denote the concatenation of the vectors x1,j , x2,j , . . . , xℓ,j . That is, x[j] is the concatenation of the j-th micro group in each of the ℓ groups. Note that x[j] ∈ {0, 1}bmicro ·ℓ , and can be seen as a smaller instance, on which we can apply ψbmicro . Our recursive construction then goes in two steps. In the first step, we make use of ψbmicro , and transform each bmicro -size micro group into a single number in [0, b). This step transforms x from a vector in {0, 1}b·ℓ into a vector S(x) in Z(b/bmicro )·ℓ . And in the second step, we use a similar CRR encoding as in the base case to encode S(x), to get our final reduced vector in Zℓ . S(x) is simply  S(x) := ψbmicro (x[1] )1 , ψbmicro (x[2] )1 , . . . , ψbmicro (x[b/bmicro ] )1 , ψbmicro (x[1] )2 , ψbmicro (x[2] )2 , . . . , ψbmicro (x[b/bmicro ] )2 , ...,...,...  ψbmicro (x[1] )ℓ , ψbmicro (x[2] )ℓ , . . . , ψbmicro (x[b/bmicro ] )ℓ . That is, we apply ψbmicro on all the x[j] ’s, and shrink all the corresponding micro-groups in x into integers. Again, we partition S into ℓ equal size groups S 1 , S 2 , . . . , S ℓ . Then we define ψb (x) as   n o     b/bmicro b/b b/b ψb (x) := CRR Sj1 j=1micro , CRR Sj2 j=1micro , . . . , CRR Sjℓ . j=1 In other words, the i-th coordinate of ψb (x) is the CRR representation of the number sequence S i , with b/b respect to our primes {qj }j=1micro . Now, note that for x, y ∈ {0, 1}b·ℓ , x · y = 0 is equivalent to x[j] · y [j] = 0 for every j ∈ [b/bmicro ], which is further equivalent to ψbmicro (x[j] ) · ψbmicro (y [j] ) ∈ Vbmicro for all j ∈ [b/bmicro ], by our assumption on ψbmicro . Since 0 ≤ ψbmicro (x[j] )i , ψbmicro (y [j] )i < b for all x, y ∈ {0, 1}b·ℓ , i ∈ [ℓ] and j ∈ [b/bmicro ], we also have ψbmicro (x[j] ) · ψbmicro (y [j] ) < b2 · ℓ, therefore we can assume that Vbmicro ⊆ [0, b2 ℓ). For all x, y ∈ {0, 1}b·ℓ and j ∈ [b/bmicro ], we have 23 ψb (x) · ψb (y) ℓ  X CRR S(x)ij ≡ b/bmicro j=1 i=1 ≡ ≡ ℓ X i=1 ℓ X i=1 S(x)ij · S(y)ij  · CRR  S(y)ij b/bmicro j=1  (mod pj ) (mod pj ) ψbmicro (x[j] )i · ψbmicro (y [j])i (mod pj ) ≡ψbmicro (x[j] ) · ψbmicro (y [j] ) (mod pj ). Since pj ≥ b2 · ℓ, we can determine ψbmicro (x[j] ) · ψbmicro (y [j] ) from ψb (x) · ψb (y) by taking modulo pj . Therefore, x·y =0 is equivalent to (ψb (x) · ψb (y) mod pj ) ∈ Vbmicro , for every j ∈ [b/bmicro ]. Finally, recall that we have log∗ (bmicro ) ·b micro ℓ6 = b. Taking logarithm of both sides, we have 6log ∗ (bmicro ) · bmicro · log ℓ = log b. Then we can upper bound ψb (x)i by b/bmicro Y ψb (x)i < pj j=1 < (b2 ℓ)2·(b/bmicro ) (b ≥ ℓ.) 6·b/bmicro ·log b ≤2 log∗ (bmicro ) ≤ 26·b/bmicro ·6 ·bmicro ·log ℓ log ∗ (bmicro ) ·b ≤ ℓ6·6 log ∗ (b) ·b ≤ ℓ6 (bmicro ≤ log b, log∗ (bmicro ) + 1 ≤ log∗ (log b) + 1 = log∗ (b).) log ∗ (b) ·2b+1 Therefore, we can set Vb as the set of integer t in [0, ℓ6 ) such that (t mod pj ) ∈ Vbmicro for every j ∈ [b/bmicro ]. And it is easy to see this Vb satisfies our requirement. 24 Finally, it is easy to see that the straightforward way of constructing ψb (x) takes O(poly(b · ℓ)) time, and we can construct Vb by enumerating all possible values of ψb (x) · ψb (y) and check each of them in log∗ (b) ·b) O(poly(b · ℓ)) time. Since there are at most ℓO(6 such values, Vb can be constructed in   log∗ (b) ·b) O ℓO(6 · poly(b · ℓ) time, which completes the proof. Now we prove Lemma 1.17, we recap its statement here for convenience. Reminder of Lemma 1.17 Let 1 ≤ ℓ ≤ d. There is an   log∗ d ·(d/ℓ)) O n · ℓO(6 · poly(d) -time log∗ d ·(d/ℓ)) reduction from OVn,dto ℓO(6  ∗ O d/ℓ · log ℓ · 6log d . instances of Z-OVn,ℓ+1 , with vectors of entries with bit-length Proof. The proof is exactly the same as the proof for Lemma 1.1 in [Wil18] with different parameters, we recap it here for convenience. Given two sets A′ and B ′ of n vectors from {0, 1}d , we apply ψd/ℓ,ℓ to each of the vectors in A′ (B ′ ) to obtain a set A (B) of vectors from Zℓ . From Theorem 4.1, there is a (u, v) ∈ A′ × B ′ such that u · v = 0 if and only if there is a (u, v) ∈ A × B such that u · v ∈ Vd/ℓ,ℓ . Now, for each element t ∈ Vd/ℓ,ℓ , we are going to construct two sets At and Bt of vectors from Zℓ+1 such that there is a (u, v) ∈ A × B with u · v = t if and only if there is a (u, v) ∈ At × Bt with u · v = 0. We construct a set At as a collection of all vectors uA = [u, 1] for u ∈ A, and a set Bt as a collection of all vectors vB = [v, −t] for v ∈ B. It is easy to verify this reduction has the properties we want. log ∗ d ·(d/ℓ)) Note that there are at most ℓO(6 numbers in Vd/ℓ,ℓ , so we have such a number of Z-OVn,ℓ+1 instances. And from Theorem 4.1, the reduction takes   log∗ d ·(d/ℓ)) O n · ℓO(6 · poly(d) time. Finally, the bit-length of reduced vectors is bounded by     ∗ log∗ d ·(d/ℓ)) = O d/ℓ · log ℓ · 6log d , log ℓO(6 which completes the proof. A Transformation from Nonuniform Construction to Uniform Construction The proof for Theorem 4.1 works recursively. In one recursive step, we reduce the construction of ψb,ℓ to the construction of ψbmicro ,ℓ , where bmicro ≤ log b. Applying this reduction log∗ n times, we get a sufficiently small instance that we can switch to a direct CRR construction. An interesting observation here is that after applying the reduction only thrice, the block length parameter becomes b′ ≤ log log log b, which is so small that we can actually use brute force to find the “optimal” construction ψb′ ,ℓ in bo(1) time instead of recursing deeper. Hence, to find a construction better than Theorem 4.1, we only need to prove the existence of such a construction. See Appendix B for details. 25 4.2 Improved Hardness for Hopcroft’s Problem In this subsection we are going to prove Theorem 1.18 using our new dimensionality reduction Lemma 1.17, we recap its statement here for completeness. ∗ Reminder of Theorem 1.18 [Hardness of Hopcroft’s Problem in clog n Dimension] Assuming SETH (or OVC), there is a constant c such that Z-OVn,clog∗ n with vectors of O(log n)-bit entries requires n2−o(1) time. Proof. The proof here follows roughly the same as the proof for Theorem 1.1 in [Wil18]. Let c be an arbitrary constant and d := c · log n. We show that an oracle solving Z-OVn,ℓ+1 where ∗ ℓ = 7log n in O(n2−δ ) time for some δ > 0 can be used to construct an O(n2−δ+o(1) ) time algorithm for OVn,d , and therefore contradicts the OVC. We simply invoke Lemma 1.17, note that we have   ∗    ∗ O 6log d ·(d/ℓ) log ℓ = log ℓ · O 6log d · (d/ℓ)   ∗ log∗ n log∗ n = O log n · 6 · c · log n/7   ∗ = O log∗ n · (6/7)log n · c · log n = o(log n).   ∗ O 6log d ·(d/ℓ) · poly(d)) = n1+o(1) time, and an OVn,d instance is Therefore, the reduction takes O(n · ℓ reduced to no(1) instances of Z-OVn,ℓ+1 , and the reduced vectors have bit length o(log n) as calculated above. We simply solve all these no(1) instances using our oracle, and this gives us an O(n2−δ+o(1) ) time algorithm for OVn,d , which completes the proof. 4.3 Hardness for Z-Max-IP Now we move to hardness of exact Z-Max-IP. Theorem 4.3 (Implicit in Theorem 1.2 [Wil18]). There is an O(poly(d) · n)-time algorithm which reduces a Z-OVn,d instance into a Z-Max-IPn,d2 instance. Proof. We remark here that this reduction is implicitly used in the proof of Theorem 1.2 in [Wil18], we abstract it here only for our exposition. Given a Z-OVn,d instance with sets A, B. Consider the following polynomial P (x, y), where x, y ∈ Zd . X P (x, y) = −(x · y)2 = −xi · yj . i,j∈[d] It is easy to see that whether there is a (x, y) ∈ A × B such that x · y = 0 is equivalent to whether the maximum value of P (x, y) is 0. 2 Now, for each x ∈ A and y ∈ B, we construct x e, ye ∈ Zd such that x ei = x⌊(i−1)/d⌋+1 and yei = e be the set of all these x e be the set of all −y(i mod d)+1 . Then we have x e · ye = P (x, y). Hence, let A e’s, and B e B) e = 0, these ye’s, whether there is a (x, y) ∈ A × B such that x · y = 0 is equivalent to whether OPT(A, and our reduction is completed. 26 Now, Theorem 1.14 (restated below) is just a simple corollary of Theorem 4.3 and Theorem 1.18. Reminder of Theorem 1.14 Assuming SETH (or OVC), there is a constant c such that every exact algorithm ∗ for Z-Max-IPn,d for d = clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. A Dimensionality Reduction for Max-IP The reduction ψb,ℓ from Theorem 4.1 actually does more: for x, y ∈ {0, 1}b·ℓ , from ψb,ℓ (x) · ψb,ℓ (y) we can in fact determine the inner product x · y itself, not only whether x · y = 0. Starting from this observation, together with Theorem 4.3, we can in fact derive a similar dimensionality self reduction from Max-IP to Z-Max-IP, we deter its proof to Appendix A. Corollary 4.4. Let 1 ≤ ℓ ≤ d. There is an   log∗ d ·(d/ℓ)) O n · ℓO(6 · poly(d) -time log∗ d ·(d/ℓ)) reduction from Max-IPn,d to d · ℓO(6   ∗ bit-length O d/ℓ · log ℓ · 6log d . instances of Z-Max-IPn,(ℓ+1)2 , with vectors of entries with 4.4 Hardness for ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair We finish the whole section with the proof of hardness of ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair. The two reductions below are slight adaptations of the ones in the proofs of Theorem 1.2 and Corollary 2.1 in [Wil18]. Lemma 4.5. Assuming d = no(1) , there is an O(poly(d) · n)-time algorithm which reduces a Z-Max-IPn,d instance into an instance of ℓ2 -Furthest Pair on 2n points in Rd+2 . Moreover, if the Z-Max-IP instance consists of vectors of O(log n)-bit entries, so does the ℓ2 -Furthest Pair instance. Proof. Let A, B be the sets in the Z-Max-IPn,d instance, and k be the smallest integer such that all vectors from A and B consist of (k · log n)-bit entries. Let W be nC·k where C is a large enough constant. Given x ∈ A and y ∈ B, we construct point     p p and ye = −y, 0, W − kyk2 , x e = x, W − kxk2 , 0 that is, appending two corresponding values into the end of vectors x and −y. Now, we can see that for x1 , x2 ∈ A, the squared distance between their reduced points is Similarly we have kf x1 − f x2 k2 = kx1 − x2 k2 ≤ 4 · d · n2k . for y1 , y2 ∈ B. Next, for x ∈ A and y ∈ B, we have kye1 − ye2 k2 ≤ 4 · d · n2k ke x − yek2 = ke xk2 + ke y k2 − 2 · x e · ye = 2 · W + 2 · (x · y) ≥ 2 · W − d · n2k ≫ 4 · d · n2k , the last inequality holds when we set C to be 5. Putting everything together, we can see the ℓ2 -furthest pair among all points x e’s and ye’s must be a pair of x e and ye with x ∈ A and y ∈ B. And maximizing ke x − yek is equivalent to maximize x · y, which proves the correctness of our reduction. Furthermore, when k is a constant, the reduced instance clearly only needs vectors with O(k) · log n = O(log n)-bit entries. 27 Lemma 4.6. Assuming d = no(1) , there is an O(poly(d) · n)-time algorithm which reduces a Z-Max-IPn,d instance into an instance of Bichromatic ℓ2 -Closest Pair on 2n points in Rd+2 . Moreover, if the Z-Max-IP instance consists of vectors of O(log n)-bit entries, so does the Bichromatic ℓ2 -Closest Pair instance. Proof. Let A, B be the sets in the Z-Max-IPn,d instance, and k be the smallest integer such that all vectors from A and B consist of (k · log n)-bit entries. Let W be nC·k where C is a large enough constant. Given x ∈ A and y ∈ B, we construct point     p p and ye = y, 0, W − kyk2 , x e = x, W − kxk2 , 0 that is, appending two corresponding values into the end of vectors x and −y. And our reduced instance is e (consisting of all these x e (consisting to find the closest point between the set A e where x ∈ A) and the set B of all these ye where y ∈ B). Next, for x ∈ A and y ∈ B, we have ke x − yek2 = ke xk2 + ke y k2 − 2 · x e · ye = 2 · W − 2 · (x · y) ≥ 2 · W − d · n2k ≫ 4 · d · n2k , the last inequality holds when we set C to be 5. Hence minimizing ke x − yek where x ∈ A and y ∈ B is equivalent to maximize x · y, which proves the correctness of our reduction. Furthermore, when k is a constant, the reduced instance clearly only needs vectors with O(k) · log n = O(log n)-bit entries. Now Theorem 1.15 and Theorem 1.16 (restated below) are simple corollaries of Lemma 4.5, Lemma 4.6 and Theorem 1.14. ∗ Reminder of Theorem 1.15 [Hardness of ℓ2 -Furthest Pair in clog n Dimension] Assuming SETH (or OVC), ∗ there is a constant c such that ℓ2 -Furthest Pair in clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. ∗ Reminder of Theorem 1.16 [Hardness of Bichromatic ℓ2 -closest Pair in clog n Dimension] Assuming ∗ SETH (or OVC), there is a constant c such that Bichromatic ℓ2 -Closest Pair in clog n dimensions requires n2−o(1) time, with vectors of O(log n)-bit entries. 5 NP · UPP communication protocol and Exact Hardness for Z-Max-IP We note that the inapproximability results for (Boolean) Max-IP is established via a connection to the MA communication complexity protocol of Set-Disjointness [ARW17]. In the light of this, in this section we view our reduction from OV to Z-Max-IP (Lemma 1.17 and Theorem 4.3) in the perspective of communication complexity. We observe that in fact, our reduction can be understood as an NP · UPP communication protocol for Set Disjointness. Moreover, we show that if we can get a slightly better NP · UPP communication protocol for Set-Disjointness, then we would be able to prove Z-Max-IP is hard even for ω(1) dimensions (and also ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair). 5.1 NP · UPP Communication Protocol for Set-Disjointness First, we rephrase the results of Lemma 1.17 and Theorem 4.3 in a more convenience way for our use here. 28 log ∗ d ·(d/ℓ)) Lemma 5.1 (Rephrasing of Lemma 1.17 and Theorem 4.3). Let 1 ≤ ℓ ≤ d, and m = ℓO(6 exists a family of functions 2 i i ψAlice , ψBob : {0, 1}d → R(ℓ+1) . There for i ∈ [m] such that: i i • when x · y = 0, there is an i such that ψAlice (x) · ψBob (y) ≥ 0; i i • when x · y > 0, for all i ψAlice (x) · ψBob (y) < 0; i i • all ψAlice (x) and ψBob (y) can be computed in poly(d) time. From the above lemma, and the standard connection between UPP and sign-rank [PS86] (see also Chapter 4.11 of [Juk12]), we immediately get the communication protocol we want and prove Theorem 1.21 (restated below for convenience). Reminder of Theorem 1.21 For all 1 ≤ α ≤ n, there is an   ∗ α · 6log n · (n/2α ), O(α) -computational-efficient NP · UPP communication protocol for DISJn . i i Proof Sketch. We set α = log ℓ here. Given the function families {ψAlice }, {ψBob } from Lemma 5.1, Merlin just sends the index i ∈ [m], the rest follows from the connection between UPP protocols and sign-rank of matrices. 5.2 Slightly Better Protocols Imply Hardness in ω(1) Dimensions Finally, we show that if we have a slightly better NP · UPP protocol for Set-Disjointness, then we can show Z-Max-IP requires n2−o(1) time even for ω(1) dimensions (and so do ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair). We restate Theorem 1.22 here for convenience. Reminder of Theorem 1.22 Assuming SETH (or OVC), if there is an increasing and unbounded function f such that for all 1 ≤ α ≤ n, there is a (n/f (α), α) -computational-efficient NP · UPP communication protocol for DISJn , then Z-Max-IPn,ω(1) requires n2−o(1) time with vectors of polylog(n)-bit entries. The same holds for ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair. Proof. Suppose otherwise, there is an algorithm A for Z-Max-IPn,d running in n2−ε1 time for all constant d and for a constant ε1 > 0 (note for the sake of Lemma 4.5 and Lemma 4.6, we only need to consider Z-Max-IP here). Now, let c be an arbitrary constant, we are going to construct an algorithm for OVn,c log n in n2−Ω(1) time, which contradicts OVC. Let ε = ε1 /2, and α be the first number such that c/f (α) < ε, note that α is also a constant. Consider the (c log n/f (α), α)-computational-efficient NP · UPP protocol Π for DISJc log n , and let A, B be the two sets in the OVn,c log n instance. Our algorithm via reduction works as follows: • There are 2α possible messages in {0, 1}α , let m1 , m2 , . . . , m2α be an enumeration of them. 29 • We first enumerate all possible advice strings from Merlin in Π, there are 2c log n/f (α) ≤ 2ε·log n = nε such strings, let φ ∈ {0, 1}ε·log n be such an advice string. α – For each x ∈ A, let ψAlice (x) ∈ R2 be the probabilities that Alice accepts each message from Bob. That is, ψAlice (x)i is the probability that Alice accepts the message mi , given its input x and the advice φ. α – Similarly, for each y ∈ B, let ψBob (y) ∈ R2 be the probabilities that Bob sends each message. That is, ψBob (y)i is the probability that Bob sends the message mi , give its input y and the advice φ. – Then, for each x ∈ A and y ∈ B, ψAlice (x) · ψBob (y) is precisely the probability that Alice accepts at the end when Alice and Bob holds x and y correspondingly and the advice is φ. Now we let Aφ be the set of all the ψAlice (x)’s, and Bφ be the set of all the ψBob (y)’s. • If there is a φ such that OPT(Aφ , Bφ ) ≥ 1/2, then we output yes, and otherwise output no. From the definition of Π, it is straightforward to see that the above algorithm solves OVn,c·log n . Moreover, notice that from the computational-efficient property of Π, the reduction itself works in n1+ε ·polylog(n) time, and all the vectors in Aφ ’s and Bφ ’s have at most polylog(n) bit precision, which means OPT(Aφ , Bφ ) can be solved by a call to Z-Max-IPn,2α with vectors of polylog(n)-bit entries. Hence, the final running time for the above algorithm is bounded by nε · n2−ε1 = n2−ε (2α is still a constant), which contradicts the OVC. 6 Improved MA Protocols In this section we prove Theorem 1.24 (restated below for convenience). Reminder of Theorem 1.24 There is an MA protocol for DISJn and IPn with communication complexity p  O n log n log log n . To prove Theorem 1.24, we need the following intermediate problem. Definition 6.1 (The Inner Product Modulo p Problem (IPpn )). Let p and n be two positive integers, in IPpn , Alice and Bob are given two vectors X and Y in {0, 1}n , and they want to compute X · Y (mod p). Note that IPn and IPpn are not Boolean functions, so we need to generalize the definition of an MA protocol. In an MA protocol for IPn , Merlin sends the answer directly to Alice together with a proof to convince Alice and Bob. The correctness condition becomes that for the right answer X · Y , Merlin has a proof such that Alice and Bob will accept with high probability (like 2/3). And the soundness condition becomes that for the wrong answers, every proof from Merlin will be rejected with high probability. We are going to use the following MA protocol for IPpn , which is a slight adaption from the protocol in [Rub18]. Lemma 6.2 (Implicit in Theorem 3.1 of [Rub18]). For a sufficiently large prime q and integers T and n, there is an   O (n/T · log q) , log n + O(1), O (T · log q) , 1/2 -efficient MA protocol for IPqn . 30 Proof Sketch. The only adaption is that we just use the field Fq2 with respect to the given prime q. (In the original protocol it is required that q ≥ T .) Now we ready to prove Theorem 1.24. Proof of Theorem 1.24. Since a IPn protocol trivially implies a DISJn protocol, we only need to consider IPn in the following. Now, let x be the number such that xx = n, for convenience we are going to pretend that x is an integer. It is easy to see that x = Θ(log n/ log log n). Then we pick 10x distinct primes p1 , p2 , . . . , p10x in [x + 1, x2 ] (we can assume that n is large enough to make x satisfy the requirement of Lemma2.4). Let  T be a parameter, we use Πpi to denote the O (n/T · log pi ) , log n + O(1), O (T · log pi ) , 1/2 -efficient MA protocol for IPpni . Our protocol for IPn works as follows: • Merlin sends Alice all the advice strings from the protocols Πp1 , Πp2 , . . . , Πp10x , together with a presumed inner product 0 ≤ z ≤ n. • Note that Πpi contains the presumed value of X · Y (mod pi ), Alice first checks whether z is consistent with all these Πpi ’s, and rejects immediately if it does not. • Alice and Bob jointly toss O(log(10x)) coins, to pick a uniform random number i⋆ ∈ [10x], and then they simulate Πpi⋆ . That is, they pretend they are the Alice and Bob in the protocol Πpi⋆ with the advice from Merlin in Πpi⋆ (which Alice does have). Correctness. Let X, Y ∈ {0, 1}n be the vectors of Alice and Bob. If X · Y = z, then by the definition of these protocols Πpi ’s, Alice always accepts with the correct advice from Merlin. Otherwise, let d = X · Y 6= z, we are going to analyze the probability that we pick a “good” pi⋆ such that pi⋆ does not divide |d − z|. Since pi > x for all pi ’s and xx > n ≥ |d − z|, |d − z| cannot be a multiplier of more than x primes in pi ’s. Therefore, with probability at least 0.9, our pick of pi⋆ is good. And in this case, from the definition of the protocols Πpi ’s, Alice and Bob would reject afterward with probability at least 1/2, as d (mod pi⋆ ) differs from z (mod pi⋆ ). In summary, when X ·Y 6= z, Alice rejects with probability at least 0.9/2 = 0.45, which finishes the proof for the correctness. Complexity. Now, note that the total advice length is ! ! 10x 10x Y X  x2 = O n/T · log x20x = O (n/T · log n) . log pi = O n/T · log O n/T · i=1 i=1 And the communication complexity between Alice and Bob is bounded by  O T · log x2 = O (T · log log n) . p Setting T = n log n/ log log n balances the above two quantities, and we obtain the needed MAprotocol for DISJn . 31 7 Future Works We end our paper by discussing a few interesting research directions. • The most important open question from this paper is that can we further improve the dimensionality ∗ reduction for OV? It is certainly weird to consider 2O(log n) to be the right answer for the limit of the dimensionality reduction. This term seems more like a product of the nature of our recursive construction and not the problem itself. We conjecture that there should be an ω(1) dimensional reduction with a more direct construction. One possible direction is to combine the original polynomial-based construction from [Wil18] together with our new number theoretical one. These two approaches seem completely different, hence a clever combination of them may solve our problem. • In order to prove ω(1) dimensional hardness for ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair, we can also bypass the OV dimensionality reduction things by proving ω(1) dimensional hardness for Z-Max-IP directly. One possible way to approach this question is to start from the NP · UPP communication protocol connection as in Section 5 (apply Theorem 1.22), and (potentially) draw some connections from some known UPP communication protocols. • We have seen an efficient reduction from Z-OV to Z-Max-IP which only blows up the dimension quadratically, is there a similar reduction from Z-Max-IP back to Z-OV? Are Z-Max-IP and Z-OV equivalent? p e log n) factor from • By making use of the new AG-code based MA protocols, we can shave a O( √ the communication complexity, can we obtain an O( n) MA communication protocol matching the lower bound for DISJn ? It seems new ideas are required. Since our MA protocol works for both DISJ and IP, and IP does seems to be a harder problem. It √ may be better to find an MA protocol only works for DISJ. It is worth noting that an O( n) AMA communication protocol for DISJ is given by [Rub18], which doesn’t work for IP. • Can the dependence on ε in the algorithms from Theorem 1.5 be further improved? Is it possible to e √c) 2−1/Ω( apply ideas in the n algorithm for Max-IPn,c log n from [ACW16]? • For the complexity of 2-multiplicative-approximation to Max-IPn,c log n , Theorem 1.5 implies that there is an algorithm running in n2−1/O(log c) time, the same as the best algorithm for OVn,c log n [AWY15]. Is this just a coincidence? Or are there some connections between these two problems? • We obtain a connection between hardness of Z-Max-IP and NP · UPP communication protocols for Set-Disjointness. Can we get similar connections from other NP · C type communication protocols for Set-Disjointness? Some candidates include NP · SBP and NP · promiseBQP (QCMA). Acknowledgment I would like to thank Ryan Williams for introducing the problem to me, countless encouragement and helpful discussions during this work, and also many comments on a draft of this paper. In particular, the idea of improving OV dimensionality self-reduction using CRT (the direct CRT based approach) is introduced to me by Ryan Williams. I am grateful to Virginia Vassilevska Williams, Kaifeng Lv, Peilin Zhong for helpful discussions and suggestions.pI would like to thank Aviad Rubinstein for sharing a manuscript of his paper, and pointing out that the O( n log n log log n) MA protocol also works for Inner Product. 32 A Dimensionality Reduction for Max-IP A In fact, tracing the proof of Theorem 4.1, we observe that it is possible to compute the inner product x · y itself from ψb,ℓ (x) · ψb,ℓ (y), that is: Corollary A.1. Let b, ℓ be two sufficiently large integers. There is a reduction ψb,ℓ : {0, 1}b·ℓ → Zℓ and 0 1 b·ℓ b · ℓ + 1 sets Vb,ℓ , Vb,ℓ , . . . , Vb,ℓ ⊆ Z, such that for every x, y ∈ {0, 1}b·ℓ , k x · y = k ⇔ ψb,ℓ (x) · ψb,ℓ (y) ∈ Vb,ℓ and for all 0 ≤ k ≤ b · ℓ, log∗ (b) ·b 0 ≤ ψb,ℓ (x)i < ℓ6 k for all possible x and i ∈ [ℓ]. Moreover, the computation of ψb,ℓ (x) takes poly(b · ℓ) time, and the sets Vb,ℓ ’s   ∗ log (b) ·b) can be constructed in O ℓO(6 · poly(b · ℓ) time. Together with Theorem 4.3, it proves Corollary 4.4 (restated below). Reminder of Corollary 4.4 Let 1 ≤ ℓ ≤ d. There is an   log∗ d ·(d/ℓ)) O n · ℓO(6 · poly(d) -time log∗ d ·(d/ℓ)) reduction from Max-IPn,d to d · ℓO(6   ∗ bit-length O d/ℓ · log ℓ · 6log d . instances of Z-Max-IPn,(ℓ+1)2 , with vectors of entries with Proof Sketch. Let b = d/ℓ (assume ℓ divides d here for simplicity), A and B be the sets in the given Max-IPn,d instance, we proceed similarly as the case for OV. k We first enumerate a number k from 0 to d, for each k we construct the set Vb,ℓ as specified in Corollary A.1. Then there is (x, y) ∈ A × B such that x · y = k if and only if there is (x, y) ∈ A × B such that k . Using exactly the same reduction as in Lemma 1.17, we can in turn reduce this into ψb,ℓ (x) · ψb,ℓ (y) ∈ Vb,ℓ log∗ (b) ·b) ℓO(6 instances of Z-OVn,ℓ+1 . log∗ (b) ·b) Applying Theorem 4.3, with evaluation of (d + 1) · ℓO(6 Z-Max-IPn,(ℓ+1)2 instances, we can determine whether there is (x, y) ∈ A × B such that x · y = k for every k, from which we can compute the answer to the Max-IPn,d instance. B Nonuniform to Uniform Transformation for Dimensionality Reduction for OV In this section we discuss the transformation from nonuniform construction to uniform one for dimensionality reduction for OV. In order to state our result formally, we need to introduce some definitions. Definition B.1 (Nonuniform Reduction). Let b, ℓ, κ ∈ N. We say a function ϕ : {0, 1}b·ℓ → Zℓ together with a set V ⊆ Z is a (b, ℓ, κ)-reduction, if the following holds: • For every x, y ∈ {0, 1}b·ℓ , • For every x and i ∈ [ℓ], x · y = 0 ⇔ ϕ(x) · ϕ(y) ∈ V. 0 ≤ ϕ(x)i < ℓκ·b . 33 Similarly, let τ be an increasing function, we say a function family {ϕb,ℓ }b,ℓ together with a set family {Vb,ℓ }b,ℓ is a τ -reduction family, if for every b and ℓ, (ϕb,ℓ , Vb,ℓ ) is a (b, ℓ, τ (b))-reduction. Moreover, if for all b and all ℓ ≤ log log log b, there is an algorithm  A which computes  ϕb,ℓ (x) in poly(b) time given b, ℓ and x ∈ {0, 1}b·ℓ , and constructs the set Vb,ℓ in O ℓO(τ (b)·b) · poly(b) time given b and ℓ, then we call (ϕb,ℓ , Vb,ℓ ) a uniform-τ -reduction family. Remark B.2. The reason we assume ℓ to be small is that in our applications we  only care  about very small log∗ b -reduction family, ℓ, and that greatly simplifies the notation. From Theorem 4.1, there is a uniform- 6 and a better uniform-reduction family implies better hardness for Z-OV and other related problems as well (Lemma 1.17, Theorem 4.3, Lemma 4.6 and Lemma 4.5). Now we are ready to state our nonuniform to uniform transformation result formally. Theorem B.3. Letting τ be an increasing function such that τ (n) = O(log log log n) and supposing there is a τ -reduction family, then there is a uniform-O(τ )-reduction family. Proof Sketch. The construction in Theorem 4.1 is recursive, it constructs the reduction ψb,ℓ from a much smaller reduction ψbmicro ,ℓ , where bmicro ≤ log b. In the original construction, it takes log∗ b recursions to make the problem sufficiently small so that a direct construction can be used. Here we only apply the reduction thrice. First let us abstract the following lemma from the proof of Theorem 4.1. Lemma B.4 (Implicit in Theorem 4.1). Letting b, ℓ, bmicro , κ ∈ N and supposing ℓκ·bmicro = b and there is a (bmicro , ℓ, κ)-reduction (ϕ, V ′ ), the following holds: • There is a (b, ℓ, 6 · κ)-reduction (ψ, V ). • Given (ϕ, V ′ ), for all x ∈{0, 1}b·ℓ , ψ(x) can be computed in poly(b · ℓ), and V can be constructed in O ℓO(κ·b) · poly(b · ℓ) time. Now, let b, ℓ ∈ N, we are going to construct our reduction as follows. Let b1 be the number such that 2 ℓτ (b)·6 ·b1 = b, and similarly we set b2 and b3 so that ℓτ (b)·6·b2 = b1 and ℓτ (b)·b3 = b2 . We can calculate from above that b3 ≤ log log log b. From the assumption that there is a τ -reduction, there is a (b3 , ℓ, τ (b3 ))-reduction (ϕb3 ,ℓ , Vb3 ,ℓ ), which is also a (b3 , ℓ, τ (b))-reduction, as τ is increasing. Note that we can assume ℓ ≤ log log log b and τ (b) ≤ log log log b from assumption. Now we simply use a brute force algorithm to find (ϕb3 ,ℓ , Vb3 ,ℓ ). There are b3 ·ℓ ℓτ (b)·b3 ·ℓ·2 = bo(1) possible functions from {0, 1}b3 ·ℓ → {0, . . . ℓτ (b3 )·b3 − 1}ℓ . Given such a function ϕ, one can check in poly(2b3 ·ℓ ) = bo(1) time that whether one can construct a corresponding set V to obtain our (b3 , ℓ, τ (b))reduction. Applying Lemma B.4 thrice, one obtain a (b, ℓ, O(τ (b)))-reduction (ψ, V ). And since ϕb3 ,ℓ can be found in bo(1) time, together with Lemma B.4, we obtain a uniform-τ -reduction family. 34 Finally, we give a direct corollary of Theorem B.3 that the existence of an O(1)-reduction family implies hardness of Z-OV, Z-Max-IP, ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair in ω(1) dimensions. Corollary B.5. If there is an O(1)-reduction family, then for every ε > 0, there exists a c ≥ 1 such that Z-OV, Z-Max-IP, ℓ2 -Furthest Pair and Bichromatic ℓ2 -Closest Pair in c dimensions with O(log n)-bit entries require n2−ε time. Proof Sketch. Note that since its hardness implies the harnesses of other three, we only need to consider Z-OV here. From Theorem B.3 and the assumption, there exists a uniform-O(1)-reduction. Proceeding similar as in Lemma 1.17 with the uniform-O(1)-reduction, we obtain a better dimensionality self reduction from OV to Z-OV. Then exactly the same argument as in Theorem 1.18 with different parameters gives us the lower bound required. C Hardness of Approximate {−1, 1}-Max-IP via Approximate Polynomial for OR √ We first show that making use of the O( n)-degree approximate polynomial for OR [BCDWZ99, dW08], OV can be reduced to approximating {−1, 1}-Max-IP. Theorem C.1. Letting ε ∈ (0, 1), an OVn,d instance with sets A, B reduces to a {−1, 1}-Max-IPn,d1 e and B, e such that: instance with sets A 3    √  m   X d n n O d log 1/ε −1   p ·2 • d1 = · ε , in which the notation denotes . ≤m i ≤O d log 1/ε i=0 • There is an integer T > ε−1 such that if there is an (a, b) ∈ A × B such that a · b = 0, then e B) e ≥ T. OPT(A, e B)| e ≤ T · ε. • Otherwise, |OPT(A, • Moreover, the reduction takes n · poly(d1 ) time. We remark here that the above reduction fails to achieve a characterization: setting ε = 1/2 and d = e √ c log n for an arbitrary constant c, we have d1 = 2O( log n) , much larger than log n. Another interesting difference between the above theorem and Lemma 3.3 (the reduction from OV to approximating Max-IP) is that Lemma 3.3 reduces one OV instance to many Max-IP instances, while the above reduction only reduces it to one {−1, 1}-Max-IP instance. Proof of Theorem C.1. Construction and Analysis of Polynomial Pε (z). By [BCDWZ99, dW08], there is a polynomial Pε : {0, 1}d → R such that: • Pε is of degree D = O p  d log 1/ε . • For every z ∈ {0, 1}d , Pε (z) ∈ [0, 1]. • Given z ∈ {0, 1}d , if OR(z) = 0, then Pε (z) ≥ 1 − ε, otherwise Pε (z) ≤ ε. • Pε can be constructed in time polynomial in its description size. 35 Now, let us analyze Pε further. For a set S ⊆ [d], let χS : {0, 1}d → R be χS (z) := we can write Pε as: Pε := X S⊆[d],|S|≤D Y (−1)zi . Then i∈S χS · hχS , Pε i, where hχS , Pε i is the inner product of χS and Pε , defined as hχS , Pε i := Ex∈{0,1}d χS (x) · Pε (x). Let cS = hχS , Pε i, from the definition it is easy to see that cS ∈ [−1, 1]. Discretization of Polynomial Pε . Note that Pε (z) has real coefficients, we need to turn it into another polynomial with  integer  coefficients first. d Let M := , consider the following polynomial Pbε : ≤D X Pbε := ⌊cS · 2M/ε⌋ · χS . S⊆[d],|S|≤D We can see that |Pbε (z)/(2M/ε) − Pε (z)| ≤ ε for every z ∈ {0, 1}d , and we let ĉS := ⌊cS · M · 2/ε⌋ for convenience. Simplification of Polynomial Pbε . Pbε (z) is expressed over the basis χS ’s, we need to turn it into a polynomial over standard basis. For each S ⊆ [d], consider χS , it can also be written as: X Y Y (−2)|T | zT , (1 − 2zi ) = (−1)zi := χS (z) = where zT := i∈T T ⊆S i∈S i∈S Y zi . Plugging it into the expression of Pbε , we have Pbε (z) := Set X T ⊆[d],|T |≤D    X S⊆[d],|S|≤D,T ⊆S X c̃T :=  S⊆[d],|S|≤D,T ⊆S the above simplifies to Pbε (z) := X   ĉS  · (−2)|T | zT . ĉS  · (−2)|T | , T ⊆[d],|T |≤D c̃T · zT . Properties of Polynomial Pbε . Let us summarize some properties of Pbε for now. First we need a bound on |c̃T |, we can see |ĉS | ≤ M · 2/ε, and by a simple calculation we have |c̃T | ≤ M 2 · 2D · 2/ε. Let B = M 2 ·2D ·2/ε for convenience. For x, y ∈ {0, 1}d , consider Pbε (x, y) := Pbε (x1 y1 , x2 y2 , . . . , xd yd ) (that is, plugging in zi = xi yi ), we have X Pbε (x, y) := c̃T · xT · yT , where xT := Y T ⊆[d],|T |≤D xi and yT is defined similarly. Moreover, we have i∈T 36 • If x · y = 0, then Pbε (x, y) ≥ (2M/ε) · (1 − 2ε). • If x · y 6= 0, then |Pbε (x, y)| ≤ (2M/ε) · 2ε. The Reduction. Now, let us construct the reduction, we begin with some notations. For two vectors a, b, we use a ◦ b to denote their concatenation. For a vector a and a real x, we use a · x to denote the vector resulting from multiplying each coordinate of a by x. Let sgn(x) be the sign function that outputs 1 when x > 0, −1 when x < 0, and 0 when x = 0. For x ∈ {−B, −B + 1, . . . , B}, we use ex ∈ {−1, 0, 1}B to denote the vector whose first |x| elements are sgn(x) and the rest are zeros. We also use 1 to denote the all-1 vector with length B. Let T1 , T2 , . . . , TM be an enumeration of all subsets T ⊆ [d] such that |T | ≤ D, we define M ϕx (x) := ◦M i=1 (ec̃Ti · xTi ) and ϕy (y) := ◦i=1 (1 · yTi ). And we have ϕx (x) · ϕy (y) = M X i=1 (ec̃Ti · 1) · (xTi · yTi ) = M X i=1 c̃Ti · xTi · yTi = Pbε (x, y). To move from {−1, 0, 1} to {−1, 1}, we use the following carefully designed reductions ψx , ψy : {−1, 0, 1} → {−1, 1}2 , such that ψx (−1) = ψy (−1) = (−1, −1), ψx (0) = (−1, 1), ψy (0) := (1, −1), and ψx (1) = ψy (1) = (1, 1). It is easy to check that for x, y ∈ {−1, 0, 1}, we have ψx (x) · ψy (y) = 2 · (x · y). Hence, composing the above two reductions, we get our desired reductions φx = ψx⊗(B·M ) ◦ϕx and φy = ψy⊗(B·M ) ◦ ϕy such that for x, y ∈ {0, 1}d , φx (x), φy (y) ∈ {−1, 1}2B·M and φx (x) · φy (y) = 2 · Pbε (x, y). e and B, e such that A e Finally, given an OVn,d instance with two sets A and B, we construct two sets A e consists of all φy (y)’s for y ∈ B. consists of all φx (x)’s for x ∈ A, and B e and B e consist of n vectors from {−1, 1}d1 , where Then we can see A 3 D d1 = 2B · M = M · 2 · 2/ε =  3 √   · 2O d log 1/ε · ε−1 p d d log 1/ε ≤O as stated. It is not hard to see the above reduction takes n · poly(d1 ) time. Moreover, if there is a (x, y) ∈ A × B e B) e ≥ (4M/ε) · (1 − 2ε), otherwise, OPT(A, e B) e ≤ (4M/ε) · 2ε. Setting such that x · y = 0, then OPT(A, ε above to be 1/3 times the ε in the statement finishes the proof. With Theorem C.1, we are ready to prove our hardness results on {−1, 1}-Max-IP. Theorem C.2. Assume SETH (or OVC). Letting α : N → R be any function of n such that α(n) = no(1) , there is another function β satisfying β(n) = no(1) and an integer T > α (β and T depend on α), such that there is no n2−Ω(1) -time algorithm for {−1, 1}-Max-IPn,β(n) distinguishing the following two cases: • OPT(A, B) ≥ T (A and B are the sets in the {−1, 1}-Max-IP instance). • |OPT(A, B)| ≤ T /α(n). 37 Proof. Letting α = no(1) and k = log α/ log n, we have k = o(1). Setting d = c log n where c is an arbitrary constant and ε = α−1 in Theorem C.1, we have that an OVc log n reduces to a certain α(n)approximation to a {−1, 1}-Max-IPn,d1 instance with sets A and B, where d1 =   √ O(√ck log n) 3 √ √ √ c log n c √ · 2O( ck log n) = nO(log(c/k)· ck) . · 2O( ck log n) ≤ √ ≤ O( ck log n) k 1/3 Now set β = nk and T be the integer specified by Theorem C.1, since k = o(1), β = no(1) . Suppose otherwise there is an n2−Ω(1) -time algorithm for√ distinguishing whether OPT(A, B) ≥ T or |OPT(A, B)| ≤ T /α(n). Then for any constant c, O(log(c/k) ck) ≤ k1/3 for sufficiently large n, which means d1 ≤ β(n) for a sufficiently large n, and there is an n2−Ω(1) -time algorithm for OVc log n by Theorem C.1, contradiction to OVC. D A Proof of Lemma 3.3 Finally, we present a proof of Lemma 3.3, which is implicit in [Rub18]. We need the following efficient MA protocol for Set-Disjointness from [Rub18], which is also used in [KLM17].13 Lemma D.1 (Theorem 3.2 of [Rub18]). For every α and m, there is an (m/α, log 2 m, poly(α), 1/2)efficient MA protocol for DISJm . We want to reduce the error probability while keeping the number of total random coins relatively low. To achieves this, we can use an expander graph (Theorem 2.7) to prove the following theorem. Lemma D.2. For every α, m and ε < 1/2, there is an (m/α, log 2 m + O(log ε−1 ), poly(α) · log ε−1 , ε)efficient MA protocol for DISJm . −1 −1 Proof. Let c1 and F : {0, 1}log m+c1 ·log ε → [m]c1 ·log ε be the corresponding constant and function as in Theorem 2.7, and let Π denote the (m/α, log 2 m, poly(α), 1/2)-efficient MA protocol for DISJm in Lemma D.1. Set q = c1 · log ε−1 and our new protocol Πnew works as follows: • Merlin still sends the same advice to Alice as in Π. • Alice and Bob jointly toss r = log m+q coins to get a string w ∈ {0, 1}r . Then we let w1 , w2 , . . . , wq be the sequence corresponding to F(w), each of them can be interpreted as log m bits. • Bob sends Alice q messages, the i-th message mi corresponds to Bob’s message in Π when the random bits is wi . • After that, Alice decides whether to accept or not as follows: – If for every i ∈ [q], Alice would accept Bob’s message mi with random bits wi in Π, then Alice accepts. – Otherwise, Alice rejects. 13 The protocol in [KLM17] also works for the k-party number-in-hand model. 38 It is easy to verify that the advice length, message length and number of random coins satisfy our requirements. For the error probability, note that when these two sets are disjoint, the same advice in Π leads to acceptance of Alice. Otherwise, suppose the advice from Merlin is either wrong or these two sets are intersecting, then half of the random bits in {0, 1}log m leads to the rejection of Alice in Π. Hence, from Theorem 2.7, with probability at least 1 − ε, at least one of the random bits wi ’s would lead to the rejection of Alice, which completes the proof. Finally we are going to prove Lemma 3.3, we recap it here for convenience. Reminder of Lemma 3.3 There is a universal constant c1 such that, for every integer c, reals ε ∈ (0, 1] and τ ≥ 2, OVn,c log n can be reduced to nε Max-IPn,d instances (Ai , Bi ) for i ∈ [nε ], such that: • d = τ poly(c/ε) · log n. • Letting T = c log n · τ c1 , if there is a ∈ A and b ∈ B such that a · b = 0, then there exists an i such that OPT(Ai , Bi ) ≥ T . • Otherwise, for all i we must have OPT(Ai , Bi ) ≤ T /τ . Proof. The reduction follows exactly the same as in [ARW17], we recap here for completeness. Set α = c/ε, m = c · log n and ε = 1/τ , and let Π be the (m/α, log 2 m + O(log ε−1 ), poly(α) · log ε−1 , ε)-efficient MA protocol for Set-Disjointness as in Lemma D.2. Now, we first enumerate all of 2m/α = 2ε·log n = nε possible advice strings, and create an Max-IP instance for each of the advice strings. For a fix advice ψ ∈ {0, 1}ε·log n , we create an Max-IP instance with sets Aψ and Bψ as follows. We use a ◦ b to denote the concatenation of the strings a and b. Let r = log2 m + c1 · log ε−1 , where c1 is the constant hidden in the big O notation in Lemma D.2, and ℓ = poly(α) · log ε−1 . Let m1 , m2 , . . . , m2ℓ be an enumeration of all strings in {0, 1}ℓ . ℓ • For each a ∈ A, and for each string w ∈ {0, 1}r , we create a vector aw ∈ {0, 1}2 , such that aw i indicates that given advice ψ and randomness w, whether Alice accepts message mi or not (1 for acceptance, 0 for rejection). Let the concatenation of all these aw ’s be aψ . Then Aψ is the set of all these aψ ’s for a ∈ A. ℓ • For each b ∈ B, and for each string w ∈ {0, 1}r , we create a vector bw ∈ {0, 1}2 , such that bw i = 1 if Bob sends the message mi given advice ψ and randomness w, and = 0 otherwise. Let the concatenation of all these bw ’s be bψ . Then Bψ is the set of all these bψ ’s for b ∈ B. We can see that for a ∈ A and b ∈ B, aψ · bψ is precisely the number of random coins leading Alice to accept the message from Bob given advice ψ when Alice and Bob holds a and b correspondingly. Therefore, let T = 2r = c log n · τ c1 , from the properties of the protocol Π, we can see that: • If there is a ∈ A and b ∈ B such that a · b = 0, then there is ψ ∈ {0, 1}ε·log n such that aψ · bψ ≥ T . • Otherwise, for all a ∈ A, b ∈ B and advice ψ{0, 1}ε·log n , aψ · bψ ≤ T /τ . And this completes the proof. 39 References [AB09] Sanjeev Arora and Boaz Barak. Computational Complexity - A Modern Approach. Cambridge University Press, 2009. [AB17] Amir Abboud and Arturs Backurs. Towards hardness of approximation for polynomial time problems. In LIPIcs-Leibniz International Proceedings in Informatics, volume 67. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2017. [ACW16] Josh Alman, Timothy M Chan, and Ryan Williams. Polynomial representations of threshold functions and algorithmic applications. In Foundations of Computer Science (FOCS), 2016 IEEE 57th Annual Symposium on, pages 467–476. IEEE, 2016. [AESW91] Pankaj K Agarwal, Herbert Edelsbrunner, Otfried Schwarzkopf, and Emo Welzl. Euclidean minimum spanning trees and bichromatic closest pairs. Discrete & Computational Geometry, 6(3):407–422, 1991. [AI06] Alexandr Andoni and Piotr Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In Proc. of the 47th FOCS, pages 459–468. IEEE, 2006. [AIL+ 15] Alexandr Andoni, Piotr Indyk, Thijs Laarhoven, Ilya Razenshteyn, and Ludwig Schmidt. Practical and optimal lsh for angular distance. In Advances in Neural Information Processing Systems, pages 1225–1233, 2015. [AINR14] Alexandr Andoni, Piotr Indyk, Huy L Nguyen, and Ilya Razenshteyn. Beyond localitysensitive hashing. In Proc. of the 25th SODA, pages 1018–1028. SIAM, 2014. [Apo13] Tom M. Apostol. Introduction to analytic number theory. Springer Science & Business Media, 2013. [APRS16] Thomas Dybdahl Ahle, Rasmus Pagh, Ilya Razenshteyn, and Francesco Silvestri. On the complexity of inner product similarity join. In Proceedings of the 35th ACM SIGMOD-SIGACTSIGAI Symposium on Principles of Database Systems, pages 151–164. ACM, 2016. [AR15] Alexandr Andoni and Ilya Razenshteyn. Optimal data-dependent hashing for approximate near neighbors. In Proc. of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, pages 793–801. ACM, 2015. [AR18] Amir Abboud and Aviad Rubinstein. Fast and deterministic constant factor approximation algorithms for lcs imply new circuit lower bounds. In LIPIcs-Leibniz International Proceedings in Informatics, volume 94. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2018. [ARW17] Amir Abboud, Aviad Rubinstein, and R. Ryan Williams. Distributed PCP theorems for hardness of approximation in P. In 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 15-17, 2017, pages 25–36, 2017. [AV14] Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lower bounds for dynamic problems. In Proc. of the 55th FOCS, pages 434–443, 2014. [AVW14] Amir Abboud, Virginia Vassilevska Williams, and Oren Weimann. Consequences of faster alignment of sequences. In Proc. of the 41st ICALP, pages 39–51, 2014. 40 [AVY15] Amir Abboud, Virginia Vassilevska Williams, and Huacheng Yu. Matching triangles and basing hardness on an extremely popular conjecture. In Proceedings of the forty-seventh annual ACM symposium on Theory of computing, pages 41–50. ACM, 2015. [AW09] Scott Aaronson and Avi Wigderson. Algebrization: A new barrier in complexity theory. TOCT, 1(1):2:1–2:54, 2009. [AW15] Josh Alman and Ryan Williams. Probabilistic polynomials and hamming nearest neighbors. In Proc. of the 56th FOCS, pages 136–150. IEEE, 2015. [AWY15] Amir Abboud, Ryan Williams, and Huacheng Yu. More applications of the polynomial method to algorithm design. In Proceedings of the Twenty-Sixth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 218–230. Society for Industrial and Applied Mathematics, 2015. [BCDWZ99] Harry Buhrman, Richard Cleve, Ronald De Wolf, and Christof Zalka. Bounds for small-error and zero-error quantum algorithms. In Foundations of Computer Science, 1999. 40th Annual Symposium on, pages 358–368. IEEE, 1999. [BCW98] Harry Buhrman, Richard Cleve, and Avi Wigderson. Quantum vs. classical communication and computation. In Proceedings of the thirtieth annual ACM symposium on Theory of computing, pages 63–68. ACM, 1998. [BGL16] Karl Bringmann, Allan Grønlund, and Kasper Green Larsen. A dichotomy for regular expression membership testing. arXiv preprint arXiv:1611.00918, 2016. [BI15] Arturs Backurs and Piotr Indyk. Edit Distance Cannot Be Computed in Strongly Subquadratic Time (unless SETH is false). In Proc. of the 47th Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 51–58, 2015. [BI16] Arturs Backurs and Piotr Indyk. Which regular expression patterns are hard to match? In Proc. of the 57th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 457–466, 2016. [BK18] Karl Bringman and Marvin Künnemann. Multivariate fine-grained complexity of longest common subsequence. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1216–1235. SIAM, 2018. [Bri14] Karl Bringmann. Why walking the dog takes time: Frechet distance has no strongly subquadratic algorithms unless SETH fails. In Proc. of the 55th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pages 661–670, 2014. [BS76] Jon Louis Bentley and Michael Ian Shamos. Divide-and-conquer in multidimensional space. In Proceedings of the eighth annual ACM symposium on Theory of computing, pages 220– 230. ACM, 1976. [Cha08] Timothy M Chan. A (slightly) faster algorithm for klee’s measure problem. In Proceedings of the twenty-fourth annual symposium on Computational geometry, pages 94–100. ACM, 2008. [Chr17] Tobias Christiani. A framework for similarity search with space-time tradeoffs using localitysensitive filtering. In Proc. of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 31–46. SIAM, 2017. 41 [CIP09] Chris Calabro, Russell Impagliazzo, and Ramamohan Paturi. The complexity of satisfiability of small depth circuits. In IWPEC, volume 5917, pages 75–85. Springer, 2009. [Cop82] Don Coppersmith. Rapid multiplication of rectangular matrices. SIAM Journal on Computing, 11(3):467–471, 1982. [CP16] Tobias Christiani and Rasmus Pagh. Set similarity search beyond minhash. arXiv preprint arXiv:1612.07710, 2016. [CT15] Svyatoslav Covanov and Emmanuel Thomé. Fast integer multiplication using generalized fermat primes. arXiv preprint arXiv:1502.02800, 2015. [DHKP97] Martin Dietzfelbinger, Torben Hagerup, Jyrki Katajainen, and Martti Penttonen. A reliable randomized algorithm for the closest-pair problem. Journal of Algorithms, 25(1):19–51, 1997. [DKL16] Roee David, CS Karthik, and Bundit Laekhanukit. On the complexity of closest pair via polar-pair of point-sets. CoRR, abs/1608.03245, 2016. [dW08] Ronald de Wolf. A note on quantum algorithms and the minimal degree of epsilon-error polynomials for symmetric functions. arXiv preprint arXiv:0802.1816, 2008. [Für09] Martin Fürer. Faster integer multiplication. SIAM Journal on Computing, 39(3):979–1005, 2009. [GIKW17] Jiawei Gao, Russell Impagliazzo, Antonina Kolokolova, and R. Ryan Williams. Completeness for first-order properties on sparse structures with algorithmic applications. In Proc. of the 28th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2162–2181, 2017. [Gro96] Lov K Grover. A fast quantum mechanical algorithm for database search. In Proceedings of the twenty-eighth annual ACM symposium on Theory of computing, pages 212–219. ACM, 1996. [GU18] Francois Le Gall and Florent Urrutia. Improved rectangular matrix multiplication using powers of the coppersmith-winograd tensor. In Proceedings of the Twenty-Ninth Annual ACMSIAM Symposium on Discrete Algorithms, pages 1029–1046. SIAM, 2018. [HVDHL16] David Harvey, Joris Van Der Hoeven, and Grégoire Lecerf. Even faster integer multiplication. Journal of Complexity, 36:1–30, 2016. [IM98] Piotr Indyk and Rajeev Motwani. Approximate nearest neighbors: towards removing the curse of dimensionality. In Proc. of the thirtieth annual ACM symposium on Theory of computing, pages 604–613. ACM, 1998. [IP01] Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-sat. J. Comput. Syst. Sci., 62(2):367–375, 2001. [Juk12] Stasys Jukna. Boolean function complexity: advances and frontiers, volume 27. Springer Science & Business Media, 2012. [KKK16] Matti Karppa, Petteri Kaski, and Jukka Kohonen. A faster subquadratic algorithm for finding outlier correlations. In Proc. of the Twenty-Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pages 1288–1305. Society for Industrial and Applied Mathematics, 2016. 42 [Kla03] Hartmut Klauck. Rectangle size bounds and threshold covers in communication complexity. In Computational Complexity, 2003. Proceedings. 18th IEEE Annual Conference on, pages 118–134. IEEE, 2003. [KLM17] C.S. Karthik, Bundit Laekhanukit, and Pasin Manurangsi. On the parameterized complexity of approximating dominating set. arXiv preprint arXiv:1711.11029, 2017. [KM95] Samir Khuller and Yossi Matias. A simple randomized sieve algorithm for the closest-pair problem. Information and Computation, 118(1):34–37, 1995. [KT17] Robert Krauthgamer and Ohad Trabelsi. Conditional lower bounds for all-pairs max-flow. arXiv preprint arXiv:1702.05805, 2017. [Mat92] Jiřı́ Matoušek. Efficient partition trees. Discrete & Computational Geometry, 8(3):315–334, 1992. [Mat93] Jiřı́ Matoušek. Range searching with efficient hierarchical cuttings. Discrete & Computational Geometry, 10(2):157–182, 1993. [NS15] Behnam Neyshabur and Nathan Srebro. On symmetric and asymmetric lshs for inner product search. In Proc. of the 32nd International Conference on Machine Learning, ICML, pages 1926–1934, 2015. [PS86] Ramamohan Paturi and Janos Simon. Probabilistic communication complexity. Journal of Computer and System Sciences, 33(1):106–123, 1986. [PW10] Mihai Pătraşcu and Ryan Williams. On the possibility of faster sat algorithms. In Proc. of the twenty-first annual ACM-SIAM symposium on Discrete Algorithms, pages 1065–1075. SIAM, 2010. [RG12] Parikshit Ram and Alexander G Gray. Maximum inner-product search using cone trees. In Proc. of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 931–939. ACM, 2012. [RR+ 07] Ali Rahimi, Benjamin Recht, et al. Random features for large-scale kernel machines. In NIPS, volume 3, page 5, 2007. [Rub18] Aviad Rubinstein. Hardness of approximate nearest neighbor search. In STOC, page To appear, 2018. [RV13] Liam Roditty and Virginia Vassilevska Williams. Fast approximation algorithms for the diameter and radius of sparse graphs. In Proc. of the 45th Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 515–524, 2013. [SL14] Anshumali Shrivastava and Ping Li. Asymmetric lsh (alsh) for sublinear time maximum inner product search (mips). In Advances in Neural Information Processing Systems, pages 2321– 2329, 2014. [SL15] Anshumali Shrivastava and Ping Li. Asymmetric minwise hashing for indexing binary inner products and set containment. In Proc. of the 24th International Conference on World Wide Web, pages 981–991. ACM, 2015. [TG16] Christina Teflioudi and Rainer Gemulla. Exact and approximate maximum inner product search with lemp. ACM Transactions on Database Systems (TODS), 42(1):5, 2016. 43 [Val15] Gregory Valiant. Finding correlations in subquadratic time, with applications to learning parities and the closest pair problem. Journal of the ACM (JACM), 62(2):13, 2015. [Vas18] Virginia Vassilevska Williams. On some fine-grained questions in algorithms and complexity. In To appear in the proceedings of the ICM, 2018. [Wil05] R. Ryan Williams. A new algorithm for optimal 2-constraint satisfaction and its implications. Theoretical Computer Science, 348(2–3):357–365, 2005. [Wil14] Ryan Williams. Faster all-pairs shortest paths via circuit complexity. In Proceedings of the forty-sixth annual ACM symposium on Theory of computing, pages 664–673. ACM, 2014. [Wil18] Ryan Williams. On the difference between closest, furthest, and orthogonal pairs: Nearlylinear vs barely-subquadratic complexity. In Proceedings of the Twenty-Ninth Annual ACMSIAM Symposium on Discrete Algorithms, pages 1207–1215, 2018. [WY14] Ryan Williams and Huacheng Yu. Finding orthogonal vectors in discrete structures. In Proceedings of the twenty-fifth annual ACM-SIAM symposium on Discrete algorithms, pages 1867–1877. SIAM, 2014. [Yao82] Andrew Chi-Chih Yao. On constructing minimum spanning trees in k-dimensional spaces and related problems. SIAM Journal on Computing, 11(4):721–736, 1982. 44
8cs.DS
Adaptive Bee Colony in an Artificial Bee Colony for Solving Engineering Design Problems 1 Tarun Kumar Sharma, 2Millie Pant, 3V.P.Singh 1, 2 Indian Institute of Technology Roorkee, Roorkee, India 3 Director General, SCET, Saharanpur, India Email:{taruniitr1; millidma; singhvp3}@gmail.com Abstract – A wide range of engineering design problems have been solved by the algorithms that simulates collective intelligence in swarms of birds or insects. The Artificial Bee Colony or ABC is one of the recent additions to the class of swarm intelligence based algorithms that mimics the foraging behavior of honey bees. ABC consists of three groups of bees namely employed, onlooker and scout bees. In ABC, the food locations represent the potential candidate solution. In the present study an attempt is made to generate the population of food sources (Colony Size) adaptively and the variant is named as A-ABC. A-ABC is further enhanced to improve convergence speed and exploitation capability, by employing the concept of elitism, which guides the bees towards the best food source. This enhanced variant is called E-ABC. The proposed algorithms are validated on a set of standard benchmark problems with varying dimensions taken from literature and on five engineering design problems. The numerical results are compared with the basic ABC and three recent variant of ABC. Numerically and statistically simulated results illustrate that the proposed method is very efficient and competitive. Keywords –Artificial Bee Colony; ABC; Optimization; Colony Size; Convergence 1. Introduction Evolutionary Programming (EP) [1], Genetic Algorithms (GA) [2], Particle Swarm Optimization (PSO) [3], Differential Evolution (DE) [4], Ant colony optimization (ACO) [5], and the like, are some algorithms to solve many complex real world problems that include engineering, biology, finance, etc [6]-[16]. These algorithms are inspired by the collective intelligent behavior of some species such as school of fishes, colonies of ants, flock of birds and swarm behavior. Researchers modeled this swarm behavior and engineer tested the efficiency and competitiveness of these designed models on complex design problems. Artificial Bee colony, proposed by Karaboga in 2005 [17]-[18] is the newest algorithm that belongs to the swarm of swarm intelligence algorithms. ABC simulates the foraging behavior of the bee colony and employs this intelligent foraging behavior to solve numerical and engineering design optimization problems. Karaboga demonstrated the performance of the ABC algorithm [19] is competitive to other population-based algorithm with an advantage of employing fewer control parameters on constrained and unconstrained optimization problem. An important and basic difference between the Artificial Bee Colony and other population based/swarm intelligence algorithms is that in the ABC algorithm the possible solutions represent food sources, not individuals, honeybees where as in other algorithms, like PSO, each possible solution represents an individual of the swarm. A brief overview of the algorithm is given in section 2. Like other population based search algorithm, ABC starts with a population of potential candidate solutions (food sources may be flower patch etc.) where the population size (in case of ABC, the number of food sources) are fixed in the beginning of the algorithm. However, practically analyzing it is very rare that the every patch will contain the same number of flowers. Keeping this in mind, in the present study we propose a modified variant of ABC in which the population of food sources change adaptively. The corresponding algorithm is named A-ABC which is further enhanced (E-ABC) by employing the concept of elitism and improving the exploitation capability where the bees are always guided towards the best food source (i.e. the one having the best fitness function value). The remaining of the paper is organized as follows; in the next section we give a brief overview of the basic ABC algorithm. In section 3, the proposed variants are described. Numerical results are given in section 4 and finally the conclusions are presented in section 5. 2. Artificial Bee Colony: An Outline ABC is one of the newest algorithms based on the foraging behavior of insects. It tries to model natural behavior of real honey bees in food foraging. Honey bees use several mechanisms like waggle dance to optimally locate food sources and to search new ones. Waggle dance is a means of communication among bees by which the successful foragers share the information not only about the direction and distance of the food sources but also about the amount of nectar available to the other foragers. This information exchange among bees helps them in detecting the optimal food locations. In ABC, this collective cooperative behavior of bees is simulated as an optimization algorithm. Since ABC algorithm is simple in concept, easy to implement, and has fewer control parameters, it has been widely used in many fields. ABC algorithm has been applied successfully to a large number of various optimization problems [6], [19], [20]-[33]. The colony of artificial bees contains three groups of bees: employed bees, onlookers and scouts. A bee waiting on the dance area for making a decision to choose a food source is called onlooker and one going to the food source visited by it before is named employed bee. The other kind of bee is scout bee that carries out random search for discovering new sources. The position of a food source represents a possible solution to the optimization problem and the nectar amount of a food source corresponds to the quality (fitness) of the associated solution. In the algorithm, the first half of the colony consists of employed artificial bees and the second half constitutes the onlookers. The number of the employed bees or the onlooker bees is equal to the number of solutions in the population. At the first step, the ABC generates a randomly distributed initial population of NP solutions (food source positions), where NP denotes the size of population. Each solution xi where i =1, 2,..., SN is a D-dimensional vector, where D is the number of optimization parameters. After initialization, the population of the positions (solutions) is subjected to repeated cycles, C =1, 2,..., MCN of the search processes of the employed bees, the onlooker bees and scout bees. An employed bee produces a modification on the position (solution) in her memory depending on the local information (visual information) and tests the nectar amount (fitness value) of the new source (new solution). Provided that the nectar amount of the new one is higher than that of the previous one, the bee memorizes the new position and forgets the old one. Otherwise she keeps the position of the previous one in her memory. After all employed bees complete the search process; they share the nectar information of the food sources and their position information with the onlooker bees on the dance area. An onlooker bee evaluates the nectar information taken from all employed bees and chooses a food source with a probability related to its nectar amount. As in the case of the employed bee, she produces a modification on the position in her memory and checks the nectar amount of the candidate source. Providing that its nectar is higher than that of the previous one, the bee memorizes the new position and forgets the old one. An artificial onlooker bee chooses a food source depending on the probability value associated with that food source pi, calculated as Eq. (1): pi  fit i SN  i 1 (1) fit i where fiti is the fitness value of the solution i which is proportional to the nectar amount of the food source in the position i and SN is the number of food sources which is equal to the number of employed bees. In order to produce a candidate food position from the old one in memory, the ABC uses the following Eq. (2): vij  xij  ij ( xij  xkj ) (2) where k  {1, 2, …, NP} and j  {1, 2, …, D} are randomly chosen indexes. Moreover, k ≠ i. Øij is a random number between [-1, 1]. It controls the production of neighbor food sources around xij and represents the comparison of two food positions visible to a bee. This can be seen from Eq. (2), as the difference between the parameters of the xij and xkj decreases, the perturbation on the position xij decreases, too. Thus, as the search approaches to the optimum solution in the search space, the step length is adaptively reduced. After each candidate source position is produced and evaluated by the artificial bee, its performance is compared with that of its old one. If the new food source has equal or better quality than the old source, the old one is replaced by the new one. Otherwise, the old one is retained. If a position cannot be improved further through a predetermined named “limit”, then that food source is assumed to be abandoned. The corresponding employed bee becomes a scout. The abandoned position will be replaced with a new food source found by the scout. Assume that the abandoned source xi , then the scout discovers a new food source to be replaced with xi. This operation can be defined as in Eq. (3): j j j xij  x min  rand ()( xmax  x min ) j (3) j where x max and x min are upper and lower bounds of parameter j, respectively. Pseudocode of the ABC Algorithm 1. Initialize the population of solutions xij (i=1,2,…,SN, j=1,2,…,D). 2. Evaluate the population. 3. cycle (represented as G) = 1 repeat 4. Produce new solutions (food source positions) using equation (2). 5. Apply the greedy selection process between xij,G and vij,G. 6. Calculate the probability values pi for the solutions xij,G using the equation (1). In order to calculate the fitness values of solutions the following equation is employed:  1  fit i  1  f i 1  abs( f )  i if f i  0 if f i  0 Normalize pi values into [0, 1]. Produce the new solutions (new positions) vij,G for the onlookers from the solutions xij,G , selected depending on pi, and evaluate them. 8. Apply the greedy selection process for the onlookers between xij,G and vij,G. 9. Determine the abandoned solution (source), if exists, and replace it with a new randomly produced solution xi for the scout using the equation (3). 10. Memorize the best food source position (solution) achieved so far. 11. cycle = cycle+1. 12. until cycle = Maximum Cycle Number (MCN). 7. 3. Proposed ABC-SAC Algorithms & its variants In the proposed ABC-SAC algorithm an attempt is to generate adaptive Colony Size. First of all we randomly generate some initial population of solutions, which at a later stage keep on changing adaptively. The Food Source position (SN) of subsequent generations is taken as the average of the population size attribute from all individuals in the current population as follows: 1 Initialize the population of solutions xi,j,G. Then declare p as variable (Initialize p=0) 2 for (i=0; i<FoodNumber; i++) 3 int p = p + Foods[i][D]; 4 FoodNumber = (int) (p/FoodNumber) + 0.5); 5 (Check population size for even as number of food sources equals the half of the colony size) 6 Then follow the steps 2 – 12 described above in the Pseudocode in Section 2. It can be observed from the above code that the population of food source (SN) depend on p and may vary in every generation. The only thing to be kept in mind is that the population size should be even in number as the number of the employed bees or the onlooker bees is equal to the number of solutions in the population. This is a profitable situation as it may reduce the number of function evaluations leading to a faster convergence. The population generated in each iteration, using the above code, is shown in Fig. 1. ABC-SAC1: The proposed ABC-SAC is further modified by including in it a concept of elitism, due to which the bees are always guided towards the best food source. Here, the food source is generated as follows: vi , j  x best , j   ij ( x r1, j  x k , j ) (4) where xbest,j indicates the best food location. The remaining notations have the same meaning as defined in the previous section. This particular modification will further aid in getting a faster convergence. The bees always look for the best solution. ABC-SAC2: In the other variant of the proposed ABC-SAC2 algorithm is further implemented to improve the exploitation of ABC by using the equation given below: vi , j  xi , j  ij ( xi , j  x k , j )  C ( xbest , j  x r1, j ) (5) where C is taken as 1.5. Population Size This variant is inspired from the Particle Swarm Optimization (PSO) [34] (though the equation is not exactly same) which takes care of global as well as local exploration so that the domain of the problem is thoroughly is explored. 32 30 28 26 24 22 20 10 20 30 40 50 60 70 Iterations (Cycle No.) 80 90 100 Figure 1. Population Graph 4. Experimental Settings and Comparison criterion The ABC has certain control parameters that have to be set by the user. First of all it’s the population (number) of food sources (colony size) which is taken as 100 for ABC and for ABC-SAC and its variants ABC-SAC1 and ABC-SAC2. The percentage of onlooker bees is 50% of the colony, the employed bees are 50% of the colony and the number of scout bees is selected as one for ABC. The limit (or generation) is taken 100. Random numbers are generated using inbuilt function rand() in DEVC++. Besides comparing ABC-SAC and its variants ABCSAC1 and ABC-SAC2 with basic ABC, we have also compared it with a latest variant of ABC called gbest ABC [34] in terms of best and mean fitness function values, standard deviation (SD) and average number of function evaluations (NFE). It should be noted here that according to literature in most of the ABC algorithms the stopping criteria is that of the number of cycles (or generations) however, in the present study we have considered NFE as a stopping criteria. The tests are repeated for 30 runs and the average number of function evaluations (NFE) is recorded. The maximum number of function evaluations is set 106. In every case, a run was terminated when an accuracy of | f max  f min | 10 20 was reached or when the maximum number of function evaluation was reached. Values lesser than 10-20 are treated as Zero (0). All algorithms are executed on Pentium IV, using DEV C++. 5. Result analyses and discussions The proposed ABC-SAC and its variants are validated on a set of 5 standard, scalable benchmark problems for different dimensions and 5 engineering design problems The test problems and engineering problems are given in the Appendix A and B respectively. 5.1. Benchmark Problems The first four benchmark problems (Sphere, Griewank, Rastringin and Ackley) are tested for dimensions 30 and 60, while the remaining function (Schaffer) is tested for dimensions 2 and 3. The corresponding results are recorded in Tables 1 to 5. From these Tables we can see that all the proposed variants performed quite well in terms of NFE and fitness value. Among the proposed versions, ABC-SAC1 emerged as a clear winner outperforming the other algorithms and the remaining variants significantly. The superior performance of ABCSAC1 can be further validated with the help of box-plot given in figure 2. The performance curves of selected benchmark problems all the algorithms are illustrated in figure 3. These figures clearly indicate the faster convergence of ABC-SAC. The faster convergence of ABC-SAC1 is due to the presence of elitism which always guides the bees towards the best food source. This increases the convergence rate and results in smaller NFE. 5.2. Engineering design problems Algorithm Numerical results based on these performance measures are given in Table 6 and Table 7. From Table 6, which gives the average fitness function value and standard deviation, we see that in terms of average fitness function value and standard deviation all the algorithms gave more or less similar results although in some cases the proposed algorithms gave a marginally better performance than basic ABC and ABC-SAC. However if we compare the NFE in Table 7 the superior performance of the proposed algorithms become more evident. Acceleration rate (AR) [35] is used to compare the convergence speeds between ABC-SAC2 and other algorithms. It is defined as follows: AR  NFE one a lg orithm  NFE other a lg orithm NFE one a lg orithm % From Table 7 we can see that the proposed ABCSAC2 gives the better results for every problem except F3 in the comparison to the other algorithms. Further from the Table 7 it is clearly analysed that the proposed ABC-SAC2 is faster than ABC by 27.82%, faster than ABC-SAC by 24.36% and faster than ABC-SAC1 by 8.24%. Table 1. Best, Mean, Standard Deviation (Std) and Number of Functions Evaluations (NFE) For Sphere Function. D = 30 Algorithm Best Mean SD NFE ABC ABC - SAC ABC – SAC1 ABC - SAC.2 gBest (C =1.5) 1.01E-13 1.24E-14 2.61E-15 9.02E-15 2.02E-14 D = 60 1.11E-13 2.01E-14 4.44E-15 1.88E-14 3.22E-14 1.22E-13 1.82E-14 3.57E-15 2.23E-14 3.25E-15 97140 83720 76900 86620 91404 Algorithm Best Mean SD NFE ABC 2.29E-13 6.31E-13 2.63E-13 99342 ABC - SAC 1.16E-15 4.20E-15 2.22E-16 73912 ABC – SAC1 1.56E-16 5.01E-16 2.74E-16 67402 ABC - SAC.2 6.45E-16 8.43E-16 9.52E-17 71035 gBest (C =1.5) 1.40E-13 3.52E-13 1.24E-13 81430 Table 4. Best, Mean, Standard Deviation (Std) and Number of Functions Evaluations (NFE) For Ackley Function. D = 30 Algorithm Algorithm Best Mean SD NFE ABC ABC - SAC ABC – SAC1 ABC - SAC.2 gBest (C =1.5) 3.31E-16 3.82E-18 4.83E-19 5.62E-18 1.01E-17 D = 60 4.82E-16 5.07E-18 5.04E-19 6.40E-18 2.96E-17 8.67E-17 9.19E-18 8.31E-19 9.73E-18 4.99E-17 47780 40848 37905 40131 42831 Best Mean SD NFE ABC ABC - SAC ABC – SAC1 ABC - SAC.2 gBest (C =1.5) 1.38E-13 7.98E-15 5.39E-16 6.68E-15 1.08E-14 D = 60 2.19E-13 7.98E-15 6.79E-16 8.87E-15 1.33E-14 1.81E-13 1.69E-15 1.40E-17 9.13E-16 2.45E-14 74867 68002 61040 65200 71280 NFE Best Mean SD NFE 0 0 0 48760 0 0 0 41820 0 0 0 32992 0 0 0 33080 0 0 0 44500 D=3 Algorithm Best Mean SD NFE ABC 2.18E-16 5 .76E-16 1.62E-17 59900 ABC - SAC 7.78E-18 9.48E-18 6.30E-18 47450 ABC – SAC1 2.03E-19 7.56E-19 2.39E-19 39530 ABC - SAC.2 2.03E-06 6.51E-18 2.86E-19 35720 gBest (C =1.5) 1.01E-19 1.85E-18 1.01E-17 52502 Table 6. Mean of Fitness Function Value and Standard Deviation (Std) for All Algorithms (F-Function) Algorithm Algorithm SD ABC ABC - SAC ABC – SAC1 ABC - SAC.2 gBest (C =1.5) F Best Mean SD NFE ABC 7.59E-15 9.54E-15 7.15E-16 57975 ABC - SAC 8.65E-18 9.30E-18 4.80E-18 51695 ABC – SAC1 7.39E-19 8.40E-19 1.24E-19 43658 ABC - SAC.2 6.35E-18 9.00E-18 9.62E-18 40252 gBest (C =1.5) 6.97E-16 7.55E-16 4.13E-16 51947 Table 3. Best, Mean, Standard Deviation (Std) and Number of Functions Evaluations (NFE) For Rastringin Function. D = 30 Mean 1.01E-13 1.11E-13 1.22E-13 97140 1.24E-14 2.01E-14 1.82E-14 83720 2.61E-15 4.44E-15 3.57E-15 76900 9.02E-15 1.88E-14 2.23E-14 86620 2.02E-14 3.22E-14 3.25E-15 91404 D = 60 Algorithm Best Mean SD NFE ABC 8.64E-13 9.18E-13 4.36E-13 109090 ABC - SAC 5.28E-14 7.45E-14 1.94E-14 91834 ABC – SAC1 8.36E-15 9.39E-15 4.84E-16 83195 ABC - SAC.2 7.77E-14 9.11E-14 7.64E-14 88039 gBest (C =1.5) 2.47E-14 1.00E-13 6.09E-15 95301 Table 5. Best, Mean, Standard Deviation (Std) and Number of Functions Evaluations (NFE) For Schaffer Function. D=2 Best Mean SD NFE ABC 8.64E-13 9.18E-13 4.36E-13 109090 ABC - SAC 5.28E-14 7.45E-14 1.94E-14 91834 ABC – SAC1 8.36E-15 9.39E-15 4.84E-16 83195 ABC - SAC.2 7.77E-14 9.11E-14 7.64E-14 88039 gBest (C =1.5) 2.47E-14 1.00E-13 6.09E-15 95301 Table 2. Best, Mean, Standard Deviation (Std) and Number of Functions Evaluations (NFE) For Griekwank Function. D = 30 Algorithm Best ABC ABC - SAC ABC – SAC1 ABC - SAC.2 gBest (C =1.5) D ABC ABC-SAC ABC-SAC1 ABC-SAC2 F1 2 169.844 (0.00021) 169.849 (0.0080) 169.846 (1.70e-016) 169.842 (1.63.e-016) F2 3 4.2131 (3.19e-016) 4 F4 10 -26.01 (0.719) 4.20916 (1.42e-017) 1.8536e009 8.08e-023) -26.0317 (0.0398) 4.20079 (.000101) F3 4.2142 (5.08e-007) 1.7638e008 (3.51e-008) -26.0421 (0.446) F5 6 2.96e+06 (0.2648) 2.99e+06 (0.221) 2.99e+06 (0.0) 2.791e+06 (0.00319) 4.74e-008 (1.87e-018) 2.9014e-009 (2.94e-024) -26.0418 (0.6518) Table 7. Comparison of ABC-SAC2 with other Algorithms in terms of NFE’s and AR (%), Here 4/1 Implies ABC-SAC2 Vs. ABC, 4/2 Implies ABC-SAC2 Vs. ABC-SAC And 4/3 Implies ABC-SAC2 Vs ABCSAC1 ABCABCABCAR AR AR F ABC SAC SAC1 SAC2 4/1 4/2 4/3 F1 306 289 249 197 35.62 31.83 20.88 F2 838 756 524 513 38.78 32.14 2.10 F3 463 418 317 321 30.67 23.21 --- F4 240000 240000 240000 240000 0.00 0.00 0.00 F5 8438 8517 6913 5568 34.01 34.62 19.46 27.82 24.36 8.24 Average Acceleration Rate (AR(%)) 6. Conclusions In the proposed study, we presented the concept of adaptive population of food sources for an Artificial Bee Colony algorithm. The corresponding algorithm named ABC-SAC was further modified by including elitism (ABC-SAC1) and by incorporating global-local exploration (ABC-SAC2) in it. It was observed that by self adapting the food sources, the performance of the basic ABC can be improved. It was also analyzed that this modification can be further improved by considering elitism as the proposed ABC-SAC1 showed better results in comparison to other variants on benchmark problems and even on engineering design problems. Figure 2. Simulation results of all algorithms for benchmark problems Appendix A Function Definition n f1 ( x )  Sphere x i2  i 1 S = [-5.12, 5.12], X* = f 1 (0,…,0), Griekwank f 2 ( x)  1 4000 2 i  x   cos( i 1 f 4  10 n  ) 1 1 n n i 1  x 2 i =0 n    x i2   exp  1  cos( 2  x i )   n  i 1   f 3 (0,…,0) , f min n Restrigin’s i f 2 (0,…,0), f min  f 3 ( x )   20 * exp   . 2    20  e S =[-32, 32], X* = xi i 1 S = [-600, 600], X* = Ackly’s f min = 0 n n =0   10 cos 2  x i  i 1 S = [-5.12, 5.12], X* = f f min =0 f 5 (0,…,0) , f min =0 4 (0,…,0), n   2 sin   x i   0 . 5  i1    f5  0 .5  2 n   2   1  0 . 001   x i    i 1   2 Schaffer S = [-100, 100], X* = Notes: f min = the minimum of the value of the function: X* = the minimum: S = the feasible region: and S  Rn , n is dimension of the problem Appendix B Engineering Design Problems The credibility of an optimization algorithm also depends on its ability to solve real life/engineering’s problems. In this paper we took four real life engineering design problems to validate the efficiency of all the proposed algorithms. Mathematical models of problems are given below: F1: Optimal Capacity of Gas Production Facilities [36] This is the problem of determining the optimum capacity of production facilities that combine to make an oxygen producing and storing system. Oxygen for basic oxygen furnace is produced at a steady state level. The demand for oxygen is cyclic with a period of one hour, which is too short to allow an adjustment of level of production to the demand. Hence the manager of the plant has two alternatives. He can keep the production at the maximum demand level; excess production is lost in the atmosphere. He can keep the production at lower level; excess production is compressed and stored for use during the high demand period. The mathematical model of this problem is given by: Minimize: x f ( x )  61.8  5.72 x1  0.2623[(40  x1 ) ln( 2 )] 0 .85 200 x  0.087 ( 40  x1 ) ln( 2 )  700.23 x2  0.75 200 Subject to: x1  17.5 , x2  200 ; 17.5  x1  40 , 300  x 2  600 . F2: Optimal Thermohydraulic Performance of an Artificially Roughened Air Heater [37] In this problem the optimal thermohydraulic performance of an artificially roughened solar air heater is considered. Optimization of the roughness and flow parameters (p/e, e/D, Re) is considered to maximize the heat transfer while keeping the friction losses to be minimum. The mathematical model of this problem is given by: Maximize L  2.51 * ln e   5.5  0.1RM  G H where R  0.95 x 0.53 ; G  4.5( e  ) 0.28 ( 0.7 ) 0.57 3.69 *10 4 * x3  7.72 *108 * x11 x20.219  765.43 *106 * x11 Bounds:10  x1  55,1.1  x2  2,10  x3  40 2 M H e   x1 x3 ( f / 2)1 / 2 ; f  ( f s  f r ) / 2 f s  0.079x3 0.25 ; f r  2(0.95 x3 0.53 References 2  2.5 * ln(1 / 2 x1 )  3.75) 2 Subject to: 0.02  x1  0.8 , 10  x2  40 , 3000  x3  20000 [1] [2] F3: Design of Gear Train [38] This problem is to optimize the gear ratio for the compound gear train. It is to be designed such that the gear ratio is as close as possible to 1/6.931. For each gear the number of teeth must be between 12 and 60. Since the number of teeth is to be an integer, the variables must be integers. The mathematical model of gear train design is given by, 2 2     Minimize f   1  Td Tb    1  x1x2   6.931 TaT f   6.931 x3 x4  Subject to: 12  xi  60 i  1, 2,3, 4 [ x1 , x2 , x3 , x4 ]  [Td , Tb , Ta , T f ] , xi’s should be integers. Ta, Tb, Td, and Tf are the number of teeth on gears A, B, D and F respectively. The design of a compound gear train is shown in Fig. 1. [3] [4] [5] [6] [7] [8] [9] F4: The lennard-jones atomic cluster problem [39] The Lennard-Jones (LJ) model of inert gas cluster has been investigated intensively as a challenging testing ground for global optimization algorithms. The LJ problem can be formulated as follows: Let N atoms be given in three dimensional space. Let i i 1 i 2 [10] [11] i T 3 x  ( x , x , x ) represent the coordinates of atom i. 1 T N T T let X  (( x ) ,..., ( x ) ) the LJ potential energy function v ( rij ) of a pair of atoms (i, j) is given by [12] [13] 1 1 v(rij )  12  6 ,1  i,j  N where rij  ||x i  x j|| rij rij The LJ potential function for a single pair of neutral atoms is a simple unimodal function. This is illustrated by Fig. 2. It is easy to find the overall minimum of this function that is assumed at 1 with energy −1. In a complex system, many atoms interact and we need to sum up the LJ potential functions for each pair of atoms in a cluster. The result is a complex energy landscape with many local minima. It is given by: N 1 N   1 1 Minimize V ( X )   v(|| x i  x j ||)     i  i  j 12 || x  x j || 6  i j i 1 j  i1  || x  x || [14] [15] [16] [17] As it is known the LJ problem is a highly nonlinear, non convex function with numerous local minimum that takes the LJ problem a challenging standard test problem for the global optimization algorithms. For illustration, we fix one atom’s position and let the others move around the fixed one. A cluster of more than 20 atoms has many of local minima along its LJ PES. [18] F5: Gas transmission compressor design [37] [21] Minimize f ( x)  8.61*105 * x11/ 2 x 2 x32 / 3 ( x22  1) 1 / 2  [19] [20] L. J. Fogel, A. J. Owens, M. J. Walsh, Artificial intelligence through a simulation of evolution, edited by M. Maxfield, Callahan, and L. J. Fogel, Biophysics and Cybernetic systems, in: 2nd Cybernetic Sciences Symposium 1965, pp. 131–155. D. Goldberg, Genetic Algorithms in Search Optimization and Machine Learning, Addison Wesley Publishing Company, Reading, Massachutes 1986. J. Kennedy, R. C. Eberhart, Particle Swarm Optimization, in: IEEE International Conference on Neural Networks, Perth, Australia, IEEE Service Center, Piscataway, NJ 1995, pp. 1942– 1948. K. Price, R. Storn, Differential Evolution – a Simple and Efficient Adaptive Scheme for Global Optimization Over Continuous Spaces, Technical Report, International Computer Science Institute, Berkley 1995. M. Dorigo, V. Maniezzo, A. Colorni, Positive feedback as a search strategy, Technical Report 91-016, Politecnico di Milano, Italy, 1991. Tarun Kumar Sharma, Millie Pant, V.P. Singh, Improved Local Search in Artificial Bee Colony using Golden Section Search, Journal of Engineering, 1:1(2012) 14-19. Ali Yazdekhasti, Iman Sadeghkhani, Optimal Tuning of TCSC Controller Using Particle Swarm Optimization, Advances in Electrical Engineering Systems, 1:1(2012) 24-29. Yudong Zhang, Lenan Wu, Rigid Image Registration by PSOSQP Algorithm, Advances in Digital Multimedia, 1:1(2012) 4-8. Maziar Rezaei Rad, Mani Rezaei Rad, Shahabeddin Akbari, Seyyed Abbas Taher, Using ANFIS, PSO, FCN in Cooperation with Fuzzy Controller for MPPT of Photovoltaic Arrays, Advances in Digital Multimedia, 1:1(2012) 37-45. Zheng Zhang, Pattern Recognition by PSOSQP and Rule based System, Advances in Electrical Engineering Systems, 1:1(2012) 30-34. Shuihua Wang, Lenan Wu, An Improved PSO for Bankruptcy Prediction, Advances in Computational Mathematics and its Applications, 1:1(2012) 1-6. Yudong Zhang, Lenan Wu, Tabu Search Particle Swarm Optimization used in Cluster Analysis, Journal of Science, 1:1(2012) 6-12. Amir Ghoreishi, Arash Ahmadivand, State Feedback Design Aircraft Landing System with Using Differential Evolution Algorithm, Advances in Computer Science and its Applications, 1:1(2012) 16-20. Yudong Zhang, Lenan Wu, A Robust Hybrid Restarted Simulated Annealing Particle Swarm Optimization Technique, Advances in Computer Science and its Applications, 1:1(2012) 5-8. Y. Zhang, L. Wu, Artificial Bee Colony for Two Dimensional Protein Folding, Advances in Electrical Engineering Systems, 1:1(2012) 19-23. H. Noormohamadi, A.A. Gharaveisi, M. Suresrafil, Novel Bacterial Foraging Algorithm for Optimization Problems, Advances in Electrical Engineering Systems, 1:1(2012) 41-48. D. Karaboga, An idea based on honey bee swarm for numerical optimization. Technical Report-TR06, Kayseri, Turkey: Erciyes University; 2005. D. Karaboga, B. Basturk, A powerful and efficient algorithm for numerical function optimization: artificial bee colony (ABC) algorithm, Journal of Global Optimization 39(2007) 171–459. D. Karaboga, B. Basturk, On the performance of artificial bee colony (ABC) algorithm, Applied Soft Computing, 8(2008) 687697. D. Karaboga, C. Ozturk, N. Karaboga, B. Gorkemli, Artificial bee colony programming for symbolic regression, Information Sciences (2012), http:// dx.doi.org/10.1016/j.ins.2012.05.002. M Ma, J. Liang, M. Guo, Y. Fan, Y. Yin, SAR image segmentation based on Artificial Bee Colony algorithm, Applied [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] Soft Computing, (In Press) doi:10.1016/j.asoc.2011.05.039, in press. WC. Yeh, TJ. Hsieh, Artificial bee colony algorithm-neural networks for s-system models of biochemical networks approximation. Neural Comput Appl. (2012) doi:10.1007/s00521010-0435-z. F. Gao, Feng-xia Fei, Q. Xu, Y. fang Deng, Yi-bo Qi, I. Balasingham, A novel artificial bee colony algorithm with space contraction for unknown parameters identification and time-delays of chaotic systems, Appl. Math. Comput. (2012), http://dx.doi.org/10.1016/j.amc.2012.06.040. H. Zhang, Y. Zhu, W. Zou, X. Yan, A hybrid multi-objective artificial bee colony algorithm for burdening optimization of copper strip production, Applied Mathematical Modelling, 36:6(2012) 2578-2591. X. Liao, J. Zhou, R. Zhang, Y. Zhang, An adaptive artificial bee colony algorithm for long-term economic dispatch in cascaded hydropower systems, International Journal of Electrical Power & Energy Systems, 43:1(2012) 1340-1345. H. Gozde, M. Cengiz Taplamacioglu, İ. Kocaarslan, Comparative performance analysis of Artificial Bee Colony algorithm in automatic generation control for interconnected reheat thermal power system, International Journal of Electrical Power & Energy Systems 42:1(2012) 167-178. Ali R. Yildiz, A new hybrid artificial bee colony algorithm for robust optimal design and manufacturing, Applied Soft Computing, In Press, 2012. O. Kisi, C. Ozkan, B. Akay, Modeling discharge–sediment relationship using neural networks with artificial bee colony algorithm, Journal of Hydrology, 428–429(2012) 94-103. S. K. Mandal, Felix T.S. Chan, M.K. Tiwari, Leak detection of pipeline: An integrated approach of rough set theory and artificial bee colony trained SVM, Expert Systems with Applications, 39:3(2012) 3071-3080. T.K. Sharma, M. Pant, Enhancing the food locations in an artificial bee colony algorithm, in: IEEE Swarm Intelligence Symposium (SIS), Paris, France, 2011, pp. 119-123. T.K. Sharma, M. Pant, Enhancing different phases of artificial bee colony for continuous global optimization problems, in: International Conference on Soft Computing for Problem Solving, SocProS 2011, AISC of Advances in Intelligent and Soft Computing, Roorkee, India, Vol. 130, 2011, pp. 715–724. T.K. Sharma, M. Pant, J.C. Bansal, Artificial Bee Colony with Mean Mutation Operator for Better Exploitation, in: IEEE World Congress on Computational Intelligence (CEC), Brisbane, Australia, 2012, pp. 3050 - 3056. T.K. Sharma, M. Pant, J.C. Bansal, Some Modifications to Enhance the Performance of Artificial Bee Colony, in: IEEE World Congress on Computational Intelligence (CEC), Brisbane, Australia, 2012, pp. 3454 - 3461. Zhu G., Kwong S.: Gbest-Guided Artificial Bee Colony Algorithm for Numerical Function Optimization, Appl. Math. Comput. (2010). S. Rahnamayan, H.R. Tizhoosh, and Salama, M. M. Ali, Opposition-Based Differential Evolution. IEEE Transactions on Evolutionary Computation, 12:1(2008) 64– 79. [12]C. Beightler, D. Phillips. Applied geometric programming. John Wiley and Sons, New York, 1976. B. Prasad, J. Saini, Optimal thermo hydraulic performance of artificially roughened solar air heater. Journal Solar Energy, 47(1991) 91–96. B. Babu, New optimization techniques in engineering. SpringerVerlag, Berlin Heidelberg, 2004. U. chakraborthy, S. Das, A. konar. Differential evolution with local neighborhood, in: IEEE congress on evolutionary computation, Canada, 2006, 2042–2049. Tarun Kumar Sharma did his MCA in 2001, M.Tech (IT) in 2009 and presently pursuing Ph.D from Indian Institute of Technology (IIT) Roorkee, India. He has almost 9 years of teaching experience in Engineering College. His key areas are Evolutionary Computing; Software Engineering; Computer based Optimization Techniques; ERP. His research interest includes swarm intelligence algorithms and their applications in various complex engineering design problems. His publications are in Journals and International Conferences of repute. He volunteered in SocPros-2011, an First International Conference on Soft Computing for Problem solving. He is peer reviewer of many IEEE conferences and International Journals. He is student member of Machine Intelligence Research (MIR) Labs, WA, USA. Millie Pant is working as an assistant professor in Department of Paper Technology, Indian Institute of Technology (IIT), Roorkee, India since 2007. Her research interest includes evolutionary and swarm intelligence algorithms and their applications in various complex engineering design problems. Her publications are in Journals and International Conferences of repute. She has published over 100 referred on evolutionary algorithms (GA, PSO, DE and ABC) and their applications in electrical design problems, image processing papers. She has been program committee member of over 10 International events and Program Committee Chair of SoCProS-211. She is Program Committee Chair of the 7th International Conference on Bio-Inspired Computing: Theories and Application (BIC-TA 2012) and SoCProS-2012 (International Conference on Soft Computing for Problem Solving). V.P. Singh received the Bachelor’s degree from Meerut University, India in the year 1970, Master’s and Ph. D degrees in Applied mathematics from the University of Roorkee (now, Indian Institute of Technology Roorkee), India, in 1972, and 1978 respectively. Prof. Singh is currently with SCET Saharanpur, as a Director General. Previously he was Professor in the Department of Paper Technology, IIT Roorkee. His special fields of interests include Applied and Industrial Mathematics, Mathematical Modelling of Pulp washing problems. He has number of publications in journal of repute and has been reviewer for number of Journals and Conferences.
5cs.CE
arXiv:1710.09875v1 [cs.NE] 26 Oct 2017 Phase Transitions in Image Denoising via Sparsely Coding Convolutional Neural Networks Jacob Carroll Department of Physics & Center for Soft Matter and Biological Physics Virginia Tech Blacksburg, VA 24061 [email protected] Nils Carlson Department of Computer Science and Engineering New Mexico Tech Socorro NM, 87801 Garrett T. Kenyon CCS-3, Information Sciences Los Alamos National Laboratory Los Alamos, NM, 87545 Abstract Neural networks are analogous in many ways to spin glasses, systems which are known for their rich set of dynamics and equally complex phase diagrams. We apply well-known techniques in the study of spin glasses to a convolutional sparsely encoding neural network and observe power law finite-size scaling behavior in the sparsity and reconstruction error as the network denoises 32×32 RGB CIFAR10 images. This finite-size scaling indicates the presence of a continuous phase transition at a critical value of this sparsity. By using the power law scaling relations inherent to finite-size scaling, we can determine the optimal value of sparsity for any network size by tuning the system to the critical point and operate the system at the minimum denoising error. 1 Introduction Spin glasses and neural networks are very analogous and draw many parallels in their dynamics. Generally, a spin glass is a model of disordered magnetism. The simplest model of a spin glass, the Ising model, is a network of N "spins" {σi } which take on the discrete values, connected by a weight matrix Jij ∈ R that represents the strength of connection between the spins. The dynamics of these systems is determined by the values of randomly chosen Jij , which are generally time independent (3). The similarity of these spin glass systems with neural networks is of interest to us because spin glasses have been a focus of research in statistical physics for the last fifty years, and a large library of machinery and techniques has been developed to deal with them. We would like to apply this machinery to the field of neural networks. For this paper we used PetaVision, a high performance neural simulation toolbox (1), to construct sparsely coding convolutional neural networks and examine the relationship between the network’s efficiency and sparsity. Interesting behavior in the efficiency of the networks as the sparsity was varied led us to analyze the finite-size scaling of the network, a technique more commonly used in the study of spin glasses, and discovered power law relationships that indicate a continuous (second-order) phase transition is occurring in the networks as sparsity is varied. 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, USA. 2 Neural network We used two networks in our simulation, both built using PetaVision. The first network was a sparse auto-encoder network that trained the filter kernels of a convolutional layer using a Locally Competitive Algorithm, as defined by Rozell et al. (7), as it attempted to iteratively converge on a sparse representation of different input images. The second network (see Figure 1) used the same sparsely encoding convolutional layer that was trained by the autoencoder to denoise images that had very high Gaussian noise added to them. The input for both networks were images from the CIFAR-10 image set (6).The image set was divided into two parts. The first 50,000 images were used for training the filter kernels of the sparsely coding convolutional layer for different levels of sparsity. Then, 10,000 additional images had very high Gaussian noise added to them and were denoised by the denoising network for each level of sparsity used in training. We observed a distinct minimum in the percent reconstruction error of the noisy images as the sparsity of the network was varied that displayed behavior analogous to continuous phase transitions seen in spin glasses (see figure 2) (3; 9). With this as our motivation we investigated the presence of a phase transition in our system. Input Layer Noise Layer Input Error Layer Sparsely Coding Input Reconstruction Convolutional Layer Layer Figure 1: A schematic of the denoising network. The Input Error Layer computes the difference between the Noise Layer and the Input Reconstruction Layer, an alternative implementation of lateral inhibition in LCA (8). Feature learning utilizes a local Hebbian rule to implement stochastic gradient descent. 3 Phase transitions and finite-size scaling A phase of a system is defined as a subspace of the microscopic system parameters where the system’s dynamics obey the same macroscale laws and relations everywhere in that subspace. The space of system parameters can have many phases, and the system can transition between them as system control parameters change. The point of transition between two (or more) phases is known as the critical point. Phase transitions have been subject of significant study in Condensed Matter Physics, and it is well established that the occurrence of a continuous phase transition1 is accompanied by a singularity at the critical point in one or more system parameters when the system is of infinite size (9). It is impossible to achieve infinite system sizes computationally, but this theory can be expanded to finite systems where these singularities become truncated and rounded. These minima or maxima that the singularities turn into at finite system sizes follow very specific relations with system size: Location of Minima ∼ L−1/ν −γ/ν Height of Minima ∼ L , (1) (2) where L is the linear system size. This behavior is known as finite-size scaling (9; 2). The exponents ν and γ two examples of "critical exponents". The critical exponents describe the behavior of the system as it approaches the critical point (9; 2). Thus we can identify a phase transition in our network by the existence and behavior of minima and maxima in the space of system parameters as we vary the system size, which in our case will be the number of neurons in the convolutional layer. The exponents we record, ν̄ and γ̄, will be proportional to γ and ν through some effective dimension of our system. 1 A continuous (second-order) phase transition has a continuous change in the dynamics of the system as it transitions between phases, while first-order phase transitions are discontinuous. 2 4 Results The parameters of the system that we are interested in are the fraction of active neurons and the average percent reconstruction error of our noisy images: 10,000 X ksi − ŝi k2 1 Perr = , (3) 10, 000 i=1 ksi k2 where Perr is the average percent reconstruction error, si is the ith original image before it has Gaussian noise added to it, ŝi is the ith reconstruction of the noised image taken from the sparsely coding convolutional layer (1; 7; 8). 213 neurons 214 neurons 215 neurons 216 neurons 217 neurons 0.26 0.28 ● 0.24 Percent Reconstruction Error The fraction of active neurons is controlled by a parameter λ, as described Rozell et al. (7), that behaves monotonically with the sparsity of active neurons and inversely with the fraction of active neurons. Through λ we can control the fraction of active neurons and observe how the average percent reconstruction error behaves as the fraction of active neurons is varied. We observed a minimum in Perr occur as we varied the fraction of active neurons for many different system sizes. These results are summarized in Figure 2. ● ● ● ● ● ● ● ● ● 0.22 ●● ● 0.00 0.02 0.04 0.06 0.08 0.10 0.12 Fraction Active Neurons Figure 2: Average percent active error vs. fraction active neurons 0.03 0.04 0.05 101.91x−0.756 ● 0.01 0.02 Fraction Active Neurons 0.2225 0.2215 0.2205 ● 0.2195 Minimum Percent Error 10−0.621x−0.00745 214 215 216 217 214 System Size (Number of Neurons) 215 216 217 System Size (Number of Neurons) (a) Height of minima vs. system size (b) Location of minima vs system size Figure 3: The power law behavior of the minimum average percent reconstruction error (a), and the fraction of active neurons at that minimum (b). We report ν̄ = 1.32 ± 0.04 and γ̄ = 0.0099 ± 0.0095. We measured the shift in height and location of the minima in Perr as the system size was varied, and plot each on a log-log plot (see Figures 3 (a), and 3 (b)). We observe power law behavior in both 3 the location and height of the minima as the system size is varied. This satifies the finite-size scaling requirements as defined in equations 1 and 2. This finite-size scaling behavior indicates a continuous phase transition is occurring as the sparsity of the network is varied. 5 Discussion The existence of phase transitions in neural networks is not unique to this sparsely coding convolutional system. The auto-associative network proposed by Hopfield (5) was shown by Hertz et al. (4) to display a first-order phase transition in its memory capacity. If the number of patterns recorded by the network exceeds a "critical fraction" of the network size, the output of the network is maximally disordered (4). We propose a similar mechanism is responsible for the observed continuous phase transition of our sparsely coding convolution network, where the fraction of active neurons is analogous to the "critical fraction" of learned patterns in the auto-associative network. If our network’s fraction of active neurons is too far above the "critical fraction", the network will have the freedom to reconstruct the noise in the image, while if the fraction of active neurons is too low, the network will only reconstruct image components for which it has learned strong priors. These two different regions of dynamics form our "phases". The existence of a phase transition in the average percent reconstruction error of the network as the fraction of active neurons is varied guarantees the persistence of the power law behavior seen in Figure 3 (b). This power law behavior allows us to predict the optimal fraction of active neurons for any system size, which in turn can be tuned to through the parameter λ, as described by Rozell et al. (7), to ensure that any sparsely coding convolutional network is operating at the optimal level of sparsity. The critical behavior of the network allows us to always achieve the minimum denoising error by operating the network at this critical value of sparsity. Acknowledgments We gladly acknowledge helpful discussions with Uwe C. Täuber. This work was supported by the Los Alamos National Laboratory under contract DE-AC5206NA25396. Computations were performed using the Darwin Computational Cluster at Los Alamos National Laboratory. References [1] Petavision. URL github.com/PetaVision/OpenPV. [2] J. Cardy. Scaling and renormalization in statistical physics. Cambridge University Press, 1996. ISBN 0521499593. [3] V. Dotsenko. An introduction to the theory of spin glasses and neural networks. World Scientific Lecture Notes in Physics. World Scientific Publishing Company, 1995. ISBN 9810218737. [4] J. A. Hertz, A. S. Krogh, and R. G. Palmer. Introduction to the theory of neural computation. Addison-Wesley Publishing Company, 1991. ISBN 0201515601. [5] J. J. Hopfield. Neural networks and physical systems with emergent collective computational abilities. Proceedings of the National Academy of Sciences, 79(8):2554–2558, 1982. URL http://www.pnas.org/ content/79/8/2554.abstract. [6] A. Krizhevsky. Learning multiple layers of features from tiny images. 2009. [7] C. J. Rozell, D. H. Johnson, R. G. Baraniuk, and B. A. Olshausen. Sparse coding via thresholding and local competition in neural circuits. Neural Computation, 20:2526–2563, 2008. [8] P. F. Schultz, D. M. Paiton, W. Lu, and G. T. Kenyon. Replicating kernels with a short stride allows sparse reconstructions with fewer independent kernels. arXiv preprint arXiv:1406.4205, 2014. [9] U. C. Täuber. Critical dynamics: a field theory approach to equilibrium and non-equilibrium scaling behavior. Cambridge University Press, 2014. ISBN 9780521842235. 4
1cs.CV
1 Synchronization of Power Systems and Kuramoto Oscillators: A Regional Stability Framework arXiv:1804.01644v1 [cs.SY] 5 Apr 2018 Lijun Zhu, and David J. Hill Life Fellow, IEEE Abstract—The transient stability of power systems and synchronization of non-uniform Kuramoto oscillators are closely related problems. In this paper, we develop a novel regional stability analysis framework based on the proposed regionparametrized Lyapunov function to solve the problems. Also, a new synchronization definition is introduced and characterized by frequency boundedness and angle cohesiveness, the latter of which requires angles of any two connected nodes rather than any two arbitrary nodes to stay cohesive. It allows to take power fluctuations into explicit account as disturbances and can lead to less conservative stability condition. Applying the analysis framework, we derive two algebraic stability conditions for power systems that relate the underlying network topology and system parameters to the stability. Finally, to authors’ best knowledge, we first explicitly give the estimation of region of attraction for power systems. The analysis is verified via numerical simulation showing that two stability conditions can complement each other for predicting the stability. I. I NTRODUCTION Power systems are a class of heterogeneous complex networks composed of load and generator buses connected via electric lines. The angle stability of power systems refers to the ability of bus angles to stay synchronism after severe faults or when the system experiences power fluctuations. It ensures stable and secure system operation to deliver electric power reliably from generators to loads. Small-disturbance and transient stability analysis are two classes of stability analysis. Small-disturbance stability concerns the stability issues of power systems under disturbances of small scale and usually uses the eigenvalue-based method following the model linearization. Transient stability considers the stability under rather large disturbances and the stability result is effective in a larger region of interest than the small-disturbance stability. Transient stability assessment approaches are categorized into direct time-domain simulation and energy function methods. Time-domain simulation assesses the stability with respect to a given fault or disturbance by means of numerical simulation [18], [25]. On the contrary, the energy function method adopts Lyapunov stability theory and relies on a class of energy functions to determine the system stability. It identifies critical unstable equilibrium points (UEPs) [13] such as closest UEP or controlling UEP [7], [6] which are used to infer the stability. For instance, when the post-fault energy is less than the energy of closest UEP, the system This work was supported by The University of Hong Kong Research Committee Post-doctoral Fellow Scheme. Lijun Zhu and David J. Hill are with Department of Electrical and Electronic Engineering, The University of Hong Kong, Hong Kong. (e-mail: ljzhu,[email protected]). trajectory is guaranteed to converge towards the system equilibrium. Time-domain simulation is less intuitive and requires intensive computation especially for large-scale power systems but guarantees the accuracy if the precise modeling of the system is available [23], [24]. In comparison, energy function method provides more insights and is less computing intensive, although the estimated region of attraction is conservative. The transient stability of power systems is also closely related to the synchronization of celebrated Kuramoto oscillators in terms of dynamic model and phase (angle) behavior. For conventional power systems, the dynamic model of synchronous generators under the over-damped assumption can be approximated by the modified Kuramoto model [11]. For microgrids, the droop-controlled frequency dynamics of the inverter-interfaced energy sources resemble Kuramoto model [1], [29], [30]. However, the network structures of Kuramoto oscillators and power networks sometimes are different. The complete graph structure is usually assumed for Kuramoto model and facilitates it to study necessary and sufficient synchronization conditions, while the network structure of power systems is usually irregular. In the early work, a network reduction method called Kron reduction ([20]) was introduced to simplify the network. For instance, reference [4], [22] considered loads were modeled as constant impedances and used Kron reduction to absorb loads into lines and reduce the original meshed power network into a network of generators. The Kron reduction simplifies the power network but has two drawbacks: the loss of the original topological information and inclusion of higher transfer conductances resulting from load absorption. The former makes it difficult to explore relation between stability and the original network topology, while the latter makes an unsolved problem to develop general Lyapunov functions. Later, Bergen and Hill [5] proposed the network-preserving model of conventional power systems with frequency-dependent loads for which Lyapunov functions in Lur’e-Postnikov form ([5], [15], [17]) were proposed. The network-preserving model allows for more precise dynamic modeling of loads, while the original network structure is retained. The synchronization of Kuramoto oscillators refers to phase synchronization if natural frequencies of oscillators are identical or phase locking otherwise, i.e., phases of oscillators are distributed in a pattern. The phase locking coincides with transient stability definition of power systems. The research on Kuramoto oscillators mainly focus on finding necessary (see, e.g., [8], [31], [19]) and sufficient synchronization conditions (see, e.g.,[8], [10], [14], [9]). The work [10], [11] first linked the stability of network-reduced power systems with syn- 2 chronization of Kuramoto oscillators, and adopted notations such as phase cohesiveness and frequency synchronization to characterize the stability for power systems. Motivated by [16], [11] also showed that the network topology has a crucial impact on the stability of power systems. Over the last decade, the increasing integration of renewable energy into power grids has been motivated by environmental and economic benefits and continues as the enabling technology innovation progresses. Microgrid is one of promising technologies that can integrate large amount of renewable energy such as solar, wind power and geothermal systems, and fulfills the potential of distributed generation ([21], [26]) in a systematic way. In general, energy sources are fed via powerelectronic converters, whose characteristics are determined by the internal control logic and are largely different from the conventional synchronous machine based power generators [29], [30], [27], [28]. The power generation of renewable energy is intermittent, stochastic and subjected to weather condition. On the other hand, the demand-side activities become complicated and less predictable. The generation of renewable energy and complicated load activities may cause fluctuations in power systems, which have not been accounted for in the existing stability analysis. In this paper, we will show that the transient stability of power systems is related to the synchronization of non-uniform Kuramoto oscillators. The objective of this paper is to establish a general analysis framework based on energy (Lyapunov) functions to study the transient stability for power systems and the synchronization of non-uniform Kuramoto oscillators. The main contributions are summarized as follows. First, we introduce a new definition for the synchronization of power systems and Kuramoto oscillators characterized by angle differences across any physical lines being less than π, which complements the definition of phase cohesiveness in [11] that considers angle differences of any arbitrary two angles in the system. Second, with the recognition that renewable energy has stochastic and intermittent nature, we explicitly consider the energy fluctuations as disturbances to power systems and analyze their impact on stability. Third, we propose a general stability analysis method based on region-parametrized Lyapunov function whose bounds are parametrized by the size of region of interest. The stability analysis gives the existence condition of positively invariant sets in terms of the energy and boundedness in terms of the state which can be used to obtain the condition for angle cohesiveness and frequency boundedness. Fourth, applying the stability analysis framework, we derive two algebraic conditions for power systems in terms of the new definition and a definition similar to that in [11] that both relate the underlying network topology and system parameters to the stability. Finally, to authors’ best knowledge, we first explicitly give the estimation of the region of attraction for power systems. This paper is a strengthened extension to our conference paper [33] in several aspects including the aforementioned third, fourth and last points. In addition, we will explain the motivation of the new synchronization definition using an example and show positively invariant set from bus angle perspective in addition to energy perspective in [33]. Also, we derive additional stability condition in Theorem 5.1. The rest of the paper is structured as follows. Section II presents the structure-preserving model of power systems and introduces the first stability definition and describes the problem to be studied. In Section III, we introduce a new stability definition using a motivating example and present a coordinate transformation. In Section IV, we propose stability analysis framework based on region-parametrized Lyapunov functions and apply it to obtain two stability conditions for power systems in Section V. Section VI extends the stability analysis in Section V to non-disturbance scenario and explicitly gives the estimation of region of attraction for power systems. Section VII verifies theoretical results on the IEEE 9-bus test system using numerical simulation. The paper is concluded in Section VIII. Notations. For a scalar x ∈ R, sinc(x) = sin(x)/x. For a vector x = [x1 , · · · , xn ]T ∈ Rn , kxk and kxk∞ are the 2-norm and the ∞-norm of vector x and sin(x) := [sin(x1 ), · · · , sin(xn )]T . The vector en is a column vector of dimension n with all elements being 1. The notations from algebraic graph theory is defined as follows. An undirected G = (V, E) consists of a set of vertices V = {1, · · · , n} and a set of undirected edges E ⊆ V × V. An undirected edge of E from node i to node j is denoted by (i, j), meaning that nodes Vi and Vj are interconnected with each other. The edge weight is denoted by aij where aii = 0 and aij = aji > 0 for (j, i) ∈ E. The Laplacian ofP the graph G is denoted by L = [lij ] ∈ Rn×n , where lii = nj=1 aij and lij = −aij if i 6= j. Denote by Ek the kth edge of E where k ∈ {1, · · · , |E|}, |E| the number of edges, and B ∈ Rn×|E| the incidence matrix whose component is Bik = 1 if node i is the sink node of edge Ek , Bik = −1 if it is the source node and Bik = 0 otherwise. As a result, one can have L = BAv B T where Av = diag({aij }(i,j)∈E ) is the diagonal matrix with diagonal elements being edge weights. Gc is called the complete graph induced by G, if Gc = (V, Ec ) is an undirected complete graph with the same set of nodes as G, for which Bc is the incidence matrix. II. S YSTEM M ODEL AND P ROBLEM F ORMULATION In this paper, we study the first-order dynamics di θ̇i = pi (t) − n X aij sin(θi − θj ), i = 1, · · · , n. (1) j=1 The model (1) can represent Kuramoto oscillators, conventional power systems with over-damped synchronous generators [11], lossy [27] and lossless [1], [29] microgrids. For instance, the network-preserving model of lossless microgrids with inverter-based energy sources and loads can be described by (1) in which θi is the phase angle of the voltage Vi at bus i. The network parameter is aij = |Vi ||Vj ||Bij | where Bij is the susceptance of the line connecting bus i and j, |Vi | and |Vj | are magnitudes of voltage Vi and Vj , respectively. Note that aij > 0 if two buses are connected, and aij = 0 otherwise. The net power injected from the network P pe,i = − nj=1 aij sin(θi − θj ). Let V = Vl ∪ Vs where Vl = 1, · · · , l and Vs = l + 1, · · · , n are index sets for the load 3 and energy source buses, respectively. For i ∈ Vl , the equation (1) describes the power balance between power injection and power consumed by the load [1], for which we adopt the frequency-dependent load ([5]) where pi < 0 is the nominal consumption and di is the frequency-dependent parameter. For i ∈ Vs , energy sources are equipped with AC-AC or DCAC inverter and their dynamics are determined by the internal control logic of the inverters which normally implement droop control [1] or maximum power point tracking (MPPT) [12]. For either control strategy, the equation (1) depicts the power balance between energy consumption by internal load, power supply by energy sources and power delivery to microgrids. For droop control, di and pi are related to parameters and setpoints of the droop control (see [1]), while for MPPT control, pi is the maximum power output and di is related to the internal frequency-dependent load. pi can be simply regarded as the power supplied by ith energy source. Remark 2.1: In contrast, the classic Kuramoto oscillators are n KX θ̇i = pi − sin(θi − θj ), i = 1, · · · , n. n j=1 where pi is the natural frequency of ith oscillator, K is the coupling strength and the network graph has all-to-all connections. The model (1) is also called non-uniform Kuramoto oscillators that was studied in [11]. Because the model (1) has non-complete interconnection and non-uniform coefficient di , it is more challenging to study the synchronization. Remark 2.2: The model of lossy microgrids can also be written in the form of (1), with pi (t) replaced by p′i (t), as P di θ̇i = p′i (t) − nj=1 aij sin(θ P i − θj ), i = 1, · · · , n, where p′i (t) = pi (t) − |Vi |2 Gii + nj=1 |Vi ||Vj |Gij cos(θi − θj ). The second and last term in p′i (t) are the power transfer induced by non-zero conductances Gij . This model can also represent the network-reduced model of conventional power systems with over-damped synchronous generators [11]. The term pi is normally assumed to be constant in the literature of power systems and Kuramoto oscillators, however it is worth mentioning that pi in this paper might be timevarying due to load and renewable generation fluctuations. For instance, for MPPT control the maximum power outputs of the renewable energy such as PV and wind power normally vary with the weather condition. The dynamical system (1) can be put in a vector form, with θ = [θ1 , · · · , θn ]T , as follows θ̇ = −D−1 (BAv sin(B T θ) − pf (t)) (2) where B is the incidence matrix of the power network G, D = diag(d1 , · · · , dn ) is the coefficient matrix, pf = [p1 , · · · , pn ]T ∈ Rn is called power profile vector. Define θc = BcT θ, (3) where Bc is the incidence matrix of the induced complete graph Gc . Hence, the elements in θc are θi − θj for i 6= j, ∀i, j ∈ {1, · · · , n}. The stability in terms of synchronization for (2) with notations of phase cohesiveness and frequency synchronization was introduced in [11], adapted in [32] and revised as follows. A few notations are adopted from [11] for the purpose of self-containedness. The torus is the set T1 = [0, 2π] where 0 and 2π are associated with each other. An angle is a point θ ∈ T1 and an arc is a connected subset of T1 . The n-torus is the Cartesian product Tn = T1 × · · · × T1 . Definition 2.1: (Phase Cohesiveness and Frequency Boundedness). A solution θ(t) : R+ → Tn is then said to be phase cohesive if there exists a γ ∈ [0, π) such that kθc k∞ ≤ γ. A solution θ̇(t) : R+ → Rn is then said to be frequency bounded if there exists a ̟o such that kθ̇(t)k∞ ≤ ̟o . In [11], the transient stability of power systems and synchronization of non-uniform Kuramoto oscillators were studied in terms of phase cohesiveness and frequency synchronization, that is limt→∞ θ̇(t) = cen for some constant c ∈ R. Since pi is time-varying in this paper, the system is not able to achieve the frequency synchronization but rather frequency boundedness in Definition 2.1. As shown in next section, the phase cohesiveness in Definition 2.1 may lead to some conservativeness and thus we will introduce a new phase cohesiveness definition later. The main objective of this paper is to investigate the synchronization of power systems and nonuniform Kuramoto oscillators (2) in the sense of Definition 2.1 and a new definition to be given in next section. III. A N EW S YNCHRONIZATION D EFINITION A ND E QUILIBRIUM S UBSPACE A. A New Synchronization Definition The notation of phase cohesiveness in the sense of Definition 2.1 was graphically explained in Example 2.2 of [10] for a two-bus system. The following example uses a three-bus system to complement the explanation in [10], explains the role of coupling forces between buses and more importantly motivates a new stability notation. A few more notations are helpful. For a set of angles (θ1 , · · · , θn ), define θ˚ 1 · · · θn the arc that starts at θ1 , ends at θn and travels across angles in the order of (θ1 , · · · , θn ) and A(θ˚ 1 · · · θn ) is its length. Example 3.1: Consider the three-bus system (2) with zero power profile pi = 0, i = 1, · · · , 3 and its network topology is illustrated in Fig. 1.b. The buses are labeled A, B, C and connected in an all-to-all fashion. As illustrated in Fig. 1.a, the bus angle in a torus is marked as a point in the circle. The desired synchronization behavior is that all three angles converge to a common value. Suppose, due to external disturbances, angle θC is disturbed to the position C1 within ¯′ . BAC ˙1 is the shortest arc containing all (θA , θB , θC ) arc AB ˙1 ) < π. In this case, the coupling in its interior and A(BAC forces among them play an active role of holding bus angles together. No matter angle θC leads ahead/lags behind angle θA , it will results in negative/positive coupling force −aCA sin(θC − θA ) at bus C, decelerating/accelerating the angle θC to force these two angles together. This argument also applies to angle pairs (A, B) and (B, C). As a result, ˙1 ) < π, and then angles the length of the arc stays A(BAC are cohesive in the sense of Definition 2.1. This mechanism 4 ˙1 ) < π which coincides with the is effective if A(BAC cohesiveness condition maxi,j∈{A,B,C} |θi − θj | ≤ γ < π. However, if θc is disturbed farther away beyond the position B ′ to the position C2 in Fig. 1.a, say within ˘ B ′ A′ . By definition, the phase cohesiveness in Definition 2.1 does not cover this case, since the shortest arc containing all (θA , θB , θC ) and with length less than π does not exist. Let us explain it in terms of coupling forces. When the angle of bus C is at C2 , the coupling forces that applies from B (simply illustrated by fBC in Fig. 1.a) and that applies from A (illustrated by fAC ) counteract with each other. Hence, whether three angles converge to a common value becomes indeterminate. Then, consider buses A, B, C are connected in a way illustrated in Fig. 1.c. As known, the coupling forces only exist between bus A and bus B and between bus A and bus C. Suppose C is at position C2 for which phase cohesiveness in Definition 2.1 fails to infer the stability. However, it is observed that the coupling forces between A and B and between A and C, tends to attract B and C towards A, making ˙2 contract and showing it is potentially stable. the region BAC   ǯ ˆ ʹ ɀ Ǯ ˆ B (a) Angles θA , θB , θC in Torus T C (b) A complete network configuration. A B C Fig. 1. Illustration of phase cohesiveness for the power system in difference network configurations. The observation in Example 3.1 motivates us to propose a different definition of phase cohesiveness that is concerned with angle differences across lines. Define θl = B θ, For the operation of classic power systems and microgrids, the load demand and the generation of non-dispatchable energy sources are predicted. They are fed into the optimal power flow algorithm to calculate the power required to be generated at dispatchable energy sources in order to meet economic goals and system operation requirements. The scheduled power generation matches the predicted demand and their relation is described by the power flow equation BAv sin(B T θe ) = po , (5) θe := θo + cen (6) with δi = θi − θio (c) A non-complete network configuration. T B. Coordinate Transformation and Equilibrium Subspace where po is a vector consisting of predicted load demand and scheduled power generation satisfying eTn po = 0. θo = col(θ1o , · · · , θno ) ∈ Rn is a constant vector that characterizes the relative angle differences among buses and c ∈ R is an arbitrary constant capturing the uniform angle offset on every bus. Since the uniqueness of equilibria is fully described by θo , in what follows, we call θo equilibrium point for simplicity. In fact, the real-time power profile pf might not align with the scheduled po , due to the load and renewable generation fluctuations caused by complicated load activity and the variation of the weather condition. Let p(t) = pf (t) − po be the power deviation from the dispatched power profile and regarded as the disturbance to power systems when the system is scheduled to operate around the equilibrium point θo . Let A ͳ complete graph, maxi,j∈{1,··· ,n} |θi − θj | ≤ γ is equivalent to max(i,j)∈V |θi −θj | ≤ γ and therefore Definition 3.1 coincides with Definition 2.1. It is worth noting that considering the system behavior of θ in Euclidean Space Rn and in Torus Tn is equivalent as far as the initial condition θ(to ) ∈ Rn at t = to satisfies max(i,j)∈E |θi (to ) − θj (to )| ≤ γ or max(i,j)∈{1,··· ,n} |θi (to ) − θj (to )| ≤ γ. (4) where B is the incidence matrices of the graph G. Each element in θl is angle difference across the corresponding physical line. Definition 3.1: (Phase Cohesiveness and Frequency Boundedness). A solution θ(t) : R+ → Tn is then said to be phase cohesive if there exists a γ ∈ [0, π) such that kθl k∞ ≤ γ. A solution θ̇(t) : R+ → Rn is then said to be frequency bounded if there exists a ̟o such that kθ̇(t)k∞ ≤ ̟o . As a result, the second case in Example 3.1 could be phase cohesive in the sense of Definition 3.1. When G is a (7) be the angle deviation from the equilibrium point. The dynamical system (2) can be rewritten in the new coordinate as follows δ̇ = −D−1 (BAv (sin(B T (δ + θo )) − sin(B T θo )) − p(t)) (8) where δ = [δ1 , · · · , δn ]T ∈ Rn . The equilibrium subspace for the system (8) is E := {δ ∈ Rn | δ = cen , ∀c ∈ R} (9) on which angle deviations are synchronized, i.e., δi − δj = 0, ∀i, j = {1, · · · , n}. As a result, the stability with respect to an equilibrium point θo is converted into the stability with respect to this equilibrium subspace E. Denote δc = BcT δ and δ̄c = max {|θio − θjo |}, i,j=1,··· ,n (10) With the coordinate transformation (7), we present weakened versions of Definition 2.1 and 3.1, respectively. 5 Definition 3.2: (Synchronization I) A solution δ(t) : R+ → R is then said to be phase cohesive if there exists a γ ∈ [0, π−δ̄c) such that kδc (t)k∞ ≤ γ. A solution δ̇(t) : R+ → Rn is then said to be frequency bounded if there exists a ̟o such that kδ̇(t)k∞ < ̟o . n Similarly, denote δl = B T δ and δ̄l = max {|θio − θjo |}. (i,j)∈E (11) The phase cohesiveness and frequency boundedness in Definition 3.1 can be given in terms of δl . Definition 3.3: (Synchronization II) A solution δ(t) : R+ → n R is then said to be phase cohesive if there exists a γ ∈ [0, π− δ̄l ) such that kδl (t)k∞ ≤ γ. A solution δ̇(t) : R+ → Rq is then said to be frequency bounded if there exists a ̟o such that kδ̇(t)k∞ < ̟o . Since |θio − θjo | ≤ c1 and |δi − δj | ≤ c2 imply |θi − θj | ≤ c1 + c2 for c1 + c2 ≤ π, the phase cohesiveness and frequency boundedness in Definition 3.2 and Definition 3.3 implies that in Definition 2.1 and 3.1, respectively. Therefore, they are weakened versions of Definition 2.1 and 3.1. In fact, taking (θo , po ) = (0, 0) in (5) results in δ = θ, p = pf and δ̄l = δ̄c = 0 which in turn recovers θ-dynamics (2) from δ-dynamics (8). In the sequel, we will mainly focus on the stability analysis in the sense of of Definition 3.2 and 3.3 and the analysis can be easily extended to Definition 2.1 and 3.1 by taking (θo , po ) = (0, 0). In this paper, we have the following assumption. Assumption 3.1: δ̄l < π/2. Note that this is a reasonable assumption for power systems, since the secure operation is assured when the angle difference across any physical line is less than π/2. IV. R EGIONAL S TABILITY A NALYSIS F RAMEWORK In this section, we will present a novel regional stability analysis framework that will be applied to explore the stability of power systems in the sense of Definition 3.2 and 3.3. Consider a nonlinear system ẋ = f (t, x) (12) where x ∈ Rn is the state and the origin is the equilibrium point of the system (12), i.e., f (t, 0) = 0. Define the compact set B(r) := {x ∈ Rn | kxk ≤ r}. The analysis is based on the region-parametrized Lyapunov function defined as follows. Definition 4.1: A continuously differentiable function V (x) : B(rm ) → R+ is called a region-parametrized Lyapunov function (RPLF) if for any given region γ ∈ [0, γm ], there exist non-negative functions α, ᾱ and µ such that for kxk ≤ γ it holds that α(γ)kxk2 ≤ V (x) ≤ ᾱ(γ)kxk2 , ∂V f (t, x) < 0, ∀kxk ≥ µ(γ). ∂x (13) (14) Remark 4.1: Note that bounds of the RPLF and the condition for its time derivative to be negative are parametrized by the size γ of the region to be considered. When the system admits a Lyapunov function Ṽ (x) : D → R+ where D ∈ B(rm ) ∈ Rn satisfying φ(kxk) ≤ Ṽ (x) ≤ φ̄(kxk) with class K functions φ and φ̄, we can use Ṽ as the RPLF candidate and explicitly calculate the bounds in (13). If lims→0 s2 /φ(s) < ∞ and lims→0 φ̄(s)/s2 < ∞, one can choose ᾱ(γ) = supkxk≤γ {φ̄(kxk)/kxk2 }, α(γ) = inf kxk≤γ {φ(kxk)/kxk2 }. The next lemma establishes the condition on which we can find a positively invariant set within the region kx(t)k ≤ γm when there exists a RPLF. It can be used to investigate the condition for the phase cohesiveness in Definition 3.2 and 3.3. Before proceeding, let us define the compact set W (r) := {x ∈ Rn | V (x) ≤ r} with V as a RPLF. Lemma 4.1: Consider nonlinear system (12). Suppose there exists a RPLF V (x) defined for kxk ≤ γm . For a given γ ∈ [0, γm ], if it holds that g(γ) := γ µ(γ) α(γ) ≥ 1, ᾱ(γ) (15) then there exists a χ ∈ R satisfying fl (γ) ≤ χ ≤ fr (γ) with fl (γ) := ᾱ(γ)µ2 (γ), fr (γ) := γ 2 α(γ) (16) such that W (χ) is a positively invariant set, i.e., any trajectories starting with x(to ) ∈ W (χ) is ultimately contained in W (fl (γ)) and along the trajectory kxk ≤ γ holds. Proof: See Appendix. Definition 4.2: A positive continuous function g(γ) : D = {γ|0 ≤ γ ≤ γm } → R+ is called a quasi-sinusoidal function if g(0) = 0, g(γm ) = 0 and g(γ) monotonically increases with x for 0 ≤ γ ≤ γ ∗ and monotonically decreases with γ for γ ∗ < x ≤ γm where r∗ = arg maxγ∈D {g(r)}. The next lemma gives the sufficient condition under which the solution to the inequality (15) exists and further elaborates the result in Lemma 4.1 provided that g(γ) in (15) is a quasisinusoidal function. Lemma 4.2: Consider nonlinear system (12) and there exists a RPLF V (x) defined for kxk ≤ γm . Suppose g(γ) in (15) is a quasi-sinusoidal function of γ ∈ [0, γm ] and maximized at γ = γ ∗ . If g(γ ∗ ) > 1, then A. there exists 0 < γmin < γ ∗ and γ ∗ < γmax < γm such that g(γmin ) = 1, g(γmax ) = 1 and g(γ) > 1 for γ ∈ (γmin , γmax ); B. (Energy Perspective) if fl (γ) is a monotonically increasing function of γ, W (χ) is a positively invariant set for every χ ∈ [fl,min , fr,max ] where fl,min = fl (γmin ) and fr,max = maxγ∈[γmin ,γmax ] {fr (γ)}. Moreover, any trajectories starting within x(to ) ∈ W (χ) is ultimately contained in W (fl,min ); 6 C. (State Perspective) let ® γl = γr = min γ∈[γmin ,γmax ] max γ∈[γmin ,γmax ] ® fl,min fl,min ≤ γ2 α(γ) α(γ) ´ fr,max fr,max ≤ γ2 ᾱ(γ) ᾱ(γ) ´ Proof: The proof is similar to that in [3], [15], [32] and hence is omitted here. According to (24) and entities in (20), we follow the procedure presented in [15] and find that α > 0, β > 0 can be selected arbitrarily and , . (17) P = (D − Den eTn D/d) Then, any trajectory starting within B(γ) for γ ∈ [γl , γr ] is ultimately contained in B(γl ). Proof: See Appendix. V. S YNCHRONIZATION AND T RANSIENT S TABILITY A NALYSIS In this section, we will explore the synchronization of power systems (8) by proposing a class of parameterized energy functions as the RPLFs. A. Energy Functions The model of microgrids can be rewritten as δ̇ = F δ − Gψ(H T δ) + Gp (18) where ψ(H T x) = BAv (sin(B T (δ + θo )) − sin(B T θo )) (19) (25) where d = eTn Den such that (24) is satisfied and the energy function (21) obtains V = 0 at equilibrium subspace E defined in (9). It will be shown that the energy function (21) is a RPLF for power systems (8) in the sense of Definition 4.1. Let us define functions κ(γ) := sinc(γ/2) cos(γ/2 + δ̄l ). (26) where δ̄l is given in (11) and f (γ) = γ q κp (γ) (27) Two more lemmas are needed before we proceed to explore the synchronization and transient stability of power systems. Lemma 5.1: ([32]) κ(γ) is a monotonically decreasing function and f (γ) is a quasi-sinusoidal function in the sense of Definition 4.2, obtains zeros at γ = 0, π − 2δ̄l and reaches its maximum at γ = γ ∗ satisfying p cos(γ ∗ + δ̄l ) = (p − q)κ(γ ∗ ). (28) where γ ∗ < π/2 − δ̄l if p > q. and F = 0, G = D−1 , H = I. (20) The equation (18) with p = 0 is similar to Lur’e form except that it is not a minimal realization and under-actuated, due to eTn ψ(H T x) = 0. Let us propose a general class of energy function V (δ) = V1 (δ) + V2 (δ) (21) Lemma 5.2: ([2]) For Hermitian nonnegative definite matrices X and Y with ordered eigenvalues, i.e., λ1 (X) ≥ · · · ≥ λn (X) and λ1 (Y ) ≥ · · · ≥ λn (Y ), it holds that λi+j−1 (XY ) ≤ λj (X)λi (Y ), i + j ≤ n + 1, (29) λi+j−n (XY ) ≥ λj (X)λi (Y ), i + j ≥ n + 1. (30) where 1 ≤ i, j ≤ n. where V1 (δ) = V2 (δ) = 1 T αδ P δ (22) 2 Z n n δ −δ i j  1 XX aij sin(u + θio − θjo ) β 2 i=1 j=1 0  − sin(θio − θjo ) du. (23) with P ∈ Rn×n and α, β ∈ R to be determined. The following proposition is inspired by the work [3], [15] and cited from [32], which is used to choose P , α and β. Proposition 5.1: ([32]) Consider the dynamic system (18) or equivalently the microgrids (8) with p = 0. If there exist a symmetric matrix P and matrices L, W , and X of proper dimensions such that the following equalities are satisfied P F + F T P = −LLT P G = αH + βF T H − LW + XeTn W TW = β(H T G + GT H), (24) then the energy function V in (21) satisfies V̇ ≤ 0 for |δi − δj | < π − 2δ̄l , ∀(i, j) ∈ E where δ̄l is defined in (11). B. Synchronization Criterion I In this subsection, we use the energy function (21) with α = 1, β = 0 and P specified in (25). The energy function is repeated as follows 1 T δ (D − Den eTn D/d)δ. (31) 2 Pn Pn 2 Due to 2(D − Den eTn D/d) = i=1 j=1 di dj (δi − δj ) , the energy function is similar to the one used in [11] where the energy function is however defined in the original θcoordinate. The difference is due to that the synchronization condition to be derived for power systems (8) is given in the angle-deviation δ-coordinate instead of the original system (2). We will adopt the regional stability analysis method presented in Section IV. Then, the synchronization condition in the sense of Definition 3.2 is presented by the following theorem with the notation Bc (γ) := {δc ∈ R(n−1)n/2 | kδc k ≤ γ}. V = Theorem 5.1: Consider power systems (8) with energy function (31) under Assumption 3.1. Assume δ̄c − δ̄l < π/2. 7 Let γ ∈ [0, π − δ̄m ) where δ̄m = max{2δ̄l , δ̄c } and κ(γ) be defined in (26). Let function σ(γ)1 be … σ(γ) = max{di dj }/ min{di dj } i6=j × i6=j nkdiag{di dj }BcT D−1 p(t)k[t0 ,∞] . γκ(γ)d (32) λ2 > λcr := σ(γ ∗ ), (33) If it holds that 2 min{di dj }/(2d), fl,min = γmin (34) 2 min{di dj }/(2d), fr,max = γmax (35) i6=j i.e., any trajectories δ starting within x(to ) ∈ W (χ) is ultimately contained in W (fl,min ); C. (Angle Perspective: phase cohesiveness) let γl = γmin , γr = γmax mini6=j {di dj } . maxi6=j {di dj } Proof: First, we will verify the energy function V (δ) in (31) is a RPLF. Note that (37) where Bc is the incidence matrix of the induced complete graph. It leads to αkδc k ≤ V ≤ ᾱkδc k (38) where δc = Bc δ and α = min{di dj }/(2d), ᾱ = max{di dj }/(2d). i6=j i6=j (39) For the rest of the proof, we consider Lyapunov function V within kδc k ≤ γ for γ ∈ [0, π − 2δ̄l ). Note that kδl k∞ ≤ kδc k∞ ≤ kδc k ≤ γ implies that |δi − δj | ≤ γ, ∀(i, j) ∈ E. The derivative of V (δ), along the trajectory of (8), is V̇ = δ T (I − Den eTn /d)[p −BAv (sin(B T (δ + θo )) − sin(B T θo ))] = −δ T BAv (sin(B T (δ + θo )) − sin(B T θo )) +δ T (I − Den eTn /d)p. n (40) 1 For convenience, we denote ks(t)k [t1 ,t2 ] = supt1 ≤t≤t2 ks(t)k for a bounded vector singal s(t). n 1 XX aij (δi − δj )2 2 i=1 j=1 ô sin(δi − δj + θio − θjo ) − sin(θio − θjo ) δi − δj λ2 ≥ κ(γ)δ T Lδ ≥ κ(γ)kδc k2 , n where the last inequality is due to Lemma 4.7 in [11] and δ T BAv (sin(B T (δ + θo )) = δ T (I − Den eTn /d)p = δc diag{di dj }BcT D−1 p/d. where we used (37). Equation (40) leads to λ2 κ(γ)kδc k2 + δc diag{di dj }BcT D−1 p/d n nkdiag{di dj }BcT D−1 p(t)k[t0 ,∞] ≤ 0, if kδc k ≥ . κ(γ)λ2 d V̇ ≤ − So far, we concluded that V is a RPLF. Then, if g(γ) := γκ(γ)/Rs ≥ 1, (36) Then, any trajectories δ(t) starting within Bc (γ) for γ ∈ [γl , γr ] is ultimately contained in Bc (γl ). D. (Frequency Boundedness) if p is bounded, there exists a T such that kδ̇k∞ ≤ ̟o for some ̟o and t > T . (D − Den eTn D/d) = Bc diag{di dj }BcT /d sin(δi − δj + θio − θjo ) − sin(θio − θjo ) δi − δj cos((δi − δj )/2 + θio − θjo ) sin((δi − δj )/2) = ≥ κ(γ) (δi − δj )/2 where κ(γ) is defined in (26). As a result, where λ2 is the algebraic connectivity of the underlying Laplacian L of power network and γ ∗ = π/2 − δ̄l , the synchronization in the sense of Definition 3.2 is achieved. In particular, A. there exists 0 < γmin < π/2 − δ̄l and π/2 − δ̄l < γmax < π − δ̄m such that λ2 = σ(γmin ), λ2 = σ(γmax ) and λ2 > σ(γ) for γ ∈ (γmin , γmax ); B. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [fl,min , fr,max ] where i6=j Since |δi − δj | ≤ γ and kθio − θjo k ≤ δ̄l for any bus j that is connected with bus i, one has where Rs := (41) … max{di dj }/ min{di dj } i6=j × i6=j nkdiag{di dj }BcT D−1 p(t)k[t0 ,∞] , λ2 d (42) the condition of Lemma 4.1 is satisfied. We further analyze the inequality (41) using Lemma 4.2. Note that g(γ) in (41) is a quasi-sinusoidal function and maximizes at γ ∗ = π/2 − δ̄l by Lemma 5.1. If g(γ ∗ ) > 1 which is equivalent to (33), it follows from Statement A of Lemma 4.2 that Statement A is satisfied. We can calculate fl,min in Lemma 4.2 as fl,min = n2 kdiag{di dj }BcT D−1 p(t)k2[t0 ,∞] maxi6=j {di dj } 2κ2 (γmin )λ22 d3 (43) 2 . Noting λ2 = σ(γmin ) and α in (39), we and fr,max = αγmax can obtain the neat expression of fl,min in (34) and fr,max in (35). As a result, Statement B follows that of Lemma 4.2. Statement C follows from that of Lemma 4.2 by noting functions α(γ) and ᾱ(γ) do not depend on γ. What remains is to prove frequency boundedness. Statement C implies that there exists a T such that the system trajectory δc (t) enters and stay in the ball B(γl ) for t > T where γl = γmin < γ ∗ = π/2 − δ̄l . We also note kδc k ≤ γl = γmin < o π/2 − δ̄l implies that |δi − δj + θij | < 12 π. As a result, RHS of (8) is bounded, which shows that kδ̇k is bounded. So, the frequency δ̇ will be ultimately bounded, i.e., kδ̇(t)k ≤ ̟o for t > T with some ̟o and T . The frequency boundedness is proved. 8 Taking (θo , po ) = (0, 0) in (5) recovers θ-dynamics (2) from δ-dynamics (8) and makes κ(γ) = sin(γ)/γ. As a result, the energy function becomes V = θT (D − Den eTn D/d)θ which coincides with the one used in [11]. Then, we arrive at the following corollary with this energy function. Corollary 5.1: Consider microgrid (2) with energy function V = θT (D − Den eTn D/d)θ. Let γ ∈ [0, π) and function σ̄(γ) be … max{di dj }/ min{di dj } σ̄(γ) = i6=j × aij 6= 0 if and only if (i, j) ∈ E, V (δ) sums up the potential energy only induced across transmission lines. Lemma 5.3: For a given γ ∈ [0, π−2δ̄l ), if max(i,j)∈E |δi − δj | ≤ γ, then α(γ)kδl k2 ≤ V (δ) ≤ ᾱkδl k2 (48) holds for α(γ) = κ(γ) min {aij }/2, ᾱ = max {aij }/2. (i,j)∈E (i,j)∈E (49) i6=j nkdiag{di dj }BcT D−1 p(t)k[t0 ,∞] sin(γ)d Proof: For any |u| ≤ γ < π and |x| ≤ δl , one has If λ2 > λcr := σ̄(γ ∗ ) holds where γ ∗ = π/2, the synchronization in the sense of Definition 2.1 is achieved. In particular, A. there exists 0 < γmin ≤ π/2 and π/2 < γmax < γmax such that λ2 = σ̄(γmin ), λ2 = σ̄(γmax ) and λ2 > λcr for γ ∈ (γmin , γmax ); B. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [fl,min , fr,max ] where 2 fl,min = γmin min{di dj }/(2d), (44) 2 fr,max = γmax min{di dj }/(2d), (45) i6=j i6=j i.e., any trajectories θ starting within x(to ) ∈ W (χ) is ultimately contained in W (fl,min ); C. (Angle Perspective: phase cohesiveness) let γl = γmin , γr = γmax mini6=j {di dj } . maxi6=j {di dj } (46) Any trajectories θ starting within Bc (γ) for γ ∈ [γl , γr ] is ultimately contained in Bc (γl ). D. if p is bounded, there exists a T such that kθ̇k∞ ≤ ̟o for some ̟o and t > T . Remark 5.1: Statement A and C in Corollary 5.1 coincide with Theorem 4.4 in [11] where constant power profile pf is considered and frequency synchronization can be achieved. As we consider some entries in power profile are time-varying, Corollary 5.1 extends the result in [11] to frequency boundedness in Statement D and in addition provide the existence of the invariant set from energy perspective in Statement B. Also, the condition is derived using the regional stability analysis method proposed in Section IV. C. Synchronization Criterion II In this subsection, we use the energy function (21) with α = 0 and β = 1 which is repeated as follows Z δi −δj n n 1 XX o o aij (sin(u + θij ) − sin θij )du. (47) V (δ) = 2 i=1 j=1 0 o where θij = θio − θjo . In fact, V (δ) is the sum of the potential energy induced by the coupling force between ith bus and jth bus when angles move away from the equilibrium θo . Since sin(u + x) − sin x ≤ 1. (50) u Applying (V-B) and (50) yields Z δi −δj n n o o sin(u + θij ) − sin θij 1 XX udu aij V (δ) = 2 i=1 i=1 u 0 Z δi −δj n n 1 XX 1 ≥ κ(γ)udu = κ(γ)δ T BAv B T δ aij 2 i=1 i=1 2 0 and 1 T δ BAv B T δ 2 Noting δl = B T δ, the proof is complete. Lemma 5.3 shows that the energy function V (δ) is bounded by quadratic functions of kδl k. Using V (δ) as the RPLF candidate, the synchronization condition in the sense of Definition 3.3 is presented by the following theorem with Bl (γ) := {δl ∈ R|E| | kδl k ≤ γ}. V (δ) ≤ Theorem 5.2: Consider power systems (8) with energy function (47) under Assumption 3.1. Let γ ∈ [0, π − 2δ̄l ) and κ(γ) be defined in (26). Let function σ(γ) be Ç å3 kAv B T D−1 p(t)k[t0 ,∞] max(i,j)∈E {aij } 2 . σ(γ) := 5 min(i,j)∈E {aij } γκ 2 (γ) (51) Define Q = Av B T D−1 BAv ≥ 0. (52) If it holds that λs (Q) > λcr := σ(γ ∗ ), (53) where λs (Q) is the smallest non-zero eigenvalue of Q and γ ∗ satisfies 5 (54) κ(γ ∗ ) = cos(γ ∗ + δ̄l ), 3 then the synchronization in the sense of Definition 3.3 is achieved. In particular, A. there exists 0 < γmin < γ ∗ and γ ∗ < γmax < γmax such that λs (Q) = σ(γmin ), λs (Q) = σ(γmax ) and λs (Q) > λcr for γ ∈ (γmin , γmax ); B. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [fl,min , fr,max ] where 2 fl,min = γmin κ(γmin ) min {aij }/2, (55) fr,max = γs2 κ(γs ) min {aij }/2, (56) (i,j)∈E (i,j)∈E 9 1 where γs satisfies cos(γs + δ̄l ) = −κ(γs ), (57) i.e., any trajectories δ starting within x(to ) ∈ W (χ) where is ultimately contained in W (fl,min ); C. (Angle Perspective: phase cohesiveness) let s min(i,j)∈E {aij } γl = γmin , γr = γs κ(γs ) . (58) max(i,j)∈E {aij } Then, any trajectories δ starting within Bl (γ) for γ ∈ [γl , γr ] is ultimately contained in Bl (γl ). D. (Frequency Boundedness) if p is bounded, there exists a T such that kδ̇k∞ ≤ ̟o for some ̟o and t > T . Proof: Let us consider Lyapunov function (47) within kδl k ≤ γ for γ ∈ [0, π − 2δ̄l ). The derivative of V (δ), along the trajectory of (8), is V̇ (δ) = n n 1 XX 2 where ξ = (Av Ap ) 2 B T δ and Q̄ = 1 1 T −1 2 (Ap Av ) B D B(Av Ap ) 2 . Note that Q̄ is the symmetric matrix whose eigenvalues are all non-negative. Let v be the eigenvector corresponding to the zero eigenvalue of Q̄. We 1 note that v ∈ null(Q̄) ∈ null(B(Av Ap ) 2 ), since Q̄v = 0 1 1 implies B(Av Ap ) 2 v = 0. Also, ξ ∈ imag((Av Ap ) 2 B T ) which shows that ξ ⊥ v, because the null space of 1 B(Av Ap ) 2 is orthogonal complement to the column space of 1 (Av Ap ) 2 B T . Then, by Courant-Fischer minimum-maximum theorem, one has min ξ6=0 where λs (Q̄) is the smallest non-zero eigenvalue of Q̄. Also, kξk2 ≥ κ(γ) min(i,j)∈E {aij }kδl k2 by noting δl = 1 1 −1 2 2 B T δ. Due to Q̄ = (A−1 v Ap ) Q(Av Ap ) , λs (Q̄) ≥ λs (Q)κ(γ)/ max(i,j)∈E {aij } by Lemma 5.2. From (61), δ T BAp Av B T D−1 BAv Ap B T δ ≥ min(i,j)∈E {aij } λs (Q)κ2 (γ)kδl k2 max(i,j)∈E {aij } o o aij (sin(δi − δj + θij ) − sin θij )(δ̇i − δ̇j ) i=1 j=1 = S(δ) + Q(δ) (59) Also one has Q(δ) in (59) where S(δ) and Q(δ) are denoted as S(δ) = 1 2 ( n X n X × −d−1 i 1 2 n n o o (sin(δi − δj + θij ) − sin θij ) 1 XX (δi − δj ) aij 2 i=1 j=1 δi − δj −1 T T −1 ×(d−1 p i pi − dj pj ) = δ BAv Ap B D ≤ kAv B T D−1 p(t)k[t0 ,∞] kδl k o o aik (sin(δi − δk + θik ) − sin(θik )) ajk k=1 Q(δ) = o o aij (sin(δi − δj + θij ) − sin θij ) due to kAp k < 1, Thus, V̇ is bounded by k=1 +d−1 j and Q(δ) = i=1 j=1 n X n X n X n X )  o o sin(δj − δk + θjk ) − sin(θjk ) V̇ ≤ − κ2 (γ)λs (Q) o o aij (sin(δi −δj +θij )−sin θij )(di−1 pi −d−1 j pj ) i=1 j=1 A manipulation of the indices in S(δ) leads to ) ( n n X 1 X o o S(δ) = − aij (sin(δi − δj + θij ) − sin θij ) × d j=1 i=1 i ( n ) X  o o (60) aij sin(δi − δj + θij ) − sin(θij ) j=1 The RHS of the last equality in (60) equals to S(δ) = −δ T BAp Av B T D−1 BAv Ap B T δ where Ap is a diagonal matrix with diagonal elements being Ap (k, k) = o o sin(δi − δj + θij ) − sin θij , δi − δj for (i, j) = Ek , k = 1, · · · , |E|. It is noted from (V-B) that Ap (k, k) ≥ κ(γ), when |θio − θjo | ≤ δl and |δi (t) − δj (t)| < γ for any (i, j) ∈ E. One has δ T BAp Av B T D−1 BAv Ap B T δ = ξ T Q̄ξ ξ T Q̄ξ ≥ kξk2 min T . ξ6=0 ξ ξ ξ T Q̄ξ ξ T Q̄ξ = min = λs (Q̄) T ξ6=0,ξ⊥v ξ T ξ ξ ξ (61) min(i,j)∈E {aij } kδl k2 max(i,j)∈E {aij } + kAv B T D−1 p(t)k[t0 ,∞] kδl k kAv B T D−1 p(t)k[t0 ,∞] max(i,j)∈E {aij } ≤0, if kδl k ≥ λs (Q)κ2 (γ) min(i,j)∈E {aij } (62) So far, we proved that V is a RPLF. Then, if 5 g(γ) := γκ 2 (γ)/Rs > 1, where Rs := Ç max(i,j)∈E {aij } min(i,j)∈E {aij } å 23 kAv B T D−1 p(t)k[t0 ,∞] λs (Q) (63) (64) the condition of Lemma 4.1 is satisfied. We further analyze the inequality (63) using Lemma 4.2. Note that g(γ) in (41) is a quasi-sinusoidal function by Lemma 5.1 and maximizes at γ ∗ which satisfies (54). If g(γ ∗ ) > 1 which is equivalent to (53), it follows from Lemma 4.2 that Statement A is satisfied with γmin < π/2 − δ̄l (by Lemma 5.1). We calculate fl (γ) as follows 3 kAv B T D−1 p(t)k2[t0 ,∞] max(i,j)∈E {aij } fl (γ) = 2 2λ2s (Q)κ4 (γ) min(i,j)∈E {aij } It is a monotonically increasing function of γ, because κ(γ) is a monotonically decreasing function by Lemma 5.1. As a result, fl,min = fl (γmin ). We can obtain the neat expression of 10 fl,min in (55) by noting λs (Q) = σ(γmin ). We can calculate fr (γ) = γ 2 κ(γ) min(i,j)∈E {aij }/2. By Lemma 5.1, arg max γ∈[γmin ,γmax ] B. (Angle Perspective) let γr = (π − δ̄m ) {γ 2 κ(γ)} = γs , where γs satisfies (57). Thus, Statement B follows. Applying Lemma 4.2 shows γl is γl = γmin . Then, Statement C follows from that of Lemma 4.2 by noting that the function ᾱ does not depend on γ. Statement D about frequency boundedness can easily follows from similar argument in Theorem 5.1 by noting that the system trajectory is ultimately contained in B(γl ), i.e., kδl k ≤ γl = γmin ≤ π/2 − δ̄l . mini6=j {di dj } , maxi6=j {di dj } (68) Then, any trajectories starting within Bc (γ) for γ ∈ [0, γr ] ultimately converge to equilibrium subspace E, i.e., the region of attraction is kBcT δk ≤ γr . Proof: Note that the derivative of V (δ), along the trajectory of (8), is λ2 κ(γ)kδc k2 . n Then, the result follows from Lemma 6.1 and Theorem 5.1. V̇ ≤ − VI. E XTENSION TO N ON - DISTURBANCE C ASE : R EGION ATTRACTION OF In this section, we will extend the regional stability analysis method presented in Section IV and stability analysis in Section V-B and V-C to the non-disturbance case, i.e., p = 0 in (8). These results can be utilized to estimate the region of attraction for power systems (8), which is useful to assess the stability of power systems following severe faults such as tripping of a line. We first derive a variant of Lemma 4.2 when the derivative of the RPLF V (x) satisfies (14) with µ(γ) = 0. Lemma 6.1: Consider nonlinear system (12) with regional Lyapunov function satisfying (13) and (14) with µ(γ) = 0. Then, A. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [0, fr,max] where Theorem 6.2: Consider microgrid (8) with p(t) = 0 and energy function (47). A. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [0, fr,max] where fr,max = γs2 κ(γs ) min {aij }/2, (i,j)∈E (69) where γs satisfies (57), i.e., any trajectories starting within x(to ) ∈ W (χ) where ultimately converge to equilibrium subspace E; B. (Angle Perspective) let s min(i,j)∈E {aij } , (70) γr = γs κ(γs ) max(i,j)∈E {aij } (65) Then, any trajectories starting within Bl (γ) for γ ∈ [0, γr ] ultimately converge to equilibrium subspace E, i.e., the region of attraction is kB T δk ≤ γr . i.e., any trajectories starting within x(to ) ∈ W (χ) ultimately converge to equilibrium point. B. (State Perspective) let ® ´ fr,max fr,max 2 γr = max ≤γ . (66) ᾱ(γ) ᾱ(γ) γ∈[0,γm ] Proof: Note that the derivative of V (δ), along the trajectory of (8), is fr,max = max {γ 2 α(γ)}, γ∈[0,γm ] Then, any trajectories starting within B(γr ) for γ ∈ [0, γr ] ultimately converge to equilibrium point, i.e., the region of attraction is kxk ≤ γr . Proof: Note that fr (γ) > fl (γ) in Lemma 4.1 holds for all γ ∈ [0, γm ], since µ(γ) = 0. The proof easily follows from that of Lemma 4.1 and 4.2 by setting µ(γ) = 0. Then, we can use Lemma 6.1 to show the next two theorems. Theorem 6.1: Consider microgrid (8) with p(t) = 0 and energy function (31). A. (Energy Perspective) W (χ) is a positively invariant set for any χ ∈ [0, fr,max] where fr,max = (π − δ̄m )2 min{di dj }/(2d), i6=j (67) where δ̄m is given in Theorem 5.1, i.e., any trajectories starting within x(to ) ∈ W (χ) ultimately converge to equilibrium subspace E; V̇ ≤ −κ2 (γ)λs (Q) min(i,j)∈E {aij } kδl k2 max(i,j)∈E {aij } (71) Then, the result follows from Lemma 6.1 and Theorem 5.2. Remark 6.1: When a fault occurs, we need to assure that the power system remains stable after the fault is cleared. The time duration between the fault occurence and fault clearance is called critical clearing time. If the fault is cleared before the fault-on trajectories reach the boundaries of the region of attraction in Theorem 6.1 and 6.2, the trajectories can converge back to equilibrium subspace E again. Therefore, we can use Theorem 6.1 and 6.2 to calcuate the critical clearing time for power systems, which will be demonstrated in Section VII. VII. N UMERICAL S IMULATION Consider lossless microgrids in the network structure of IEEE 9-bus test system illustrated in Fig. 2. Buses 1, 2, 3 are the inverter-interfaced energy sources while the other buses are load buses. The numerical simulation will compare two algebraic stability conditions (33) and (53) given in Theorem 5.1 and 5.2, respectively. Both conditions are sufficient 11 TABLE I T RANSMISSION LINE PARAMETERS AND NOMINAL POWER PROFILE poi line parameters (per unit) aij (set 1) aij (set 2) bus number i θio (rad, set 1) θio (rad, set 2) poi (per unit) a14 17.2376 8.4148 1 0.1162 0.1841 1.17 a45 10.7036 10.6607 2 0.2195 0.1994 1.63 a56 5.8484 9.9044 3 0.1406 0.1269 0.85 conditions for the synchronization. We will use two sets of line parameters aij and show that one condition is not necessarily better than the other but they complement each other for predicting the stability and estimating the region of attraction. Two sets of line parameters aij and the nominal power profile po = col{po1 , · · · , pon } are given in Table. I. Note that max(i,j)∈E {aij }/ min(i,j)∈E {aij } = 1.6243 in set 2 compared with max(i,j)∈E {aij }/ min(i,j)∈E {aij } = 2.9474 in set 1, showing line parameters in set 2 are more evenly distributed across the network than set 1. The solutions θo to power flow equation (5) can be calculated and illustrated in Table. I. As a result, θ̄l in (11) is θ̄l = 0.2195 rad for set 1 and θ̄l = 0.1395 rad for set 2. The system parameter di is randomly generated within range di ∈ [0.7, 1]. We will emulate two scenarios: the time-varying disturbance scenario with p 6= 0 and line tripping scenario with p = 0 in (8). First, for t ∈ [0, 5)s, since the equilibrium point is locally stable, we allow angles to settle to the equilibrium subspace E. For the time-varying disturbance scenario, after t = 5s, a random disturbance is injected at bus 1 to emulate the power generation fluctuation for renewable power. The disturbance will change its value randomly every 0.1 s, but its magnitude is bounded, i.e., supt∈[0,∞) |p(t)| < pd for some constant pd . For line tripping scenario, at t = 5s, we assume the electric line connecting bus 1 and 4 trips causing the system instability and making system trajectory leaves the equilibrium subspace E. Theorem 6.1 and Theorem 6.2 give two estimation of region of attraction, namely kBc δk ≤ γr for γr in (68) and kBδk ≤ γr for γr in (70). When both conditions C1 : kBc δk ≥ γr and C2 : kBδk ≥ γr are triggered, we immediately re-close the line and retain the origin system structure making system trajectory converge to the equilibrium subspace E again. We denote T1 and T2 as the time when C1 and C2 are triggered, respectively. In fact, T1 and T2 are the critical clearing time based on estimation of region of attraction given by Theorem 6.1 and Theorem 6.2. Note that the larger critical clearing time is more desirable, which allows more time for the protection system to take actions. For time-varying disturbance scenario with parameter set 1 , we set disturbance level pd = 1.0, one can calculate λ2 = 4.0147 and λcr = 3.961 such that the algebraic stability condition (33) is satisfied, while λs (Q) = 32.6285 and λcr = 47.5875 which shows the algebraic stability condition (53) is not satisfied and hence gives more conservative stability result. For the line tripping scenario, one can calculate region of attraction from Theorem 6.1 and 6.2 and obtains two estimations C1 : kBc δk ≤ 2.3044 and C2 : kBδk ≤ 0.7115, a36 17.1069 10.1356 4 0.0483 0.0446 -0.2 a67 9.8343 12.2033 5 0.0089 0 -0.9 a78 13.6459 10.6274 6 0.0909 0.0429 -0.1 a82 15.8972 13.6683 7 0.0634 0.0163 -1 a89 6.0142 9.5708 8 0.1168 0.0799 -0.2 a94 11.3837 11.3565 9 0 0.0009 -1.25 Fig. 2. Microgrids in 9-bus IEEE Test system structure respectively. The numerical simulation shows that the critial clearing time T2 = 5.4658s and T1 = 5.6167s at which the line is re-connected, concluding that the stability result in terms of Definition 3.3 is more conservative than Definition 3.2. The simulation result is illustrate in Fig. 3. For time-varying disturbance scenario with parameter set 2, we set disturbance level pd = 5.0, one can calculate λs (Q) = 48.5049 and λcr = 45.6904 such that the algebraic stability condition (53) is satisfied, while λ2 = 4.5773 and λcr = 45.6904 which shows the algebraic stability condition (33) is not satisfied and hence gives more conservative stability result. For the line tripping scenario, one can calculate the region of attraction from Theorem 6.1 and 6.2 and obtains two estimations C1 : kBc δk ≤ 2.2684 and C2 : kBδk ≤ 0.9393, respectively. The numerical simulation shows that the critical clearing time T1 = 5.6002s and T2 = 5.6439s, concluding that the stability result in terms of Definition 3.2 is more conservative than Definition 3.3. The simulation result is illustrate in Fig. 4. VIII. C ONCLUSION In this paper, we first presented the first-order power system model which coincides with non-uniform Kuramoto oscillators. Then, we introduced two definitions of stability in terms of phase cohesiveness and frequency boundedness. We proposed the stability analysis framework based on the RPLF and applied it to derive stability conditions in terms of two proposed stability definitions. Finally, we explicitly gave the estimation of region of attraction for microgrids. The effectiveness of the theoretical analysis is verified by the numerical simulation. A PPENDIX Proof of Lemma 4.1: Since V (x) is a RPLF satisfying (13) and (14), V (x) decreases outside the ball B(µ(γ)). In 12 angle angle [rad] 0.4 0.2 0 0 5 10 t [s] 15 20 bus 1 bus 2 bus 3 bus 4 bus 5 bus 6 bus 7 bus 8 bus 9 ɖ ˆ” ɖ̵ ɀ‹ ɀ̵ͳ (a) Time-varying disturbance scenario. ˆŽ ɀͳ ɀ‘ ɀƒš Fig. 5. The relation between fl (γ) and fr (γ). ɀ angle bus 1 bus 2 bus 3 bus 4 bus 5 bus 6 bus 7 bus 8 bus 9 angle [rad] 1 0.5 0 0 2 4 t [s] 6 8 (b) Line tripping scenario. Fig. 3. Simulation for parameter set 1. angle bus 1 bus 2 bus 3 bus 4 bus 5 bus 6 bus 7 bus 8 bus 9 angle [rad] 1 0 −1 0 5 10 t [s] 15 20 (a) Time-varying disturbance scenario. angle angle [rad] 1.5 1 0.5 0 0 2 4 t [s] 6 8 bus 1 bus 2 bus 3 bus 4 bus 5 bus 6 bus 7 bus 8 bus 9 (b) Line tripping scenario. Fig. 4. Simulation for parameter set 2. fact, B(µ(γ)) is contained in W (χ), which follows from x ∈ B(µ(γ)) ⇒ x ∈ W (fl (γ)) ⇒ x ∈ W (χ) due to χ ≥ fl (γ). Therefore, one has V̇ < 0 at the boundary of W (χ) and hence W (χ) is an invariant set, i.e., any trajectories starting with x ∈ W (χ) will converge to and stay in W (fl (γ)). The above argument is based on the argument kxk ≤ γ (the requirement for the existence of the RPLF). Next, we will show the condition kx(t)k ≤ γ holds for t ≥ to which is true if χ ≤ fr (γ), due to α(γ)kx(t)k2 ≤ V (x(t)) ≤ χ ≤ fr (γ). (72) Hence, if fr (γ) ≥ fl (γ) or equivalently (15) holds, it is guaranteed that the invariant set W (χ) within which kx(t)k ≤ γ can be found. The proof is thus complete. Proof of Lemma 4.2: We will prove A ⇒ B ⇒ C. ⇒ A. It is very straightforward to verify Statement A when g(γ) is a quasi-sinusoidal function. In the rest of the proof, we consider functions g(γ), fl (γ) and fr (γ) within the range γ ∈ [γmin , γmax ]. A ⇒ B. Statement A implies that fl (γ) ≤ fr (γ) for γ ∈ [γmin , γmax ], fl (γmin ) = fr (γmin ) and fl (γmax ) = fr (γmax ). By Lemma 4.1, χ ∈ [fl (γ), fr (γ)] whose maximum range is [fl,min , fr,max ] as γ varies within γ ∈ [γmin , γmax ]. The relation between fl (γ) and fr (γ) is schematically illustrated in Fig. 5. For any χ ∈ [fl,min , fr,max ], one can find γ1 = arg minγ∈[γmin,γmax ] {fr (γ) = χ}. Since fl (γ1 ) ≤ χ ≤ fr (γ1 ), applying Lemma 4.1 shows any trajectories starting within x ∈ W (χ) is ultimately contained in the invariant set W (fl (γ1 )). Set χ′ = fl (γ1 ) ≥ fl (γmin ) and repeat the above argument with χ replaced by χ′ < χ and find γ1′ . It is noted χ′ and γ1′ until χ′ = fl (γmin ). This search pattern is illustrated in Fig. 5. Then, we can prove the trajectory is eventually contained in set W (fl (γmin )). Statement B is proved. B ⇒ C. Due to (13), ᾱ(γ)kxk2 p ≤ fr,max implies V ≤ fr,max , which shows that B( fr,max /ᾱ(γ)) ∈ W (f pr,max ), i.e., any trajectory starts inside the ball B( fr,max p /ᾱ(γ)) is also inside W (fr,max ). The size of the ball B( fr,max /(ᾱ(γ)) depends on the choice of γ and is required to be smaller than γ (the requirement of the RPLF for us to use (13)). We need to seek such ball of the largest size inside W (fr,max ), which is equivalent to find γr in (17). As a result, B(γr ) ∈ W (fr,max ). We can use similar argument to obtain γl . Because V ≤ 2 fl,min p implies α(γ)kxk ≤ fl,min , one has W (fl,min ) ∈ B( fl,min )/α(γ)), i.e.,pany trajectory entering W (fl,min ) alsopenters the ball B( fl,min /α(γ)). The size of the ball B( fl,min )/α(γ)) depends on the choice of γ and is also required to be smaller than γ. We need to seek such ball of the smallest size that encloses W (fl,min ), which is equivalent to find γl in (17). As a result, W (fl,min ) ∈ B(γl ). Then, the statement C follows from statement B. R EFERENCES [1] N. Ainsworth and S. Grijalva. A structure-preserving model and sufficient condition for frequency synchronization of lossless droop inverter-based AC networks. IEEE Transactions on Power Systems, 28(4):4310–4319, 2013. [2] A. Amir-Moéz. Extreme properties of eigenvalues of a hermitian transformation and singular values of the sum and product of linear transformations. Duke Mathematical Journal, 23(3):463–476, 1956. [3] B.D.O. Anderson. Stability of control systems with multiple nonlinearities. Journal of the Franklin Institute, 282(3):155–160, 1966. [4] T. Athay, R. Podmore, and S. Virmani. A practical method for the direct analysis of transient stability. IEEE Transactions on Power Apparatus and Systems, (2):573–584, 1979. 13 [5] A. Bergen and D. Hill. A structure preserving model for power system stability analysis. IEEE Transactions on Power Apparatus and Systems, (1):25–35, 1981. [6] H. Chang, C. Chu, and G. Cauley. Direct stability analysis of electric power systems using energy functions: theory, applications, and perspective. Proceedings of the IEEE, 83(11):1497–1529, 1995. [7] H. Chiang and C. Chu. Theoretical foundation of the BCU method for direct stability analysis of network-reduction power system. models with small transfer conductances. IEEE Transactions on Circuits and Systems I: Fundamental Theory and Applications, 42(5):252–265, 1995. [8] N. Chopra and M. Spong. On exponential synchronization of Kuramoto oscillators. IEEE Transactions on Automatic Control, 54(2):353–357, 2009. [9] S. Chung and J. Slotine. On synchronization of coupled Hopf-Kuramoto oscillators with phase delays. In 49th IEEE Conference on Decision and Control, pages 3181–3187, 2010. [10] F. Dörfler and F. Bullo. On the critical coupling for Kuramoto oscillators. SIAM Journal on Applied Dynamical Systems, 10(3):1070–1099, 2011. [11] F. Dörfler and F. Bullo. Synchronization and transient stability in power networks and nonuniform Kuramoto oscillators. SIAM Journal on Control and Optimization, 50(3):1616–1642, 2012. [12] F. Dörfler, J.W. Simpson-Porco, and F. Bullo. Breaking the hierarchy: Distributed control and economic optimality in microgrids. IEEE Transactions on Control of Network Systems, 3(3):241–253, 2016. [13] A. El-Abiad and K. Nagappan. Transient stability regions of multimachine power systems. IEEE Transactions on Power Apparatus and Systems, (2):169–179, 1966. [14] A. Franci, A. Chaillet, and W. Pasillas-Lépine. Phase-locking between Kuramoto oscillators: robustness to time-varying natural frequencies. In 49th IEEE Conference on Decision and Control, pages 1587–1592, 2010. [15] D. Hill and A. Bergen. Stability analysis of multimachine power networks with linear frequency dependent loads. IEEE Transactions on Circuits and Systems, 29(12):840–848, 1982. [16] D. Hill and G. Chen. Power systems as dynamic networks. In IEEE International Symposium on Circuits and Systems, pages 722–725, 2006. [17] D. Hill and C. Chong. Lyapunov functions of Lur’e-Postnikov form for structure preserving models of power systems. Automatica, 25(3):453– 460, 1989. [18] Z. Huang, S. Jin, and R. Diao. Predictive dynamic simulation for large-scale power systems through high-performance computing. In High Performance Computing, Networking, Storage and Analysis (SCC), pages 347–354, 2012. [19] A. Jadbabaie, N. Motee, and M. Barahona. On the stability of the Kuramoto model of coupled nonlinear oscillators. In Proceedings of American Control Conference, volume 5, pages 4296–4301, 2004. [20] P. Kundur, N. Balu, and M. Lauby. Power system stability and control, volume 7. McGraw-hill New York, 1994. [21] R. H. Lasseter. MicroGrids. In IEEE Power Engineering Society Winter Meeting, volume 1, pages 305–308, 2002. [22] G.A. Lüders. Transient stability of multimachine power systems via the direct method of lyapunov. IEEE Transactions on Power Apparatus and Systems, (1):23–36, 1971. [23] R. Majumder. Some aspects of stability in microgrids. IEEE Transactions on power systems, 28(3):3243–3252, 2013. [24] Z. Miao, A. Domijan, and L. Fan. Investigation of microgrids with both inverter interfaced and direct ac-connected distributed energy resources. IEEE Transactions on Power Delivery, 26(3):1634–1642, 2011. [25] I. Nagel, L. Fabre, M. Pastre, F. Krummenacher, R. Cherkaoui, and M. Kayal. High-speed power system transient stability simulation using highly dedicated hardware. IEEE Transactions on Power Systems, 28(4):4218–4227, 2013. [26] P. Piagi and R.H. Lasseter. Autonomous control of microgrids. In Power Engineering Society General Meeting, 2006. IEEE, pages 8–pp. IEEE, 2006. [27] J. Schiffer, R. Ortega, A. Astolfi, J. Raisch, and T. Sezi. Conditions for stability of droop-controlled inverter-based microgrids. Automatica, 50(10):2457–2469, 2014. [28] J. Schiffer, T. Seel, J. Raisch, and T. Sezi. Voltage stability and reactive power sharing in inverter-based microgrids with consensusbased distributed voltage control. IEEE Transactions on Control Systems Technology, 24(1):96–109, 2016. [29] J.W. Simpson-Porco, F. Dörfler, and F. Bullo. Droop-controlled inverters are kuramoto oscillators. IFAC Proceedings Volumes, 45(26):264–269, 2012. [30] J.W. Simpson-Porco, F. Dörfler, and F. Bullo. Synchronization and power sharing for droop-controlled inverters in islanded microgrids. Automatica, 49(9):2603–2611, 2013. [31] M. Verwoerd and O. Mason. On computing the critical coupling coefficient for the Kuramoto model on a complete bipartite graph. SIAM Journal on Applied Dynamical Systems, 8(1):417–453, 2009. [32] L. Zhu and D. Hill. Transient stability analysis of power systems: A network perspective (accepted for SIAM Journal on Control and Optimization). 2018. [33] L. Zhu and D.J. Hill. Transient stability analysis of microgrids with network-preserving structure. In 6th IFAC Workshop on Distributed Estimation and Control in Networked Systems, 2016.
3cs.SY
TOWARDS CT-QUALITY ULTRASOUND IMAGING USING DEEP LEARNING Sanketh Vedula?,† Ortal Senouf ?,† Alex M. Bronstein† Oleg V. Michailovich‡ Michael Zibulevsky† † arXiv:1710.06304v1 [cs.CV] 17 Oct 2017 ‡ Technion – Israel Institute of Technology Electrical and Computer Engineering, University of Waterloo, Canada ABSTRACT The cost-effectiveness and practical harmlessness of ultrasound imaging have made it one of the most widespread tools for medical diagnosis. Unfortunately, the beam-forming based image formation produces granular speckle noise, blurring, shading and other artifacts. To overcome these effects, the ultimate goal would be to reconstruct the tissue acoustic properties by solving a full wave propagation inverse problem. In this work, we make a step towards this goal, using Multi-Resolution Convolutional Neural Networks (CNN). As a result, we are able to reconstruct CT-quality images from the reflected ultrasound radio-frequency(RF) data obtained by simulation from real CT scans of a human body. We also show that CNN is able to imitate existing computationally heavy despeckling methods, thereby saving orders of magnitude in computations and making them amenable to real-time applications. Index Terms— Ultrasound imaging, inverse problem, despeckling, deconvolution, deep learning, X-ray CT. 1. INTRODUCTION Medical ultrasound (US) is a widespread imaging modality owing its popularity to cost efficiency, portability, speed, and lack of harmful ionizing radiation. Unfortunately, the quality of medical ultrasound scans is typically affected by a number of artifacts, some of which are rooted in the physics of ultrasound image formation. Thus, for example, the band-limited characteristics of acoustic beamforming are generally responsible for the reduced spatial resolution. Additionally, the coherent nature of ultrasound image formation makes the resulting scans suffer from the degrading effect of speckle noise, which tends to reduce image contrast and obscure diagnostically relevant details. As a result, ultrasound imaging has limited applicability to clinical tasks relying on tissue characterization. The problem of speckle noise contamination is traditionally solved by means of image despeckling. Thus, in the past decade, the arsenal of image despeckling algorithms has been enhanced by particularly effective methods based on homomorphic de-noising [1], non-local means (NLM) [2], and ? equal contribution BM3D filtering [3]. Although some of these methods have already been integrated in high-end ultrasound scanners, their elevated computational requirement and relatively long runtimes prevent their deployment on portable devices or in realtime applications. Recently, convolutional neural networks (CNN) have been extensively used for solving various problems of image processing [4, 5], including some important medical imaging applications, among which are X-ray CT image reconstruction [6] and denoising [7]. In this paper, we demonstrate the applicability of CNN as a means for fast and accurate approximation of the image restoration results produced by advanced (yet, relatively slow) despeckling algorithms. We believe the availability of such solutions opens the doors to the possibility of using cutting-edge signal processing on low-cost (portable) devices and in real-time applications. In addition, we also demonstrate the applicability of CNN to the reconstruction of “CT-quality” ultrasound images from standard ultrasonograms. The contributions of this paper are three-fold: Firstly, we propose an end-to-end CNN architecture for real-time despeckling of ultrasound images. Secondly, we show that our network successfully approximates the state-of-the-art de-speckling algorithms, and works about ×4 faster on GPU, and ×8 − 260 faster on CPU, which makes it amenable to real-time applications. Finally, aiming to go beyond the quality of despeckling, we propose a method for training CNN for the purpose of converting regular US scans into corresponding “CT-like” images which feature substantially improved resolution and contrast, while preserving all the relevant anatomical and pathological information. The remainder of the paper is organized as follows: We briefly overview the proposed methodology in Section 2 and provide its experimental assessment in Section 3. Section 4 concludes the paper. 2. METHODS 2.1. Restoration of medical ultrasound scans The quintessential goal of ultrasound image despeckling is to reject the spurious variations of image intensity caused by speckle noise, while preserving the anatomical integrity and discernibility of diagnostical details. More often than not, the methods of image despeckling take advantage of advanced denoising methodologies, properly adapted to cope with the peculiar statistical nature of speckle noise. In particular, the nowadays standard methods of image denoising based on multi-resolution analysis and sparse representations, Bayesian estimation and random Markov fields, diffusionbased filtering, and non-local means, have all been attempted in application to image despeckling[8]. In view of this fact, it is hardly surprising that image despeckling faces the same challenges as the more general methods of image denoising, chief among which is the fact that their effectiveness tends to increase pro rata with computational complexity. As a result, despite the recent advances in computational technologies, many powerful despeckling and denoising tools are still unavailable for real-time applications. The most prominent examples of such methods include NLM [2] and BM3D [3] filters, both of which have polynomial time complexity, even under approximative execution. Accordingly, the principal goal of this study has been to develop CNN capable of accurately approximating the effect of the above filters at much smaller run-times. In this work, all the proposed and reference methods are applied within the homomorphic filtering framework, which considers speckle noise to be multiplicative in its nature. Thus, a typical homomorphic filter amounts to denoising of logarithmically transformed data, followed by exponentiation of the result thus obtained. Moreover, as demonstrated in [1], this type of despeckling becomes particularly effective if applied to the envelops of deconvolved RF data, with an addition of the procedure of outlier shrinkage. While the deconvolution is helpful in substantially decorrelating the speckle noise, the outlier shrinkage has an effect of gaussianization of noise behaviour via suppressing the “heavy tails” of the noise distribution produced by the log transform. The net effect of the above preprocessing is a considerable simplification of the statistical properties of the noise that can now be treated as being approximately white and Gaussian. Consequently, in what follows, all the tested method are applied to the preprocessed data, with particular denoising methods being total-variation (TV), NLM, and BM3D filtering. 2.2. Data Sources In order to conduct numerical experiments under controllable conditions, in silico ultrasound datasets were used. Unfortunately, in view of the fact that training of CNN normally requires tens of thousands of images, generating such data by means of standard simulation software packages (such as, e.g., k-Wave or Field-II) was found to be infeasible. As a result, the in silico data were simulated using the fast simulation scheme of [9], which allows one to properly model all the major US artifacts, including acoustic shadowing, dispersive attenuation, refraction-related effects, etc. The simu- lation parameters were set so as to mimic the characteristics of a standard linear array probe with a central frequency of 5 MHz and an approximate Q-factor of 0.5. The distributions of tissue density and acoustic velocities have been deduced from the corresponding Hounsfield units of abdominal X-ray CT scans. 2.3. CNN-based approximation In our work, we use the in-phase/quadrature (IQ) images that are derived from radio-frequency (RF) images through the process of frequency demodulation. We propose training a CNN over the dataset of pairs of IQ images and resulted conventional despeckled images to achieve a fast approximation of the despeckling algorithms mentioned in Section 2.1. Going beyond despeckling, we aim to estimate the CT image given an ultrasound one by exploiting the fact that intensity in CT images (measured in Hounsfield units) is proportional to the tissue density. Similarly, ultrasound imaging depends on the speed of sound and acoustic impedance, which in turn are also directly influenced by the density of the tissue. Hence, it is clear that the X-ray CT and ultrasound imaging are affected by a common physical property of the tissue. Exploiting this fact, we propose to use CNN to approximate a “CT-quality” image of the tissue given its corresponding ultrasound image. Experiments presented in this paper were conducted using a multi-resolution fully convolutional neural network (CNN) consisting of a down-sampling track followed by an up-sampling track. Our network consists of 10 convolutional layers with symmetric skip connections from each layer in the down-sampling track to its corresponding layer in the up-sampling track, similar to [10]. All the kernel sizes of convolutions have been set to be 3 × 3. The non-linearities are set to ReLU and training is performed on mini-batches of 6 images using Adam optimizer, with a learning rate of 1 × 10−4 . 3. EXPERIMENTS 3.1. Fast approximation of despeckling Dataset. The US RF data (IQ images) was obtained by applying our simulator described in Section 2.2 to CT image patches extracted from the Cancer Imaging Archive (TCIA) [11]. Conventional despeckling algorithms (TV, BM3D, NLM) were applied on the US IQ data and the corresponding despeckled patches were generated. Training. The dataset comprised of 8200 samples of US IQ images and the corresponding despeckled images using the conventional despeckling algorithms mentioned above. The network architecture as detailed in Section 2.3 was implemented with the two input channels corresponding to real and imaginary parts of the complex-valued IQ image, and the CPU GPU BM3D 390.7s - NLM 400.3s - TV 12.8s 0.78s CNN(ours) 1.5s 0.2s Table 1. Run-time comparison of conventional and CNNbased to despeckling on a 256 × 256 × 64 US volume PSNR BM3D 34.40dB NLM 35.33dB US image(a) TV NLM BM3D CNN-TV 35.43 dB CNN-NLM 32.6 dB CNN-BM3D 42.43 dB TV NLM BM3D CNN-TV 31.08 dB CNN-NLM 32.01 dB CNN-BM3D 32.26 dB TV 41.66dB Table 2. Average PSNR of despeckling approximation by CNN calculated with respect to the conventional despeckling output image. output as the corresponding despeckled image. Training was performed for 50K-60K mini-batch iterations for 2 hours. Results. Post training, 420 pairs of US IQ images and their respective despeckled patches were considered for evaluation. The performance of trained network was compared to that of the conventional despeckling algorithms. The benchmarking was performed on both Intel Xeon E5 CPU and an NVIDIA Titan X GPU. It has to be noted that the GPU implementations of BM3D and NLM methods was not available for comparison. The run-time results for each algorithm are summarized in Table 1 with their corresponding PSNR in Table 2. It can be observed that the CNN approximation of different despeckling algorithms gained a run-time speed-up in the range of ×4 on the GPU and ×8 − 260 on the CPU as compared to their off-the-shelf GPU/CPU counterparts, while maintaining an accurate approximation of the original despeckling output. A visual inspection of the results is displayed in Figure 1 showing that the CNN, upon training, can approximate any well-engineered time-consuming despeckling algorithms accurately while producing orders of magnitude of speed-up needed for real-time applications. It is also important to note that the current results were obtained with minimal optimization of the network architecture which means that a more compact network might achieve similar results in a shorter time. 3.2. Reconstructing ‘CT-quality’ images Datasets. The CT image patches were extracted from the TCIA datasets[11] with corresponding ultrasound IQ images generated using the simulator described in Section 2.2. Training. Using the network architecture proposed in Section 2.3, training was performed on a dataset comprising of 13,860 patches from ultrasound IQ images (2 channels) as input and the corresponding CT patches as the output. Training was run for 160K mini-batches for 4 hours on an NVIDIA Titan X GPU. US image(b) Fig. 1. CNN approximation of different despeckling methods. Two examples of despeckling approximation are presented. Odd rows depict conventional despeckling of the input US image in the leftmost column, while even rows display the CNN approximation. PSNR is reported for each CNN approximation with respect to the corresponding original despeckled image. Results. Results are presented in Figure 2. We compare the performance of the reconstructed CT images to conventional and CNN-approximated despeckling methods, and for all the images, the PSNR is presented with respect to the ground truth CT(columns 3 and 4 in Figure 2). We can observe both visually and quantitatively that our reconstructed CT images look closer to the ground truth CT when compared to the despeckled ones. Additionally, in order to verify that our network does not overfit the dataset, and generalizes well to previously unseen data, we tested it on a different CT dataset obtained from TCIA. The average PSNR of the reconstructed CT-quality images with respect to ground truth CT was 23.79 dB, which resembles the performance on the training set. We can observe in our results (column 1 and 5 in Figure 2) that the trained network is able to recover the overall anatomy and the contrast accurately, except for the CT-specific noise, a feature that CT and ultrasound imaging do not share. A possi- CT GT US Image TV CNN-TV 5.32 dB 5.28 dB 6.99 dB 6.93 dB 4.42 dB 4.68 dB 5.17 dB 5.38 dB 4.21 dB 10.85 dB 4.57 dB 11.32 dB CNN-CT 5. REFERENCES 18.22 dB [1] Oleg V Michailovich and Allen Tannenbaum, “Despeckling of medical ultrasound images,” IEEE Transactions on Ultrasonics, Ferroelectrics, and Frequency Control, vol. 53, no. 1, pp. 64–78, 2006. 18.5 dB [2] Pierrick Coupé, Pierre Hellier, Charles Kervrann, and Christian Barillot, “Nonlocal means-based speckle filtering for ultrasound images,” IEEE Transactions on Image Processing, vol. 18, no. 10, pp. 2221–2229, 2009. 24.57 dB 23.37 dB 27.64 dB 19.71 dB Fig. 2. Reconstructing ‘CT-quality’ images from ultrasound. Depicted from left to right in each row are: real CT image used as the ground truth, corresponding simulated US image generated as described in Section 2.2, the output of a conventional TV despeckling algorithm, the output of our despeckling CNN-TV network, and the reconstructed CT image using our CNN-CT network. PSNR is reported relative to the ground truth CT image. ble explanation could be that the network learns the common manifold of the CT and US domains, but not intrinsic features like modality-specific noise. 4. CONCLUSION In this paper, we have showed that conventional despeckling algorithms can be approximated by CNN and by that, provide a major speed-up in run-times. Moreover, we have showed that a CNN can reconstruct a CT-quality image from US IQ images within the same run-time range. With that being said, the networks were trained and tested on pairs of CT images and the corresponding simulated ultrasound images. However, in practice, the CT-US paired data is difficult to obtain. Our further research will concentrate on tackling this problem, possibly by developing an unsupervised/semi-supervised training framework. [3] Yu Gan, Elsa Angelini, Andrew Laine, and Christine Hendon, “BM3D-based ultrasound image denoising via brushlet thresholding,” in Biomedical Imaging (ISBI), 2015 IEEE 12th International Symposium on. IEEE, 2015, pp. 667–670. [4] Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, and Lei Zhang, “Beyond a gaussian denoiser: Residual learning of deep cnn for image denoising,” IEEE Transactions on Image Processing, 2017. [5] Chao Dong, Chen Change Loy, Kaiming He, and Xiaoou Tang, “Learning a deep convolutional network for image super-resolution,” in European Conference on Computer Vision. Springer, 2014, pp. 184–199. [6] Kyong Hwan Jin, Michael T McCann, Emmanuel Froustey, and Michael Unser, “Deep convolutional neural network for inverse problems in imaging,” IEEE Transactions on Image Processing, vol. 26, no. 9, pp. 4509–4522, 2017. [7] Qingsong Yang, Pingkun Yan, Mannudeep K Kalra, and Ge Wang, “CT Image Denoising with Perceptive Deep Neural Networks,” arXiv preprint arXiv:1702.07019, 2017. [8] Nidhi Gupta, A.P Shukla, and Suneeta Agarwal, “Despeckling of Medical Ultrasound Images: A Technical Review,” Int. Journal of Information Engg. and Electronic Business(IJIEEB), vol. 8, no. 3, 2016. [9] Oliver Kutter, Ramtin Shams, and Nassir Navab, “Visualization and GPU-Accelerated Simulation of Medical Ultrasound from CT Images,” Comput. Methods Prog. Biomed., vol. 94, no. 3, pp. 250–266, June 2009. [10] Xiao-Jiao Mao, Chunhua Shen, and Yu-Bin Yang, “Image restoration using convolutional auto-encoders with symmetric skip connections,” CoRR, vol. abs/1606.08921, 2016. [11] Kenneth Clark et. al, “The Cancer Imaging Archive (TCIA): Maintaining and Operating a Public Information Repository,” Journal of Digital Imaging, vol. 26, no. 6, pp. 1045–1057, Dec 2013.
1cs.CV
1 Attribute-Guided Network for Cross-Modal Zero-Shot Hashing arXiv:1802.01943v1 [cs.CV] 6 Feb 2018 Zhong Ji, Yuxin Sun, Yunlong Yu, Yanwei Pang, Jungong Han Abstract—Zero-Shot Hashing aims at learning a hashing model that is trained only by instances from seen categories but can generate well to those of unseen categories. Typically, it is achieved by utilizing a semantic embedding space to transfer knowledge from seen domain to unseen domain. Existing efforts mainly focus on single-modal retrieval task, especially Image-Based Image Retrieval (IBIR). However, as a highlighted research topic in the field of hashing, cross-modal retrieval is more common in real world applications. To address the Cross-Modal Zero-Shot Hashing (CMZSH) retrieval task, we propose a novel AttributeGuided Network (AgNet), which can perform not only IBIR, but also Text-Based Image Retrieval (TBIR). In particular, AgNet aligns different modal data into a semantically rich attribute space, which bridges the gap caused by modality heterogeneity and zero-shot setting. We also design an effective strategy that exploits the attribute to guide the generation of hash codes for image and text within the same network. Extensive experimental results on three benchmark datasets (AwA, SUN, and ImageNet) demonstrate the superiority of AgNet on both cross-modal and single-modal zero-shot image retrieval tasks. Index Terms—Zero-shot hashing, cross-modal hashing, zeroshot learning, attribute, image retrieval. I. I NTRODUCTION R CENTLY, hashing-based multimedia retrieval approaches have attracted a lot of attention, mainly owing to their fast retrieval speed and low storage cost [1], [2], [3]. Generally, these approaches fall into two categories: unsupervised hashing [1], [2], [4], [5] and supervised hashing [6], [7]. The former usually applies the statistics information, such as manifold structure [4] and the variance of feature [5], to generate the hash function with the intention to preserve the similarity space, while the latter explores the semantic supervision information, e.g., class label, to capture the intrinsic property of data. Because more knowledge is utilized, supervised hashing approaches usually achieve better performance than those of unsupervised ones. However, one deficiency of supervised hashing approaches is that a large number of labeled instances are required for training the model, which is time-consuming and labor-intensive. In addition, it is very difficult to annotate sufficient training data for the new concepts in a timely manner, and also, impractical to retrain the hashing model whenever the retrieval system meets a new concept [12]. To address this awkward situation, inspired by the success of Zero-Shot Learning (ZSL) [8], [9], [10], [11], Zero-Shot Z. Ji, Y. Sun, Y. Yu, and Y. Pang are with the School of Electrical and Information Engineering, Tianjin University, Tinjin 300072, China (e-mail: {jizhong, sunyuxin, yuyunlong, pyw}@tju.edu.cn). J. Han is with the School of Computing & Communications, Lancaster University, UK (e-mail: [email protected]). Query: TBIR IBIR leopard 匾噩 ··、 Retrieval Result: CMZSH Model Unseen Domain -+ Seen Domain Fig. 1. An illustration of Cross-Modal Zero-Shot Hashing (CMZSH). Typically, a CMZSH model is trained by texts and images in seen domain. At testing stage, the CMZSH model mainly tackles two tasks in unseen domain, i.e., Text-Based Image Retrieval (TBIR) and Image-Based Image Retrieval (IBIR). For TBIR, the query set are texts and the retrieval set are images. For IBIR, both the query and the retrieval sets are images. Hashing (ZSH) is developed recently [12], [13]. Its goal is to encode images of unseen categories with the hash funciton trained by only those of seen categories by incorporating the ideas of supervised hashing approaches and ZSL. Transferring Supervised Knowledge (TSK) [12] is the pioneering method in ZSH. The authors propose to employ the semantic vectors as a bridge to transfer available supervision information from seen categories to unseen categories. Further, Guo et al. [13] present a deep ZSH method, named Similarity Transfer Network (SitNet). Specifically, SitNet applies a multi-task architecture to leverage the supervision knowledge of seen categories and the semantic vectors simultaneously, and employs a straightthrough estimator to avoid information loss caused by realvalue relaxation. Although these methods have achieved impressive performance, there is still a serious limitation for them. That is, the existing ZSH approaches only focus on Image-Based Image Retrieval (IBIR) task, where both the query and the retrieval sets are images. In fact, Text-Based Image Retrieval (TBIR), i.e., leveraging textual description to search images, is also very common in the real-life scenario. The aforementioned limitation motivates us to consider investigating ZSH in a cross-modal retrieval setting, which we call Cross-Modal Zero-Shot Hashing (CMZSH). Specifically, CMZSH mainly deals with two different tasks, one is IBIR, and the other is TBIR. That is to say, CMZSH broadens the scope of conventional ZSH from single-modal application to cross modal application. An illustration is described in Fig. 1. It should be noted that Image-Based Text Retrieval (IBTR) also belongs to the scope of Cross-Modal Hashing. However, since only one category name is corresponding to a class of 2 images for most popular ZSH datasets, IBTR in this situation actually degenerates into a ZSL (also called zero-shot image classification) problem, which is not the focus of our work. To achieve CMZSH, the following challenges should be addressed. 1) Modality heterogeneity. As query set and retrieval set are likely to be from different modalities, the generated hash codes are expected to have an additional property that preserves the semantic relationship between both modalities. 2) Category migration. It is an inherent problem of ZSL that the learning model should have the ability of handling the instances from unseen categories. Therefore, CMZSH needs to exploit the transferable knowledge that bridges the gap between seen categories and unseen categories. 3) Semantic similarity preservation. The hash function is actually a projection from high dimensional real-value features to low dimensional binary space. To implement effective nearest neighbor search, the generated binary hash codes are necessary to inherit the semantic similarity relationship of high dimensional real-value features. In this paper, we address the above issues with the proposed Attribute-Guided Network (AgNet) framework. Specifically, to narrow the semantic gap brought by modality heterogeneity and category migration, we map both the visual features and the textual features into a common space, respectively. In this work, we utilize the class-level attribute space as the common space. In this way, the two different modalities are aligned into a high-level semantic space. Using the embeddings of different modalities in the attribute space as inputs, both visual and textual hash codes are obtained from a shared deep neural network. Besides, the relationships between different modalities are constructed via a category similarity matrix formulated with the pair-wise class label. Moreover, to preserve the relationship of different categories, attribute similarity is further introduced to restrict the distances of different categories in the same modality. We summarize our highlights as below: 1) We address the cross-modal retrieval problem in ZSH, i.e., Cross-Modal Zero-Shot Hashing (CMZSH), via a novel deep hashing neural network. It can perform not only IBIR, but also TBIR. To the best of our knowledge, it is the first work to study the cross-modal hashing retrieval in the zero-shot setting. 2) By exploiting the class-level attributes information, we propose an Attribute-Guided Network (AgNet) framework. It first maps two different modalities into a common attribute space, which acts as a hub to bridge unseen and seen categories, as well as visual and textual modalities. Then, an effective strategy is designed to generate two individual hash codes for image and text within the same network. Specifically, we exploit the attribute to guide the generation of hash codes by preserving the category similarity and attribute similarity. 3) The experimental results for both IBIR and TBIR tasks on three popular benchmark datasets demonstrate that the proposed AgNet achieves competitive performance. II. R ELATED W ORK In this section, we will introduce some research progresses closely related to our work, including cross-modal hashing and zero-shot hashing. In fact, CMZSH can be viewed as a special case for them. CMZSH also falls into the domains of hashing-based retrieval and zero-shot learning. Due to the limited space, please refer to [14] and [15] for more elaborate surveys about them. A. Cross-Modal Hashing Cross-Modal Hashing (CMH) is a widely used retrieval technique [3], [16], [18], most of which tackle the problems of Text-Based Image Retrieval (TBIR) and Image-Based Text Retrieval (IBTR). This is usually implemented by generating two respective hash codes for each individual modality. In this way, different modalities can be computed in the same hashing space. A number of methods have been proposed, which can be generally divided into two categories: unsupervised methods and supervised methods. As one of the representative unsupervised cross-modal methods, Collective Matrix Factorization Hashing (CMFH) [16] generates crossmodal hash codes in a latent semantic space shared by both modalities via collective matrix factorization technique. To explore the heterogeneous correlation in different modalities, Liu et al. [17] propose a novel CMH scheme using fusion similarity from the multiple modalities. On the other hand, supervised CMH methods usually perform better than unsupervised ones since they can fully utilize the intrinsic property in data. For example, Zhang et al. [18] merge semantic labels into hashing learning procedure and propose a Semantic Correlation Maximization Hashing (SCMH) method. Lin et al. [19] convert the semantic similarity of instances into a probability distribution and generate hash codes by minimizing the KL-divergence. Liu et al. [20] propose a graph-regularized Supervised Matrix Factorization Hashing (SMFH) framework with a collective non-negative matrix factorization technique. With the renaissance of the deep neural network, deep learning has proved its outperformance in this field. For instance, Jiang et al. [21] first propose an end-to-end deep neural network framework to address the CMH problem. However, they just utilize the inter-modal relationship but ignore intra-modal information. To address this problem, Yang et al.[22] use pairwise labels to exploit intra-modal similarity and propose a Pairwise Relationship Guided Deep Hashing (PRDH) method. Our proposed CMZSH framework follows the idea of supervised CMH, which leverages semantic supervision information to generate different hashing codes for each modality to ensure they are able to interact with each other. However, different from CMH, CMZSH has to tackle an additional zero-shot problem. That is, the supervision knowledge is limited to seen categories, which is the only information in learning reliable hash function for transforming modalities of unseen categories into binary codes. Therefore, CMZSH is more challenging. 3 III. T HE PROPOSED AG N ET ALGORITHM B. Zero-Shot Hashing Zero-Shot Hashing (ZSH) is a marriage of zero-shot learning and hashing-based retrieval techniques. It is proposed to tackle the close-set limitation in hashing-based retrieval approaches, i.e., the concepts of possible testing instances in either dataset or query set are within the training set [12], [13]. Therefore, ZSH explores only the information from seen categories to build hash functions to retrieve the images in unseen categories. As an emerging research topic, the existing ZSH methods mainly focus on IBIR task. For example, in the pioneering work proposed by Yang et al. [12], the labels of each seen category are converted into semantic embedding representations via word2vec model [23], by which the supervision knowledge in seen categories can be transferred to unseen ones. Then, hash codes are generated by projecting the visual representation to the embedding space. Instead of using word vector as semantic representation in [12], Xu et al. [24] adopt semantically-rich attribute information as transferable knowledge. Further, Guo et al. [13] propose a multi-task framework to simultaneously exploit the supervision information from visual concepts and semantic representations. Specifically, they leverage the hash codes to capture the semantic similarity relationship in a transferable semantic embedding space and propose a center regularization loss to preserve both intraconcept similarity and inter-concept distance. In addition, under the transductive setting [25], [26], Lai et al. [27] propose a transductive zero-shot hashing method via coarse-to-fine similarity mining. In this way, a greedy binary classification network is first used to detect the most informative images from unseen category images. After that, the fine similarity mining module further finds the similarities among the informative images. However, since these ZSH approaches are designed for IBIR task, they have a natural deficiency that cannot encode the text into hash codes. Therefore, they are hardly applied for TBIR. To achieve CMZSH, the idea of ZSH should be combined with that of CMH. This is exactly what this paper is going to tackle. TABLE I The main notations. Notation N s u d c l k x ∈ Rl z ∈ Rk y ∈ Rs+u a ∈ Rd â(v) ∈ Rd â(t) ∈ Rd S(c) ∈ Rn×n S(att) ∈ Rn×n P ∈ Rc×n Q ∈ Rc×n B ∈ Rc×n Description number of instances number of seen categories number of unseen categories number of attributes hash codes length dimensionality of visual space dimensionality of textual space visual representation vector textual representation vector label vector ground-truth attribute vector predicted attribute vector in visual modality predicted attribute vector in textual modality category similarity matrix attribute similarity matrix outputs matrix of A2H Net in visual modality outputs matrix of A2H Net in textual modality hash codes matrix A. Problem Definition In order to address the CMZSH problem, both the requirements of knowledge transferability from seen categories to unseen categories and cross-modal retrieval should be fulfilled. Attributes and word vectors are two most popular side information in ZSL [28], [29], [30], [31]. Specifically, attributes define a few properties of an object, such as color, shape, and the presence or absence of a certain body part. They are shared across both seen and unseen categories. Word vectors represent words as vectors based on distributed language representation techniques, and theoretically, they can encode arbitrary concepts into sematic vectors. Therefore, both attributes and word vectors can construct a semantic space to transfer the knowledge from seen categories to unseen categories, meaning either of them can be selected as the candidate semantic space in CMZSH. Further, different approaches can be designed to generate both visual and textual hash codes from either attributes or word vectors space, which enables the crossmodal retrieval feasible. In this paper, we only focus on the usage of attributes. That is to say, we exploit attributes as the intermediary space, from which the hash codes are encoded. Suppose we are given N training instances Dtr = {di = (xi , zi , yi ) , i = 1, ..., N } from s labeled seen categories S = {1, 2, ...s}, where xi ∈ Rl is the visual representation, zi ∈ Rk is the textual semantic representation of its corresponding category name and yi ∈ {0, 1}s is the label vector represented as one-hot encoding. Note that the different modalities mainly refer to image and text in this paper. Besides, each instance is also annotated with a binary attribute vector denoted as ai ∈ {0, 1}d . Under the zero-shot setting, there also exist unseen categories U = {s + 1, ..., s + u}, which is disjoint with the labeled seen categories, i.e., S ∩ U = ∅. B. Network Architecture The overall framework of the proposed AgNet framework is illustrated in Fig. 2. It consists of three components: i) V2A Net. The output of penultimate layer (before the Softmax layer) of the fine-tuned GoogleNet [32] is first extracted as the visual features. After that, these CNN features are utilized as the input to a deep neural network with three fully-connected layers, which embeds the visual features to attribute vectors. ii) T2A Net. We use word2vector model [23] to represent the text input, which has been trained on the Wikipedia corpus. It is a 1000-dimensional vector for each category name. T2A Net is a two-layer neural network that is used to establish the word vectors to attributes projection. iii) A2H Net. Unlike the existing deep cross-modal hashing methods that generate hash codes from two independent networks (one for image, and the other for text), AgNet accomplishes the hash codes generation only with a single three-layer neural network. Specifically, it utilizes the predicted attribute vectors (or called attribute embedding vectors) as input, and outputs both visual and textual hash codes. Table II shows the configuration of AgNet. It needs to be highlighted that the architecture of the neural network is not the focus of this work, what we want to prove 4 Fig. 2. Architecture overview of the proposed AgNet approach. It consists of two stages. First, V2A Net and T2A Net embed the inputs of image and text into a shared attribute space, respectively. Next, A2H Net encodes the visual and textual vectors in attribute space into visual hash codes and textual hash codes, respectively. The shared attribute space enables the knowledge transferability from seen categories to unseen categories. And the A2H Net makes the cross-modal retrieval feasible. TABLE II The network architecture details of the proposed AgNet. “Full”denotes the fully-connected layer, “Relu” and “Sigmoid” denote activation functions. Sub-network V2A Net T2A Net A2H Net Layer Full1+Relu Full2+Relu Full3+Sigmoid Full1+Relu Full2+Sigmoid Full1+Relu Full2+Sigmoid Full3 Configuration 1024 512 number of attributes d 1000 number of attributes d 128 128 hash codes length c is that attribute-guide framework is reasonable and beneficial for the performance of CMZSH. C. Objective Function We first design the objective functions for the V2A Net and the T2A Net, whose purpose is to transform the inputs of image and text to the attribute space. Their transformation (v) functions are denoted as fv and ft , respectively. Let âi = fv (xi ) ∈ Rd denote the predicted attribute vector of each (t) visual representation xi while âi = ft (zi ) ∈ Rd denotes the predicted attribute vector of each textual representation zi . Given a training set of instances and their corresponding category attribute vectors, the V2A Net and the T2A Net are both trained with the cross-entropy objective function: Latt N 1 X T T ai log (âi ) + (1 − ai ) log(1 − âi ), (1) =− N i=1 where ai denotes the attribute vector, and âi is the predicted (v) (t) attribute vector âi for V2A Net or âi for T2A Net. This objective function ensures that the predicted attribute vectors approximate to the distribution of original attribute vectors. Then, the key challenge is how to realize the purpose of A2H Net, i.e., to generate two individual hash codes for image and text from the attribute space. We design three losses to achieve this purpose: i) category similarity loss; ii) attribute similarity loss; and iii) regularization loss. The category similarity loss is proposed to ensure the different predicted attribute vectors of different modalities in the same category can generate similar hash codes, while those in different categories have distinct differences. Given the predicted attribute vectors â(v) and â(t) of image and  (v) text, respectively, denote P∗i = g âi ; θ ∈ Rc and Q∗i =  (t)  g âi ; θ ∈ Rc as their outputs of A2H Net, where g is the transformation function for A2H Net and θ is the parameters for it. Moreover, use Θij = 12 P∗i T Q∗j to represent the neighbor relationship between P∗i and Q∗j in the Hamming space . Denote S(c) ∈ Rn×n as the category similarity, where (c) (c) Sij = 1 when yi = yj and Sij = 0 otherwise. By using the negative log likelihood of the inter-modal similarities, we formulate the category similarity loss as: Lcs = − N  X (c) Sij Θij − log 1 + eΘij  . (2) i,j=1 By minimizing this objective function, the Hamming distances for those instances within the same category but with different modalities are reduced, whereas the distances are getting larger for those with different categories. Therefore, the category similarity is preserved between different modalities. In addition, an effective hash code should also be equipped with the discriminative ability in a single modality. Hence, attribute similarity matrix S(att) is introduced to make the (att) intra-modal hash codes more discriminable. Let Sij = (c) cos (ai , aj ) − Sij , where cos (ai , aj ) is the cosine distance between attribute vectors of ai and aj . S(att) is a modified cosine similarity, which is used to measure the semantic similarities among different categories. Different from the binary label similarity S(c) , S(att) utilizes a real-value to describe the similarities among different categories. It is used in the attribute similarity loss Las as a guide for the generation of visual hash codes. Specifically, if two attribute vectors from different categories are similar, their corresponding visual instances should be given a higher penalty such that their hash codes have higher discriminative ability. If two instances are from the same category, we do not give them penalty, that is why S(c) is subtracted. The attribute similarity loss is defined 5 as follow: Las = N X  (att) σ φi,j Si,j  , (3) i,j=1 where φij = 12 PT∗i P∗j represents the neighbor relationship of P∗i and P∗j in Hamming space, and σ (•) denotes the sigmoid function. The sigmoid function is applied to restrict the scope of this term. By minimizing this term, those instances closed in the attribute space and from different categories will be uncoupled in the Hamming space. 2 Meanwhile, we use kB − PkF to make P approximate to 2 hash codes. And PT 1 F ensures each bit of the hash codes is balanced. Then, the regularization loss is formulated as follow: 2 Lreg = kB − PkF + PT 1 2 F , (4) where B = sign (P) , 1 denotes a vector with all elements being 1. Therefore, the overall objective function of the A2H Net is written as follow: LA2H = Lcs + λLas + ηLreg N  X  (c) =− Sij Θij − log 1 + eΘij i,j=1 + N X    (att) 2 λσ φi,j Si,j + η kB − PkF + PT 1 2 F  , i,j=1 (5) where λ and η are trade-off parameters to control the weight of each item. D. Optimization Our AgNet is trained in two steps. Firstly, V2A Net and T2A Net are separately learned with cross entropy functions. Then, using the predicted attribute vectors from two modalities, we train A2H Net according to Eq. (5). Back Propagation algorithm is adopted to optimize AgNet. For Eq.(5), the A2H is calculated with: gradient of L∂P ∗i N  1 X LA2H (c) = σ(Θij ) − Sij Q∗j ∂P∗i 2 j=1 N + 1X (att) (att) (att) λP∗j Si,j σ(φi,j Si,j )(1 − σ(φi,j Si,j )) 2 j=1 + 2η (P∗i − B∗i ) + 2ηPT∗i 1. (6) Then, the gradient of weight in A2H Net can be calculated A2H with L∂P according to chain rule. The details of training A2H ∗i Net are shown in Algorithm 1. Using mini-batch Stochastic Gradient Descent algorithm, we fix the batch size to be 32. The initial learning rate is set as 10−3 and decreased by 0.01% for each iteration. We choose the hyperparameter λ and η in AgNet according to the results on validation set and find the best performances can be achieved with λ = η = 1. Therefore, we set λ = η = 1. Our neural network is implemented with TensorFlow library on an NVIDIA 1080ti GPU server. Algorithm 1 Algorithm for training A2H Net Input: The predicted visual attribute vectors â(v) , the predicted textual attribute vectors â(t) , label matrix Y and attribute matrix A . Output: Parameters θ in the A2H Net and binary codes B. 1: Initialization: Randomly initialize parameters θ of A2H Net, set mini-batch M = 32 and iteration number l = bN /M c. 2: Repeat 3: for iter = 1, 2, ..., l do 4: Randomly sample M instances. 5: Calculate category similarity S(c) . 6: Calculate attribute similarity S(att) . 7: Calculate Q and P by forward propagation. 8: Get the corresponding binary code B. 9: Update the parameter θ by back propagation. 10: until a fixed number of iterations. IV. E XPERIMENT In this section, we implement both the single-model and cross-modal zero-shot retrieval tasks, i.e., IBIR and TBIR, on three benchmark datasets. And we compare the proposed AgNet approach with several existing state-of-the-art methods to demonstrate its effectiveness. A. Datasets Animals with Attributes (AwA) [28]. AwA dataset consists of 30,475 images from 50 animal categories and 85 associated class-level attributes. It is a popular dataset for ZSL. We follow the standard seen/unseen split [28], where 40 categories with 24,295 images are taken as the seen domain and the remaining 10 categories with 6,180 images are adopted as the unseen domain. SUN attribute [33]. It is another widely used dataset in ZSL, which consists of 717 scene categories annotated by 102 attributes. Each category has 20 images, and there are totally 14,340 images. Following [34], we utilize 707 categories as the seen domain and the other 10 categories as the unseen domain. ImageNet [35]. ImageNet is a large-scale image dataset organized according to the Word-Net [36] hierarchy. As no attribute is annotated for this dataset, in our experiment, we use AwA dataset as an auxiliary dataset to construct the training set. Specifically, after removing 10 similar categories shared by two datasets1 , we choose 40 categories with 21,832 images from AwA as seen domain and 100 animal categories with 129,622 images from ILSVRC2012 as the unseen domain. B. Cross-Modal Zero-Shot Hashing Under cross-modal zero-shot retrieval setting, i.e., TBIR, the seen data are used for training the model. At the testing 1 We eliminate 10 categories (i.e., dalmatian, collie, german shepherd, chihuahua, persian cat, siamese cat, bobcat, horse, deer, sheep) from AwA to construct the seen domain. 6 TABLE III Results on three benchmark datasets in Mean Average Precision (%). The best results are marked in bold. Method SCMH [18] SMFH [20] DCMH [21] FSH [17] AgNet 8bits 15.2 17.7 11.9 12.7 41.9 16bits 14.2 19.3 9.8 14.1 50.1 AwA 32bits 14.1 21.5 12.7 14.2 56.1 48bits 12.6 22.9 9.8 12.6 58.1 64bits 12.1 21.6 10.3 12.1 58.8 8bits 15.1 12.6 12.3 19.7 21.1 16bits 16.2 12.1 12.6 20.8 21.3 stage, the names of unseen categories are used as queries for retrieving images from the unseen domain. Since the existing ZSH approaches cannot tackle the crossmodal retrieval task, we choose the CMH approaches for comparison. Four existing state-of-the-art CMH approaches are selected for comparison, where SCMH [18], SMFH [20], and DCMH [21] are three representative supervised CMH methods, while FSH [17] is an unsupervised CMH method. For all comparative approaches, we use the codes provided by the authors. As DCMH is an end-to-end CMH method, we utilize raw images as input. The others adopt the same visual features as ours, that is, the GoogleNet features [32] fine-tuned in the training set. Besides, we use the word2vec features [23] as textual features for all methods. We use the Mean Average Precision (mAP) to evaluate the performances of the proposed AgNet and the comparative approaches. To observe the performance under different code length, we set the code length with 8, 16, 32, 48 and 64 bits , respectively. From the results shown in Table III, we have the following observations: i) The proposed AgNet achieves the best performance on all three datasets consistently. All the comparative approaches have a relatively poor performance. This is mainly due to the reason that they are not designed for zero-shot settings, which leads to a worse generalization ability on the unseen domains. Specifically, it has a significant improvement on AwA dataset. For instance, the mAP performance of AgNet is 58.1% with 48 bits, which has a 35.2% absolute gain than that of the second best method SMFH. ii) The performances of AgNet on SUN dataset are inferior to those on AwA dataset. This is partly due to the fact that SUN is a fine-grained dataset in which there are few diversities in each category, making the learned hash codes be less discriminative. iii) AgNet also has a relatively small promotion on the largescale ImageNet. Considering that the numbers of both the testing categories and instances in ImageNet are far more than those in AwA and SUN datasets, the improvements are still impressive. iv) The mAP performances of AgNet are positively related to code length in most situations, which indicates that the discriminative ability of hash codes increases with the growth of code length. By contrast, the mAP performances of comparative methods are unstable and without such a property. In a word, the experimental results clearly demonstrate the superiority of the proposed AgNet approach in CMZSH task. C. Single-Modal Zero-Shot Hashing The existing ZSH methods mainly focus on single-modal retrieval, i.e., the query set and retrieval set are both constructed SUN 32bits 19.1 12.4 13.7 16.2 23.5 48bits 21.4 12.6 13.5 18.7 24.5 64bits 18.8 13.1 14.1 16.5 26.6 8bits 1.46 1.38 1.00 1.44 3.80 16bits 1.88 1.33 1.04 1.95 5.26 ImageNet 32bits 2.06 2.00 1.03 2.31 5.89 48bits 1.84 2.23 1.00 2.65 5.98 64bits 1.73 2.40 1.01 2.72 5.77 with the images. To evaluate the generalization of AgNet, we also implement AgNet in the single-modal ZSH task. As the scale of the unseen domain in SUN is insufficient to evaluate the performance of image retrieval task, we just implement single-model retrieval on AwA and ImageNet datasets. Following [12] and [13], we randomly choose 10,000 instances from seen domain to construct the training set. As for testing, we randomly select 1,000 images from the unseen domain as the query set. The remaining unseen images and all seen domain images form the retrieval set. We select the following state-of-the-art hashing methods as the baselines. IMH [37] and ITQ [5] are two representative unsupervised hashing methods, SDH [6], TSK [12] and SitNet [13] are three supervised hashing methods. In addition, TSK and SitNet are specially designed for zero-shot retrieval. The mAP and Precision within Hamming radius 2 are adopted as the evaluation metrics in this task. For all comparative approaches, we utilize GoogleNet features fine-tuned in the training set as the visual features. Following [13], we set the code length to be 8, 16, 32, and 48 bits, respectively. 1) Experimental results on AwA: All the comparative approaches are implemented by ourselves with the code provided by the authors, except for SitNet. The results of SitNet are directly cited from the original paper [13]. It should be noted that the split of seen and unseen domain in SitNet has a slight difference with ours. SitNet randomly chooses 10 categories as unseen domain, while we follow the standard split [28] in this work. We follow this setting to make our work repeatable. The performances of AgNet and the comparative methods on AwA dataset are reported in Fig. 3. As we can see, the proposed AgNet achieves the best mAP performance in most cases. For example, AgNet gains 19.1% in 32 bits, which has an improvement against the second best SitNet by 9.1% in the same length. Besides, the mAP performances of AgNet keep improving with the increase of code length, which is similar to the phenomenon in the cross-modal retrieval task. As for Precision, AgNet exceeds all comparative methods in the code length of 32 and 48 bits, and only achieves a slightly inferior performance on 8 and 16 bits. Moreover, there is a slight drop from 32 bits to 48 bits in the precision performance of AgNet, indicating that we need to choose a suitable code length to guarantee the retrieval performance. 2) Experimental results on ImageNet: The comparative experiments are reported in Fig. 4. Note that SitNet [13] is not selected for comparison in this dataset since its experimental setting is different from ours. It can be observed that AgNet outperforms all comparative methods with significant margins in all code lengths. Besides, the performances of unsuper- 7 ITQ[5] SDH[6] IMH[37] TSK[12] SitNet[13] AgNet ITQ[5] 25 SDH[6] IMH[37] TSK[12] AgNet 10 15 mAP (%) mAP (%) 20 10 5 5 0 8bits 16bits 32bits 48bits Code length 0 35 8bits 32bits 48bits Code length 20 25 15 20 15 Precision (%) Precision (%) 30 16bits 10 5 10 5 0 8bits 16bits 32bits 48bits Code length 0 Fig. 3. Performances (mAP and Precision) of different methods for singlemodal zero-shot hashing task on AwA dataset. D. Effects of Attributes As our algorithm is an attribute-based method, the performance of the learned attribute space will affect the discriminative ability of hash codes. In this part, we implement some experiments to analyze the impact of the attribute space, including the scale of attribute space and the attribute prediction accuracy to the final performances. To evaluate the influence of attribute space scale, we vary the number of attributes from 10 to 80 with the interval of 10. In consideration of the difference on attributes, we report the average performance of 5 trials for each number by fixing the code length as 64 bits. The curve of CMZSH in terms of mAP is shown in Fig. 5. It can be observed that the mAP performance increases with the growth of attribute number. Specifically, there is a giant leap when attribute number changes from 10 to 20. It 16bits 32bits 48bits Code length Fig. 4. Performances (mAP and Precision) of different methods for singlemodal zero-shot hashing task on ImageNet dataset. 70 60 mAP (%) vised methods surpass those of the conventional supervised method, i.e., SDH. Without using the supervision information, unsupervised methods exploit the inherent property of visual representations to generate hash codes and avoid suffering from the misleading of supervision information of seen categories in zero-shot setting. However, by utilizing semantic information as the transferable supervision information, AgNet and TSK mitigate the influence of zero-shot problem and outperform both unsupervised and conventional supervised hashing methods on ImageNet dataset. 8bits 50 40 30 20 10 0 10 20 30 40 50 60 70 Number of Attributes 80 Fig. 5. Performances of AgNet with different number of attributes on AwA dataset. indicates that more attributes are required to guarantee the discriminative ability. Besides, when the amount of attribute is large enough, the increasing scope turns to saturation. In addition, the attribute prediction accuracy also plays a significant role in the performance of AgNet. The previous experiment in cross-modal task has demonstrated that the performances of AgNet on SUN are inferior to those on AwA. The underlying reason may be that the attribute prediction accuracy on SUN is inferior to those on AwA. Therefore, we analyze the attribute prediction accuracy on both datasets. According to the distribution of binary attribute tags on AwA and SUN, as is shown in Fig. 6(a), it can be easily noticed that the tags of AwA and SUN are biased to 0. 8 Fig. 6. (a)The distribution of binary attribute tags on AwA and SUN. (b)The results of positive-error distance on AwA and SUN. Fig. 7. Confusion matrix of AgNet on AwA, where the columns are the categories that visual hash codes belong to and the rows are the categories of textual hash codes that visual hash codes are close to. Therefore, we propose to utilize the positive-error distance (PED) to evaluate the prediction accuracy, which is defined as: N P d P Aji Aji − Âji D= i j N P d P i , (7) Aji j where Â∗i denotes the predicted attribute vector and A∗i denotes the ground-truth attribute vector, d is the dimensionality of A∗i and N is the number of instances. Using Eq. (7), the distances between A∗i and Â∗i are calculated when Aji = 1. The results are reported in Fig. 6(b), which demonstrate that the attribute prediction on AWA is closer to the ground truth than that on SUN. The PED of visual modality and textual modality on SUN are larger than that on AwA in 70.1% and 61.4%, respectively. Thereby, the attribute prediction on AwA is more discriminable than that on SUN, which further interprets the better performance of AgNet on AwA than that on SUN. E. Visualization To further evaluate the performance of AgNet in each category, taking AwA dataset for example, we utilize confusion matrix to visualize the neighbor relationship between textual hash codes and visual hash codes of AgNet. We fix the code length to 64 bits. The result is shown in Fig. 7, where each column denotes the categories that visual instances belong to, and each row is the categories of textual instances that visual instances are close to. It can be observed that most instances are concentrated in the diagonal line, which indicates that visual instances are close to the text instance with the same category in most situations. However, there still exists some confusions in some categories. Take “seal” as example, about 40% of visual instances are close to “humpback whale”. The main underlying reason is that both categories are marine animal with a lot of similar attributes, which misguides the model to generate the similar hash codes for both categories. This means that the performance of AgNet in similar categories should be further improved in future. In addition, the effective hash codes need to preserve the neighbor relationship of the original features. As for AgNet, we use A2H Net to generate hash codes from both the textual and visual modalities. In this part, we use t-SNE [38] to visualize the performance of A2H Net on the unseen domain. Instead of adopting the binary codes that are difficult to generate effective cluster with t-SNE, we utilize attribute predictions and outputs from the last layer in A2H Net as the inputs for t-SNE. As is illustrated in Fig. 8, we can observe that the similarity relationship in attribute space has been well preserved in the hash space, which indicates the effectiveness of A2H Net. V. C ONCLUSION In this paper, we have proposed a deep hashing neural network to address the cross-modal zero-shot retrieval problem. It aligns different modal data into a more high-level semantic space, i.e., attribute space. Besides, category similarity is utilized to construct the relationships between different modalities while attribute similarity is introduced to regularize the distance of similar categories in single modality. Experimental results on both cross-modal and single-modal retrieval tasks have demonstrated the superiority of the proposed approach. In the future, as the acquisition of attribute annotation requires prior knowledge, we shall exploit other semantic data to formulate common space, e.g., click-through data. R EFERENCES [1] L. Liu, and L. Shao, “Sequential compact code learning for unsupervised image hashing,” IEEE Trans. Neural Netw. Learn. Syst., vol. 27, no. 12, pp. 2526-2536, 2016. [2] L. Liu, M. Yu, and L. Shao, “Latent structure preserving Hashing,” Int. Jou. of Comput. Vis., vol. 122, no. 3, pp. 439-457, 2017. [3] L. Lin, G. Ding, J. Han, and J. Wang, “Cross-view retrieval via probability-based semantics-preserving hashing,” IEEE Trans. on Cybern., vol. 47, no. 12, pp. 4342-4355, 2017. [4] F. Shen, C. Shen, Q. Shi, A. Hengel, Z. Tang, and H. Shen, “Hashing on nonlinear manifolds,” IEEE Trans. on Image Process., vol. 24, no. 6, pp. 1839-1851, 2015. [5] Y. Gong, S. Lazebnik, A. Gordo, and F. Perronnin, “Iterative Quantization: a procrustean approach to learning binary codes for large-scale image retrieval,” IEEE Trans. on Pattern Anal. Mach. Intell., vol. 35, no. 12, pp. 2916-2929, 2013. [6] F. Shen, C. Shen, W. Liu, and H. Shen, “Supervised discrete hashing,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Boston, USA, June 2015, pp. 37-45. [7] W. Liu, J. Wang, R. Ji, Y. Jiang, and S. Chang, “Supervised hashing with kernels,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Providence, USA, June 2012, pp. 2074-2081. [8] C. Lampert, H. Nickisch, and S. Harmeling, “Attribute-based classification for zero-shot visual object categorization,” IEEE Trans. on Pattern Anal. Mach. Intell., vol. 36, no. 3, pp. 453-465, 2014. 9 Fig. 8. t-SNE visualization of unseen instances on AWA dataset. Points denote visual representations and triangles denote text representations. (a) The visualization of attribute predictions. (b) The visualization of outputs from the last layer in A2H Net. [9] Y. Fu, T. Hospedales, T. Xiang, and S. Gong, “Learning multimodal latent attributes,” IEEE Trans. on Pattern Anal. Mach. Intell., vol. 36, no. 2, pp. 303-316, 2014. [10] L. Yang, L. Liu, L. Shao, F. Shen, G. Ding, and J. Han, “From zeroshot learning to conventional supervised classification: unseen visual data synthesis,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Honolulu, USA, July 2017, pp. 6165-6174. [11] Z. Ji, Y. Yu, Y. Pang, J. Guo, and Z. Zhang, “Manifold regularized cross-modal embedding for zero-shot learning,” Inf. Sci., pp. 48-58, 2017. [12] Y. Yang, Y. Luo, L. Chen, F. Shen, J. Shao, and H. Shen, “Zero-shot hashing via transferring supervised knowledge,” in Proc. ACM Conf. on Multimedia, Amsterdam, Netherlands, Oct. 2016, pp. 1286-1295, 2016. [13] Y. Guo, G. Ding, J. Han, and Y. Guo, “SitNet: discrete similarity transfer network for zero-shot hashing,” in Int. Joint Conf. on Art. Intell., Melbourne, Australia, Aug. 2017, pp. 1767-1773. [14] J. Wang, W. Liu, S. Kumar, and S. Chang, “Learning to hash for indexing big data - a survey,” Proc. of the IEEE, vol. 104, no. 1, pp. 34-57, 2016. [15] Y. Fu, T. Xiang, Y. Jiang, X. Xue, L. Sigal, and S. Gong, “Recent advances in zero-shot recognition: toward data-efficient understanding of visual content,” IEEE Signal Process. Maga., vol. 35, no. 1, pp. 112-125, 2018. [16] G. Ding, Y. Guo, J. Zhou, and Y. Gao, “Large-scale cross-modality search via collective matrix factorization hashing,” IEEE Trans. on Image Process., vol. 25, no. 11, pp. 5427-5440, 2016. [17] H. Liu, R. Ji, Y. Wu, F. Huang, and B. Zhang, “ Cross-modality binary code learning via fusion similarity hashing,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Honolulu, USA, July 2017, pp. 63456353. [18] D. Zhang, and W. Li, “Large-scale supervised multimodal hashing with semantic correlation maximization,” in AAAI Conf. Art. Intell., Qubec, Canada, July 2014, pp. 2177-2183. [19] Z. Lin, G. Ding, M. Hu, and J. Wang, “Semantics-preserving hashing for cross-view retrieval,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Boston, USA, June 2015, pp. 3864-3872. [20] H. Liu, R. Ji, Y. Wu, and G. Hua, “Supervised matrix factorization for cross-modality hashing,” in Int. Joint Conf. on Art. Intell., New York, USA, Jan. 2016, pp. 1767-1773 [21] Q. Jiang, and W. Li, “Deep cross-modal hashing,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Honolulu, USA, July 2017, pp. 32703278. [22] E. Yang, C. Deng, W. Liu, X. Liu, D. Tao, and X. Gao, “Pairwise relationship guided deep hashing for cross-modal retrieval,” in AAAI Conf. Art. Intell., San Francisco, USA, Feb. 2017, pp. 1618-1625. [23] T. Mikolov, I. Sutskever, K. Chen, G. Corrado, and J. Dean, “Distributed representations of words and phrases and their compositionality,” Advances in Neural Inf. Process. Syst., Nevada, USA, Dec. 2013, pp. 31113119. [24] Y. Xu, Y. Yang, F. Shen, X. Xu, Y. Zhou, and H. Shen, “Attribute hashing for zero-shot image retrieval,” in IEEE Int. Conf. on Multimedia and Expo, Hong Kong, China, July 2017, pp. 133-138. [25] Y. Fu, M. Hospedales, Timothy, T. Xiang, and S. Gong, “Transductive multi-view zero-shot learning,” IEEE Trans. on Pattern Anal. Mach. Intell., vol. 37, no. 11, pp. 2332-2345, 2015. [26] Y. Yu, Z. Ji, J. Guo, and Y. Pang, “Transductive zero-shot learning with adaptive structural embedding,” IEEE Trans. Neural Netw. Learn. Syst., pp. 1-12, 2017. [27] H. Lai, and Y. Pan, “Transductive zero-shot hashing via coarse-tofine similarity mining,” arXiv:1711.02856, 2017. [28] C. Lampert, H. Nickisch, and S. Harmeling, “Learning to detect unseen object classes by between-class attribute transfer,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Florida, USA, June 2009, pp. 951-958. [29] Z. Akata, F. Perronnin, Z. Harchaoui, and C. Schmid, “ Label-embedding for attribute-based classification,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Portland, USA, June 2013, pp. 819-826. [30] Z. Zhang, and Saligrama, “Zero-shot recognition via structured prediction,” in Eur. Conf. on Comput. Vis., Amsterdam, Netherlands, Oct. 2016, pp. 533-48. [31] M. Rohrbach, M. Stark, G. Szarvas, I. Gurevych, and B. Schiele, “ What helps where and why? Semantic relatedness for knowledge transfer,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., San Francisco, USA, June 2010, pp. 910-917. [32] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna, “ Rethinking the inception architecture for computer vision,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Las Vegas, USA, June 2016, pp. 2818-2826. [33] G. Patterson, and J. Hays, “SUN attribute database: Discovering, annotating, and recognizing scene attributes,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Providence, USA, June 2012, pp. 2751-2758. [34] D. Jayaraman, and K. Grauman, “Zero-shot recognition with unreliable attributes,” Advances in Neural Inf. Process. Syst., Montral Canada, Dec. 2014, pp. 3464-3472. [35] J. Deng, W. Dong, R. Socher, L. Li, K. Li, and F.F. Li, “ImageNet: A large-scale hierarchical image database,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Florida, USA, June 2009, pp. 248-255. [36] G. Miller, “Wordnet: a lexical database for english,” in Comm. of the ACM, Nov. 1995, vol. 38, no. 11, pp. 39-41. [37] F. Shen, C. Shen, Q. Shi, A. Hengel, and Z. Tang, “ Inductive hashing on manifolds,” in Proc. IEEE Conf. on Comput. Vis. Pattern Recognit., Portland, USA, June 2013, pp. 1562-1569. [38] L. Maaten, and G. Hinton, “Visualizing data using t-sne,” J. Mach. Learn. Res., vol. 9, pp.2579-2605, 2008.
1cs.CV
arXiv:cs/0501043v1 [cs.LO] 25 Jan 2005 Under consideration for publication in Theory and Practice of Logic Programming 1 Proving Correctness and Completeness of Normal Programs — a Declarative Approach WLODZIMIERZ DRABENT Institute of Computer Science, Polish Academy of Sciences, ul. Ordona 21, Pl – 01-237 Warszawa, Poland and Linköpings universitet, Department of Computer and Information Science S – 581 83 Linköping, Sweden (e-mail: [email protected]) MIROSLAWA MILKOWSKA Institute of Informatics, Warsaw University, ul. Banacha 2, 02-097 Warszawa, Poland (e-mail: [email protected]) submitted January 11, 2003; revised July 13, 2004; accepted January 3, 2005 Abstract We advocate a declarative approach to proving properties of logic programs. Total correctness can be separated into correctness, completeness and clean termination; the latter includes non-floundering. Only clean termination depends on the operational semantics, in particular on the selection rule. We show how to deal with correctness and completeness in a declarative way, treating programs only from the logical point of view. Specifications used in this approach are interpretations (or theories). We point out that specifications for correctness may differ from those for completeness, as usually there are answers which are neither considered erroneous nor required to be computed. We present proof methods for correctness and completeness for definite programs and generalize them to normal programs. For normal programs we use the 3-valued completion semantics; this is a standard semantics corresponding to negation as finite failure. The proof methods employ solely the classical 2-valued logic. We use a 2-valued characterization of the 3-valued completion semantics, which may be of separate interest. The method of proving correctness of definite programs is not new and can be traced back to the work of Clark in 1979. However a more complicated approach using operational semantics was proposed by some authors. We show that it is not stronger than the declarative one, as far as properties of program answers are concerned. For a corresponding operational approach to normal programs, we show that it is (strictly) weaker than our method. We also employ the ideas of this work to generalize a known method of proving termination of normal programs. KEYWORDS: declarative programming, negation in logic programming, specifications, program correctness and completeness, termination, teaching logic programming 1 Introduction This paper discusses reasoning about logic programs in terms of their declarative semantics. We view total correctness of programs as consisting of correctness, com- 2 Wlodzimierz Drabent and Miroslawa Milkowska pleteness and clean termination. Correctness (sometimes called partial correctness) means that any answer obtained from the program satisfies the specification. As logic programming is nondeterministic, one is interested in completeness, i.e. that all the results required by the specification are computed. Programs should also (cleanly) terminate — computations should be finite and without run-time errors, like floundering and arithmetical exceptions. Obviously, clean termination depends on the operational semantics, in particular on the selection rule. However correctness and completeness do not; they are declarative properties. It is desirable that they could be dealt with in a declarative way, abstracting from any operational semantics and treating programs and their answers only from the logical point of view. Otherwise logic programming would not deserve to be considered a declarative programming paradigm. Declarative treatment of correctness and completeness makes it possible to separate reasoning about “logic” and “control”; correctness and completeness are related to logic and clean termination to control. Changing the control component does not influence correctness and completeness. In this paper we show how to prove correctness and completeness declaratively. We discuss a known method of proving correctness of definite programs and introduce a method for proving completeness. Then we generalize both methods to programs with negation. As their declarative semantics we employ the 3-valued completion semantics (Kunen 1987). Our proof methods use however only the standard 2-valued logic. The employed 2-valued characterization of Kunen semantics may be of separate interest. The proof method for definite program correctness (Clark 1979; Hogger 1981; Deransart 1993) is simple and straightforward. It is declarative: it abstracts from any operational semantics. It should be well known. However its usefulness is often not appreciated. Instead a more complicated approach using operational semantics was proposed by some authors (Bossi and Cocco 1989; Apt 1997; Pedreschi and Ruggieri 1999). That approach takes into account the form of atoms selected under LD-resolution. We show that, as far as declarative properties of programs are concerned, the operational approach is not stronger than the declarative one. The last of these papers also deals with normal programs. In this case we show that the operational approach is strictly weaker than that presented here, when declarative properties are of interest. The following observation is important for our approach: it should be possible to use approximate specifications, and one should not require that the same specification is used for both correctness and completeness. This is natural, as there usually are answers which are neither considered erroneous nor required to be computed. Using the same specification for both purposes requires making decisions like “should append([ ], 7, 7) be correct?”; this brings substantial and unnecessary complications. So there is some 3-valued flavour even in logic programming without negation. Notice that if a program is both correct and complete with respect to a specification then the specification cannot be approximate. Approximate specifications are useful not only in the context of proving correctness and completeness. We show how a (non-unique) approximate specification can replace the unique in- Correctness and Completeness of Normal Programs 3 terpretation in the method of (Apt and Pedreschi 1993) for proving termination of normal programs. The paper consists of two main chapters: Section 3 is devoted to definite programs, Section 4 to normal programs. In each case we first discuss proving correctness, then proving completeness. We also discuss completeness of the presented proof methods and compare them with the operational approach. Section 4.3 on proving correctness of normal programs also presents a generalization of the method for proving termination by Apt and Pedreschi (1993). The paper is concluded by a section on related work. A preliminary and abridged version of this paper appeared as (Drabent and Milkowska 2001). 2 Preliminaries For basic definitions we refer the reader to (Lloyd 1987) and to (Apt 1997; Doets 1994). We consider the declarative semantics given by 3-valued logical consequences of program completion (Kunen 1987). This is a standard semantics for normal programs with finite failure (Doets 1994). It is a generalization of the classical semantics for definite programs (2-valued logical consequences of the program). SLDNFresolution is sound for this semantics and important completeness results exist. We are interested in declarative properties of programs, i.e. properties of programs treated as sets of logic formulae. Speaking more formally, we consider properties of program answers. We are not interested in distinguishing logically equivalent programs, for instance logically equivalent definite programs with different S-semantics (Bossi et al. 1994), like { p(X)←, p(a)← } and { p(X)← }. By a computed (resp. correct) answer we mean an instance Qθ of a query Q, where θ is a computed (correct) answer substitution for Q and the given program. (A query is a sequence of literals; it is a sequence of atoms when definite programs are concerned). Notice that, by soundness and completeness of SLD-resolution, the sets of computed and of correct answers for a given definite program are equal. (In particular, a correct answer Qθ for a query Q is a computed answer for a query Qθ.) So in the case of definite programs we usually do not distinguish between these two kinds of answers; the term “answer” refers to both of them. Due to incompleteness of SLDNF-resolution, some correct answers for normal programs are not computed answers. So in the context of normal programs the term “answer” refers to correct answers. We assume an arbitrary fixed first order language L. Sometimes it is required that the set of function symbols of L is infinite; this will be stated explicitly. A preinterpretation for L is an algebra J and a mapping assigning an n-ary function of J to each n-ary (n ≥ 0) function symbol of L. We will represent interpretations as sets (Lloyd 1987, p. 12), (Doets 1994, p. 124): an interpretation (over J ) is a set of constructs of the form p(e1 , . . . , en ), where p is a predicate symbol and e1 , . . . , en are elements of the carrier |J | of J . Such a p(e1 , . . . , en ) will be called a J -atom. Obviously, if J is a Herbrand algebra then an interpretation is a set of ground atoms. The Herbrand base w.r.t. (with respect to) a given language L will be denoted by H, and the least Herbrand model of a definite program P by MP . 4 Wlodzimierz Drabent and Miroslawa Milkowska We sometimes use a comma instead of ∧ and assume that conjunction has a higher priority than disjunction, and disjunction higher than implication. For instance α, β ∨ γ, δ stands for (α ∧ β) ∨ (γ ∧ δ), and α ∨ β → γ for (α ∨ β) → γ. In program examples we use some elements of the notation of Prolog (variable names begin with an upper case letter, lists are denoted using [, |, ], etc). 3 Reasoning about Definite Programs First we show a method of proving program correctness. In the next section we compare it with an approach related to operational semantics. Then we introduce a method of proving completeness. 3.1 Correctness of Definite Programs We begin with a brief discussion on specifications. As a standard example let us take the program APPEND: app( [ ], L, L ) ← app( [H|K], L, [H|M ] ) ← app( K, L, M ) We want to prove that it indeed appends lists. We need a precise statement (a specification) of this property. A slight complication is that the program does not actually define the relation of list concatenation, but its superset; the least Herbrand model contains atoms like app([ ], 1, 1). This is a common phenomenon in logic programming, the least model contains “ill-typed” atoms which are irrelevant for the correctness of the program. So we want to prove that: for any answer app(k, l, m), if k and l are lists then m is a list and k ∗ l = m. (By a list we mean a term [t1 , . . . , tn ] (in Prolog notation), where n ≥ 0 and t1 , . . . , tn are possibly non-ground terms. Symbol ∗ denotes the list concatenation.) This property could be equivalently expressed as spec |= app(k, l, m) (1) for any answer app(k, l, m), where spec is the Herbrand interpretation: spec = { app(k, l, m) ∈ H | if k and l are lists then m is a list and k ∗ l = m } (2) Obviously, (1) holds iff all the ground instances of app(k, l, m) are in spec. Notice that we do not need to refer to the notion of a query in the specification. Assume that app(k, l, m) = app(k ′ , l′ , m′ )θ is a computed answer for a query app(k ′ , l′ , m′ ). If k ′ , l′ are lists then obviously k, l are lists and (1) implies that m is a list and k ∗ l = m. Such specifications, referring to program answers, will be called declarative. A declarative specification can be an interpretation (possibly not a Herbrand one) or Correctness and Completeness of Normal Programs 5 a theory.1 In this paper we will use specifications of the first kind, but we expect that our results also apply to specifications of the second kind. Definition 3.1 A definite program is correct w.r.t. a declarative specification spec iff spec |= Q for any answer Q of the program. Notice that a program P is correct w.r.t. a Herbrand interpretation spec iff its least Herbrand model MP is a subset of spec (as for such interpretations spec |= Q means that all the ground instances of the atoms in Q are in spec). To prove correctness (of a logic program w.r.t. a declarative specification) we use an obvious approach, discussed among others by Clark (1979), Hogger (1981, p. 378–9) and Deransart (1993, Section 3).2 We will call it the natural proof method. It consists of showing that spec |= C for each clause C of the considered program. The soundness of the natural method follows from the following simple property. Proposition 3.2 (Correctness, definite programs) Let P be a program and spec be an interpretation. If spec |= P then P is correct w.r.t. specification spec. Proof By soundness of SLD-resolution, P |= Q for any answer Q. Now spec |= P and P |= Q imply spec |= Q. (This also holds for spec being a theory.) The method is also complete (Deransart 1993) in the following sense. If a program P is correct w.r.t. a declarative specification spec then there exists a stronger specification spec ′ ⊆ spec such that spec ′ |= P , and thus the method is applicable to spec ′ . (To prove this property, take as spec ′ the least model of P over the given preinterpretation.) Example 3.3 The proof of correctness of APPEND w.r.t. specification (2) is rather simple. We present here its less trivial part with details. Consider the second clause. To show that spec |= app([H|K], L, [H|M ]) ← app(K, L, M ) take ground terms h, k, l, m (and valuation { H/h, K/k, L/l, M/m }) such that spec |= app(k, l, m), in other words app(k, l, m) ∈ spec. We have to show that spec |= app([h|k], l, [h|m]). Assume that [h|k] and l are lists, hence k is a list. Then m is a list and k ∗ l = m, as spec |= app(k, l, m). Thus [h|m] is a list and [h|k] ∗ l = [h|m], hence app([h|k], l, [h|m]) ∈ spec. This concludes the proof. 1 2 A specification corresponding to our example specification spec may consist of an axiom app(k, l, m) ↔ (list(k), list(l) → list(m), k∗l=m) together with axioms describing predicates =, list and function ∗, and an induction schema for lists. where it is called “inductive proof method”. 6 Wlodzimierz Drabent and Miroslawa Milkowska Example 3.4 The specification of APPEND considered above does not describe the usage of APPEND to split a list or to subtract lists. Also the requirement on k is unnecessary. This is because our intention was to follow a corresponding example of (Apt 1997). A full specification of APPEND may be   if l or m is a list then spec APPEND = app(k, l, m) ∈ H . k, l, m are lists and k ∗ l = m It is easy to check, in a way described above, that spec APPEND |= APPEND. Thus by Proposition 3.2 program APPEND is correct w.r.t. spec APPEND . The program in the next example uses accumulators. Alternatively it can be seen as employing difference lists. Let us define that a difference list representing a list [t1 , . . . , tn ] is any pair ([t1 , . . . , tn |t], t) of terms, where t is an arbitrary term. Example 3.5 Consider the standard REVERSE program: reverse(X , Y ) ← rev (X , Y , [ ]) rev([ ], X, X) ← rev([H|L], X, Y ) ← rev(L, X, [H|Y ]) The declarative reading of the program is simple: the first argument of rev is a list, its reverse is represented as a difference list of the second and the third argument. This can be expressed by a formal specification specR = { reverse([t1 , . . . , tn ], [tn , . . . , t1 ]) | n ≥ 0, t1 , . . . , tn ∈ T } ∪ { rev([t1 , . . . , tn ], [tn , . . . , t1 |t], t) | n ≥ 0, t1 , . . . , tn , t ∈ T } where T is the set of ground terms. To prove that the program is correct w.r.t. this specification it is sufficient to show specR |= REVERSE. The nontrivial part of the proof is to show that the last clause is true in the interpretation specR . Take ground terms l, x, h, y, such that specR |= rev (l , x , [h|y]). So there exist n ≥ 0, t1 , . . . , tn , t such that l = [t1 , . . . , tn ], x = [tn , . . . , t1 |t], t = [h|y]. Then rev([h|l], x, y) is rev([h, t1 , . . . , tn ], [tn , . . . , t1 , h|y], y), thus specR |= rev ([h|l ], x , y). A quite common opinion is that “ill-typed” logical consequences of programs (like app([ ], 1, 1) for program APPEND) lead to difficulties in reasoning about program correctness (cf. eg. (Apt 1995; Apt 1997; Naish 1992)). Similarly, programs dealing with accumulators or difference lists are sometimes considered difficult to reason about(cf. eg. (Apt 1995)). The natural method deals with such programs without any special burden, as the examples above show. Notice that the natural method refers only to the declarative semantics of programs. A specification is an interpretation (alternatively a theory). Correctness is expressed as truth (of the program’s answers) in the interpretation. Program clauses are treated as logic formulae, their truth in the interpretation is to be shown. We abstract from any operational semantics, in particular from the form of queries Correctness and Completeness of Normal Programs 7 appearing during computation. The reasoning is obviously independent from the selection rule. Still we can use declarative specifications to reason about queries and corresponding answers, using the fact that an answer is an instance of the query. 3.2 Call-Success Specifications and the Operational Approach In this section we present an operational approach to program correctness and prove that it is not stronger than the natural method of Proposition 3.2 (as far as properties of program answers are concerned). We also argue that from a practical point of view the natural method is advantageous. Some authors (Bossi and Cocco 1989), (Apt 1997, Chapter 8), (Pedreschi and Ruggieri 1999)3 propose another approach to proving correctness. The approach explicitly deals with the form of queries. It uses specifications consisting of two parts. The precondition specifies atomic queries and the postcondition their success instances. We will call such specifications call-success specifications. Formally, pre- and postconditions are sets of atoms, closed under substitutions. The proof method used in this approach was proposed by (Bossi and Cocco 1989) and is an instance of the method of (Drabent and Maluszyński 1988).4 We will call it the operational proof method. It is based on the following verification condition: Let hpre, post i be a call-success specification, with the precondition pre and the postcondition post . For each clause C of the program it should be shown that for each (possibly non-ground) instance H ← B1 , . . . , Bn (n ≥ 0) of C if H ∈ pre, B1 , . . . , Bk ∈ post then Bk+1 ∈ pre (for k = 0, . . . , n−1), if H ∈ pre, B1 , . . . , Bn ∈ post then H ∈ post . (3) Additionally, there is a condition on initial queries. One requires that for any instance B1 , . . . , Bn (n > 0) of such query, if B1 , . . . , Bk ∈ post then Bk+1 ∈ pre (for k = 0, . . . , n−1). In (Apt 1997) a program (a query) with a call-success specification is called well-asserted if it satisfies the respective condition above. The intuition behind condition (3) is related to operational semantics – to procedure calls and successes under LD-resolution (SLD-resolution with the Prolog selection rule). Indeed, (3) implies a stronger, non-declarative notion of correctness. We will say that a program is correct w.r.t. a call-success specification hpre, post i if every procedure call in an LD-derivation is in pre and every procedure success is in post , provided the initial query satisfies the condition above. By a procedure call we mean the atom selected in a goal, and by a procedure success a computed instance of a procedure call. If P satisfies the verification condition (3) then P is correct w.r.t. the call-success specification (see (Apt 1997) and the references therein). Notice that correctness w.r.t. a call-success specification is not a declarative property. It considers not only computed answers, but whole computations (LD-trees). Thus this kind of correctness depends on the selection rule used. This is why we call the method operational. 3 4 Whenever these approaches differ, we follow that of (Apt 1997). The latter approach does not require specifications to be closed under substitutions. 8 Wlodzimierz Drabent and Miroslawa Milkowska Example 3.6 Consider the APPEND program. We refer here to its treatment in (Apt 1997, p. 214). The precondition and postcondition are, respectively, pre = { app(k, l, m) | k and l are lists }, post = { app(k, l, m) | k, l, m are lists and k ∗ l = m }. (Here k, l, m are terms, possibly non-ground.) The details of the proof can be found in (Apt 1997). Now we formally compare both proof methods. We are going to prove that, as far as declarative properties are of interest, both methods are equivalent. Remember that we refer to two notions of program correctness: w.r.t. declarative specifications (of the natural method) and w.r.t. call-success specifications (of the operational method). We first prove that the operational method is stronger than the natural one. We show that correctness w.r.t. a declarative specification can be expressed by means of correctness w.r.t. a call-success specification, and that whatever can be proven by the natural method, can be proven by the operational method. Roughly speaking, the natural method is the operational one with the preconditions abandoned. Proposition 3.7 Let P be a program, and let an interpretation spec be a declarative specification. Consider a call-success specification hpre⊤, post(spec)i, where pre ⊤ is the set of all atoms and post (spec) = {A | spec |= A}. Then P is correct w.r.t. spec iff P is correct w.r.t. hpre⊤, post(spec)i. Moreover, P and spec satisfy the verification condition of the natural method (Proposition 3.2) iff P and hpre⊤, post(spec)i satisfy the verification condition (3) of the operational method. Proof The first equivalence is obvious. Consider the call-success specification hpre⊤, post(spec)i. Notice that the condition on initial queries is trivially satisfied by any query. All the implications of (3) except the last one are trivially satisfied. The last implication of (3) holds for each instance of a clause C iff spec |= C. (For the non-obvious “if” case notice that B1 , . . . , Bn ∈ post(spec) means spec |= Bi for i = 1, . . . , n; hence from spec |= H ← B1 , . . . , Bn we obtain spec |= H.) It remains to show that the operational method is not stronger than the natural one, as far as the declarative properties are concerned. Consider a call-success specification hpre, post i. A corresponding declarative specification could be seen, speaking informally, as implication pre → post. The following definition formalizes this idea. Definition 3.8 Correctness and Completeness of Normal Programs 9 Let pre and post be sets of atoms closed under substitution. The declarative specification corresponding to the call-success specification hpre, posti is the Herbrand interpretation pre→post := { A ∈ H | if A ∈ pre then A ∈ post }. In other words, pre→post = (H \ pre) ∪ (H ∩ post ). If P is correct w.r.t. pre→post and Aθ is an answer to a query A ∈ pre then Aθ ∈ post . As an example take the callsuccess specification of APPEND from Example 3.6. The corresponding declarative specification is the specification (2) of APPEND from the previous section. The following proposition compares the corresponding declarative and call-success specifications. (Similar property is mentioned without proof in (de Boer et al. 1997; Pedreschi and Ruggieri 1999).) The next proposition (see also (Courcelle and Deransart 1988)) compares both proof methods. Proposition 3.9 If a program P is correct w.r.t. a call-success specification hpre, posti then P is correct w.r.t. the declarative specification pre→post. Proof Assume that a program P is correct w.r.t. hpre, posti. As pre→post is a Herbrand interpretation, it is sufficient to show that MP ⊆ pre→post (cf. the comment following Definition 3.1). Consider an A ∈ MP . So query A succeeds. If A ∈ pre then A ∈ post . Thus A ∈ pre→post . Now we show that if it can be proved by the operational method that a program P is correct w.r.t. hpre, posti then it can be proved by the natural method that P is correct w.r.t. pre→post. Proposition 3.10 If P and hpre, posti satisfy the verification condition (3) of the operational method then pre→post |= P . Proof pre→post |= P means that for any ground instance H ← B1 , . . . , Bn of a clause of P , if B1 , . . . , Bn ∈ pre→post then H ∈ pre→post . Consider such an instance and assume that B1 , . . . , Bn ∈ pre→post . If H 6∈ pre then H ∈ pre→post . Otherwise, for H ∈ pre we obtain from (3) by simple induction that Bi ∈ pre and Bi ∈ post , for i = 1, . . . , n. Hence H ∈ post , by (3); thus H ∈ pre→post . The converse of the two propositions does not hold: Example 3.11 For a simple counterexample consider P and hpre, posti satisfying the verification condition (3), and reorder the atoms in the clause bodies. The obtained program P1 may be incorrect w.r.t. hpre, posti, but pre→post |= P1 . 10 Wlodzimierz Drabent and Miroslawa Milkowska For a counterexample independent from the ordering of body atoms, consider the program P2 : p(X, Y, Z) ← q(X, Z), q(Y, Z) q(X, X) ← Let S be a set of ground terms. Consider a declarative specification pre→post , where pre = post = {p(t1 , t2 , t3 ) | t1 ∈ S or t2 ∈ S} ∪ {q(t1 , t2 ) | t1 ∈ S}, {p(t1 , t2 , t3 ) | t3 ∈ S} ∪ {q(t1 , t2 ) | t2 ∈ S}. We have pre→post |= P2 , but P2 is incorrect w.r.t. the operational specification hpre, post i. The same holds for P2 with the atoms in the clause body swapped. The last two propositions show that the natural method is stronger than the operational one (and hence equivalent to it), as far as declarative properties are concerned. In contrast to the operational method, the natural one is independent from the order of the body atoms in clauses. We proved that the two methods are formally equivalent. Now we argue that, from the practical point of view, switching from the operational method to the natural one does not bring any difficulties or complications. First, a declarative specification corresponding to a given call-success specification is obtained from the latter by a simple composition of three operations: removing non-ground atoms, set complementation and set union. Then, the proof of Proposition 3.10 shows how to obtain a natural method proof out of an operational one. This is done by adding a few simple steps. (Notice that for the new proof we consider implications (3) only for ground instances of clauses). The natural method requires proving one implication per program clause. In contrast, the operational method requires proving one implication for each atom occurring in the program or in the initial query. This is a price for obtaining more information: the property proved concerns not only program answers but also calls and successes under LD-derivations. However, when one is not interested in the latter, the natural method seems more convenient. There are many examples of using the operational method where the declarative one is sufficient (for instance cf. the papers mentioned above). Apparently people are often confused by the fact that the least Herbrand model contains undesired, “illtyped” atoms (cf. the opinions of (Apt 1995)). They want a specification describing exactly the set of atoms of interest. For instance, such a set for APPEND is spec ′ = { app(k, l, m) | k, l, m are lists and k ∗ l = m }. A program is usually not correct w.r.t. such a declarative specification. It is often not recognized that the property of interest can be described by means of an approximate declarative specification, like those from the examples of Section 3.1. There may be another reason for using specifications describing exactly the sets of answers of interest: such specifications can be employed in reasoning about program completeness. It is however not necessary to use the same specification for both correctness and completeness. As we argue in Section 3.3, it is quite convenient and natural to use separate specifications instead. Correctness and Completeness of Normal Programs 11 Notice the difference in the treatment of “ill-typed” atoms (like app([ ], 1, 1) for APPEND) by the two approaches. In the natural method we can include such atoms in a specification.5 For example, the declarative specification spec APPEND from Example 3.4 contains all ground atoms of the form app(k, l, m) where l and m are not lists. In the operational method the “ill-typed” atoms are usually excluded from postconditions. A precondition states explicitly how the program should be called to avoid “ill-typed” answers. The call-success specification of APPEND discussed above is a typical example. So the postcondition of a call-success specification is MP ∩ pre or its superset, while a declarative Herbrand specification is a superset of MP (for instance MP ∪ (H \ pre)). The following example shows that such treatment of “ill-typed” atoms by the operational method is impossible in some cases. It also shows that sometimes a non-trivial precondition cannot be used and the operational method boils down to the natural one; what conceptually is a precondition has to be expressed by a postcondition. Example 3.12 Let us consider a program TWO = TWOp ∪ TWOq , where TWOp is p(X, Y ) ← q(X, X2, X1, X3), q(X1, X3, X2, Y ) and p does not occur in TWOq . Assume that TWOq is correct w.r.t. declarative specification specq = (pre1q →post3q ) ∩ (pre2q →post4q ), where pre1q = { q(t, s, u, v) | list (t) } pre2q = { q(t, s, u, v) | list (s) } post3q = { q(t, s, u, v) | list (u) } post4q = { q(t, s, u, v) | list (v) } and list (t) stands for “t is a list”, for a possibly non-ground term t. (Thus specq states that if the i-th argument of q is a list then its argument i + 2 is a list too, for i = 1, 2. Nothing more is known about TWOq . Notice that specq includes all atoms with the predicate symbol distinct from q.) Program TWO is an abstraction of “two-pass” programs and of certain usages of difference lists. Some examples of such programs can be found e.g. in (Boye and Maluszyński 1997). Informally, its data flow can be described as follows. The value of X1 produced by the first call of q is used by the second call. The value of X2 is produced by the latter and used by the former, which uses it to produce the value of X3. The value of X3 is used by the second call, which produces the value of Y . By means of the natural method it is easy to show that, in an answer p(t1 , t2 ) of TWO, if t1 is a list then t2 is a list too. In order to describe this, let us use declarative specification specTWO = (prep →postp ) ∩ specq 5 Generally: a specification may permit any answer A that is not an instance of any query for which the program is intended to be used. 12 Wlodzimierz Drabent and Miroslawa Milkowska where prep = { p(t, s) | list (t) } postp = { p(t, s) | list (s) }. TWO is correct w.r.t. specTWO , as specTWO |= TWOp 6 and TWOq is correct w.r.t. specTWO by our initial assumption.7 Correctness of TWO w.r.t. spec implies that if p is called with the first argument being a list and succeeds then the second argument is bound to a list. Now we discuss how this can be proved using the operational method. Let Ar denote the set of all atoms with the predicate symbol r. To express this property one needs a call-success specification hpre, posti such that pre ∩ Ap = prep and post ∩ Ap = postp . Assume that the operational proof method is applicable to this specification, in other words that the verification conditions (3) hold. Hence in any LD-derivation any procedure call is in pre and any procedure success is in post, provided the initial goal is in pre. As explained previously, a usual way of using the operational method is such that “ill-typed” atoms are excluded from the postcondition. This is impossible for program TWO, as in the computations (i.e. LD-derivations) started from a goal A ∈ prep , predicate q may succeed with its second and fourth arguments being not lists. Notice that the precondition pre has to permit any value of the second, third and fourth argument of q, as during the computation q is invoked with these arguments being variables. Formally, pre contains any atom of the form q(t1 , t2 , t3 , t4 ) where t1 is a list. These atoms are in pre1q , but (some of them) are not in pre2q . Thus pre2q cannot be used as a precondition for q (more precisely, pre ∩ Aq cannot be pre2q , or a subset of pre2q ). We could use pre1q as a precondition for q (formally pre ∩ Aq could be pre1q ) provided that q did not occur in any clause body of TWOq . Otherwise we have to use the trivial precondition for q (formally pre ∩ Aq = Aq ), as nothing is known about the procedure calls in TWOq .8 Hence for the last implication of (3) for TWOp to hold, the postcondition has to express that if the i-th argument of q is a list then its argument i + 2 is a list, for 6 Here are the details of the proof. Take a ground instance H ← B1 , B2 of the clause of TWOp . Notice that: H ∈ prep implies B1 ∈ pre1q , 3 B1 ∈ postq implies B2 ∈ pre1q , B2 ∈ post3q implies B1 ∈ pre2q , B1 ∈ post4q implies B2 ∈ pre2q , B2 ∈ post4q implies H ∈ postp . Assume that spec TWO |= B1 , B2 . Thus we have, for i = 1, 2: Bi ∈ pre1q implies Bi ∈ post3q , Bi ∈ pre2q implies Bi ∈ post4q , Combining these implications together we obtain that H ∈ prep implies H ∈ postp . This means that spec TWO |= H. 7 8 To view this reasoning as application of Proposition 3.2, take a specification I = MTWOq ∪ (prep →postp ∩ {p(t1 , t2 ) | t1 , t2 are ground terms }). I ⊆ specTWO (as MTWOq ⊆ specq ), and I |= TWO (as specTWO |= TWOp ). Notice that the same holds if we swap the body atoms of TWOp . Correctness and Completeness of Normal Programs 13 i = 1, 2. So the postcondition for q is the declarative specification specq lifted to non-ground terms. Formally, spec ∩ Aq = (pre1q ∪ post3q ) ∩ (pre2q ∪ post4q ). Conceptually, pre1q and pre2q are preconditions, as they are premises of implications which have to be used in the proof. However, as shown above, pre2q (and pre1q , for some programs TWOq ) cannot be used in the precondition of the operational method. Instead they have to be employed in the postcondition. Notice that the first two implications of (3) hold trivially, and that proving the last implication is basically a generalization of the declarative proof presented above.9 Thus the operational proof for TWOp is basically the same as the declarative method proof presented above. (Restriction of the former to ground clause instances gives the latter.) Propositions 3.9 and 3.10 show that, for proving properties of program answers, we do not need preconditions. Declarative specifications and the natural method of Section 3.1 are sufficient. The proof of Proposition 3.10 shows how every operational method proof can be easily transformed into a natural method one, with introducing only minor changes. The converse does not hold; Examples 3.11 and 3.12 show that in some cases a natural method proof cannot be converted into an operational one with a non-trivial precondition. The operational method is a generalization of the natural one: roughly speaking any natural method proof can be seen as operational one, with a trivial precondition (Proposition 3.7). The operational method proves more, as it also deals with the form of procedure calls and successes in LD-resolution. However it is more complicated and, for declarative properties, it is not stronger than the natural one. In our opinion, when one is interested only in declarative properties, the natural method should be preferred to the operational one. 3.3 Completeness of Definite Programs Let us begin from an observation that for a given program a specification for completeness is in general different from that for correctness. For the purposes of correctness we describe a superset of the set of answers of a program. For the purposes specification for completeness z }| { required | 9 incorrect {z specification for correctness } One has to show that if H ∈ prep and B1 , B2 ∈ (pre1q ∪ post3q ) ∩ (pre2q ∪ post4q ) then H ∈ postp , for any instance H ← B1 , B2 of the clause of TWOp . For ground instances this is equivalent to specTWO |= TWOp . 14 Wlodzimierz Drabent and Miroslawa Milkowska of completeness we describe its subset, as a program satisfying a completeness requirement may compute something more than required. Often when a specification for correctness is of the form pre→post then a specification for completeness is post . For instance, it makes no sense to require that APPEND program were complete w.r.t. the specification spec from the beginning of Section 3.1, or specAPPEND from Example 3.4. Such a program should compute “ill-typed” answers, like app(a, b, c). Our specification for completeness of APPEND is the Herbrand interpretation specCAPPEND = {app(k , l , m) ∈ H | k , l , m are lists, k ∗ l = m}. Notice that it properly expresses our intentions: APPEND should compute all the cases of list concatenation. The difference specAPPEND \ specCAPPEND contains only “ill-typed” atoms, with the first or second argument not being a list. We are not interested whether they are answers of APPEND. As previously, we consider specifications which are (possibly non-Herbrand) interpretations. Additionally we require that a specification is over a preinterpretation J in which equality satisfies the Clark equality theory CET.10 (Alternatively, we may consider specifications which are theories containing CET.) Definition 3.13 A definite program P is complete for a query Q w.r.t. a specification specC if specC |= Q θ implies that Qθ is an answer for P , for any instance Qθ of Q. P is complete w.r.t. specC if it is complete for any query w.r.t. specC . Remember that Qθ is an answer for P iff P |= Qθ; this implies that Qθ is an instance of some computed answer for Q. Below we refer to theory ONLY-IF(P ) (Doets 1994, p. 135) that is usually used while defining the Clark completion of a program P . Informally, ONLY-IF(P ) is P with implications reversed. For each predicate symbol p, if the clauses of P ~ 1 , . . . , p(~tk )←B ~ k then ONLY-IF(P ) contains beginning with p are p(~t1 )←B p(~x) → k _ ~ i, ∃−~x ~x = ~ti ∧ B i=1 where ~x are distinct new variables and the quantification is over the variables occurring in the clauses. For k = 0 the implication is equivalent to ¬p(~x). In our example, ONLY-IF(APPEND) is (equivalent to) app(x , y, z ) → x = [ ], y = z ∨ ∃ h, k , m (x = [h|k ], z = [h|m], app(k , y, m)). We also need a specification for equality: spec = = { =(t, t) | t ∈ |J | } where |J | is the carrier of the considered preinterpretation J . So in the case of Herbrand specifications we have spec = = {=(t, t) | t is a ground term}. 10 As an example what happens if this requirement is not satisfied consider J in which constants a, b are given the same value. Take an interpretation spec over J such that spec |= p(a). Then a program P = { p(a)← } is not complete w.r.t. spec, as spec |= p(b) but p(b) is not an answer of P . Correctness and Completeness of Normal Programs 15 The following can be used to prove completeness of a program. Proposition 3.14 (Completeness, definite programs) Let P be a definite program and Q a query. Assume that the set of function symbols of the underlying language is infinite. If (i) specC ∪ spec = |= ONLY-IF(P ) and (ii) P terminates for Q, i.e. there exists a finite SLD-tree for P and Q then P is complete for Q w.r.t. specC . If P is complete w.r.t. specC for each ground instance of each atom from a query Q then P is complete for Q w.r.t. specC . Notice that no particular selection rule is required in (ii). For Herbrand specifications, condition (i) means that for each A ∈ specC there exists a ground instance A ← B1 , . . . , Bn of a clause of P such that B1 , . . . , Bn ∈ specC . Proof The first part of the proposition follows from a more general Theorem 4.21. (Take spec = (⊤, specC), where ⊤ is the set of all J -atoms over the considered preinterpretation. By Theorem 4.6, P seen as normal program is correct w.r.t. spec and thus Theorem 4.21 can be applied.) For the second part, let Q = A1 , . . . , An and P be complete w.r.t. specC for each ground instance of each Ai . Now specC |= Qθ implies specC |= Ai θσ and then P |= Ai θσ, for each ground instance Ai θσ of Ai θ, i = 1, . . . , n. This implies P |= Ai θ. The latter follows from the fact that if P |= Aσ for each ground instance Aσ of an atom A then P |= A (see e.g. Theorem 3.3 of (Apt et al. 1996), the proof there requires infinite set of constants, but can be easily modified for infinite set of function symbols). We obtained P |= Ai θ for i = 1, . . . , n, this means P |= Qθ. Example 3.15 Consider program APPEND and the specification specCAPPEND given above. It is easy to show that specCAPPEND ∪ spec = |= ONLY-IF(APPEND). One can show, using any standard method, that APPEND terminates for any ground atomic query. Thus APPEND is complete for any ground atomic query and then, by the second part of the proposition, complete. Consider a query Q = app(X, Y, m), where X, Y are variables and m a possibly non-ground list. For any lists k, l such that k ∗ l = m we have specCAPPEND |= app(k , l , m). By completeness of APPEND, P |= app(k, l, m). So by completeness of SLD-resolution, app(k, l, m) (or a more general atom) is a computed answer for Q. Summarizing, Q produces all the required divisions of m into two lists. In our opinion, Proposition 3.14 is a formalization of a rather natural way of informal reasoning about completeness, which consists of checking that any tuple of argument values to be defined by the predicate is “covered” by some of its clauses. The proposition without condition (ii) does not hold. Program { app(X, Y, Z) ← app(X, Y, Z) } is a counterexample. Also the requirement on function symbols cannot be removed. For a counterexample take P = { p(a)←, p(b)←}, Q = p(X), 16 Wlodzimierz Drabent and Miroslawa Milkowska a Herbrand universe {a, b} and a Herbrand interpretation specC = { p(a), p(b) }. Then specC |= Q and P is not complete for Q. However (i) and (ii) hold. The method proposed here proves program completeness for queries that terminate. This should not be seen as a disadvantage, since in most cases termination of a program has to be established anyway. Deransart and Maluszyński (1993, Section 6.2.2, Theorem 6.1) provide a similar sufficient condition for completeness, which does not refer to termination. Instead of (ii) it employs some other property, which involves norms on atoms. Checking that property is similar to proving termination. So whenever termination has to be shown anyway, our approach is simpler. Notice that Proposition 3.14 is also applicable when termination is not proven. Condition (i) alone implies that if we obtain a terminating execution for a particular query Q then all the answers for Q required by the specification have been computed. There is certain limitation in using interpretations as specifications for completeness. One cannot express properties like “for any lists k, l there exists some m such that P |= app(k, l, m).” (The same limitation applies to call-success specifications of the operational approach from the previous section.) Such properties can however be expressed by specifications which are theories. The proof method of Proposition 3.14 is not complete, in contrast to that of (Deransart and Maluszyński 1993). For a counterexample, consider a program P containing a clause p(~x) ← p(~x). P is complete (for query p(~x)) w.r.t. specification MP , but condition (ii) does not hold. The method is however complete for arbitrary program P and any query Q for which P terminates (or any query A1 , . . . , An such that P terminates for any ground instance of Ai , for i = 1, . . . , n). To prove this fact, assume that P is complete w.r.t. a specification specC . Then there exists a weaker specification specC ′ ⊇ specC such that P is complete w.r.t. specC ′ and (i) holds for specC ′ . One may take as specC ′ the least model of P over the given preinterpretation. Thus Proposition 3.14 makes it possible to show that, for any query as above, P is complete w.r.t. specC ′ , and thus specC . 4 Reasoning about normal programs We first discuss specifications for normal programs and present a 2-valued characterization of the 3-valued completion semantics. Then we introduce a method for proving correctness (Section 4.3) and a method for proving completeness of programs (Section 4.4). Each presentation includes an example, discussion of completeness of the method and comparison with an operational approach. In the section on correctness we also show how the presented approach can be used to generalize a well-known method for proving termination. We conclude with a bigger example (Section 4.5). In this chapter, unless stated otherwise, the considered programs (queries) are normal programs (queries). We are interested in the completion semantics (logical consequences of program completion in 3-valued logic (Kunen 1987)). This Correctness and Completeness of Normal Programs 17 semantics corresponds to an operational notion of finite failure. So we usually skip “finitely” in phrases like “finitely fails”. 4.1 Specifications for normal programs In order to introduce specifications for normal programs let us first consider definite programs with queries which may contain negative literals. Assume that we have a definite program P complete w.r.t. a Herbrand specification specC and correct w.r.t. a specS (C as completeness, S as soundness). If an atomic query A fails then specC |= ¬A. So for P and atomic queries, negation as finite failure is correct w.r.t. the specification for completeness. Now consider a query Q = p(~t), ¬q(~u). If it succeeds with an answer Qθ then spec1 |= Qθ for an interpretation spec1 that interprets p as specS and q as specC. If Q fails then spec2 |= ¬Q for an interpretation spec2 that interprets p as specC and q as specS. In order to deal with this phenomenon, we will use the following renamings of predicate symbols. Definition 4.1 Let L be a first order language. Let Q be a formula or a set of formulae (e.g. a query or a program) of L. Let us extend L by adding, for any predicate symbol p, a new predicate symbol p′ . Q′ is Q with p replaced by p′ in every negative literal of Q (for any predicate symbol p, except for =). Similarly, Q′′ is Q with p replaced by p′ in every positive literal. If I is an interpretation for L then I ′ is the interpretation obtained from I by replacing each predicate symbol p by p′ . For normal programs, a specification for correctness should describe two (possibly overlapping) sets of ground atoms — those allowed to succeed and those allowed to fail. Similarly, a specification for completeness should describe two (disjoint) sets, of the ground atoms required to fail and of those required to succeed. It is natural to allow to succeed any atom not required to fail, and allow to fail any atom not required to succeed. Hence the two sets needed to specify correctness can be the complements of the two sets used to specify completeness. Definition 4.2 A specification for a normal program is a pair (specS , specC ), where specC and specS are interpretations over the same preinterpretation J , in which the equality satisfies the Clark equality theory CET. A specification (specS , specC ) is called proper if specC ⊆ specS . Formal definitions of correctness and completeness are given in the respective sections below. For an informal explanation, assume that a program P is correct w.r.t. a proper Herbrand specification spec = (specS, specC). Then, if a ground atomic query A succeeds then A ∈ specS, if it fails then A 6∈ specC. If P is complete w.r.t. spec then any A ∈ specC succeeds and any A 6∈ specS fails. Thus atomic queries from specS − specC are allowed to succeed or to fail, but nothing is required about these queries. 18 Wlodzimierz Drabent and Miroslawa Milkowska One can consider correctness w.r.t. a specification that is not proper (atomic queries from specC − specS are neither allowed to succeed nor to fail). On the other hand a program cannot be complete w.r.t. a non-proper Herbrand specification. This would require that some atoms both succeed and fail. Sometimes it may be helpful to view our specifications as interpretations in the 4valued logic of Belnap. The logical values in this logic are the subsets of {true, false}. By removing the value {true, false} we obtain the logical values of the 3-valued logic that is usually used when dealing with semantics of logic programs. For a 4-valued interpretation I and a formula F , I |=4 F means that the logical value of F in I contains true. For more details see (Fitting 1991) or (Stärk 1996). A specification spec = (specS, specC) can be seen as a pair IS4 (spec), IC4 (spec) of 4valued interpretations. The first interpretation corresponds to viewing spec as a specification for correctness, the other — for completeness. Definition 4.3 Let spec = (specS, specC) be a specification over a preinterpretation J . IS4 (spec) is the 4-valued interpretation over J such that for any J -atom A the logical value of A contains true iff A ∈ specS, and it contains false iff A 6∈ specC. IC4 (spec) is the 4-valued interpretation over J such that for any J -atom A the logical value of A contains true iff A ∈ specC, and it contains false iff A 6∈ specS. We will avoid 4-valued interpretations by employing the predicate renaming of Definition 4.1. 4.2 Characterization of 3-valued completion semantics In this section we introduce a characterization of the 3-valued completion semantics of normal programs. The characterization uses the standard 2-valued logic. It employs renaming of predicate symbols. There exist other 2-valued characterizations of the completion semantics, based on predicate renaming. The approach of Mancarella et al. (1990) (see also references therein) is applicable to a restricted class of programs and deals with different semantics, which employs a domain closure axiom (thus the underlying language has a finite set of function symbols). Our characterization combines the ideas of those of (Stärk 1996) and (Drabent and Martelli 1991; Drabent 1996). Lemma 4.4 (Characterization of completion semantics) Let P be a program and Q a query. comp(P ) |=3 Q comp(P ) |=3 ¬Q iff iff P ′ ∪ ONLY-IF(P ′′ ) ∪ CET |= Q′ , P ′ ∪ ONLY-IF(P ′′ ) ∪ CET |= ¬Q′′ . Proof We use a result of Stärk (1996) who introduced a notion of partial completion of a logic program and showed that 3-valued consequences of the completion of a normal program are classical consequences of the partial completion of the program (modulo a simple syntactic transformations described below). Correctness and Completeness of Normal Programs 19 The main observation is that Stärk’s partial completion pcomp(P ) of a program P and P ′ ∪ONLY-IF(P ′′ ) ∪CET are just syntactical transformations of each other. Let L be the underlying first-order language. The language L used by Stärk is obtained from L by adding for every predicate symbol p a new symbol p with the same arity. Let us transform P ′ , ONLY-IF(P ′′ ), Q′ and ¬Q′′ as follows: – replace in ONLY-IF(P ′′ ) each implication of the form α → β by ¬β → ¬α, – transform each formula containing negation to an equivalent form in which negation occurs only in negated literals, – substitute each occurrence of a negated literal of the form ¬p′ (~t) by atom ~ p(t) (notice that every negated literal will be of that form and the obtained formulae do not contain primed predicate symbols). Let us denote the translation of F by F (where F is P ′ , ONLY-IF(P ′′ ), Q′ or ¬Q′′ ). Now the partial completion pcomp(P ) of a program P is P ′ ∪ONLY-IF(P ′′ )∪ CET . From Theorems 3.2 and 3.4 in (Stärk 1996) it follows that: comp(P ) |=3 Q comp(P ) |=3 ¬Q iff pcomp(P ) |= Q′ iff pcomp(P ) |= ¬Q′′ Let F be Q′ (resp. ¬Q′′ ). pcomp(P ) |= F is equivalent to P ′ ∪ ONLY-IF(P ′′ ) ∪ CET |= F . 4.3 Correctness of normal programs We now introduce our method for proving program correctness. The presentation is followed by an example proof. Section 4.3.3 discusses completeness of the method and the next section compares the method with some other approaches. Section 4.3.5 shows how correctness w.r.t. approximate specifications can be employed in generalizing a known method of proving program termination. The reader may wish to skip Sections 4.3.3 – 4.3.5 in the first reading. 4.3.1 Proof method Definition 4.5 We say that a program P is correct with respect to a specification spec = (specS, specC) if for any query Q (i) if comp(P ) |=3 Q then specS ∪ specC ′ |= Q′ (ii) if comp(P ) |=3 ¬Q then specS ∪ specC ′ |= ¬Q′′ The reader may compare this definition with the informal discussion of Section 4.1, related to Definition 4.2.11 In particular, if P is correct with respect to spec = (specS, specC), then from the soundness of SLDNF-resolution it follows that every 11 Notice that specS ∪ specC ′ |= Q′ is equivalent to IS4 (spec) |=4 Q, and specS ∪ specC ′ |= ¬Q′′ is equivalent to IS4 (spec) |=4 ¬Q. 20 Wlodzimierz Drabent and Miroslawa Milkowska computed answer Q (of SLDNF-resolution) satisfies specS ∪ specC ′ |= Q′ . It means that for each positive literal A in Q, specS |= A, and for each negative literal ¬A in Q, specC |= ¬A. For P and spec as above, if a query Q fails then specS ∪ specC ′ |= ¬Q′′ (by soundness of negation as failure). In the case of queries consisting of one literal A (resp. ¬A) it means that specC |= ¬A (resp. specS |= A). The same holds for any operational semantics, which is sound w.r.t. 3-valued completion semantics. This includes constructive negation (cf. (Drabent 1995) and the references therein) and extensions of SLDNF-resolution allowing selecting a non-ground negative literal ¬A if A fails or succeeds without binding its variables (Lloyd 1987; Stärk 1996). The proposed proof method is given by the following theorem. (spec= is defined in Section 3.3.) Theorem 4.6 (Correctness, normal programs) Let P be a program and spec = (specS, specC) a specification, such that (a) specS ∪ specC ′ |= P ′ (b) specS ∪ specC ′ ∪ spec= |= ONLY-IF(P ′′ ) then P is correct w.r.t. spec. Proof From (a), (b) and spec= |= CET we obtain specS ∪ specC ′ ∪ spec= |= P ′ ∪ ONLY-IF(P ′′ )∪CET . Assume that comp(P ) |=3 Q (respectively comp(P ) |=3 ¬Q). By Lemma 4.4, specS ∪ specC ′ |= Q′ (resp. specS ∪ specC ′ |= ¬Q′′ ). 4.3.2 Example correctness proof We illustrate our correctness proof method by applying it to a program (from (Stärk 1996)) defining the subset relation. We present a detailed proof. Example 4.7 Let P be the following program: subset(L, M ) ← ¬notsubset(L, M ) notsubset(L, M ) ← member(X, L), ¬member(X, M ) member(X, [X|L]) ← member(X, [Y |L]) ← member(X, L) Consider Herbrand specification spec = (specS, specC), where specS = sSm ∪ sSn ∪ sSs , sSm sCm sSn sCn sSs sCs = = = = = = specC = sCm ∪ sCn ∪ sCs {member(x, l) | l is a list → x ∈ l} {member(x, l) | l is a list ∧ x ∈ l} {notsubset(l, m) | l and m are lists → l 6⊆ m} {notsubset(l, m) | l and m are lists ∧ l 6⊆ m} {subset(l, m) | l and m are lists → l ⊆ m} {subset(l, m) | l and m are lists ∧ l ⊆ m} Correctness and Completeness of Normal Programs 21 (l ⊆ m means that all elements of l are elements of m.) We would like to prove that our program is correct with respect to the above specification spec. We show that conditions (a) and (b) of Theorem 4.6 are satisfied. This implies that whenever subset(l, m) is a computed answer of P then sSs |= subset(l, m), and thus if l, m are lists then l ⊆ m. Also, whenever a query subset(l, m) fails then sCs |= ¬subset(l, m). Hence l or m is not a list or l 6⊆ m. Let spSC = specS ∪ specC ′ . In order to prove condition (a) one has to show, for each clause C of P , that spSC |= C ′ . In order to prove condition (b) one has to show that each implication of ONLY-IF(P ′′ ) is true in the interpretation spSC ∪ spec= . Let us first consider the second clause of program P . For condition (a) we have to prove that: spSC |= notsubset(L, M ) ← member(X, L) ∧ ¬member′ (X, M ). Let l, m, x be any elements of the universe such that spSC |= member(x, l) ∧ ¬member′ (x, m). That means that member(x, l) ∈ sSm and member(x, m) 6∈ sCm . We would like to prove that notsubset(l, m) ∈ sSn . So assume that l and m are lists. From member(x, l) ∈ sSm we obtain that x ∈ l, and from member(x, m) 6∈ sCm — x 6∈ m. Hence l 6⊆ m. For condition (b) and predicate notsubset we have to show that spSC |= notsubset′ (L, M ) → ∃X(member′ (X, L) ∧ ¬member(X, M )) Let l, m be any elements of the universe such that spSC |= notsubset′ (l, m). So l and m are lists and l 6⊆ m. So there exists an element, say a, such that a ∈ l and a 6∈ m. Thus member(a, l) ∈ sCm and member(a, m) 6∈ sSm . Hence spSC |= member′ (a, l) ∧ ¬member(a, m), so the implication above is true in spSC. Let C denote the first clause of P . Notice that subset(L, M ) ↔ ¬notsubset(L, M ) is true both in sSs ∪ sCn and in sCs ∪ sSn . After replacing notsubset by notsubset′ , this implies sSs ∪ sCn′ |= C ′ , and hence (a) for the first clause. After replacing subset by subset′ , this implies sSn ∪ sCs′ |= subset′ (L, M ) → ¬notsubset(L, M ), hence (b) for predicate subset. The proof for predicate member boils down to a proof of a definite program (a proof of correctness and part (i) of completeness proof, cf. Proposition 3.14). ✷ 4.3.3 On completeness of the proof method To discuss completeness of the proof method we need an ordering on specifications. Definition 4.8 Let sp = (spS, spC), spec = (specS, specC) be specifications (over the same preinterpretation J ). We say that sp is stronger than spec (written sp  spec) if spS ⊆ specS and specC ⊆ spC. The set of atoms allowed to succeed (fail) by the stronger specification is a subset of the set of atoms allowed to succeed (fail) by the weaker one. The set of atoms required to succeed (fail) by the stronger specification is a superset of the analogical set for the weaker one. 22 Wlodzimierz Drabent and Miroslawa Milkowska Notice that this definition corresponds to an intuitive notion of a stronger specification. Let spec1  spec2 , then for any program P , if P is correct w.r.t. spec1 then it is correct w.r.t. spec2 . The ordering  on specifications corresponds to the information content ordering ≤k (Fitting 1991) on 4-valued specifications for correctness (cf. the last paragraphs of Section 4.1): spec1  spec2 iff IS4 (spec1 ) ≤k IS4 (spec2 ). It also holds that spec1  spec2 iff IC4 (spec2 ) ≤k IC4 (spec1 ). We say that a proof method is complete for P if the following condition holds: if P is correct w.r.t. a specification spec then there exists a specification stronger than spec which satisfies the conditions of the proof method. As the following examples show, the proof method for program correctness (Theorem 4.6) is not complete. Example 4.9 Let P be the following program: p(f (x)) ← p(x) q ← p(x) Consider a non-proper Herbrand specification spec = (∅, {q}), which says that no atom is allowed to succeed and all atoms except q are allowed to fail. Notice that IS4 (spec) = ΦP ↑ ω and ΦP ↑ ω is not the ≤k -least fixpoint, where ΦP is the 4-valued immediate consequence operator of P (Fitting 1991). Program P is correct w.r.t. this specification. Unfortunately neither spec nor any specification stronger than spec satisfies conditions (a) and (b) of Theorem 4.6 (for justification see below). Thus the proof method cannot be applied. On the other hand program P is correct w.r.t. a proper specification (∅, ∅), corresponding to the least fixpoint of the operator ΦP , and this specification does satisfy conditions (a) and (b). ✷ Example 4.10 Consider a program P : p(a) ← q ← ¬p(x) and assume that the underlying language has exactly one function symbol a. (This example can be easily generalized for any finite set of function symbols.) Notice that comp(P ) 6|=3 q and comp(P ) 6|=3 ¬q. Consider a Herbrand specification spec = ({p(a)}, {p(a), q}), which allows q neither to succeed nor to fail. P is correct w.r.t. spec but the verification condition of our method (Theorem 4.6) is not satisfied. The latter is due to {p(a), p′ (a), q ′ }) 6|= q ′ → ∃x¬p(x). The condition holds for a weaker specification ({p(a)}, {p(a)}) that corresponds to the least fixpoint of ΦP over one element Herbrand algebra. To explain the incompleteness we will refer to the 4-valued immediate consequence operator ΦJ P (over a preinterpretation J ). A 4-valued interpretation I is a J J pre-fixpoint of ΦJ P iff ΦP (I) ≤k I. For any α, the interpretation ΦP ↑ α is 3-valued Correctness and Completeness of Normal Programs 23 and is identical to the corresponding power of the 3-valued immediate consequence operator (Stärk 1996). Conditions (a) and (b) of Theorem 4.6 mean that the 4-valued interpretation IS4 (spec) corresponding to a specification spec over a preinterpretation J is a prefixpoint of ΦJ P . A program P may be correct w.r.t. a specification spec for which 4 IS (spec) is not preceded by the least fixpoint of ΦJ P (in the ordering ≤k ). Then there does not exist a specification which satisfies (a), (b) and is stronger than spec. Hence Theorem 4.6 is inapplicable in such a case. In Example 4.9 this happens because J ΦJ P ↑ ω is not a fixpoint of ΦP . In Example 4.10 the program is correct w.r.t. a specification, which is stronger than the ΦJ P ↑ ω. When the set of function symbols of the underlying language is infinite then the strongest Herbrand specification with respect to which P is correct is specω , where IS4 (specω ) = ΦP ↑ ω. The latter follows from the fact (Kunen 1987) that comp(P ) |=3 F iff ΦP ↑ n |=3 F for some finite n (where F is a query or a negation of a query). This reasoning can be summarized as: Proposition 4.11 The correctness proof method of Theorem 4.6 is complete for an arbitrary program P and for any specification weaker than the ≤k -least fixpoint of ΦJ P. When the set of function symbols of the underlying language is infinite then the proof method is complete for an arbitrary Herbrand specification spec and any program P for which ΦP ↑ ω is the ≤k -least fixpoint of ΦP . We believe that cases for which the method is not complete are rather artificial (like those from the two examples above) and are rare in practice. 4.3.4 Correctness proving methods — comparison In this section we compare the correctness proof method from Section 4.3.1 with that for definite programs (Section 3.1) and with the approach of (Pedreschi and Ruggieri 1999). We show that the latter is (strictly) weaker, as far as declarative properties of programs are concerned. We first show that the natural method for proving correctness of definite programs (Proposition 3.2) is a special case of the method for normal programs (Theorem 4.6). Let P be a definite program and specS a specification for correctness. Take spec = (specS, ∅). Then condition (a) is equivalent to specS |= P (i.e. the verification condition of the natural method), and condition (b) reduces to spec= |= ONLY-IF(P ), which trivially holds. A straightforward way of generalizing to normal programs the natural method for proving correctness of definite programs is to replace 2-valued interpretations by 4-valued ones, and programs by program completions: Proposition 4.12 Let P be a program, Q a query and I a 4-valued interpretation such that I |=4 comp(P ). 24 Wlodzimierz Drabent and Miroslawa Milkowska 1. If comp(P ) |=3 Q then I |=4 Q. If comp(P ) |=3 ¬Q then I |=4 ¬Q. 2. P is correct w.r.t. a specification spec such that IS4 (spec) = I. Proof Let F be Q or ¬Q. From comp(P ) |=3 F it follows that comp(P ) |=4 F (Stärk 1996). As I |=4 comp(P ), we obtain I |=4 F . If IS4 (spec) = I then implications 1. are equivalent to the conditions (i), (ii) of Definition 4.5 of program correctness. The proof method provided by Proposition 4.12 is in fact weaker than that of Theorem 4.6, as IS4 (spec) |=4 comp(P ) implies conditions (a) and (b) of the Theorem but not vice versa. This is because IS4 (spec) |=4 comp(P ) means that IS4 (spec) is a fixpoint of the 4-valued immediate consequence operator ΦP (Stärk 1996), while conditions (a), (b) mean that it is a pre-fixpoint of ΦP . (For details see Section 4.3.3.) Pedreschi and Ruggieri (1999) presented an operational method for proving total correctness of normal programs. It is an extension of the method for definite programs discussed in Section 3.2. The method uses call-success specifications (cf. Section 3.2), the difference is that the pre- and postconditions are Herbrand interpretations. The core of the method is the following definition of a proof relation ⊢t . A level mapping is a function from ground atoms to natural numbers. For a level mapping | | and an atom A, |A| will denote the maximum of {|Aθ| : Aθ is ground} or ∞ when such maximum does not exist. Definition 4.13 (Pedreschi and Ruggieri 1999, Definition 5.3 ) Let P be a program, and hP re, P osti a call-success specification, where P re, P ost are Herbrand interpretations. We write ⊢t {P re}P {P ost} iff there exists a level mapping | | such that: (i) for every ground instance A ← L1 , . . . , Ln of a clause of P : 1. for i ∈ [1, n]: P re |= A ∧ P ost |= L1 , . . . Li−1 =⇒  P re |= Bi ∧ | A | > | Bi | if Li = Bi P re |= Bi ∧ | A | > | Bi | if Li = ¬Bi 2. P re |= A ∧ P ost |= L1 , . . . , Ln =⇒ P ost |= A (ii) TP (P ost) ⊇ P ost ∩ P re. If ⊢t {P re}P {P ost} holds and P does not flounder for (ground atomic) queries from P re then P is totally correct w.r.t. hP re, P ost ∩ P rei in the following sense: 1. P ost ∩ P re is the set of those atoms from P re that succeed, 2. P re \ P ost is the set of those atoms from P re that fail, 3. if P re |= A0 , |A0 | is finite, and L is A0 or ¬A0 then the LDNF-tree with the root L (a) is finite, and (b) for each selected literal A or ¬A in the tree, P re |= A. Correctness and Completeness of Normal Programs 25 Properties 1. and 2. mean that P is correct (in the sense of Definition 4.5) w.r.t. a specification spec for which (H \ P re) ∪ (P ost ∩ P re) are the ground atoms allowed to succeed and (H\ P re)∪(P re \ P ost) are the ground atoms allowed to fail. Simple calculation results in spec = ((H \ P re) ∪ P ost, P re ∩ P ost). The following proposition states that whenever the method of (Pedreschi and Ruggieri 1999) can provide a proof of program correctness (in the sense of Definition 4.5) then a proof can be obtained by our method. Proposition 4.14 Assume that ⊢t {P re}P {P ost} holds. Then conditions (a) and (b) of Theorem 4.6 hold for specification spec = (specS, specC), such that specS = (H \ P re) ∪ P ost and specC = P re ∩ P ost. Hence P is correct w.r.t. spec. Proof ~ of a clause of P and assume that To prove (a) consider a ground instance H ← B ′ ′ ~ specS ∪specC |= B and P re |= H. (If P re 6|= H then condition (a) trivially holds.) ~ we obtain from (i) 1. by induction that P re |= L if L Then for each literal L of B is positive, P re |= ¬L if L is negative, and hence P ost |= L (as in the first case specS |= L and in the second case specC |= L). Thus P ost |= H, by (i) 2., and specS ∪ specC ′ |= H. To prove (b) it is sufficient to show that for every ground atom A such that ~ such that specC |= A there exists a ground instance of a program clause A ← B ′ ′′ ~ specS ∪ specC |= B . Let A be a ground atom for which specC |= A (i.e. A ∈ P re ∩ P ost). By (ii) A ∈ TP (P ost). From the definition of TP it follows that there ~ such that P ost |= B. ~ From exists a ground instance of a program clause A ← B ~ where Li = Bi or Li = ¬Bi , satisfies P re |= Bi . In case (i) 1. each literal Li of B, Li = Bi we have P ost |= Li and P re |= Li , thus specC |= Li . In case Li = ¬Bi we have P ost |= Li and P re 6|= Li , thus specS |= Li . Hence specS ∪ specC ′ |= L′′i for ~ so specS ∪ specC ′ |= B ~ ′′ . every literal Li of B, The condition ⊢t {P re}P {P ost} in the Proposition may be weakened: notice that no facts concerning the level mapping (from the definition of ⊢t ) were used in the proof. We showed that the proof method of (Pedreschi and Ruggieri 1999) is weaker than that of Theorem 4.6, as far as the declarative semantics and program correctness are concerned. It is actually strictly weaker, due to the following limitations. The method deals only with total correctness, thus correctness, completeness and termination have to be proved together; none of them can be dealt with separately. As a result, the method is not applicable to approximate specifications, for which a program is correct but not complete (or does not terminate). A specification has to be exact for the atoms in P re, in the sense that it states exactly which of them succeed and which fail. Formally, P re ∩ P ost is unique for a given program and precondition.12 The method deals with LDNF-resolution and is inapplicable 12 Notice that this restriction does not concern the operational method for definite programs (Section 3.2); that method permits approximate specifications. 26 Wlodzimierz Drabent and Miroslawa Milkowska to programs that flounder or do not terminate under Prolog selection rule (but are intended to be executed under some other operational semantics, for instance delays or constructive negation). It is also inapplicable when the LDNF-tree is infinite but has success nodes (e.g. when a query has an infinite set of computed answers). In all these cases the method of Theorem 4.6 is applicable. Notice also that the operational method, in contrast to our approach, requires separate proving of non-floundering. Obviously, the method of (Pedreschi and Ruggieri 1999) deals also with properties which are out of the scope of our approach, namely termination and the form of selected literals in LDNF-resolution. See Section 4.4 for a comparison with the method for proving program completeness proposed in this paper. 4.3.5 A note on proving termination This section, in contrast to the rest of the paper, considers a property which is not declarative. We show how approximate specifications (which describe declarative notion of program correctness) can be employed in generalizing a well-known method of proving termination. Apt and Pedreschi (1993) presented a method of proving termination of normal programs with the Prolog selection rule. They introduced a notion of an acceptable program (w.r.t. a 2-valued interpretation I and a level mapping). Any acceptable program is left terminating, this means it terminates with the Prolog selection rule for all ground goals. The interpretation I is a model of the program and a model of comp(P − ), where P − is the involved in negation part of the program.13 It turns out that I is unique for all the predicates in P − (Apt and Pedreschi 1993). This is a disadvantage of the approach; to show that P is left terminating one has to know the unique interpretation. We show that the unique 2-valued interpretation can be replaced by an approximate specification spec w.r.t. which the program is correct. We introduce a notion of an approximately acceptable program (a-acceptable in short). We prove that each a-acceptable program is acceptable, and thus left terminating. Definition 4.15 Let P be a program, | | a level mapping, and spec = (specS, specC) a specification. P is called a-acceptable with respect to | | and spec if P is correct w.r.t. spec, and for every ground instance A ← L1 , . . . , Ln of a clause from P the following implication holds for i ∈ [1, n]: if specS ∪ specC ′ |= i−1 ^ L′j then | A | > | Li | . j=1 where |¬B| = |B| for any ground atom B. 13 ∗ is introduced; it is the least set such that any predicate symbol To define P − , first N egP ∗ , and if p ∈ N eg ∗ occurs in the head of a clause occurring in a negative literal of P is in N egP P ∗ . Program P − contains those clauses of P that C of P and q in the body of C then q ∈ N egP ∗ use symbols from N egP in their heads. Correctness and Completeness of Normal Programs 27 This definition differs from that of an acceptable program in two aspects. ConVi−1 Vi−1 dition I |= j=1 Lj has been replaced by specS ∪ specC ′ |= j=1 L′j . Also, P is required to be correct w.r.t. spec, instead of I being a model of P ∪ comp(P − ), where comp is taken w.r.t. the alphabet N egP∗ of predicate symbols.14 The notion of a-acceptability is a generalization of that of acceptability. If P is acceptable w.r.t. | | and an interpretation I, which is a model of comp(P ), then P is a-acceptable w.r.t. | | and spec = (I, I). This follows directly from the definitions and from the fact that I |= comp(P ) implies correctness of P w.r.t. (I, I). In a general case, if P is acceptable w.r.t. | | and an interpretation I over a preinterpretation J then P is a-acceptable w.r.t. | | and spec = (I, I \ B), where B is the set of J -atoms of the form p(~t), where p 6∈ N egP∗ . This follows from the definitions and from the fact that I |= P ∪comp(P − ) implies that P is correct w.r.t. (I, I \ B). The latter implication follows from a lemma that for any J -literal L and ′ any natural number n, if L is true in (the 3-valued interpretation) ΦJ P ↑ n then L J ′ is true in (2-valued) I ∪ (I \ B) , where ΦP is the 3-valued immediate consequence operator over J . We skip details of the proof. To show that a-acceptability implies left termination we employ the following theorem, analogous to Theorem 6.7 of (Apt and Pedreschi 1993). In what follows, ΦP denotes the 3-valued immediate consequence operator. A 3-valued Herbrand interpretation is total if any ground atom is either true or false in this interpretation. Theorem 4.16 Assume that the set of function symbols is infinite. Let P be an a-acceptable program w.r.t. | | and spec. Then ΦP ↑ ω is total. Proof (outline) The proof is basically the same as that of (Apt and Pedreschi 1993), however a substantial part of the latter proof is made shorter. The part is entitled Subcase 2 and shows that ΦP ↑ n |=3 ¬Lk̄ , for a literal Lk̄ which is not undefined in ΦP ↑ n and for which I |= ¬Lk̄ (where P is acceptable w.r.t. I). In our case I |= ¬Lk̄ is replaced by specS ∪ specC ′ |= ¬L′k̄ (where spec = (specS, specC)) and the whole Subcase 2 is reduced to the following: an assumption that Lk̄ is true in ΦP ↑ n leads (by Kunen theorem (Kunen 1987; Doets 1994)) to comp(P ) |=3 Lk̄ and, by correctness of P , to specS ∪ specC ′ |= L′k̄ , contradiction. So ΦP ↑ n |=3 ¬Lk̄ . Now we can prove the main result. Theorem 4.17 Assume that the set of function symbols is infinite. Let P be an a-acceptable program w.r.t. | | and spec. Then P is acceptable (w.r.t. | | and some interpretation) and P is left terminating. 14 ∗. Thus if comp(P − ) contains an axiom ¬p(~ x) then p ∈ N egP 28 Wlodzimierz Drabent and Miroslawa Milkowska Proof Let spec = (specS, specC) and P be as in the assumptions of the theorem. By Theorem 4.16 ΦP ↑ ω is total, thus this is the least fixpoint of ΦP , hence ΦP ↑ ω |=3 comp(P ). Let I be the ground atoms true in ΦP ↑ ω, we have I |= comp(P ). Now to show that P is acceptable w.r.t. I and | |, it is sufficient to show that I |= L implies specS ∪ specC ′ |= L′ , for any ground literal L. Consider a ground literal L such that I |= L. This means ΦP ↑ ω |=3 L. Thus ΦP ↑ n |=3 L for some n < ω. Hence comp(P ) |=3 L, by Kunen theorem (Kunen 1987; Doets 1994). So specS ∪ specC ′ |= L′ , by the correctness of P . Example 4.18 To illustrate the method we employ the following program, similar to program GAME of (Apt and Pedreschi 1993). win(X) ← move(X, Y ), ¬win(Y ). move([l|X], X). move([l, l|X], X). move([l, l, l, l|X], X). It models a two person game, in each move a player removes a certain number of tokens, the one who removes the last token wins. Let | | be the function on ground terms such that |f (t1 , . . . , tn )| = 0 if f 6= [ | ] and |[t1 |t]| = |t|+1. Consider a level mapping |win(t)| = |t|+1, |move(t1 , t2 )| = |t1 |, and a Herbrand specification spec = (sSw ∪ sSm , ∅) where sSw = { win(t) | t is a ground term }, sSm = { move(t1 , t2 ) | |t1 | > |t2 | }. The program is obviously correct w.r.t. spec, and it is easy to check that it is a-acceptable. Thus it is left terminating. Notice that the analogical proof in (Apt and Pedreschi 1993) requires providing the unique model I of the program completion. This model is also needed to apply the method of (Pedreschi and Ruggieri 1999) for this program. (More precisely, in order to show termination for goals from a precondition P re, one has to know I ∩ P re; see the discussion of Section 4.3.4.) The proof of (Apt and Pedreschi 1993) considers arbitrary relation move for which the corresponding graph is finite and acyclic. Our proof can be easily adjusted to such case, by replacing function | | above by the function f used in (Apt and Pedreschi 1993) to define the level mapping in the proof.15 Left termination does not imply a-acceptability. But according to Theorem 4.18 of (Apt and Pedreschi 1993) if P is a left terminating, non-floundering program then P is acceptable w.r.t. some level mapping | | and a model I of comp(P ). Thus P is a-acceptable w.r.t. | | and specification spec = (I, I). In this section we generalized the notion of acceptable program, so that in termination proofs one can use approximate specifications instead of unique models. We 15 As function f is defined only for the nodes of the graph, it should be generalized to arbitrary terms. This can be done by assuming f (t) = 0 for any term which is not a node of the graph. Correctness and Completeness of Normal Programs 29 deal with termination of a program for all ground goals. There is another path of generalizing the method of (Apt and Pedreschi 1993) to programs that terminate only for some ground goals (Bossi et al. 1994; Schreye et al. 1992). The approach of (Pedreschi and Ruggieri 1999) belongs to this path. It proves left termination for the goals satisfying the precondition, however — as discussed in Section 4.3.4 — for such goals the specification has to be exact. We expect that some improvements of the method of (Apt and Pedreschi 1993) are also applicable to the method presented here, for instance a weakening of inequalities in case of non-mutually recursive predicates (Apt and Pedreschi 1994; Pedreschi and Ruggieri 1999). 4.4 Completeness of normal programs As the operational semantics for normal programs we assume SLDNF-resolution, as defined by Apt and Doets (1994). To discuss completeness we need to refer to the notion of SLDNF-tree. We outline its definition below, for more details the reader is referred to (Apt and Doets 1994) or (Doets 1994). An SLDNF-tree for query Q and program P is a set of trees, with one of them distinguished as the main tree. The nodes of the trees are queries and the trees are, roughly speaking, SLDNF-trees of (Lloyd 1987). Q is the root of the main tree. Any node with a non-ground negative literal selected is a leaf of a tree, such a node is marked floundered. Whenever a ground negative literal ¬A is selected in a node N then there exists a subsidiary tree with the root A. The whole SLDNF-tree may be viewed as a tree of trees, in which the tree with the node N is the parent of the subsidiary tree with the root A. The leaves of each tree can be marked failed or success, with the expected meaning. So if a leaf N is neither marked failed nor success then a negative literal ¬A is selected in N , moreover A is non-ground or the subsidiary tree for A neither succeeds nor finitely fails. A tree succeeds if it has a success leaf. A tree finitely fails if it is finite and all its leaves are marked failed. The SLDNF-tree succeeds (finitely fails) if the main tree does. To each success leaf of the main tree there corresponds a computed answer substitution θ for Q (and a computed answer Qθ), defined as expected. 4.4.1 Proof method In this section we introduce a method for proving program completeness. Then we briefly discuss completeness of the method and provide a comparison with an operational proof method. Definition 4.19 We say that a program P is complete for a query Q w.r.t. a specification spec = (specS, specC) if (i) specS ∪ specC ′ |= Q′′ implies comp(P ) |=3 Q, (ii) specS ∪ specC ′ |= ¬Q′ implies comp(P ) |=3 ¬Q. 30 Wlodzimierz Drabent and Miroslawa Milkowska Program P is complete w.r.t. spec if it is complete for any query Q.16 We say that a program P is SLDNF-complete for a query Q w.r.t. a specification spec = (specS, specC) if (i) specS ∪ specC ′ |= Q′′ σ implies that some SLDNF-tree for Q succeeds with an answer Qθ more general than Qσ, (ii) specS ∪ specC ′ |= ¬Q′ implies that some SLDNF-tree for Q finitely fails. From the soundness of SLDNF-resolution it follows that SLDNF-completeness implies completeness. For Herbrand specifications completeness implies correctness: Proposition 4.20 If a program P is complete w.r.t. a Herbrand specification spec = (specS, specC) then 1. spec is proper, and 2. P is correct w.r.t. spec. Proof 1. If spec is not proper then there exists a ground atom A ∈ specC \ specS. By Definition 4.19, comp(P ) |=3 A and comp(P ) |=3 ¬A; contradiction. 2. Assume P is not correct w.r.t. spec. So for some query Q we have comp(P ) |=3 Q and specS∪specC ′ 6|= Q′ , or comp(P ) |=3 ¬Q and specS∪specC ′ 6|= ¬Q′′ . In the first case we have specS ∪ specC ′ |= ¬Q′ θ for some ground Qθ and, by Definition 4.19, comp(P ) |=3 ¬Qθ; contradiction. Similarly in the second case, specS ∪ specC ′ |= Q′′ θ and comp(P ) |=3 Qθ; contradiction. To show that the proposition does not hold for non-Herbrand specifications, consider a preinterpretation J , the set S = { t ∈ |J | | t is a value in J of a ground term}, and an element u ∈ |J | \ S. Let I = { p(t) | t ∈ S }. Program { p(X)← } is complete w.r.t. (I, I) and w.r.t. (I, I ∪{p(u)}), the latter specification is not proper. The program is however not correct w.r.t. any of these specifications. We consider completeness w.r.t. non-proper specifications as a rather pathological case. The following theorem gives sufficient conditions for program completeness. Theorem 4.21 (Completeness, normal programs) Assume that the set of function symbols is infinite. Let P be a program, Q a query and spec = (specS, specC) a specification such that 1. P is correct w.r.t. spec, and 2. there exists an SLDNF-tree for Q such that its main tree is finite and all the leaves of the main tree are marked failed or success. Then P is SLDNF-complete and complete for Q w.r.t. spec = (specS, specC). 16 These notions can be expressed in terms of the 4-valued logic by using the fact that spec ∪ 4 (spec) |= Q, and specS ∪ specC ′ |= ¬Q′ is equivalent to specC ′ |= Q′′ is equivalent to IC 4 4 (spec) |= ¬Q. IC 4 Correctness and Completeness of Normal Programs 31 Condition 2. implies that each ¬A selected in the main tree is ground and the subsidiary tree for A succeeds or fails. Notice that the SLDNF-tree may be infinite or contain floundering nodes. However the “important part” of it is finite and without floundering and can be computed under some search strategy in a finite number of steps. (When a success is obtained in a subsidiary tree, traversing this tree can be abandoned.) Remember that the selection rule in the tree is arbitrary, this includes delay mechanisms. If due to delays no literal is selected in a node of the main tree then condition 2. is not satisfied. It is a kind of floundering, the node is a leaf marked neither failed nor success.17 The proof uses the following lemma. Lemma 4.22 Assume that the set of function symbols is infinite. Let t, t1 , . . . , tn be terms such that t is not an instance of any ti . Then there exists an instance of t which is not unifiable with any ti . Proof Let v1 , . . . , vk (k ≥ 0) be the variables of t. Let f1 , . . . , fk be distinct function symbols (of arity ≥ 0) not occurring in t, t1 , . . . , tn and c be a constant. Let ui = fi (c, . . . , c), for i = 1, . . . , k, be terms. Consider a substitution θ = {v1 /u1 , . . . , vk /uk }. Assume that s = tθ is unifiable with some ti . As s is ground, tθ = ti σ for some substitution σ. Terms u1 , . . . , uk occur (as subterms) in σ (since they occur in ti σ). Let us replace each occurrence of term uj in σ by the variable vj , obtaining σ ′ , and remove all the pairs of the form vj /vj from σ ′ , obtaining a substitution σ ′′ . Then t = ti σ ′′ , contradiction with the assumption of the lemma. So s = tθ is not unifiable with any ti . Now we can present a proof of Theorem 4.21. Proof Assume that conditions 1. and 2. hold. Let T be the SLDNF-tree for Q satisfying 2. (i) Let specS∪specC ′ |= ¬Q′ . We show that T finitely fails. Assume that it does not. Then T succeeds with some answer Qθ. By correctness we have specS ∪ specC ′ |= Q′ θ. Contradiction (with specS ∪ specC ′ |= ¬Q′ ). (ii) Let specS ∪ specC ′ |= Q′′ σ. We want to show that T contains an answer more general than Qσ. Assume the contrary. Let Q1 , . . . , Qn (n ≥ 0) be the answers of T, Qσ is not an instance of any of them. By Lemma 4.22, there exists Qσθ which is not unifiable with any of Q1 , . . . , Qn . Consider the SLDNF-tree U for Qσθ under the same selection rule18 as T. The nodes of U are instances of corresponding nodes of T. The main tree of U is finite and all its leaves are marked failed or success. Any answer of U is an instance of some Qi and of Qσθ. So no such answer exists and U finitely fails. Hence specS∪specC ′ |= ¬Q′′ σθ. Contradiction. 17 18 Formally, the tree is not an SLDNF-tree, as a selection rule has to select a literal in every non-empty query. We omit tedious formalization of this notion. 32 Wlodzimierz Drabent and Miroslawa Milkowska We conclude this section by discussing completeness of the method and comparing it with the method of (Pedreschi and Ruggieri 1999). A program P may be complete w.r.t. a specification without satisfying condition 2. of Theorem 4.21 (e.g. a query may succeed but the main tree may be infinite). In such cases the method of proving completeness is inapplicable. However the method is trivially complete for Herbrand specifications and programs which terminate without floundering for the considered queries (formally: satisfy condition 2. of the theorem). This is because completeness w.r.t. a Herbrand specification implies correctness w.r.t. the same specification (Proposition 4.20). Hence condition 1. of Theorem 4.21 holds. The operational proof method for total correctness of Pedreschi and Ruggieri (1999) was discussed in Section 4.3.4. Total correctness includes completeness. From the discussion after Definition 4.13 it follows immediately that the verification condition of that method implies completeness of P (in the sense of Definition 4.19) for ground atomic queries from P re with respect to specification spec = ((H \ P re) ∪ P ost, P re ∩ P ost). It also implies termination for such queries and, by Proposition 4.14, correctness of P w.r.t. spec. Thus the completeness can be shown by our method, as the conditions of Theorem 4.21 hold (for all ground atomic queries which are requested by spec to succeed or fail). Remember however that our approach requires a separate termination proof. This shows that for ground atomic queries the method of this section is stronger than that of (Pedreschi and Ruggieri 1999) (as far as program completeness in the sense of Definition 4.19 is concerned). It is also strictly stronger, as it applies to programs that loop or flounder under Prolog selection rule, but do not under some other one.19 4.4.2 Example completeness proof Let us illustrate our method of proving completeness of normal programs by applying it to a program defining the subset relation with an additional requirement that a subset must be a list without repetitions. The example is rather lengthy, as our intention was to present a detailed proof. Example 4.23 Let P be the following program: subs([ ], L) ← subs([H|T ], LH) ← select(H, LH, L), subs(T, L), ¬member(H, T ) select(H, [H|L], L) ← select(H, [X|L], [X|LH]) ← select(H, L, LH) The definition and specification of member are the same as in Example 4.7. A 19 A wider class of queries is dealt with by Theorem 5.10 of (Pedreschi and Ruggieri 1999). It provides a criterion implying condition (i) of Definition 4.19 of completeness. Also in this case the criterion implies that a completeness proof by our method exists. Correctness and Completeness of Normal Programs 33 Herbrand specification for P is spec = (specS, specC), where specS = sSm ∪ sSsel ∪ sSsubs , sSsel sCsel sSsubs sCsubs specC = sCm ∪ sCsel ∪ sCsubs = {select(e, l, m) | l is a list → e ∈ l ∧ m is a list ∧ l ≈ [e|m]} = {select(e, l, m) | l and m are lists such that l = [e1 , . . . , ei , e, ei+1 , . . . ek ], m = [e1 , . . . , ei , ei+1 , . . . ek ], 0 ≤ i ≤ k} = {subs(l, m) | m is a list → listd(l) ∧ l ⊆ m} = {subs(l, m) | m is a list ∧ listd(l) ∧ l ⊆ m} Here l ≈ m means that lists l and m contain the same elements and listd(l) means that l is a list with distinct elements. Let spSC = specS ∪ specC ′ . To prove condition (a) for the second clause of predicate subs/2, assume that spSC |= select(h, lh, l) ∧ subs(t, l) ∧ ¬member′ (h, t). (A) We show that subs([h|t], lh) ∈ sSsubs . So let lh be a list. From (A) it follows that: (1) select(h, lh, l) ∈ sSsel hence h ∈ lh and l is a list such that lh ≈ [h|l]; (2) subs(t, l) ∈ sSsubs hence listd(t) and t ⊆ l, thus [h|t] ⊆ lh, by (1); (3) member(h, t) 6∈ sCm hence h 6∈ t (since t is a list), thus listd([h|t]), by (2). We obtain [h|t] ⊆ lh and listd([h|t]), this completes the proof of condition (a) for the most complex clause of P . Let us now prove condition (b) for predicate subs/2. We show that spSC ∪ spec= |= subs′ (S, M ) → S = [ ] ∨ ∃H, T, L (S = [H|T ] ∧ select′ (H, M, L) ∧ subs′ (T, L) ∧ ¬member(H, T )). Let s, m be elements of the universe such that spSC |= subs′ (s, m), i.e. subs(s, m) ∈ sCsubs . So m is a list, s is a list of distinct elements and s ⊆ m. The case of s = [ ] is obvious. Otherwise s = [h|t]. Since h ∈ s and s ⊆ m, m = [m1 , . . . , mi−1 , h, mi+1 , . . . , mk ]. Take [m1 , . . . , mi−1 , mi+1 , . . . , mk ] as l. Obviously select(h, m, l) ∈ sCsel . From listd([h|t]) we have listd(t) and h 6∈ t. Thus member(h, t) 6∈ sSm . Also subs(t, l) ∈ sCsubs , as [h|t] ⊆ m. Thus the right hand side of the implication holds. The remaining part of the proof of conditions (a), (b) is easier and is skipped here. It follows that P is correct w.r.t. spec. Consider a query Q = subs(L, M ), where L is a variable and M a ground list. Once it is shown that for such queries P terminates without floundering (under some selection rule and search strategy), it follows that P is complete for such queries. This means that for a given set all its subsets will be computed (i.e. all the permutations of the corresponding lists). Assume that we do not have a termination proof and request all answers to a query Q from an interpreter with run-time checks for floundering. Then if the execution terminates, we know that all the answers for Q required by the specification have been produced. This happens in the case of our example program P and Prolog. ✷ 34 Wlodzimierz Drabent and Miroslawa Milkowska 4.5 Example In this section we illustrate our method of proving correctness and completeness of normal programs by a larger example. We have chosen a program calculating the transitive closure of a given relation and its toy application to searching airway connections satisfying given requirements. Transitive closure is used as an example in many papers on proving program properties, e.g. (Apt 1995; Ferrand and Deransart 1993; Malfon 1994). For our example we choose rather arbitrary approximate specifications. The purpose is to illustrate how just some of a program’s properties can be proven. We also show how the method applies in case of extending a program by adding new predicates. Information about the flights is given by predicate direct/3; direct (from, to, flight (time, price)) denotes that there exists a direct flight from from to to, time of the flight is equal to time and its cost is price. We assume that time and price are natural numbers. Let FLIGHTS be the following program: good conn(X , Y , Req) ← connect (X , Y , Dxy), satisfies(Dxy, Req) connect (X , Y , Dxy) ← connect (X , Y , Dxy, [X ]) connect (X , Y , [D ], V ) ← direct (X , Y , D ) connect (X , Z , [D |Dyz ], V ) ← direct (X , Y , D ), ¬member (Y , V ), connect (Y , Z , Dyz , [Y |V ]) % satisfies(ListOfFlightsInfo, Requirements), where % Requirements = req(MaxNoOfTransfers, MaxTotalCost , MaxFlightTime) satisfies(List , req(MaxTr , MaxTotalCost , MaxFlightTime)) ← analyze(List , NoOfTransfers, TotalCost , MaxFlightTime), lesseq(NoOfTransfers, MaxTr ), lesseq(TotalCost , MaxTotalCost ) % analyze(ListOfFlightsInfo, NumberOfTransfers, Cost , MaxFlightTime) analyze([ ], −1, 0, MaxFlightTime) ← analyze([flight (Time, Price)|List ], NoOfTransfers, Cost ,MaxFlightTime) ← lesseq(Time, MaxFlightTime), analyze(List , NoOfTrL, ListCost , MaxFlightTime), add (ListCost , Price, Cost ), add (NoOfTrL, 1 , NoOfTransfers) We omit here the definition of direct/3 and definitions of (built-in) predicates lesseq/2 and add/3. The definition of member/2 is the same as in the previous examples. Predicate direct/3 defines a directed graph: direct (x , y, info) means that there is an edge from x to y labelled by info. We assume that there is no loop, i.e. an Correctness and Completeness of Normal Programs 35 edge (direct flight) from x to x. Following (Ross and Wright 2003) by a path we will understand a non-empty sequence of edges satisfying standard condition: the terminal vertex of each edge is the initial vertex of the next. A cycle is a path (x1 , x2 ), . . . , (xn , x1 ), n ≥ 1, such that x1 , . . . , xn are distinct vertices. A graph that contains no cycle is called acyclic. A path is acyclic if the graph consisting of the vertices and edges of the path is acyclic. We begin with proving correctness and completeness of FLIGHTS with respect to the specification such that its first part (specS) is constructed from the following sets of ground atoms (which may be called predicate specifications). Let G denote the labelled graph defined by direct/3, and N , Z the sets of natural and integer numbers, respectively. conn = { good conn(x, y, req(k, c, t)) | there exists in G a path from x to y such that the total cost of the connection does not exceed c, c ∈ N } specSconnect/3 = { connect(x, y, d) | there exists in G a path from x to y and d is the sequence (list) of its edge labels } specSconnect/4 = { connect(x, y, d, v) | connect(x, y, d) ∈ specSconnect/3 } specSsatisfies = { satisfies(list, req(maxT rans, maxCost, maxT ime)) | list is a list of elements of the form f light(ti , pi ) such that the total sum of pi ’s does not exceed maxCost, pi , maxCost ∈ Z } specSanalyze = { analyze(list, noT rans, totalCost, maxF lightT ime) | list is a list of elements of the form f light(ti , pi ), such that the total sum of pi ’s is equal to totalCost, pi , totalCost ∈ Z } specSdirect = { direct(x, y, f light(t, p)) | there exists an edge in G (a direct flight) from x to y labelled f light(t, p), t, p ∈ N } specSlesseq = { lesseq(X, Y ) | x ≤ y, specSadd = { add(x, y, z) | x + y = z, specSmember = { member(x, l) | l is a list → x ∈ l } specSgood x, y ∈ Z } x, y, z ∈ Z } Let us notice that specSdirect , specSlesseq and specSadd are exact specifications. The remaining ones are approximate: they allow cyclic paths and abstract from the number of transfers and the flight times, and from the form of the last argument of connect/4; the approximate specification of member is taken from previous examples. The second part of specification (specC) is constructed from the following sets 36 Wlodzimierz Drabent and Miroslawa Milkowska of ground atoms: specCgood conn = { good conn(x, y, req(k, c, t)) | there exists in G an acyclic path from x to y denoting a connection such that: the number of transfers does not exceed k, its total cost does not exceed c, the time of each flight does not exceed t, k, c, t ∈ N } specCconnect/3 = { connect(x, y, d) | there exists in G an acyclic path from x to y such that d is the sequence (list) of its edge labels } specCconnect/4 = { connect(x, y, d, v) | there exists in G an acyclic path from x to y, d is the sequence (list) of its edge labels and v is a list containing no internal node of the path } specCsatisfies = { satisfies(list, req(maxT rans, maxCost, maxT ime)) | list is a non-empty list of elements of the form f light(ti , pi ), the length of list does not exceed maxT rans + 1, the total sum of pi ’s does not exceed maxCost, each ti does not exceed maxT ime, maxT rans, maxCost, maxT ime, ti , pi ∈ N } specCanalyze = { analyze(list, noT rans, totalCost, maxT ime) | list is a list of elements of the form f light(ti , pi ) such that: the length of list is equal to noT rans + 1, the total sum of pi ’s is equal to totalCost, each ti does not exceed maxT ime, noT rans ∈ Z, totalCost, maxT ime, ti , pi ∈ N } specCdirect = specSdirect specClesseq = specSlesseq specCadd = specSadd specCmember = { member(x, l) | l is a list ∧ x ∈ l } Specifications specCconnect/3 and specCconnect/4 are approximate, as they include only acyclic paths while the program also finds paths being concatenation of an acyclic path from x to y with a cycle from y to y (furthermore they require the fourth argument of connect to be a list). Specifications specCsatisfies , specCanalyze and specCmember are also approximate (as some numbers are required to be in N , the last argument of analyze may be not a number, the last argument of member not a list, etc.). The remaining specifications above are exact. Notice that in the description of specCgood conn the expression “an acyclic path” may be replaced by “a path”, as each path with the described properties can be transformed into an acyclic path with these properties by removing the cycles. Correctness and Completeness of Normal Programs 37 Consider Herbrand specification spec = (specS, specC), where specS = specSdirect ∪ specSgood conn ∪ specSconnect/3 ∪ specSconnect/4 ∪ specSsatisfies ∪ specSanalyze ∪ specSlesseq ∪ specSadd ∪ specSmember specC = specCdirect ∪ specCgood conn ∪ specCconnect/3 ∪ specCconnect/4 ∪ specCsatisfies ∪ specCanalyze ∪ specClesseq ∪ specCadd ∪ specCmember We would like to prove that FLIGHTS is correct with respect to the above specification spec. Thus we have to show that conditions (a) and (b) of Theorem 4.6 are satisfied. To prove condition (a) for predicate good conn we have to show that: specS |= good conn(X, Y, R) ← connect(X, Y, D) ∧ satisfies(D, R) Let x, y, d, r be ground terms such that specSconnect/3 |= connect(x, y, d) and specSsatisfies |= satisfies(d, r). This means that there exists in G a path from x to y and d is the sequence of its edge labels, so d is a non-empty list of elements of the form f light(t, p). Moreover r is of the form req(k, c, t) and the sum of all p’s does not exceed c. Hence specSgood conn |= good conn(x, y, r). To prove condition (b) for predicate good conn we have to show that: specC |= good conn(X, Y, R) → ∃D (connect(X, Y, D) ∧ satisf ies(D, R)) For predicates connect/3 and connect/4 we have to prove the following implications: specS |= connect(X, Y, Dxy) ← connect(X, Y, Dxy, [X]) specC |= connect(X, Y, Dxy) → connect(X, Y, Dxy, [X]) specS |= connect(X, Y, [D], V ) ← direct(X, Y, D) specS ∪ specC ′ |= connect(X, Z, [D|Dyz], V ) ← direct(X, Y, D) ∧ ¬member′ (Y, V ) ∧ connect(Y, Z, Dyz, [Y |V ]) ′ specS ∪ specC ∪ spec= |= connect′ (X, Z, L, V ) → (∃D L = [D] ∧ direct′ (X, Z, D)) ∨ (∃Y ∃D ∃Dyz L = [D|Dyz] ∧ direct′ (X, Y, D) ∧ ¬member(Y, V ) ∧ connect′ (Y, Z, Dyz, [Y |V ])) Let us prove the last implication. Assume that specCconnect/4 |= connect(x, z, l, v). It means that (in G) there exists an acyclic path from x to z and l is the list of its edge labels. If l consists of exactly one edge it must be an edge from x to z (labelled d), thus there is a direct flight from x to z. So the following holds: l = [d] and specC |= direct(x, z, d). Let l consists of more than one element. So l = [d1 , d2 , . . . , dk ], where k > 1 and di is a label of the i-th edge of the path from x to z. The first edge of that path goes from x to a node y, let d be its label (d = d1 ) and let dyz = [d2 , . . . , dk ]. So the following holds: l = [d|dyz] and specC |= direct(x, y, d). From specCconnect/4 |= connect(x, z, l, v) it also follows that v is a list such that y 6∈ v, so specSmember |= ¬member(y, v). To complete this proof we have to show that specC |= connect(y, z, dyz, [y|v]). We already know that there exists an acyclic path from y to z (a subpath of the path from x to z), dyz is the list of edge labels of that (sub)path and v is a list such that each internal node 38 Wlodzimierz Drabent and Miroslawa Milkowska of the path from x to z is not its element. It remains to show that also y is not an internal node of the subpath from y to z, but this follows immediately from the assumption on the acyclicity of the entire path from x to y. This ends the proof of that implication. We leave to the reader the details of proofs of the remaining implications, as well as proofs of conditions (a) and (b) for the remaining predicates. It follows that FLIGHTS is correct w.r.t. spec. Thus we know that if good conn(x, y, req(k, c, t)) is a computed answer then there exists a connection from x to y and its cost is not greater than c. Moreover if a query good conn(x, y, req(k, c, t)) fails then we know that specCgood conn |= ¬good conn(x, y, req(k, c, t)) and there does not exist a connection fulfilling the requirements on the number of transfers, cost and maximal flight time. From Theorem 4.21 (on proving completeness) it follows, for instance, that if a query good conn(x, Y, req(k, c, t)) (where Y is a variable) terminates without floundering then all places (vertices) y are found such that there exists a connection from x to y satisfying the requirements (i.e. specCgood conn |= good conn(x, y, req(k, c, t))). Let us extend FLIGHTS by adding a new predicate bad conn defined as follows: bad conn(X, Y, Req) ← ¬good conn(X, Y, Req) Let specn = (specSn, specCn), where specSn = specS ∪ specSbad specSbad conn specCbad conn conn specCn = specC ∪ specCbad conn = { bad conn(x, y, r) | if r = req(k, c, t) and k, c, t ∈ N then there does not exist in G a path from x to y denoting a connection such that: the number of transfers does not exceed k, its total cost does not exceed c, the time of each flight does not exceed t } = { bad conn(x, y, r) | there does not exist in G a path from x to y } Notice that specSbad conn and specCbad conn also contain atoms of the form bad conn(x, y, r) where x or y is not a vertex of the graph. As explained previously, in the description of specSbad conn “a path” may be replaced by “an acyclic path”. Specification specSbad conn is exact and specCbad conn is approximate. We have to prove the following new implications concerning predicate bad conn: specSbad conn ∪ specCgood specCbad conn ∪ specSgood conn conn |= bad conn(X, Y, R) ← ¬good conn(X, Y, R) |= bad conn(X, Y, R) → ¬good conn(X, Y, R) As before we leave the details of the proofs to the reader. The rest of implications remains the same, and hence previous proofs remain valid. Thus the extended program is correct w.r.t. the specification specn. So if bad conn(x, y, r) is a computed answer then there does not exist a connection from x to y satisfying r. After having proved that the program terminates and does not flounder for ground queries of the form bad conn(x, y, r), we will also know that Correctness and Completeness of Normal Programs 39 the program is complete for such queries w.r.t. specn. Hence bad conn(x, y, r) will succeed for any x, y such that there does not exist a connection from x to y. To end with, suppose we are interested just in direct connections and choose the following (approximate) specification: specCnbad conn = { bad conn(x, y, req(0, c, t)) | there does not exist in G an edge from x to y labelled f light(s, p) such that p ≤ c, c, t, p, s ∈ N } This specification refers to the number of transfers (more precisely, to connections without transfers) whereas the specification specS abstracted from this. In order to prove correctness of the extended program w.r.t. a specification containing specCngood conn instead of specCgood conn , we have to strengthen specS (modifying specSgood conn , specSsatisfies and specSanalyze ) and prove again the corresponding conditions. For example a new specification for predicate good conn/3 could be: specSngood conn = { good conn(x, y, req(k, c, t)) | there exists in G a path from x to y of length not greater than k + 1, the total cost of the connection does not exceed c, k, c ∈ N } Specifications specSsatisfies and specSanalyze should be strengthened analogously (by taking into account the total length of the list and the fact that if the costs in the connection list are in N then the total cost is in N ) and the proof should be accordingly modified. Every (logic) programmer should have, at least in her mind, intended meaning for all the used predicates. Specification spec = hspecS, specCi is a formalization of such intended meaning. It is important that in most cases the specification is approximate (specS 6= specC); specifying exactly the meaning of the program is usually too cumbersome and unnecessary. We believe that the methods advocated in this paper are a formalization of informal reasoning performed by a competent programmer to convince herself about correctness of a program. 5 Related work In this section we present a brief overview of related work. Due to our approach to specifications, we do not need any explicit notion of precondition, type information, or domain of a procedure. Such notions are used in most other approaches (Bossi and Cocco 1989; Apt 1997; Pedreschi and Ruggieri 1999; Deville 1990) in order to deal with “ill-typed” atoms, for which the behaviour of the program is of no interest. For similar purposes Naish (2000) introduces a 3-valued approach to definite programs. An approach related to ours is the annotation method of Deransart (Deransart 1993, Section 4; Boye and Maluszyński 1997, Section 4) for proving definite program correctness. It can be seen as refinement of the natural method of Section 3.1, where one proves more (but smaller) implications than those to be proved in the natural method. A method for proving completeness of definite programs, similar to ours, was 40 Wlodzimierz Drabent and Miroslawa Milkowska presented in (Deransart and Maluszyński 1993). Both approaches are compared in Section 3.3. Comparison with the operational method (Bossi and Cocco 1989; Apt 1997; Pedreschi and Ruggieri 1999) for correctness of definite programs is given in Section 3.2. The operational method can be generalized to correctness of normal programs (Apt 1995; Pedreschi and Ruggieri 1999); we present a comparison in Section 4.3.4. We show that the correctness proving approaches presented in this paper are stronger than the corresponding operational ones (as far as properties of program answers are concerned); moreover our approach for normal programs is strictly stronger. The method of (Pedreschi and Ruggieri 1999) includes proving completeness of normal programs. In Section 4.4.1 we show that it is strictly weaker than the method of Theorem 4.21. Also, the methods presented in this paper are, in our opinion, simpler than the operational ones. In particular, in the approach of (Pedreschi and Ruggieri 1999) one has to prove correctness, completeness and termination together. Due to this one cannot use approximate specifications. The comparisons formally show that it is not necessary to refer to operational semantics in reasoning about declarative properties of programs. Naish (1996) presents a similar opinion; he advocates a declarative view for a class of program properties which are often treated as operational. A related early work is (Deville 1990). It presents a method to develop Prolog programs. Their correctness and completeness follows from construction. However the construction process consists of many stages and is rather complicated. Our approach to normal programs considers their 3-valued semantics, in contrast to (Deville 1990; Apt 1995; Pedreschi and Ruggieri 1999) where 2-valued semantics is used. The 3-valued completion semantics more precisely corresponds to the operational semantics mainly used in practice (negation as finite failure and SLDNFresolution). Introducing 3-valued semantics does not result in any difficulties: our proof methods use only the standard 2-valued logic. An important approach to proving properties of normal programs was proposed by Stärk (1997). It deals with normal programs, executed under Prolog selection rule. Success, failure and termination are described by an inductive theory, called the inductive extension of a program. The theory can be seen as a refinement of the notion of program completion. The program’s properties of interest are expressed as formulae and one has to prove that they are consequences of the theory. This is opposite to our approach where properties are expressed as specifications and appear to the left of |=, while a program (or a theory similar to program completion) appears to the right of |=. Some properties, like “for any k there exists l such that P |= p(k, l)”, are expressible in the approach of (Stärk 1997) but cannot be expressed as interpretations in our approach. To deal with such properties we need to use specifications which are theories, not interpretations; we expect that our approach is also applicable to such specifications. The approach of (Stärk 1997) includes clean termination and is equipped with a tool to mechanically verify the proofs. It is however bound to Prolog selection rule. The involved induction scheme is rather complicated; the scheme seems difficult Correctness and Completeness of Normal Programs 41 to use without computer support. The purpose of our work is different: we are interested in the declarative semantics and in basic methods, which can be widely understood by programmers and used – possibly in an informal form – in practical reasoning about actual programs. Ferrand and Deransart (1993) presented a method of proving correctness of normal programs. (Their terminology is different; what they call “partial completeness” is, in our terminology, correctness for negative atomic queries.) In contrast to our work they deal with the well-founded semantics (van Gelder et al. 1991). Their specifications are thus Herbrand interpretations. The validation conditions of their method consist of conditions equivalent to those of Theorem 4.6, and of additional requirement involving existence of a certain well-founded ordering of atoms. Malfon (1994) presented methods of proving program completeness for three kinds of semantics, given by the well-founded model, the least fixpoint of ΦP , and by ΦP ↑ ω. (Notice that the latter is not the Kunen semantics considered in this paper.) Similarly to the previous case, the proposed sufficient conditions for completeness are (equivalent to) the conjunction of our conditions for correctness and a condition involving a well-founded ordering. The latter depends on the considered semantics. 6 Conclusions This paper advocates declarative reasoning about logic programs. We show how to prove correctness and completeness of definite and normal logic programs in a declarative way, independently from any operational semantics. This makes it possible to separate reasoning about “logic” from reasoning about “control”. The method for proving correctness of definite programs is not new, however its usefulness has not been appreciated. The methods for completeness and for correctness of normal programs are a contribution of this work. We refer to two specifications; one for correctness and one for completeness. This makes it possible to specify the program semantics approximately, thus simplifying the specifications and the proofs. In this paper specifications are interpretations, but the approach seems applicable to specifications being theories. The semantics of normal programs is 3-valued. We do not however explicitly refer to 3-valued logic. Instead, a pair of 2-valued specifications plays a role of a 4-valued specification for correctness and a 3-valued specification for completeness. Also, we use a 2-valued characterization of the 3-valued completion semantics, which may be of separate interest. Approximate specifications are convenient not only when one deals with program correctness and completeness. We show how approximate specifications can be used to generalize and simplify the proof method of (Apt and Pedreschi 1993) for termination of normal programs. Some authors suggest referring to operational semantics, in particular to the form of call patterns under LD- (LDNF-) resolution, when reasoning about correctness. We claim that our approach is simpler. We show formally that whatever can be proved using the operational approach, can be proved in the approach advocated 42 Wlodzimierz Drabent and Miroslawa Milkowska here (as far as properties of program answers are concerned). For normal programs our approach is strictly stronger, for definite programs the two approaches are equivalent. The operational methods additionally prove some properties of the operational semantics, which are outside of the scope of our approach. Obviously, when such properties are of interest, operational methods are indispensable. Their importance should not be neglected. But as long as we are interested in properties of computed answers (correctness and completeness), and not in some details of computations (like call patterns), the declarative approach is sufficient. Termination is an important operational property, which in contrast to correctness and completeness depends on the selection rule. But even for termination most approaches, like the method of (Apt and Pedreschi 1993), do not explicitly refer to call patterns (except for the initial query). If it were necessary to resort to operational semantics in order to prove basic program properties then logic programming would not deserve to be called a declarative programming paradigm. This work shows that this is not the case. We believe that the presented proof methods are simple and natural. We claim that they are a formalization of a style of thinking in which a competent logic programmer reasons (or should reason) about her programs. We believe that these methods, possibly treated informally, are a valuable tool for actual everyday reasoning about real programs. We believe that they should be used in teaching logic programming. Acknowledgement The first author was partly supported by the European Commission within the 6th Framework Programme project REWERSE (http://rewerse.net). References Apt, K. and Pedreschi, D. 1993. Reasoning about termination of pure Prolog programs. Information and Computation 106, 1, 109–157. Apt, K. R. 1995. Program verification and Prolog. In Specification and Validation Methods for Programming Languages and Systems, E. Börger, Ed. Oxford University Press, 55–95. Apt, K. R. 1997. From Logic Programming to Prolog. International Series in Computer Science. Prentice-Hall. Apt, K. R. and Doets, K. 1994. A new definition of SLDNF-resolution. Journal of Logic Programming 18, 2, 177–190. Apt, K. R., Gabbrielli, M., and Pedreschi, D. 1996. A closer look at declarative interpretations. Journal of Logic Programming 28, 2, 147–180. Apt, K. R. and Pedreschi, D. 1994. Modular termination proofs for logic and pure Prolog programs. In Advances in Logic Programming Theory. Oxford University Press. Bossi, A. and Cocco, N. 1989. Verifying correctness of logic programs. In Proceedings of TAPSOFT ’89, vol. 2. Springer-Verlag, 96–110. LNCS 352. Bossi, A., Cocco, N., and Fabris, M. 1994. Norms on terms and their use in proving universal termination of a logic program. Theoretical Computer Science 124, 2, 297–328. Bossi, A., Gabbrielli, M., Levi, G., and Martelli, M. 1994. The S-semantics approach: Theory and applications. Journal of Logic Programming 19/20, 149–197. Correctness and Completeness of Normal Programs 43 Boye, J. and Maluszyński, J. 1997. Directional types and the annotation method. Journal of Logic Programming 33, 3, 179–220. Clark, K. L. 1979. Predicate logic as computational formalism. Tech. Rep. Technical Report 79/59, Imperial College, London. December. Courcelle, B. and Deransart, P. 1988. Proofs of partial correctness for attribute grammars with application to recursive procedures and logic programming. Information and Computation 78, 1, 1–55. de Boer, F. et al. 1997. Proving concurrent constraint programs correct. ACM TOPLAS 19, 5, 685–725. Deransart, P. 1993. Proof methods of declarative properties of definite programs. Theoretical Computer Science 118, 99–166. Deransart, P. and Maluszyński, J. 1993. A Grammatical View of Logic Programming. The MIT Press. Deville, Y. 1990. Logic Programming: Systematic Program Development. AddisonWesley. Doets, K. 1994. From Logic to Logic Programming. The MIT Press, Cambridge, MA. Drabent, W. 1995. What is failure? An approach to constructive negation. Acta Informatica 32, 1, 27–59. Drabent, W. 1996. Completeness of SLDNF-resolution for non-floundering queries. Journal of Logic Programming 27, 2, 89–106. Drabent, W. and Maluszyński, J. 1988. Inductive assertion method for logic programs. Theoretical Computer Science 59, 133–155. Drabent, W. and Martelli, M. 1991. Strict completion of logic programs. New Generation Computing 9, 69–79. Drabent, W. and Milkowska, M. 2001. Proving correctness and completeness of normal programs — a declarative approach. In Logic Programming, 17th International Conference, ICLP 2001, Proceedings, P. Codognet, Ed. LNCS, vol. 2237. Springer-Verlag, 284–299. Ferrand, G. and Deransart, P. 1993. Proof method of partial correctness and weak completeness for normal logic programs. Journal of Logic Programming 17, 2-4, 265– 278. Fitting, M. 1991. Bilattices and the semantics of logic programming. Journal of Logic Programming 11, 91–116. Hogger, C. J. 1981. Derivation of logic programs. J. of ACM 28, 2, 372–392. Kunen, K. 1987. Negation in logic programming. Journal of Logic Programming 4, 4, 289–308. Lloyd, J. W. 1987. Foundations of Logic Programming, 2nd ed. Springer-Verlag. Malfon, B. 1994. Characterization of some semantics for logic programs with negation and application to program validation. In Proceedings of the 1994 International Logic Programming Symposium, M. Bruynooghe, Ed. MIT Press, 91–105. Mancarella, P. et al. 1990. Algebraic properties of a class of logic programs. In Proceedings of the 1990 North American Conference, S. Debray and M. Hermenegildo, Eds. MIT Press, 923–39. Naish, L. 1992. Types and the intended meaning of logic programs. In Types in Logic Programming. The MIT Press, 189–216. Naish, L. 1996. A declarative view of modes. In Proceedings of JICSLP’96. MIT Press, 185–199. Naish, L. 2000. A three-valued semantics for Horn clause programs. Australian Computer Science Communications 22, 1 (Jan.), 174–180. 44 Wlodzimierz Drabent and Miroslawa Milkowska Pedreschi, D. and Ruggieri, S. 1999. Verification of logic programs. Journal of Logic Programming 39, 1-3, 125–176. Ross, K. A. and Wright, C. R. B. 2003. Discrete Mathematics, 5th ed. Prentice Hall. Schreye, D. D., Verschaetse, K., and Bruynooghe, M. 1992. A framework for analysing the termination of definite logic programs with respect to call patterns. In Proc. FGCS’92, International Conference on Fifth Generation Computer Systems, H. Tanaka, Ed. ICOT Tokyo, ICOT, 481–488. Stärk, R. F. 1996. From logic programs to inductive definitions. In Logic: From Foundations to Applications, European Logic Colloquium’93, W. A. Hodges et al., Eds. Clarendon Press, Oxford, 453–481. Stärk, R. F. 1997. Formal verification of logic programs: Foundations and implementation. In Logical Foundations of Computer Science LFCS ’97 — Logic at Yaroslavl. Springer-Verlag, 354–368. LNCS 1234. van Gelder, A., Ross, K., and Schlipf, J. 1991. The well-founded semantics for general logic programs. Journal of the ACM 38, 3, 620–650.
2cs.AI
VANISHING IDEALS OVER FINITE FIELDS arXiv:1502.05451v2 [math.AC] 19 Jun 2016 AZUCENA TOCHIMANI AND RAFAEL H. VILLARREAL Abstract. Let Fq be a finite field, let X be a subset of a projective space Ps−1 , over the field Fq , parameterized by rational functions, and let I(X) be the vanishing ideal of X. The main result of this paper is a formula for I(X) that will allows us to compute: (i) the algebraic invariants of I(X), and (ii) the basic parameters of the corresponding Reed-Muller-type code. 1. Introduction In this paper we study vanishing ideals of sets in projective spaces parameterized by rational functions over finite fields. Let R = K[y] = K[y1 , . . . , yn ] be a polynomial ring over a finite field K = Fq and let F be a finite set {f1 /g1 , . . . , fs /gs } of rational functions in K(y), the quotient field of R, where fi (resp. gi ) is in R (resp. R \ {0}) for all i. As usual we denote the affine and projective spaces over the field K by As and Ps−1 , respectively. Points of the projective space Ps−1 are denoted by [α], where 0 6= α ∈ K s . The projective set parameterized F , denoted by X, is the set of all points [(f1 (x)/g1 (x), . . . , fs (x)/gs (x))] in Ps−1 that are well defined, i.e., x ∈ K n , fi (x) 6= 0 for some i, and gi (x) 6= 0 for all i. Let S = K[t1 , . . . , ts ] = ⊕∞ d=0 Sd be a polynomial ring over the field K with the standard grading. The graded ideal I(X) generated by the homogeneous polynomials of S that vanish at all points of X is called the vanishing ideal of X. There are good reasons to study vanishing ideals over finite fields. They are used in algebraic geometry [6] and algebraic coding theory [3]. They are also used in polynomial interpolation problems [12]. We come to our main result. Theorem 3.8 Let B = K[y0 , y1 , . . . , yn , z, t1 , . . . , ts ] be a polynomial ring over K = Fq . If X is a projective set parameterized by rational functions f1 /g1 , . . . , fs /gs in K(y), then I(X) = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1) ∩ S. Using the computer algebra system Macaulay2 [4], this result can be used to compute the degree, regularity, and Hilbert polynomial of I(X) (see Example 3.17). By the algebraic methods introduced in [11] (see Section 2), this result can also be used to compute the basic parameters (length, dimension, minimum distance) of the corresponding projective Reed-Muller-type code over X (see Example 3.18). For all unexplained terminology and additional information, we refer to [2, 6, 8] (for algebraic geometry and computational commutative algebra) and [13] (for coding theory). 2000 Mathematics Subject Classification. Primary 13P25; Secondary 14G50, 11T71, 94B27. The first author was partially supported by CONACyT. The second author was partially supported by SNI. 1 2 AZUCENA TOCHIMANI AND RAFAEL H. VILLARREAL 2. Preliminaries All results of this section are well-known. To avoid repetitions, we continue to employ the notations and definitions used in Section 1. If d ∈ N, let Sd denote the set of homogeneous polynomials of degree d in S, together with the zero polynomial. Thus Sd is a K-linear space and S = ⊕∞ d=0 Sd . Definition 2.1. An ideal I ⊂ S is graded if I is generated by homogeneous polynomials. Proposition 2.2. [10, p. 92] Let I ⊂ S be an ideal. The following conditions are equivalent: (g1 ) I is a graded ideal. P (g2 ) If f = rd=0 fd is in I, fd ∈ Sd for d = 0, . . . , r, then each fd is in I. Let I be a graded ideal of S of dimension k. As usual, by the dimension of I we mean the Krull dimension of S/I. The Hilbert function of S/I is the function HI : N → N given by HI (d) = dimK (Sd /Id ), where Id = I ∩ Sd . There is a unique polynomial hI (x) ∈ Q[x] of degree k − 1 such that hI (d) = HI (d) for d ≫ 0 [5, p. 330]. By convention, the zero polynomial has degree −1. The degree or multiplicity of S/I is the positive integer ( (k − 1)! lim HI (d)/dk−1 if k ≥ 1, d→∞ deg(S/I) := dimK (S/I) if k = 0. Definition 2.3. The regularity of the Hilbert function of S/I, or simply the regularity of S/I, denoted reg(S/I), is the least integer r ≥ 0 such that HI (d) is equal to hI (d) for d ≥ r. We will use the following multi-index notation: for a = (a1 , . . . , as ) ∈ Zs , set ta = ta11 · · · tas s . We call ta a Laurent monomial. If ai ≥ 0 for all i, ta is a monomial of S. An ideal of S generated by polynomials of the form ta − tb , with a, b in Ns , is called a binomial ideal of S. Lemma 2.4. [14, p. 321] Let B = K[y1 , . . . , yn , t1 , . . . , ts ] be a polynomial ring over a field K. If I is a binomial ideal of B, then the reduced Gröbner basis of I with respect to any term order consists of binomials and I ∩ K[t1 , . . . , ts ] is a binomial ideal of S. Proposition 2.5. [7, pp. 136–137] Let K = Fq be a finite field and let As be the affine space of dimension s over K. Then I(As ) = ({tqi − ti }si=1 ). Projective Reed-Muller-type codes. In this part we introduce the family of projective ReedMuller-type codes and its connection to vanishing ideals and Hilbert functions. Let K = Fq be a finite field and let Y = {P1 , . . . , Pm } = 6 ∅ be a subset of Ps−1 with m = |Y|. Fix a degree d ≥ 1. For each i there is fi ∈ Sd such that fi (Pi ) 6= 0. There is a well-defined K-linear map:   f (P1 ) f (Pm ) |Y| (2.1) evd : Sd = K[t1 , . . . , ts ]d → K , f 7→ ,..., . f1 (P1 ) fm (Pm ) The image of Sd under evd , denoted by CY (d), is called a projective Reed-Muller-type code of degree d over the set Y [3]. There is an isomorphism of K-vector spaces Sd /I(Y)d ≃ CY (d). It is usual to denote the Hilbert function S/I(Y) by HY . Thus HY (d) is equal to dimK CY (d). The minimum distance of the linear code CY (d), denoted δY (d), is given by δY (d) := min{ω(v) : 0 6= v ∈ CY (d)}, VANISHING IDEALS 3 where ω(v) is the Hamming weight of v, that is, ω(v) is the number of non-zero entries of v. Definition 2.6. The basic parameters of the linear code CY (d) are: its length |Y|, dimension dimK CY (d), and minimum distance δY (d). The following summarizes the well-known relation between projective Reed-Muller-type codes and the theory of Hilbert functions. Proposition 2.7. ([3], [11]) The following hold. (i) HY (d) = dimK CY (d) for d ≥ 0. (ii) deg(S/I(Y)) = |Y|. (iii) δY (d) = 1 for d ≥ reg(S/I(Y)). 3. Rational parameterizations over finite fields We continue to employ the notations and definitions used in Sections 1 and 2. Throughout this section K = Fq is a finite field and X is the projective set parameterized by the rational functions F = {f1 /g1 , . . . , fs /gs } in K(y). Theorem 3.1. (Combinatorial Nullstellensatz [1]) Let S = K[t1 , . . . , ts ] be a polynomial ring over a field K, let f ∈ S, and let a = (ai ) ∈ Ns . Suppose that the coefficient of ta in f is non-zero and deg (f ) = a1 + · · · + as . If A1 , . . . , As are subsets of K, with |Ai | > ai for all i, then there are x1 ∈ A1 , . . . , xs ∈ As such that f (x1 , . . . , xs ) 6= 0. Lemma 3.2. Let K be a field and let A1 , . . . , As be a collection of non-empty finite subsets of K. If Y := A1 × · · · × As ⊂ As , g ∈ I(Y ) and degti (g) < |Ai | for i = 1, . . . , s, then g = 0. In particular if g is a polynomial of S that vanishes at all points of As , then g = 0. Proof. We proceed by contradiction. Assume that g is not zero. Then, there is a monomial ta = ta11 · · · tas s of g with deg(g) = a1 + · · · + as and a = (a1 , . . . , as ) 6= 0. As degti (g) < |Ai | for all i, then ai < |Ai | for all i. Thus, by Theorem 3.1, there are x1 , . . . , xs with xi ∈ Ai for all i such that g (x1 , . . . , xs ) 6= 0, a contradiction to the assumption that g vanishes on Y .  Definition 3.3. The affine set parameterized by F , denoted X∗ , is the set of all points (f1 (x)/g1 (x), . . . , fs (x)/gs (x)) in As such that x ∈ K n and gi (x) 6= 0 for all i. Lemma 3.4. Let K = Fq be a finite field. The following conditions are equivalent: (a) (b) (c) (d) g1 · · · gs vanishes at all points of K n . g1 · · · gs ∈ ({yiq − yi }ni=1 ). ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1) ∩ S = S. X∗ = ∅. Proof. (a) ⇔ (b)): This follows at once from Proposition 2.5. (a) ⇔ (d)): This follows from the definition of X∗ . P P (c) ⇒ (a)): We can write 1 = si=1 ai (gi ti − fi z) + nj=1 bj (yjq − yj ) + h(y0 g1 · · · gs − 1), where the ai ’s, bj ’s and h are polynomials in the variables yj ’s, ti ’s, y0 and z. Take an arbitrary point x = (xi ) in K n . In the equality above, making yi = xi for all i, z = 0 and ti = 0 for all i, we get that 1 = h1 (y0 g1 (x) · · · gs (x) − 1) for some h1 . If (g1 · · · gs )(x) 6= 0, then h1 (y0 g1 (x) · · · gs (x) − 1) is a polynomial in y0 of positive degree, a contradiction. Thus (g1 · · · gs )(x) = 0. 4 AZUCENA TOCHIMANI AND RAFAEL H. VILLARREAL P P (b) ⇒ (c)): Writing g1 · · · gs = nj=1 bj (yjq −yj ), we get y0 g1 · · · gs −1 = −1+ nj=1 y0 bj (yjq −yj ). Thus 1 is in the ideal ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1).  Lemma 3.5. Let f1 /g1 , . . . , fs /gs be rational functions of K(y) and let f = f (t1 , . . . , ts ) be a polynomial in S of degree d. Then g1d+1 · · · gsd+1 f = s X g1 · · · gs hi (gi ti − fi ) + g1d+1 · · · gsd+1 f (f1 /g1 , . . . , fs /gs ) i=1 for some h1 , . . . , hs in the polynomial ring K[y1 , . . . , yn , t1 , . . . , ts ]. If f is homogeneous and z is a new variable, then g1d+1 · · · gsd+1 f = s X g1 · · · gs hi (gi ti − fi z) + g1d+1 · · · gsd+1 z d f (f1 /g1 , . . . , fs /gs ) i=1 for some h1 , . . . , hs in the polynomial ring K[y1 , . . . , yn , z, t1 , . . . , ts ]. Proof. We can write f = λ1 tm1 + · · · + λr tmr with λi ∈ K ∗ and mi ∈ Ns for all i. Write mi = (mi1 , . . . , mis ) for 1 ≤ i ≤ r and set I = ({gi ti − fi }si=1 ). By the binomial theorem, for all i, j, we can write mij tj mij = [(tj − (fj /gj )) + (fj /gj )]mij = (hij /gj ) + (fj /gj )mij , for some hij ∈ I. Hence for any i we can write mi1 tmi = t1 mis · · · ts = (Gi /g1mi1 · · · gsmis ) + (f1 /g1 )mi1 · · · (fs /gs )mis , where Gi ∈ I. Notice that mi1 + · · ·+ mis ≤ d for all i because f has degree d. Then substituting these expressions for tm1 , . . . , tms in f = λ1 tm1 + · · · + λr tmr and multiplying f by g1d+1 · · · gsd+1 , we obtain the required expression. If f is homogeneous of degree d, the required expression for g1d+1 · · · gsd+1 f follows from the first part by considering the rational functions f1 z/g1 , . . . , fs z/gs , i.e., by replacing fi by fi z, and observing that f (f1 z, . . . , fs z) = z d f (f1 , . . . , fs ).  Lemma 3.6. Let K = Fq be a finite field. The following conditions are equivalent: (a) ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1) ∩ S = (t1 , . . . , ts ). (b) X∗ = {0}. Proof. (a) ⇒ (b)): By Lemma 3.4, X∗ 6= ∅. Take a point P in X∗ , i.e., there is x = (xi ) ∈ As such that gi (x) 6= 0 for all i and P = (f1 (x)/g1 (x), . . . , fs (x)/gs (x)). By hypothesis, for each tk , we can write (3.1) tk = s X i=1 ai (gi ti − fi z) + n X bj (yjq − yj ) + h(y0 g1 · · · gs − 1), j=1 where the ai ’s, bj ’s and h are polynomials in the variables yj ’s, ti ’s, y0 and z. From Eq. (3.1), making yi = xi for all i, y0 = 1/g1 (x) · · · gs (x), ti = fi (x)/gi (x) for all i, and z = 1, we get that fk (x)/gk (x) = 0. Thus P = 0. (b) ⇒ (a)): Setting I = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1), by Lemma 3.4 one has that I ∩ S ( S. Thus it suffices to show that tk ∈ I ∩ S for all k. Notice that g1 · · · gs fk VANISHING IDEALS 5 vanishes at all points of As because X∗ = {0}. Hence, thanks to Proposition 2.5, g1 · · · gs fk is in ({yiq − yi }ni=1 ). Setting w = y0 g1 · · · gs − 1, and applying Lemma 3.5 with f = tk , we can write (w + 1)2 tk = s X y02 g1 · · · gs hi (gi ti − fi z) + y02 g12 · · · gs2 z(fk /gk ). i=1 Therefore (w + 1)2 tk ∈ I. Thus tk ∈ I ∩ S. fi z}si=1 , {yiq  − yi }ni=1 , y0 g1 · · · gs − 1) and m = (t1 , . . . , ts ) is the Lemma 3.7. If I = ({gi ti − irrelevant maximal ideal of S, then (a) I ∩ S is a graded ideal of S, and (b) X = 6 ∅ if and only if I ∩ S ( m. Proof. (a): We set B = K[y0 , y1 , . . . , yn , z, t1 , . . . , ts ]. Take 0 6= f ∈ I ∩ S and write it as f = f1 + · · · + fr , where fi is a homogeneous polynomial of degree di and d1 < · · · < dr . By induction, using Proposition 2.2, it suffices to show that fr ∈ I ∩ S. We can write f= s X i=1 ai (gi ti − fi z) + n X ci (yiq − yi ) + c(y0 g1 · · · gs − 1), i=1 where the ai ’s, ci ’s, and c are in B. Making the substitution ti → ti v, z → zv, with v an extra variable, and regarding f (t1 v, . . . , ts v) as a polynomial in v it follows readily that v dr fr is in the ideal generated by B = {gi ti v − fi zv}si=1 ∪ {yiq − yi }ni=1 ∪ {y0 g1 · · · gs − 1}. Writing v dr fr as a linear combination of B, with coefficients in B, and making v = 1, we get that fr ∈ I ∩ S. (b): ⇒) If X 6= ∅, by Lemma 3.4, we get that I ∩ S 6= S. By part (a) the ideal I ∩ S is graded. Hence I ∩ S ( m. ⇐) If I ∩ S ( m, by Lemmas 3.4 and 3.6, we get X∗ 6= ∅ and X∗ 6= {0}. Thus X 6= ∅.  We come to the main result of this paper. Theorem 3.8. Let B = K[y0 , y1 , . . . , yn , z, t1 , . . . , ts ] be a polynomial ring over a finite field K = Fq . If X is a projective set parameterized by rational functions f1 /g1 , . . . , fs /gs in K(y) and X 6= ∅, then I(X) = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1) ∩ S. Proof. We set I = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1). First we show the inclusion I(X) ⊂ I ∩ S. Take a homogeneous polynomial f = f (t1 , . . . , ts ) of degree d that vanishes at all points of X. Setting w = y0 g1 · · · gs − 1, by Lemma 3.5, we can write (3.2) (w + 1)d+1 f = s X y0d+1 g1 · · · gs ai (gi ti − fi z) + z d y0d+1 g1d+1 · · · gsd+1 f (f1 /g1 , . . . , fs /gs ), i=1 where a1 , . . . , as are in B. We set H = g1d+1 · · · gsd+1 f (f1 /g1 , . . . , fs /gs ). This is a polynomial in K[y]. Thus, by the division algorithm in K[y] (see [2, Theorem 3, p. 63]), we can write (3.3) H = H(y1 , . . . , yn ) = n X hi (yiq − yi ) + G(y1 , . . . , yn ) i=1 for some h1 , . . . , hn in K[y], where the monomials that occur in G = G(y1 , . . . , yn ) are not divisible by any of the monomials y1q , . . . , ynq , i.e., degyi (G) < q for i = 1, . . . , n. Therefore, using 6 AZUCENA TOCHIMANI AND RAFAEL H. VILLARREAL Eqs. (3.2) and (3.3), we obtain the equality n s X X hi (yiq − yi )+ z d y0d+1 G(y1 , . . . , yn ). y0d+1 g1 · · · gs ai (gi ti − fi z)+ z d y0d+1 (3.4) (w + 1)d+1 f = i=1 i=1 Thus to show that f ∈ I ∩ S we need only show that G = 0. We claim that G vanishes on K n . Notice that yiq − yi vanishes at all points of K n because (K ∗ , · ) is a group of order q − 1. Take an arbitrary sequence x1 , . . . , xn of elements of K, i.e., x = (xi ) ∈ K n . Case (I): gi (x) = 0 for some i. Making yj = xj for all j in Eq. (3.4) we get G(x) = 0. Case (II): fi (x) = 0 and gi (x) 6= 0 for all i. Making yk = xk and tj = fj (x)/gj (x) for all k, j in Eq. (3.4) and using that f is homogeneous, we obtain that G(x) = 0. Case (III): fi (x) 6= 0 for some i and gℓ (x) 6= 0 for all ℓ. Making yk = xk , tj = fj (x)/gj (x) and z = 1 in Eq. (3.4) and using that f vanishes on [(f1 (x)/g1 (x), . . . , fs (x)/gs (x))], we get that G(x) = 0. This completes the proof of the claim. Therefore G vanishes at all points of K n and degyi (G) < q for all i. Hence, by Lemma 3.2, we get that G = 0. Next we show the inclusion I(X) ⊃ I ∩ S. By Lemma 3.7 the ideal I ∩ S is graded. Let f be a homogeneous polynomial of I ∩S. Take a point [P ] in X with P = (f1 (x)/g1 (x), . . . , fs (x)/gs (x)). Writing f as a linear combination of {gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1), with coefficients in K, and making ti = fi (x)/gi (x), yj = xj , z = 1 and y0 = 1/g1 (x) · · · gs (x) for all i, j it follows that f (P ) = 0. Thus f vanishes on X.  Definition 3.9. If I ⊂ S is an ideal and h ∈ S, we set (I : h) := {f ∈ S| f h ∈ I}. This ideal is called the colon ideal of I with respect to h. Definition 3.10. The projective algebraic set parameterized by F , denoted by X, is the set of all points [(f1 (x)/g1 (x), . . . , fs (x)/gs (x))] in Ps−1 such that x ∈ K n and fi (x)gi (x) 6= 0 for all i. The ideal I(X) can be computed from I(X) using the colon operation. Proposition 3.11. If X 6= ∅, then (I(X) : t1 · · · ts ) = I(X). Proof. Since X ⊂ X, one has I(X) ⊂ I(X). Consequently (I(X) : t1 · · · ts ) ⊂ I(X) because ti is not a zero-divisor of S/I(X) for all i. To show the reverse inclusion take a homogeneous polynomial f in I(X). Let [P ] be a point in X, with P = (α1 , . . . , αs ) and αk 6= 0 for some k, and let I[P ] be the ideal generated by the homogeneous polynomials of S that vanish at [P ]. Then I[P ] is a prime ideal of height s − 1, \ (3.5) I[P ] = ({αk ti − αi tk | k 6= i ∈ {1, . . . , s}), I(X) = I[Q] , [Q]∈X and the latter is the primary decomposition of I(X). Noticing that ti ∈ I[P ] if and only if αi = 0, it follows that t1 · · · ts f ∈ I(X). Indeed if [P ] has at least one entry equal to zero, then t1 · · · ts ∈ I[P ] and if all entries of P are not zero, then f ∈ I(X) ⊂ I[P ] . In either case t1 · · · ts f ∈ I(X). Hence f ∈ (I(X) : t1 · · · ts ).  Next we present some other means to compute the vanishing ideal I(X). Theorem 3.12. Let B = K[y0 , w, y1 , . . . , yn , z, t1 , . . . , ts ] be a polynomial ring over K = Fq . If X is a projective algebraic set parameterized by f1 /g1 , . . . , fs /gs in K(y) and X 6= ∅, then I(X) = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1, wf1 · · · fs − 1) ∩ S = ({gi ti − fi z}si=1 , {yiq − yi }ni=1 , {fiq−1 − 1}si=1 , y0 g1 · · · gs − 1) ∩ S. VANISHING IDEALS Proof. This follows adapting the proof of Theorem 3.8. 7  Theorem 3.13. Let B = K[y0 , y1 , . . . , yn , t1 , . . . , ts ] be a polynomial ring over K = Fq . If X∗ is an affine set parameterized by f1 /g1 , . . . , fs /gs in K(y), then I(X∗ ) = ({gi ti − fi }si=1 , {yiq − yi }ni=1 , y0 g1 · · · gs − 1) ∩ S. Proof. This follows adapting the proof of Theorem 3.8.  Definition 3.14. The affine algebraic set parameterized by F , denoted X ∗ , is the set of all points (f1 (x)/g1 (x), . . . , fs (x)/gs (x)) in As such that x ∈ K n and fi (x)gi (x) 6= 0 for all i. . The ideal I(X ∗ ) can be computed from I(X∗ ) using the colon operation. Proposition 3.15. (I(X∗ ) : t1 · · · ts ) = I(X ∗ ). Proof. This follows adapting the proof of Proposition 3.11.  Corollary 3.16. Let B = K[t1 , . . . , ts , y1 , . . . , yn , z] be a polynomial ring over the finite field K = Fq and let f1 , . . . , fs be polynomials of R. The following hold: (a) If X 6= ∅, then I(X) = ({ti − fi z}si=1 ∪ {yiq − yi }ni=1 ) ∩ S. (b) If X 6= ∅, then I(X) = ({ti − fi z}si=1 ∪ {yiq − yi }ni=1 ∪ {fiq−1 − 1}si=1 ) ∩ S. Proof. The result follows by adapting the proof of Theorem 3.8, and using Theorem 3.12.  The formula for I(X) given in (b) can be slightly simplified if the fi ’s are Laurent monomials (see [11, Theorems 2.1 and 2.13]). Example 3.17. Let f1 = y1 + 1, f2 = y2 + 1, f3 = y1 y2 and let K = F5 be a field with 5 elements. Using Corollary 3.16, and Macaulay2 [4], we get deg S/I(X) = 19, deg S/I(X) = 6, reg S/I(X) = 5, reg S/I(X) = 2. For convenience we present the following procedure for Macaulay2 [4] that we used to compute the degree and the regularity: R=GF(5)[z,y1,y2,t1,t2,t3,MonomialOrder=>Eliminate 3]; f1=y1+1,f2=y2+1,f3=y1*y2,q=5 I=ideal(t1-f1*z,t2-f2*z,t3-f3*z,y1^q-y1,y2^q-y2) Jxx=ideal selectInSubring(1,gens gb I) I=ideal(t1-f1*z,t2-f2*z,t3-f3*z,y1^q-y1,y2^q-y2, f1^(q-1)-1,f2^(q-1)-1,f3^(q-1)-1) Jx=ideal selectInSubring(1,gens gb I) S=ZZ/5[t1,t2,t3] Ixx=sub(Jxx,S),Mxx=coker gens Ixx degree Ixx, regularity Mxx Ix=sub(Jx,S),Mx=coker gens Ix degree Ix, regularity Mx 8 AZUCENA TOCHIMANI AND RAFAEL H. VILLARREAL Example 3.18. Let f1 = y1 + 1, f2 = y2 + 1, f3 = y1 y2 and let K = F5 be a field with 5 elements. Using Proposition 2.7, Corollary 3.16 and Macaulay2 [4], we get d |X| dim CX (d) δX (d) 1 2 3 4 5 19 19 19 19 19 3 6 10 15 19 13 8 1 d |X| dim CX (d) δX (d) 1 6 3 3 2 6 6 1 The dth column of these tables represent the length, the dimension, and the minimum distance of the projective Reed-Muller-type codes CX (d) and CX (d), respectively (see Section 2). The minimum distance was computed using the methods of [9]. Continuing with the Macaulay2 procedure of Example 3.17 we can compute the other values of these two tables as follows: degree Ixx, regularity Mxx hilbertFunction(1,Ixx),hilbertFunction(2,Ixx),hilbertFunction(3,Ixx), hilbertFunction(4,Ixx),hilbertFunction(5,Ixx) degree Ix, regularity Mx hilbertFunction(1,Ix),hilbertFunction(2,Ix) Let us give some application to vanishing ideals over monomial parameterizations. Corollary 3.19. Let K = Fq be a finite field. If X is parameterized by Laurent monomials, then I(X) is a radical Cohen-Macaulay binomial ideal of dimension 1. Proof. That I(X) is a binomial ideal follows from Lemma 2.4 and applying Theorem 3.8. That I(X) is a radical ideal of dimension 1 is well known and follows from Eq. (3.5) (see the proof of Proposition 3.11). Recall that depth S/I(X) ≤ dim S/I(X) = 1. From Eq. (3.5) one has that m = (t1 , . . . , ts ) is not an associated prime of I(X). Thus depth S/I(X) > 0 and depth S/I(X) = dim S/I(X) = 1, i.e., I(X) is Cohen-Macaulay.  Corollary 3.20. [11, Theorem 2.1] Let K = Fq be a finite field and let X be a projective algebraic set parameterized by Laurent monomials. Then I(X) is a Cohen-Macaulay lattice ideal and dim S/I(X) = 1. Proof. It follows from Proposition 3.11, Theorem 3.12 and Lemma 2.4.  Binomial vanishing ideals. Let K be a field. The projective space Ps−1 ∪ {[0]}) together with the zero vector [0] is a monoid under componentwise multiplication, where [1] = [(1, . . . , 1)] is the identity of Ps−1 ∪ {[0]}. Recall that monoids always have an identity element. Lemma 3.21. Let K = Fq be a finite field and let Y be a subset of Ps−1 . If Y ∪ {[0]} is a submonoid of Ps−1 ∪ {[0]} such that each element of Y is of the form [α] with α ∈ {0, 1}s , then Y is parameterized by Laurent monomials. Proof. The set Y can be written as Y = {[α1 ], . . . , [αm ]}, where αi = (αi1 , . . . , αis ) and αij = 0 or αik = 1 for all i, k. Consider variables y1 , . . . , ys and z1 , . . . , zs . For each αik define hik = yiq−1 if αik = 1 and hik = ziq−1 /yiq−1 if αik = 0. Setting hi = (hi1 , . . . , his ) for i = 1, . . . , m and Fi = h1i · · · hmi for i = 1, . . . , s, we get h1 h2 · · · hm = (h11 · · · hm1 , . . . , h1s · · · hms ) = (F1 , . . . , Fs ). It is not hard to see that Y is parameterized by F1 , . . . , Fs .  VANISHING IDEALS 9 Example 3.22. Let K be the field F3 and let Y = {[(1, 1, 0)], [0, 1, 1], [0, 1, 0], [1, 1, 1]}. With the notation above, we get that Y is the projective set parameterized by F1 = (y1 z2 z3 )2 /(y2 y3 )2 , F2 = (y1 y2 y3 )2 , F3 = (y2 z1 z3 )2 /(y1 y3 )2 . The next result gives a family of ideals where the converse of Corollary 3.19 is true. Proposition 3.23. Let K = Fq be a finite field. If Y is a subset of Ps−1 such that each element of Y is of the form [α] with α ∈ {0, 1}s and I(Y) is a binomial ideal, then Y is a projective set parameterized by Laurent monomials. Proof. Since Y is finite, one has that Y = Y = V (I(Y)), where Y is the Zariski closure and V (I(Y)) is the zero set of I(Y). Hence, as I(Y) is generated by binomials, we get that Y∪{[0]} is a submonoid of Ps−1 ∪{[0]}. Thus, by Lemma 3.21, Y is parameterized by Laurent monomials.  This leads us to pose the following conjecture. Conjecture 3.24. Let K = Fq be a finite field and let Y be a subset of Ps−1 . If I(Y) is a binomial ideal, then Y is a projective set parameterized by Laurent monomials. In particular from Proposition 3.23 this conjecture is true for q = 2. References [1] N. Alon, Combinatorial Nullstellensatz, Recent trends in combinatorics (Mat́raháza, 1995), Combin. Probab. Comput. 8 (1999), no. 1-2, 7–29. 3 [2] D. Cox, J. Little and D. O’Shea, Ideals, Varieties, and Algorithms, Springer-Verlag, 1992. 1, 5 [3] M. González-Sarabia, C. Renterı́a and H. Tapia-Recillas, Reed-Muller-type codes over the Segre variety, Finite Fields Appl. 8 (2002), no. 4, 511–518. 1, 2, 3 [4] D. Grayson and M. Stillman, Macaulay2, 1996. Available via anonymous ftp from math.uiuc.edu. 1, 7, 8 [5] G. M. Greuel and G. Pfister, A Singular Introduction to Commutative Algebra, 2nd extended edition, Springer, Berlin, 2008. 2 [6] J. Harris, Algebraic Geometry. A first course, Graduate Texts in Mathematics 133, Springer-Verlag, New York, 1992. 1 [7] N. Jacobson, Basic Algebra I , Second Edition, W. H. Freeman and Company, New York, 1996. 2 [8] M. Kreuzer and L. Robbiano, Computational Commutative Algebra 2, Springer-Verlag, Berlin, 2005. 1 [9] J. Martı́nez-Bernal, Y. Pitones and R. H. Villarreal, Minimum distance functions of graded ideals and ReedMuller-type codes, J. Pure Appl. Algebra, to appear. Preprint, 2015, arXiv:1512.06868v1. 8 [10] H. Matsumura, Commutative Ring Theory, Cambridge Studies in Advanced Mathematics 8, Cambridge University Press, 1986. 2 [11] C. Renterı́a, A. Simis and R. H. Villarreal, Algebraic methods for parameterized codes and invariants of vanishing ideals over finite fields, Finite Fields Appl. 17 (2011), no. 1, 81-104. 1, 3, 7, 8 [12] T. Sauer, Polynomial interpolation in several variables: lattices, differences, and ideals, Stud. Comput. Math. 12 (2006), 191–230. 1 [13] M. Tsfasman, S. Vladut and D. Nogin, Algebraic geometric codes: basic notions, Mathematical Surveys and Monographs 139, American Mathematical Society, Providence, RI, 2007. 1 [14] R. H. Villarreal, Monomial Algebras, Second Edition, Monographs and Research Notes in Mathematics, Chapman and Hall/CRC, 2015. 2 Departamento de Matemáticas, Centro de Investigación y de Estudios Avanzados del IPN, Apartado Postal 14–740, 07000 Mexico City, D.F. E-mail address: [email protected] Departamento de Matemáticas, Centro de Investigación y de Estudios Avanzados del IPN, Apartado Postal 14–740, 07000 Mexico City, D.F. E-mail address: [email protected]
0math.AC
How many units can a commutative ring have? arXiv:1701.02341v1 [math.AC] 9 Jan 2017 Sunil K. Chebolu and Keir Lockridge Abstract. László Fuchs posed the following problem in 1960, which remains open: classify the abelian groups occurring as the group of all units in a commutative ring. In this note, we provide an elementary solution to a simpler, related problem: find all cardinal numbers occurring as the cardinality of the group of all units in a commutative ring. As a by-product, we obtain a solution to Fuchs’ problem for the class of finite abelian p-groups when p is an odd prime. 1. INTRODUCTION It is well known that a positive integer k is the order of the multiplicative group of a finite field if and only if k is one less than a prime power. The corresponding fact for finite commutative rings, however, is not as well known. Our motivation for studying this—and the question raised in the title—stems from a problem posed by László Fuchs in 1960: characterize the abelian groups that are the group of units in a commutative ring (see [8]). Though Fuchs’ problem remains open, it has been solved for various specialized classes of groups, where the ring is not assumed to be commutative. Examples include cyclic groups ([10]), alternating, symmetric and finite simple groups ([4, 5]), indecomposable abelian groups ([1]), and dihedral groups ([2]). In this note we consider a much weaker version of Fuchs’ problem, determining only the possible cardinal numbers |R× |, where R is a commutative ring with group of units R× . In a previous note in the M ONTHLY ([6]), Ditor showed that a finite group G of odd order is the group of units of a ring if and only if G is isomorphic to a direct product of cyclic groups Gi , where |Gi | = 2ni − 1 for some positive integer ni . This implies that an positive integer is the number of units in a ring if and only if it is of the Qodd t form i=1 (2ni − 1) for some positive integers n1 , . . . , nt . As Ditor mentioned in his paper, this theorem may be derived from the work of Eldridge in [7] in conjunction with the Feit-Thompson theorem which says that every finite group of odd order is solvable. However, the purpose of his note was to give an elementary proof of this result using classical structure theory. Specifically, Ditor’s proof uses the following key ingredients: Mashke’s theorem, which classifies (for finite groups) the group algebras over a field that are semisimple rings; the Artin-Wedderburn theorem, which describes the structure of semisimple rings; and Wedderburn’s little theorem, which states that every finite division ring is a field. In this note we give another elementary proof of Ditor’s theorem for commutative rings. We also extend the theorem to even numbers and infinite cardinals, providing a complete answer to the question posed in the title; see Theorem 8. Our approach also gives an elementary solution to Fuchs’ problem for finite abelian p-groups when p is an odd prime; see Corollary 4. 2. FINITE CARDINALS We begin with two lemmas. For a prime p, let Fp denote the field of p elements. Recall that any ring homomorphism φ : A −→ B maps units to units, so φ induces a group homomorphism φ× : A× −→ B × . 1 Lemma 1. Let φ : A −→ B be a homomorphism of commutative rings. If the induced group homomorphism φ× : A× −→ B × is surjective, then there is a quotient A′ of A such that (A′ )× ∼ = B×. Proof. By the first isomorphism theorem for rings, Im φ is isomorphic to a quotient of A. It therefore suffices to prove that (Im φ)× = B × . Since ring homomorphisms map units to units and φ× is surjective, we have B × ⊆ (Im φ)× . The reverse inclusion (Im φ)× ⊆ B × holds since every unit in the subring Im φ must also be a unit in the ambient ring B . Lemma 2. Let V and W be finite fields of characteristic 2. 1. The tensor product V ⊗F2 W is isomorphic as a ring to a finite direct product of finite fields of characteristic 2. 2. As F2 -vector spaces, dim(V ⊗F2 W ) = (dim V )(dim W ). Proof. To prove (1), let K and L be finite fields of characteristic 2. By the primitive element theorem, we have L ∼ = F2 [x]/(f (x)), where f (x) is an irreducible polynomial in F2 [x]. This implies that K ⊗ F2 L ∼ = K[x] . (f (x)) The irreducible factors of f (x) in K[x] are distinct since the extension L/F2 is sepQt arable. Now let f (x) = i=1 fi (x) be the factorization of f (x) into its distinct irreducible factors in K[x]. We then have the following series of ring isomorphisms: Y K[x] K[x] K[x] ∼ ∼ , L∼ = = Qt = (f (x)) ( i=1 fi (x)) i=1 (fi (x)) t K ⊗ F2 where the last isomorphism follows from the Chinese remainder theorem for the ring K[x]. Since each factor K[x]/(fi (x)) is a finite field of characteristic 2, we see that K ⊗F2 L is isomorphic as a ring to a direct product of finite fields of characteristic 2, as desired. For (2), simply note that if {v1 , . . . , vk } is a basis for V and {w1 , . . . , wl } is a basis for W , then {vi ⊗ wj | 1 ≤ i ≤ k, 1 ≤ j ≤ l} is a basis for V ⊗F2 W . We may now classify the finite abelian groups of odd order that appear as the group of units in a commutative ring. Proposition 3. Let G be a finite abelian group of odd order. The group G is isomorphic to the group of units in a commutative ring if and only if G is isomorphic to the group of units in a finite direct product of finite fields of characteristic 2. In particular, an odd positiveQinteger k is the number of units in a commutative ring if and only if k is t of the form i=1 (2ni − 1) for some positive integers n1 , . . . , nt . Proof. The ‘if’ direction of the second statement follows from the fact that, for rings A and B , (A × B)× ∼ = A× × B × . For the converse, since the trivial group is the group of units of F2 , let G be a nontrivial finite abelian group of odd order and let R be a commutative ring with group of units G. Since G has odd order, the unit −1 in R must have order 1. This implies that R has characteristic 2. 2 Now let G∼ = Cpα1 × · · · × Cpαk 1 k denote a decomposition of G as a direct product of cyclic groups of prime power order (the primes pi are not necessarily distinct). Let gi denote a generator of the ith factor. Define a ring S by S= F2 [x1 , . . . , xk ] . α p k α p 1 (x11 − 1, . . . , xkk − 1) Since R is a commutative ring of characteristic 2, there is a natural ring homomorphism S −→ R sending xi to gi for all i. Since the gi ’s together generate G, this map induces a surjection S × −→ R× , and hence by Lemma 1 there is a quotient of S whose group of units is isomorphic to G. Since any quotient of a finite direct product of fields is again a finite direct product of fields (of possibly fewer factors), the proof will be complete if we can show that S is isomorphic as a ring to a finite direct product of fields of characteristic 2. To see this, observe that the map α p k α p 1 F2 [x1 ]/(x11 − 1) × · · · × F2 [x1 ]/(xkk − 1) −→ S sending a k -tuple to the product of its entries is surjective and F2 -linear in each factor; by the universal property of the tensor product, it induces a surjective ring homomorphism α p k α p 1 F2 [x1 ]/(x11 − 1) ⊗F2 · · · ⊗F2 F2 [x1 ]/(xkk − 1) −→ S. α (†) α The dimension of the source of (†) as an F2 -vector space is p1 1 · · · pk k by Lemma 2 (2); this is also the dimension of the target (count monomials in the polynomial ring S ). Consequently, the map (†) is an isomorphism of rings. The irreducible factors of each α p i polynomial xi i − 1 are distinct since this polynomial has no roots in common with its derivative (pi is odd). Therefore by the Chinese remainder theorem, each tensor factor is a finite direct product of finite fields of characteristic 2. Since the tensor product distributes over finite direct products, we may use Lemma 2 (1) to conclude that S is ring isomorphic to a finite direct product of finite fields of characteristic 2. For any odd prime p, we now characterize the finite abelian p-groups that are realizable as the group of units of a commutative ring. Recall that a finite p-group is a finite group whose order is a power of p. An elementary abelian finite p-group is a finite group that is isomorphic to a finite direct product of cyclic groups of order p. Corollary 4. Let p be an odd prime. A finite abelian p-group G is the group of units of a commutative ring if and only if G is an elementary abelian p-group and p is a Mersenne prime. Proof. The ‘if’ direction follows from the fact if p = 2n − 1 is a Mersenne prime, then (Fp+1 × · · · × Fp+1 )× ∼ = Cp × · · · × Cp . 3 For the other direction, let p be an odd prime and let G be a finite abelian p-group. If G is the group of units of commutative ring, then by Proposition 3, G ∼ = T × where T is a finite direct product of finite fields of characteristic 2. Consequently, G∼ = C2n1 −1 × · · · × C2nt −1 . Since each factor must be a p-group, for each i we have 2ni − 1 = pzi for some positive integer zi . We claim that zi = 1 for all i. This follows from [3, 2.3], but since the argument is short we include it here for convenience. Assume to the contrary that zi > 1 for some i. Consider the equation pzi + 1 = ni 2 . Since p > 1, we have ni ≥ 2 and hence pzi ≡ −1 mod 4. This means p ≡ −1 mod 4 and zi is odd. Since zi > 1, we have a nontrivial factorization 2ni = pzi + 1 = (p + 1)(pzi −1 − pzi −2 + · · · − p + 1), so pzi −1 − pzi −2 + · · · − p + 1 must be even. On the other hand, since zi and p are both odd, working modulo 2 we obtain 0 ≡ pzi −1 − pzi −2 + · · · − p + 1 ≡ zi ≡ 1 mod 2, a contradiction. Hence zi = 1 for all i, so p is Mersenne and G an is elementary abelian p-group. The above corollary does not hold for the Mersenne prime p = 2; for example, C4 = F× 5 . As far as we know, Fuchs’ problem for finite abelian 2-groups remains open. We next provide a simple example demonstrating that every even number is the number of units in a commutative ring. Proposition 5. Every even number is the number of units in a commutative ring. Proof. Let m be a positive integer and consider the commutative ring R2m = Z[x] . (x2 , mx) Every element in this ring can be uniquely represented by an element of the form a + bx, where a is an arbitrary integer and 0 ≤ b ≤ m − 1. We will now show that a + bx is a unit in this ring if and only if a is either 1 or −1; this implies the ring has × ∼ exactly 2m units. (In fact, it can be shown that R2m = C2 × Cm .) If a + bx is a unit in R2m , there there exits an element a′ + b′ x such that (a + bx)(a′ + b′ x) = 1 in R2m . Since x2 = 0 in R2m , we must have aa′ = 1 in Z; i.e., a is 1 or −1. Conversely, if a is 1 or −1, we see that (a + bx)(a − bx) = 1 in R2m . 3. INFINITE CARDINALS Propositions 3 and 5 solve our problem for finite cardinals. For infinite cardinals, we will prove the following proposition. Proposition 6. Every infinite cardinal is the number of units in a commutative ring. Our proof relies mainly on the Cantor-Bernstein theorem: Theorem 7 (Cantor-Bernstein). Let A and B be any two sets. If there exist injective mappings f : A −→ B and g : B −→ A, then there exits a bijective mapping h : A −→ B . In other words, if |A| ≤ |B| and |B| ≤ |A|, then |A| = |B|. 4 We also use other standard facts from set theory which may be found in [9]. For example, we make frequent use of the fact that whenever α and β are infinite cardinals with α ≤ β , then αβ ≤ β . Recall that ℵ0 denotes the cardinality of the set of natural numbers. Proof of Proposition 6. Let λ be an infinite cardinal and let S be a set whose cardinality is λ. Consider F2 (S), the field of rational functions in the elements of S . We claim that |F2 (S)× | = λ. By the Cantor-Bernstein theorem, it suffices to prove that |S| ≤ |F2 (S)× | and |F2 (S)× | ≤ |S|. Since S ⊆ F2 (S)× , it is clear that |S| ≤ |F2 (S)× |. For the reverse inequality, first observe that if A is a finite set, then |F2 [A]| = ℵ0 . This follows by induction on the size of A, because F2 [x] is countable and R[x] is countable whenever R is countable. We now have the following: |F2 (S)× | ≤ |F2 (S)| ≤ |F2 [S] × F2 [S]| (every rational function is a ratio of two polynomials) = |F2 [S]|2 = |F2 [S]| X ≤ |F2 [A]| A⊂S, 1≤|A|<ℵ0 X = ℵ0 A⊂S, 1≤|A|<ℵ0 ≤ ∞ X i=1 i |S| ℵ0 = ∞ X |S|ℵ0 = |S|ℵ20 = |S|ℵ0 = |S|. i=1 Combining Propositions 3, 5, and 6, we obtain our main result. Theorem 8. Let λ be a cardinal number. There exists a commutative ring R with |R× | = λ if and only if λ is equal to Qt 1. an odd number of the form i=1 (2ni − 1) for some positive integers n1 , . . . , nt , 2. an even number, or 3. an infinite cardinal number. ACKNOWLEDGMENTS. We would like to thank George Seelinger for simplifying our presentation of a ring with an even number of units. We also would like to thank the anonymous referees for their comments. REFERENCES 1. S. K. Chebolu, K. Lockridge, Fuchs’ problem for indecomposable abelian groups, J. Algebra 438 (2015) 325–336. 2. ———, Fuchs’ problem for dihedral groups, J. Pure Appl. Algebra 221 no. 2 (2017) 971–982. 3. ———, Fields with indecomposable multiplicative groups, Expo. Math. 34 (2016) 237–242. 4. C. Davis, T. Occhipinti, Which finite simple groups are unit groups? J. Pure Appl. Algebra 218 no. 4 (2014) 743–744. 5. ———, Which alternating and symmetric groups are unit groups? J. Algebra Appl. 13 no. 3 (2014). 6. S. Z. Ditor, On the group of units of a ring, Amer. Math. Monthly 78 (1971) 522–523. 5 7. K. E. Eldridge, On ring structures determined by groups, Proc. Amer. Math. Soc. 23 (1969) 472–477. 8. L. Fuchs, Abelian groups. International Series of Monographs on Pure and Applied Mathematics, Pergamon Press, New York-Oxford-London-Paris, 1960. 9. P. R. Halmos, Naive set theory. The University Series in Undergraduate Mathematics, D. Van Nostrand Co., Princeton, NJ-Toronto-London-New York, 1960. 10. K. R. Pearson, J. E. Schneider, Rings with a cyclic group of units, J. Algebra 16 (1970) 243–251. Department of Mathematics, Illinois State University, Normal, IL 61790, USA [email protected] Department of Mathematics, Gettysburg College, Gettysburg, PA 17325, USA [email protected] 6
0math.AC
. arXiv:1802.07596v1 [math.AC] 21 Feb 2018 MAXIMAL DEPTH PROPERTY OF FINITELY GENERATED MODULES AHAD RAHIMI Abstract. Let (R, m) be a Noetherian local ring and M a finitely generated R-module. We say M has maximal depth if there is an associated prime p of M such that depth M = dim R/p. In this paper, we study finitely generated modules with maximal depth. It is shown that the maximal depth property is preserved under some important module operations. Generalized Cohen–Macaulay modules i with maximal depth are classified. Finally, the attached primes of Hm (M ) are considered for i < dim M . Introduction Let K be a field and (R, m) be a Noetherian local ring, or a standard graded K-algebra with graded maximal ideal m. Let M be a finitely generated R-module. A basic fact in Commutative algebra says that depth M ≤ min{dim R/p : p ∈ Ass(M)}. We set mdepthR M = min{dim R/p : p ∈ Ass(M)}. For simplicity, we write mdepth M instead of mdepthR M. We say M has maximal depth if the equality holds, i.e., depth M = mdepth M. In other words, there is an associated prime p of M such that depth M = dim R/p. Cohen–Macaulay modules as well as sequentially Cohen–Macaulay modules are examples of modules with maximal depth. Of course this class is rather large. In Example 1.6 the ring R is not sequentially Cohen– Macaulay and has maximal depth. This concept has already been working with several authors and some known results in this regards are as follows: If I ⊂ S is a generic monomial ideal, then it has maximal depth, see [10, Theorem 2.2]. If a monomial ideal I has maximal depth, then so does its polarization, see [6]. In this paper, we study finitely generated modules to have maximal depth. Some classifications of this kind of modules are given. In the preliminary section, we give some facts about mdepth M. For the dimension filtration F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Md = M of M, we observe that all the Mi have the same mdepth, namely this number is the smallest j for which Mj 6= 0. From this fact, we deduce that if M is sequentially Cohen–Macaulay, then M has maximal depth, see Proposition 1.4. In Section 2 , we show that the maximal depth property is preserved under tensor product, regular sequence and direct sum. Let A and B be two Noetherian algebras over an algebraically closed field K. Let M and N be nonzero finitely generated 2010 Mathematics Subject Classification. 13C14, 13C15, 13E05, 13D45. Key words and phrases. Maximal depth, Sequentially Cohen–Macaulay, Generalized Cohen– Macaulay, Localization, Attached primes. 1 modules over A and B, respectively. We set R := A ⊗K B. Then by using a result of [7] we show M ⊗K N as R-module has maximal depth if and only if M and N have maximal depth. Next, it is shown that if M has maximal depth and x = x1 , . . . , xn is an Msequence in R, then so does M/xM. The converse is not true in general, see Example 2.5. In the following section, we observe that if M has maximal depth with depth M > 0, then Hmdepth M (M) is not finitely generated, see Proposition 3.3. This is used to classify all generalized Cohen–Macaulay modules with maximal depth. In fact, we prove the following: Let M be a generalized Cohen–Macaulay module with depth M > 0. Then M has maximal depth is equivalent to say that ”M is sequentially Cohen–Macaulay” and this is the same as ”M is Cohen–Macaulay”. If M is sequentially Cohen–Macaulay and Hmi (M) 6= 0 for some i, then Hmi (M) is not finitely generated. Inspired by this fact and Proposition 3.3, we may ask the following question in Remark 3.6: Assume M has maximal depth and Hmi (M) 6= 0. Does it follow Hmi (M) is not finitely generated? We set Assd(M) = {p ∈ Ass(M) : depth M = dim R/p}; so that M has maximal depth if and only if Assd(M) 6= ∅. In the final section, under the condition that p ∈ Supp(M) contains an element of Assd(M), we obtain several results. First of all, Mp has maximal depth and depth M = depth Mp + dim R/p, see Proposition 4.2. Secondly, we show min Att(Hmdepth M (M)) = Assd(M). As a consequence, we explicitly obtain the attached primes Hmi (M) for all i if M is sequentially Cohen–Macaulay. Note that the attached primes of top local cohomology are known. In fact, Att(Hmdim M (M)) = Assh(M) where Assh(M) = {p ∈ Ass(M) : dim M = dim R/p} and not so much is known about Att(Hmi (M)) whenever i < dim M. At the end of this section we consider the following fact in [11]. For a finitely generated R-module M, one has AnnR (M/pM) = p for all p ∈ Var(AnnR M). The dual property of this fact for an Artinian module L is : Ann(0 :L p) = p for all p ∈ Var(Ann L). (∗) Hmi (M) In [11] it is shown that the local cohomology module satisfies the property (∗) with some conditions on R. Under our condition that p ∈ Supp(M) contains an element of Assd(M), we show Hmdepth M (M) satisfies (∗). As a consequence, if M is sequentially Cohen–Macaulay, then Hmi (M) satisfies (∗) for all i. 1. Preliminaries Let K be a field and (R, m) be a Noetherian local ring, or a standard graded K-algebra with graded maximal ideal m. Let M be a finitely generated R-module. It is a classical fact that depth M ≤ min{dim R/p : p ∈ Ass(M)}, see [2]. We set mdepthR M = min{dim R/p : p ∈ Ass(M)}. For simplicity, we write mdepth M instead of mdepthR M. Thus depth M ≤ mdepth M ≤ dim M. Observe 2 that depth(M) = 0 if and only if mdepth(M) = 0. Thus, if mdepth M = 1, then depth M = 1. Definition 1.1. We say M has maximal depth if the equality holds, i.e., depth M = mdepth M. In other words, there is an associated prime p of M such that depth M = dim R/p. Cohen–Macaulay modules are obvious example of modules of maximal depth. If depth M = 0, then M has maximal depth. In particular, any non-zero Artinian module N has maximal depth. Indeed, let p ∈ Ass(N). The exact sequence 0 → R/p → N of R-modules implies that R/p is an Artinian domain. It follows that R/p is a filed and hence m ∈ Ass(N). Therefore depth N = 0. Notice that, if M is unmixed, then M has maximal depth if and only if M is Cohen–Macaulay. This is a known fact that sequentially Cohen–Macaulay modules have maximal depth. In the following, we give some facts about mdepth M and hence deduce that sequentially Cohen–Macaulay modules have maximal depth. Let M be an R-module of dimension d. The dimension filtration F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Md = M of M is defined by the property that Mi is the largest submodule of M with dim Mi ≤ i for i = 0, . . . , d. In a dimension filtration each Mi is uniquely determined as follows, see [13]. Fact 1.2. Let M be a finitely generated R-module and F be the dimension filtration of M. Then \ Mi = Nj dim R/pj >i for all i = 0, . . . , d. Here 0 = 0 in M. Tn j=1 Nj denotes a reduced primary decomposition of For all i, we set Assi (M) = {p ∈ Ass(M) : dim R/p = i}. The following characterization of a dimension filtration is given in [8]. Fact 1.3. Let F be a filtration of M. The following conditions are equivalent: (a) Ass(Mi /Mi−1 ) = Assi (M) for all i; (b) F is the dimension filtration of M. A finite filtration F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Mr = M of M by submodules is a Cohen–Macaulay filtration if each quotient Mi /Mi−1 is Cohen–Macaulay and 0 ≤ dim M1 /M0 < dim M2 /M1 < · · · < dim Mr /Mr−1 . If M admits a Cohen– Macaulay filtration, then we say M is sequentially Cohen–Macaulay. Note that if M is sequentially Cohen–Macaulay, then the Cohen–Macaulay filtration is just the dimension filtration. Proposition 1.4. Let F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Md = M be the dimension filtration of M. We set t = min{i : Mi 6= 0}. Then mdepth Mi = t for i = t, . . . , d. Moreover, if M is sequentially Cohen–Macaulay, then M has maximal depth. 3 Proof. We first show that mdepth M = t. By Fact 1.3, Ass(Mt ) = Asst (M). Hence dim Mt = t; so there exists p ∈ Ass(Mt ) such that dim R/p = t. Suppose mdepth M = s. As p ∈ Ass(M), it follows that s ≤ t. If s < t, then Ms = 0. Hence Asss (M) = ∅ by Fact 1.3, which is a contradiction. Therefore, mdepth M = t. Now observe that t = mdepth M ≤ mdepth Md−1 ≤ · · · ≤ mdepth Mt ≤ dim Mt = t. Thus, mdepth Mi = t for i = t, . . . , d. To show the second part, let M be sequentially Cohen–Macaulay. Thus the dimension filtration of F is the Cohen–Macaulay filtration. As Mt is Cohen–Macaulay, it has maximal depth and so depth Mt = mdepth Mt . Since M is sequentially Cohen– Macaulay, it follows that depth Mi = depth M for all i, see for instance [12, Fact 2.3]. Thus depth M = depth Mt = mdepth Mt = mdepth M, as desired.  Remark 1.5. In Proposition 1.4, we observe that mdepth M = min{dim R/p : p ∈ Ass(Mt )} = mdepth Mt . In a dimension filtration F , one has Ass(Mt ) = Ass(M) − Ass(M/Mt ), see [13]. In the following, we give an example which is not sequentially Cohen–Macaulay and has maximal depth. Moreover, in the dimension filtration not necessarily all the Mi have the same depth. Example 1.6. Let S = K[x1 , . . . , x8 ] be the standard graded polynomial ring with the unique graded maximal ideal m = (x1 , . . . , x8 ). Let C8 be the cycle graph of length 8 and I its edge ideal in S. Thus, I = (x1 x2 , x2 x3 , x3 x4 , x4 x5 , x5 x6 , x6 x7 , x7 x8 , x8 x1 ). By using, CoCoA [3], the ideal I has the minimal primary decomposition I = T10 i=1 pi where p1 = (x1 , x3 , x5 , x7 ), p2 = (x2 , x4 , x6 , x8 ), p3 = (x2 , x3 , x5 , x7 , x8 ), p4 = (x2 , x3 , x5 , x6 , x8 ), p5 = (x1 , x3 , x5 , x6 , x8 ), p6 = (x1 , x3 , x4 , x6 , x8 ), p7 = (x1 , x2 , x4 , x5 , x7 ), p8 = (x1 , x2 , x4 , x6 , x7 ), p9 = (x1 , x3 , x4 , x6 , x7 ) and p10 = (x2 , x4 , x5 , x7 , x8 ). We set R = S/I. Fact 1.2 provides the dimension filtration 0 = R0 ⊂ R1 ⊂ R2 ⊂ R3 ⊂ R4 = R, for R where R3 = (p1 ∩ p2 )/I and R1 = R2 = 0. By Remark 1.5, Ass(R3 ) = Ass(R) − Ass(R/R3 ) = {p3 , . . . , p10 }. Hence, mdepth R3 = mdepth R = 3. By [9, Corollary 7.6.30] we have depth R = 3(or using CoCoA [3]). Therefore, R has maximal depth. We claim that depth R3 = 2. Consider the exact sequence 0 → R3 → R → R′ → 0 where R′ = R/R3 ∼ = S/(p1 ∩ ′ p2 ). One has depth R = 1. Hence the Depth lemma yields depth R3 = 2. So in the dimension filtration R3 and R4 have different depth. The ring R is not sequentially Cohen–Macaulay, because in the dimension filtration of R the quotients R3 /R2 and R′ = R/R3 are not Cohen–Macaulay. Indeed, 2 = depth R3 6= dim R3 = 3, and 1 = depth R′ 6= dim R′ = 4. Note also that the only sequentially Cohen–Macaulay cycles are C3 and C5 , see [5]. 4 Remark 1.7. It is natural to define the following notion: A dimension filtration F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Mr = M of M by submodules is a maximal depth filtration if each quotient Mi /Mi−1 has maximal depth and 0 ≤ dim M1 /M0 < dim M2 /M1 < · · · < dim Mr /Mr−1 . If M admits a maximal depth filtration, then we say M has sequentially maximal depth. We notice that M has sequentially maximal depth is equivalent to say that M is sequentially Cohen–Macaulay. In fact, by Fact 1.3 we have Ass(Mi /Mi−1 ) = {p ∈ Ass(M) : dim R/p = i}. Thus Mi /Mi−1 is unmixed. Consequently, Mi /Mi−1 has maximal depth is equivalent to say that Mi /Mi−1 is Cohen–Macaulay. 2. Tensor product, regular sequence and direct sum In this section, we show that the maximal depth property is preserved under some important module operations. Let A and B be two Noetherian algebras over a field K such that R := A ⊗K B is Noetherian. The following fact gives the associated primes of R-modules of the form M ⊗K N, where M and N are nonzero finitely generated modules over A and B, respectively. Fact 2.1. Let K be an algebraically closed field. Then AssR (M ⊗K N) = {p1 + p2 : p1 ∈ AssA (M) and p2 ∈ AssB (N)}, see, [7, Corollary 2.8]. Proposition 2.2. Continue with the notation and assumptions as above, M ⊗K N has maximal depth if and only if M and N have maximal depth. Proof. We set L = M ⊗K N and suppose L has maximal depth. Thus there exists p ∈ Ass(L) such that depth L = dim R/p. This is a known fact that depth L = depth M + depth N. Fact 2.1 provides p = p1 + p2 where p1 ∈ AssA (M) and p2 ∈ AssB (N). Consequently, depth M + depth N = dim R/(p1 + p2 ) = dim A/p1 + dim B/p2 . Since depth M ≤ dim A/p1 and depth N ≤ dim B/p2 , it follows that depth M = dim A/p1 and depth N = dim B/p2 , and hence M and N have maximal depth. The converse is proved in the same way with using again Fact 2.1.  Next, we have the following Proposition 2.3. Let M be an R-module which has maximal depth. Let x ∈ R be an M-regular element. Then M/xM has maximal depth. Proof. By our assumption, there exists p ∈ Ass(M) such that depth M = dim R/p. We may assume depth M > 1. For p ∈ Ass(M) we choose z ∈ M such that Rz is maximal among the cyclic submodules of M annihilated by p. As in the proof of [2, Proposition 1.2.13] we see that p consists of zero divisors of M/xM. Thus p ⊆ q 5 for some q ∈ Ass(M/xM). Note that x ∈ q. Since x is M-regular, it follows that x 6∈ p. Hence p 6= q. Observe that depth M − 1 = ≤ < = depth M/xM dim R/q dim R/p depth M. Consequently, depth M/xM = dim R/q where q ∈ Ass(M/xM). Therefore, M/xM has maximal depth, as desired.  Corollary 2.4. Let M be an R-module which has maximal depth. Let x = x1 , . . . , xn ∈ R be an M-sequence. Then M/xM has maximal depth. The following example shows that the converse of Proposition 2.3 is not true in general. Example 2.5. Let S = K[x1 , x2 , x3 , x4 ] be the standard graded polynomial ring with the unique graded maximal ideal m = (x1 , x2 , x3 , x4 ). We set R = S/I where I = p1 ∩ p2 with p1 = (x1 , x2 ) and p2 = (x3 , x4 ). The element x = x1 + x3 ∈ S is R-regular. Consider the following isomorphism R/xR ∼ = S/(I, x). Using Macaulay2 ([4]) gives us the associated primes of T = S/(I, x) that is {(x1 , x3 ), (x2 , x4 , x1 + x3 )}. One has that depth T = mdepth T = 1. Hence R/xR has maximal depth. On the other hand, depth R = 1 and mdepth R = 2. Thus, R has no maximal depth. L Proposition 2.6. Let M1 , . . . , Mn be finitely generated R-modules. Then ni=1 Mi has maximal depth if and only if there exists j such that depth Mj ≤ depth Mk for all k and Mj has maximal depth. Ln Proof. depth. Thus there exists an associated   LnSuppose i=1 Mi has maximal Ln Ln prime p of i=1 Mi such that depth i = i=1 Mi = dim R/p. Note that depth L i=1 M n depth Ms where depth Ms ≤ depth Mk for all k. Since p ∈ Ass = i=1 Mi S n i=1 Ass(Mi ), it follows that p ∈ Ass(Ms ) where depth Ms ≤ depth Mk for all k. Indeed, otherwise p ∈ Ass(Ml ) for some l and there exists h such that depth Mh < depth Ml . Hence depth Ms ≤ depth Mh < depth Ml ≤ dim R/p, a contradiction. Therefore, the conclusion follows. The other implication is obvious.  3. Generalized Cohen–Macaulay modules with maximal depth Let (R, m) is a local ring and M a finitely generated R-module. Recall that M is called generalized Cohen–Macaulay module if the local cohomology module Hmi (M) is of finite length for all i < dim M. Recall that a prime ideal p of R is called an attached prime of M if there exists a quotient Q of M such that p = Ann(Q). The 6 set of attached primes of M will be denoted by Att(M). If M is Artinian, this definition is the same as MacDonald’s definition. Note also that Hmi (M) is Artinian for all i ≥ 0, see [1]. Fact 3.1. Let L be an Artinian R-module. Then L 6= 0 if and only if Att(L) 6= ∅, and L 6= 0 is of finite length if and only if Att(L) = {m}, see [1, Corollary 7.2.12]. Fact 3.2. Let p ∈ Ass(M) with dim R/p = j. Att(Hmj (M)), see [1, Exercise 11.3.9]. Then Hmj (M) 6= 0 and p ∈ Proposition 3.3. Assume M has maximal depth with depth M > 0. Then Hmdepth M (M) is not finitely generated. Proof. Our assumption says that there exists p ∈ Ass(M) such that depth M = dim R/p. Fact 3.2 provides p ∈ Att(Hmdepth M (M)) and of course Hmdepth M (M) 6= 0. On the contrary, suppose Hmdepth M (M) is finitely generated. As Hmdepth M (M) is always Artinian, it has finite length and so Att(Hmdepth M (M)) = {m} by Fact 3.1. Hence, p = m. Therefore, depth M = 0, a contradiction.  We have the following classification of generalized Cohen–Macaulay modules with maximal depth. Corollary 3.4. Suppose M is generalized Cohen–Macaulay module with depth M > 0. Then the following statements are equivalent: (a) M has maximal depth, (b) M is sequentially Cohen–Macaulay, (c) M is Cohen–Macaulay. Proof. The implication (c) ⇒ (b) is obvious. The implication (b) ⇒ (c) follows from Proposition 1.4. For (a) ⇒ (c), we need to show depth M = dim M. Suppose depth M < dim M. Since M is generalized Cohen–Macaulay, Hmdepth M (M) is finitely generated. This contradicts with Proposition 3.3. Therefore, depth M = dim M.  Example 3.5. Let S = K[x1 , x2 , x3 , x4 ] be the standard graded polynomial ring with the unique graded maximal ideal m = (x1 , x2 , x3 , x4 ). We set R = S/I where I = p1 ∩ p2 with p1 = (x1 , x2 ) and p2 = (x3 , x4 ). The exact sequence 0 → R → S/p1 ⊕ S/p2 → S/m → 0 yields Hm0 (R) = 0 and Hm1 (R) ∼ = S/m. Hence Hm1 (R) is finitely generated. Therefore, R is generalized Cohen–Macaulay. As depth R = 1 and mdepth R = 2, the ring R has no maximal depth. We end this section with the following remark Remark 3.6. Assume M has maximal depth with depth M > 0. Then Hmdepth M (M) is not finitely generated. On the other hand, since dim M = dim R/p for some p ∈ Ass(M), it follows from Fact 3.2 that Hmdim M (M) is not finitely generated, too. All the non-vanishing local cohomology modules of a sequentially Cohen– Macaulay module are not finitely generated, see the isomorphisms (2). So inspired by these facts, we may ask the following question: Assume M has maximal depth and Hmi (M) 6= 0. Does it follow Hmi (M) is not finitely generated? 7 4. Localization and Attached primes In this section, (R, m) is a local ring and M a finitely generated R-module. We recall the following known fact as Depth Inequality. Fact 4.1. Let p ∈ Supp(M). Then the next inequality holds depth M ≤ depth Mp + dim R/p. We set Assd(M) = {p ∈ Ass(M) : depth M = dim R/p}. Observe that M has maximal depth if and only if Assd(M) 6= ∅. We have the following relation between localization and maximal depth property of M. Proposition 4.2. The following statements hold: (a) If p ∈ Ass(M), then Mp has maximal depth. (b) If p ∈ Supp(M) contains an element of Assd(M), then Mp has maximal depth. Moreover, depth M = depth Mp + dim R/p. Proof. (a): Let p ∈ Ass(M). Then pRp ∈ AssRp (Mp ). It follows that depth Mp = 0, and hence Mp has maximal depth. (b): By our assumption, there exists q ∈ Ass(M) such that depth M = dim R/q with q ⊆ p. Thus qRp ∈ AssRp (Mp ). Hence depth Mp ≤ dim Rp /qRp = height pRp /qRp = height p/q. Observe that dim R/q = depth M ≤ ≤ ≤ = depth Mp + dim R/p height p/q + dim R/p dim R/q − dim R/p + dim R/p dim R/q. Fact 4.1 explains the first step in this sequence and the remaining steps are standard. Consequently, depth Mp = dim Rp /qRp for some qRp ∈ AssRp (Mp ). Therefore, Mp has maximal depth. Furthermore, the desired equality also follows.  Corollary 4.3. If M is Cohen–Macaulay, then Mp has maximal depth for all p ∈ Supp(M). Moreover, depth M = depth Mp + dim R/p. Proof. As p ∈ Supp(M), there exists q ∈ Ass(M) such that q ⊆ p. Since M is Cohen–Macaulay, it is unmixed and so depth M = dim R/q. Hence q ∈ Assd(M). Thus the assumption of Proposition 4.2 is satisfied. Therefore, the conclusion follows.  8 Recall that by Assh(M) we mean the set of all associated primes p ∈ Ass(M) such that dim R/p = dim M. The attached primes of top local cohomology module are known. In fact, Att(Hmdim M (M)) = Assh(M), (1) see [1, Theorem 7.3.2]. In the following we consider the attached primes of Hmi (M) whenever i < dim M. From now on, (R, m) is a local ring which is a homomorphic image of a Gorenstein local ring. Proposition 4.4. Assume p ∈ Supp(M) contains an element of Assd(M). Then min Att(Hmdepth M (M)) = {p ∈ Ass(M) : dim R/p = depth M}. Proof. We set depth M = r. If r = 0, then m ∈ Ass(M) and Hm0 (M) is of finite length. Hence Att(Hm0 (M)) = {m} by Fact 3.1. Therefore, the result holds in this case. Now let r > 0 and p ∈ Assd(M). Thus p ∈ Ass(M) and dim R/p = r. Fact 3.2 provides p ∈ Att(Hmr (M)). We need to show that p is minimal. Suppose q ⊆ p where q ∈ Att(Hmr (M)). By Shifted Localization Principle  0 (M ) = {pRp }, qRp ∈ AttRp HpR p p see, [1, Theorem 11.3.2]. It follows that qRp = pRp and hence p = q. Now let p ∈ min Att(Hmr (M)). Thus Ann M ⊆ Ann Hmr (M) ⊆ p and so p ∈ Supp(M). Our assumption implies q ⊆ p where q ∈ Ass(M) and depth M = dim R/q = r. Hence q ∈ Att(Hmr (M)) by Fact 3.2. Since p is minimal in Att(Hmr (M)), it follows that p = q and hence p ∈ Assd(M).  As a consequence of Proposition 4.4 and (1) we have the following Corollary 4.5. If M is Cohen–Macaulay of dimension d, then Att(Hmd (M)) = min Att(Hmd (M)) = Assd(M) = Ass(M). In the following, we have the attached prime Hmi (M) for all i if M is sequentially Cohen–Macaulay. Proposition 4.6. Let F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Md = M be a Cohen–Macaulay filtration of M. Then Att(Hmi (M)) = Ass(Mi /Mi−1 ) for all i. Moreover, d [ Att(Hmi (M)) = Ass(M), i=0 where d = dim M. Proof. For all i, the exact sequence 0 → Mi−1 → Mi → Mi /Mi−1 → 0 yields (2) H i (M) ∼ = H i (Mi /Mi−1 ), = H i (Mi ) ∼ m m m see [13, Lemma 4.5]. Since Mi /Mi−1 is Cohen-Macaulay, the first desired equality follows from Corollary 4.5. The second equality follows from Fact 1.3. 9 At the end of this section we consider the following fact in [11]. For a finitely generated R-module M, one has AnnR (M/pM) = p for all p ∈ Var(AnnR M). The dual property of this fact for an Artinian module L is : Ann(0 :L p) = p for all p ∈ Var(Ann L). (∗) In [11] it is shown that the local cohomology module Hmi (M) satisfying the property (∗) is equivalent to say that Var(Ann(Hmi (M))) = PsuppiR M where PsuppiR M = i−dim(R/p) {p ∈ Spec(R) : HpRp (Mp ) 6= 0}, see [11, Theorem 3.1]. It is also shown in [11] i that Hm (M) satisfies (∗) with some conditions on R. Proposition 4.7. Assume p ∈ Supp(M) contains an element of Assd(M). Then Hmdepth M (M) satisfies (∗). Proof. We set depth M = r. By [11, Theorem 3.1] we need to show Var(Ann(Hmr (M))) = PsupprR M. Let p ∈ Var(Ann(Hmr (M))). Thus Ann M ⊆ Ann(Hmr (M)) ⊆ p and so p ∈ Supp(M). By our assumption, there exists q ∈ Ass(M) such that q ⊆ p and dim R/q = r. Fact 3.2 provides q ∈ Att(Hmr (M)). By Shifted Localization Principle  r−dim R/p (Mp ) . qRp ∈ AttRp HpRp r−dim R/p It follows that HpRp (Mp ) 6= 0 and hence p ∈ PsupprR M. The other inclusion is proved in the same way.  Corollary 4.8. If M is Cohen–Macaulay of dimension d, then Hmd (M) satisfies (∗). Corollary 4.9. If M is sequentially Cohen–Macaulay, then Hmi (M) satisfies (∗) for all i. Proof. Let F : 0 = M0 ⊂ M1 ⊂ · · · ⊂ Md = M be a Cohen–Macaulay filtration of M. Notice that for all i we have Hmi (M) ∼ = Hmi (Mi /Mi−1 ), see (2). Observe that Var(Ann(Hmi (M))) = Var(Ann(Hmi (Mi /Mi−1 ))) = Psuppi (Mi /Mi−1 ) = Psuppi (M). Therefore, the result follows by [11, Theorem 3.1]. Corollary 4.8 provides the second step in this sequence. To see the third step, let p ∈ Psuppi (Mi /Mi−1 ). Thus i−dim(R/p) HpRp (Mi /Mi−1 )p 6= 0 and so  i−dim(R/p) Att HpRp (Mi /Mi−1 )p 6= ∅. By Weak General Shifted Localization Principle [1, Exercise 11.3.8], there exists  i−dim R/p (Mi /Mi−1 )p ) , qRp ∈ AttRp HpRp  where q ⊆ p and q ∈ Att Hmi (Mi /Mi−1 ) . Hence q ∈ Att(Hmi (M)). By us i−dim R/p (M)p ) . It follows that ing Shifted Localization Principle qRp ∈ AttRp HpRp i−dim R/p HpRp (M)p ) 6= 0 and hence p ∈ Psuppi M. The other inclusion is proved in the same way.  10 Acknowledgment The author would like to thank the referee for the useful comments. References [1] M. Brodmann and R.Y. Sharp, ”Local cohomology”: An algebraic introduction with geometric applications, Cambridge Studies in Advanced Mathematics 60, Cambridge University Press, second edition 2013. [2] W. Bruns and J. Herzog, ”Cohen–Macaulay rings” (Revised edition), Cambridge Studies in Advanced Mathematics 39, Cambridge University Press, 1998. [3] A.Capani, G.Niesi, L.Robbiano: CoCoA, a system for doing Computations in Commutative Algebra. http://cocoa.dima.unige.it. /research/publications.html, 1995. [4] D. Grayson, M. Stillman, D. Eisenbud, Macaulay2, a software system for research in algebraic geometry, available at http://www.math.uiuc.edu/Macaulay2. [5] C. A. Francisco, A. Van Tuyl, Sequentially Cohen–Macaulay edge ideals, Proc. Amer. Math. Soc. 135 (2007), 2327-2337. [6] A. Frübis-Kruger and N. Terai, Bounds for the regularity of monomial ideals, Mathematiche (Catania) 53 (Suppl.) (1998) 83-97. [7] H. T. Ha, H. D. Nguyen, N. V. Trung, and T. N. Turng, Symbolic powers of sums of ideals, arXiv:1702.01766 [math.AC]. [8] J. Herzog, D. Popescu, finite filtration of modules and shellable multicomplexes, manuscripta math, 121 (2006), 385-410. [9] S. Jacques, Betti numbers of graph ideals, Ph.D. Thesis, University of sheffield, 2004. [10] E. Miller, B. Sturmfels, and K. Yanagawa, Generic and cogeneric monomial ideals, J. Symb. Comput., 29 (2000), 691-708. [11] L.T. Nhan and T. N. An, On the unmixedness and universal catenaricity of local rings and local cohomology modules, J. Algebra 321 (2009), 303-311. [12] A. Rahimi, Sequentially Cohen-Macaulayness of bigraded modules, Rocky Mountain J. Math., 47, No. 2 (2017), 621-635. [13] P. Schenzel, On the dimension filtration and Cohen-Macaulay filtered modules, in Proc. of the Ferrara meeting in honour of Mario Fiorentini, University of Antwerp Wilrijk, Belgium (1998), Dekker, New York, 1999, pp. 245-264. Ahad Rahimi, Department of Mathematics, Razi University, Kermanshah, Iran E-mail address: [email protected] 11
0math.AC
1 A study of retrieval algorithms of sparse messages in networks of neural cliques Ala Aboudib*, Vincent Gripon, Xiaoran Jiang** Electronics Department, Télécom Bretagne (Institut Mines-Télécom), Technopôle Brest-Iroise, CS 83818 – 29238 Brest cedex 3, France Abstract--Associative memories are data structures addressed using part of the content rather than an index. They offer good fault reliability and biological plausibility. Among different families of associative memories, sparse ones are known to offer the best efficiency (ratio of the amount of bits stored to that of bits used by the network itself). Their retrieval process performance has been shown to benefit from the use of iterations. However classical algorithms require having prior knowledge about the data to retrieve such as the number of nonzero symbols. We introduce several families of algorithms to enhance the retrieval process performance in recently proposed sparse associative memories based on binary neural networks. We show that these algorithms provide better performance, along with better plausibility than existing techniques. We also analyze the required number of iterations and derive corresponding curves. Keywords--associative memory, sparse coding, artificial neural network, parsimony, clique, distributed algorithms, iterative processing. I. INTRODUCTION A new artificial neural network model was proposed recently by Gripon and Berrou [1]. This model employs principles from the information theory and error correcting codes and aim at explaining the long-term associative memory functionality of the neocortex. The original model introduced in [1] was proved to outperform the celebrated Hopfield neural network [2] in terms of diversity (the number of messages the network can store) and efficiency (the ratio of the amount of useful bits stored to that of bits used to represent the network itself) [3]. In fact this model can be seen as a particular Willshaw sparse associative memory [4] [5] with constraints on the structure that enable improved retrieval algorithms [6]. Despite these constraints, the model offers asymptotically equivalent performance as generic Willshaw networks. In [7], the authors propose improved retrieval algorithms for the original model of [1]. In this paper, we modify the model proposed by Gripon and Berrou in order to provide their networks with more flexibility. We obtain a model similar to the original one proposed by Willshaw while keeping the interesting features of the structure and thus keeping enhanced retrieval algorithms. We introduce a generic formulation of these algorithms, that contain those proposed by Willshaw [4], Palm [8] and Gripon and Berrou [1] *The authors are also with the Laboratory for Science and Technologies of Information, Communication and Knowledge, CNRS Lab-STICC, Brest, France. Tel.: +33770322057, Email addresses: [email protected], [email protected], [email protected]. **This work was partially supported by the European Research Council (ERC-AdG2011 290901 NEUCOD). along with new ones providing better performance. The rest of this paper is organized in seven parts; in section II we describe the general architecture of the network by Gripon and Berrou and explain how it can be extended. Section III introduces a generic formulation of the retrieval algorithm. Then, the following four sections develop each step of this algorithm. For each step, different techniques are reviewed if available. Some of these techniques have been proposed in previous papers, and others we introduce here for the first time. In section XIII, performance comparisons of several combinations of retrieval techniques are presented. Section IX is a conclusion. II. NETWORK TOPOLOGY AND STORING MESSAGES This section focuses on the neural-network-based autoassociative memory introduced by Gripon and Berrou in [1]. It is dedicated to defining this network and describing how it can be extended to store variable-length messages. In part A of this section the raw structure of the network is described. That is, the network structure before any message is stored. After that, we describe in part B how data are structured (stored) within the network in such a way that associative memory functionality emerges. a) Raw Structure The network can be viewed as a graph consisting of vertices initially not connected (zero adjacency matrix) organized in parts called clusters with each vertex belonging to one and only one cluster. Clusters are not necessarily of equal sizes but for simplicity, they will be all considered of size throughout this work. Each cluster is given a unique integer label between and , and within each cluster, every vertex is given a unique label between and . Following from this, each vertex in the network can be referred to by a pair , where is its cluster label, and is the vertex label within cluster . For biologicallyinspired reasons, the authors of [1] use the term fanal instead of vertex. At a given moment , a binary state is associated with each fanal in the network. is given the value if is active and if it is idle. Initially, all fanals are supposed to be idle. The adjacency matrix (also called the weight matrix ) for this graph is a binary symmetric square matrix whose elements take values in where a zero means an absence of a connection while a indicates that a connection is present. Line and column indices are fanals represented as pairs. So in order to indicated that two fanals and ́ ́ are connected, we write . All connection combinations are ́ ́ allowed except those among fanals belonging to the same cluster, resulting in a -partite graph. When the memory is empty, is a zero matrix. 2 b) Message storing procedure Algorithm 1 The retrieval process. This network is designed to store sparse messages of the form | | . So each message consists of integer sub-messages or segments in | | where a refers to a segment that needs not to be stored. We are only interested in storing non-zero submessages. There are of them. For example, in order to store a message in a network with and , each non-zero segment position within this message is interpreted as a cluster label, and the segment value is interpreted as a fanal label within the cluster . Thus, each nonzero segment is associated with a unique fanal . Thus, this example maps to the 10th fanal of the 2nd cluster, the 7th fanal of the 3rd cluster, the 12th fanal of the 5th cluster and the 11th fanal of the 6th (last) cluster. Then, given these elected fanals in distinct clusters, the weight matrix of the network is updated according to equation (1) so that a fully connected sub-graph called a clique is formed of these elected fanals. ́ ́ ́ ́ Insert an Input Message. Apply a dynamic rule. Phase 1: Apply an activation rule. Apply a dynamic rule. Phase 2: While (stopping criterion is not attained) { Apply an activation rule. Apply a dynamic rule. }. output Each step of algorithm 1 is described in detail in the next sections. IV. INPUT MESSAGE INSERTION (1) where and ́ ́ are fanals associated to message segments and ́ respectively. It is important to note that if we wish to store another message ́ that overlaps with . That is, ́ ’s corresponding clique shares one or more connections with that of , the value of these connections, which is , should not be modified, these connections are simply reused. So the storing process is nondestructive and the network’s connection map is the union of all cliques. Figure 1 depicts an example of a network with storing two messages of size . It is worth noting that when , the structure of this network becomes equivalent to the Willshaw model. active fanals. An input message should be fed to the network in order to trigger the retrieval process. For example, suppose that we have a message stored in the network of figure 1 where . Suppose now that we wish to retrieve from the partially erased input . In order to do that, all fanals corresponding to non-zero segments should be activated. That is, a fanal associated with the segment of ̅ at position whose value is is activated by setting . So, activates two fanals: and . It is worth noting that from the point of view of the network, erased segments and segments corresponding to irrelevant clusters i.e. clusters exempted from storing a message, are all seen as zeros and thus they are initially indistinguishable. So, the job of the retrieval process is to determine which clusters are relevant and then to find the fanals within these clusters that represent the searched message. Now, having a number of active fanals, a dynamic rule should be applied. V. DYNAMIC RULES Figure 1 Learning sparse messages. Each message is stored as a clique of fanals belonging to a subset of the overall set of clusters. III. THE RETRIEVAL PROCESS The goal of the retrieval process introduced in this paper is to recover an already stored message (by finding its corresponding clique) from an input message that has undergone partial erasure. A message is erased partially by replacing some of its non-zero segments by zeros. For example, if is a message stored in the network of figure 1, we can imagine ̅ . The core of the retrieval process can be viewed as an iterative twofold procedure composed of a dynamic rule and an activation rule. Algorithm 1 depicts the steps of the retrieval process: A dynamic rule is defined as the rule according to which fanal scores are calculated. We will denote the score of a fanal by . Calculating fanals’ scores is crucial to deciding which ones will be activated. A score is a way to estimate the chance that a fanal belongs to a bigger clique within the set of active fanals and thus the chance that it belongs to the message we are trying to recover. In principle, the higher the score the higher this chance is. Two dynamic rules have been already introduced, namely, the SUM-OF-SUM [1] and the SUM-OF-MAX [6] rules. We also introduce for the first time what we call the NORMALIZATION rule. a) The SUM-OF-SUM rule (SOS) The SUM-OF-SUM is the original rule. It states that the score of a fanal denoted by is simply the number of active fanals connected to plus a predefined memory effect . Scores should be calculated for all of the fanals in the network. This SUM-OF-SUM rule can be formalized by the following equation: ∑∑ ́ ́ ́ ́ (2) 3 Although intuitive, this rule has a major problem which is that in some cases, the scores give a false estimate of the chance that a given fanal belongs to a bigger clique within the set of active fanals. To clarify this point we consider the example of figure 2 where black circles represent active fanals and gray ones represent fanals for which we are going to calculate the scores. According to the SUM-OF-SUM rule, the fanal in the cluster on top-left has a score of while the fanal in the cluster on bottomright has a score of . This result indicates that the latter fanal is more likely to belong to a bigger clique than the former because it has a higher score. This observation is not true since all the active fanals that contribute to that higher score belong to the same cluster and thus no connections are allowed to form among them. In order to solve this problem the SUM-OF-MAX and the NORMALIZATION dynamic rules can be applied. b) The NORMALIZATION rule (NORM) In the NORMALIZATION rule that we introduce here, fanals’ scores are calculated using the following equation: ∑ ́ | ́| ∑ (3) ́ ́ ́ where | ́ | is the number of active fanals in cluster ́. Equation (3) states that the contribution of a fanal ́ ́ to the score of another fanal connected to it is normalized on the number of active fanals in cluster ́. That is, if the cluster ́ contains active fanals, then the contribution of the fanal ́ ́ becomes . So by applying this rule to the network of figure 2, the fanal in the cluster on bottom-right gets a score of and the fanal on top-left gets a score of which is a result that favorises the latter fanal to be activated and thus solves the SUM-OF-SUM rule problem. Figure 2 Dynamic rule application phase. Black-filled fanals are active fanals and gray-filled ones are fanal to which scores are to be calculated. c) The SUM-OF-MAX rule (SOM) According to the SUM-OF_MAX rule, the score of a fanal is the number of clusters in which there is at least one active fanal ́ ́ connected to plus the memory effect : ∑ ́ ́ ( ́ ́ ) (4) So referring back to figure 2, and according to equation (4), the fanal on top-left has a score of where the other fanal on bottom-right has a score of 2. This is a more satisfying result than the one obtained by the SUM-OF-SUM rule since it indicates that the latter fanal, although connected to more active fanals, is less likely to belong to a bigger clique within the set of active fanals than the one on top-left. Moreover, it has been shown in [6] that for the particular case, when , the SUM-OF-MAX rule guarantees that the retrieved massage is always either correct or ambiguous but not wrong. An ambiguous output message means that in some clusters more than one fanal might be activated of which one is the correct fanal. VI. ACTIVATION RULES The activation rule is applied for electing the fanals to be activated based on their scores after application of a dynamic rule. So basically, a fanal is activated if its score satisfies two conditions:  attains a certain value defined by each activation rule.  where is the activation threshold of fanal . [9] The activation rule should be able to find two unknowns: The subset of clusters to which the message we are trying to recover belongs, and the exact fanals within these clusters representing the sub-messages. Two activation rules are introduced in this paper: the Global Winners Take All rule (GWsTA) which is a generalization of the Global Winner Take All (GWTA) rule, and the Global Losers Kicked Out (GLsKO) rule which is a new rule we propose here for the first time. a) The GWsTA rule The GWTA rule introduced in [10] activates only fanals with the network-wide maximal score. The problem with this rule is that it supposes that fanals belonging to the message we are looking for have equal scores. It also supposes that this unified score is maximal which is not necessarily the case. It has been shown in [10] that spurious cliques, i.e. cliques that share one or more edges with the clique we are searching, might appear and render the scores of the shared fanals of the searched clique higher than others’. For example, in the network of figure 2, if the searched clique is , then is a spurious one. Now by applying the SUM-OF-MAX rule on the black and gray fanals which are all supposed active, and considering and that the network contains only the connections shown in the figure, we get the scores: . Thus, according to the GWTA rule, only fanals and will be kept active and the clique is lost. This is caused by the spurious clique which highers the scores of and . The generalization of the GWTA rule we propose is meant to account for this problem. The behavior of the Global Winners Take All rule is the same in both phases of the retrieval process. It elects a subset of fanals with maximal and near-maximal scores to be activated. In other words, it defines a score threshold at each iteration, and only fanals that have at least this score threshold are activated. In order to calculate this score threshold at a given iteration, we first fix an integer parameter . Then we make a list compromising the highest scores in the network including scores that appear more than once. For example, if the fanals scores in a network with are and , then our list becomes . The minimum score in this list which is becomes the score threshold . Then we apply the equation: 4 VII. STOPPING CRITERIONS { (5) It is worth noting that this activation rule is equivalent to the retrieval rule proposed by Willshaw [4] in that fanals are activated by comparing their scores to a fixed threshold . The basic differences is that Willshaw does not specify a rule for choosing and that his retrieval process is not iterative (only one iteration). In this context, the GWsTA rule can be considered as a rule for fixing an optimal value of using the method described above where optimally. One problem with this rule is that the choice of an optimal for a certain message size would not be adapted for other message sizes. This limits the possibility of using this rule for retrieving messages of variable sizes. Moreover, this rule always activates a subset of fanals with maximal and near-maximal scores. But in some cases, when the number of stored messages reaches a high level, the fanals with the maximal score does not necessarily belong to the searched message. b) The GLsKO rule The Global Losers Kicked Out (GLsKO) has a behavior in phase 1 of the retrieval process that differs from that of phase 2 as follows: Phase 1: Apply the GWTA rule. Since the retrieval process is iterative, a stopping criterion should be used in order to put this process to an end. In parts A and B of this section we review the two classic criterions that are already in use. In parts C and D we propose two new ones that are supposed to enhance performance. a) A stopping criterion can be defined as a predefined number of iterations of the retrieval process. So dynamic and activation rules are applied iteratively, and when a counter announces that the desired number of iterations is attained, the retrieval process terminates and the activated fanals are taken for the retrieved message. The problem with this approach is that the stopping criterion which is a simple iteration counter is independent of the nature of retrieved message. That is, the activated fanals after the last iteration are not guaranteed to form a clique corresponding to an already stored message. This stopping criterion is only interesting with the GWsTA rule. b) In phase 1, the GWTA rule is applied resulting in the activation of a subset of fanals to which the searched message is guaranteed to belong. After this, the activation thresholds of inactive fanals are set to infinity because we are no more interested in searching outside the already activated fanals. In phase 2, the rule changes behavior, so, at each iteration, it makes a list compromising the lowest non-zero scores of the active fanals only. For example, if the set { represents the scores of active fanals in a network with and we fix , then the list of lowest scores becomes . After that, a score threshold equals to the maximum score in the latter list is set, and only fanals with scores greater than are kept active. This can be described by the following equation: The convergence criterion (CONV) This criterion states that if the set of active fanals at iteration is the same as that of iteration , the retrieval process is taken as converged so it terminates and the result is output. The convergence criterion is only compatible with the GWsTA rule. In the case of the GLsKO rule, one or more active fanals are deactivated in each iteration. So it is not possible to have the same set of active fanals throughout two subsequent iterations. c) Phase 2: Kick losers out. A fixed number of iterations (ITER) The equal scores criterion (EQSC) The idea we propose for this criterion is that when a point is reached where there are no more losers. Or, in other words, when all scores of active fanals are equal, the retrieval process terminates and the result is output. d) The clique criterion (CLQ) This new criterion depends on the relationship between the number of activate fanals and their scores. If the activate fanals form a clique the retrieval process terminates. Thus the retrieved message is more likely to make sense though it is not necessarily the correct result. In order to check if the activated fanals form a clique, we define as the set of active fanals and as the score of the active fanal , then we apply the following procedure: | |. ( { | | ) (6) An optional property of the GLsKO rule is the ability to determine the number of fanals to be deactivated. Which we found to be only interesting when . For example, if we set and in the network example of the previous paragraph, we get the following list of scores . If is not specified, all losers are deactivated. But since , only one of these two fanals is randomly chosen to be deactivated. This may be useful if we wish to exclude losers one at a time and thus reduce incautious quick decisions. Another property of this rule is that the choice of is independent of the message sizes. This should allow this rule to retrieve stored messages even if they differ in size which is not the case with the GWsTA as we have seen. . To make sense of this stopping criterion, we take an intuitive situation when In this case, the stopping criterion is that when all active fanals have an equal score which is equal to the number of these fanals, a clique is recognized, so the process is terminated and the result is output. It is worth noting that when using the GWsTA rule, it is always preferable to combine any stopping criterion with the ITER criterion to prevent infinite looping since this rule is not guaranteed to always satisfy other stopping criterions. 5 VIII. RESULTS We have seen that there are many possible combinations of dynamic, activation rules and stopping criterions in order to construct a retrieval algorithm. In this section we will demonstrate the performance of some of these combinations. calculating fanals’ scores. b) c) Figure 3 Influence of dynamic rules on retrieval error rates in a network with 𝜒 𝑙 𝑐 𝛾 𝜎𝑖𝑗 initially, with 3 segments of partial erasure in input messages. a) First observation Figure 3 shows that both the SOM and the SOS dynamic rules give the same performance. The NORM rule was found to give the same results also, but it is not shown in the figure for clarity. This is not the case with the original network introduced in [1] where the SUM-OF-MAX rule was proved to give better results [6]. This is an interesting phenomenon that is worth studying. It indicates that the major source of retrieval errors networks string sparse messages is not related to the different methods of Second observation We notice in figure 4 that the GWsTA ( ) rule gives a better performance than GWTA (GWsTA, ) used with the CONV stopping criterion combined with a maximum possible number of iterations of . We also notice that the GWsTA ( gives a lower error rate when the memory effect However, the GLsKO ( , ) rule using the EQSC or the CLQ (not shown on the figure for clarity) stopping criterion has the lowest error rate which attains the performance of the brute force retrieval algorithm (ML) for this amount of input erasure. But the performance of the GLsKO rule with and unspecified degrades. It is also worth pointing out that the GWsTA ( ) rule with one iteration which is equivalent to the retrieval rule proposed by Willshaw [4] gives a result similar to that of the GWTA rule used with the CONV and ITER stopping criterions which turns out to be the worst performance. This proves that combining iterations with a proper activation threshold significantly improves performance as shown in [8]. Third observation Figure 5 shows that the average number of iterations required to retrieve a message is relatively constant for all rules up to messages learnt. Beyond this, the number of iterations required for the GLsKO and the GWsTA rules with begins to increase rapidly. It is worth emphasizing that the maximum number of iterations allowed for the GWsTA rule is 30 so the constant level reached by the curve representing this rule with in figure 5 is just a result of that constraint. However, the number of iterations for the GWsTA rule with increases only slightly approaching an average of 3.3 up to 250000 messages learnt. Figure 5 Average number of iterations for different scenarios in a network with 𝜒 𝑙 𝑐 𝛾 if not st ted otherwise 𝜎𝑖𝑗 initially, with 3 segments of partial erasure in input messages. IX. CONCLUSION Figure 4 Influence of activation rules on retrieval error rates in a network with 𝜒 𝑙 𝑐 𝛾 if not st ted otherwise 𝜎𝑖𝑗 initially, with 3 segments of partial erasure in input messages. In this paper, we presented all existing retrieval algorithms and suggested new ones for a recently invented sparse associative memory model. We also demonstrated and compared the performance of these algorithms when using partially erased 6 messages as inputs. We aim to extend the scope of the algorithms presented in this paper to deal with other types of input messages such as distorted ones. We found that the GLsKO activation rule combined with the equal scores or the clique stopping criterions gives the best results in terms of retrieval error rate but with a rapidly increasing number of iterations. Actually, the second phase of the GLsKO rule along with the clique criterion can be viewed as an operation equivalent to searching the maximum clique among active fanals. This is a famous NP-complete problem with no optimal solution yet. However, many sub-optimal solutions were suggested for this problem (or equivalently, the minimum vertex cover problem) such as [11] [12] and many more. We believe that such sub-optimal solutions are adaptable to our problem and can be integrated in our retrieval algorithm in the future in order to give a better performance with a more reasonable number of iterations. Finally, the retrieval algorithms presented in this work are all synchronous in the sense that, at each iteration, dynamic and activation rules are always applied to all clusters. In future work, we will consider asynchronous methods which can take into account the fact that some clusters may reach their final state before others, so application of dynamic and activation rules could then be limited to only a subset of clusters. ACKNOWLEDGMENT The authors would like to thank Zhe Yao and Michael Rabbat at McGill University for interesting discussions that helped leading to the proposal of the new retrieval techniques introduced in this paper. We also acknowledge funding from the NEUCOD project at the electronics department of Télécom Bretagne. REFERENCES [1] V. Gripon and C. Berrou, "Sparse neural networks with large learning diversity," IEEE Transactions on Neural Networks, vol. 22, no. 7, pp. 1087-1096, 2011. [2] J.J. Hopfield, "Neural networks and physical systems with emergent collective computational abilities," Proceedings of the National Academy of Science, USA, vol. 79, pp. 2554-2558, 1982. [3] V Gripon and M Rabbat, "Maximum Likelihood Associative Memories," in Proceedings of Information Theory Workshop, 2013. [4] D. J. Willshaw, O. P. Buneman, and H. C. Longuet-Higgins, "Nonholographic associative memory," Nature, vol. 222, pp. 960-962, 1969. [5] G. Palm, "Neural associative memories and sparse coding," Neural Networks., vol. 37, pp. 165-171, 2013. [6] V. Gripon and C. Berrou, "Nearly-optimal associative memories based on distributed constant weight codes," in Proceedings of Information Theory and Applications Workshop, USA, 2012, pp. 269-273. [7] Z. Yao, V. Gripon, and M. G. Rabbat, "A massively parallel associative memory based on sparse neural networks," Submitted to IEEE Transactions on Neural Networks and Learning Systems, arXiv:1303.7032v1 [cs.AI]. [8] F. T. Sommer and G. Palm, "Improved bidirectional retrieval of sparse patterns stored by Hebbian learning," Neural Networks, vol. 12, no. 2, pp. 281-297, 1999. [9] W. S. McCulloch and W. Pitts, "A logical calculus of the ideas immanent in nervous activity," The Bulletin of Mathematical Biophysics, vol. 5, no. 4, pp. 115-133, 1943. [10] B. K. Aliabadi, C. Berrou, V. Gripon, and X. Jiang, "Learning sparse messages in networks of neural cliques," Submitted to IEEE Transactions on Neural Networks and Learning Systems, arXiv:1208.4009v1 [cs.NE], 2012. [11] X. Xu and J. Ma, "An efficient simulated annealing algorithm for the minimum vertex cover problem," Neurocomputing, vol. 69, no. 7, pp. 913-916, 2006. [12] X. Geng, J. Xu, J. Xiao, and L. Pan, "A simple simulated annealing algorithm for the maximum clique problem," Information Sciences, vol. 177, no. 22, pp. 5064-5071, 2007.
9cs.NE
Under review as a conference paper at ICLR 2015 L EARNING TO E XECUTE Wojciech Zaremba∗ New York University [email protected] arXiv:1410.4615v3 [cs.NE] 19 Feb 2015 Ilya Sutskever Google [email protected] A BSTRACT Recurrent Neural Networks (RNNs) with Long Short-Term Memory units (LSTM) are widely used because they are expressive and are easy to train. Our interest lies in empirically evaluating the expressiveness and the learnability of LSTMs in the sequence-to-sequence regime by training them to evaluate short computer programs, a domain that has traditionally been seen as too complex for neural networks. We consider a simple class of programs that can be evaluated with a single left-to-right pass using constant memory. Our main result is that LSTMs can learn to map the character-level representations of such programs to their correct outputs. Notably, it was necessary to use curriculum learning, and while conventional curriculum learning proved ineffective, we developed a new variant of curriculum learning that improved our networks’ performance in all experimental conditions. The improved curriculum had a dramatic impact on an addition problem, making it possible to train an LSTM to add two 9-digit numbers with 99% accuracy. ∗ 1 I NTRODUCTION Execution of computer programs requires dealing with a number of nontrivial concepts. To execute a program, a system has to understand numerical operations, if-statements, variable assignments, the compositionality of operations, and many more. We show that Recurrent Neural Networks (RNN) with Long Short-Term Memory (LSTM) units can accurately evaluate short simple programs in the sequence-to-sequence framework of Sutskever et al. (2014). The LSTM reads the program character-by-character and computes the program’s output. We consider a constrained set of computer programs that can be evaluated in linear time and constant memory, because the LSTM reads the program only once and its memory capacity is limited (Section 3). We found it difficult to train LSTMs to execute computer programs, so we used curriculum learning to simplify the learning problem. We design a curriculum procedure which outperforms both conventional training that uses no curriculum learning (baseline) as well as the naive curriculum learning of strategy of Bengio et al. (2009) (Section 4). We provide a plausible explanation for the effectiveness of our procedure relative to naive curriculum learning (Section 7). Finally, in addition to curriculum learning strategies, we examine two simple input transformations that further simplify the sequence-to-sequence learning problem. We show that, in many cases, reversing the input sequence (Sutskever et al., 2014) and replicating the input sequence improves the LSTM’s performance on a memorization task (Section 3.2). The code for replicating most of the experiments in this work can be found in https://github. com/wojciechz/learning_to_execute. ∗ Work done while the author was in Google Brain. 1 Under review as a conference paper at ICLR 2015 Input: j=8584 for x in range(8): j+=920 b=(1500+j) print((b+7567)) Target: 25011. Input: i=8827 c=(i-5347) print((c+8704) if 2641<8500 else 5308) Target: 12184. Figure 1: Example programs on which we train the LSTM. The output of each program is a single integer. A “dot” symbol indicates the end of the integer, which has to be predicted by the LSTM. 2 R ELATED WORK There has been related research that used Tree Neural Networks (also known as Recursive Neural Networks) to evaluate symbolic mathematical expressions and logical formulas (Zaremba et al., 2014a; Bowman et al., 2014; Bowman, 2013), which is close in spirit to our work. Computer programs are more complex than mathematical or logical expressions because it is possible to simulate either with an appropriate computer program. From a methodological perspective, we formulate the program evaluation task as a sequenceto-sequence learning problem with a recurrent neural network (Sutskever et al., 2014) (see also (Mikolov, 2012; Sutskever, 2013; Pascanu et al., 2013)). Other interesting applications of recurrent neural networks include speech recognition (Robinson et al., 1996; Graves et al., 2013), machine translation (Cho et al., 2014; Sutskever et al., 2014), handwriting recognition (Pham et al., 2013; Zaremba et al., 2014b), and many more. Maddison & Tarlow (2014) trained a language model of program text, and Mou et al. (2014) used a neural network to determine whether two programs are equivalent. Both of these approaches require the parse trees of programs, while the input to our model is a string of character representing our program. Predicting program output requires that the model deals with long term dependencies that arise from variable assignment. For this reason, we chose to use the Long Short-Term Memory model (Hochreiter & Schmidhuber, 1997), although there are many other RNN variants that perform well on tasks with long term dependencies (Cho et al., 2014; Jaeger et al., 2007; Koutnı́k et al., 2014; Martens, 2010; Bengio et al., 2013). Initially, we found it difficult to train LSTMs to accurately evaluate programs. The compositional nature of computer programs suggests that the LSTM would learn faster if we first taught it about the individual operators and how to combine them. This approach can be implemented with curriculum learning (Bengio et al., 2009; Kumar et al., 2010; Lee & Grauman, 2011), which prescribes to gradually increase the “difficulty level” of the examples presented to the LSTM. It is partially motivated by fact that humans and animals learn much faster when they are given hard but manageable tasks. Unfortunately, we found the naive curriculum learning strategy of Bengio et al. (2009) to sometimes be harmful. One of our key contributions is the formulation of a new curriculum learning strategy that substantially improves the speed and the quality of training in every experimental setting that we considered. 3 P ROGRAM S UBCLASS We train RNNs on the class of short programs that can be evaluated in O (n) time and constant memory. This restriction is dictated by the computational structure of the RNN itself, as it can only 2 Under review as a conference paper at ICLR 2015 Input: vqppkn sqdvfljmnc y2vxdddsepnimcbvubkomhrpliibtwztbljipcc Target: hkhpg Figure 2: A sample program with its outputs when the characters are scrambled. It helps illustrate the difficulty faced by our neural network. perform a single pass over the program and its memory is limited. Our programs use the Python syntax and are constructed from a small number of operations and their compositions (nesting). We allow the following operations: addition, subtraction, multiplication, variable assignments, ifstatements, and for-loops, but we forbid double loops. Every program ends with a single “print” statement whose output is an integer. Two example programs are shown in Figure 1. We select our programs from a family of distributions parametrized by their length and nesting. The length parameter is the number of digits in the integers that appear in the programs (so the integers are chosen uniformly from [1, 10length ]). The appendix presents the pseudocode 1 of the algorithm used to generate our programs. For example, two programs that are generated with length = 4 and nesting = 3 are shown in Figure 1. We impose restrictions on the operands of multiplication and on the ranges of for-loop, since they pose a greater difficulty to our model. We constrain one of the arguments of multiplication and the range of for-loops to be chosen uniformly from the much smaller range [1, 4· length]. We do so since our models are able to perform linear-time computation while generic integer multiplication requires superlinear time. Similar considerations apply to for-loops, since nested for-loops can implement integer multiplication. The nesting parameter is the number of times we are allowed to combine the operations with each other. Higher values of nesting yield programs with deeper parse trees. Nesting makes the task much harder for the LSTMs, because they do not have a natural way of dealing with compositionality, unlike Tree Neural Networks. It is surprising that the LSTMs can handle nested expressions at all. The programs also do not receive an external input. It is important to emphasize that the LSTM reads the entire input one character at a time and produces the output one character at a time. The characters are initially meaningless from the model’s perspective; for instance, the model does not know that “+” means addition or that 6 is followed by 7. In fact, scrambling the input characters (e.g., replacing “a” with “q”, “b” with “w”, etc.,) has no effect on the model’s ability to solve this problem. We demonstrate the difficulty of the task by presenting an input-output example with scrambled characters in Figure 2. Finally, we wanted to verify that our program are not trivial to evaluate, by ensuring that the bias coming from Benford’s law (Hill, 1995) is not too strong. Our setup has 12 possible output characters, that is 10 digits, the end of sequence character, and minus. Their output distribution is not uniform, which can be seen by noticing that the minus sign and the dot do not occur with the same frequency as the other digits. If we assume that the output characters are independent, the probability of guessing the correct character is ∼ 8.3%. The most common character is 1 which occurs with probability 12.7% over the entire output. However, there is a bias in the distribution of the first character. There are 11 possible choices, which can be randomly guessed with a probability of 9%. The most common character is 1, and it occurs with a probability 20.3% in its first position, indicating a strong bias. Still, this value is far below our model prediction accuracy. Moreover, the most probable second character in the first position of the output occurs with probability 12.6%, which is indistinguishable from probability distribution of digits in the other positions. The last character is always the end of sequence. The most common digit prior to the last character is 4, and it occures with probability 10.3%. These statistics are computed with 10000 randomly generated programs with length = 4 and nesting = 1. The absence of a strong bias for this configuration suggests that there will be even less bias in with greater nesting and longer digits, which we have also confirmed numerically. 3 Under review as a conference paper at ICLR 2015 Input: print(398345+425098) Target: 823443 Figure 3: A typical data sample for the addition task. 3.1 A DDITION TASK It is difficult to intuitively assess the accuracy of an LSTM on a program evaluation task. For example, it is not clear whether an accuracy of 50% is impressive. Thus, we also evaluate our models on a more familiar addition task, where the difficulty is measured by the length of the inputs. We consider the addition of only two numbers of the same length (Figure 3) that are chosen uniformly from [1, 10length ]. Adding two number of the same length is simpler than adding variable length numbers. Model doesn’t need to align them. 3.2 M EMORIZATION TASK In addition to program evaluation and addition, we also investigate the task of memorizing a random sequence of numbers. Given an example input 123456789, the LSTM reads it one character at a time, stores it in memory, and then outputs 123456789 one character at a time. We present and explore two simple performance enhancing techniques: input reversing Sutskever et al. (2014) and input doubling. The idea of input reversing is to reverse the order of the input (987654321) while keeping the desired output unchanged (123456789). It may appear to be a neutral operation because the average distance between each input and its corresponding target does not change. However, input reversing introduces many short term dependencies that make it easier for the LSTM to learn to make correct predictions. This strategy was first introduced by Sutskever et al. (2014). The second performance enhancing technique is input doubling, where we present the input sequence twice (so the example input becomes 123456789; 123456789), while the output remains unchanged (123456789). This method is meaningless from a probabilistic perspective as RNNs approximate the conditional distribution p(y|x), yet here we attempt to learn p(y|x, x). Still, it gives noticeable performance improvements. By processing the input several times before producing the output, the LSTM is given the opportunity to correct any mistakes or omissions it made before. 4 C URRICULUM L EARNING Our program generation procedure is parametrized by length and nesting. These two parameters allow us control the complexity of the program. When length and nesting are large enough, the learning problem becomes nearly intractable. This indicates that in order to learn to evaluate programs of a given length = a and nesting = b, it may help to first learn to evaluate programs with length  a and nesting  b. We evaluate the following curriculum learning strategies: No curriculum learning (baseline) The baseline approach does not use curriculum learning. This means that we generate all the training samples with length = a and nesting = b. This strategy is the most “sound” from statistical perspective, since it is generally recommended to make the training distribution identical to test distribution. Naive curriculum strategy (naive) We begin with length = 1 and nesting = 1. Once learning stops making progress on the validation set, we increase length by 1. We repeat this process until its length reaches a, in which case we increase nesting by one and reset length to 1. We can also choose to first increase nesting and then length. However, it does not make a noticeable difference in performance. We skip this option in the rest of paper, and increase length first in all our experiments. This strategy is has been examined in previous work on curriculum learning (Bengio et al., 2009). However, we show that sometimes it gives even worse performance than baseline. Mixed strategy (mix) To generate a random sample, we first pick a random length from [1, a] and a random nesting from [1, b] independently for every sample. The Mixed strategy uses a balanced 4 Under review as a conference paper at ICLR 2015 mixture of easy and difficult examples, so at every point during training, a sizable fraction of the training samples will have the appropriate difficulty for the LSTM. Combining the mixed strategy with naive curriculum strategy (combined) This strategy combines the mix strategy with the naive strategy. In this approach, every training case is obtained either by the naive strategy or by the mix strategy. As a result, the combined strategy always exposes the network at least to some difficult examples, which is the key way in which it differs from the naive curriculum strategy. We noticed that it always outperformed the naive strategy and would generally (but not always) outperform the mix strategy. We explain why our new curriculum learning strategies outperform the naive curriculum strategy in Section 7. We evaluate these four strategies on the program evaluation task (Section 6.1) and on the memorization task (Section 6.3). 5 LSTM In this section we briefly describe the deep LSTM (Section 5). All vectors are n-dimensional unless explicitly stated otherwise. Let hlt ∈ Rn be a hidden state in layer l in timestep t. Let Tn,m : Rn → Rm be a biased linear mapping (x → W x + b for some W and b). We let be element-wise multiplication and let h0t be the input to the deep LSTM at timestep t. We use the activations at the top layer L (namely hL t ) to predict yt where L is the depth of our LSTM. The structure of the LSTM allows it to train on problems with long term dependencies relatively easily. The “long term” memory is stored in a vector of memory cells clt ∈ Rn . Although many LSTM architectures differ slightly in their connectivity structure and activation functions, all LSTM architectures have additive memory cells that make it easy to learn to store information for long periods of time. We used an LSTM described by the following equations (from Graves et al. (2013)): l l l l LSTM : hl−1 t , ht−1 , ct−1 → ht , ct     sigm i  l−1  f  sigm ht T =  o  sigm 2n,4n hlt−1 tanh g 6 clt = f clt−1 + i hlt tanh(clt ) =o g E XPERIMENTS In this section, we report the results of our curriculum learning strategies on the program evaluation and memorization tasks. In both experiments, we used the same LSTM architecture. Our LSTM has two layers and is unrolled for 50 steps in both experiments. It has 400 cells per layer and its parameters are initialized uniformly in [−0.08, 0.08]. This gives total ∼ 2.5M parameters. We initialize the hidden states to zero. We then use the final hidden states of the current minibatch as the initial hidden state of the subsequent minibatch. Thus it is possible that a program and its output could be separated across different minibatches. The size of minibatch is 100. We constrain the norm of the gradients (normalized by minibatch size) to be no greater than 5 (Mikolov et al., 2010). We keep the learning rate equal to 0.5 until we reach the target length and nesting (we only vary the length, i.e., the number of digits, in the memorization task). After reaching the target accuracy (95%) we decrease the learning rate by 0.8. We keep the learning rate on the same level until there is no improvement on the training set. We decrease it again, when there is no improvement on training set. The only difference between experiments is the termination criteria. For the program output prediction, we stop when learning rate becomes smaller than 0.001. For copying task, we stop training after 20 epochs, where each epoch has 0.5M samples. We begin training with length = 1 and nesting = 1 (or length=1 for the memorization task). We ensure that the training, validation, and test sets are disjoint. It is achieved computing the hash value of each sample and taking it modulo 3. Important note on error rates: We use teacher forcing when we compute the accuracy of our LSTMs. That is, when predicting the i-th digit of the target, the LSTM is provided with the correct 5 Under review as a conference paper at ICLR 2015 first i − 1 digits of the target. This is different from using the LSTM to generate the entire output on its own, as done by Sutskever et al. (2014), which would almost surely result in lower numerical accuracies. To help make intuitive sense of our results, we present a large number of test cases and the outputs computed by the LSTM, albeit with teacher forcing. 6.1 R ESULTS ON P ROGRAM E VALUATION We train our LSTMs using the four strategies described in Section 4: • • • • No curriculum learning (baseline), Naive curriculum strategy (naive) Mixed strategy (mix), and Combined strategy (combined). Figure 4 shows the absolute performance of the baseline strategy (training on the original target distribution), and of the best performing strategy, combined. Moreover, Figure 5 shows the performance of the three curriculum strategies relative to baseline. Finally, we provide several example predictions on test data in the supplementary materials. The accuracy of a random predictor would be ∼ 8.3%, since there are 12 possible output symbols. Figure 4: Absolute prediction accuracy of the baseline strategy and of the combined strategy (see Section 4) on the program evaluation task. Deeper nesting and longer integers make the task more difficult. Overall, the combined strategy outperformed the baseline strategy in every setting. Figure 5: Relative prediction accuracy of the different strategies with respect to the baseline strategy. The Naive curriculum strategy was found to sometime perform worse than baseline. A possible explanation is provided in Section 7. The combined strategy outperforms all other strategies in every configuration on program evaluation. 6.2 R ESULTS ON THE A DDITION TASK Figure 6 presents the accuracy achieved by the LSTM with the various curriculum strategies on the addition task. Remarkably, the combined curriculum strategy resulted in 99% accuracy on the addition of 9-digit long numbers, which is a massive improvement over the naive curriculum. 6.3 R ESULTS ON THE M EMORIZATION TASK Recall that the goal of the memorization task is to read a sequence of digits into the hidden state and then to reconstruct it from the hidden state. Namely, given an input such as 123456789, the goal is 6 Under review as a conference paper at ICLR 2015 Figure 6: The effect of curriculum strategies on the addition task. Figure 7: Prediction accuracy on the memorization task for the four curriculum strategies. The input length ranges from 5 to 65 digits. Every strategy is evaluated with the following 4 input modification schemes: no modification; input inversion; input doubling; and input doubling and inversion. The training time was not limited; the network was trained till convergence. to produce the output 123456789. The model processes the input one input character at the time and has to reconstruct the output only after loading the entire input into its memory. This task provides insight into the LSTM’s ability to learn to remember. We have evaluated our model on sequences of lengths ranging from 5 to 65. We use the four curriculum strategies of Section 4. In addition, we investigate two strategies to modify the input which increase performance: • Inverting input (Sutskever et al., 2014) • Doubling Input Both strategies are described in Section 3.2. Figure 7 shows the absolute performance of the baseline strategy and of the combined strategy. This Figure shows the performance at convergence. We further present in Supplementary material (Section 9) results after 20 epochs (Figure 8). For this task, the combined strategy no longer outperforms the mixed strategy in every experimental setting, although both strategies are always better than using no curriculum and the naive curriculum strategy. Each graph contains 4 settings, which correspond to the possible combinations of input inversion and input doubling. The result clearly shows that the simultaneously doubling and reversing the input achieves the best results. Random guessing would achieve an accuracy of ∼ 9%, since there are 11 possible output symbols. 7 H IDDEN S TATE A LLOCATION H YPOTHESIS Our experimental results suggest that a proper curriculum learning strategy is critical for achieving good performance on very hard problems where conventional stochastic gradient descent (SGD) 7 Under review as a conference paper at ICLR 2015 performs poorly. The results on both of our problems (Sections 6.3 and 6.1) show that the combined strategy is better than all other curriculum strategies, including both naive curriculum learning, and training on the target distribution. We have a plausible explanation for why this is the case. It seems natural to train models with examples of increasing difficulty. This way the models have a chance to learn the correct intermediate concepts, and then utilize them for the more difficult problem instances. Otherwise, learning the full task might be just too difficult for SGD from a random initialization. This explanation has been proposed in previous work on curriculum learning Bengio et al. (2009). However, based the on empirical results, the naive strategy of curriculum learning can sometimes be worse than learning with the target distribution. In our tasks, the neural network has to perform a lot of memorization. The easier examples usually require less memorization than the hard examples. For instance, in order to add two 5-digit numbers, one has to remember at least 5 digits before producing any output. The best way to accurately memorize 5 numbers could be to spread them over the entire hidden state / memory cell (i.e., use a distributed representation). Indeed, the network has no incentive to utilize only a fraction of its state, and it is always better to make use of its entire memory capacity. This implies that the harder examples would require a restructuring of its memory patterns. It would need to contract its representations of 5 digit numbers in order to free space for the 6-th number. This process of memory pattern restructuring might be difficult to implement, so it could be the reason for the sometimes poor performance of the naive curriculum learning strategy relative to baseline. The combined strategy reduces the need to restructure the memory patterns. The combined strategy is a combination of the naive curriculum strategy and of the mix strategy, which is a mixture of examples of all difficulties. The examples produced by the naive curriculum strategy help to learn the intermediate input-output mapping, which is useful for solving the target task, while the extra samples from the mix strategy prevent the network from utilizing all the memory on the easy examples, thus eliminating the need to restructure its memory patterns. 8 C RITIQUE Perfect prediction of program output requires a complete understanding of all operands and concepts, and of the precise way in which they are combined. However, imperfect prediction might be achieved in a multitude of ways, and could heavily rely on memorization, without a genuine understanding of the underlying concepts. For instance, perfect addition is relatively intricate, as the LSTM needs to know the order of numbers and to correctly compute the carry. There are many alternatives to the addition algorithm if perfect output is not required. For instance, one can perform element-wise addition, and as long as there is no carry then the output would be perfectly correct. Another alternative, which requires more memory, but is also more simpler, is to memorize all results of addition for 2 digit numbers. Then multi-digit addition can be broken down to multiple 2-digits additions element-wise. Once again, such an algorithm would have a reasonably high prediction accuracy, although it would be far from correct. We do not know how heavily our model relies on memorization and how far the learned algorithm is from the actual, correct algorithm. This could be tested by creating a big discrepancy between the training and test data, but in this work, the training and the test distributions are the same. We plan to examine how well our models would generalize on very different new examples in future work. 9 D ISCUSSION We have shown that it is possible to learn to evaluate programs with limited prior knowledge. This work demonstrate the power and expressiveness of sequence-to-sequence LSTMs. We also showed that correct curriculum learning is crucial for achieving good results on very difficult tasks that cannot be optimized with standard SGD. We also found that the general method of doubling the input reliably improves the performance of sequence-to-sequence LSTMs. Our results are encouraging but they leave many questions open. For example, we are not able to evaluate arbitrary programs (e.g., ones that run in more than O (n) time). This cannot be achieved with conventional RNNs or LSTMs due to their runtime restrictions. We also do not know the 8 Under review as a conference paper at ICLR 2015 optimal curriculum learning strategy. To understand it, it may be necessary to identify the training samples that are most beneficial to the model. 10 ACKNOWLEDGMENTS We wish to thank Oriol Vinyals for useful discussions, and to Koray Kavukcuoglu for help during code development. Moreover, we wish to acknowledge Marc’Aurelio Ranzato for useful comments on the first version of the paper. Some chunks of our code origin from Google Deepmind repository. We thank to unknown developers of LSTM function, and auxiliary functions. R EFERENCES Bengio, Yoshua, Louradour, Jérôme, Collobert, Ronan, and Weston, Jason. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pp. 41–48. ACM, 2009. Bengio, Yoshua, Boulanger-Lewandowski, Nicolas, and Pascanu, Razvan. Advances in optimizing recurrent networks. In Acoustics, Speech and Signal Processing (ICASSP), 2013 IEEE International Conference on, pp. 8624–8628. IEEE, 2013. Bowman, Samuel R. Can recursive neural tensor networks learn logical reasoning? arXiv preprint arXiv:1312.6192, 2013. Bowman, Samuel R, Potts, Christopher, and Manning, Christopher D. Recursive neural networks for learning logical semantics. arXiv preprint arXiv:1406.1827, 2014. Cho, Kyunghyun, van Merrienboer, Bart, Gulcehre, Caglar, Bougares, Fethi, Schwenk, Holger, and Bengio, Yoshua. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. Graves, Alex, Mohamed, Abdel-rahman, and Hinton, Geoffrey. Speech recognition with deep recurrent neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2013 IEEE International Conference on, pp. 6645–6649. IEEE, 2013. Hill, Theodore P. A statistical derivation of the significant-digit law. Statistical Science, pp. 354–363, 1995. Hochreiter, Sepp and Schmidhuber, Jürgen. Long short-term memory. Neural computation, 9(8):1735–1780, 1997. Jaeger, Herbert, Lukoševičius, Mantas, Popovici, Dan, and Siewert, Udo. Optimization and applications of echo state networks with leaky-integrator neurons. Neural Networks, 20(3):335–352, 2007. Koutnı́k, Jan, Greff, Klaus, Gomez, Faustino, and Schmidhuber, Jürgen. A clockwork rnn. arXiv preprint arXiv:1402.3511, 2014. Kumar, M Pawan, Packer, Benjamin, and Koller, Daphne. Self-paced learning for latent variable models. In Advances in Neural Information Processing Systems, pp. 1189–1197, 2010. Lee, Yong Jae and Grauman, Kristen. Learning the easy things first: Self-paced visual category discovery. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 1721–1728. IEEE, 2011. Maddison, Chris J and Tarlow, Daniel. Structured generative models of natural source code. arXiv preprint arXiv:1401.0514, 2014. Martens, James. Deep learning via hessian-free optimization. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 735–742, 2010. Mikolov, Tomáš. Statistical language models based on neural networks. PhD thesis, Ph. D. thesis, Brno University of Technology, 2012. Mikolov, Tomas, Karafiát, Martin, Burget, Lukas, Cernockỳ, Jan, and Khudanpur, Sanjeev. Recurrent neural network based language model. In INTERSPEECH, pp. 1045–1048, 2010. Mou, Lili, Li, Ge, Liu, Yuxuan, Peng, Hao, Jin, Zhi, Xu, Yan, and Zhang, Lu. Building program vector representations for deep learning. arXiv preprint arXiv:1409.3358, 2014. Pascanu, Razvan, Gulcehre, Caglar, Cho, Kyunghyun, and Bengio, Yoshua. How to construct deep recurrent neural networks. arXiv preprint arXiv:1312.6026, 2013. Pham, Vu, Kermorvant, Christopher, and Louradour, Jérôme. Dropout improves recurrent neural networks for handwriting recognition. arXiv preprint arXiv:1312.4569, 2013. Robinson, Tony, Hochberg, Mike, and Renals, Steve. The use of recurrent neural networks in continuous speech recognition. In Automatic speech and speaker recognition, pp. 233–258. Springer, 1996. Sutskever, Ilya. Training Recurrent Neural Networks. PhD thesis, University of Toronto, 2013. Sutskever, Ilya, Vinyals, Oriol, and Le, Quoc V. Sequence to sequence learning with neural networks. arXiv preprint arXiv:1409.3215, 2014. Zaremba, Wojciech, Kurach, Karol, and Fergus, Rob. Learning to discover efficient mathematical identities. arXiv preprint arXiv:1406.1584, 2014a. Zaremba, Wojciech, Sutskever, Ilya, and Vinyals, Oriol. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014b. 9 Under review as a conference paper at ICLR 2015 S UPPLEMENTARY MATERIAL Input: length, nesting stack = EmptyStack() Operations = Addition, Subtraction, Multiplication, If-Statement, For-Loop, Variable Assignment for i = 1 to nesting do Operation = a random operation from Operations Values = List Code = List for params in Operation.params do if not empty stack and Uniform(1) > 0.5 then value, code = stack.pop() else value = random.int(10length ) code = toString(value) end if values.append(value) code.append(code) end for new value= Operation.evaluate(values) new code = Operation.generate code(codes) stack.push((new value, new code)) end for final value, final code = stack.pop() datasets = training, validation, testing idx = hash(final code) modulo 3 datasets[idx].add((final value, final code)) Algorithm 1: Pseudocode of the algorithm used to generate the distribution over the python program. Programs produced by this algorithm are guaranteed to never have dead code. The type of the sample (train, test, or validation) is determined by its hash modulo 3. 11 A DDITIONAL R ESULTS ON THE M EMORIZATION P ROBLEM We present the algorithm for generating the training cases, and present an extensive qualitative evaluation of the samples and the kinds of predictions made by the trained LSTMs. We emphasize that these predictions rely on teacher forcing. That is, even if the LSTM made an incorrect prediction in the i-th output digit, the LSTM will be provided as input the correct i-th output digit for predicting the i + 1-th digit. While teacher forcing has no effect whenever the LSTM makes no errors at all, a sample that makes an early error and gets the remainder of the digits correctly needs to be interpreted with care. 12 Q UALITATIVE EVALUATION OF THE CURRICULUM STRATEGIES 12.1 E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 4, N ESTING = 1 Input: print(6652). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 6652. 6652. 6652. 6652. 6652. Input: 10 Under review as a conference paper at ICLR 2015 Figure 8: Prediction accuracy on the memorization task for the four curriculum strategies. The input length ranges from 5 to 65 digits. Every strategy is evaluated with the following 4 input modification schemes: no modification; input inversion; input doubling; and input doubling and inversion. The training time is limited to 20 epochs. print((5997-738)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 5259. 5101. 5101. 5249. 5229. Input: print((16*3071)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 49136. 49336. 48676. 57026. 49626. Input: c=2060; print((c-4387)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -2327. -2320. -2201. -2377. -2317. Input: print((2*5172)). 11 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 10344. 10344. 10324. 10344. 10344. Input: print((9891-4715)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 5176. 5196. 5104. 4246. 5196. Input: print(4849). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 4849. 4849. 4849. 4849. 4849. Input: print((4*7054)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 28216. 28216. 28116. 28216. 28216. Input: print((4635-5257)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -622. -688. -628. -692. -632. Input: e=1079 for x in range(10):e+=4729 print(e). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 12.2 48369. 48017. 48011. 48101. 48009. E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 4, N ESTING = 2 Input: 12 Under review as a conference paper at ICLR 2015 e=6653 for x in range(14):e+=6311 print(e). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 95007. 94093. 90013. 95015. 94103. Input: i=6404; print((i+8074)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 14478. 14498. 14444. 14482. 14478. Input: print((8*(5051-648))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 35224. 34044. 32180. 33284. 33004. Input: h=(3681 if 9279<3033 else 6191) for x in range(7):h-=9910 print(h). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -63179. -62049. -63117. -62013. -62009. Input: print(((3210+2472)+1477)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 7159. 7009. 7019. 7995. 7079. Input: b=8494 for x in range(2):b+=7484 print((b*14)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 328468. 318004. 338088. 329220. 338080. 13 Under review as a conference paper at ICLR 2015 Input: j=6447; print((12*(j-4689))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 21096. 21266. 10046. 10606. 20402. Input: print((13*9201)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 119613. 118313. 118011. 117669. 119533. Input: g=1054; print((6028+(g-1953))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 5129. 4013. 5035. 4015. 4009. Input: d=6817 for x in range(7):d-=(4581-2186) print(d). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 12.3 -9948. -1996. -1610. -1882. -1980. E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 4, N ESTING = 3 Input: f=4692 for x in range(4):f-=1664 j=1443 for x in range(8):j+=f d=j for x in range(11):d-=4699 print(d). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -65958. -13262. -73194. -40188. -12004. 14 Under review as a conference paper at ICLR 2015 Input: b=9930 for x in range(11):b-=4369 g=b; print(((g-8043)+9955)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -36217. -37515. -38609. -35893. -35055. Input: d=5446 for x in range(8):d+=(2678 if 4803<2829 else 9848) print((d if 5935<4845 else 3043)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 3043. 3043. 3043. 3043. 3043. Input: print((((2578 if 7750<1768 else 8639)-2590)+342)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 6391. -555. 6329. 6461. 6105. Input: print((((841 if 2076<7326 else 1869)*10) if 7827<317 else 7192)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 7192. 7192. 7192. 7192. 7192. Input: d=8640; print((7135 if 6710>((d+7080)*14) else 7200)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 7200. 7200. 7200. 7200. 7200. Input: b=6968 for x in range(10):b-=(299 if 3389<9977 else 203) print((12*b)). 15 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 47736. -0666. 11262. 48666. 48766. Input: j=(1*5057); print(((j+1215)+6931)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 13203. 13015. 12007. 13379. 13205. Input: print(((1090-3305)+9466)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 7251. 7111. 7099. 7595. 7699. Input: a=8331; print((a-(15*7082))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 12.4 -97899. -96991. -19959. -95551. -96397. E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 6, N ESTING = 1 Input: print((71647-548966)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -477319. -472122. -477591. -479705. -475009. Input: print(1508). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1508. 1508. 1508. 1508. 1508. Input: 16 Under review as a conference paper at ICLR 2015 j=611989; print((j+763864)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1375853. 1379920. 1378991. 1375119. 1375173. Input: print((151108 if 289653>33296 else 564130)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 151108. 154973. 151108. 151108. 151108. Input: c=142012 for x in range(12):c-=166776 print(c). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -1859300. -1840831. -1840000. -1979720. -1820700. Input: print((678740+203140)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 881880. 880475. 881666. 880190. 885920. Input: print((929067-75246)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 853821. 851233. 867113. 855615. 853009. Input: d=960350 for x in range(24):d-=187946 print(d). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -3550354. -3571998. -3699993. -3899220. -3507790. 17 Under review as a conference paper at ICLR 2015 Input: print((8*786463)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 6291704. 6270804. 6271904. 6297644. 6270004. Input: print((498592-570324)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 12.5 -71732. -61086. -73582. -19000. -72842. E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 6, N ESTING = 2 Input: print((39007+416968)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 455975. 559917. 438887. 458993. 450031. Input: print((586051+664462)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1250513. 1250939. 1240719. 1230881. 1240551. Input: print(948950). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 948950. 948950. 948950. 948950. 948950. Input: i=849846 for x in range(15):i-=557574 print((362961 if 881013<597832 else i)). 18 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -7513764. -7422756. -7011048. -2617777. -7101146. Input: g=977055; print((g-(592222+268807))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 116026. 132440. 101488. 114988. 125682. Input: print(((17*711621) if 224989>711768 else 267900)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 267900. 267900. 267900. 267900. 267900. Input: j=114940; print((j+482118)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 597058. 590006. 690004. 599816. 599990. Input: print((171932*19)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 3266708. 3249998. 3131798. 3390158. 3100388. Input: h=411671; print((242648 if (h+31605)>679390 else 449699)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 449699. 449699. 449699. 449699. 449699. Input: print(11332). 19 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 12.6 11332. 11332. 11332. 11332. 11332. E XAMPLES OF PROGRAM EVALUATION PREDICTION . L ENGTH = 6, N ESTING = 3 Input: c=335973; b=(c+756088); print((6*(b+66858))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 6953514. 1099522. 7773362. 6993124. 1044444. Input: c=935280; print((765618 if 409621<(c-(329375 if 806201<240281 else 81797)) else 805944)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 765618. 800988. 765644. 765616. 865618. Input: print(((670421 if 144271>805597 else 364643)*20)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 7292860. 1774640. 7134660. 7292860. 7292860. Input: print((108196 if 714126>847153 else (888873-(381812*13)))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -4074683. 13205544. -4011899. -4422909. -4048381. Input: j=(181489 if 467875>46774 else (127738 if 866523<633391 else 592486)) ; print((j-627483)). 20 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -445994. -333153. -488724. -440880. -447944. Input: f=483654 for x in range(9):f-=913681 a=f for x in range(12):a-=926785 print((124798 if a>326533 else 576599)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 576599. 176599. 576599. 576599. 576599. Input: f=136315; h=(f+37592); g=418652; print((g-(h+234728))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 10017. 12115. -1123. -000.. -0033. Input: a=768606 for x in range(11):a+=454841 f=a for x in range(3):f-=696226 print((340434 if f<287035 else 523084)). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 523084. 523084. 523084. 523084. 523084. Input: b=468503; print((b-(326264+406077))). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: -263838. -278797. -241144. -252080. -277882. Input: g=801925; print((58095+(g+(824920 if 842317>176260 else 570318)))). 21 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1684940. 1602221. 1799892. 1677788. 1611888. 12.7 E XAMPLES OF PREDICTING RESULT OF ADDITION . L ENGTH = 6 Input: print(284993+281178). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 566171. 566199. 566151. 566171. 566171. Input: print(616216+423489). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1039705. 1039712. 1039605. 1039605. 1039705. Input: print(559794+837898). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1397692. 1397694. 1397662. 1397792. 1397692. Input: print(830194+551314). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1381508. 1381401. 1381518. 1381508. 1381508. Input: print(252849+873177). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1126026. 1126020. 1126006. 1125026. 1126026. Input: print(17513+163744). 22 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 181257. 181398. 181287. 181257. 181257. Input: print(530590+569236). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1099826. 1099708. 1099826. 1099826. 1099826. Input: print(856484+436077). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1292561. 1292589. 1292571. 1292561. 1292561. Input: print(731632+833163). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1564795. 1564769. 1564775. 1564795. 1564795. Input: print(738532+444531). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 1183063. 1183000. 1183063. 1183063. 1183063. 12.8 E XAMPLES OF PREDICTING RESULT OF ADDITION . L ENGTH = 8 Input: print(32847917+95908452). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 128756369. 128899997. 128756669. 128756369. 128756369. Input: print(49173072+46963478). 23 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 96136550. 96129999. 96136050. 96136550. 96136550. Input: print(79385668+60159139). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 139544807. 139679090. 139544707. 139544807. 139544807. Input: print(16183468+42542767). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 58726235. 58798523. 58726035. 58726235. 58726235. Input: print(15982788+54043908). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 70026696. 60014022. 70026496. 60026696. 70026696. Input: print(45356253+31242293). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 76598546. 76699777. 76598246. 76598546. 76598546. Input: print(93230501+12607891). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 105838392. 105999882. 105838292. 105838392. 105838392. Input: print(2487336+40625181). 24 Under review as a conference paper at ICLR 2015 Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 43112517. 43178441. 43112917. 43112517. 43112517. Input: print(61854571+75028157). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 136882728. 136860087. 136883928. 136882728. 136882728. Input: print(13828700+10188872). Target: ”Baseline” prediction: ”Naive” prediction: ”Mix” prediction: ”Combined” prediction: 24017572. 24000349. 24018872. 23017572. 24017572. 25
9cs.NE
Rényi entropy power inequality and a reverse arXiv:1704.02634v2 [math.PR] 5 Aug 2017 Jiange Li August 8, 2017 Abstract This paper is twofold. In the first part, we present a refinement of the Rényi Entropy Power Inequality (EPI) recently obtained in [11]. The proof largely follows the approach in [18] of employing Young’s convolution inequalities with sharp constants. In the second part, we study the reversibility of the Rényi EPI, and confirm a conjecture in [5, 24] in two cases. Connections with various p-th mean bodies in convex geometry are also explored. 1 Introduction Let X be a random vector in Rn with density f with respect to the Lebesgue measure. Its Shannon entropy is defined as Z f (x) log f (x)dx. h(X) = − Rn The entropy power of X is defined as N (X) = e2h(X)/n . Shannon’s Entropy Power Inequality (i.e., EPI) states that for any two independent random vectors X and Y in Rn such that the entropies of X, Y and X + Y exist, N (X + Y ) ≥ N (X) + N (Y ). (1) This result was first stated by Shannon [29] with an incomplete proof; the first rigorous proof was provided by Stam [30] using Fisher information and de Bruijn’s identity. Various proofs have been found using a number of different approaches, including Young’s inequality [23, 18], restricted Brunn-Minkowski sum [31], minimum mean square estimation (MMSE) [32], and optimal transport [27]. Although the EPI is interesting in its own right, it has further significant impact by connecting several important and active research areas, including functional inequalities on Riemannian manifolds, inequalities in convex geometry, entropic versions of results in additive combinatorics and bounding the capacity of communication channels. We refer to the nice survey by Madiman, Melbourne and Xu [24] for more details. As a generalization of Shannon entropy, Rényi entropy is important in quantum information theory, where it can be used as a measure of entanglement. The Rényi entropy is also important in ecology and statistics as an index of diversity. For p ∈ (0, 1) ∪ (1, ∞), the Rényi entropy of order p (i.e., p-Rényi entropy) is defined as Z 1 f (x)p dx. log hp (X) = 1−p n R 1 Defining by continuity, h1 (X) corresponds to the classical Shannon entropy. By taking limits, we have h0 (X) = log |supp(f )|, h∞ (X) = − log kf k∞ , where supp(f ) is the support of f , and |supp(f )| is the volume of supp(f ), and kf k∞ is the essential supremum of f . The p-Rényi entropy power is defined by Np (X) = e2hp (X)/n . Unlike Shannon entropy power, which captures the variances of real-valued Gaussian random variables, the (operational) meaning of Rényi entropy power is not clear for the author. It is observed by Bobkov and Chistyakov [8] that Shannon’s EPI (1) does not always hold for the Rényi entropy power. So, a more natural definition of the Rényi entropy power is necessary. One variant of the Rényi entropy power is Npα (X) with an appropriate exponent α which depends on p. Analogous to the EPI (1), one would like the following Rényi EPI to hold for independent random vectors Npα (X + Y ) ≥ Npα (X) + Npα (Y ). (2) For instance, the Brunn-Minkowski inequality suggests that α = 1/2 for p = 0. For p > 1, Bobkov and Marsiglietti [11] recently showed that (2) holds for α = (p + 1)/2. In the next section, we will show that (2) holds with a smaller exponent. Related to the Rényi EPI is Savaré and Toscani’s extension [28] of Costa’s concavity of entropy power theorem [16] from Shannon entropy to Rényi entropy. More specifically, let ut solve the non-linear heat equation ∂t ut = ∆upt in Rn . For p > 1 − 2/n, they showed that Npα (ut ) is a concave function of t > 0, where α = 1+ n(p − 1)/2. Another variant of the Rényi EPI obtained by Bobkov and Chistyakov [8] states that, at the expense of some universal factor c, for p > 1 and independent random vectors X1 , · · · , Xk , Np (X1 + · · · + Xk ) ≥ c k X Np (Xi ). i=1 A sharpened version was obtained by Ram and Sason [26]. In general, the EPI can not be reversed. There exist independent real-valued random variables X, Y with finite entropies, but h(X +Y ) = ∞, see [8] for examples. The reversibility of EPI was addressed by Bobkov and Madiman [10], which states that for independent κconcave (the definition is given in Section 3.1) random vectors X, Y in Rn , there exist linear volume preserving maps T1 , T2 such that N (T1 (X) + T2 (Y )) ≤ c · (N (X) + N (Y )), where c is some constant depending on κ. This can be thought of as the functional lifting of V. Milman’s well known reverse Brunn-Minkowski inequality [25]. The following reverse Rényi EPI proposed by Ball, Nayar and Tkocz [5] (Shannon entropy version for log-concave random vectors) and Madiman, Melbourne and Xu [24] states that for any symmetric κconave random vector (X, Y ) in R2 , Np1/2 (X + Y ) ≤ Np1/2 (X) + Np1/2 (Y ). 2 (3) Toward this conjecture, it was shown in [5] that (3) holds for p = 1 in the log-concave case with an exponent 1/10 instead of 1/2. Extension in the Rényi entropy setting can be found in [24]. We will verify the conjecture in two cases p = 0 and p = 2 for log-concave random vectors. The paper is organized as follows. In Section 2, we follow the approach of Dembo, Cover and Thomas [18] of employing Young’s inequality to derive an improvement of the Rényi EPI recently obtained by Bobkov and Marsiglietti [11]. Section 3.1 is devoted to the discussion of various formulations of the conjecture (3). In particular, we will relate the conjecture to the convexity of the p-th cross-section bodies introduced by Gardner and Giannopoulos [19]. We verify the conjecture (3) in two cases p = 0, 2 in Section 3.2. Connections among various p-th mean bodies are discussed in Section 4. 2 Rényi EPI The following statement about the Rényi EPI is analogous to Lieb’s observation of an equivalent formulation of Shannon’s EPI [23]. For the sake of completeness, we include the proof. Lemma 2.1. Let p ≥ 0 and α > 0 be some constants. Suppose that X, Y are independent random vectors in Rn such that X, Y and X + Y have finite p-Rényi entropies. The following statements are equivalent: 1. We have Npα (X + Y ) ≥ Npα (X) + Npα (Y ). (4) 2. For any λ ∈ [0, 1], we have 1 1 hp (λ 2α X + (1 − λ) 2α Y ) ≥ λhp (X) + (1 − λ)hp (Y ). 1 (5) 1 Proof. To see that (4) implies (5), it suffices to assume that λ 2α X + (1 − λ) 2α Y has finite entropy. By definition, 1 1 1 n log Npα (λ 2α X + (1 − λ) 2α Y ) 2α 1 1 n ≥ log(Npα (λ 2α X) + Npα ((1 − λ) 2α Y )) 2α  n = log λNpα (X) + (1 − λ)Npα (Y ) 2α  n ≥ λ log Npα (X) + (1 − λ) log Npα (Y ) 2α = λhp (X) + (1 − λ)hp (Y ). 1 hp (λ 2α X + (1 − λ) 2α Y ) = We use (4) in the first inequality. The second inequality follows from the concavity of the log function. In the second identity, we use the scaling property that hp (aX) = hp (X) + n log |a|. For the reverse, i.e. (5) implies (4), it is not hard to check that 1 1 hp (λ− 2α X) = hp ((1 − λ)− 2α Y ), where λ= Npα (X) . Npα (X) + Npα (Y ) 3 Then, we have 1 1 1 1 hp (X + Y ) = hp (λ 2α · λ− 2α X + (1 − λ) 2α · (1 − λ)− 2α Y ) 1 ≥ hp (λ− 2α X) n = hp (X) − log λ 2α n log(Npα (X) + Npα (Y )). = 2α This is equivalent to the desired statement. Theorem 2.1. Let p > 1. Let X, Y be independent random vectors in Rn such that X, Y and X + Y have finite p-Rényi entropies. Then, we have Npα (X + Y ) ≥ Npα (X) + Npα (Y ), where α=  1 1+ log 2  p+1 log p p+1 log + p−1 2p p−1 −1 . 1 1 Proof. Let 0 < λ < 1. Let f and g be the densities of λ 2α X and (1 − λ) 2α Y , respectively. n 1 n 1 Then, X and Y have densities fλ,α(x) = λ 2α f (λ 2α x) and g1−λ,α (x) = (1− λ) 2α g((1− λ) 2α x), respectively. By Lemma 2.1, it suffices to prove (5), which is equivalent to ′ ′ kf ∗ gk−p ≥ kfλ,α k−λp kg1−λ,α k−(1−λ)p p p p n ′ ′ ′ kgk−(1−λ)p , = (λλ (1 − λ)1−λ )− 2α kf k−λp p p where p′ is the Hölder conjugate of p, i.e., 1/p + 1/p′ = 1. For p > 1, we have p′ > 1. The above inequality is equivalent to n kf ∗ gkp ≤ (λλ (1 − λ)1−λ ) 2αp′ kf kλp kgk1−λ . p (6) Using the log-convexity of Ls norm, for 1 ≤ q ≤ p, we have θ 1−θq kf kq ≤ kf k1q kf kp 1−θq = kf kp , where θq = 1 − p′ /q ′ is the solution of 1/q = θq + (1 − θq )/p. (It also easily follows from Hölder’s inequality). Similarly, for 1 ≤ r ≤ p, we have kf kr ≤ kf kp1−θr , where θr = 1 − p′ /r ′ is the solution of 1/r = θr + (1 − θr )/p. Then, the estimate (6) holds if we have n λ 1−θq kf ∗ gkp ≤ (λλ (1 − λ)1−λ ) 2αp′ kf kq 1−λ kgkr1−θr . (7) Given p > 1 and 0 < λ < 1, we can define q, r such that λ = p′ /q ′ and 1 − λ = p′ /r ′ . It is easy to check that 1 + 1/p = 1/q + 1/r. Young’s inequality says kf ∗ gkp ≤  cq cr cp 4 n/2 kf kq kgkr , ′ where cs = s1/s (s′ )−1/s . Hence, the estimate (7) holds if we have λ 1−λ (λ (1 − λ) ) n 2αp′ ≥  cq cr cp n/2 . Particularly, we can set α = sup q,r H(λ)  , c p′ log cqpcr where H(λ) is the Shannon entropy of Bernoulli(λ), and the supremum is taken over all q, r ′ such that 1/q + 1/r = 1 + 1/p. Using cs = s1/s (s′ )−1/s , we have       cp p′ log p log q log r p′ p′ log − − = p′ − log p′ − ′ log q ′ − ′ log r ′ cq cr p q r q r    ′  ′ ′ ′ log q log r p p p p ′ log p − − log ′ + ′ log ′ =p − p q r q′ q r r = H(λ) − A(λ), where A(λ) = p ′   1 1 1 log p − log q − log r , p q r which can be rewritten as             1 1 λ λ 1−λ 1−λ ′ p 1 − ′ log 1 − ′ − 1 − ′ log 1 − ′ − 1 − log 1 − . p p p p p′ p′ Thus, we need to solve the optimization problem α= A(λ) 1 − sup 0≤λ≤1 H(λ) !−1 . The theorem follows from the fact that A(λ)/H(λ) achieves the maximum at λ = 1/2. Notice that H(λ) and A(λ) are symmetric about λ = 1/2. It suffices to show that A(λ)/H(λ) is increasing for 0 ≤ λ ≤ 1/2. The latter statement is equivalent to A′ (λ) A(λ) ≥ , 0 ≤ λ ≤ 1/2, ′ H (λ) H(λ) where A′ (λ) = log p′ −λ p′ −(1−λ) , and H ′ (λ) = log 1−λ λ . (8) Notice that A(0) = H(0) = 0. We have Rλ ′ Pm ′ A(λ) k=1 A (kλ/m) 0 A (s)ds = lim Pm = Rλ . m→∞ ′ (s)ds H(λ) H ′ (kλ/m) H k=1 0 The statement (8) holds, if we can show that A′ (λ)/H ′ (λ) is increasing for 0 ≤ λ ≤ 1/2. This is equivalent to A′ (λ) A′′ (λ) ≤ , 0 ≤ λ ≤ 1/2, H ′′ (λ) H ′ (λ) 5 (9) where A′′ (λ) = We have 1−2p′ (p′ −λ)(p′ −(1−λ)) 1 and H ′′ (λ) = − λ(1−λ) . Notice that A′ (1/2) = H ′ (1/2) = 0. R 1/2 ′′ Pm−1 ′′ A (s)ds A′ (λ) k=0 A (λ + k(1/2 − λ)/m) λ = lim Pm−1 . = R 1/2 ′ H (λ) H ′′ (s)ds m→∞ k=0 H ′′ (λ + k(1/2 − λ)/m) λ The statement (9) holds, if we can show that A′′ (λ)/H ′′ (λ) is increasing for 0 ≤ λ ≤ 1/2. One can check that   A′′ (λ) p′ (p′ − 1) −1 ′ = (2p − 1) 1 + , H ′′ (λ) λ(1 − λ) which is increasing for 0 ≤ λ ≤ 1/2 (recall that p′ > 1). Hence, the theorem follows. Remark 2.2. The exponent α in the theorem is strictly smaller than (p + 1)/2 obtained in p−1 p−1 , which, in view of the lower bound obtained [11]. For large p, we have α ≈ log 2 log2 ( p+1 2p 2 ) in [11], is asymptotically optimal up to a multiplicative constant. As p → 1, we can recover the classical EPI. Costa, Hero and Vignat [15] proved that, under covariance constraints, maximizers of Rényi entropies are generalized Gaussian distributions, indexed by a parameter 2 , of the form −∞ < β ≤ n+1   1 − n −1 β 2 β 2 Aβ 1 − kxk . 2 + It is not clear whether the sharp exponent can be obtained from the generalized Gaussian case. As p → 0, we have α → 1/2, which captures the classical Brunn-Minkowski inequality. But it is not clear if Theorem 2.1 holds for 0 < p < 1, in which case we might need a reverse Hölder argument. 3 Reverse Rényi EPI This section is devoted to the reversibility of the Rényi EPI. In general, the Rényi EPI can not be reversed, even in the Shannon case. Variants of the reverse Rényi EPI might hold for certain distributions. 3.1 Discussion of conjectures Recall that a probability measure µ on Rn is called κ-concave if the following BrunnMinkowski type inequality µ(λA + (1 − λ)B) ≥ (λµ(A)κ + (1 − λ)µ(B)κ )1/κ holds for any 0 ≤ λ ≤ 1 and any non-empty Boreal sets A, B ⊆ Rn . Defining by continuity, for κ = 0, we have log µ(λA + (1 − λ)B) ≥ λ log µ(A) + (1 − λ) log µ(B), which characterizes the class of log-concave measures. For κ = −∞, we obtain the largest class, whose members are called convex measures. A κ-concave measure is absolutely continuous with respect to the Lebesgue measure if κ ≤ 1/n, and its density f satisfies the so-called s-concave property f (λx + (1 − λ)y) ≥ (λf (x)s + (1 − λ)f (y)s )1/s 6 for all x, y ∈ Rn such that f (x)f (y) 6= 0 and s = κ/(1 − nκ). We refer to the seminal work of Borell [12] for the hierarchical properties of such measures. The following conjecture was raised by Ball, Nayar and Tkocz [5] (Shannon entropy version for log-concave measures) and Madiman, Melbourne and Xu [24] (Rényi entropy version for general κ-concave measures). Conjecture 3.1. Let p ∈ [0, ∞]. Let κ ∈ [−∞, 1/n], and let X be a κ-concave random vector in Rn . The function ( 1/2 Np (v · X), v 6= 0 v 7→ 0, v=0 defines a norm of v ∈ Rn . It is easy to check the homogeneity. The veracity of the conjecture really depends on proving the triangle inequality Np1/2 ((u + v) · X) ≤ Np1/2 (u · X) + Np1/2 (v · X), which essentially depends on the marginal distribution of X on the plane spanned by u, v. We can apply a linear transformation to the plane such that u, v end up perpendicular without changing the convexity of the marginal distribution. Hence, the conjecture is equivalent to that Np1/2 (X + Y ) ≤ Np1/2 (X) + Np1/2 (Y ) (10) holds for any symmetric κ-concave random vector (X, Y ) in R2 . Similar to Lemma 2.1, we have the following linearized version of (10). Let (X, Y ) be a symmetric κ-concave random vector in R2 , and assume that X, Y have equal p-Rényi entropy. For any λ ∈ [0, 1], we have hp (λX + (1 − λ)Y ) ≤ hp (X). (11) It is not hard to check that equality holds for p = 0. The statement is not true without the equal entropy assumption. Dembo, Cover and Thomas [18] proved that for any independent random vectors X and Y in Rn , h0 (λX + (1 − λ)Y ) ≥ λh0 (X) + (1 − λ)h0 (Y ). As is observed in [5], the statement (10) holds for p = 1 in the Shannon case when (X, Y ) is log-concave and one marginal has the same law as the other one rescaled, say Y ∼ tX for some t > 0. The essential case t = 1 was first observed by Cover and Zhang [17]. An interesting related problem one would like to study is the maximal entropy increment h(X + Y ) − h(X), where Y is an independent copy of X. Abbe [1] conjectured that exponential distribution is the maximizer among log-concave measures for given covariance matrix. This might be related to the minimal entropy problem for log-concave measures with fixed covariance matrix. The latter is the entropy version of Bourgain’s slicing problem [13] formulated by Bobkov and Madiman [9]. The lower bound of the entropy jump h(X + Y ) − h(X) has been studied in [4, 2, 6] under the assumption that X satisfies the Poincaré inequality. The following statement is stronger than Conjecture 3.1. Conjecture 3.2. Let (X, Y ) be a symmetric κ-concave random vector in R2 , and assume that X, Y have equal p-Rényi entropy. The function λ 7→ hp (λX + (1 − λ)Y ) is convex for λ ∈ [0, 1]. 7 Before giving another geometric formulation of Conjecture 3.1, we introduce some notations commonly used in convex geometry. Let K ⊂ Rn be a compact set with the origin in its interior. For v ∈ Sn−1 , the radial function ρK (v) is defined as ρK (v) = sup{r ≥ 0 : rv ∈ K}. For a symmetric convex body K, it is not hard to see that ρK (v) = kvk−1 K , where kvkK is the norm of v for which K is the unit ball. Conjecture 3.1 is true when p = ∞ and X is uniformly distributed over a symmetric convex body K. This is known as Buseman’s theorem [14], and the unit ball is called the intersection body, I(K), of K. Generalizations of Buseman’s theorem hold for symmetric log-concave measures [3] and more general convex measures [24]. As a generalization of intersection body, the p-th cross-section body of a convex body was introduced by Gardner and Giannopoulos [19]. Its extension for probability measures is given below. We will see that that the p-th cross-section body of a random vector (its density) agrees with the unit ball associated to the norm claimed in Conjecture 3.1. Definition 3.3. Let f be a probability density on Rn . The p-th cross-section body Cp (f ) is the set with the radial function ρCp (f ) (v) = Z Z Rn f (y)dy x+v⊥ p f (x)dx 1/p , v ∈ Sn−1 , (12) where v ⊥ is the subspace perpendicular to v. It is not hard to see that the radial function can be rewritten as !1/p  Z Z p+1 f (x)dx ρCp f (v) = R dt . x·v=t For v ∈ Rn , the density of v · X is −1 |v| Z f (x)dx. v·x=t Therefore, we have −1/2 ρCp f (v) = Np+1 (v · X). Hence, we can rephrase Conjecture 3.1 in the following way. Conjecture 3.4. Let p ∈ [−1, ∞]. Let s ∈ [−1/n, ∞], and let f be a symmetric s-concave probability density on Rn . Then, the p-th corss-section body Cp (f ) is a symmetric convex body. We introduce other types of p-th mean bodies, which are closely related to each other. Their relationships will be discussed in Section 4. The following is a natural extension of the intersection body of a convex body to a probability density f . Definition 3.5. Let f be a probability density on Rn . The intersection body I(f ) is the set with the radial function Z f (x)dx, v ∈ Sn−1 . ρI(f ) (v) = v⊥ 8 The following p-th radial mean body of a probability density function reduces to the p-th radial mean body of a convex body introduced by Gardner and Zhang [20] with some normalizing constant if the density is taken to be uniform over that convex body. Definition 3.6. Let f be a probability density on Rn . The p-th radial mean body Rp (f ) is the set with the radial function ρRp (f ) (v) = Z f (x) Rn Z r p−1 f (x + rv)drdx R+ 1/p , v ∈ Sn−1 . (13) Definition 3.7. Let f be a probability density function on Rn . Ball’s p-th mean body is defined as the set with radial function ρBp (f ) (v) = Z r p−1 f (rv)dr R+ 1/p , v ∈ Sn−1 . Definition 3.8. Let f be a probability density on Rn . The polar p-th centroid body Γ◦p (f ) is the set with the radial function ρΓ◦p (f ) (v) = Z p |v · x| f (x)dx Rn −1/p , v ∈ Sn−1 . where v · x is the inner product of v and x. We let Zp (f ) be the dilation of Γ◦p (f ) defined as Zp (f ) = 3.2  2 p+1 1/p Γ◦p (f ). (14) C−1 (f ) and C1 (f ) In the following, we verify Conjecture 3.4 in two special cases p = −1, 1 (log-concave densities when p = 1), equivalently Conjecture 3.1 for p = 0, 2. As we mentioned, it is easy to see that (11) holds for p = 0. Equivalently, Conjecture 3.1 holds for p = 0, and Conjecture 3.4 holds for p = −1. We include this as a theorem to show the relation between C−1 (f ) and other geometric bodies. Theorem 3.1. Let f be a probability density supported on a symmetric convex body K ⊂ Rn . We have C−1 (f ) = (2K)◦ = (R∞ (f ))◦ . Proof. In this case, we have 1/2 N0 (v · X) = |Range(v · X)| = 2 sup v · x = 2hK (v) = h2K (v). x∈K Since K is a symmetric convex body, the dilated set 2K = {2x : x ∈ K} = K ± K is a symmetric convex body as well. Therefore, the support function h2K (v) is a homogeneous convex function, and it defines a norm on Rn . Then, we have ρC−1 (f ) (v) = h2K (v)−1 , v ∈ Sn−1 , 9 which implies that C−1 (f ) = (2K)◦ . To see the 2nd identity in the theorem, we let p → ∞ in the definition (13). We have ρR∞ (f ) (v) = sup{r > 0 : there is x ∈ K such that x + rv ∈ K} = sup{r > 0 : rv ∈ K − K} = ρ2K (v). The first identity follows from the principle of the largest term. This is equivalent to the desired statement. 1/2 Remark 3.9. If we allow the norm kvk = N0 (v · X) to be infinite, the support of f only need to be symmetric and convex, not necessary bounded. Theorem 3.2 (Ball’s Theorem [3]). Let p > 0 and let f be a symmetric log-concave probability density on Rn . Then 1/p Z , v ∈ Sn−1 r p−1 f (rv)dr ρ(v) = R+ is the radial function of a symmetric convex body in Rn . Theorem 3.3. Let p > 0, and let f be a log-concave (not necessary symmetric) probability density on Rn . Then, C1 (f ) and Rp (f ) are symmetric convex bodies. Furthermore, we have C1 (f ) = I(fˆ) = (n − 1)I(Rn−1 (f )), Rp (f ) = Bp (fˆ), where fˆ(x) = Z f (y)f (x + y)dy. Rn Proof. By the definition of C1 (f ) in (12), for v ∈ Sn−1 , we have Z Z f (y)dydx f (x) ρC1 (f ) (v) = x+v⊥ Rn Z Z f (x + y)dydx f (x) = n v⊥ ZR Z f (x)f (x + y)dxdy = v⊥ Rn = ρI(fˆ) (v). To see the second identity, we rewrite ρC1 (f ) (v) in the spherical polar coordinates as Z Z Z r n−2 f (x + ru)drdudx f (x) ρC1 (f ) (v) = Sn−1 ∩v⊥ R+ Rn Z Z Z r n−2 f (x + ru)drdxdu. f (x) = Sn−1 ∩v⊥ Rn R+ 10 The 2nd equation follows from Fubini’s theorem. Using the definition of Rn−1 (f ) in (13), we have Z ρRn−1 (f ) (u)n−1 du ρC1 (f ) (v) = Sn−1 ∩v⊥ = (n − 1) Z Sn−1 ∩v⊥ Z ρRn−1 (f ) (u) r n−2 drdu 0 = (n − 1)|Rn−1 (f ) ∩ v ⊥ | = (n − 1)ρI(Rn−1 (f )) (v). By the definition of Rp (f ) in (13), we have ρRp (f ) (v) = Z = Z = Z f (x) Rn r p−1 R+ r p−1 Z r p−1 f (x + rv)drdx R+ Z f (x)f (x + rv)dxdr Rn fˆ(rv)dr R+ 1/p 1/p 1/p = ρBp (fˆ) (v). Notice that fˆ is a symmetric log-concave function, since it is the density of the difference of two independent random vectors with the same density f . Ball’s theorem implies the convexity of Bp (fˆ), i.e., Rp (f ), and C1 (f ), i.e., I(fˆ). Remark 3.10. The theorem can be thought of as the functional version of Theorem 5.2 in [19] and Theorem 4.3 in [20]. The proofs given here are much simpler. Generalization of Ball’s theorem do hold for convex measures [7]. But it is not clear for us if the proof can be extended to general convex measures, since the convolution of two s-concave densities is not necessary s′ -concave for some s′ . 4 Discussion of p-th mean bodies The various p-th mean bodies introduced in the previous section are closely related to each other. We take f = 1K , where K is a convex body. It is known that R∞ (K) is the difference body of K, and that R−1 (K) is the polar projection body of K. So, the p-th radial mean body, Rp (K), forms a spectrum connecting the difference body and polar projection body. Similar property holds for the dilated polar p-th centroid body defined in (14), Zp (K), which connects the intersection body of K when p = −1 and the polar body of K when p = ∞. The next two propositions are functional liftings of Lemma 5.1 and Proposition 3.1 in [19], which could be used to give an alternative proof of the first part of Theorem 3.3. Proposition 4.1. Let p ≥ −1 be non-zero. Let f be a probability density on Rn . For v ∈ Sn−1 , we have −1/p  Z 1 , f (x)ρZp (fx ) (v)−p dx ρZp (Rn+p (f )) (v) = n + p Rn where fx (y) = f (x + y). 11 Proof. −p ρZp (Rn+p (f )) (v) p+1 = 2 = = = = = = Z |v · x|p dx Rn+p (f ) Z ρR (f ) (u) n+p p+1 p |u · v| r n+p−1 drdu 2 n−1 S Z 0 p+1 |u · v|p ρRn+p (f ) (u)n+p du 2(n + p) Sn−1 Z Z Z p+1 r n+p−1 fx (ru)drdxdu f (x) |u · v|p 2(n + p) Sn−1 n R R Z + Z Z p+1 |u · v|p r n+p−1 fx (ru)drdudx f (x) 2(n + p) Rn n−1 R+ S  Z Z p+1 p |v · y| fx (y)dy f (x)dx 2(n + p) Rn Rn Z 1 f (x)ρZp (fx ) (v)−p dx. n + p Rn Z For p > −1, the p-cosine transform Tp f of a continuous function f on Sn−1 is defined as Z |u · v|p f (u)du, v ∈ Sn−1 . Tp f (v) = Sn−1 The spherical Radon transform Rf is defined as Z f (u)du, v ∈ Sn−1 . Rf (v) = Sn−1 ∩v⊥ The following connection between p-cosine transform and Radon transform is known, see [22, 21]. lim p→−1+ p+1 Tp f = Rf. 2 Proposition 4.2. Let f be a probability density on Rn . For v ∈ Sn−1 , we have lim ρZp (f ) (v)−p = ρI(f ) (v). p→−1+ In other words, we have Z−1 (f ) = I(f ). Proof. By definition, we have −p ρZp (f ) (v) Z p+1 = |v · x|p f (x)dx 2 Rn Z Z p+1 p |u · v| r n+p−1 f (ru)drdu. = 2 Sn−1 R+ 12 (15) Using identity (15), we have lim ρZp (f ) (v)−p = p→−1+ = Z Sn−1 ∩v⊥ Z Z r n−2 f (ru)drdu R+ f (x)dx v⊥ = ρI(f ) (v). In the following, we apply these properties to give another proof of the first statement of Theorem 3.3. Proof. ρC1 (f ) (v) = = = = Z f (x) Rn Z f (x) n ZR n ZR Rn Z Z f (y)dydx x+v⊥ f (x + y)dydx v⊥ f (x)ρI(fx ) (v)dx f (x)ρZ−1 (fx ) (v)dx = (n − 1)ρZ−1 (Rn−1 (f )) (v) = (n − 1)ρI(Rn−1 (f )) (v). We use Proposition 4.2 in the last equation and the 3rd last equation. The 2nd last identity follows from Proposition 4.1. Using a similar argument, we can prove the following result. Proposition 4.3. Let f be a probability density on Rn . For v ∈ Sn−1 , we have lim p→−1+ p+1 n−1 (v) = ρI(Cn−1 (f )) (v). Tp ρC n−1 (f ) 2(n − 1) Proof. For u ∈ Sn−1 , we have ρI(Cn−1 (f )) (v) = |Cn−1 f ∩ v ⊥ | Z 1dx = Cn−1 (f )∩v⊥ = = Z ⊥ Sn−1 ∩v Z 1 n−1 1 = n−1 1 = n−1 Z ρCn−1 f (u) Sn−1 ∩v⊥ Z Sn−1 ∩v⊥ Z Rn r n−2 drdu 0 f (x) ρCn−1 f (u)n−1 du n−1 Z Z dxdu f (y)dy f (x) Rn Z Sn−1 ∩v⊥ 13 x+u⊥ Z f (y)dy x+u⊥ n−1 dudx. Using the connection (15), we have ρI(Cn−1 (f )) (v) = p+1 p→−1+ 2(n − 1) lim Z f (x) Rn Z |u · v|p Sn−1 Z f (y)dy x+u⊥ n−1 dudx n−1 Z Z Z p+1 p = lim dxdu f (y)dy |u · v| f (x) p→−1+ 2(n − 1) Sn−1 x+u⊥ Rn Z p+1 n−1 (u)du |u · v|p ρC = lim n−1 (f ) p→−1+ 2(n − 1) Sn−1 p+1 n−1 = lim (v). Tp ρC n−1 (f ) p→−1+ 2(n − 1) Acknowledgement The author is grateful to Mokshay Madiman and Muriel Médard for helpful discussions. The author also would like to thank the anonymous referee for a thorough reading of the paper, and valuable suggestions which make the paper much improved. References [1] E. Abbe, personal communication. [2] S. Artstein, K. Ball, F. Barthe, and A. Naor. On the rate of convergence in the entropic central limit theorem. Probab. Theory Related Fields, 129(3):381–390, 2004. [3] K. Ball. Logarithmically conave functions and sections of convex sets in Rn . Studia Math., 88(1):69–84, 1988. [4] K. Ball, F. Barthe, and A. Naor. Entropy jumps in the presence of a spectral gap. Duke Math. J., 119(1):41–63, 2003. [5] K. Ball, P. Nayar, and T. Tkocz. A reverse entropy power inequality for log-concave random vectors. Studia Math., 235:17–30, 2016. [6] K. Ball and V. H. Nguyen. Entropy jumps for isotropic log-concave random vectors and spectral gap. Studia Math., 213(1):81–96, 2012. [7] S. G. Bobkov. Convex bodies and norms associated to convex measures. Probab. Theory Related Fields, 147(1–2):302–332, 2010. [8] S. G. Bobkov and G. P. Chistyakov. Entropy power inequality for the Rényi entropy. IEEE Trans. Inform. Theory, 61(2):708–714, 2015. [9] S. G. Bobkov and M. Madiman. The entropy per coordinate of a random vector is highly constrained under convexity conditions. IEEE Trans. Inform. Theory, 57(8):4940–4954, 2011. [10] S. G. Bobkov and M. Madiman. Reverse Brunn-Minkowski and reverse entropy power inequalities for convex measures. J. Funct. Anal., 262(7):3309–3339, 2012. 14 [11] S. G. Bobkov and A. Marsiglietti. arxiv.org/abs/1609.04897, 2016. Variants of entropy power inequality. [12] C. Borell. Convex set functions in d-space. Period. Math. Hungar., 6(2):111–136, 1975. [13] J. Bourgain. On high-dimensional maximal functions associated to convex bodies. Amer. J. Math., 108(6):1467–1476, 1986. [14] H. Busemann. A theorem on convex bodies of the Brunn-Minkowski type. Proc. Nat. Acad. Sci. U. S. A., 35:27–31, 1949. [15] J. Costa, A. Hero, and C. Vignat. On solutions to multivariate maximum α-entropy problems. Lecture Notes in Computer Science, 2683:211–228, July 2003. [16] M. H. M. Costa. A new entropy power inequality. 31(6):751–760, 1985. IEEE Trans. Inform. Theory, [17] T. M. Cover and Z. Zhang. On the maximum entropy of the sum of two dependent random variables. IEEE Trans. Inform. Theory, 40(4):1244–1246, 1994. [18] A. Dembo, T. M. Cover, and J. A. Thomas. Information-theoretic inequalities. IEEE Trans. Inform. Theory, 37(6):1501–1518, 1991. [19] R. J. Gardner and A. A. Giannopoulos. p-cross-section bodies. Indiana Univ. Math. J., 48(2):593–613, 1999. [20] R. J. Gardner and G. Zhang. Affine inequalities and radial mean bodies. Amer. J. Math., 120(3):505–528, 1998. [21] E. Grinberg and G. Zhang. Convolutions, transforms, and convex bodies. Proc. London Math. Soc. (3), 78(1):77–115, 1999. [22] A. Koldobsky. Inverse formula for the Blaschke-Levy representation. Houston J. Math., 23(1):95–108, 1997. [23] E. H. Lieb. Proof of an entropy conjecture of Wehrl. Comm. Math. Phys., 62(1):35–41, 1978. [24] M. Madiman, J. Melbourne, and P. Xu. Forward and reverse entropy power inequalities in convex geometry. arxiv.org/abs/1604.04225, 2016. [25] V. D. Milman. Inégalité de brunn-minkowski inverse et applicationsa la théorie locale des espaces normés. CR Acad. Sci. Paris, 302(1):25–28, 1986. [26] E. Ram and I. Sason. On Rényi entropy power inequalities. IEEE Trans. Inform. Theory, 62(12):6800–6815, 2016. [27] O. Rioul. Yet another proof of the entropy power inequality. IEEE Trans. Inform. Theory, DOI: 10.1109/TIT.2017.2676093. [28] G. Savaré and G. Toscani. The concavity of Rényi entropy power. IEEE Trans. Inform. Theory, 60(5):2687–2693, 2014. [29] C. E. Shannon. A mathematical theory of communication. Bell System Tech. J., 27:379– 423, 623–656, 1948. 15 [30] A. J. Stam. Some inequalities satisfied by the quantities of information of Fisher and Shannon. Information and Control, 2:101–112, 1959. [31] S. J. Szarek and D. Voiculescu. Shannon’s entropy power inequality via restricted Minkowski sums. In Geometric aspects of functional analysis, volume 1745 of Lecture Notes in Math., pages 257–262. Springer, Berlin, 2000. [32] S. Verdú and D. Guo. A simple proof of the entropy-power inequality. IEEE Trans. Inform. Theory, 52(5):2165–2166, 2006. 16
7cs.IT
Ain Shams University, Faculty of Engineering Ain Shams Journal of Electrical Engineering (ASJEE) Vol. 1.June, 2009, PP 135-143 Increasing Server Availability for Overall System Security: A Preventive Maintenance Approach Based on Failure Prediction Ayman M. Bahaa Eldin1, Hoda K. Mohamead1,Sally S. Deraz2 1 Computer and Systems Engineering Department, Faculty of Engineering, Ain Shams University. 2 IBM Cairo Technology Development Center. Cairo, Egypt. ARTICLE HISTORY Received: 17/5/2009 Accepted 27/6/2009 ABSTRACT Server Availability (SA) is an important measure of overall systems security. Important security systems rely on the availability of their hosting servers to deliver critical security services. Many of these servers offer management interface through web mainly using an Apache server. This paper investigates the increase of Server Availability by the use of Artificial Neural Networks (ANN) to predict software aging phenomenon. Several resource usage data is collected and analyzed on a typical long-running software system (a web server). A Multi-Layer Perceptron feed forward Artificial Neural Network was trained on an Apache web server dataset to predict future server resource exhaustion through uni-variate time series forecasting. The results were benchmarked against those obtained from nonparametric statistical techniques, parametric time series models and empirical modeling techniques reported in the literature. Keywords Server Availability, Data Mining, Artificial Neural Network, Software Aging.. 1. INTRODUCTION It has been observed that software applications executing continuously over a long period of time, such as web servers, show a degraded performance and increasing rate of failures [1]. This phenomenon has been called „software aging‟ [2]. This may be due to memory leaks, unreleased file-locks and round-off errors. Currently, researchers have been looking for methods to counteract this phenomenon by what is so called „software rejuvenation‟ methods [3] such as applying a form of „preventive‟ maintenance. This could be done by, for example, occasionally stopping the software application, cleaning its internal state and then restarting [3] to prevent unexpected future system outages. This allows for scheduled downtime at the discretion of the user, which suggests an optimal timing of software rejuvenation. The goal of this research is to use prediction of resources exhaustion as well as further information for deriving the best rejuvenation schedule. 2. RELATED WORK The software aging problem is currently approached either by building analytical models for system degradation such as probability models, linear and nonlinear statistical models, expert systems and fractal base models [4], or by empirically studying the software systems based on measurements. Reported results focus 135 Ayman M. Bahaa Eldin et.al on applying statistical regression techniques to monitored numerical system data, and few attempts were reported on the use of Wavelet Networks in software aging [10,11]. techniques to filter out the most predictive variables; forward selection, backward elimination, and probabilistic wrapper (PWA). Then Root-meansquare-errors (RMSE) is calculated for the three cross benchmarked variable selection techniques. They selected the variable set yielding the smallest RMSE on the validation data set. 3. Model Building: Variable sets identified in the previous step to cross benchmark four modeling techniques for short and long term predictions are used. These modeling techniques are multivariate linear regression (ML), support vector machines (SVM), radial basis functions (RBF), and universal basis functions (UBF). 4. Sensitivity Analysis: investigating each variable contribution to the overall quality of the model, by evaluating potentially nonlinear relationships between a variable and the target variable. They took each of the four models built in the previous model building step and removed each of the variables found in the variable selection step one at a time. They then calculated the change in model error RMSE for the validation, and the generalization data set. In [1], they studied the development of resource usage (i.e. response time and memory usage) of an Apache web server while subjecting it to an artificial workload. Among the system parameters, they monitored free physical memory, used swap space, which follows a seasonal pattern, and response time of the Apache web server. Non-parametric statistical techniques and parametric time series models were employed for analyzing the collected data. They also focused on how to model seasonal patterns, and determine the model order and showed how the exploitation of the seasonal variation can help in adequately predicting the future resource usage. Since their predication of any parameter in time series analysis was based on the previous values of the same parameter, they proposed multivariate time series models to be employed for investigating the interactions between various system resources as a future enhancement. They also proposed studying the influence of the configuration of the operating system, and the server on the aging behavior in details as another future enhancement. In [4], a best practice guide for building empirical models for the prediction of performance variables of computing systems was proposed. They validated its applicability in three case studies; by modeling and forecasting Apache web server response time, and free available memory, as well as the call availability of a telecommunication system. Their primary goal was to gain better understanding of the way the system works. Based on observations about its past behavior, statistical models were derived to capture its dynamics, and to make forecasts about its future behavior. Steps of best practice guide are: 1. System Observation: Building time teries from system log files. 2. Variable selection: where cross benchmark of three variable selection It is interesting to note that variables to which the model is highly sensitive are not necessarily highly correlated with the target. Based on the best practice guide they proposed, they recommended focusing the modeling efforts on the variable selection step because it yields consistently the largest improvement (one order of magnitude) in prediction performance in their test cases. Results from sensitivity analysis, they suggested that variable selection with a nonlinear wrapper approach may improve model quality further. However favoring nonlinear over linear multivariate regression techniques yields to consistent improvements, but they may not always be significant. They also proposed searching for causality inference (i.e. finding root cause) and getting 136 Increasing Server Availability for Overall System Security: A Preventive Maintenance Approach Based on Failure Prediction optimal reaction schemes in an effort to close the loop as further investigation. From the previous literature review, time series models could be fitted to the data collected to help predicting the future resource usage. Attributes subject to software aging are monitored and related data is collected aiming at predicting the expected exhaustion of resources like real memory and swap space. Then, nonparametric statistical techniques and parametric time series models are employed to analyze the collected data and estimate time to exhaustion via extrapolation for each resource, usually assuming linear functions of time. ANN is a relatively simple model that can produce adequate forecasts and can efficiently deal with seasonality in resource usage and system performance. In this work, ANNs are used to forecast Swap Space Usage, Free Physical Memory and Response Time of an apache web server and results are cross benchmarked against reported results in the literature based on parametric and nonparametric statistical analysis, and empirical modeling techniques. 3. COLLECTED DATA Data and results reported in [1] and [4] are used to carry on further analysis using an Artificial Neural Network approach. The collected data is from a Linux web server with an artificial load approaching its maximum optimal load level. The setup that was used for collecting the data consisted of a server running Apache version 1.3.14 on a Linux platform, and a client connected via an Ethernet local area network. The fact that the Linux OS stores an abundance of system information in the /proc virtual file system was exploited. For example, the file /proc/meminfo contains information about the usage of physical memory and swap space, while information on the system load can be found in the file /proc/loadavg. From the /proc file system and with the help of the Linux monitoring tool “procmon”, measurements were periodically collected. “httperf” were used to generate requests with constant time intervals between two requests. Each request accesses one of five specified files of sizes 500 bytes, 5 kB, 50 kB, 500 kB, and 5MB on the server. “httperf” is not only a workload generator, but it can also be employed for monitoring performance information. The measurements provided include the reply rate (i.e., the number of responses received from the server per unit time), the response time (i.e., the interval from the time “httperf” sends out the first byte of a request until it receives the first byte of reply), and the number of timeout errors (i.e., the total number of requests for which no response was received from the server due to timeout errors). For collecting resource usage data over a long time period, a shell program was used to run “httperf” periodically. As for the connection rate, a value of 400 requests per second was chosen, which puts the web server in an overload state, and should speed up software aging. Among the system parameters of the web server monitored during a period of more than 3.5 weeks are the response time of the web server, the used swap space, and the free physical memory. The three time series are shown in Figure 2, Figure 6 and Figure 8 respectively. Data were collected during experiments in which the web server was put in a near overload condition indicating the presence of software aging. 4. NEURAL NETWORK APPROACH 4.1. Artificial Neural Networks ANN is a class of flexible nonlinear models that can discover patterns adaptively from the data. Given an appropriate number of nonlinear processing units, neural networks can learn from experience and estimate any complex functional relationship with high accuracy. Numerous successful ANN applications have been reported in the literature in a variety of fields including pattern recognition and forecasting. For a comprehensive overview of ANN the reader is referred to [5]. 4.2. ANN for time series analysis The usage of ANN for time series analysis relies entirely on the data that were observed and is 137 Ayman M. Bahaa Eldin et.al powerful enough to represent any form of time series. ANN can learn even in the case of noisy data and can represent nonlinear time series. For example, Given a series of values of the variable x at time step t and at past time steps x(t), x(t-1), x(t-2),…, x(t-m), we look for an unknown function F such that; x(t+n)=F[x(t), x(t-1), x(t2),…, x(t-m)], which gives an n-step predictor of order m for the quantity x. Although many types of neural network models have been proposed, the most popular one for time series forecasting is the Multi-Layer Perceptron (MLP) feed forward model [6]. A multi-layer feed forward network with at least one hidden layer and a sufficient number of hidden neurons is capable of approximating any measurable function [7]. A feed-forward network can map a finite time sequence into the value that the sequence will have at some point in the future [8]. Feed forward ANNs are intrinsically non-linear, nonparametric approximators, which makes them suitable for complex prediction tasks. The ANN sees the time series X1,…,Xn in the form of many mappings of an input vector to an output value [9]. The time-lagged values x(t), x(t-1), x(t-2),…,x(t-m) are fed as inputs to the network, which once trained on many inputoutput pairs, gives as output the predicted value for yet unseen x values. Hidden nodes with appropriate non-linear transfer functions (activation functions) are used to process the information received by the input nodes. 4.5. ANN topology and parameter selection The number of ANN input neurons determine the number of periods the neural network “look into the past” when predicting the future. Whereas it has been shown that one hidden layer is sufficient to approximate continuous function [5], the number of hidden units necessary is not known in general. To examine the distribution of the ANN main parameters (i.e. number of time lags and number of neurons in the hidden layer), we conducted a number of experiments, where these parameters were systematically changed to explore their effect on the forecasting capabilities. These estimations of the network‟s most important parameters although rough, allowed us to choose reasonable parameters for our ANN. Multi Layer Perceptron (MLP) Feed Forward Neural networks were constructed as illustrated in Figure 1, for the three parameters under study. 4.3. ANN for software aging forecasting Figure 1. Implemented MLP neural network In software aging, we do not have a well defined model describing the aging process that one would like to study. All that is available are measurements of the variables of interest (i.e. time series). Therefore, we propose, in this work, an artificial neural network approach for the problem of forecasting the attributes, subject to software aging that are monitored, with the objective of predicting the expected exhaustion of resources like real memory and swap space. 4.4. Proposed neural network structure For our problem, we decided to use a fully connected, MLP, feed forward ANN with one hidden layer, and the back propagation learning algorithm [8]. The input nodes are the previous lagged observations while the output node is the forecast for the future values. We divided the collected data into three segments, one to train the ANN, one for validation, and the third for testing. The testing segment is used to evaluate the forecasting performance of the ANN in predicting the performance parameters‟ values. To measure the accuracy of the training and forecasting, the difference between the expected values from the ANN and the actual values of the test set is calculated. Three error measures are calculated, namely Root Mean Square Error (RMSE) Mean Absolute Percent Error (MAPE), and Symmetric Mean Absolute Percent Error (SMAPE), Although RMSE is enough to assess the results, other error measures are calculated to compare the results with others 138 Increasing Server Availability for Overall System Security: A Preventive Maintenance Approach Based on Failure Prediction 4.5.1. Mean Absolute Percent Error (MAPE). MAPE is calculated by averaging the percentage difference between the fitted (forecast) line and the original data: response time over time has been explained previously by resource exhaustion [1]. Where y represents the original series and e represents the original series minus the forecast, and n the number of observations. 4.5.2. Symmetric Mean Absolute Percent Error (SMAPE). SMAPE calculates the symmetric absolute error in percent between the actual X and the forecast F across all observations t of the test set of size n. The formula is: 4.6. Forecasting the exhaustion of the Apache server resources We use the ANN described above and the data introduced in [1] and [4] to predict three Apache performance variables; response time, free physical memory and swap space used, in order to obtain predictions about possible near-future failures due to resource exhaustion. Figure 2: Response Time We notice significant spikes in the plot that could be due to operating system‟s page faults or memory access. Since our objective is not to predict such spikes; rather, our intention is to predict the pattern in response time, we performed data preprocessing to filter out such spikes. To do so, we have preprocessed the data by calculating the median of the response time for the next 24 hours over a sliding window. In Figure 3, we show a plot of the preprocessed response time with vertical solid line segmenting the data into the set used in training and validation, and the set used in testing. This dataset was split into three segments; the first segment is used to train the ANN and the second segment is used to tune the ANN parameters (i.e. number of time lags and number of neurons in the hidden layer) and validation. The third segment is used to measure the ANN generalization performance on data which has not been presented to the NN during parameter tuning. 4.6.1. Forecasting response time for Apache server. The dataset was collected in a 7-day period with a connection rate of 350 per second. Response time is defined as the interval from the time a client sends the first byte of a request until the client receives the first byte of the reply. Figure 2 illustrates a plot of the measured response time for the Apache server. The increasing Figure 3: Response Time Preprocessed If we can accurately forecast response time, then we could trigger a preventive maintenance actions based on this forecast. 139 Ayman M. Bahaa Eldin et.al One major problem for using an ANN for time series analysis and forecasting is the determination of the network parameters, mainly the number of neurons in the hidden layer, and the window of past time, or the number of time lags, used to forecast future values. The approach used here is to select different combinations of these 2 parameters and each time the ANN is trained with the training set and tested using the test set. In each trial, the RMSE is calculated and the combination that produce the lowest value is used for the construction of the ANN predictor. Those experiments are summarized in Table 1. Table 1: RMSE for different number of lags and hidden layer neurons No. of neurons 2 3 4 No. of Time Lags 3 0.0405 0.0259 0.026 4 0.0392 0.0256 0.02466 5 0.0405 0.02698 0.02473 6 0.17798 0.01347 0.00408 7 0.0494 0.03047 0.0278 No. of neurons 5 6 7 No. of Time Lags 3 0.02382 0.0405 0.0265 4 0.02536 0.0192 0.0238 5 0.0244 0.03121 0.02464 6 0.004028 0.00715 0.00169 7 0.0278 0.02598 Table 2 summarizes the RMSE, MAPE and SMAPE for the response time of the Apache server for the testing dataset. As shown in Figure 5, we were able to forecast the response time accurately using the MLP described in Figure 1 with 6 input neurons (time lags), 7 neurons in the hidden layer and a sigmoid nonlinear transfer function. Table 2: Response Time forecasting accuracy Error measures for SMAPE MAPE RMSE predicted data ANN approach 0.00775% 0.0109% 0.00169 As shown in Figure 5 the results obtained are accurate. Based on RMSE, comparing with the results reported in [4] using universal basis functions, multivariate linear regression, support vector machines and radial basis functions empirical modeling techniques, we find that our proposal provide less RMSE than the mentioned techniques and hence it is considered better than those techniuques. 0.0331 Figure 4 shows a graph for RMSE values for the number of time lags and number of neurons in the hidden layer. The number of time lags and hidden layer neurons that give the best accuracy is highlighted by a circle. Figure 5: Response Time forecasting results 4.6.2. Forecasting swap space used for Apache server. This dataset was collected on a 25-day period with connection rate of 400 per second. Figure 4: Conducted experiments for response time Figure 6 shows swap space usage for the Apache server. It is clear that it follows a seasonal pattern and that considerable increases in used swap space occur at fixed intervals. 140 Increasing Server Availability for Overall System Security: A Preventive Maintenance Approach Based on Failure Prediction set used in training and validation, and the set used in testing. Figure 6: Swap Space Used Table 3 shows the RMSE, MAPE and SMAPE for the forecasts of the Swap Space Used of the Apache server for the testing dataset using the MLP described in Figure 1 with 3 input neurons (time lags), 4 neurons in the hidden layer and a sigmoid nonlinear transfer function. As seen in Table 3, the results obtained by the ANN approach are far more accurate than the results obtained by the non-parametric statistical approach reported in [1]. Figure 7: Swap Space Used forecasting results Our goal is to forecast future values of this variable. We notice that as physical memory approaches its minimum allowed lower limit, the system frees up memory by paging, giving an irregular utilization pattern. We have normalized the data by scaling it to the interval [0,1]. Table 3: Swap Space Used evaluation Error measures for SMAPE MAPE RMSE the predicted data Non-Parametric 4.313% 4.47% 612.46 0.292% 0.295% 113.189 Statistical approach ANN approach In Figure 7, we show a plot of the last 3208 observations of the measured SwapSpaceUsed (the testing dataset) and the predicted values obtained by the ANN approach, which shows accurate predictions. 4.6.3. Forecasting free physical memory for Apache server. The dataset was collected in a 7-day period with a connection rate of 350 per second. Figure 8 shows a plot over time of the free physical memory of the Apache server with vertical solid line segmenting the data into the Figure 8: Physical Free Memory Table 4 shows the RMSE, MAPE and SMAPE for the Free Physical Memory of the Apache server for the testing dataset forecasts using the MLP described in Figure 1 with 4 input neurons (time lags), 2 neurons in the hidden layer and a sigmoid nonlinear transfer function. 141 Ayman M. Bahaa Eldin et.al Table 4: Physical Free Memory forecasting accuracy Error measures for SMAPE MAPE RMSE the predicted data ANN approach 1.078% 1.093% 0.0117 In Figure 9, we show a plot of the last 2483 observations of the measured physical free memory (the testing dataset) and the predicted values obtained by the ANN approach, which shows accurate forecasts. Based on RMSE the obtained results are more accurate than the results reported in [4] obtained from universal basis functions, multivariate linear regression, support vector machines and radial basis functions empirical modeling techniques. Future work involves extending the proposed Artificial Neural Network approach to empirically model the process of software aging in order to attempt to define an optimal software rejuvenation policy. Also Sensitivity Analysis for the selected resource usage parameters is to be carried to select the best set. 6. ACKNOWLEDGEMENT The authors would like to thank Professor Kishor S. Trivedi, the Hudson Chair in the Department of Electrical and Computer Engineering at Duke University, for valuable discussions during the development of this work and for his review of the manuscript and Michael Grottke for providing the Apache performance dataset. 7. REFRENCES [1] Grottke M., L. Lie and K. Vaidyanathan, K. Trivedi: Analysis of software aging in a web server, IEEE Transactions on Reliability, Vol. 55, No. 3, September 2006, pp.411-420, 2006 [2] Dohi T., K. Goseva-Popstojanova and K. S. Trivedi, Analysis of software Cost Models with Rejuvenation, Proc. Of the IEEE Intl. Symp. On High Assurance Systems Engineering, HASE, 2000. [3] Huang Y., C. Kintala, N. Kolettis and N. Fulton, Software Rejuvenation: Analysis, Module and applications, In proc. Of the 25th IEEE Intl. Symp. On Fault Tolerant com-puting (FTCS-25), Pasadena, CA, 1995 Figure 9: Physical Free Memory forecasting results 5. CONCLUSION AND FUTURE WORK In this work we have forecasted the development of response time, memory usage and swap space used, that are related to software aging, of an Apache web server subjected to a synthetic load for 25 days, using a proposed Artificial Neural Networks approach. We showed that a feed forward Artificial Neural Networks is able to accurately predict the future behavior of these performance variables. The results obtained were benchmarked against those reported in the literature that are based on parametric and non-parametric statistical techniques and empirical modeling techniques and were more accurate. 142 [4] Guenther A. Hoffmann, Kishor S. Trivedi, and Miroslaw Malek: A Best Practice Guide to Resource Fore casting for Computing Systems, IEEE Transactions on Reliability, VOL. X, NO. X, DECEMBER 2007 [5] Hornik, K., Stinchcombe, M., White, H., Multilayer feedforward networks are universal approximators. Neural Networks 3, 551-560, 1989 [6] Zhang, G. Peter and Qi, Min, Neural network forecasting for seasonal and trend time series, European Journal of Operational Research 160, 501-514, 2005 Increasing Server Availability for Overall System Security: A Preventive Maintenance Approach Based on Failure Prediction [7] Siegelmann H. and Sontag Eduardo D., Neural nets are universal computing devices. Technical Report SYSCON-91-08, Rugters Center for Systems and Control, 1991 [8] Hassoun,M. H., Fundamentals of Artificial Neural Networks, MIT Press, 1995 [9] Chakraborty, K., Mehrota, K., Chilukuri, K. Mohan and Ranka, S., Forecasting the behaviour of multivariate time series using neural networks., Neural Networks 5, 961970, 1992 [10] Xu, J., You, J. and Zhang,K., A NeuralWavelet based Methodology for software Aging Forecasting, IEEE International Conference on Systems, Man and Cybernetics, Volume 1, Issue , 10-12 Oct. 2005 Page(s): 59 - 63 Vol. 1, 2005. Dr. Hoda Korashy is an associative prof. at Ain shams university, Faculty of Engineering, computers & systems department. Field of interest: database and data mining, intelligent systems and agents. Sally Sobhy Derz Research Engineer in IBM Cairo, Egypt. She received her B.SC and Master of Science in computer Engineering from Ain Shams University Her Research interests are in Data Mining [11] Ning, M. H., Yong Q., Di, H., Ying, Ch. And Zhong, Z. J., Software Aging Prediction Model Based on Fuzzy Wavelet Network with Adaptive Genetic Algorithm, Proceedings of the 18th IEEE International Conference on Tools with Artificial Intelligence (ICTAI‟06), Pages 659-666, 2006. ‫ملخص البحث‬ ‫يعختر يدى خوفر أجهزث اهخوادى وكدرخهب عوي خٌفيذ اهيهبى‬ ‫اهيونوج ههب يً أهى يعبيير كيبس األيبً اهنوي هٌظبى‬ ‫ هٌبم اهعديد يً األٌظيج األيٌيج اهخي خعخيد عوي‬.‫اهيعوويبح‬ ‫خوفر األجهزث اهخبديج للكيبى تعيوهب وعبدث يب يخى إدارث ٌظى‬ ‫اهخأييً خوم عً طريق واجهج خطتيق وية خعخيد في األغوة‬ ‫ في هذا اهتحد يخى دراشج‬.Apache ‫عوي ٌظبى األتبخشي‬ ‫زيبدث خوفر أجهزث اهخوادى عً طريق اشخخداى اهشتنبح‬ ً‫ وي‬. ‫اهعصتيج االصطٌبعيج هوخٌتؤ ةظبهرث خلبدى اهتريجيبح‬ ‫أجل ذهم يخى خجييع عد د نتير يً تيبٌبح اشخهالم يوارد‬ Dr. Ayman Mohammad Bahaa Eldin Assistant Professor, Computer and Systems Eng. Dept. Ain Shams University Received his B.SC. , Master of Science, PhD. In Computer Engineering from Ain Shams University in 1995, 1999, and 2004 respectively. His field of research are in the area of cryptography, computer sand network security. [email protected] ‫ خى اشخخداى شتنج‬. ‫خبدى يعيل هفخرث طويوج ذى يخى خحويوهب‬ ‫عصتيج ذاح خغذيج أيبييج يخعددث اهيراحل وخدريتهب عوي‬ ‫اهتيبٌبح اهيجيعج يً خبدى أتبخشي هخوكع االشخهالم اهيشخلتوي‬ ‫ نيب خى‬. ‫اهيفرط هويوارد عً طريق خحويل اهشوشوج اهزيٌيج‬ ‫يلبرٌج الٌخبئج اهخي حصوٌب عويهب يع اهطرق األخرى اهيٌشورث‬ 143 .‫شبتلب‬
9cs.NE
Submitted to the Annals of Statistics ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION arXiv:1708.04738v1 [math.ST] 16 Aug 2017 By Mengyang Gu ∗ , Xiaojing Wang † and James O. Berger Johns Hopkins University ∗ , University of Connecticut University‡ † ‡ and Duke We consider estimation of the parameters of a Gaussian Stochastic Process (GaSP), in the context of emulation (approximation) of computer models for which the outcomes are real-valued scalars. The main focus is on estimation of the GaSP parameters through various generalized maximum likelihood methods, mostly involving finding posterior modes; this is because full Bayesian analysis in computer model emulation is typically prohibitively expensive. The posterior modes that are studied arise from objective priors, such as the reference prior. These priors have been studied in the literature for the situation of an isotropic covariance function or under the assumption of separability in the design of inputs for model runs used in the GaSP construction. In this paper, we consider more general designs (e.g., a Latin Hypercube Design) with a class of commonly used anisotropic correlation functions, which can be written as a product of isotropic correlation functions, each having an unknown range parameter and a fixed roughness parameter. We discuss properties of the objective priors and marginal likelihoods for the parameters of the GaSP and establish the posterior propriety of the GaSP parameters, but our main focus is to demonstrate that certain parameterizations result in more robust estimation of the GaSP parameters than others, and that some parameterizations that are in common use should clearly be avoided. These results are applicable to many frequently used covariance functions, e.g., power exponential, Matérn, rational quadratic and spherical covariance. We also generalize the results to the GaSP model with a nugget parameter. Both theoretical and numerical evidence is presented concerning the performance of the studied procedures. 1. Introduction. A Gaussian Stochastic Process (GaSP) is a useful tool for analyzing spatially correlated data. For example, in geostatistics, it has been popularly used to model various types of data with complicated patterns ([10]). This paper, however, focuses on the use of GaSPs in emulation (approximation) of complex computer models. Computer models are developed in an effort to reproduce the behavior of engineering, physical, Keywords and phrases: Gaussian stochastic process, emulation, anisotropic covariance, robust parameter estimation, objective priors, posterior propriety 1 2 M. GU, X. WANG AND J. O. BERGER biological and human processes. A key issue with such computer models is that they are typically very time-consuming to run (e.g., the TITAN2D computer model that models volcanic pyroclastic flows ([4]) requires up to 2 hours for a single run) and a large number of runs is typically needed for inferences concerning the computer model (i.e., estimation of parameters of the computer model) or predictions using the computer model, both being aspects of what is called Uncertainty Quantification (UQ) for computer models. It is thus typically crucial to develop a fast (and accurate) emulator to approximate the computer model, for use in UQ tasks ([20, 26, 3, 30]). Data from a computer model (i.e., runs from the computer model) is typically rather different than spatial data. First, the input space of the computer model (e.g. the space of model parameters, initial conditions, boundary conditions, etc.) often has high dimension, while the maximum dimension for spatial data is typically three. Second, the inputs of a computer model typically are variables on completely different scales, so the effect of the inputs on the correlations will be highly variable. Consequently, the assumption of isotropy, which is often adopted in spatial processes, usually does not hold for modeling data from computer models. Different types of geometrically anisotropic spatial processes are discussed in the literature (c.f., [42, 18]). For computer models, it is common to use a product correlation function ([35, 28, 4, 29]), typically with very different correlation parameters for each input; the product form also keeps computations tractable, and this choice will be followed herein. Third, many computer models are deterministic, or close to being deterministic, while noise in data from spatial processes can be large. The fourth difference is that, by design, data from computer models is typically taken at input values that are far apart, whereas this may well not be so for spatial data. In this paper, we focus on the problem of estimating the parameters of the GaSP emulator. These parameters typically consist of mean parameters, a variance parameter, and the parameters in the correlation functions, such as range and roughness parameters (introduced in more detail in the next section). Although the mean parameters and variance parameter are relatively easy to deal with, it was pointed out in [20] that the parameters in the correlation functions are notoriously difficult to estimate. For instance, maximum likelihood estimation (MLE) of these parameters has been widely recognized to be unstable ([25, 21, 23, 31]) and can be inconsistent under infill asymptotics ([40, 41]). The instability is partially caused by the Cholesky decomposition of covariance matrices that are often close to singular, when evaluating the likelihood. This can often be overcome by adding a nugget to stabilize the computation, but studies have found that the features of ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 3 the emulator can significantly change when a nugget is added ([2]). Another difficulty that will be discussed herein is that serious problems can arise when the covariance matrix is estimated to be near-diagonal, and this can easily happen when a product correlation structure is used because, if even one of the terms in the product is close to zero, the correlation will be close to zero. Two R packages, DiceKriging and DiceOptim, use several different ways to avoid unstable results, such as using expected improvement criteria and bounds for the range parameters ([34]). Although these methods can yield stable computations, they produce larger predictive errors (as shown in Section 5) than the methods proposed herein, which seek parameter estimates that are naturally robust. To obtain parameter estimates that are naturally robust, i.e., that stabilize the computation without degrading the predictive accuracy of the emulator, we utilize formal objective prior distributions (namely reference priors) and then find posterior modes for the correlation parameters. The first use of reference priors in modeling spatially correlated data was [5]; that paper was restricted to consideration of an isotropic covariance function, with only one range/scale parameter. Reference priors for an anisotropic process were studied in [28, 33], and their properties were studied in the context of product correlation functions and separable designs (e.g., a lattice) for the input values over which the computer model is run. Most designs used for creating emulators of computer models – such as the Latin Hypercube Design (LHD) – are, however, non-separable, and so we need to extend the analysis of the reference priors and likelihoods to cover non-separable situations and to include the possibility of a nugget parameter (a noise term). (Objective priors for isotropic GaSPs with a nugget were discussed recently in [6, 32, 19].) Posterior modes of the correlation parameters depend on the parameterization used for the parameters and it was first found in [23] that this choice of parameterization can make a major difference of the “robustness” of the posterior mode. The word “robust” in this context was first used in [37] and will be formally defined in Section 3, but, informally, a robust procedure avoids the numerical issues discussed above while producing an emulator with good predictive performance. In this investigation, it was also found that robustness is considerably more difficult to obtain for the anisotropic case with product correlation functions than for the isotropic case. As an example, the posterior density of the range parameters goes to infinity when the correlation matrix, for a product correlation function, approaches a matrix of ones, under one frequently used parameterization, while this does not happen in the isotropic case. One of the major contributions of this work is in making the study of robustness of the parameterization rigorous by 4 M. GU, X. WANG AND J. O. BERGER determining the tail behavior of the resulting posterior distributions. The paper is organized as follows. In Section 2, we introduce the GaSP emulator with product correlation functions and designs for the input values at which the computer model is run, and we begin the comparison of our methods to two standard approaches – maximum likelihood estimation (MLE) and maximum marginal likelihood estimation (MMLE) – in order to highlight some of the key concerns. In Section 3, we first study a closed-form example of profile and marginal likelihood, where a sufficient and necessary condition is provided under which the MLE has poor behavior. Then, we formally define robust parameter estimation in the development of GaSP emulators and prove our main results concerning robustness, along with establishing posterior propriety of the suggested priors. The potentially serious consequences of using non-robust estimation methods will also be highlighted. In Section 4, we extend the results to a GaSP with a noise term. The robust method has been implemented in a new R package ([13]), which will be used for comparison of the method with other approaches, such as the MLE and DiceKriging, in Section 5. Section 6 presents some conclusions. 2. Gaussian stochastic processes. 2.1. Background and a recommendation. Consider a real-valued Gaussian stochastic process y(·) ∈ R on a p-dimensional input domain X , (2.1) y(·) ∼ GaSP (µ(·), σ 2 c(·, ·)), where µ(·) is the mean function and σ 2 c(·, ·) is the covariance function with variance σ 2 and correlation function c(·, ·). For any inputs xi ∈ X , i = 1, · · · , n, the outputs (y(x1 ), . . . , y(xn ))T follow a multivariate normal distribution,   (2.2) (y(x1 ), . . . , y(xn ))T | µ, σ 2 , R ∼ MN ((µ(x1 ), . . . , µ(xn ))T , σ 2 R) , where R denotes the correlation matrix with the (i, j) entry c(xi , xj ) and µ = (µ(x1 ), · · · , µ(xn ))T . The mean function for any input x ∈ X is modeled via the regression µ(x) = E[y(x)] = h(x)θ = q X ht (x)θt , t=1 where h(x) = (h1 (x), h2 (x), . . . , hq (x)) is a q-dimensional vector of basis functions and θ = (θ1 , · · · , θq )T , with θt being an unknown regression parameter for the basis function ht . ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 5 The process is called isotropic if the correlation function is only a function of ||xi − xj ||2 , for any xi = (xi1 , · · · , xip )T ∈ X and xj = (xj1 , · · · , xjp )T ∈ X , where || · ||2 is the Euclidean distance or the L2 norm. As mentioned earlier, isotropy is often too restrictive to emulate complicated functions and a product of p one-dimensional correlation functions is typically assumed for the computer model emulation instead (2.3) c(xi , xj ) = p Y cl (xil , xjl ), l=1 with cl (·, ·) being a one-dimensional correlation function for the lth coordinate of the input vector. D The simulator is run at a set of n chosen inputs xD = {xD 1 , . . . , xn }, often selected using some “space filling” technique over the input domain X , e.g., D T a Latin Hypercube Design ([35, 36]); let yD = (y(xD 1 ), . . . , y(xn )) denote the corresponding simulator outputs. Given the product correlation function in (2.3), the correlation matrix of these inputs is thus (2.4) R = R1 ◦ R2 ◦ ... ◦ Rp , where each Rl is the correlation matrix for the lth input, having (i, j)th element cl (xil , xjl ), and ◦ is the Hadamard product. Some frequently chosen correlation functions are listed in Table 1 (dropping the subscript l). The correlation function cl (·, ·) typically has a range parameter γl > 0, which controls how fast the correlation decays with the distance, and a roughness parameter αl > 0, controlling the geometric properties of the process ([5]). As mentioned earlier, the points in xD are typically chosen as far apart as possible, in order to sample the computer model output at as many diverse points as possible. Consequently, the roughness parameters αl , 1 ≤ l ≤ p, are not highly influential and typically have quite flat likelihood surfaces. They are also highly confounded with γl and σ 2 , causing computational and inferential difficulties if left in the model ([40, 10]). It is thus common (and herein adopted) to fix the roughness parameters at prespecified values and focus only on estimation of the range parameters. An alternative possibility would be to assign a discrete prior – concentrated on a few values – to the roughness parameters, as in [8]; the results herein would likely generalize to that situation. One of most frequently used correlation functions is the Gaussian correlation, which is the special case of αl = 2 in the power exponential correlation function. The sample paths of the resulting GaSP process are infinitely differentiable, which is sometimes desirable in applications. However, the choice 6 M. GU, X. WANG AND J. O. BERGER Power Exponential Spherical Rational Quadratic Matérn c(d) α exp{−(d/γ) }, α ∈ (0, 2]     3  3 d 1 d 1− 2 γ + 2 γ 1[d/γ≤1]   2 −α , α ∈ (0, +∞) 1 + γd  α   d d 1 Kα γ , 0 < α < 1 γ 2α−1 Γ(α) α=1 1<α<2 α=2 α>2 ν(γ) γ −α ω(γ) γ −α γ −1 γ −2 γ −2 γ −2 γ −2α γ −2+2α log(γ) γ2 −2 1 log(γ) 2−2α γ γ −2 γ −2 γ log(γ) γ2 −2 γ Table 1 Popular choices of correlation functions, where cl (xil , xjl ) ≡ c(d), with d = |xil − xjl |. Here α is the roughness parameter and γ is the range parameter. Γ(·) is the gamma function and Kα (·) is the modified Bessel function of the second kind. ν(γ) and ω(γ) are terms in the Taylor expansion of the correlation functions, as γ → ∞ (see Section 3). of αl = 2 has been criticized since it often yields too smooth sample paths for many applications ([38]) and because computational difficulties can arise with this choice (see the Appendix). Thus 1 < αl < 2 is typically chosen in the power exponential family ([4]), although the process is then not even once differentiable, sometimes not ideal for applications. Another popular choice of the correlation function is the Matérn correlation. The isotropic, stationary form of the Handcock-Stein-Wallis parametrization of the Matérn function was introduced in [15, 16] and was extended to the non-stationary case in [27] via kernel convolution. When αl = (2k + 1)/2 for k ∈ N, the Matérn correlation has a closed-form expression. For example, when αl = 1/2, the Matérn correlation reduces to the power exponential correlation with αl = 1; when αl → ∞, it reduces to Gaussian correlation. One nice feature of Matérn correlation is that its sample paths are bαl − 1c times differentiable, so the smoothness of the process can be directly controlled by the roughness parameters. Hence, it has become the recommended choice for the correlation function in spatial modeling ([38]). One of the most frequently used Matérn correlation functions is αl = 5/2, which has the form ! √ √ ! 5d2l 5dl 5dl (2.5) cl (dl ) = 1 + + 2 exp − , γl γl 3γl where dl stands for any of the |xil − xjl |. Use of Matérn correlation functions has been less popular in the computer model emulation literature. Here is an argument as to why (2.5) should be seriously considered for emulation, noting first that it is computationally ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 7 tractable. Denoting d˜l = dl /γl , the following is easy to establish for (2.5). • When d˜l → 0, cl (d˜l ) ≈ 1 − C d˜2l with C > 0 being a constant. This thus behaves similarly to exp(−d˜2 ) ≈ 1 − d˜2 , which corresponds to the l l power exponential correlation with αl = 2 (i.e., Gaussian correlation). This suggests that the Matérn correlation in (2.5) will maintain the smoothness induced by Gaussian correlation for nearby  inputs. √  ˜ ˜ • When dl → ∞, the dominant part of cl (dl ) is exp − 5d˜l which matches the power exponential correlation with αl = 1. Thus the Matérn correlation in (2.5) prevents the correlation from decreasing quickly with distance, as does the Gaussian correlation. This can be of benefit in the computer model emulation since some inputs may have almost no effect on the computer model, which would correspond to near constant correlations even for distant inputs. We have also found that the Matérn correlation function with αl = 5/2 yields very good empirical results in emulation. In addition, it is the default correlation function in the DiceKriging package. For these reasons, it will be used as the default correlation function for the numerical study in Section 5. However, our results are applicable to the much larger class of correlation functions listed in Table 1, as shown in Section 3. 2.2. Marginal likelihood and marginal posterior. 2.2.1. Marginal likelihood. Although maximum likelihood estimation of all parameters of the covariance function is possible, it has become standard to treat the mean parameters and variance in a fully objective Bayesian fashion, since they can be dealt with in closed-form in the Bayesian computations. Thus these parameters are assigned the objective prior π(θ, σ 2 ) ∝ 1 . (σ 2 )a with a fixed a > 0, where a = 1 corresponds to the standard reference prior. (It has become customary to also compare results with other choices of a, so we allow that in what follows.) Using this prior to marginalize out the mean and variance parameters in the likelihood function, we obtain the marginal likelihood −( n−q +a−1) 1 1 2 (2.6) L(γ | yD ) ∝ |R|− 2 |hT (xD )R−1 h(xD )|− 2 S 2 , 2 where h(xD ) is the n × q basis matrix with the (i, j) entry hj (xD i ); S = (yD )T QyD with Q = R−1 PR and PR = In −h(xD ){hT (xD )R−1 h(xD )}−1 hT (xD )R−1 , with In being the identity matrix of size n. 8 M. GU, X. WANG AND J. O. BERGER Assuming the roughness parameters α = (α1 , . . . , αp ) have been prespecified, the range parameters of the correlation function can be estimated by maximizing (2.6), which is denoted as maximum marginal likelihood estimator (MMLE). While this approach was argued in [4] to be superior to maximum likelihood estimation (MLE), we will see that it is still non-robust, in the sense that will be defined in Section 3. The main problem is that the marginal likelihood will often not go to zero in the tails and, indeed, can be increasing. Thus it was argued in [23, 37] that the marginal likelihood needs to be augmented by the reference prior for the range parameters. 2.2.2. Reference prior and posterior. The reference prior for a separable product correlation function was developed in [28] and is given by (2.7) π R (θ, σ 2 , γ) ∝ π R (γ) , (σ 2 )a with π R (γ) ∝ |I∗ (γ)|1/2 , where I∗ (·) is the expected Fisher information matrix as below,   n − q tr(W1 ) tr(W2 ) ... tr(Wp )  tr(W12 ) tr(W1 W2 ) ... tr(W1 Wp )     tr(W22 ) ... tr(W2 Wp )  (2.8) I∗ (γ) =  ,   .. . .   . . 2 tr(Wp ) where Wl = Ṙl Q, for 1 ≤ l ≤ p, and Ṙl is the partial derivative of the correlation matrix R with respect to the lth range parameter. The marginal posterior of γ with regard to this reference prior is (2.9) p(γ | yD ) ∝ L(γ | yD ) |I∗ (γ)|1/2 . Sampling from this posterior requires a Metropolis-type algorithm and each evaluation of the likelihood typically requires O(n3 ) flops for the inverse of the correlation matrix, which is computationally prohibitive for many applications. Moreover, the computation error can be very large when the correlation matrix is close to the matrix of all ones. For these reasons, it is common ([4, 37]) to instead simply estimate γ by its marginal posterior mode, using (2.9), n o (2.10) (γ̂1 , . . . γ̂p ) = argmax L(γ1 , . . . , γp | yD ) π R (γ1 , . . . , γp ) . γ1 ,...,γp ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 9 2.2.3. Parameterizations. Maximum likelihood estimation is invariant under the choice of parameterization, but the posterior mode is not invariant because of the presence of the Jacobian for the prior. Here are three common ways of parameterizing the range parameters in the power exponential correlation function ([5, 28, 3, 4, 37]), for any l = 1, · · · , p: (2.11) (2.12) (2.13) cγl (|xil − xjl |) = exp{−(|xil − xjl |/γl )αl }, cβ̃l (|xil − xjl |) = exp{−β̃l |xil − xjl |αl }, n o cξ̃l (|xil − xjl |) = exp − exp(ξ˜l )|xil − xjl |αl . Table 1 gives various correlation functions in their natural parameterizations, in which the range parameter and roughness parameter are independent; we will call this the α-free parameterization of the range parameter. In contrast, in the above parameterizations of the power exponential correlation function, β̃l = γl−αl and ξ˜l = log(γl−αl ) both depend on αl . We will also consider the following transformations of the α-free parameterization (dropping the subscript l for convenience). Definition 2.1. For the range parameters γ in Table 1, (i) β = 1/γ will be called the inverse range parameter; (ii) ξ = log(1/γ) will be called the log inverse range parameter. Note that β̃ = β α and ξ˜ = αξ. The mode of the posterior distributions for the ξ˜ and ξ parameterizations will be the same (properly transformed), because the Jacobians of the transformations differ only by the prefixed constant α; thus we need to consider only the ξ — and not the ξ˜ — parameterization of the power exponential correlation function in what follows. On the other hand, the posterior modes of β̃ and β are not the same (when transformed), so we have to consider both parameterizations in what follows. 2.2.4. Predictions using the emulator. After obtaining the estimates of the range parameters under a specified parameterization, transform back to obtain the corresponding γ = (γ1 , . . . , γp ), after which the predictive distribution of y(x∗ ), given yD and γ, is a Student’s t-distribution, (2.14) y(x∗ ) | yD , γ ∼ t(ŷ(x∗ ), σ̂ 2 c∗∗ , n − q) , 10 M. GU, X. WANG AND J. O. BERGER with n − q degrees of freedom, where   ŷ(x∗ ) = h(x∗ )θ̂ + rT (x∗ )R−1 yD − h(xD )θ̂ ,    T σ̂ 2 = (n − q)−1 yD − h(xD )θ̂ R−1 yD − h(xD )θ̂ ,  T c∗∗ = c(x∗ , x∗ ) − rT (x∗ )R−1 r(x∗ ) + h(x∗ ) − hT (xD )R−1 r(x∗ )  −1   × hT (xD )R−1 h(xD ) h(x∗ ) − hT (xD )R−1 r(x∗ ) , −1 T D −1 D with θ̂ = hT (xD )R−1 h(xD ) h (x )R y being the generalized least squares estimator for θ; R being the correlation matrix corresponding to  ∗ D T the design inputs and r(x∗ ) = c(x∗ , xD 1 ), · · · , c(x , xn ) , both obtained by plugging in the estimated γ values. The corresponding prediction and any quantile of the predictive distribution are then readily available. 2.3. Profile likelihood. For comparison purposes, we will also consider the full likelihood approach, which utilizes the MLE for the mean and variance 2 2 2 parameters, θ̂M LE = θ̂, σ̂M LE = (n − q)σ̂ /n, where θ̂ and σ̂ are defined 2 in (2.14). Plugging θ̂M LE and σ̂M LE into (2.2) and ignoring the normalizing constant, the likelihood of (2.2) reduces to the profile likelihood (2.15) 1 n 2 −2 L(γ | yD , σ̂M (S 2 )− 2 . LE , θ̂ M LE ) ∝ |R| To complete the MLE analysis, γ is estimated by the mode of this profile likelihood and denoted by γ̂M LE . The predictive distribution of a new input x∗ , conditional on the previous outputs and the MLE, is (2.16) 2 ∗ 2 ∗ y(x∗ ) | yD , σ̂M LE , θ̂ M LE , γ̂M LE ∼ N (ŷM LE (x ), σ̂M LE cM LE ), where ŷM LE (x∗ ) = ŷ(x∗ ), with ŷ(x∗ ) defined in (2.14), and c∗M LE = cM LE (x∗ , x∗ )− ∗ ∗ ∗ rTM LE (x∗ )R−1 M LE rM LE (x ), obtained by plugging γ̂M LE into cM LE (x , x ), ∗ rM LE (x ) and RM LE . The profile likelihood is sometimes very flat in the tails, resulting in γ̂M LE being near zero and R̂M LE being near In (see the details in Section 3). This can be shown to result in the predicted mean, ŷM LE (x∗ ), being essentially an impulse function at each of the observations, while following the GaSP mean elsewhere. Figure 1 gives an example of this scenario, where the GaSP mean is assumed to be a constant. In the left panel of the figure, the roughness parameter was α = 1 for the power exponential correlation function, and both the MLE and MMLE became essentially degenerate, while the prediction from the posterior mode approach was reasonable (although not quite 11 1 y 0 −1 0 −3 −3 −2 −2 −1 y 1 2 2 3 3 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 0.0 0.2 0.4 0.6 x 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0 x Fig 1. Emulation of the function y = 3sin(5πx)x + cos(7πx), graphed as the black solid curves (overlapping the green and red curves in the right panel). The design for the input x is equally spaced from [0, 1] with n = 12, with the resulting function values indicated by the black circles. A constant mean function is used. The left panel is for α = 1 and the right panel for α = 1.9, for the power exponential correlation function. The blue curves (which are essentially unit impulse functions at the observations and constant elsewhere) give the emulator mean obtained from the profile likelihood approach; the red curves give the emulator mean from the MMLE approach; and the green curves give the emulator mean arising from the maximum posterior mode approach with the reference prior. smooth enough). In the right panel of the figure, the roughness parameter was α = 1.9; here both the MMLE and marginal posterior mode approaches gave excellent predictions, but the profile likelihood approach still resulted in a degenerate prediction. Such degeneracies are somewhat unusual in onedimension, but are not particularly unusual with higher dimensional inputs, as shown numerically in Section 5. 3. Robust parameter estimation for GaSP Models. In this section, we explore the ways in which GaSP emulator construction can fail, developing the “robustness criteria” that are needed to avoid such failures. We then examine which estimation methods satisfy the criteria. To begin, it is pedagogically useful to look at a special case ([23]), where the analysis is essentially closed-form. The proofs of the lemmas and theorems in this section are provided in the supplementary materials ([14]). 3.1. A closed-form example for the profile likelihood and marginal likelihood. Suppose the input is one-dimensional and that the design is equally spaced with the design points being d0 units apart. Consider a constant mean h(x) = 1 and power exponential correlation with roughness parameter α = 1. Denote ρ = e−d0 /γ , write c(xi , xj ) = ρ∆ij , with ∆ij = |xi −xj |/d0 , and write y(xD i ) as yi to simplify the notation. The closed-form logarithm of the profile likelihood and marginal likelihood (obtained by integrating out the mean and variance parameters using the standard reference prior), 12 M. GU, X. WANG AND J. O. BERGER as well as their limiting values when ρ → 0 and ρ → 1, are given in the supplementary materials ([14]). From these, we can establish the following condition, under which the mode of the profile likelihood occurs at ρ = 0. Lemma 3.1. A necessary and sufficient condition that the mode of the profile likelihood in (2.15) is at ρ = 0 [causing the unwelcome degeneracy] n P is, defining ȳ = yi /n, i=1 (3.1) n−1 X i=1 (yi − ȳ)(yi+1 − ȳ) ≤ 0 . The intuition behind Lemma 3.1 comes from the fact that, in this case, the GaSP becomes an autoregressive model of order 1. When the empirical lag-1 autocorrelation is less than zero, the profile likelihood estimate of the correlation ρ will be zero, since the correlation ρ is parameterized to be nonnegative here. On the other hand, if either likelihood is maximized at ρ = 1, then R = 1n 1Tn , where 1n is the vector of all ones, so that the correlation matrix becomes ill-conditioned, causing large approximation errors in computation of its inverse. For the general case considered in the remainder of the paper, explicit results such as that in Lemma 3.1 are not available. However, we can still look at the tail rates (corresponding to ρ going to 0 or 1) for various likelihoods and posteriors and assess when problems will occur. We formalize these notions in the next subsection, through our criteria for robust estimation. 3.2. Robust estimation. As discussed in the previous section, when R ≈ In , the GaSP predictive mean will degenerate to the fitted mean and impulse functions at the observed inputs, as happened in Figure 1. When R ≈ 1n 1Tn , the correlation matrix R is almost singular, leading to very large computational errors in the GaSP predictive mean. Robust estimation of the parameters is defined as avoiding these two possible problems. Definition 3.1. (Robust Estimation.) Estimation of the parameters in the GaSP is called robust, if the following two situations do NOT happen: (i) R̂ = 1n 1Tn , (ii) R̂ = In , where R̂ is the estimated correlation matrix. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 13 Note that the predictive mean of the GaSP is not well-defined in these two situations when the inputs are at one of the design points, but it can be defined as the limit as R̂ → 1n 1Tn , and R̂ → In . The following basic lemma is immediate from the definition of the correlation matrix. Lemma 3.2. Robustness is lacking in either of the following two cases. Case 1. If, for all 1 ≤ l ≤ p, γ̂l = ∞ (or ξˆl = −∞ or β̂l = 0 in the other parameterizations), then R̂ = 1n 1Tn . Case 2. If ∃l, 1 ≤ l ≤ p, for which γ̂l = 0 (equivalent to ξˆl = ∞ or β̂l = ∞), then R̂ = In . Note that it is generally fine if some (but not all) of the estimated γl are close to ∞, because this will just make R̂l ≈ 1n 1Tn for some l but not R̂ ≈ 1n 1Tn . In such a situation, the inputs associated with the large γl can be called inert inputs, since they will have only a small effect on the outputs. Indeed, this is a desirable situation, since such inputs could be removed from the emulator, simplifying and improving the approximation. The MLE, MMLE and marginal posterior modes (for the various parameterizations) all reduce to mode estimation with regard to a function G(γ). Thus the following guarantees that the problematic situations cannot occur. Corollary 3.1. Estimation of γ = (γ1 , . . . , γp )T as the mode of a nonnegative function G(γ) is robust if G(γ) → 0, under the following two situations: (i) ∃ l, 1 ≤ l ≤ p, γl → 0, (ii) For all l, 1 ≤ l ≤ p, γl → ∞. Corollary 3.2. Estimation of any monotonic transformation of the range parameters ζ = f (γ) = (f1 (γ), . . . , fp (γ))T , by the mode of its marginal posterior, is robust if L(f −1 (ζ) | yD )π R (f −1 (ζ)) under the following two situations: (i) ∃ l, 1 ≤ l ≤ p, fl−1 (ζ) → 0, (ii) For all l, 1 ≤ l ≤ p, fl−1 (ζ) → ∞. where f −1 (ζ) = (f1−1 (ζ), ..., fp−1 (ζ))T . ∂f −1 (ζ) →0 ∂ζ 14 M. GU, X. WANG AND J. O. BERGER 3.3. Robustness Results. From the results in the previous section, it is clear that we should compute the tail rates, in terms of γ, of the marginal likelihood, profile likelihood, and the various posteriors to see if they are robust. Computation of the tail rates of the posteriors requires computation of the tail rates of the reference prior, as well as the tail rates of the marginal likelihood. We need the following two mild assumptions (c.f., [5, 32]) to establish the main results concerning these rates. Assumption 3.1. For any dl ≥ 0 and 1 ≤ l ≤ p, cl (dl ) = c0l (dl /γl ), where c0l (·) is a correlation function that satisfies lim c0l (u) = 0. u→∞ Assumption 3.2. For any 1 ≤ l ≤ p, as γl → ∞, Rl (γl ) = 1n 1Tn + νl (γl )Dl + νl (γl )ωl (γl )(D∗l + Bl (γl )), ∗ where Dl is a nonsingular and symmetric matrix with 1Tn D−1 l 1n 6= 0, Dl is a fixed matrix, νl (γl ) > 0 is a non-increasing and differentiable function, ωl (γl ) is a differentiable function, and Bl (γl ) is a differentiable matrix (incorporating the higher order terms of the expansion), satisfying ∂ || ∂γ Bl (γl )||∞ ωl0 (γl ) νl (γl ) → 0, ωl (γl ) → 0, ∂ → 0, ||Bl (γl )||∞ → 0, ∂ l → 0, ∂γl log νl (γl ) ∂γl log(ωl (γl )) where ωl0 (γl ) = ∂ωl (γl )/∂γl , and kBk∞ = maxi,j |aij | with aij being the (i, j) entry of the matrix B. The first assumption ensures that the correlation function will decrease to zero as the distance between two points goes to infinity. The second assumption guarantees that the first two small terms in the Taylor expansion of the correlation function decrease to zero at an appropriate rate as γl → ∞. The assumptions hold for all the correlation functions listed in Table 1, in which the functions νl and ωl are also given. The following lemma gives the tail rates for the marginal and profile likelihoods. Lemma 3.3. (Tail rates of the marginal likelihood and profile likelihood.) If Assumption 3.1 and Assumption 3.2 hold for each of the Rl , 1 ≤ l ≤ p, the marginal likelihood and profile likelihood have the following tail rates. (i) If ∃l, 1 ≤ l ≤ p, such that γl → 0, the marginal likelihood and profile likelihood both exist and are greater than zero. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 15 (ii) If γl → ∞ for all l, 1 ≤ l ≤ p, and C(h(xD )) denotes the column space of the mean basis matrix h(xD ), the marginal likelihood satisfies  ! p X   a−1/2  O ( νl (γl )) , 1n ∈ / C(h(xD )),    l=1 ! L(γ | yD ) = p  X  O (  νl (γl ))a−1 , 1n ∈ C(h(xD )) .   l=1 The profile likelihood, in this case, satisfies p X D 2 L(γ | y , σ̂M LE , θ̂ M LE ) = O ( νl (γl ))1/2 l=1 ! . Part (i) of this lemma indicates that the marginal likelihood and profile likelihood could have their modes at R = In and thus could potentially be non-robust; one such case was given in Figure 1. Part (ii) of the lemma shows that the mode of the marginal likelihood could be at R = 1n 1Tn for the frequently used setting of a = 1 and 1n ∈ C(h(xD )). On the other hand, the profile likelihood will decrease to zero at this limit, so it cannot be non-robust in this fashion. A byproduct of Lemma 3.3 is that, when a = 1 and 1n ∈ C(h(xD )), use of a constant prior for γ would result in an improper posterior distribution, consistent with the result for isotropic case given in [5]. The asymptotic behaviors of the reference prior for the two limiting cases of interest are given in the lemma below. Lemma 3.4. (Tail rates of the prior.) If Assumption 3.1 and Assumption 3.2 hold for each of the Rl , 1 ≤ l ≤ p, then π R (γ) has the following two limiting properties. Here γ E denotes the vector of γl for all l ∈ E, E ⊂ {1, 2, ..., p}, and γ −E denotes the complementary vector. (i) As γ E → 0, π R (γ) ≤ C(γ −E ) " Y tr l∈E  ∂R ∂γl 2 #1/2 where C(γ −E ) is constant in γ E . (ii) As γl → ∞ for all l, 1 ≤ l ≤ p, if 1 ∈ / C(h(x)), (3.2) π R (γ) ≤ C1 p Q l=1 ( p P l=1 νl0 (γl ) νl (γl , ))p , 16 5 M. GU, X. WANG AND J. O. BERGER Numeric value Upper bound Numeric value Upper bound −5 −10 Log prior −6 −20 −10 −15 −5 Log prior 0 −2 −4 Log prior 0 2 0 4 Numeric value Upper bound 0 200 400 600 800 1000 0 200 400 600 800 1000 0 200 400 γ 800 5 Numeric value Upper bound 1000 Numeric value Upper bound 0 200 400 600 800 1000 Log prior 0 200 400 γ 600 800 1000 −25 −20 −15 −10 −5 Log prior −20 −15 −15 −10 −5 −10 Log prior −5 0 0 0 5 Numeric value Upper bound 600 γ 5 γ 0 200 400 γ 600 800 1000 γ Fig 2. The tail behavior of the reference prior (black curves), and its upper bound (red curves) from Lemma 3.4 part (ii), when γ1 = . . . = γp → ∞. The power exponential correlation function is used with fixed αl = 1.9, 1 ≤ l ≤ p. The first row is for the case in which 1n ∈ / C(h(xD )), while the second row is for 1n ∈ C(h(xD )). From left to right, the dimension of the inputs are p = 1, p = 2 and p = 3. The prior and bounds are evaluated at points uniformly sampled from [0, 1]p . The black curves and red curves overlap when γl is large. where νl0 (γl ) = ∂νl (γl )/∂γl ; if 1 ∈ C(h(xD )) and p ≥ 2, π R (γ) ≤ C2 ( p Q l=1 p P l=1 νl0 (γl ) νl (γl ))p p X νl2 (γl )ωl0 (γl ) , νl0 (γl )νm (γm ) l=1 for every index m between 1 and p; if 1 ∈ C(h(xD )) and p = 1, π R (γ) ≤ C3 |ω10 (γ1 )|. where C1 , C2 and C3 are all positive and not related to γl . The bounds for the one-dimensional case in Lemma 3.4 (ii) were proved in [5]. These results are a generalization of the p dimensional results in [28], which considered only separable designs. Interestingly, the bounds in part (ii) of Lemma 3.4 seem to be almost exact in numerical examples we have studied for the power exponential correlation function. Figure 2 presents some of the evidence for this. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 17 The following theorem states that, under the γ and ξ parameterizations and when a = 1, the mode of the marginal posterior with the reference prior for the range parameters will typically be robust for the correlation functions listed in Table 1. Similar theorems can be stated for other choices of a but, since a = 1 is the near universal choice, we restrict the statement of the results to that case. Theorem 3.1. Under the parameterizations of the range parameter γ and log inverse range ξ in Definition 2.1, the posterior mode in (2.9) with a = 1 is robust for the product form of the power exponential, spherical, and Matérn correlation functions over the domain of α listed in Table 1. In addition, the posterior mode of γ is robust for the rational quadratic correlation if αl > 1/2, 1 ≤ l ≤ p and the posterior mode of ξ is robust for the rational quadratic correlation over the entire domain of α. Proof. Theorem 3.1 can be proved by verifying Corollary 3.1 and Corollary 3.2 using the results from Lemma 3.3 and Lemma 3.4. While use of the mode of the marginal posterior for the γ and ξ parameterizations is robust, the mode of the marginal posterior under other parameterizations, such as the β̃ parameterization in (2.12), can be nonrobust. Indeed, directly applying Lemma 3.4 and Lemma 3.3, the bounds on the tail rates of the marginal posterior under the various parameterizations (and also for the profile and marginal likelihood) are given in Table 2. For simplicity, we assume roughness parameters are kept the same, i.e. α1 = α2 = · · · = αp = α. The blue highlighted entries are those in which the tail rate is constant, so that there is a potential problem of non-robustness. The red highlighted entries in Table 2 are quite surprising, as here the marginal posterior density becomes infinite in the tail, so that the mode will be at the problematical 1n 1Tn . (The following Corollary 3.3 establishes that there is no other infinite mode.) That the posterior mode for the β̃ parameterization has this bizarre behavior has not been previously recognized, and should clearly rule out use of this parameterization (at least when estimating by the marginal posterior mode with the standard reference prior). Figure 3 gives numerical evidence of this feature, where we plot the log-marginal posterior as a function of β̃1 = β̃2 = β̃. Both examples have local modes with a finite marginal posterior, while the real modes with infinite posterior density occur as β̃1 = β̃2 → 0. The following lemma is needed to establish posterior propriety in the next subsection and also to establish Corollary 3.3. It calculates the tail rates when some, but not all, of the range parameters are close to zero. 18 M. GU, X. WANG AND J. O. BERGER 1n ∈ C(h(xD )) l ∈ E, γl → 0 O(1) γl → ∞ for all l −α/2 O(γ(1) ) Marginal Lik O(1) O(1) Post γ, p = 1 α ) O( exp(−C/γ ) γ (α+1) Profile Lik p≥2 O( l∈E Post β̃, p = 1 p≥2 exp(−Cl /γlα ) (α+1) γl p Q Q ) γl−α−1 −(p−1) O( l∈E p−1 P exp(−Cl /γlα ) ) (p) O( Q ) γl−α−1 O( l=1 (1/2−p)α ) ) γ(1) O(β̃ −1/2 ) −(p−1/2) O(β̃(p) ˜ O(exp(− exp(ξ)C)) ) ) ) −α/2−1 p Q l=1 ξ̃l ) l=1 O( exp((p−2) ξ̃ (α+1) γl O(γ O(exp(−β̃C)) p Q O( exp(−β̃l )Cl ) ˜ O(exp(ξ)) exp( Q l∈E O(β̃(p) exp(− exp(ξ˜l )Cl + ξ˜l )) −α/2 O(γ(1) α ) O( exp(−C/γ ) γ (α+1) O(1) ˜ + ξ)) ˜ O(exp(− exp(ξ)C γl → ∞ for all l −α/2 O(γ(1) ) O(1) −α−1 γ(1) l∈E O( l ∈ E, γl → 0 O(1) O( l=1(1−p)α ) ) O(exp(−β̃C)) Q O( exp(−β̃l Cl )) p≥2 Post ξ̃, p = 1 Q O(γ 1n ∈ / C(h(xD )) ) ˜ O(exp(ξ/2)) exp(− exp(ξ˜l )Cl )) l∈E exp( p−1 P ξ̃l ) i=1 O( exp((p−1/2) ξ̃ (p) ) ) Table 2 Tail behaviors of the profile likelihood, the marginal likelihood and the posterior distributions for different parameterizations of the power exponential correlation function, using the reference prior in (2.7) with a = 1. In the 2nd and 4th columns, E is a nonempty set such that for l ∈ E, γl → 0 (equivalent to β̃l → ∞ or ξ˜l → ∞), and C D and Cl are positive numbers depending on |xD il − xjl |, 1 ≤ i, j ≤ n, l ∈ E. In the 3rd and ˜ 5th columns, γl → ∞ (equivalent to β̃l → 0 or ξl → −∞), for all 1 ≤ l ≤ p; in the stated tail rates, γ(1) is defined as the minimum of the γl , β̃(p) is the largest β̃l , and ξ˜(p) is the largest ξ˜l , where 1 ≤ l ≤ p. Blue highlights the cases where the tail behavior is constant, so that there is danger of non-robustness. Red highlights the cases where the posterior goes to infinity in the tail, necessarily leading to non-robustness, as this will be shown to be the unique mode. Lemma 3.5. Assume Assumption 3.1 and Assumption 3.2 hold for each Rl , 1 ≤ l ≤ p. If (i) γl1 → ∞ for 1 ≤ l1 ≤ p1 with p1 < p, (ii) γl2 → 0 for p1 +1 ≤ l2 ≤ p2 , and (iii) γl3 is bounded between 0 and ∞ for p2 +1 ≤ l3 ≤ p, then a bound on the tail rate of the marginal posterior of γ is p(γ | yD ) ≤ C4 p1 Y l1 =1  νl01 (γl1 )  where C4 > 0 is a positive constant. p2 Y l2 =p1 +1 tr  ∂R ∂γl2 2 1/2  , The following corollary is a direct consequence of the above lemma and states that, when the power exponential correlation is used, the only possible infinite mode of the marginal posterior of β̃ is at β̃l → 0 for all 1 ≤ l ≤ p. Corollary 3.3. For the power exponential correlation function, if there is one l, 1 ≤ l ≤ p, for which β̃l > K where K is a positive constant, then the marginal posterior of β̃ using the standard reference prior (2.7) with a = 1 satisfies p(β̃ | yD ) ≤ O(1). 19 5.0 4.5 4.0 Log posterior 3.0 3.5 4.5 4.0 3.5 3.0 Log posterior 5.0 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 0.00 0.01 0.02 ~ β 0.03 0.04 0.00 0.01 0.02 0.03 0.04 ~ β Fig 3. Examples of the marginal posterior of β̃ in the power exponential family with α = 1.9, when emulating the modified Branin function ([9]), which has p = 2 inputs. Two data sets of size n = 20 were generated using uniform designs at [0, 1]2 with 1 ∈ C(h(xD )). The black curves are the log marginal posterior of β̃ arising from setting β̃1 = β̃2 = β̃, and both exhibit infinite posterior density at the mode of 0. 3.4. Posterior propriety. Propriety of the posterior distribution for γ (and, hence, for all other parameterizations) is established in the following theorem for general designs, generalizing the theorems in [5] under the isotropic assumption and in [28] for separable designs. For simplicity, we assume α1 = α2 = ... = αp = α. Theorem 3.2. When α1 = α2 = ... = αp = α, the reference prior in (2.7) with a = 1 results in a proper posterior for GaSP models with the power exponential, spherical, rational quadratic and Matérn correlation functions, under general p-dimensional designs. 4. Robust inference when noise is added to the GaSP model. Some inputs have little effect on the output of the computer model. Such inputs are called inert inputs ([22]) and are usually not used in building the emulator ([37, 12]). However, when inert inputs are omitted in the emulator, the emulator can no longer be an interpolator at the design points so that the GaSP model is then inappropriate. The common solution is to add a small noise term (sometimes called a nugget) to account for the error, such as ỹ(·) = y(·) + , where y(·) is the noise-free GaSP and  is i.i.d. meanzero Gaussian white noise. This section handles the case where the noise is present in the model. The proofs of the lemmas and theorems in this section are provided in the supplementary materials ([14]). 20 M. GU, X. WANG AND J. O. BERGER 4.1. Parameter estimation. After adding the noise, the covariance function for the new process ỹ(·) can be expressed as (4.1) σ 2 c̃(xl , xm ) := σ 2 {c(xl , xm ) + ηδlm }, where η is defined to be the nugget-variance ratio and δlm is a Dirac delta function when l = m, i.e., δmm = 1 and δlm = 0 if l 6= m. Using this parameterization enables marginalization of the likelihood over σ 2 (c.f., [32]). After adding the noise, the covariance matrix becomes (4.2) σ 2 R̃ = σ 2 (R + ηIn ). The reference prior for a real-valued output and isotropic GaSP model with a nugget has been discussed in [32, 19]. Extending it to the GaSP model with multiple range parameters results in the following form: (4.3) π R̃ (θ, σ 2 , γ, η) = π R̃ (θ, σ 2 ) π R̃ (γ, η | θ, σ 2 ) ∝ π R̃ (γ, η) , (σ 2 )a with π R̃ (γ, η) ∝ |Ĩ∗ (γ, η)|1/2 , Ĩ∗ (·) the expected Fisher information matrix,   n − q tr(W̃ 1 ) tr(W̃2 ) ... tr(W̃p+1 )  tr(W̃12 ) tr(W̃1 W̃2 ) ... tr(W̃1 W̃p+1 )     ... tr(W̃2 W̃p+1 )  tr(W̃22 ) (4.4) Ĩ∗ (γ, η) =  ,   . . . .   . . 2 tr(W̃p+1 ) ˙ Q̃, for 1 ≤ l ≤ p, p is the number of range paramewhere W̃l = R̃ l ˙ is the partial derivative of R̃ with ters in the correlation matrix R̃, R̃ l respect to the lth range parameter, and Q̃ = R̃−1 PR̃ with PR̃ = In − h(xD ){h(xD )R̃−1 h(xD )}−1 h(xD )R̃−1 . As in the previous sections, one can estimate the nugget and range parameters by their marginal maximum posterior mode, n o (4.5) (γ̂1 , . . . γ̂p , η̂) = argmax L(γ1 , . . . , γp , η | yD ) π R̃ (γ1 , . . . , γp , η) . γ1 ,...,γp ,η 4.2. Robustness of the posterior mode. Note that R̃ = R1 ◦ R2 ◦ ... ◦ Rp ◦ Rp+1 , where Rp+1 = 1n 1Tn +ηIn . Also, Rp+1 satisfies Assumption 3.2 with νp+1 (η) = η and ωp+1 (η) = 0. Using these facts and in parallel to Lemma 3.3 and Lemma 3.4, the tail rates of the likelihood and the prior for the GaSP with a nugget are given in the following lemmas. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 21 Lemma 4.1. If Assumption 3.1 and Assumption 3.2 hold for each of the Rl , 1 ≤ l ≤ p , the marginal likelihood and profile likelihood have the following tail rates. (i) If ∃l, 1 ≤ l ≤ p, such that γl → 0, the marginal likelihood and profile likelihood both exist and are greater than zero. (ii) If γl → ∞ for all l, 1 ≤ l ≤ p,  ! p X    O ( νl (γl ) + η)a−1/2 , 1n ∈ / C(h(xD )),    l=1 ! L(γ, η | yD ) = p  X   a−1  νl (γl ) + η) , 1n ∈ C(h(xD )),  O ( l=1 and the profile likelihood, in this case, satisfies L(γ | y D 2 , σ̂M LE , θ̂ M LE ) p X νl (γl ) + η)1/2 . = O( l=1 Lemma 4.2. If Assumption 3.1 and Assumption 3.2 hold for each of the Rl , 1 ≤ l ≤ p, then π R̃ (γ, η) has the following two limiting properties. Here γE denotes the vector of γl for all l ∈ E, E ∈ {1, 2, ..., p}, and γ−E denotes the complementary vector. (i) When γE → 0 for all l ∈ E, E ⊂ {1, 2, ..., p}, then  !2 1/2 Y ∂ R̃  π R (γ) ≤ C̃(γ−E )  tr , ∂γl l∈E where C̃(γ−E ) is a constant in γE . (ii) As γl → ∞ for all 1 ≤ l ≤ p and η → 0, if 1 ∈ / C(h(xD )), then π R (γ) ≤ C̃1 ( Pp p Q l=1 νl0 (γl ) l=1 νl (γl ) + η)p+1 ; further, if 1 ∈ C(h(xD )) and p ≥ 2, π R (γ) ≤ C̃2 p Q νl0 (γl ) P l=1 ( pl=1 νl (γl ) + η)p+1 p X νl2 (γl )ωl0 (γl ) , νl0 (γl )νm (γm ) l=1 22 M. GU, X. WANG AND J. O. BERGER 1n ∈ C(h(xD )) l ∈ E, γl → 0 1n ∈ / C(h(xD )) Profile Lik O(1) γl → ∞ for all l and η → 0 1 −α O((γ(1) + η) 2 ) O(1) γl → ∞ for all l and η → 0 1 −α O((γ(1) + η) 2 ) Marginal Lik O(1) O(1) O(1) −2α−1 O( (γγ−α +η)2 ) p Q −α γl−α−1 γ(1) α ) O( exp(−C/γ ) γ (α+1) −α O((γ(1) + η) 2 ) Post γ, p = 1 α ) ) O( exp(−C/γ γ (α+1) p≥2 O( Post β̃, p = 1 exp(−Cl /γlα ) (α+1) γl O( l=1−α ) (γ(1) +η)p+1 O( (β̃ ˜ + ξ)) ˜ O(exp(− exp(ξ)C O( Q l∈E exp(− exp(ξ˜l )Cl + ξ˜l )) β(p) (p) +η) l∈E Post ξ̃, p = 1 ) O( O( p+1 ) (exp(ξ̃(p) )+η)p+1 exp(−Cl /γlα ) (α+1) γl ) 1 γ −α−1 O( (γ −α ) +η)3/2 p Q γl−α−1 O( l=1 −α +η)p+1/2 (γ(1) ) O((β̃ + η)−3/2 ) O(exp(−β̃C)) p Q O( exp(−β̃l )Cl ) O((β̃(p) + η)−p−1/2 ) exp(− exp(ξ˜l )Cl )) O( (exp(ξ̃ l=1 exp(2ξ̃) O( (exp( ) ξ̃)+η)2 p P exp( ξ̃l ) exp(ξ̃(p) ) l=1 Q l∈E β̃ O( (β̃+η) 2) O(exp(−β̃C)) Q O( exp(−β̃l Cl )) p≥2 p≥2 Q l∈E l ∈ E, γl → 0 ) ˜ O(exp(− exp(ξ)C)) O( Q l∈E ξ̃) O( (exp(exp( ) ξ̃)+η)3/2 exp( p P l=1 ξ̃l ) p+1/2 (p) )+η) ) Table 3 Tail behaviors of the profile likelihood, the marginal likelihood and the posterior distributions for different parameterizations of the power exponential correlation function, using the reference prior in (4.3) with a = 1. In the 2nd and 4th columns, E is a nonempty set such that for l ∈ E, γl → 0 (equivalent to β̃l → ∞ or ξ˜l → ∞), and C and Cl are positive numbers not depending on γl ∈ E (or β̃l ∈ E or ξ˜l ∈ E). In the 3rd and 5th columns, γl → ∞ (equivalent to β̃l → 0 or ξ˜l → −∞), for all 1 ≤ l ≤ p; in the stated tail rates, γ(1) is defined as minimum of the γl , β̃(p) is the largest β̃l , and ξ˜(p) is the largest ξ˜l , where 1 ≤ l ≤ p. Blue highlights the cases where the tail behavior is constant; red highlights the cases where the posterior goes to infinity in the tail; and green highlights situations in which the rate might go to zero, a constant or infinity, depending on the speed of η and γl to their limits and the choice of the roughness parameter α. for every index m between 1 to p; if 1 ∈ C(h(xD )) and p = 1, π R (γ) ≤ C̃3 ν1 (γ1 )|ω10 (γ1 )| , (ν1 (γ1 ) + η)2 where C̃1 , C̃2 and C̃3 are positive constants. Directly applying Lemma 4.1 and Lemma 4.2 yields the bounds on the tail rates of the marginal posterior under the various parameterizations (and also for the profile and marginal likelihood) in Table 3. For simplicity, we assume α1 = α2 = ... = αp = α. Comparing Table 2 with Table 3, it is clear that addition of the nugget can cause a loss of robustness of the posterior mode for the (γ1 , γ2 , ..., γp , η)T and (ξ1 , ξ2 , ..., ξp , η)T parameterizations, in certain cases. Luckily, a simple reparameterization of η, to τ = log(η), with estimation by the corresponding posterior mode, achieves robustness, as shown in the following theorem. Theorem 4.1. When a = 1, marginal posterior mode estimation of (γ1 , ..., γp , τ )T , and (ξ1 , ..., ξp , τ )T , where τ = log(η), is robust for the prod- ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 23 uct form of the power exponential family, spherical, and Matérn correlation functions listed in Table 1, and for the rational quadratic correlation function when α > 1/2. In addition, marginal posterior mode estimation of (ξ1 , ..., ξp , τ )T , for 1 ≤ l ≤ p, is robust for the rational quadratic correlation function for all α > 0, 1 ≤ l ≤ p. Proof. Theorem 4.1 can be proved by verifying Corollary 3.1 and Corollary 3.2, using the results from Lemma 4.1 and Lemma 4.2. 4.3. Posterior propriety for the GaSP model with noise. Propriety of the posterior distribution for γ and η (and, hence, for all other parameterizations) is established in the following theorem, generalizing the theorems in [32, 19] under the isotropic assumption with a nugget. It can be proved in the same way as Theorem 3.2, so we omit the details. For simplicity, we assume α1 = α2 = ... = αp = α. Theorem 4.2. When α1 = α2 = . . . = αp = α, the reference prior in (4.3) with a = 1 results in a proper posterior for the GaSP models with noise, under the power exponential, spherical, rational quadratic and Matérn correlation functions, for general p-dimensional designs. 5. Numerical results. 5.1. Comparison criteria. In this section, we numerically compare the performance of several of the methods discussed above, including the MLE and marginal posterior mode estimation with parameterizations γ and ξ (the log inverse of γ). We do not include the MMLE method or results for the β̃ parameterization because of the robustness problems these methods have, as indicated in Table 2 and Table 3. A constant GaSP mean is assumed for all cases, i.e. h(x) = 1, and we use the Matérn correlation with α = 5/2 in (2.5) for all methods. Also included are the results produced by the DiceKriging package ([34]), where the Matérn correlation is also the default setting. We mainly compare the out of sample prediction evaluated by Mean Square Error (MSE). In each simulation, we use n runs, where n is small (typically chosen to be n ≈ 10p), to build the GaSP emulator, and then record the out-of-sample MSE of n∗ = 10, 000 held-out outputs. This is repeated for N = 500 random designs, with the resulting average MSE being reported. The criteria are thus ∗ n N X 1 X MSEj = ∗ (y(x∗ij ) − ŷ(x∗ij ))2 , and AvgMSE = MSEj /N, n i=1 j=1 24 M. GU, X. WANG AND J. O. BERGER 1-dim Higdon 2-dim Branin 3-dim D&P 4-dim G&L 10-dim Linkletter Robust GaSP ξ 1.1 × 10−3 4.7 × 10−7 8.0 × 10−2 4.2 × 10−3 1.7 × 10−12 Robust GaSP γ 1.1 × 10−3 4.2 × 10−7 1.5 × 10−1 1.3 × 10−2 2.4 × 10−12 MLE 1.2 × 10−3 2.4 × 10−4 8.0 × 10−1 2.8 × 10−2 4.8 × 10−5 DiceKriging 1.2 × 10−3 1.8 × 10−3 5.7 × 10−1 4.9 × 10−2 5.7 × 10−4 Table 4 Average MSE of the four estimation procedures for the five experimental functions. From the upper to the lower rows, the sample size is n = 15, 20, 30, 40 and 40 for these five functions, respectively. Designs are generated by maxmin LHD. The baseline MSE is 0.52, 36, 52, 0.52, and 0.0044 for these five functions if only the mean of the training output is used for the predictions. where x∗ij is the ith held-out input in the j th design and ŷ(x∗ij ) is its prediction. To provide a better visual comparison between the methods, we also study the out-of-sample Normalized-RMSE v u n∗ n∗ uX X 2 t ∗ ∗ Normalized-RMSEj = (y(xij ) − ŷ(xij )) / (y(x∗ij ) − ȳj )2 , i=1 i=1 where ȳj is the mean of the observed output for the j th experiment, j = 1, ..., N . For an effective method, this should range from 0 to 1. 5.2. GaSP model without a nugget. We test the following five functions (implemented in [39]): i. 1 dimensional Higdon function from [17], Y = sin(2πX/10) + 0.2 sin(2πX/2.5), where X ∈ [0, 10]. ii. 2 dimensional Branin function from [9], Y = [X2 − 5.1X12 /(4π 2 ) + 5X1 /π − 6]2 + 10[1 − 1/(8π)] cos(X1 ) + 10 where Xi ∈ [0, 1], for i = 1, 2. iii. 3 dimensional Dette & Pepelyshev function from √ [7], 2 2 2 Y = 4(X1 − 2 + 8X2 − 8X2 ) + (3 − 4X2 ) + 16 X3 + 1(2X3 − 1)2 , where Xi ∈ [0, 1], for i = 1, 2, 3. iv. 4 dimensional modified Gramacy & Lee function from [11], Y = 2 exp{sin[0.98 (X1 + 0.48)8 ]} + X2 X3 + X4 , where Xi ∈ [0, 1), for i = 1, 2, 3, 4. v. 10 dimensional Linkletter decreasing coefficient function from [22], Y = 0.2(X1 +X2 /2+X3 /4+X4 /8+X5 /16+X6 /32+X7 /64+X8 /128), where Xi ∈ [0, 1], for i = 1 to 10. Only the first eight inputs are effective. 25 ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 100 200 300 400 300 Num 400 500 200 300 400 0.006 ● ● ● ● ● ● ● ● 0.004 0.6 0.5 0.4 ● 0.3 100 ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● 0.6 0.5 0.4 0.3 0.2 ● ● ● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ●● ● ● ● ● ● ●● ● ●● ●●● ● ● ●●●●● ●● ●● ●● ●● ●● ●● ● ●● ● ● ●● ●●●● ● ● ● ●●● ●● ●● ● ● ● ●●●● ● ● ● ●● ●●● ●● ●● ● ●●● ●●● ●●● ●● ● ●● ●● ● ● ●● ● ●● ● ●●●● ●● ● ●● ●● ●● ● ●● ●●● ● ● ● ●● ● ●●● ● ● ●● ● ●●● ●●● ● ●● ● ● ● ● ●● ● ● ● ● ● ● ●● ●● ● ● ●● ●● ● ● ●●● ● ●●● ● ● ● ● ●● ● ● ● ●● ●● ●● ● ● ● ● ● ● ●● ●● ● ● ●● ● ●● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ● ●●●● ● ● ● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ●●● ●● ● ●● ● ●●●● ● ●● ● ● ● ● ● ● ● ●●● ● ●● ●● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ●● ● ● ●● ●● ●●● ●●● ● ● ● ●● ● ● ●● ● ●● ● ●● ● ●● ●● ● ● ●●● ● ● ● ● ● ● ● ● ● 0 100 200 300 Num ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ● ●● ● ● ●● ●● ●● ● ● ● ●● ● ●● ●● ●● ●●● ●● ● ● ●● ●● ● ● ● ● ● ●● ● ● ● ● ●● ● ●● ● ●● ●● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ●●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ●● ● ● ● ● ●● ●● ● ● ● ●● ● ● ● ● ● ● ●● ●●● ● ● ● ● ● ● ●● ●● ●●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●●● ● ● ●● ● ● ● ●●● ●● ● ●● ● ●●● ● ● ●● ●● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● 0 ●● ● ●● 100 200 300 400 500 Num ● ● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● 500 ● 0.1 0.0 ● ● ● 200 ●● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ●● ● ●● ● ● ●● ● ● ●●● ● ● ●● ● ● ●● ● ● ●● ● ●●● ● ● ●●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 MSE difference between DiceKriging and Robust GaSP 8 6 4 2 0 MSE difference between DiceKriging and Robust GaSP ● 100 ● ● ● ● ● ●● ● Num ● ● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ● ●● ●● ● ● ● ● ● ●● ●● ● ● ● ●●● ● ● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ●● ● ●● ● ● ● ●● ● ●● ● ●● ● ● ● ●● ● ● ● ● ●● ● ● ●● ●● ●●● ●● ● ● ●● ● ● ● ● ● ●● ● ●●● ●●● ●●●●●● ● ● ● ● ● ●●●● ●● ● ● ● ●● ● ● ●● ● ●●● ●● ●●●● ● ●● ●●● ● ● ●● ● ● ●● ● ● ● ● ●●● ●● ●● ●● ●●● ●●● ● ● ●● ●● ●●●● ● ●●● ●●●●● ●●● ●● ● ●● ● ●● ● ●● ●● ● ●● ●●● ● ● ● ● ● ● ●●● ●● ●● ●● ●● ● ● ● ● ● ● ●● ●● ● ●● ● ●● ● ● ● ● ● ● ● ● ●● ●● ●● ● ● ● ● ● ●● ● ●● ● ●● ●● ●● ●● ● ● ● ● ●●● ● ● ●● ● ● ●● ●● ● ●● ● ●●●●●●●● ●●●●● ● ●●●● ● ● ●● ●● ● ● ●●●● ● ●● ●●● ●● ● ● ● ●● ● ● ●● ● ● ●● ●● ● ● ●● ●●● ● ● ●●● ●●● ● ● ●● ● ● ●●● ● ●● ●● ●● ●●● ●● ● ●●●●●●● ●● ●● ● ● ●●●● ●● ●● ●●●● ● ● ●●●●●●● ●● ● ● ●●●● ● ●●● ● ●● ●● ● ● ● ● ● ●● ● ●● ● ● ● ● ●●●● ●● ●● ● ● ●●● ● ●● ● ●● ● ● ●● 0 ● ●● ● 500 ● ● ● ● Num ● ●●● ● 0.002 ● ● ● ● ● ●● ● ●●● ● ● 0.000 5 ● ● ● ● 400 500 ● ● ● 0e+00 2e−05 4e−05 6e−05 8e−05 ● ● ● ●● MSE difference between MLE and Robust GaSP ● ● ● ● ● ●● MSE difference between DiceKriging and Robust GaSP ●● ● ●● 0.2 10 ● ● ●● 0.1 ● ● 0.0 15 ● MSE difference between MLE and Robust GaSP 20 25 ● 0 MSE difference between MLE and Robust GaSP ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ● ●● ● ● ● ●● ●● ● ● ● ● ● ● ●● ● ● ● ● ● ●● ● ●● ● ● ● ● ● ●● ● ● ● ●● ●● ● ● ● ● ● ●●● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ● ●● ● ● ●● ● ●● ● ● ● ● ● ● ● ● ●● ● ●● ●● ● ●●● ● ● ● ● ●● ● ●● ● ● ● ●● ● ●● ● ● ●●● ● ● ● ●●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ● ●● ● ● ●● ● ● ●● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ●●●●● ● ●● ● ● ● ● ● ●●●●● ● ●●● ● ● ● ●● ● ● ● ● ●●● ● ● ● ●● ●● ● ● ●● ● ● ● ●●●●● ● ●●● ● ● ● ● ●●● ● ● ● ●● ●● ● ●● ● ● ●● ● ●● ● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ●● ● ● ●● ● ● ● ●● ● ● ●●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● ● ● ●● ● ● ●● ●● ● ● ● ● ●● ● ● ● ● ●● ●● ● ● ●● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ●●● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ● ● ● ●● ●● ●● ● ●● ● ● ● ● ● ●● ● ● ● ● ●● ● ● ●●● ● ●● ● ● ● ● ●● ● ● ● ● ● ●● ●● ● ● ●● ●● ● ●● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● 0 100 200 300 400 500 Num Fig 4. Plots of M SE difference for each of N = 500 designs for the Dette and Pepelyshev function (left panels), Gramacy and Lee function (middle panels), and Linkletter decreasing coefficient function (right panels). The M SE for the MLE GaSP minus the M SE for the robust GaSP under the ξ parameterization is plotted in the first row, and the M SE for DiceKriging minus the M SE for the robust GaSP under the ξ parameterization is plotted in the second row. The average MSEs of the four estimation methods for the five functions are shown in Table 4. The robust GaSP methods were implemented using [13] and they clearly outperformed the MLE and DiceKriging, with the ξ parameterization yielding the best performance for most of the cases. Note that all methods used the same GaSP prediction equations; the only difference was in the estimates of the correlation parameters. The first row in Figure 4 gives the difference of MSEj of prediction, for each of 500 designs j (for functions iii, iv and v), between the MLE GaSP and the robust GaSP under the ξ parameterization. Note that, for a significant proportion of the designs, the MLE GaSP is much worse than the robust GaSP. In these cases, the MLE GaSP estimate yields a covariance matrix that is close to R̂ ≈ In , so that the prediction degenerated to the fitted mean with impulse functions at the observed values of the inputs. The second row in Figure 4 gives the difference of MSEj of prediction, for each of 500 designs j, between the DiceKriging GaSP and the robust GaSP under the ξ parameterization. The DiceKriging package uses a number of techniques to avoid unstable prediction of the correlation parameters ([34]) and is more stable than the MLE (without any constraints), as can be seen 26 0.5 M. GU, X. WANG AND J. O. BERGER ● ● 0.4 ● ● 0.3 ● ● 0.2 ● ● 0.1 Normalized−RMSE ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● Robust ξ Robust γ ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● MLE DiceKriging Fig 5. Boxplots, for the four estimation methods, of the Normalized RMSE for prediction of the Borehole function, based on n = 25 design points to build the emulator and averaging over N = 500 different designs generated from a Maximin LHD design. The average baseline MSE is 2079.36, using only the mean for prediction. The Average MSE for the 4 methods (from the left to the right) are 9.07, 8,72, 14.77 and 41.29. by a comparison of the upper panels and the lower panels of Figure 4 (the y-axis scales are considerably smaller for DiceKriging). Clearly, however, DiceKriging produces inferior correlation parameter estimates than does the robust GaSP in virtually all of the design cases for the three functions in Figure 4; indeed, only for few design choices for the Gramacy & Lee function does DiceKriging produce better predictions than the robust GaSP. 5.3. GaSP model with noise. The borehole function models water flow through a borehole ([1, 24]) and is given by Y = 2πTu (Hu − Hl ) , ln(r/rω ){1 + 2LTu /[ln(r/rω )rω2 Kω ] + Tu /Tl } where rω , r, Tu , Hu , Tl , Hl , L, Kω are the 8 inputs. The inputs r, Tu and Tl barely affect the output (as clearly shown in Figure S1 of the supplementary materials [14], where we draw plots of the borehole function by fixing seven of the inputs and varying one), and this holds globally over the input space. We thus only use the remaining five influential inputs to build the GaSP model, and then add a nugget to account for the error. The results of Normalized-RMSE for the borehole function are shown in Figure 5. The average MSE of the GaSP with parameters estimated by MLE ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 27 is 14.77, which is worse than the robust GaSP with the ξ or γ parameterization, whose average MSEs are 9.07 and 8.72, respectively. This is because R̃ → (1 + η̂)In for the MLE in several of the cases. Although the nugget might stabilize the computation when R ≈ 1n 1Tn , it cannot help when R becomes nearly proportional to In . In contrast, the robust GaSP, with a good parameterization, prevents these bad cases from materializing. DiceKriging is worse than the robust GaSP in almost all cases, in terms of Normalized-RMSE. The average Normalized-RMSE for robust GaSP, with the ξ or γ parameterization, are around 0.064 and 0.063 respectively, both of which are quite small, considering that only n = 25 observations were utilized to build the emulators. 6. Concluding remarks. We have introduced the robust GaSP for computer model emulation, namely marginal posterior mode estimation of the emulating Gaussian process correlation parameters, using the reference prior and certain parameterizations. This emulation methodology was shown to be robust for a wide class of correlation functions, whereas a number of alternative methods were shown to be non-robust. Robustness here means that the estimates of the correlation parameters avoid two possibly severe problems that can happen: the estimated correlation matrix could be nearly singular or could nearly equal the identity matrix. We also proved posterior propriety, under the reference prior, for general multi-dimensional designs. The current study of the tail behavior of the likelihoods and posteriors can be extended to the situation where both the roughness and range parameters are unknown and to a more general class of correlation functions. In addition, the results hold when the inputs are divided into k < p groups, and an isotropic correlation function is assumed for each group. The results about tail behavior, given here, were for a finite number of observations and it would be interesting to understand the tail behavior as the number of observations goes to infinity. Appendix: The problem of design singularity for power exponential correlation and α = 2. Consider a single input and an equallyspaced design on [0,1], with n = 10, so that the inputs are xD i = (i − 1)/(n − 1), i = 1, · · · , n. Suppose one uses the power exponential correlation function in Table 1 with roughness parameter α = 2. Denote the “design correlation” D 2 matrix as R0 with the (i, j) entry |xD i − xj | , 1 ≤ i, j ≤ n. The condition number of R0 is larger than 1016 . R in this case is also ill-conditioned with a small range parameter γ, e.g., γ = 1. Although R is quite far away from 1n 1Tn , it is near singular and becomes almost non-invertible when n ≥ 15. 28 M. GU, X. WANG AND J. O. BERGER This type of singularity is reported in the literature (c.f., [29]). When R0 is ill-conditioned, then usually R is ill-conditioned even if R is far away from 1n 1Tn . Clearly, this type of matrix singularity is related to the choice of roughness parameters α, but not related to the range parameters γ. One remedy for design singularity is to replace Gaussian covariance by Matérn covariance, or simply choose the range parameter α < 2 in power exponential correlation as in [4, 37]. This type of singularity is a separate problem from what we considered, and can be avoided by a pre-experimental check of the design correlation matrix. Acknowledgements. This research was supported by NSF grants DMS1007773, DMS-1228317, EAR-1331353, DMS-1407775, and EAR 1521855. The research of Mengyang Gu was part of his PhD thesis at Duke University. The authors thank the editor, the associate editor and two referees for their comments that substantially improved the article. References. [1] An, J. and Owen, A. (2001). Quasi-regression. Journal of complexity 17 588–607. [2] Andrianakis, I. and Challenor, P. G. (2012). The effect of the nugget on Gaussian process emulators of computer models. Computational Statistics & Data Analysis 56 4215–4228. [3] Bayarri, M., Berger, J., Cafeo, J., Garcia-Donato, G., Liu, F., Palomo, J., Parthasarathy, R., Paulo, R., Sacks, J. and Walsh, D. (2007). Computer model validation with functional output. The Annals of Statistics 35 1874–1906. [4] Bayarri, M. J., Berger, J. O., Calder, E. S., Dalbey, K., Lunagomez, S., Patra, A. K., Pitman, E. B., Spillerh, E. T. and Wolperti, R. L. (2009). Using statistical and computer models to quantify volcanic hazards. Technometrics 51 402-413. [5] Berger, J. O., De Oliveira, V. and Sansó, B. (2001). Objective Bayesian analysis of spatially correlated data. Journal of the American Statistical Association 96 1361– 1374. [6] De Oliveira, V. (2007). Objective Bayesian analysis of spatial data with measurement error. Canadian Journal of Statistics 35 283–301. [7] Dette, H. and Pepelyshev, A. (2010). Generalized latin hypercube design for computer experiments. Technometrics 52. [8] Diggle, P. and Ribeiro, P. (2007). Model-based Geostatistics. Springer. [9] Dixon, L. (1978). The global optimization problem: an introduction. Towards Global Optimiation 2 1–15. [10] Gelfand, A. E., Diggle, P., Guttorp, P. and Fuentes, M. (2010). Handbook of spatial statistics. CRC Press. [11] Gramacy, R. B. and Lee, H. K. (2009). Adaptive design and analysis of supercomputer experiments. Technometrics 51 130–145. [12] Gu, M., Berger, J. O. et al. (2016). Parallel partial Gaussian process emulation for computer models with massive output. The Annals of Applied Statistics 10 1317– 1347. [13] Gu, M., Palomo, J. and Berger, J. (2016). RobustGaSP: Robust Gaussian Stochastic Process Emulation R package version 0.5. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 29 [14] Gu, M., Wang, X. and Berger, J. O. (2017). Supplement to “Robust Gaussian Stochastic Process Emulation”. [15] Handcock, M. S. and Stein, M. L. (1993). A Bayesian analysis of kriging. Technometrics 35 403–410. [16] Handcock, M. S. and Wallis, J. R. (1994). An approach to statistical spatialtemporal modeling of meteorological fields. Journal of the American Statistical Association 89 368–378. [17] Higdon, D. et al. (2002). Space and space-time modeling using process convolutions. Quantitative methods for current environmental issues 37–56. [18] Kazianka, H. (2013). Objective bayesian analysis of geometrically anisotropic spatial data. Journal of Agricultural, Biological, and Environmental Statistics 18 514–537. [19] Kazianka, H. and Pilz, J. (2012). Objective Bayesian analysis of spatial data with uncertain nugget and range parameters. Canadian Journal of Statistics 40 304–327. [20] Kennedy, M. C. and O’Hagan, A. (2001). Bayesian calibration of computer models. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 63 425– 464. [21] Li, R. and Sudjianto, A. (2005). Analysis of computer experiments using penalized likelihood in Gaussian Kriging models. Technometrics 47. [22] Linkletter, C., Bingham, D., Hengartner, N., Higdon, D. and Kenny, Q. Y. (2006). Variable selection for Gaussian process models in computer experiments. Technometrics 48 478-490. [23] Lopes, D. (2011). Development and implementation of Bayesian computer model emulators PhD thesis, Duke University. [24] Morris, M. D., Mitchell, T. J. and Ylvisaker, D. (1993). Bayesian design and analysis of computer experiments: use of derivatives in surface prediction. Technometrics 35 243–255. [25] Oakley, J. (1999). Bayesian uncertainty analysis for complex computer codes PhD thesis, University of Sheffield. [26] Oakley, J. and O’Hagan, A. (2002). Bayesian inference for the uncertainty distribution of computer model outputs. Biometrika 89 769–784. [27] Paciorek, C. J. and Schervish, M. J. (2006). Spatial modelling using a new class of nonstationary covariance functions. Environmetrics 17 483–506. [28] Paulo, R. (2005). Default priors for Gaussian processes. The Annals of statistics 33 556–582. [29] Peng, C.-Y. and Wu, C. J. (2014). On the choice of nugget in kriging modeling for deterministic computer experiments. Journal of Computational and Graphical Statistics 23 151–168. [30] Qian, P. Z. G., Wu, H. and Wu, C. F. J. (2008). Gaussian Process Models for Computer Experiments With Qualitative and Quantitative Factors. Technometrics 50 383-396. [31] Ranjan, H. R. P. and Karsten, R. (2011). A Computationally Stable Approach to Gaussian Process Interpolation of Deterministic Computer Simulation Data. Technometrics 53 366 - 378. [32] Ren, C., Sun, D. and He, C. (2012). Objective Bayesian analysis for a spatial model with nugget effects. Journal of Statistical Planning and Inference 142 1933–1946. [33] Ren, C., Sun, D. and Sahu, S. K. (2013). Objective Bayesian analysis of spatial models with separable correlation functions. Canadian Journal of Statistics 41 488– 507. [34] Roustant, O., Ginsbourger, D. and Deville, Y. (2012). DiceKriging, DiceOptim: Two R Packages for the Analysis of Computer Experiments by Kriging-Based 30 M. GU, X. WANG AND J. O. BERGER Metamodeling and Optimization. Journal of Statistical Software 51 1–55. [35] Sacks, J., Welch, W. J., Mitchell, T. J., Wynn, H. P. et al. (1989). Design and analysis of computer experiments. Statistical science 4 409–423. [36] Santner, T. J., Williams, B. J. and Notz, W. I. (2003). The design and analysis of computer experiments. Springer Science & Business Media. [37] Spiller, E. T., Bayarri, M., Berger, J. O., Calder, E. S., Patra, A. K., Pitman, E. B. and Wolpert, R. L. (2014). Automating emulator construction for geophysical hazard maps. SIAM/ASA Journal on Uncertainty Quantification 2 126–152. [38] Stein, M. L. (2012). Interpolation of spatial data: some theory for kriging. Springer Science & Business Media. [39] Surjanovic, S. and Bingham, D. Virtual Library of Simulation Experiments: Test Functions and Datasets. Retrieved June 26, 2017, from http://www.sfu.ca/ ~ssurjano. [40] Zhang, H. (2004). Inconsistent estimation and asymptotically equal interpolations in model-based geostatistics. Journal of the American Statistical Association 99 250– 261. [41] Zhang, H. and Zimmerman, D. L. (2005). Towards reconciling two asymptotic frameworks in spatial statistics. Biometrika 92 921–936. [42] Zimmerman, D. L. (1993). Another look at anisotropy in geostatistics. Mathematical Geology 25 453–470. M. Gu Department of Applied Mathematics and Statistics Johns Hopkins University, 3400 North Charles Street, Whitehead Hall 100, Baltimore, Maryland, 21218-2608 USA E-mail: [email protected] X. Wang Department of Statistics University of Connecticut, 215 Glenbrook Rd. U-4120 Storrs, CT 06269-4120 USA E-mail: [email protected] J. O. Berger Department of Statistical Science Duke University, P.O. Box 90251 Durham, North Carolina 27708-0251 USA E-mail: [email protected] Submitted to the Annals of Statistics SUPPLEMENTARY MATERIALS: ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION All the formulas in this supplementary materials are cross-referenced in the main body of the article. S1. Proofs for Section 3.1. The logarithm of the profile likelihood and marginal likelihood have the following forms, respectively. (S1) 2 logL(ρ | yD , σ̂M LE , θ̂ M LE ) ( n ! ! n−1 n−1 X X X 1 n 2 2 2 2 = C0 + log(1 − ρ ) − log yi − 2ρ yi yi+1 + ρ yi 2 2 i=1 i=1 i=2      n X n n n−1 n−1 n−1  X X X X X 1−ρ  − yi yj − 2ρ  yi yj  + ρ2  yi yj  .  n − (n − 2)ρ i=1 j=1 i=1 j=2 i=2 j=2 (S2) logL(ρ | yD ) ( n ! !   n−1 n−1 X X X n − (n − 2)ρ n−1 1 2 2 2 − log yi − 2ρ yi yi+1 + ρ yi = C̃0 − log 2 1+ρ 2 i=1 i=1 i=2      n X n n n−1 n−1 n−1  X X X X X 1−ρ  − yi yj − 2ρ  yi yj  + ρ2  yi yj  .  n − (n − 2)ρ i=1 j=1 i=1 j=2 i=2 j=2 where C0 and C̃0 are two constants unrelated to yD and ρ. Equation (S2) is shown in [3], and we show the validity of Equation (S1) as follows. Note that the correlation matrix is   1 ρ ρ2 ρ3 ... ρn−1  ρ 1 ρ ρ2 ... ρn−2    n−3   ρ2 ρ 1 ρ ... ρ   R= . .. .. .. .. , ..  .. . . . . .     ρn−2 ρn−3 ρn−4 ... 1 ρ  ρn−1 ρn−2 ρn−3 ... ρ 1 S1 S2 and the inverse correlation matrix is  1 −ρ 0 0 ... 0  −ρ 1 + ρ2 −ρ 0 ... 0  2 −ρ  0 −ρ 1 + ρ ... 0 1  R−1 =  . .. .. .. .. .. 1 − ρ2  .. . . . . .   0 0 ... −ρ 1 + ρ2 −ρ 0 0 ... 0 −ρ 1 Direct computation yields      .    n − (n − 2)ρ , 1+ρ Pn−1 2 Pn Pn−1 2 2 D T −1 D i=2 yi i=1 yi − 2ρ i=1 yi yi+1 + ρ , (y ) R (y ) = 1 − ρ2 |R| = (1 − ρ2 )n−1 , 1Tn R−1 1n = from which the Equation (S1) follows. As ρ → 0 and ρ → 1, the limiting values for the log-marginal likelihood and log-profile likelihood are given in Table S1. If the mode for either log likelihood is at (or near) zero, the emulator will degenerate, as in Figure 1. From Table S1, it is clear that the log likelihoods will not typically go to zero as ρ → 0. logL(ρ | yD ) 2 logL(ρ | yD , σ̂M LE , θ̂ M LE ) when ρ → 0 Pn − n−1 log{ (yi − ȳ)2 } 2 Pi=1 n n − 2 log{ i=1 (yi − ȳ)2 } − n−1 log{ 2 when ρ → 1 2 (y i+1 − yi ) } i=1 −∞ Pn−1 Table S1 The tail behaviors of the log-marginal likelihood and log-profile likelihood (up to the normalizing constants unrelated to ρ and yD ). To prove Lemma 3.1, the following quantities are needed: a= n X yi2 , b= i=1 d= n X n X n−1 X yi yi+1 , i=1 yi yj , e= i=1 j=1 and U = a − 2ρb + ρ2 c − c= n−1 X yi2 , i=2 n n−1 X X i=1 j=2 yi yj , f= n−1 X n−1 X yi yj , i=2 j=2   1−ρ d − 2ρe + ρ2 f . n − (n − 2)ρ The following lemma is also needed for the proof of Lemma 3.1. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION Lemma S1.1. S3 We have na ≥ d, (S3) (n − 2)c ≥ f, (S4) c[n − (n − 2)ρ] > (1 − ρ)f. (S5) Proof. The first two inequalities are obvious. As c[n − (n − 2)ρ] − (1 − ρ)f = (n − 2)c [n − (n − 2)ρ] − (1 − ρ)f, n−2 the third inequality follows from (n − 2)c ≥ f and 2 n−2 > 0. [n−(n−2)ρ] n−2 − (1 − ρ) = Proof of Lemma 3.1. One only needs to prove that the log-profile likelihood in Equation (S1) decreases with ρ for all 0 ≤ ρ ≤ 1. The derivative for Equation (S1) is 2 ∂logL(ρ | yD , σ̂M ρ n ∂U LE , θ̂ M LE ) ∝− − , 2 ∂ρ 1−ρ 2U ∂ρ (S6) in which the second term can be written as n ∂U 2U ∂ρ n{(cρ − b)[n − (n − 2)ρ]2 + (d − 2eρ + f ρ2 ) − (1 − ρ)[n − (n − 2)ρ](−e + ρf )} = . [n − (n − 2)ρ]{(a − 2bρ + cρ2 )[n − (n − 2)ρ] − (1 − ρ)(d − 2eρ + f ρ2 )} 2 (a) To show necessity, note first that, as ρ → 1, logL(yD |σ̂M LE , θ̂ M LE , ρ) → −∞. Thus a necessary condition is that lim ρ→0+ 2 ∂logL(ρ | yD , σ̂M LE , θ̂ M LE ) ≤ 0, ∂ρ which implies (S7) n2 b − d − ne ≤ 0. (b) To show sufficiency, we separately discuss e ≤ 0 and e > 0. (b1) When e ≤ 0, noticing that U = S 2 /(1 − ρ2 ) > 0, a sufficient condition is ∂U ∂ρ > 0 or, equivalently, that the numerator of the second term of Equation (S6) is positive. First considering the terms related to c and f and applying Inequality (S5) yields cρ[n − (n − 2)ρ]2 − (1 − ρ)ρ[n − (n − 2)ρ]f > 0. S4 For the remaining terms,  d n[n − (n − 2)ρ] −b + [n − (n − 2)ρ]2   1−ρ −2ρ + +e [n − (n − 2)ρ]2 [n − (n − 2)ρ] d ≥ n[n − (n − 2)ρ]2 {−b + 2 + h(ρ)e}, n 2 where h(ρ) = −2ρ 1−ρ + . 2 [n − (n − 2)ρ] [n − (n − 2)ρ] It is easy to show h(ρ) is decreasing monotonically with h(0) = 1 1 n > 0 and h(1) = − 2 < 0. Since e ≤ 0, we thus have h(ρ)e ≥ h(0)e = ne . Thus a sufficient condition is −b + nd2 + h(ρ)e ≥ −b + nd2 + h(0)e = −b + nd2 + ne ≥ 0, which is equivalent to b− d e − ≤ 0. 2 n n (b2) We show that b − nd2 − ne ≤ 0 is a sufficient condition for e > 0 as follows. First, b − nd2 − ne ≤ 0 is equivalent to (S8) −b≥ −d − ne . n2 Second, (S9) e= p λd f df ≤ + , 2 2λ for any λ > 0. After ignoring the constant n, the numerator of ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION S5 the second term of Equation (S6) is (cρ − b)[n − (n − 2)ρ]2 + (d − 2eρ + f ρ2 ) − (1 − ρ)[n − (n − 2)ρ](−e + ρf ) n−2 =cρ [n − (n − 2)ρ]2 − (1 − ρ)[n − (n − 2)ρ]ρf n−2 − b[n − (n − 2)ρ]2 + (d − 2eρ + f ρ2 ) + (1 − ρ)[n − (n − 2)ρ]e [n − (n − 2)ρ]2 − (1 − ρ)[n − (n − 2)ρ]ρf − b[n − (n − 2)ρ]2 n−2 + (d − 2eρ + f ρ2 ) + (1 − ρ)[n − (n − 2)ρ]e 2 =ρf [n − (n − 2)ρ] − b[n − (n − 2)ρ]2 n−2 + (d − 2eρ + f ρ2 ) + (1 − ρ)[n − (n − 2)ρ]e −d − ne 2 [n − (n − 2)ρ] + [n − (n − 2)ρ]2 ≥ρf n−2 n2 + (d − 2eρ + f ρ2 ) + (1 − ρ)[n − (n − 2)ρ]e     [n − (n − 2)ρ]2 n−2 = − +1 d− 2− ρ (2ρe) n2 n   2 2 + ρ [n − (n − 2)ρ] + ρ f n−2       [n − (n − 2)ρ]2 n−2 f ≥ − + 1 d − 2 − ρ ρ λd + n2 n λ   2 + ρ [n − (n − 2)ρ] + ρ2 f n−2   n−2 [n − (n − 2)ρ]2 + 1 − (2 − ρ)ρλ d = − n2 n   2 n−2 ρ 2 + ρ [n − (n − 2)ρ] + ρ − (2 − ρ) f. n−2 n λ ≥ρf The first inequality is from the result in Lemma S1.1. The second inequality follows from Equation (S8). The third inequality is from Equation (S9) and the fact that 2 − n−2 n ρ ≥ 0. Finally, into the last equation, the coefficients of d and putting λ = n−2 n f are as follows. 2 n−2 + 1 − (2 − n−2 ∗ The coefficient of d is − [n−(n−2)ρ] n ρ)ρ n = 0; n2 2 n−2 n ∗ The coefficient of f is ρ n−2 [n−(n−2)ρ]+ρ2 −(2− n ρ)ρ n−2 = 0; from which the proof is complete. S6 S2. Proofs for Section 3.3. Here are some needed facts. Fact 1. (Schur Product Theorem) If A1 and A2 are both positive semidefinite matrices (i.o, A1 ≥ 0 and A2 ≥ 0) A1 ◦ A2 ≥ 0. Fact 2. For positive semidefinite matrices A1 , A2 , A3 and A4 , if A1 ≥ A2 , A3 ≥ A4 , A1 ◦ A3 ≥ A2 ◦ A4 . Fact 3. If A be a nonsingular matrix and u and v are two vectors, then (S10) |A + uv 0 | = |A|(1 + v 0 A−1 u). Further, if v 0 A−1 u 6= −1, then A + uv 0 is nonsingular and (S11) (A + uv 0 )−1 = A−1 − (A−1 u)(v 0 A−1 ) , 1 + v 0 A−1 u which is called the Sherman-Morrison Formula. Fact 4. Dl defined in Assumption 3.2 has n − 1 positive eigenvalues and one negative eigenvalue. The following three lemmas are needed for the proofs. Lemma S2.1 and Lemma S2.2 are from [4]; Lemma S2.3 is from [2]. Lemma S2.1. Suppose D is an n×n symmetric matrix whose eigenvalues are all positive except for one negative. If 1n 1Tn + D ≥ 0, there are a > 0, b > 0 and 0 ≤ s ≤ 1 such that s1n 1Tn + aIn ≤ 1n 1Tn + D ≤ 1n 1Tn + bIn . Lemma S2.2. matrix h(xD ), For an n × n matrix A > 0 and an n × p full column rank  −1 1Tn {A−1 − A−1 h(xD ) hT (xD )A−1 h(xD ) hT (xD )A−1 }1n = 0 if and only if 1n ∈ C(h(xD )). Define A = R − 1n 1Tn for the following lemma and the rest of the proofs in the supplementary materials. ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION Lemma S2.3. S7 If 1n ∈ C(h(xD )), then A is nonsingular and R−1 PR = A−1 PA , where PR is defined in Equation (2.6) and PA = Iγ − h(xD ){hT (xD )A−1 h(xD )}−1 hT (xD )A−1 . Proof of Lemma 3.3. (i) If ∀l, 1 ≤ l ≤ p, γl → 0+ , one has R → In , and the marginal likelihood becomes 1 L(γ | yD ) ∝ |hT (xD )h(xD )|− 2 (S02 )−( n−q +a−1) 2 , where S02 = (yD − h(xD )θ̂ 0 )T (yD − h(xD )θ̂ 0 ), with θ̂ 0 = (hT (xD )h(xD ))−1 hT (xD )yD . Similarly, the profile likelihood will be 2 2 −n/2 L(γ | yD , σ̂M . LE , θ̂M LE ) ∝ (S0 ) Hence the marginal likelihood and profile likelihood exist, and their values are positive. (ii) Because R = R1 ◦ R2 ◦ · · · ◦ Rp , and for each Rl , l = 1, . . . , p, Rl = 1n 1Tn + νl (γl )(Dl + o(1)), it follows from Lemma S2.1 that Cl1 1n 1Tn + Cl2 νl (γl )In ≤ Rl ≤ 1n 1Tn + Cl3 νl (γl )In , and, from Fact 2, that b1 1n 1Tn + b2 In ≤ R ≤ 1n 1Tn + b3 In , Qp Qp Qp where b = C , b = {C + C ν (γ )} − 1 2 l1 l1 l2 l l l l l Cl1 and b3 = Qp l {1 + Cl3 νl (γl )} − 1. Using Equation (S10) yields (S12) bn−1 (b2 + b1 n) ≤ |R| ≤ b3n−1 (b3 + n). 2 Thus (S13) |R| = O(bn−1 )=O ( 2 p X l=1 νl (γl ))n−1 ! . S8 Using Equation (S11), it follows that b−1 3 (In − (S14) 1n 1Tn b1 1n 1Tn ), ) ≤ R−1 ≤ b−1 2 (In − b3 + n b2 + nb1 and using Equation (S10), that b−q hT (xD )h(xD ) (1 − 3 (S15) 1Tn Px 1n ) b3 + n hT (xD )R−1 h(xD ) ≤ b−q hT (xD )h(xD ) (1 − b1 2 ≤ 1Tn Px 1n ), b2 + nb1 −1 T D where Px = h(xD ) hT (xD )h(xD ) h (x ). Thus if 1n ∈ / C(h(xD )), ! p X (S16) hT (xD )R−1 h(xD ) = O ( νl (γl ))−q . l=1 If 1n ∈ C(h(x)), by applying Lemma S2.2, one additionally has 1Tn Px 1n = n. Applying this fact to Inequality (S15) yields −(q−1) b3 ≤ hT (xD )h(xD ) 1 b3 + n −(q−1) hT (xD )R−1 h(xD ) ≤ b2 hT (xD )h(xD ) 1 , b2 + nb1 from which it follows that (S17) T −1 D h (x )R p X h(x ) = O ( νl (γl ))−(q−1) D l ! . T 1n 1n −1 According to Equation (S14), R−1 = O(b−1 4 (In − b5 +n )), where b4 = Pp P p O(( l (νl (γl )))) → 0 and b−1 5 = O(( l (νl (γl )))) → 0, when γl → ∞ for all 1 ≤ l ≤ p. Plugging R−1 = O(b−1 4 (In − D 1n ∈ / C(h(x )), then (S18) 1n 1T n b5 +n )) into Q below, if Q = R−1 − R−1 h(xD ){hT (xD )R−1 h(xD )}−1 hT (xD )R−1   (In − Px )1n 1Tn (In − Px ) −1 = O b4 (In − Px − ) b5 + n − 1Tn Px 1n !   p X 1n 1Tn −1 =O ( νl (γl )) I n − Px − . n l=1 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION S9 If 1n ∈ C(h(xD )), using Equation (S12) and the fact that 1n 1Tn is positive semidefinite, one has   b1 − 1 −1 −1 T b−1 I ≤ A ≤ b I − 1 1 ≤ b−1 n n n 3 n 2 2 In , b2 + n(b1 − 1) Pp where A is defined before Lemma S2.3. Define b−1 6 = O(( l (νl (γl )))) → 0, when γl → ∞ for all 1 ≤ l ≤ p. Using Lemma S2.3, it follows that (S19) Q = A−1 − A−1 h(xD ){hT (xD )A−1 h(xD )}−1 hT (xD )A−1  = O b−1 6 (I − Px ) ! p X νl (γl ))−1 (I − Px ) . =O ( l Using Equation (S18) and Equation (S19), we have (S20) p X 2 D T D νl (γl ))−1 S = (y ) Qy = O ( l ! . By combining Equation (S13), (S16), (S17) and (S20), the proof is complete. Proof of Lemma 3.4. and (i) If ∀l, 1 ≤ l ≤ p, γl → 0+ , one has R → In Q → I n − Px . For ∀l, 1 ≤ l ≤ p, we have " (S21) tr(Wl2 ) = tr " 2 #  # ∂R ∂R 2 ≤ Ctr Q , ∂γl ∂γl with C > 0 being a constant. Note that I∗ (γ) is the Fisher information matrix from the marginal likelihood and is positive semidefinite. According to the Hadamard’s inequality, the determinant of a positive semidefinite matrix is bounded by its diagonal elements, and thus, (S22) #1/2 " #1/2 " p p Y Y  ∂R 2 R ∗ 1/2 2 . π (γ) ∝ |I (γ)| ≤ (n − q) tr(Wl ) ≤C tr ∂γl l=1 with C > 0. l=1 S10 (ii) For simplicity, νl and ωl are used to represent νl (γl ) and ωl (γl ) in the proof, respectively. If 1n ∈ / C(h(xD )), Assumption 3.2 implies, for any 1 ≤ m ≤ p, p X T R = 1n 1n + νl Dl + F−m + o(νm ), l=1 where F−m is an n × n matrix that does not depend on γm . Thus, for any 1 ≤ l ≤ p, ∂R ∂γl (S23) ∞ ≤ C|νl0 |, where C > 0 is a positive constant. Using Equation (S18) yields 2  2 !  νl0 ∂R 2 Pp Q =O , (S24) tr(Wl ) = tr ∂γl l=1 νl and thus Equation (3.2) follows using the fact that the determinant of positive semidefinite matrix is bounded by its diagonal elements. For the case 1n ∈ C(h(xD )), w.l.o.g., we assume m = 1. Denote (S25) Ψ= p X νl ∂R − A, Ψ+A− p X νl ∂R l=1 νl0 ∂γl and (S26) ∂R1 ν0 = 1 ∂γ1 ν1 l=2 νl0 ∂γl ! . Using Lemma S2.3 yields (S27) (S28) ν0 tr(W1 ) = 1 tr ν1 " l=2 νl0 ∂γl ! A−1 PA # p X ν10 νl −1 = tr ΨA PA + PA − Wl , ν1 νl0 tr(W12 ) =  ν10 ν1 " Ψ+A− p X νl ∂R 2 # l=2 " tr ΨA−1 PA + PA − p X νl l=2 νl0 Wl #2 , S11 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION and, for 2 ≤ j ≤ p, ν0 tr(W1 Wj ) = 1 tr ν1 (S29) " ΨA −1 PA + PA − p X νl l=2 νl0 Wl ! # Wj . Note that (PA )2 = PA , tr(Wl PA ) = tr(Wl ) for all 1 ≤ l ≤ p, and tr(PA ) = n − q. For the reference prior defined in Equation (2.8), first ν0 ν0 put ν11 outside the determinant by dividing ν11 on the second column and the second row. Then multiply the first row by −1 and add it to the second row. Also, multiply the first column by −1 and add it to the second column. After the above manipulation of the determinant, it follows that (S30) 1/2 n − q tr (B)  tr(W2 ) ... tr(Wp ) tr B2 tr (BW2 ) ... tr (BWp ) 0 ν tr(W22 ) ... tr(W2 Wp ) π R (γ) ∝ 1 , ν1 . . .. . . tr(Wp2 ) where B = ΨA−1 PA − by ν1 , ν10 p P l=2 νl Wl . νl0 Further multiple the (l +1)th column 2 ≤ l ≤ p, and add them to the second column. Then multiply the (l + 1)th row by follows that (S31) n−p π R (γ) ∝ ν10 ν1 ν1 , ν10 2 ≤ l ≤ p, and add them to the second row. It  tr ΨA−1 PA 2 tr ΨA−1 PA tr(W2 ) tr ΨA−1 PA W2 tr(W22 )  ... ... ... .. . tr(Wp )  tr ΨA−1 PA Wp tr(W2 Wp ) .. . tr(Wp2 ) By definition, (S32) A= p X l=1 νl Dl + p X νl ωl D∗l + l=1 and (S33) ∂R = νl0 Dl + [νl0 ωl + νl ωl0 ]D∗l + νl0 ∂γl X l6=m νl νm (Dl ◦ Dm + o(1)), p X m∈{1,...,p}\l νm (Dl ◦ Dm + o(1)). 1/2 . S12 By Equation (S25), we have (S34) p X νl2 ωl0 ∗ Ψ = O( Dl ). νl0 l=1 Directly applying Cramer’s rule to the reference prior in Equation (S31) yields ! p 2 1/2 ν10 Y 2 −1 . { tr(Wl )tr ΨA PA } O ν1 l=2 Using Equation (S19), (S24) and (S34), the result for p ≥ 2 of (ii) in Lemma 3.4 follows. Proof of Lemma 3.5. For any γl1 → ∞, 1 ≤ l1 ≤ p1 , Rl1 → 1n 1Tn and the correlation matrix is R → Rp1 +1 ◦ Rp1 +2 ◦ ... ◦ Rp . Note that γl < ∞ with p1 + 1 ≤ l ≤ p. The following result is from the first part of Lemma 3.3, (S35) L(γ | yD ) = O(1) Since at least one γl does not go to infinity, Equation (S18) and Equation (S19) yield, Q = O(1). Assumption 3.2 implies (S36) ∂R ∂γl ∞ ≤ C|νl0 (γl )|, where C is a postive constant. So that, for any 1 ≤ l1 ≤ p1 ,  2 !  ∂R (S37) tr(Wl21 ) = tr Q = O νl01 (γl1 )2 . ∂γl1 Since p1 + 1 ≤ l2 ≤ p2 , γl → 0+ , the proof of Lemma 3.4 yields   ∂R 2 2 tr(Wl2 ) ≤ Ctr . ∂γl2 And for p1 + 1 ≤ l3 ≤ p, since γl3 is finite,  2 ∂R 2 Q = O(1). (S38) tr(Wl3 ) = tr ∂γl3 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION S13 The fact that the determinant of a positive semidefinite matrix is bounded by its diagonal elements yields (S39) π R (γ) ≤ C p1 Y l1 =1  νl01 (γl1 )  p2 Y tr l2 =p1 +1  ∂R ∂γl2 2 1/2  . Combining the result of Equation (S35) and Equation (S39), the proof is complete. Proof of Theorem 3.2. Only the proof for Matérn correlation is given here; and the rest of cases can be checked similarly. When p = 1, posterior propriety is established in [2]. For p > 1, only the case 1n ∈ C(h(xD )) is shown below; the case 1n ∈ / C(h(xD )) can be checked similarly. (i) First assume γ(1) ≤ γ(2) ≤ ... ≤ γ(p) and each γl goes to ∞ . (i.1) For the case 0 < α < 1, the marginal posterior is (S40) p Q γl−2α−1 π R (γ)L(γ | yD ) ≤ C1 l=1 −2pα γ(1) −2+2α γ(1) , with C1 > 0 being a constant. To show that REquation (S40) is R∞R∞ ∞ π R (γ)L(γ | integrable, we need only prove that M γ ... γ (1) (p−1) yD )dγ is finite, which is easily seen from the following: Z ∞Z ∞ Z ∞ ... π R (γ)L(γ | yD )dγ M ≤ C2 = C3 Z γ(1) ∞Z ∞ M Z ∞ γ(1) γ(p−1) ... Z ∞ p Y γ(p−1) l=2 −2α−1 2pα−3 γ(l) γ(1) dγ(p) ...dγ(1) 2α−3 γ(1) dγ(1) M 2α−2 = C4 M < ∞, for M > 0, C2 > 0, C3 > 0, C4 > 0 being constants and 0 < α < 1. By Fubini’s Theorem, Equation (S40) is integrable. S14 (i.2) For the case α = 1, as π R (γ)L(γ | yD ) ≤ p Q 2logγl −1 1 2 (2logγ γl3 γ(1) (1) −1) l=1 p C1  , log(γ(1) ) log(γ1 ) 2 γ(1) 2 γ(1) we have Z ≤ ∞Z ∞ M γ(1) ∞Z ∞ Z M ... ... Z = C3 Z ∞  M ∞ ∞ π R (γ)L(γ | yD )dγ γ(p−1) ∞ R Z γ(1) γ(1) ≤ C2 Z π (γ)L(γ | yD )dγ 2logγ(1) −1 3 γ(1) logγ(1) 2 γ(1) p+1  log(γ(1) ) 2 γ(1) p−1 dγ(1) 2 (2logγ γ(1) (1) − 1) 1 dγ(1) γ(1) log2 γ(1) M C4 logM < ∞. = for C1 > 0, C2 > 0, C3 > 0, C4 > 0 and M > 0 being constants. (i.3) For the case 1 < α < 2, similarly we have, Z ∞Z ∞ Z ∞ ... π R (γ)L(γ | yD )dγ M ≤ C1 = C2 Z γ(1) γ(p−1) ∞Z Z M Z ∞ M ∞ γ(1) ... ∞ γ(p−1) p Q γl−3 l=1 2−2α −2p γ(1) dγ(p) ...dγ(1) γ(1) −2α+1 γ(1) dγ(1) = C3 M −2α+2 < ∞. for C1 > 0, C2 > 0, C3 > 0 and M > 0 being constants. S15 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION (i.4) For the case α = 2, we have Z ∞Z ∞ Z ∞ ... π R (γ)L(γ | yD )dγ M ≤ C1 = C2 γ(1) Z ∞Z ∞ M Z γ(p−1) ∞ M ... γ(1) Z ∞ γ(p−1) p Q γl−3 l=1 −2p γ(1) (2log(γ(1) ) − 1) dγ(p) ...dγ(1) 2 γ(1) −3 γ(1) (2log(γ(1) ) − 1)dγ(1) logM M2 < ∞. = C3 for C1 > 0, C2 > 0, C3 > 0 and M > 0 being constants. (i.5) For the case α > 2, R D π (γ)L(y |γ) ≤ p Q γl−3 C l=1−2p γ(1) −2 γ(1) ≤C p Y −1−2/p γl . l=1 for C > 0 being the constant. The right hand side is clearly integrable. (ii) If there is at least one l for which γl < ∞, Lemma 3.5 shows that the integral of the product is just the product of the individual integrals, so one only needs to check that ν 0 (γl ) is integrable when γl → ∞ and ∂R that ∂γ is integrable when γl → 0. From Table 1, ν 0 (γl ) is integrable l when γl → ∞. Noting that by the property of the modified Bessel function of the second kind, when z → ∞ ([1], Section 9.7.4.) r ∂Kα (z) π 1 →− exp(−z)(1 + O( )), ∂z 2z z from which the Matérn correlation function is integrable as γl → 0. S3. Proof for Section 4.3. Proof of Lemma 4.1. Since R̃ = R + ηIn S16 and applying similar derivations as in the proof of Lemma 3.3, it is easy to see that ! p X (S41) |R̃| = O ( νl (γl ) + η)n−1 : l=1 (S42) hT (xD )R̃−1 h(xD ) =  ! p X   −q  O ( νl (γl ) + η) ,    l=1 p  X    νl (γl ) + η)−(q−1)  O ( l=1 (S43) S̃2 = (yD )T Q̃yD = O ( p X l=1 ! 1n ∈ / C(h(xD )), , νl (γi ) + η)−1 1n ∈ C(h(xD )) : ! . The result then immediately follows. Proof of Lemma 4.2. The proofs of (a) and (b) can be done similarly to the Proof of Lemma 3.4, by noting that R̃ = R1 ◦ R2 ◦ ... ◦ Rp ◦ Rp+1 , where Rp+1 = ηIn + 1n 1Tn , with νp+1 (η) = η and ωp+1 (η) = 0. S4. Figure for Section 5.3. Figure S1 presents plots of the borehole function made by fixing seven of the inputs and varying one. From Figure S1, the outputs barely change when the 2nd , 3rd and 5th inputs (i.e., r, Tu and Tl in the borehole function) vary. References. [1] Abramowitz, M., Stegun, I. A. et al. (1966). Handbook of mathematical functions. National Bureau of Standards-Applied Mathematics Series. [2] Berger, J. O., De Oliveira, V. and Sansó, B. (2001). Objective Bayesian analysis of spatially correlated data. Journal of the American Statistical Association 96 1361– 1374. [3] Lopes, D. (2011). Development and implementation of Bayesian computer model emulators PhD thesis, Duke University. [4] Ren, C., Sun, D. and He, C. (2012). Objective Bayesian analysis for a spatial model with nugget effects. Journal of Statistical Planning and Inference 142 1933–1946. S17 0.06 0.08 0.10 0.12 0.14 10000 30000 50000 Y 70 60 65 77.28115 0 rω 70000 90000 110000 1000 1080 Hu 95 85 95 Y Y 65 70 65 77.10 70 70 75 75 75 80 Y 80 85 80 90 90 85 77.30 Y 1040 Tu r 77.20 75 80 85 77.28135 Y 77.28125 Y 77.35 77.25 20 40 77.30 60 80 Y 100 77.40 140 77.45 90 ROBUST GAUSSIAN STOCHASTIC PROCESS EMULATION 70 80 90 Tl 100 110 700 720 740 760 Hl 780 800 820 1100 1200 1300 1400 1500 1600 1700 10000 10500 L Fig S1. The plot of borehole output by varying one input at a time. 11000 Kω 11500 12000
10math.ST
Fermat-type configurations of lines in P3 and the containment problem arXiv:1702.02160v2 [math.AG] 8 Sep 2017 Grzegorz Malara, Justyna Szpond Abstract The purpose of this note is to show a new series of examples of homogeneous ideals I in K[x, y, z, w] for which the containment I (3) ⊂ I 2 fails. These ideals are supported on certain arrangements of lines in P3 , which resemble Fermat configurations of points in P2 , see [14]. All examples exhibiting the failure of the containment I (3) ⊆ I 2 constructed so far have been supported on points or cones over configurations of points. Apart from providing new counterexamples, these ideals seem quite interesting on their own. Keywords containment problem, symbolic powers, arrangements of hyperplanes, intersection lattice, Fermat configurations Mathematics Subject Classification (2000) 14N20 · 13F20 · 13C05 · 14N05 1 Introduction We study here containment relations between symbolic and ordinary powers of homogeneous ideals. Definition 1.1 (Symbolic power). Let I ⊆ K[PN ] be a homogeneous ideal. For m > 0 the m-th symbolic power of I is defined as \ I (m) = (I m RP ∩ R) , (1) P ∈Ass(I) where Ass(I) is the set of associated primes of I. Problem 1.2 (The containment problem). Let I ⊆ K[PN ] be a homogeneous ideal. Determine all pairs of non-negative integers m, r such that there is the containment a) I r ⊆ I (m) ; b) I (m) ⊆ I r . Part a) of the Containment Problem has an easy answer: The containment holds if and only if r > m, see [2, Lemma 8.4.1]. Part b) has attracted a lot of attention in recent years. Motivated by Swanson’s work on the equivalence of adic and symbolic topologies on noetherian commutative rings [18], Ein, Lazarsfeld and Smith proved in [6] a ground-breaking result, which in a form convenient for this work, reads as follows. 2 Theorem 1.3 (Ein, Lazarsfeld, Smith). Let V ⊆ PN be a subvariety of codimension e and let I = I(V ) be its defining ideal. Then I (m) ⊆ I r holds for all m > re. It is natural to wonder to what extent the containment condition in Theorem 1.3 is tight. This question is meaningful when one asks for all ideals with certain properties. For example, if I is a complete intersection ideal, then I (m) = I m for all m > 1 and thus I (m) ⊆ I r holds for all m > r. Prompted by a considerable number of studied examples, the authors in [2, Conjecture 8.4.3] state the following Conjecture. Conjecture 1.4. Let I be a homogeneous ideal with 0 6= I codim(Zeroes(I)) = e. Then I (m) ⊆ I r K[PN ] such that for m > er − (e − 1). If I is an ideal of points in PN , then e = N and the Conjecture predicts that I (m) ⊆ I r for all m > N r − (N − 1). In particular, for N = 2 and r = 2, which is the first non-trivial case, the Conjecture reduces to the question asked by Huneke around 2000, if there is the containment I (3) ⊆ I 2 (2) for all ideals of points in P2 . During the past decade or so, a considerable amount of research has been devoted to the containment (2), and more generally to Conjecture 1.4 in the case I is an ideal of points in PN , i.e., e = N . By now, for e = N there are a number of counterexamples available, showing that Conjecture 1.4 was overoptimistic. In positive characteristic, series of counterexamples involving various r and N have been constructed by Harbourne and Seceleanu in [8]. In characteristic 0, the list of counterexamples is much shorter and they all deal with the containment (2) in P2 . The first counterexample was announced by Dumnicki, Szemberg and Tutaj-Gasińska in [5]. Further constructions followed in [4], [3], [8], [10], [11], [15]. See [19] for a survey of counterexamples known until now. In this paper we show the first non-trivial (i.e. not a cone over points in P2 ) counterexample in characteristic 0 to Conjecture 1.4 in the case N = 3 and e = 2, i.e., for an ideal of a 1-dimensional subscheme in P3 . Our main result is the following. Main Theorem. There exists an arrangement of lines in P3 , not all passing through the same point, such that for its defining ideal I one has I (3) * I 2 . In fact, we construct a sequence of arrangements of lines satisfying the Main Theorem. 3 2 Arrangement of hyperplanes Arrangements of lines, more precisely point sets defined as intersection points of arrangement lines, have played a pivotal role in exhibiting counterexamples to Conjecture 1.4. It is therefore not surprising that arrangements of hypersurfaces and higher dimensional flats in which they intersect, lead to counterexamples based on higher dimensional subvarieties. Of course, there is a trivial construction of a cone over a counterexample configuration of points in P2 . A non-trivial example requires arrangements to be picked much more carefully. We present here a series of such constructions. We begin this section with introducing some general notation for arrangements of hyperplanes in projective spaces. Later on we specialize to what we call Fermat-type arrangements. Definition 2.1 (Intersection lattice). Let H = {H1 , . . . , Hd } be an arrangement of hyperplanes, i.e., a finite set of codimension 1 projective subspaces in PN . The set L(H) of all non-empty intersections of hyperplanes in H is the intersection lattice of H. All elements in L(H) are projective flats (i.e. projective subspaces). For a flat V ∈ L(H) we define the multiplicity multH (V ) of H along V as the number of hyperplanes in H containing V . The symbol H(k) stands for the union of all k-dimensional flats in L(H). In particular H(N − 1) denotes all hyperplanes in the arrangement, and H(0) denotes all points in L(H) We define the numbers tH j (k) as the number of k-dimensional flats of multiplicity j in H. For k = N − 2, we have the following fundamental combinatorial equality   X N   d j = · tH j (k). 2 2 (3) j>2 For N = 3 there is a combinatorial formula generalizing (3), due to Hunt, see [9, part II, Section 6.1.1]. We denote by tH pq the number of points of multiplicity p on q-fold lines. Then we have     X X     X d p q H H H  = tp (0) − tpq − tq (1) . (4) 3 3 3 p>q p>3 3 q>3 Fermat configurations in P2 The Fermat arrangement F2n of lines in P2 for a given n is defined by the equation (xn − y n )(y n − z n )(z n − xn ) = 0. Thus there are 3n lines, which intersect by three in n2 points and there are 3 additional points of multiplicity n. The non-zero numerical invariants are therefore Fn Fn t3 2 (0) = n2 and tn2 (0) = 3, see also [21, Example II.6] for more details. 4 These arrangements appear in the literature under several names. In the book of Barthel, Hirzebruch and Höfer they are called Ceva arrangements, see [1, Section 2.3.I]. The same terminology is kept in the recent book by Tretkoff [20, Chapter V, 5.2]. Both these beautiful books are focused on surfaces of general type arising as ball quotients. In the area of commutative algebra the name Fermat arrangement seems more customary, see [14]. For n = 3 we get as a special case the celebrated dual Hesse arrangement with F23 t3 (0) = 12 and all other invariants vanishing. In the context of the containment problem for the set of all intersection points of F2n defined by the ideal In = (x(y n − z n ), y(z n − xn ), z(xn − y n )) (3) the containment In ⊆ In2 fails as proved by Harbourne and Seceleanu in [8, Proposition 2.1]. A completely different proof based on a more general theoretical framework has been presented by Seceleanu, see [15, Proposition 4.2]. Additionally, idealtheoretic properties of these configurations have been treated by Nagel and Seceleanu in [14]. 3.1 Fermat configurations in P3 In this section we study Fermat arrangements of flats (planes and lines) in P3 . Arrangements of this kind are well-known in the literature as they come from finite unitary reflection groups, G(n, n, N ), see [16, page 295]. Here we study the case N = 3 and postpone the general case to the forthcoming paper [12]. The Fermat arrangement F3n of planes in P3 is defined by the vanishing of the polynomial Fn (x, y, z, w) = (xn − y n )(xn − z n )(xn − wn )(y n − z n )(y n − wn )(z n − wn ). (5) There are 6n planes in the arrangement. They intersect in triples along 4n2 lines and there are 6 additional lines of multiplicity n. Therefore the non-zero invariants of the arrangements F3n (1) are Fn Fn Fn t2 3 (1) = 3n2 , t3 3 (1) = 4n2 and tn3 (1) = 6. The six n–fold lines of the arrangement are the edges of the coordinate tetrahedron. Since we are interested in the third symbolic power of an ideal, we restrict our attention to those lines in F3n (1) which have multiplicity at least 3. Definition 3.1 (The restricted Fermat configuration of lines). The restricted Fermat configuration RFn3 (1) of lines in P3 is the union of all lines in F3n (1) with multiplicity at least 3. For completeness we list also non-zero dimensional invariants of F3n (0). Using (4) we have Fn F3n Fn t6 3 (0) = n3 , tn+1 (0) = 6n and t3n3 (0) = 4. The four 3n-fold points in the arrangement are the vertices of the coordinate tetrahedron. 5 4 The non-containment result We begin by an explicit description of the ideal In defining the 6 + 4n2 lines in the restricted Fermat arrangement RFn3 (1) in P3 . Lemma 4.1. The ideal In = I(RF n3 (1)) is generated by g1 = (xn − y n )(z n − wn )xy, g3 = (xn − z n )(y n − wn )xz, g5 = (xn − wn )(y n − z n )xw, g2 = (xn − y n )(z n − wn )zw, g4 = (xn − z n )(y n − wn )yw, g6 = (xn − wn )(y n − z n )yz. Proof. The ideal Jn of the 4n2 triple lines is a complete intersection ideal Jn = ((xn − y n )(z n − wn ), (xn − z n )(y n − wn )). Since (xn − wn )(y n − z n ) = (xn − z n )(y n − wn ) − (xn − y n )(z n − wn ), it is clear that for every line in the set of lines defined by Jn , there are three planes from F3n (2) vanishing along this line. Furthermore, it is clear that, for example, any plane defined by the vanishing of n (x − y n ) belongs to the pencil of planes vanishing along the line (x, y). Thus there are n planes in the arrangement, which vanish along the (x, y) line. The same holds, by symmetry, for an arbitrary pair of variables, i.e., any other coordinate line. The ideal of the union of 4n2 triple lines and the 6 coordinate lines is then defined by In = Jn ∩ (x, y) ∩ (x, z) ∩ (x, w) ∩ (y, z) ∩ (y, w) ∩ (z, w). The generators of In can then be easily read off of this presentation. From the Zariski-Nagata Theorem, see [7, Theorem 3.14] we obtain immediately (3) Corollary 4.2. The polynomial Fn in (5) is an element of In . The polynomial Fn is exactly the reason for the non-containment in the Main Theorem. We state now a Theorem from which the Main Theorem follows immediately. Theorem 4.3. For an arbitrary integer n > 3 and In the ideal of lines in the restricted Fermat arrangement RFn3 (1) the containment In(3) ⊂ In2 fails. Proof. We know from Corollary 4.2 that the polynomial Fn (x, y, z, w) is contained (3) in In . We will show that it is not contained in In2 . To this end, we parrot to some extent the proof for the dual Hesse arrangement from [5, Theorem 2.2] and for Fermat arrangements F2n from [8, Proposition 2.1]. Keeping the notation from Lemma 4.1, we assume to the contrary that Fn ∈ In2 . Then there are homogeneous polynomials hi,j for 1 6 i 6 j 6 6 of degree 2n − 4 (this count is the reason for the assumption n > 3) such that X Fn = hi,j gi gj . (6) 16i6j66 6 Taking the identity (6) modulo (x) we obtain −y n z n wn (y n − z n )(y n − wn )(z n − wn ) = y 2n z 2 w2 (z n − wn )2 e h2,2 2n 2 2 n n 2 +z y w (y − w ) e h4,4 +w2n y 2 z 2 (y n − z n )2 e h6,6 +y n+1 z n+1 w2 (y n − wn )(z n − wn )e h2,4 +y n+1 wn+1 z 2 (y n − z n )(z n − wn )e h2,6 +z n+1 wn+1 y 2 (y n − z n )(y n − wn )e h4,6 . (7) We write here fe to indicate the residue class of a polynomial f ∈ K[x, y, z, w] modulo (x). Now we look at the coefficient of the monomial y 3n z 2n wn in (7). On the left hand side of the equation this coefficient is −1. On the right hand side of the equation, the monomial y 3n z 2n wn can be obtained only from the second summand as a summand in the product y 2n+2 z 2n w2 · e h4,4 . Taking this for granted for a while, this shows that the coefficient of the monomial y n−2 wn−2 in e h4,4 , and hence also in h4,4 is −1. Turning to the occurrence of the monomial y 3n z 2n wn on the right hand side of (7), note to begin with that its coefficient must be zero in the first summand. Indeed, already in the product y 2n z 2 w2 (z n − wn )2 either the power of z or the power of w is too large, i.e., exceeds corresponding powers of z and w in y 3n z 2n wn . Similarly, in the third, fifth and sixth summand the powers of w are too large, whereas in the fourth summand either the power of z or that of w are too large. The idea now is to consider (6) modulo (z) and identify the coefficient of the monomial y n−2 wn−2 in h4,4 as 1, which gives clearly a contradiction. Turning to the details, (6) modulo (z) gives −xn y n wn (xn − y n )(xn − wn )(y n − wn ) = w2n x2 y 2 (xn − y n )2 b h1,1 2n 2 2 n n 2b + x y w (y − w ) h4,4 + y 2n x2 w2 (xn − wn )2 b h5,5 − xn+1 wn+1 y 2 (xn − y n )(y n − wn )b h1,4 − y n+1 wn+1 x2 (xn − y n )(xn − wn )b h1,5 + xn+1 y n+1 w2 (xn − wn )(y n − wn )b h4,5 . (8) We write now fb to indicate the residue class of a polynomial f ∈ K[x, y, z, w] modulo (z). This time it is the monomial x2n y 3n wn which appears with the coefficient +1 on the left hand side of (8) and which can appear only in the second summand on the right hand side of (8). The argument is exactly the same as for the modulo (x) case, with necessary adjustment of used variables. The conclusion now is that the coefficient of the monomial y n−2 wn−2 of h4,4 is +1. This contradiction shows that (6) cannot hold, which in turns means that Fn ∈ / In2 as asserted. 7 5 Higher dimensional generalizations There is no reason to restrict this construction to P3 . In PN , we define degree n n of hyperplanes as given by the zero-locus of the polynomial Fermat arrangement FN Y Fn (x0 , . . . , xN ) = (xni − xnj ). 06i<j6N Remark 5.1. For n = 1 we obtain the well-known braid arrangement [17, Example 1.3]. From this point of view, our construction can be also viewed as higher order braid arrangements. n (N − 2)), the In [13] we show that in codimension 2 for I = I(N, n) = I(RFN containment I (3) ⊆ I 2 still fails. On the other hand, there are several interesting algebraic properties of n (k)), which we study in the forthcoming article [12]. ideals I(FN Acknowledgement. Research of Szpond was partially supported by National Science Centre, Poland, grant 2014/15/B/ST1/02197. Research of Malara was partially supported by National Science Centre, Poland, grant 2016/21/N/ST1/01491. We would like to thank Piotr Pokora and Tomasz Szemberg for helpful conversations. Many thanks go to the referee for patience and valuable comments on the original draft of the paper. References [1] Barthel, G., Hirzebruch, F., Höfer, T.: Geradenkonfigurationen und Algebraische Flächen, Springer, 1987 [2] Bauer, Th., Di Rocco, S., Harbourne, B., Kapustka, M., Knutsen, A.L., Syzdek, W. and Szemberg, T.: A primer on Seshadri constants, pp. 33–70, in: Interactions of Classical and Numerical Algebraic Geometry, Proceedings of a conference in honor of A. J. Sommese, held at Notre Dame, May 22-24 2008. Contemporary Mathematics vol. 496, 2009, eds. D. J. Bates, G-M. Besana, S. Di Rocco, and C. W. Wampler, 362 pp. [3] Bocci, C., Cooper, S., Harbourne, B.: Containment results for various configurations of points in PN , J. Pure Appl. Alg. 218 (2014), 65–75 [4] Czapliński, A., Glówka, A., Malara, G., Lampa-Baczyńska, M., Luszcz-Świdecka, P., Pokora, P. and Szpond, J.: A counterexample to the containment I (3) ⊂ I 2 over the reals, Adv. Geom. 16 (2016), 77–82 [5] Dumnicki M., Szemberg T., Tutaj-Gasińska H.: Counterexamples to the I (3) ⊂ I 2 containment, J. Algebra 393 (2013), 24–29 [6] Ein, L., Lazarsfeld, R., Smith, K.: Uniform bounds and symbolic powers on smooth varieties, Invent. Math. 144 (2001), 241–252 [7] Eisenbud, D.: Commutative algebra. With a view toward algebraic geometry. Graduate Texts in Mathematics, 150. Springer-Verlag, New York, 1995 [8] Harbourne, B., Seceleanu, A.: Containment counterexamples for ideals of various configurations of points in PN , J. Pure Appl. Algebra 219 (2015), 1062–1072 [9] Hunt, B.: Complex Manifold Geography in Dimension 2 and 3, J. Diff. Geom. 30 (1989), 51–153 8 [10] Keane, R. W., Küronya, A., McMahon, E.: An Elementary Approach to Containment Relations Between Symbolic and Ordinary Powers of Certain Monomial Ideals, Comm. Alg in press, DOI: 10.1080/00927872.2016.1175463 [11] Lampa-Baczyńska, M., Malara, G.: On the containment hierarchy for simplicial ideals, J. Pure Appl. Algebra 219 (2015), 5402–5412 [12] Malara, G., Szemberg, T., Szpond, J.: On the hierarchy of Fermat ideals, work in progress [13] Malara, G., Szpond, J.: On codimension two flats in Fermat-type arrangements, to appear, arXiv:1705.00639 [14] Nagel, U., Seceleanu, A.: Ordinary and symbolic Rees algebras for ideals of Fermat point configurations. J. Algebra 468 (2016), 80–102 [15] Seceleanu, A.: A homological criterion for the containment between symbolic and ordinary powers of some ideals of points in P2 , J. Pure Appl. Alg. 219 (2015), 4857–4871 [16] Shephard, G. C., Todd, J. A.: Finite unitary reflection groups. Canadian J. Math. 6 (1954), 274–304 [17] Stanley, R. P.: An introduction to hyperplane arrangements. Lecture notes, IAS/Park City Mathematics Institute, 2004 [18] Swanson, I.: Linear equivalence of ideal topologies, Math. Z. 234 (2000), 755–775 [19] Szemberg, T., Szpond, J.: On the containment problem, Rend. Circ. Mat. Palermo 66 (2017), 233–245 [20] Tretkoff, P.: Complex Ball Quotients and Line Arrangements in the Projective Plane. Mathematical Notes 51, Princeton University Press 2016 [21] Urzúa, G.A.: Arrangements of curves and algebraic surfaces. Thesis (Ph.D.) University of Michigan. 166 pp. ISBN: 978-0549-82049-9, 2008 Grzegorz Malara, Department of Mathematics, Pedagogical University of Cracow, Podchora̧żych 2, PL-30-084 Kraków, Poland. E-mail address: [email protected] Justyna Szpond, Department of Mathematics, Pedagogical University of Cracow, Podchora̧żych 2, PL-30-084 Kraków, Poland. E-mail address: [email protected]
0math.AC
A loopless and branchless O(1) algorithm to generate the next Dyck word.∗ arXiv:1602.06426v2 [cs.DS] 19 Mar 2018 Cassio Neri 19 July 2014† Abstract Let integer be any C/C++ unsigned integer type up to 64-bits long. Given a Dyck word the following code returns the next Dyck word of the same size, provided it exists. ✞ ☎ i n te g e r next dyck i n t e g e r const a i n t e g e r const b integer c c c return c ; } ✝ 1 w o r d ( i n t e g e r w) { = w & −w ; = w + a; = w ˆ b; = ( c / a >> 2 ) + 1 ; = ( ( c ∗ c − 1) & 0 xaaaaaaaaaaaaaaaa ) | b ; Listing 1: Bitwise tricks to generate a Dyck word. ✆ Introduction A 2n-bits Dyck word is a string containing exactly n 1s and n 0s and such that each of its prefix substrings contains no more 0s than 1s. Dyck words appear in a vast number of problems [5]. Consequently, generating them has many applications. For instance, if 1s and 0s are replaced with openning and closing parentheses, then a Dyck word is a combination of n properly balanced pairs of parentheses. When 1 denotes a move rightwards and 0 denotes a move upwards, a Dyck word represents a monotonic path along the edges of an n × n grid that starts at the lower left corner, finishes at the upper right corner and stays below diagonal. Figure 1 shows all 14 such paths on a 4 × 4 grid. For the sake of clarity, another implementation of essentially the same algorithm is presented. This one works on strings of two different arbitrarily chosen symbols (e.g., opening and closing parentheses). Contrarily to the implementation in Listing 1, the second one has explicit loops and branches and has O(n) time complexity. The apparent contradiction between being two implementations of “essentially the same” algorithm but one being loopless, brancheless and O(1) and the other having loops, branches and being O(n) can be explanained as follows. ∗ This † First work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. revision uploaded to [2] on 22 Jul 2014 and current revision on 15 Feb 2018. 1 Figure 1: Monotonic paths on a 4 × 4 grid starting at the lower left corner, finishing at the upper right corner and staying below diagonal. There are 14 of them. The first path, for instance, corresponds to the Dyck word 10101010 and the fith one to 10111000. To perform bitwise and arithmetic operations the hardware somehow “runs” loops on its transistors but, as far as I understand, for the sake of software complexity, these operations are considered as being loopless, branchless and O(1). In that sense we can categorize the algorithm in Listing 1 as loopless, branchless and O(1). The second implementation (through software code) simply explicits the loops and branches “ran” by the hardware when Listing 1 is executed. Both implementations are O(1) in space. Disclaimer: I am not a Computer Scientist and I am not aware of the state of the art. I do not claim the algorithm in Listing 1 has not been discovered/invented before but I believe there is a strict positive probability that it has not. I have performed a not very thorought search on the net and I have failed to find anything similar. The closest I know is the Gosper’s hack [6] which, I must say, was an inspiration of Listing 1. Furthermore, this implementation borrows its first operations from Gosper’s hack. Update 1: Following extra search, I came across exercise 23 of Kunth [3]: A sequence of nested parentheses can be represented as a binary number by putting a 1 in the position of each right parenthesis. For example, ’(())()’ corresponds in this way to (001101)2, the number 13. Call such a number a parenthesis trace. a) What are the smallest and largest parenthesis traces that have exactly m 1s? b) Suppose x is a parenthesis trace and y is the next parenthesis trace with the same number of 1s. Show that y can be computed from x with a short chain of operations analogous to Gosper’s hack. Listing 1 is, basically, a solution for the exercise except that it reverses the interpretation of bits. Due to this reversal, the solution presented in [3] is differ from Listing 1 and uses a, potentially costly, sqrt operation. Update 2: I also came across Warren [4] which explains Gosper’s hack and suggests the optimizations 2 based on popcount or ctz that I have added to this article in February 2018. It also made me realize that Listing 1 is closer to Gosper’s hack than I have initially thought. 2 Definitions Let n ∈ N and B = {1, 0}. A 2n-bits word is an element w = (w1 , ..., w2n ) of B 2n . To easy notation, we most often drop parentheses and commas. (For instance, (1, 0, 1, 0, 1, 0, 1, 0) becomes 10101010.) Finally, by abuse of notation, we identify w = (w1 , ..., w2n ) with the number whose binary expansion is w. More precisely, with 2n−1 X w2n−i 2i . i=0 Thanks to this identification we can order words, talk about minimum, maximum, etc. For w ∈ B 2n and i ∈ {1, ..., 2n} we define N1 (w, i) := #{j ≤ i ; wj = 1}, N0 (w, i) := #{j ≤ i ; wj = 0}. In plain English, N1 (w, i) is the number of 1s in w appearing before or at i-th position and N0 is the number of 0s before or at position i. We say that w ∈ B 2n is a 2n-bits Dyck word (or simply a Dyck word when n is implicit) if N1 (w, i) ≥ N0 (w, i) ∀i ∈ {0, ..., 2n − 1}, (1) N1 (w, 2n) = N0 (w, 2n) = n. (2) and In plain English, before or at the i-th position, the number of 1s must be no lesser than the number of 0s. In adition the total numbers of 1s and 0s match. For the mathematically trained eye, property (1) becomes easier to spot1 when 1s and 0s are replaced, respectively, with openning and closing parentheses. In this case, the Dyck word contains n pairs of correctly matched open and close parentheses. For instance, 10101010 becomes ()()()() and 10111000 becomes ()((())). 3 The minimum and the maximum Dyck word The function in Listing 1 generates the succesor of a given Dyck word. Therefore, to kick off and stop generating all words, we need to know the minimum and maximum Dyck word of a ginven size. (Recall that “minimum” and “maximum” refer to the order of integer numbers.) We claim that the minimum 2n-bits Dyck word is w̆ := 10 · · 10} | ·{z n pairs (or () · · · () in the parenthetical representation). More precisely, w̆ = (w̆1 , ..., w̆2n ) ∈ B 2n is given by w̆i = 1, if i is odd, and w̆i = 0, if i is even. 1 At least for small values of n or not so small if you are a Lisp programmer. 3 Before proving our claim, we compute w̆: w̆ = 22n−1 + 22n−3 + · · · + 23 + 21 = 2 · 22n−2 + 2 · 22n−4 + · · · + 2 · 22 + 2 · 20 = 2 · 4n−1 + 2 · 4n−2 + · · · + 2 · 4 + 2 · 40 = 2 n−1 X 4i = i=0 2 n (4 − 1). 3 Calculating this number on real computers needs care to avoid overflow. For instance, if n = 32 then 4n = 432 = 264 which is one more than the maximum natural number representable by a 64-bits unsigned integer type. In practice, however, this is a “minor” issue because generating all 64-bits Dyck words would take “forever” given that the number of 2n-bits Dyck words grows factorially [5] with n. We shall now prove that w̆ is the minimum Dyck word. Suppose by contradiction that there’s a Dyck word w = (w1 , ..., w2n ) such that w < w̆. In particular, w 6= w̆ and let i be the minimum index such that wi 6= w̆i . Because all Dyck words start with 1 we must have i > 1 and since w < w̆, we have wi = 0 and w̆i = 1. By construction of w̆, it follows that i is odd, i − 1 is even and N1 (w̆, i − 1) = N0 (w̆, i − 1). The same holds for w because it shares the first i − 1 bits with w̆. Now, wi = 0 and thus N0 (w, i) = N0 (w, i − 1) + 1 and N1 (w, i) = N1 (w, i − 1) which yields N0 (w, i) = N1 (w, i) + 1, contradicting (1). Its much easier to see that the maximum 2n-bits Dyck word is · · 0}, ŵ := 1| ·{z · · 1} 0| ·{z n times n times which values 22n − 2n . 4 The next Dyck word Let w = (w2n−1 , ..., w0 ) be a Dyck word. In this section we characterize the Dyck word that succeeds w, that is, the smallest Dyck word of the same size which is greater than w. Assuming that w 6= ŵ, i.e., w is not the maximum Dyck word, there exists at least one index i ∈ {1, ..., 2n} such that wi = 0 and wi+1 = 1. Let k be the maximum of such indices. Since a Dyck word cannot start with a 0 or finish with a 1, we have 1 < k < k + 1 < 2n. By the maximality of k, after this position there is no 0 followed by 1. More precisely, there’s a (possibly empty) sequence of 1s followed by a non empty sequence of 0s up to the end. Hence, w has this form: w = (w1 , ..., wk−1 , |{z} 1 , 1, ..., 1, 0, ..., 0), 0 , |{z} | {z } | {z } | {z } wk prefix wk+1 x times y times with x ≥ 0 and y > 0. We shall prove that the successor w̃ of w has this form: w̃ = (w1 , ..., wk−1 , |{z} 1 , |{z} 0 , 0, ..., 0 , 1, 0, ..., 1, 0). | {z } | {z } | {z } prefix w̃k w̃k+1 y−x times x pairs of 1, 0 Notice that the prefixes of w and w̃ are the same. Before seeing the formal proof, we present the idea which is quite simple. Since we want to increase a binary number the least as possible, we must flip a bit 0 into a bit 1 and this bit must be as much to the right as possible. None of the y bits 0 ending w can be flipped without breaking (1). The first opportunity is wk . Following w̃k , we want w̃ to be as least as possible and hence fill it up with 0s as much as we can without breaking (1). This will leave us with a (2n − 2x)-bits Dyck word on the left hand side of w̃ and to complete a 2n-bits Dyck word we need to append the minimum 2x-bits Dyck word. 4 First we shal show that w̃ is well defined, that is, y − x ≥ 0, the size of w̃ is 2n and w̃ verifies the properties (1) and (2). The total number of 1s in w is N1 (w, k − 1) + 1 + x and the total number of 0s is N0 (w, k − 1) + 1 + y. Since w is a Dyck word, these numbers match and we obtain N1 (w, k − 1) + 1 + x = N0 (w, k − 1) + 1 + y. Hence, N1 (w, k − 1) + 1 = N0 (w, k − 1) + 1 + y − x =⇒ y − x = N1 (w, k − 1) − N0 (w, k − 1). (3) Again, because w is a Dyck word, N1 (w, k − 1) − N0 (w, k − 1) is positive and so is y − x. The last two segments of w have total size x + y and the last two segments of w̃ have total size y − x + 2x = x + y. Hence w̃ is also 2n-bits long and k + 1 + y − x = 2(n − x). Because of the common prefix with w, w̃ verifies property (1) for any i ≤ k − 1. Obviously, it also verifies (1) for i = k (w̃ gets an extra 1). Notice that for any i ∈ {k + 1, ..., 2(n − x)}, w̃i = 0. Hence, if w̃ fails to verify (1) for any i in this set of indices, then it fails to verify (1) for i = 2(n − x). However, N1 (w̃, 2(n − x)) = N1 (w, k − 1) + 1 and N0 (w̃, 2(n − x)) = N0 (w, k − 1) + 1 + y − x and from (3) we obtain that these numbers are equal. This proves that (1) holds for i ≤ 2(n − x). Furthermore, we have proven that N1 (w̃, 2(n − x)) = N0 (w̃, 2(n − x)). From the 2(n − x)-th bit onwards, the sequence is alternating and it follows that if i ≥ 2(n − x) is even, then w̃i = 0 and N1 (w̃, i) = N0 (w̃, i). (4) To prove that w̃ is the smallest Dyck word which is greater than w, assume there’s another Dyck word v = (v1 , ..., v2n ) such that w < v < w̃. Well, obviously, v must have the same prefix as w and w̃. What about vk ? It is either 0 or 1 and we slipt in two cases. If vk = 0 = wk then, because w < v and wi = 1 for all i ∈ {k + 1, ..., k + 1 + x}, the common part between v and w must span up to index k + 1 + x. For i > k + 1 + x, wi = 0 and for w < v to hold, at least one of the last y bits of v must be 1. Then the number of 1s in v is greater than the number of 1s in w which violates the fact that any Dyck word has exactly n 1s. Similarly, if vk = 1 = w̃k , then because v < w̃ and w̃i = 0 for i ∈ {k + 1, ..., 2(n − x)} the common part between v and w̃ must span up to index 2(n − x). But, since v 6= w̃, there exists i > 2(n − x) such that vj 6= w̃j . Let i be the minimum of such indices. For v < w̃ to hold, it is necessary that vi = 0 and w̃i = 1. From (4) it follows that i is odd and i − 1 ≥ 2(n − x) is even. Again from (4) we obtain N1 (w̃, i − 1) = N0 (w̃, i − 1) and the same holds for v thanks to its common part with w̃. But vi = 0 and thus N1 (v, i) = N1 (v, i − 1) and N0 (v, i) = N0 (1, i − 1) + 1 = N1 (v, i − 1) + 1 which violates (1). 5 Two implementations The C++ function in Listing 2 (code available at [2]) implements the algorithm presented in the previous section. It does not allocate memory for the output and, instead, performs the manipulations in-place. It makes no use of helper containers and, therefore, it’s O(1) on space. The algorithm scans the word backwards up to a certain point. Then it advances forward changing the bits up to the rightmost. Hence, in the worse case, the program scans the whole word twice implying complexity O(n) on time. The function takes a Dyck word w made of ones and zeros (provided as arguments) and transforms it into the next Dyck word, if it exists, otherwise, it clears the word. The behaviour is undefined if w is not a Dyck word of ones and zeros. We shall consider now the implementation shown in Listing 1. The function shown there, similarly to the one in Listing 2, assumes that the input is a Dyck word. If it is not, then this is a pre-condition violation 5 ✞ v o i d n e x t d y c k w o r d ( s t d : : s t r i n g & w, c h a r c o n st one , c h a r c o n st z e r o ) { ☎ u n sig n ed c o n st m = w . s i z e ( ) − 1 ; u n sig n ed y = 0; u n sig n ed x = 0; f o r ( u n sig n ed i = m; i > 0 ; −− i ) { i f (w [ i ] == z e r o ) ++y ; // C o u n t e r f o r t r a i l i n g 0 s . e l s e i f (w [ i − 1 ] == z e r o ) { // Found g r e a t e s t i s u c h t h a t w [ i ] = z e r o and w [ i + 1 ] = one . // Change t h e s e two c h a r s . w [ i − 1 ] = one ; w[ i ] = zero ; // O v e r w r i t e t h e f o l l o w i n g n e x t y − x c h a r s t o z e r o . f o r ( y = y − x ; y != 0 ; −−y ) w[++ i ] = z e r o ; // O v e r w r i t e t h e r e m a i n i n g c h a r s w i t h a l t e r n a t i n g o n e s and z e r o s . w h i l e ( i < m) { w[++ i ] = one ; w[++ i ] = z e r o ; } return ; } else ++x ; // C o u n t e r f o r 1 s t h a t p r e c e d e t h e t r a i l i n g z e r o s . } w . c l e a r ( ) ; // F a i l e d t o p r o d u c e a Dyck word , t h e n c l e a r w . } ✝ Listing 2: String manipulation to generate a Dyck word. 6 ✆ which yields undefined behaviour. In addition (and opposite to the implementation in Listing 2), another pre-condition is that the input is not the maximum Dyck word of its size. Failing to verify this condition, again, produces undefined behaviour. The abstract says that integer is a C/C++ unsigned integer type and the first line in the function’s body takes the opposite of w! This is intended and works as expected on C and C++ conforming implementations because on these systems unsigned integer types have 2N -modular arithmetics, where N is the size in bits of the integer type. Other platforms might have different unsigned integer types and, at this point, it is useful to list the properties the type must verify for the algorithm to work. The first rule is obvious but worth saying: the type must implement the usual binary representation of unsigned integer numbers. In particular, all values in the range [0, 2N − 1[ are representable. 2N -modular arithmetics is sufficient but not necessary and only the opposite of w must be as per 2N -modular arithmetics (simply put, the opposite of w is 2N − w). If this is an issue, then the slightly slower variation for the first line can be used: ✞ ☎ i n t e g e r c o n st a = w & ( ˜w − 1 ) ; ✝ ✆ For the other operations, usual arithmetic rules are enough because the (mathematical) results of additions, subtractions, multiplications and divisions stay in the [0, 2N − 1[ range. Moreover, when the division is performed, c is a multiple of a (see below) and, therefore, no truncation or division by 0 occurs. We assume usual semantics also for the bitwise operators &, ^, and | (and ~ if you use the alternative to -w shown above). Finally, the right shift rotation inserts 0s in the gaps on the left but if, this is not the case, we can replace the right shift of two bits by a division by four, provided that the division truncates the result. The pleasure of verifying the details that the arithmetic and bitwise operations in Listing 1 reproduce the construction explained in previous section is left to the reader. I shall provide an overall picture though. Let k̃, x, y and w̃ be as in the previous section. The only 1-bit of w & -w is the same as rightmost 1-bit of w and is located at position k + 1 + x. In other words, a is the largest power of 2 that divides w, namely, a = 22n−k−1−x = 2y . The bits of b = w + a matches those of w̃ up to position k + 1 + y − x = 2(n − x) and are 0s afterwards. Hence, the first two lines of code do almost everything. The following three will create the sequence of x pairs of 1 and 0 (which we recognize as the minimum 2x-bits Dyck word) and apply operator | to it and b. The first value assigned to c has this form 1 , 1, ..., 1, 0, ..., 0), 1 , |{z} (0, ..., 0, |{z} | {z } | {z } | {z } prefix wk wk+1 x times y times which values (2x+2 − 1) · 2y . Since a = 2y , dividing c by a has the effect of right-shifting c by y bits. Shifting two extra bits produces the number whose x least significant bits are 1, that is, 2x − 1. After the addition to 1, c gets the value 2x . Squaring produces 22x and decrementing yields 22x − 1 which is a mask for the 2x rightmost bits. Now the magic number comes in (at this point, you have probably guessed what this is). It is the 64-bits number whose binary expansion is an alternating sequence of 1s and 0s or, in other terms, it is the minimum 64-bits Dyck word. Applying operator & to the mask and the magic number produces the 2x-bits minimum Dyck word to fill the gap in b. 7 6 Getting faster The code in Listing 1 is very efficient but programmers who love to code close to the metal might raise the question about the “expensive” division. This operation can, indeed, be removed. As explained in the previous paragraph, after b is set what is missing is applying operator | to b and the minimum 2x-bits Dyck word. Computing the minimum Dyck word of a given size is straightforward provided that we know the size but, here, we do not. We have theoretically called it 2x but we do not know its value. What we do know is that c has 2x + 2 bits 1. Provided that we have a fast way to count bits, i.e., a popcount function, then we can compute the value of x and, subsequently, the minimum 2x-bits Dyck word. This underlyies this new implementation: ✞ i n t e g e r n e x t ( i n t e g e r w) n o e x c e p t { i n t e g e r a = w & −w ; integer b = w + a ; integer c = w ˆ b; u n sig n ed x = popcount ( c ) − 2 ; c = 0 x a a a a a a a a a a a a a a a a >> ( 3 2 − x ) >> ( 3 2 − x ) ; return b | c ; } ✝ Notice that we shift twice by 32 − x instead of once by 64 − 2x. The reason is that x can be 0 and right shifting a 64-bits unsigned integer by 64 bits yields undefined behaviour. Besides, calculating 2x is most efficiently done by a left shift x << 1 hence there is no performance advantage of “>> (64 - (x << 1))” over “>> (32 - x) >> (32 - x)”. Modern hardwares provide a popcount instruction and some compilers expose it through intrinsic functions. On these platforms the implementation above can be used. Older CPUs do not provide popcount but implement a ctz instruction to count the number of trailing 0s of a binary number. For the specifc bit pattern of c we can use ctz to work around the lack of popcount. Indeed, recall that when we first set c c = (2x+2 − 1) · 2y = 2x+2+y − 2y = 2x+2+y − a. Hence, c + a = 2x+2+y . Moreover, popcount(c) = x + 2 = (x + 2 + y) − y = ctz(2x+2+y ) − ctz(2y ) = ctz(c + a) − ctz(a). For CPUs that are even older and no ctz is provided, one can sill use a software implementation [7] of popcount which might outperform the implementation in Listing 1. 7 Acknowledgements I thank my friend Prof. Lorenz Schneider who introduced me to the Gosper’s hack around 2011. I am also grateful towards mosh111, whoever he/she is, who introduced me to the problem of Dyck word generation through his/her post in [1] on 16 July 2014. References [1] CareerCup, Implement an algorithm to print all valid (e.g., properly opened and closed) combinations of n-pairs of parentheses, http://www.careercup.com/question?id=4815516967370752. 8 ☎ ✆ [2] Neri, C., http://github.com/cassioneri/Dyck [3] Knuth, D.E., The Art of Computer Programming: Bitwise Tricks & Techniques; Binary Decision Diagrams, volume 4, fascicle 1. (2009): 272-277. [4] Warren, H.S., Hacker’s delight. Addison-Wesley, 2013. [5] Wikipedia, Catalan numbers, http://en.wikipedia.org/wiki/Catalan_number. [6] Wikipedia, Combinatorial number system, http://en.wikipedia.org/wiki/Combinatorial_number_system. [7] Wikipedia, Hamming weight, https://en.wikipedia.org/wiki/Hamming_weight. 9
8cs.DS
Journal on Wireless Personal Communications manuscript No. (will be inserted by the editor) Achievable Rate Analysis of Cooperative Relay Assisted Opportunistic-NOMA under Rician Fading Channels with Channel State Information Pranav Kumar Jha · S Sushmitha Shree · D. Sriram Kumar arXiv:1709.08224v6 [cs.IT] 8 Nov 2017 Received: date / Accepted: date Abstract The average achievable rate of an Opportunistic Non-Orthogonal Multiple Access (O-NOMA) based Cooperative Relaying System (CRS) with Channel State Information (CSI) known at the transmitter end is analyzed under Rician fading channels. For opportunistic transmission of data signals, CSI is used for the source-torelay and source-to-destination links, which helps the transmitter to select the best out of the cooperative NOMA transmission and the direct transmission of signals, instantaneously. The average achievable rate of the O-NOMA and conventional NOMA (C-NOMA) based CRSs is considered for the performance comparison and the exact and asymptotic analytical expressions of the achievable rates has been provided. Asymptotic results are verified through Monte Carlo simulations for various channel powers and power allocation coefficients. Numerical results verify that the derived analytical results are matched well with the Monte Carlo simulations and show that O-NOMA-based CRS achieves better rate performance than C-NOMA-based CRS with the increasing power allocation coefficients, transmit Signal-to-Noise Ratios (SNRs) and channel powers. Keywords Non-Orthogonal Multiple Access · Achievable Rate · Opportunistic Transmission · Decode-and-Forward Relay · Superposition Coding · Rician Fading Channels Pranav Kumar Jha Department of Electronics and Communication Engineering National Institute of Technology, Tiruchirappalli Tel.: +91-846-898-3890 E-mail: jha [email protected] URL: orcid.org/0000-0001-8053-988X S Sushmitha Shree Department of Electronics and Communication Engineering Thiagarajar College of Engineering, Madurai E-mail: [email protected] URL: orcid.org/0000-0003-4929-7776 2 Pranav Kumar Jha et al. 1 Introduction Non-orthogonal multiple access (NOMA) is one of the promising techniques to improve the spectral efficiency of wireless multi-user communication systems [1]. For multiple access, NOMA uses the power domain and superposition coding is used to implement this which enables the transmitter to transmit data signals with different power levels to different receivers at the same time and bandwidth [2]. In order to boost the spectral efficiency of cooperative relaying systems (CRSs), the NOMA has been proposed into CRSs where one or more relays help a source in transmitting the signals to one or more destinations in order to mitigate the wireless channel effects such as path losses, attenuation and shadowing. In industry, the NOMA and the cooperative relaying technique have been considered as primary techniques for 3rd Generation Partnership Project (3GPP) Long Term Evolution-Advanced (LTE-A) systems [3, 4]. Hence, CRSs using the NOMA can be practically realized as one of alternatives to achieve high spectral efficiency in the fifth generation (5G) communication systems. In literature, the advanced NOMA for different CRSs have been developed to significantly improve the spectral efficiency of the CRSs [5–13]. The research is focused on the models of CRSs with different node constructions and different relaying schemes and has shown the spectral efficiency gains achieved by their proposed NOMA schemes in terms of average achievable rate and outage probability. In [5], CRS using NOMA has been proposed, where the source simultaneously transmits two independent data symbols by superposition coding, and the relay decodes and forwards the symbol with lower received power after performing the successive interference cancellation (SIC). Also, the average achievable rate for the CRS using NOMA has been analyzed, and a sub-optimal power allocation scheme for NOMA has been presented. In [6], a novel detection scheme for CRS using NOMA has been proposed to enhance the achievable rate for CRS using NOMA presented in [5], but it requires more complexity at the receiver. In [6], the destination jointly decodes two data symbols from the direct and relayed transmissions with maximal-ratio combining and SIC. In addition, its average achievable rate and the outage probability have been investigated. Unlike [5] and [6] considering a single relay and a single destination, in [5], the more complicated CRS with multiple relays and destinations has been treated, and a cooperative NOMA scheme has been proposed for the CRS where the receivers with better channel conditions have prior information about the data symbols of other receivers and the prior information is used to achieve the spatial diversity. In [7], the outage probability and diversity order achieved by the cooperative NOMA have been investigated. Unlike [5–7] with decode-and-forward relaying, in [8], a NOMA-based down-link cooperative cellular system with amplify-and-forward relaying has been proposed, where the base station transmits data signals to two users simultaneously with amplify-and-forward relaying. Also, its average achievable rate and outage performance have been investigated. In [9], the NOMA scheme has been proposed in coordinated direct and relay transmission (CDRT), where the base station directly communicates with a near user while communicating with a far user only through a relay. In the CDRT using NOMA, the near user has the prior information about the data symbol of the far user, and exploits it for interference cancellation, Title Suppressed Due to Excessive Length 3 which can significantly improve the spectral efficiency. Its average achievable rate and outage probability have been also analyzed in [9]. In [10], the full-duplex (FD) CRS using NOMA with dual users has been proposed and its average achievable rate and outage probability have been investigated under the assumption of imperfect self-interference cancellation. In addition, it has been shown that the FD CRS using NOMA can work better than the half-duplex CRS using NOMA. In the studies on CRSs using NOMA in [5–10], channel state information (CSI) has been assumed to be unavailable at the source in order to reduce the system overhead. However, it can limit the performance improvement because the source cannot use the time-varying channels for data transmission. In [11–13], hence, adaptive transmission, user selection, and hybrid relaying schemes using CSI have been respectively proposed to enhance the spectral efficiency of CRSs using NOMA. In [14], an opportunistic NOMA (O-NOMA) based CRS has been proposed using decode-and-forward over Rayleigh fading channels and the average achievable rates has been studied for different channel powers and power allocation coefficients with CSI available at the transmitter end. In this paper, unlike the proposed schemes in [11–14], we analyze the O-NOMAbased CRS using CSI available at the transmitter end under Rician fading channels in order to achieve the further performance improvement at the expense of system overhead. We consider a source, a decode-and-forward relay, and a destination for the simple implementation as in [5]. For opportunistic transmission, CSI for the sourceto-destination and source-to-relay links is exploited and based on the CSI, transmitter instantaneously selects one of the direct transmission and the cooperative NOMA transmission [5] with the help of the relay, which can provide better achievable rate performance than the conventional NOMA-based CRS with no CSI at the source. In addition, an asymptotic expression of the average achievable rate has also been provided and the asymptotic results are verified through Monte Carlo simulations. The average achievable rates of the O-NOMA and the conventional NOMA (C-NOMA) based CRSs has been compared for different channel powers and power allocation coefficients used for NOMA. This paper is organized as follows: Section 2 provides opportunistic NOMAbased CRS, and provides its received signals and signal-to-noise ratios (SNRs). In Section 3, the average achievable rate for the O-NOMA-based CRS is analyzed and in section 4, an approximation method is used for asymptotic average achievable rate expressions. In Section 5, a comparison has been made between the O-NOMA and C-NOMA-based CRSs in terms of average achievable rate in order to verify the superiority of O-NOMA-based CRS over C-NOMA-based CRS through numerical results and simulations. Section 6 concludes this paper. 2 System Description A CRS has been considered for the analysis as shown in Fig. 1, where a source (S) transmits signals to a destination (D) directly and through a relay (R). The channel coefficients of S-to-D, S-to-R, and R-to-D links are represented as hSD , hSR , and hRD , 4 Pranav Kumar Jha et al. Fig. 1 A Cooperative relaying system based on NOMA. Fig. 2 Direct signal transmission from source to destination. respectively, and considered to be independent Rician random variables with average 2 , Ω 2 and Ω 2 , respectively. channel powers of ΩSD RD SR √ In the CRS using NOMA, During the first time slot, the source transmits a1 PS s1 + √ a2 PS s2 to the relay and the destination, using the superposition coding [1, 5, 6] shown in Fig. 3, where si represents the i-th data symbol, E[|si |2 ] = 1 and PS signifies the total transmit power, ai represents the power allocation coefficient for symbol si and a1 + a2 = 1 and a1 > a2 is assumed, which means 0.5 < a1 < 1 and 0 < a2 < 0.5. The relay decodes symbol s2 after decoding and cancelling symbol s1 with SIC, whereas the destination decodes symbol s1 considering symbol s2 as noise. During the second time slot, only the relay transmits the decoded symbol s2 with power PS to the destination. However, when |hSD |2 > |hSR |2 , the NOMA may not provide a gain of end-to-end achievable rate since the received signal power of symbol at the relay is very limited. For O-NOMA-based CRS, if |hSD |2 > |hSR |2 , only direct transmission between the source and the destination is performed without relaying as shown in Fig. 2 , otherwise the NOMA is employed with relay [14]. The rationale of the O-NOMA-based CRS is based on the fact that the achievable rate for the relayed link is the minimum of achievable rates for the source-to-relay link and the relayto-destination link. That is, when |hSD |2 > |hSR |2 , the direct link achieves better rate performance than the relayed link. In the O-NOMA-based CRS, hence, the source directly transmits symbol s1 to the destination with power PS during a time slot when |hSD |2 > |hSR |2 . In the C-NOMA-based CRS, the received signals at the relay and the destination during the first time slot are respectively given as p p rCSR = hSR ( a1 PS s1 + a2 PS s2 ) + nSR , (1) Title Suppressed Due to Excessive Length 5 Fig. 3 NOMA-based cooperative relaying systems. and p p rCSD = hSD ( a1 PS s1 + a2 PS s2 ) + nSD , (2) where nSR and nSD denote additive white Gaussian noise with variance σ 2 . The received SNRs of symbol s1 to be decoded for SIC and symbol s2 to be decoded after SIC at the relay are respectively given from (1) as C γSR,s = 1 and a1 PS |hSR |2 , a2 PS |hSR |2 + σ 2 (3) a2 PS |hSR |2 . (4) σ2 The received SNR of symbol s1 to be decoded at the destination is given from (2) C γSR,s = 2 as C γSD,s = 1 a1 PS |hSD |2 . a2 PS |hSD |2 + σ 2 (5) The received signal at the destination during the second time slot is given as √ rCRD = a2 PR hRD s2 + nRD , (6) where nRD is additive white Gaussian noise with variance σ 2 , and thus the received SNR for symbol s2 is given as C γRD,s = 2 a2 PS |hRD |2 . σ2 (7) On the other hand, for the direct transmission, the received signal of symbol s1 at the destination and its received SNR are respectively given as, √ D rSD = a1 PR hSD s1 + nSD , (8) D γSD,s = 1 a1 PS |hSD |2 . σ2 (9) 6 Pranav Kumar Jha et al. 3 Achievable Rate Analysis Let λSD , |hSD |2 , λSR , |hSR |2 , λRD , |hRD |2 , ρ = σPS2 and C(x) , log2 (1 + x), where ρ signifies the transmit SNR. It is assumed that [5] the transmit power of S and R is the same as PS = PR = P. As following the fact the the end-to-end achievable rate of decode-and-forward relaying is dominated by the weakest link [3], and with the help of [3–5, 7, 9], the achievable rate of the O-NOMA-based CRS is obtained as follows [5]: If λSD < λSR 1 C C )} ), log2 (1 + γSR,s CPro = min{log2 (1 + γSD,s 1 1 2 (10) 1 C C + min{log2 (1 + γSR,s2 ), log2 (1 + γRD,s2 )}, 2 which can be written as [14] 1 C CPro = min{log2 (1 + γSD,s )} 1 2 (11) 1 C C ), log (1 + γ )}, + min{log2 (1 + γSR,s RD,s2 2 2 2 else, D CPro = log2 (1 + γSD,s ). (12) 1 In (10), it is noted that the first and the second parts denote the achievable rates C of symbols s1 and s2 , respectively. In the first part of (10), log2 (1 + γSR,s ) is required 1 to assume that the relay successfully decodes symbol s1 for SIC, but that is deleted in (11) since λSD < λSR . It is also noted that there is one half spectral efficiency penalty for relaying in (11), whereas there is no spectral efficiency penalty in (12) as the source transmits an independent data symbol to the destination directly for a given time slot when λSD > λSR . Then, using (11) and (12), the achievable average rate of the O-NOMA-based CRS is obtained as 1 1 CPro = log2 (1 + λSD ρ) − (1 + a2 λSD ρ) 2 | {z 2 } CC,s1 1 + log2 (1 + min{a2 λSR , λRD }ρ), |2 {z } (13) CC,s2 else, C pro = log2 (1 + λSD ρ) . | {z } (14) CD,s1 With the help of (13) and (14), the total achievable rate of O-NOMA-based CRS can be written as 1 1 CPro = log2 (1 + λSD ρ) − (1 + a2 λSD ρ) 2 2 1 (15) + log2 (1 + min{a2 λSR , λRD }ρ) 2 + log2 (1 + λSD ρ). Title Suppressed Due to Excessive Length 7 Let γ1 , λSD , γ2 , min{λSR , λRD }, the cumulative distribution function (CDF) of γ1 and γ2 for CC,s1 and CC,s2 is given as [15] ∞ F(γ1 ) = 1 − Ax Ay ∑ aix ayj i+ j γ1 , ∑ i=0 k=0 i! j! n ∞ ∑ B̃x (n)B̃y (k)n!k!e−(ax +ay )γ1 ∑ k=0 n=0 ∞ F(γ2 ) = 1 − Az Ay ∑ ∞ a 2 −(az + ay )γ2 ∑ B̃z (n)B̃y (k)n!k!e k=0 n=0 k aiz (ay /a2 ) j i+ j γ2 , i! j! i=0 k=0 n (16) n ∑∑ (17) K k (1+Ky )k 1+Ky Kxn (1+Kx )n −Kx , A = x , By (k) = yΩ k (k!)2 , ax = 1+K y Ωx , ay = Ωy , Ax = ax e Ωxn (n!)2 y B (k) (n) = Bxn+1 , By (k) = yk+1 . Here, x represents the S-to-D link, y represents ax ay where Bx (n) = ay e−Ky , B̃x (n) the S-to-R link, z represents the R-to-D link and K represents the Rician factor. The expansion form of incomplete Gamma function is used for the equality of (16). 4 Achievable Rate Approximation According to [15], (16) and (17) can be approximated for the asymptotic results where approximated values for CC,s1 and CC,s2 is given as CC,s1 = 1 [H(ρ) − H(ρa2 )], 2ln(2) (18) where, n j k y (i + j)! aix ay ax +a H(ρ) = Ax Ay ∑ ∑ B̃x (n)B̃y (k)n!k! ∑ ∑ e ρ i+ j i=0 j=0 i! j! ρ k=0 n=0 ∞ ∞ 2  1 2 ax +ay ρ ax +ay ρ i+ j (19) − 2t − 1 2t − 1 π n 2t−1 π) + 1)i+ j−1 e cos( 2n π)+1 |sin( π)|, × ∑ (cos( n t=1 2n 2n Similarly CD,s1 can be calculated as CD,s1 = 1 H(ρ), ln(2) (20) CC,s2 = 1 G(ρ), 2ln(2) (21) and where, ∞ G(ρ) = Az Ay ∑ k=0 n=0  1 × 2 (i + j)! aiz (ay /a2 ) j az +aρy /a2 e ρ i+ j i=0 j=0 i! j! n ∞ k ∑ B̃z (n)B̃y (k)n!k! ∑ ∑ az +ay /a2 ρ i+ j 2 az +ay /a2 ρ − π n 2t − 1 2t − 1 2t−1 (cos( π) + 1)i+ j−1 e cos( 2n π)+1 |sin( π)|. ∑ n t=1 2n 2n (22) 8 Pranav Kumar Jha et al. 16 signal 1 (simulated O-NOMA) signal 1 (analytical O-NOMA) signal 2 (simulated C-NOMA) signal 2 (analytical C-NOMA) sum rate (simulated O-NOMA) sum rate (analytical O-NOMA) signal 2 (simulated O-NOMA) signal 2 (analytical O-NOMA) signal 1 (simulated C-NOMA) signal 1 (analytical C-NOMA) sum rate (simulated C-NOMA) sum rate (analytical C-NOMA) 16 14 Acheivable Rate (bit/s/Hz) 14 12 12 10 0 0.005 0.01 5 8 0 6 0 0.005 0.01 4 2 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Power Allocation Coefficient a2 Fig. 4 Average achievable rates of O-NOMA and C-NOMA-based CRSs for ρ = 20 dB when ΩSD = 3 and ΩSR = ΩRD = 6. signal 1 (simulated O-NOMA) signal 1 (analytical O-NOMA) signal 2 (simulated C-NOMA) signal 2 (analytical C-NOMA) sum rate (simulated O-NOMA) sum rate (analytical O-NOMA) signal 2 (simulated O-NOMA) signal 2 (analytical O-NOMA) signal 1 (simulated C-NOMA) signal 1 (analytical C-NOMA) sum rate (simulated C-NOMA) sum rate (analytical C-NOMA) 20 20 Acheivable Rate (bit/s/Hz) 18 16 15 14 12 0 0.005 0.01 5 10 0 8 0 0.005 0.01 6 4 2 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 Power Allocation Coefficient a2 Fig. 5 Average achievable rates of O-NOMA and C-NOMA-based CRSs for ρ = 30 dB when ΩSD = 3 and ΩSR = ΩRD = 6. 5 Numerical Results and Discussions In this section, for validation of the accuracy of the analytical results analyzed in the Section 4 has been compared using Monte Carlo simulations. For simulation purpose, 105 realizations of Rician distribution random variables are transmitted. The asymptotic achievable rate of the C-NOMA-based CRS given in [15] is used for comparison purpose with the achievable rate of O-NOMA-based CRS obtained in this paper. Figs. Title Suppressed Due to Excessive Length 9 signal 1 (simulated O-NOMA) signal 1 (analytical O-NOMA) signal 2 (analytical C-NOMA) sum rate (simulated O-NOMA) sum rate (analytical O-NOMA) signal 2 (simulated C-NOMA) signal 2 (simulated O-NOMA) signal 2 (analytical O-NOMA) signal 1 (simulated C-NOMA) signal 1 (analytical C-NOMA) sum rate (simulated C-NOMA) sum rate (analytical C-NOMA) 16 16 Acheivable Rate (bit/s/Hz) 14 14 12 12 0 0.005 0.01 10 8 6 5 4 0 2 0 0 0.05 0.1 0.15 0 0.2 0.005 0.01 0.25 0.3 0.35 0.4 0.45 0.5 Power Allocation Coefficient a2 Fig. 6 Average achievable rates of O-NOMA and C-NOMA-based CRSs for ρ = 20 dB when ΩSD = 3 and ΩSR = ΩRD = 12. 22 signal 1 (simulated O-NOMA) signal 1 (analytical O-NOMA) signal 2 (simulated C-NOMA) signal 2 (analytical C-NOMA) sum rate (simulated O-NOMA) sum rate (analytical O-NOMA) signal 2 (simulated O-NOMA) signal 2 (analytical O-NOMA) signal 1 (simulated C-NOMA) signal 1 (analytical C-NOMA) sum rate (simulated C-NOMA) sum rate (analytical C-NOMA) 20 20 Acheivable Rate (bit/s/Hz) 18 16 15 14 0 0.005 0.01 12 10 8 6 5 4 0 2 0 0 0.05 0.1 0.15 0 0.2 0.005 0.01 0.25 0.3 0.35 0.4 0.45 0.5 Power Allocation Coefficient a2 Fig. 7 Average achievable rates of O-NOMA and C-NOMA-based CRSs for ρ = 30 dB when ΩSD = 3 and ΩSR = ΩRD = 12. 4, 5, 6 and 7 provides the achievable rate performance of s1 , s2 and the corresponding average achievable sum rate of the O-NOMA and C-NOMA-based CRSs for different values of the power allocation coefficient a2 of s2 . Further, parameters are set as KSR = KRD = 5, KSD = 2 and ΩSD = 3. In addition, as a2 increases, the achievable rate for s2 increases and the rate for s1 decreases, since s2 gets more power. Fig. 8 and Fig. 9 provides the achievable rate performance of the O-NOMA and C-NOMAbased CRSs against the transmit SNR ρ where a2 is set as 0.4. 10 Pranav Kumar Jha et al. 12 5 Achievable Rate (bit/s/Hz) 10 0 8 4 5 6 sum rate (analytical C-NOMA) signal 2 (analytical C-NOMA) signal 1 (analytical C-NOMA) sum rate (analytical O-NOMA) signal 2 (simulated C-NOMA) signal 1 (analytical O-NOMA) sum rate (simulated O-NOMA) sum rate (simulated C-NOMA) signal 2 (simulated O-NOMA) signal 2 (analytical O-NOMA) signal 1 (simulated O-NOMA) signal 1 (simulated C-NOMA) 6 4 2 0 0 5 10 15 Transmit SNR 20 25 30 (dB) Fig. 8 Average achievable rates of O-NOMA and C-NOMA-based CRSs for a1 = 0.9 and a2 = 0.1 when ΩSD = 3 and ΩSR = ΩRD = 6. In Fig. 4, for SNR = 20 dB and ΩSR = ΩRD = 6, It can be seen that when a2 increases from 0.1 to 0.4, the achievable rate of s1 decreases from 10.89 bit/s/Hz to 9.905 bit/s/Hz while for C-NOMA-based CRS, s1 decreases from 1.64 bit/s/Hz to 0.657 bit/s/Hz. Next, s2 increases from 4.113 bit/s/Hz to 5.058 bit/s/Hz for ONOMA-based CRS which is same as in the case of C-NOMA-based CRS due to the available CSI at the transmitter end. Average achievable sum rates for O-NOMA and C-NOMA-based CRSs are 15 bit/s/Hz and 5.753 bit/s/Hz, respectively for a2 = 0.1. In Fig. 5, SNR is set as 30 dB and ΩSR = ΩRD = 6. Now when a2 increases from 0.1 to 0.4, the achievable rate of s1 decreases from 14.2 bit/s/Hz to 13.2 bit/s/Hz for ONOMA-based CRS while for C-NOMA-based CRS, s1 decreases from 1.651 bit/s/Hz to 0.6489 bit/s/Hz. Further, s2 increases from 5.77 bit/s/Hz to 6.721 bit/s/Hz for ONOMA and C-NOMA-based CRSs both. Average achievable sum rates for O-NOMA and C-NOMA-based CRSs are 19.97 bit/s/Hz and 7.421 bit/s/Hz, respectively for a2 = 0.1. In Figs. 4 and 5, for ΩSR = ΩRD = 6, an increase of 4.97 bit/s/Hz for O-NOMAbased CRS and 1.668 bit/s/Hz for C-NOMA-based CRS has been shown in the average achievable sum rates for 10 dB increment in the SNR. O-NOMA-based CRS achieves 9.247 bit/s/Hz more rate than C-NOMA-based CRS for SNR=20 dB and 12.549 bit/s/Hz for SNR=30 dB at a2 = 0.1, which shows that O-NOMA-based CRS achieves better average rate performance than C-NOMA-based CRS. In Fig. 6, SNR is set as 20 dB and ΩSR = ΩRD = 12. Now, when a2 increases from 0.1 to 0.4, the achievable rate of s1 decreases from 10.94 bit/s/Hz to 9.957 bit/s/Hz for O-NOMA-based CRS while for C-NOMA-based CRS, s1 decreases from 1.64 bit/s/Hz to 0.657 bit/s/Hz and s2 increases from 5.112 bit/s/Hz to 6.074 bit/s/Hz for both the cases. Average achievable rates for O-NOMA and C-NOMA-based CRSs are 16.05 bit/s/Hz and 6.752 bit/s/Hz, respectively for a2 = 0.1. Title Suppressed Due to Excessive Length 11 12 6 Achievable Rate (bit/s/Hz) 10 4 2 8 0 4 5 sum rate (analytical C-NOMA) signal 2 (simulated C-NOMA) signal 2 (analytical C-NOMA) sum rate (analytical O-NOMA) signal 1 (analytical O-NOMA) sum rate (simulated O-NOMA) sum rate (simulated C-NOMA) signal 2 (simulated O-NOMA) signal 1 (simulated O-NOMA) signal 1 (analytical C-NOMA) signal 1 (simulated C-NOMA) signal 2 (analytical O-NOMA) 6 6 4 2 0 0 5 10 15 Transmit SNR 20 25 30 (dB) Fig. 9 Average achievable rates of O-NOMA and C-NOMA-based CRSs for a1 = 0.9 and a2 = 0.1 when ΩSD = 3, ΩSR = ΩRD = 12. In Fig. 7 by using SNR = 30 dB and ΩSR = ΩRD = 12, when a2 increases from 0.1 to 0.4, the achievable rate of s1 decreases from 14.16 bit/s/Hz to 13.15 bit/s/Hz for O-NOMA-based CRS while for C-NOMA-based CRS, s1 decreases from 1.619 bit/s/Hz to 0.6115 bit/s/Hz and s2 increases from 6.756 bit/s/Hz to 7.678 bit/s/Hz for O-NOMA and C-NOMA-based CRSs both. Average achievable sum rates for O-NOMA and C-NOMA-based CRSs are 20.91 bit/s/Hz and 8.375 bit/s/Hz, respectively for a2 = 0.1. In Figs. 6 and 7, for ΩSR = ΩRD = 12, an increase of 4.86 bit/s/Hz for O-NOMAbased CRS and 1.619 bit/s/Hz for C-NOMA-based CRS has been shown in the average achievable sum rates for 10 dB increment in the SNR. O-NOMA-based CRS achieves 9.298 bit/s/Hz more rate than C-NOMA-based CRS for SNR=20 dB and 12.539 bit/s/Hz for SNR=30 dB at a2 = 0.1 which shows that O-NOMA-based CRS achieves better average rate performance than C-NOMA-based CRS. In Figs. 4 and 6, for a2 = 0.1 and SNR = 20 dB, when values of ΩSR = ΩRD changes from 6 to 12, an increase of 1.05 bit/s/Hz and 0.999 bit/s/Hz in the average achievable sum rate of O-NOMA-based CRS and C-NOMA-based CRS has been noticed, respectively and in Figs. 5 and 7, for a2 = 0.1 and SNR = 30 dB, when values of ΩSR = ΩRD changes from 6 to 12, an increase of 0.94 bit/s/Hz and 0.954 bit/s/Hz in the average achievable sum rate of O-NOMA-based CRS and C-NOMAbased CRS has been shown, respectively. Hence. these results clearly demonstrate that larger channel power helps in achieving better achievable rate. In Fig. 8, a1 = 0.9, a2 = 0.1 and ΩSR = ΩRD = 6 and when ρ increases from 5 dB to 15 dB, the average achievable sum rate of O-NOMA-based CRS increases from 5.571 bit/s/Hz to 9.995 bit/s/Hz and for C-NOMA-based CRS, it increases from 4.575 bit/s/Hz to 7.961 bit/s/Hz while s2 increases from 3.438 bit/s/Hz to 6.658 bit/s/Hz for O-NOMA and C-NOMA-based CRSs both due to the knowledge of CSI at the 12 Pranav Kumar Jha et al. transmitter end. At ρ = 15 dB, s1 is 1.133 bit/s/Hz for O-NOMA-based CRS and 0.5663 bit/s/Hz for C-NOMA-based CRS. In Fig. 9, parameters are set as ΩSR = ΩRD = 12, a1 = 0.9 and a2 = 0.1. Here, when ρ increases from 5 dB to 15 dB, the average achievable sum rate of O-NOMAbased CRS increases from 6.007 bit/s/Hz to 10.47 bit/s/Hz and for C-NOMA-based CRS, increases from 5.011 bit/s/Hz to 8.44 bit/s/Hz while s2 increases from 3.942 bit/s/Hz to 8.44 bit/s/Hz for O-NOMA and C-NOMA-based CRSs both. At ρ = 15 dB, s1 is 1.376 bit/s/Hz for O-NOMA-based CRS and 0.6879 bit/s/Hz for C-NOMAbased CRS. In Figs. 8 and 9, at ρ = 15 dB, an increase of 0.475 bit/s/Hz for O-NOMA-based CRS and 0.479 bit/s/Hz for C-NOMA-based CRS has been shown in the average achievable sum rate when ΩSR = ΩRD varies from 6 to 12. O-NOMA-based CRS achieves 2.034 bit/s/Hz more rate than C-NOMA-based CRS for ΩSR = ΩRD = 6 and 2.03 bit/s/Hz for ΩSR = ΩRD = 12, which shows that O-NOMA-based CRS achieves better average rate performance than C-NOMA-based CRS and larger channel power helps in achieving improved achievable rate comparatively. 6 Conclusions In this paper, the performance of O-NOMA-based CRS is investigated and exact and asymptotic analytical expressions of the achievable rates has been provided under Rician fading channels. Derived analytical results have been verified with the simulation results and proved to be in harmony with the Monte Carlo simulations which concludes that O-NOMA-based CRS is superior than C-NOMA-based CRS in terms of average achievable rate. Numerical results also show that as the transmit SNR increases and the channel power of the S-to-R and R-to D link is large, O-NOMA-based CRS achieves better rate performance than conventional C-NOMA-based CRS. References 1. Z. Ding, Z. Yang, P. Fan, H.V. Poor, IEEE Signal Processing Letters 21(12), 1501 (2014) 2. H.T. Do, S.Y. Chung, IEEE Transactions on Communications 57(8) (2009) 3. C. Danae, Technical specification group radio access network. Tech. rep., Technical report, Technical report, Spreading and Modulation, http://www. 3gpp. org (1999) 4. Z. Bai, 3GPP, Sophia Antipolis, Technical Specification 36.213 v. 11.4. 0 (2013) 5. J.B. Kim, I.H. Lee, IEEE Communications Letters 19(11), 1949 (2015) 6. M. Xu, F. Ji, M. Wen, W. Duan, IEEE Communications Letters 20(8), 1679 (2016) 7. Z. Ding, M. Peng, H.V. Poor, IEEE Communications Letters 19(8), 1462 (2015) 8. J. Men, J. Ge, IET Communications 9(18), 2267 (2015) 9. J.B. Kim, I.H. Lee, IEEE Communications Letters 19(11), 2037 (2015) 10. C. Zhong, Z. Zhang, IEEE Communications Letters 20(12), 2478 (2016) Title Suppressed Due to Excessive Length 13 11. S. Luo, K.C. Teh, IEEE Communications Letters 21(4), 937 (2017) 12. N.T. Do, D.B. Da Costa, T.Q. Duong, B. An, IEEE Communications Letters 21(3), 664 (2017) 13. Y. Liu, G. Pan, H. Zhang, M. Song, IEEE Access 4, 4912 (2016) 14. I.h. Lee, H. Lee, Journal of information processing systems 13(3), 630 (2017) 15. R. Jiao, L. Dai, J. Zhang, R. MacKenzie, M. Hao, IEEE Transactions on Vehicular Technology (2017)
7cs.IT
Context-Updates Analysis and Refinement in Chisel? Irina Măriuca Asăvoae1 , Mihail Asăvoae1 , Adrián Riesco2 arXiv:1709.06897v1 [cs.PL] 20 Sep 2017 2 1 Inria Paris, France Universidad Complutense de Madrid, Spain Abstract. This paper presents the context-updates synthesis component of Chisel–a tool that synthesizes a program slicer directly from a given algebraic specification of a programming language operational semantics. (By context-updates we understand programming language constructs such as goto instructions or function calls.) The context-updates synthesis follows two directions: an overapproximating phase that extracts a set of potential context-update constructs and an underapproximating phase that refines the results of the first step by testing the behaviour of the context-updates constructs produced at the previous phase. We use two experimental semantics that cover two types of language paradigms: high-level imperative and low-level assembly languages and we conduct the tests on standard benchmarks used in avionics. Keywords: generic slicing tool, programming languages formal semantics, Maude, synthesis 1 Introduction Slicing is a well established analysis method that takes a program and a slicing criterion (i.e., a program point pc and a set of program variables V ) and produces a program slice (i.e., the parts of the program containing language constructs units, usually discriminated based on the sequencing operator, that change the variables in V, directly or indirectly, during the program executions either up to or from the program point pc). Note that depending on the moment slicing is applied, we have either dynamic slicing—used at the program runtime, and static slicing—used without executing the program. In this paper, we focus on static slicing and we refer it as simply slicing. Moreover, hereafter we refer the language constructs units, i.e., the syntactic components of the programming language that are separated by sequencing operators, as instructions. The main idea in program slicing relies on the evaluation of the data flow equations over the control flow graph of the program. Obviously, besides the data-flow, there is a need of additional techniques to help with other language features—[34] gives a comprehensive survey on the standard program slicing ? This research has been partially supported by the MINECO Spanish project TRACES (TIN2015-67522-C3-3-R) and by the Comunidad de Madrid project NGreens Software-CM (S2013/ICE-2731) 2 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco techniques applied over different programming language concepts such as standard imperative, pointers, unstructured control flow, and concurrency. Generally, these techniques use the programs’ control flow graphs with various augmentations, e.g., the function calls are usually represented by call-edges [30]. Consequently, any programming language supporting slicing has to be automatically translated into control flow graph based models. Field and Tip show in [11] a method to derive program slices and dependences from term rewriting systems. This method is applicable to any language with semantics specified as a term rewriting system. Hence, the translation of the programs into their afferent model for slicing is replaced by describing the semantics of the programming language as a rewriting system. Furthermore, the rules in this rewriting system are augmented with wrappers, which maintain the slicing information. In order to compute a program slice, the term representing the program is rewritten with the augmented rewriting system until it reaches the normal form, which contains the slice via the wrappers. This method is tantamount to determining the slice in a dynamic fashion during program execution. Along the lines of programming language semantics as rewriting systems, we observe an increased interest in defining various languages to cover many programming language paradigms. This desideratum is stated in the rewriting logic semantics project [20], where the programming languages semantics are defined as rewriting systems using Maude, and it is followed by the work in the K framework [27]. Maude [7] is a high-level language and high-performance system supporting both equational and rewriting logic computation. Maude modules correspond to specifications in rewriting logic [19], a logic that allows specifiers to represent many models of concurrent and distributed systems. This logic is an extension of membership equational logic [6], an equational logic that, in addition to equations, allows the statement of membership axioms characterizing the elements of a sort. Rewriting logic extends membership equational logic by adding rewrite rules that represent transitions in a concurrent system and can be nondeterministic. In the context of [20], these rules correspond to the execution of the different instructions in our programming language, hence allowing a natural representation for any programming language semantics. As a semantical framework, Maude has been used to specify the semantics of several languages, such as LOTOS [35], CCS [35], and Java [9]. Moreover, the K-Maude compiler [28], which is able to translate K specifications into Maude, has eased the methodology to describe programming language semantics in Maude. Our work comes to complement the rewriting logic semantics project by developing static analysis methods, in particular slicing, for programs written in languages with an already defined rewriting logic semantics in Maude. Our approach analyses a given programming language semantics and synthesizes the necessary information for program slicing. We use the results of the syntheses to traverse the program term in order to obtain the program slice. However, we do not execute the program as in [11]. Rather, we construct over the program an augmented control flow graph structure and we use it to obtain the program slice. The novelty, comparing to the standard methods presented in [34], is that we Context-Updates Analysis and Refinement in Chisel 3 construct the program models in a generic way, for any programming language with a given algebraic semantics. Our approach is implemented in Chisel3 , a Maude tool for generic program slicing [26]. Chisel takes a programming language semantics, given as a Maude specification, breaks it into pieces of interest for slicing, and uses these pieces to augment the program term and to produce the model, which is then sliced. For experiments we use two semantics: a semantics for an imperative programming language with functions, WhileFun, and a semantics for the MIPS assembly language. Chisel synthesizes these semantics to extract operators that produce updates at the memory level. These operators are then used to produce necessary information for slicing, e.g., side-effect instructions. The final step of Chisel is the program slicing analysis that takes a program and produces its slice w.r.t. a slicing criterion. Chisel aims to evolve into a framework for generic static slicing. The main argument for the genericity claim lays in the fact that any programming language paradigm involves a semantic notion of memory/environment which is crucial for slicing and on which we focus our syntheses. Another argument is given by Tip’s survey [34] which presents specialized slicing algorithms for various programming paradigms. However, there is a price to pay for genericity: the slicing precision. Namely, the analyses of the programming language semantics produce supersets of the language constructs involved in slicing. Hence, the loss of precision directly depends on the imprecision of the synthesized language constructs. For producing more accurate synthesis results, we introduce the filtering step based on program testing. With the current development of Chisel we target sequential imperative code without dynamic allocation that is generated from synchronous designs—a class of applications used in real-time systems, e.g., avionics. The contribution of this paper is presenting the context-updates synthesis component of Chisel, where by context-updates we understand programming language constructs such as goto instructions or function calls. The context-updates synthesis follows two directions: an overapproximating phase when we analyse the language semantics specification to extract a set of potential context-update constructs and an underapproximating phase when we stress-test the semantics to refine the context-updates obtained at the first step. The underapproximating phase, firstly introduced in this paper, is justified by the lack of precision of the overapproximating phase for the context-updates. This lack of precision is most likely due to the laxity of the automatic detection of stack-like memory operators. Note that the class of target languages, i.e., programming languages present in the synchronous compilation chain, does not involve pointers while the arrays are always of fixed size. Since Chisel does not handle programs with pointers yet, we transform the fixed-size arrays into function calls (i.e., we add to the program a function that implements array accesses) so we can use Chisel for slicing industrial benchmarks that contain arrays. The rest of the paper is organized as follows: in Section 2 we present a comparison with existing works on generic program slicing, in Section 3 we give 3 https://github.com/ariesco/chisel 4 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco an overview of the Chisel tool, in Section 4 we describe our method for contextupdates synthesis and its integration in Chisel, and in Section 5 we describe the experimental evaluation of selected benchmarks. Section 6 concludes and outlines some future work directions. The complete code of the tool and examples are available at https://github.com/ariesco/chisel. 2 Related work Program slicing [36] is a standard analysis technique, hence most static analyzers contain some variant of program slicing. Slicing techniques [34] are classified as static, i.e., the slices are computed without assuming a particular program input, and dynamic, i.e., the test cases determine the program slices. Standard program analyzers include the necessary infrastructure to compute static slicing in the encoding of the language semantics, the control-flow graph, the dependency relations between program variables, etc. Examples of program slicing tools integrated in program analyzer are, for high-level languages: FramaC [16] for C code, and CodeSurfer [33] and Wala [12] for Java, whereas for low(er) level languages: Giri [29] for LLVM intermediate representation, CodeSurfer/x86 for disassembled x86 executables [4], MCSLICE [31] for Intel IA-32 microcode, and SlicingDroids [15] for Android executables. All these tools translate a program into a model for analysis, then analyze the model. However, the translation phase is particular to the language for which the analyzer is built and takes into account knowledge about the particularities of each language. Chisel aims to unify the translation phase by inferring the particularities of each language from its given algebraic semantics. Through this, we explore the genericity limits of slicing, in particular, and static analysis, in general. An early work on generic slicing is presented in [8] where the tool compiles a program into a self slicer. Generic slicing is also the focus in [5,10]. The ORBS tool [5] proposes a technique for dynamic slicing, based on statement deletion. A program slice is constructed iteratively by removing statements from the original program and then checking if the transformation is semantics-preserving w.r.t. the slicing criterion. Their semantics preserving verification phase relies on novel testing techniques [17]. Chisel proposes a complementary technique to the dynamic slicing of ORBS, as it computes static slicing based on in-depth investigation of the formal language semantics. We also use benchmark testing techniques for improving the precision of the context-updates synthesis. Another generic program slicing technique is proposed in [10] where an algorithm mechanically extracts slices from a common intermediate representation named PIM. The algorithm relies on a well-defined, non-trivial, and language dependent transformation between a language semantics of choice and PIM. The approach in [10] is generic in the sense that notions of static and dynamic slices are represented as constrained slices and various slicing methods are collapsed in a parametric slicing procedure. Chisel integrates now only static slicing and addresses genericity from a different angle: it eliminates the need of a languagedependent translation by working directly on the language semantics. Context-Updates Analysis and Refinement in Chisel 5 In rewriting logic, the work in [2] implements dynamic slicing for execution traces of the Maude model checker. The semantics is executed for an initial given state, then dependency relations are computed using a backward tracing mechanism. In comparison, Chisel proposes a static approach built around a formal semantics and with an emphasis on computing slices for programs and not for given traces (e.g., of model checker runs). Also, our proposed algorithm for context-update inference is based on a notion of hypertree, which we introduced and used for side-effects analysis, in [24]. A similar construction to our hypertree, called 2D graph is used in [18] for proving termination of term rewriting systems. Besides the generic aspect of Chisel, we mainly address in this paper the context-updates discovery component in our framework that is also of interest in the functional programming community. Functional programming proposes richer notions of contexts (and context manipulation) than what we consider in our framework. Briefly, the standard definition of a context as variables in scopes is extended in functional languages in several directions. On one hand, there are high-level constructs such as call/cc - call with current continuation - from the Scheme language [1], where snapshots of the current control states are manipulated as values (e.g., passed as arguments to function calls). One another hand, there are extended notions for contexts to capture security properties, as in the SLam calculus from [13] or parameters of the execution platforms [32,22]. For example, the contexts are used to track how programs affect an execution environment (e.g., the effect systems [32]) or the complementary approach about how programs depend on the execution environment (e.g., the coeffect systems [22]). In our framework, the context is a first-order variable that could be explicitly or implicitly represented in the programming languages’ semantics. We identify context changes (i.e., context-updates) in a generic manner, directly from a formal language semantics given as rewrite theories. Our context-updates discovery is less particularized as the mentioned related work in functional programming. This is due to the genericity character of our approach, i.e., we do not address a particular type of memory/environment representation as the one in functional programming. Nevertheless, the rich representations of context from functional programming are of interest for our framework in order to specialize the contextupdates detection with the inference of types of variables updates during context changes, e.g., different parameter passing styles at function call. The theoretical ideas underlying Chisel are in [24,3,25]. In [24] we describe the methodology for performing intraprocedural slicing, which is improved in [3] by implementing interprocedural slicing. In [25] we introduce an algorithm for inferring the data-flow information to automatically detect how the language constructs work with the memory. A description of the implementation of Chisel could be found in [26]. A preliminary study of the benchmarks used for testing in this paper is presented in [3], but limited to subparts of the code and only evaluated on high-level imperative languages. 6 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco S Language Semantics C Side-Effects Synthesis M memory Memory Policies memory stack read /write Synthesis C Context-Update Synthesis Term Analysis Fig. 1. Chisel components: the formal language semantics and the analyses. 3 The Chisel system We briefly describe in this section the ideas underlying Chisel tool. Chisel aims to advance the generic synthesis of program models from any programming language, provided the algebraic semantics of the language is given as a rewriting system. For now, the analysis of interest is program slicing. Note that the standardized model used by program slicing is an augmented control flow graph, i.e., a set of control flow graphs connected by call edges. The crucial information used in slicing is related to the data flow: which language constructs produce the data flow and how the data is actually flowing. The main observation we use for Chisel is the fact that side-effects induce an update in the memory afferent to the program. Hence, Chisel first detects the operators used by the semantics to reproduce memory updates. Then, the usage of the memory update operators is traced through semantics up to the language constructs. Any language construct that may produce a memory update is classified as producing side-effects. Moreover, following the direction of the memory updates, we infer also the data flow details (i.e., source-destination) for each side-effect language construct. Finally, the information gathered by Chisel about language constructs is used to traverse the term representing the program and to extract the subterms representing the slice. The tool works under a few assumptions w.r.t. S–the programming language semantics specification. Firstly, we assume that S is provided as an algebraic specification in rewriting logic. Given the bundle of work in the area of programming language specifications using rewriting logic, as discussed in Section 1, we consider that this first assumption does not impose a restriction on the generality. Secondly, we assume the existence of a certain structure in this semantics. Namely, the instructions are terms of a particular sort (i.e., a type) and the memory/environment/machine on which the programs are running are described by the operators defined in a certain specification module. The idea behind this assumption is the fact that any semantics of a programming language uses an (abstract) memory and some operations over this memory. We present in Fig. 1 the structure of Chisel: its components and their inputoutput relations. We briefly address each of the components in the following Context-Updates Analysis and Refinement in Chisel 7 subsections, except the context-update synthesis, which is the main contribution of the current work and is to be elaborated in the remaining of this paper. 3.1 Memory policies synthesis Let us denote M as the part of S that defines some (abstract) form of the memory used during program execution. Our assumption about the structure of the memory is that it connects the variables in the program with their values possibly via a chain of intermediate addresses. We define a memory policy as a particular type of operators specified using M = {o : w → s}, where w and s are standardly denoted as the arity and, respectively, co-arity of o. (Note that s denotes a sort while w denotes a list of sorts.) For example, a memory-read is the set of operators in M that contain in their arity the sort for variables and for memory and in their co-arity the sort for values. A memory-write operator contains in its arity sorts for memory, variables, and values, and in its co-arity the memory sort. Also, the rules defining this operator change the memory by updating the variable with the value. In [25] we present the analyses of S for read/write memory policies that produce the set of operators that manipulate the memory according to the given policy. 3.2 Side-effect synthesis Let us denote by C the part of S that defines the operators representing the programming language constructs, i.e., language instructions. The first inference that Chisel has to make is regarding which elements in C modify the program variables. Since in the memory M the program variables are connected to their values, determining constructs that modify a variable essentially means tracking the effects of an instruction over its variable component until reaching the memory level. Hence, we name side-effect language constructs those operators in C that produce a memory-write over some of its variable component. To determine the subset of C that may be side-effect constructs, Chisel identifies the set of rules R in S containing in the left-hand side (as a subterm) the C operators. The side-effect synthesis starts with the rules in R and constructs a hyper-tree T whose nodes are sets of rewrite rules and edges are unification based dependencies between these rules. Chisel discriminates the side-effect constructs by following the paths in this hyper-tree from the root to the leaves. The paths P leading to leaves that contain rules already classified by the memory policy phase as memory-writes are signalling the side-effect constructs. This part of Chisel is presented in [24]. The next phase of the side-effect synthesis consists in using the constructed T to determine the data flow (source-destination) produced by the side-effect constructs. Essentially, at this phase, Chisel trickles-up the paths P of the hypertree T , starting from the leaves up to the root. Namely, at the leaves level we identify the variable subterm as destination and the value as the source. This identification is based on the read/write memory policy phase. The information regarding the source-destination relation between these two subterms (i.e., 8 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco value/variable) is propagated up on each path in P by a backwards inference of the unifications of these subterms. When reaching the root of T , the value at the memory level is hooked to the sources subterms and the variable to the destination subterms. Hence, we determine the data flow induced by each side-effect construct and we describe this as a part of [25]. Note that side-effects synthesis determines an over-approximation of the sideeffect constructs. The data flow inference phase only enriches each of the already discovered side-effects constructs with key information for the program slicing, i.e., the source-destination direction of the flow of data. 3.3 Term analysis The algorithm for slicing a program p takes as input a slicing criterion S consisting in a set of program variables. In this step, Chisel takes the tree Tp representing the program term and traverses it repeatedly. Each traversal phase adds new elements to the set S and the process is repeated until the set S stabilizes. While traversing Tp , whenever a side-effect construct is encountered, if the destination of this construct is from S then all the source variables are added to S. Also, whenever a context-update construct is encountered, the traversal of Tp is redirected towards the Tp ’s subtree whose root matches a particular subterm of the context-update construct. At the end of the traversal, the program slice is given by the skeleton of Tp containing the subtrees representing the instructions that produced changes to the set S. 4 The context-update inference algorithm In this section we present our approach towards discovering context-update constructs in the programming language under consideration. We start by setting some notation and defining the intuitive ideas. Note that in the followings we use notation introduced in the previous section. Firstly, we denote Lp the list of elements from C–the language instructions’ sort–obtained by a preorder traversal of Tp –the tree associated to the program p. We define as context-update constructs (context-updates for short) those operators in C that, during program execution using S, produce changes to the list Lp . For example, function calls and gotos are context-update constructs. We denote by context-updates synthesis the strategy of deducing, based on the language semantics S, an overapproximation of the set of context-update instructions. The methodology we propose for context-updates synthesis follows the same strategy as the one for side-effects described in the previous Sections 3.1 and 3.2. Namely, we firstly apply sort-based patterns to the memory module in S in order to identify stack structures/memory operators or, short, memory-stacks (Section 4.1). Secondly, using the memory-stacks we traverse the hyper-tree T to discover the set O of language constructs that directly use the memory-stacks (Section 4.2). Note that O is an overapproximation of the context-updates since our target semantics S describe context-free languages of either high or low level. Context-Updates Analysis and Refinement in Chisel 9 As the context-free languages need some stack representation and we trigger our context-updates synthesis by an initial phase that discovers memory-stack patterns in S. Finally, in order to make the set O more accurate we use a refinement step that, based on the execution of benchmarks, partitions the subset O in three: Of the function call constructs, Og the goto constructs, and Or the residue constructs that are present in O due to the overapproximations in the first two steps (Section 4.3). 4.1 Memory-stack policy The memory-stack policy determines rules in S constructing stack-like structures at the memory level. The strategy applied for memory-stack policy is similar to the strategy described in Section 3.1. Namely, we have two patterns we search for: explicit and implicit. The explicit memory-stack policy where we determine non-commutative memory operators s : SS 0 →S or s : S 0 S→S that have a subsorted arity S 0 ≤ S and all the rules describing them either add or substract one element. The implicit pattern uses the conditional rules over the language semantics to produce memory-stacks. The implicit pattern is produced by the Maude’s evaluation semantics that uses a an evaluation stack for conditional rules. Namely, the evaluation of the conditional rule’s body (i.e., the statement between the crl and if keywords) is postponed until the evaluation of the rule’s condition (i.e., the statement after if keyword) is completed. Example 1. We present in this example the memory specification for WhileFun– an imperative language with assignment, conditional, loops, local variables, an input/output buffer, and function calls [14,3]. Assuming we have defined the syntax for the language in a module WHILE-SYNTAX (which includes definitions for variables, Boolean values, and numeric values), the module MEMORY imports this module and defines the sorts Env for the environment, which maps variables to values, and ESt for a stack of environment, which will be used when a new context is required: fmod MEMORY is pr WHILE-SYNTAX . sorts Env ESt . subsort Env < ESt . ... where the subsort indicates that a single environment states for a singleton stack, i.e., the environment type is a subtype of the environments’ stack . Constructors of these sorts are defined by using op and the attribute ctor. In this case, we define the empty environment (mt); a single assignment, which receives a variable and a value (underscores are placeholders); and the composition of environment, defined with empty syntax and defined as commutative and associative and having mt as identity: op mt : -> Env [ctor] . op _=_ : Variable Value -> Env [ctor] . op __ : Env Env -> Env [ctor comm assoc id: mt] . 10 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco Similarly, the stack is built by putting together stacks with the _|_ operator: op _|_ : ESt ESt -> ESt [ctor assoc] . The operator | follows the explicit memory-stack policy and it will be used in the context-update synthesis, as described in Example 2 from Section 4.2. The memory module also contains functions for variables’ update, variables’ look-up, and new variables allocation. Below we show Chisel commands and the results for the memory-stack policy applied on WhileFun: Maude> (memory inferences .) ESt RWBUF Maude> (context update sorts .) ESt Maude> (memory-stack ops .) _|_ Namely, memory inferences command produces the sorts that agree with memorystack policy: ESt–the environment stack sort defined in the MEMORY module– and RWBUF–the sort defining the memory buffer that handles the results of the read/write instructions in WhileFun. The context update sorts command keeps from the memory-stack sorts only the sorts that produce context changes, as we describe next, in Section 4.2. 4.2 Context-updates synthesis The synthesis of a set O of constructs that may produce context-updates relies on the hyper-tree constructed for the operators in C and is similar with the sideeffects synthesis described in Section 3.2 and [24]. The difference here is the fact that at the leaves level we now use a different memory policy (the memory-stack policy) to filter the paths leading to context-updates. The algorithm implementing this in Chisel is defined by the operator traverseHypertree given in Fig. 2: The operator in Fig. 2 computes the set of basic syntactic language constructs that may be context-updates, by inspecting the conditions and the right-hand side of each rewrite rule in C represented here as Q, i.e., the rule label. The operator unfolds the rewrite rules into the hyper-tree T with children nodes representing lists of rules that unify with subterms of Q’s conditions (each subterm of Q unifies with a particular node). The traversalHypertree operator goes horizontally in T if there is no subtree rooted in the current Q node. Otherwise, when Q is the root of a subtree in T (e.g., when the rule Q is conditional), the traversal goes vertically via the operator traverseCond. The traversalHypertree operator assigns each rule label Q to a particular set, either orange or olive, where these sets are defined as follows: orangeSet := {Q ∈ nodes(T ) | ∃Q0 ∈ subtree(Q, T ) : Q0 ∈ ContextUpdates} oliveSet := {Q ∈ nodes(T ) | ∀Q0 ∈ subtree(Q, T ) : Q0 ∈ / ContextUpdates} The orangeSet contains Qs that are the root of a subtree containing contextupdates while oliveSet is context-updates free. Note that the termination of Context-Updates Analysis and Refinement in Chisel 11 op traverseHypertree : Module QidSet TermList ContextUpdates HypertreeTraversalResult -> HypertreeTraversalResult . eq traverseHypertree(M, none, TL, CU, HTR) = HTR . ceq traverseHypertree(M, Q ; QS, TL, CU, HTR) = traverseHypertree(M, QS, TL, CU, HTR’) if Q in CU /\ HTR’ := add2orange(Q, HTR) . ceq traverseHypertree(M, Q ; QS, TL, CU, HTR) = traverseHypertree(M, QS, TL, CU, HTR) if traversed?(Q, HTR) . ceq traverseHypertree(M, Q ; QS, TL, CU, HTR) = if allOrange?(HTR’) and not emptyHypernode(M, COND, (T, TL)) then add2orange(Q, HTR’) else add2olive(Q, HTR’) fi if COND := getCondition(M,Q) /\ not Q in CU /\ not traversed?(Q,HTR) /\ T := getLHS(M,Q) /\ HTR’ := traverseCond(M, COND, (T, TL), CU, setAllOrangeVar(true, HTR)) . op traverseCond : Module Condition TermList ContextUpdates HypertreeTraversalResult -> HypertreeTraversalResult . eq traverseCond(M, nil, TL, CU, HTR) = setAllOrangeVar(false, HTR) . eq traverseCond(M, T = T’ /\ COND, TL, CU, HTR) = traverseCond(M, COND, TL, CU, HTR) . eq traverseCond(M, T := T’ /\ COND, TL, CU, HTR) = traverseCond(M, COND, TL, CU, HTR) . eq traverseCond(M, T : S /\ COND, TL, CU, HTR) = traverseCond(M, COND, TL, CU, HTR) . ceq traverseCond(M, T => T’ /\ COND, TL, CU, HTR) = combineHypernodes(HTR’, HTR’’) if TV := freshTerm(T) /\ QS := getRulesUnifying(M, TV, getRls(M), TL) /\ HTR’ := traverseHypertree(M, QS, TL, CU, HTR) /\ HTR’’ := traverseCond(M, COND, TL, CU, setAllOrangeVar(true, HTR’)) . Fig. 2. The traverseHypertree operator in Chisel. the algorithm in Fig. 2 is ensured by the fact that the specification S has a finite number of rules, and that any rule in T that was already added to either orange or olive set is not unfolded anymore. We give next an example that provides the intuition about the synthesis process. CallF→ AsR→ Inc1→ Inc2→ SdE→ IfR1→ . . . → WriteR→ ReadR1→ReadR2 −→ < , > −→ asgP1→asgP2 −→ rmv1→rmv2 −→ | −→ < , , , > | Fig. 3. The hyper-tree constructed for WhileFun. Example 2. The first part of the hyper-tree TWhileFun , constructed for WhileFun semantics, is depicted in Fig. 3. The memory-stack operator discovered here at the leaves level is | that is obtained by the explicit memory-stack policy. The root of TWhileFun contains the language constructs C where we show first CallF the rule label that specifies the semantics of a function call such as: 12 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco crl [CallF] : < Call fn(actPrms), st, rwb, fs > => < skip, st’’, rwb’, fs > if fn(Prms){ C } fs’ := fs /\ < actPrms, st > => vals /\ st’ := assignPrms(actPrms, Prms, st | mt) /\ < C, st’, rwb, fs > => < skip, st’’ | lenv’, rwb’, fs > . The first condition in the rule CallF extracts the function definition from the function set fs by means of a matching condition; the second condition evaluates the arguments passed to the function; the third condition uses the function assignPrms (described below) to bind the parameters to the values previously obtained; and the fourth condition evaluates the body of the function in the new stack of environments. op assignPrms : ExpL VarL ESt -> ESt . eq [asgP1] : assignPrms(nv, nv, ro) = ro . eq [asgP2] : assignPrms((N,EL), (X,VVs), mu | ro) = assignPrms(EL, VVs, mu | remove(ro, X) (X = N)) . The function assignPrms is in charge of assigning the appropriate values to the parameters of a function call. It receives a list of expressions, a list of variables, and a stack of environments as arguments and traverses the lists removing the previous value associated to the variable at the top of the stack and binding it to the new one. 4.3 Context-updates refinement For the refinement step we use a modified version of the Maude testing tool presented in [23], which generates test cases for Maude functional modules and executes these tests while checking the conformance of their result w.r.t. a given specification ϕ. In our case, ϕ is defined over the execution trace as defined next. Given the programming language semantics S and a program p, which is associated in S with a term with a tree representation Tp , we define Lp the flattening of p into a list of instructions (i.e., unit elements in C) obtained by the preorder traversal of Tp (i.e., the listing of the program’s code instructions). Given a set of execution traces E we denote its elements by $, i.e., an execution path of p w.r.t. S. Furthermore, we denote by π the filtering of $ w.r.t. the language constructs C. We use the standard notation for π, namely |π| represents the length of the path, while πi , i ∈ {0, . . . , |π|}, represents the i-th element of the path. Note that π0 is , the empty execution list. We also denote by [Lp ]fn the set function definitions in p: {Lp (k)..Lp (k + n − 1) | Lp (k) ∈ Cfn and (Lp (k + n) ∈ Cfn or Lp (k + n) = ) and ∀i = k + 1..k + n − 1 : Lp (i) ∈ / Cfn } where Lp (i) represents the i-th element of the list Lp and Cfn is the set of program constructs representing function declarations. Context-Updates Analysis and Refinement in Chisel 13 Definition 1. The property ϕ w.r.t. E is defined as follows: ∀ς ∈ O, ∀$ ∈ E, π := filter C ($), ∀i ∈ 1..|π| : πi = ς =⇒ (πi−1 πi ∈ Lp =⇒ ς ∈ Or )∧ (πi−1 πi ∈ / Lp ∧ (πi−1 , πi ) ∈ [Lp ]fn ) =⇒ ς ∈ Og )∧ (πi−1 πi ∈ / Lp ∧ (πi−1 , πi ) ∈ / [Lp ]fn ) =⇒ ς ∈ Of ) Hence the three sets Of (the function call constructs), Og (the goto constructs), and Or (the residue constructs) are obtained from O by a discrimination process based on the analysis of testing traces. Namely, the residues Or are constructs that execute always in programs’ sequential order; the gotos Og and function calls Of are constructs that break the sequential order for either jumping inside the current function body, or to another function, respectively. Note that if the sets Or , Og , and Of do not form a partition we use the remaining elements in O to signal counterexamples for the context-updates inference phase. In the next section we describe the benchmark tests we used for the experimental semantics WhileFun and MIPS. 5 Experiments in Chisel We apply Chisel, extended with the synthesis algorithm for context-updates on a standard benchmark for real-time systems called PapaBench [21]. We consider, in our experimental evaluation, both formal semantics of WhileFun and MIPS. PapaBench is a code snapshot extracted from an actual real-time designed for Unmanned Aerial Vehicle (UAV). It consists of two communicating applications, a command management called fly by wire and a navigation management called autopilot. Both applications have a number of inter-dependent tasks which are executed in a control loop, at different frequencies. Structurally, fly by wire has five tasks, named from T1 to T5 and autopilot has eight tasks, from T6 to T13. Moreover, each application serves three interrupts, which are not of concern for the current tool evaluation. The tasks are summarized in Fig. 4 (left) and their inter-dependencies shown in the same figure (right). PapaBench application has two modes–manual and automatic. In the manual mode, the radio command (T1) of fly by wire is executed, sending data (T2) to autopilot which analyzes and sends back information (T6, T7, T8) to fly by wire for processing and issuing commands (T3, T4). The automatic mode is triggered in autopilot by the GPS communication (T9) and enables navigation, altitude and climb control (T10, T11, T12) before stabilization (T7). T5 of fly by wire and T13 of autopilot handle failure checking and respectively parameter reporting. PapaBench is organized in modes and tasks, coordinated by a set of global variables. We apply Chisel on two programming levels: the original imperative code and the binary code obtained after disassembling. In this way we aim to study the analyzability and traceability properties of PapaBench, e.g., isolate and quantify different functionalities within each task, as well as the inter-task behavior between communicating tasks. We report the results of Chisel as reduc- 14 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco Tasks : fbw and autopilot T1 - receive radio commands T2 - send data to autopilot T3 - receive data from autopilot T4 - transmit servos T5 - check failsafe T6 - manage radio commands T7 - control stabilization T8 - send data to fbw T9 - receive gps data T10 - control navigation T11 - control altitude T12 - control climb T13 - manage reporting Fig. 4. PapaBench: The tasks and their dependencies Name # Funs # Calls scheduler fbw periodic auto fly by wire T1 T2 T3 T4 T5 autopilot T6 T7 T8 T9 T10 T11 T12 T13 14 21 41 10 9 9 9 7 95 36 9 7 15 18 3 4 37 18 80 110 26 9 24 14 22 214 71 13 15 30 27 2 3 93 LOC red (%) LOC red (%) (WhileFun) (WhileFun) (MIPS) (MIPS) 103 72.8 % 396 44.4 % 225 73.3 % 779 36.3 % 638 91.1 % 1913 41 % 119 76.5 % 534 36.2 % 59 69.5 % 329 44.4 % 82 76.5 % 501 43.6 % 50 61.5 % 235 34.5 % 66 67 % 453 51 % 1384 92 % 5639 41.5 % 306 77.2 % 1329 54 % 57 70 % 426 42 % 54 69.2 % 219 38 % 87 75 % 617 36.5 % 102 71.1 % 1002 42.2 % 15 63.4 % 90 70.6 % 49 66.2 % 363 50 % 240 79.7 % 1535 42 % Fig. 5. Chisel performance on PapaBench benchmark tion in the number of instructions (LOC). Next, we elaborate on experimentation (i.e., platform, organization, test cases) and its results, as summarized in Fig. 5. Context-Updates Analysis and Refinement in Chisel 15 We conduct our experiments on the following settings: we run Chisel with Maude (and Full-Maude) 2.7 on a MacBook Pro 2.5 GHz, 4GB RAM, with PapaBench version 0.4 (for the WhileFun code) and the gcc 4.7.1 cross-compiler to obtain MIPS code (and with sufficient traceability to check the corresponding program slices at the high- and low-levels). We organize the benchmark as follows, in Fig. 5: each of the 13 tasks (the rows T1 to T13), the core functionalities of fly by wire and autopilot (the rows scheduler fbw and periodic auto), and the complete PapaBench benchmark (the rows fly by wire and autopilot). These latter four functionalities were introduced in [26] and included here for completion purposes. Note that in [26] the context-updates were manually introduced for each language while here we detect them automatically. The context-updates synthesis phase produces exact results for WhileFun while for MIPS the overapproximation at the synthesis phase is too large (the synthesized context-updates for MIPS include most of the language instructions). Hence, the testing phase, which is underapproximating the synthesized context-updates, is essential for context-updates in MIPS. We employ random testing on the currently described benchmarks and we reduce the context-updates for MIPS to the exact set. Hence, the results reported in the Fig. 5 coincide with the results obtained in [26] where the context-updates were manually provided. We quantify the number of functions and function calls (columns #Funs and respectively #Calls), the code size (LOC) and the slicing reduction factor, red(%) for both WhileFun and MIPS programs. The reduction factor captures the slicing performance w.r.t., the original code on both WhileFun and MIPS variants. We measure the slicing performance in the following way: - The rows with the full benchmark (autopilot and fly by wire) and its core functionalities (scheduler fbw and periodic auto): the slicing procedure considers as slicing criteria sets of global variables used to activate modes and inter-task communication. The red(%) shows the reduction percentage resulting from program slices size over the reference (original) code size. - The rows corresponding to each task T1 to T13 (with the exception of T11–control altitude–which is very small, but included for completeness purposes): the slicing procedure is based on 7 slicing criteria designed to measure several aspects of a task code. These criteria correspond to: 1- global functionality, i.e., variable(s) responsible for the task functionality; 2,3- mode split, i.e., global and local variable(s) related to modes involved in the task main function; 4- inter-tasks parameters, i.e., variable(s) that emphasize the communication between tasks in Fig. 4 (e.g., T5-T4 for T5, T2-T6-T1-T3 for T2); 5- global params. impact, i.e., global variable(s) used in performing the respective task functionality; 6- effect on inter-procedural behavior, i.e., global impact of function calls; 7- effect on the communication for control navigation and climb tasks (T10 and T12) and arrays to measure the penalty incurred when transforming array operations into function calls (for T1-T9 and T13), and local impact of specific function calls. 16 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco Chisel, when applied on WhileFun programs performs well, partly because of the inter-procedural analysis and partly because the code structure is modebased. The results for WhileFun are reported in Fig. 5 (column red(%)WhileFun). On the other hand, we report lower percentages for MIPS code, as shown in Fig. 5 (column red(%)MIPS) because of several reasons. First, the current version of Chisel does not follow through the memory addresses. Second, any function call in a small sized function involves setting the function stack with registers global and stack pointer, which end-up dominating the code size and yielding longer slices. Third, as reported in [31], in general slicing binary code could result in longer slices because of the indirect side-effects via register flags. However, Chisel slicing on MIPS code stays generic and it is work in progress to employ a slicing procedure specialized for low-level languages to produce more precise slices. Using the criteria 6- and 7-, we measure the improvement of an inter-procedural analysis for MIPS that amounts to an additional 20%-25% reduction. PapaBench is used to evaluate the worst-case execution time (WCET) analysis and to experiment different scheduling models. In these contexts and with respect to the considered benchmark, we used the program slices computed with Chisel for several purposes. For example, we perform the intersection of program slices obtained on criteria such as functionality modes and we identify what are the shared and/or individual behaviors as well as communication patterns at the code level (in particular on WhileFun code). Also, we use the program slices to discover the computationally intensive modes which in turn would impact the task scheduling and the accuracy of the WCET analysis. In this latter case, it is a well-known WCET estimation technique to evaluate the code generated from synchronous designs in two phases: the initialization and the rest. 6 Concluding remarks and future work In this paper we have presented a generic synthesis method for context-updates constructs, from given semantics of programming languages written in Maude. The synthesis strategy follows three stages: the memory policy, the contextupdates overapproximations, and the overapproximation refinement. We also integrated our method in Chisel, a Maude tool that can perform generic program slicing. We experimented our extended Chisel with different semantics: WhileFun (imperative) and MIPS (assembly), both of them with different variations, e.g., different memory models and data flow styles. We have also designed test programs to evaluate the efficiency of the produced slices. These experiments correspond to Unmanned Aerial Vehicle applications, which prove that this technique can be applied to real-time programs. Note that for the moment we use these benchmarks in the refinement step. As ongoing work we focus on a more complex strategy for the refinement step by using more evolved testing strategies. For future work, we plan to extend the language with pointers, hence supporting more complex memory policies based on a more refined memory model. Finally, our aim is to introduce concurrency Context-Updates Analysis and Refinement in Chisel 17 in the framework so that we can cover and test out proposed methodology on a larger and significant class of programming languages. References 1. H. Abelson and G. J. Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1985. 2. M. Alpuente, D. Ballis, F. Frechina, and J. Sapina. Combining runtime checking and slicing to improve Maude error diagnosis. In Logic, Rewriting, and Concurrency, volume 9200 of LNCS, pages 72–96. Springer, 2015. 3. I. M. Asavoae, M. Asavoae, and A. Riesco. Towards a formal semantics-based technique for interprocedural slicing. In iFM 2014, volume 8739 of LNCS, pages 291–306. Springer, 2014. 4. G. Balakrishnan, R. Gruian, T. W. Reps, and T. Teitelbaum. CodeSurfer/x86a platform for analyzing x86 executables. In CC, volume 3443 of LNCS, pages 250–254. Springer, 2005. 5. D. Binkley, N. Gold, M. Harman, S. Islam, J. Krinke, and S. Yoo. ORBS: Languageindependent program slicing. In FSE14, pages 109–120, 2014. 6. A. Bouhoula, J.-P. Jouannaud, and J. Meseguer. Specification and proof in membership equational logic. Theoretical Computer Science, 236:35–132, 2000. 7. M. Clavel, F. Duran, S. Eker, P. Lincoln, N. Marti-Oliet, J. Meseguer, and C. Talcott. All About Maude, volume 4350 of LNCS. Springer, 2007. 8. S. Danicic and M. Harman. Espresso: A slicer generator. In SAC, pages 831–839, 2000. 9. A. Farzan, F. Chen, J. Meseguer, and G. Rosu. Formal analysis of Java programs in JavaFAN. In CAV, pages 501–505, 2004. 10. J. Field, G. Ramalingam, and F. Tip. Parametric program slicing. In POPL, pages 379–392. ACM Press, 1995. 11. J. Field and F. Tip. Dynamic dependence in term rewriting systems and its application to program slicing. Information & Software Technology, 40(11-12):609–636, 1998. 12. S. J. Fink, E. Yahav, N. Dor, G. Ramalingam, and E. Geay. Effective typestate verification in the presence of aliasing. In ISSTA, pages 133–144. ACM, 2006. 13. N. Heintze and J. G. Riecke. The slam calculus: Programming with secrecy and integrity. In POPL, pages 365–377, 1998. 14. M. Hennessy. The Semantics of Programming Languages: An Elementary Introduction Using Structural Operational Semantics. John Wiley & Sons, 1990. 15. J. Hoffmann, M. Ussath, T. Holz, and M. Spreitzenbarth. Slicing droids: program slicing for smali code. In SAC, pages 1844–1851. ACM, 2013. 16. F. Kirchner, N. Kosmatov, V. Prevosto, J. Signoles, and B. Yakobowski. Frama-c: A software analysis perspective. Formal Asp. Comput., 27(3):573–609, 2015. 17. W. B. Langdon, S. Yoo, and M. Harman. Inferring automatic test oracles. In ICSE, pages 5–6, 2017. 18. S. Lucas, J. Meseguer, and R. Gutierrez. Extending the 2D dependency pair framework for conditional term rewriting systems. In LOPSTR, volume 8981 of LNCS, pages 113–130, 2014. 19. J. Meseguer. Conditional rewriting logic as a unified model of concurrency. Theoretical Computer Science, 96(1):73–155, 1992. 18 Irina Măriuca Asăvoae, Mihail Asăvoae, Adrián Riesco 20. J. Meseguer and G. Rosu. The rewriting logic semantics project. Theoretical Computer Science, 373(3):213–237, 2007. 21. F. Nemer, H. Casse, P. Sainrat, J. P. Bahsoun, and M. D. Michiel. Papabench: a free real-time benchmark. In WCET, 2006. 22. T. Petricek, D. A. Orchard, and A. Mycroft. Coeffects: a calculus of contextdependent computation. In ICFP, pages 123–135, 2014. 23. A. Riesco. Test-case generation for Maude functional modules. In T. Mossakowski and H. Kreowski, editors, WADT, volume 7137 of LNCS, pages 287–301. Springer, 2010. 24. A. Riesco, I. M. Asavoae, and M. Asavoae. A generic program slicing technique based on language definitions. In WADT 2012, volume 7841 of LNCS, pages 248– 264, 2013. 25. A. Riesco, I. M. Asavoae, and M. Asavoae. Memory policy analysis for semantics specifications in Maude. In LOPSTR, volume 9527 of LNCS, pages 293–310. Springer, 2015. 26. A. Riesco, I. M. Asavoae, and M. Asavoae. Slicing from formal semantics: Chisel. In FASE, pages 374–378, 2017. 27. G. Rosu and T. F. Serbanuta. An overview of the K semantic framework. Journal of Logic and Algebraic Programming, 79(6):397–434, 2010. 28. V. Rusu, D. Lucanu, T. Serbanuta, A. Arusoaie, A. Stefanescu, and G. Rosu. Language definitions as rewrite theories. Journal of Logical and Algebraic Methods in Programming, 85(1):98–120, 2016. 29. S. K. Sahoo, J. Criswell, C. Geigle, and V. S. Adve. Using likely invariants for automated software fault localization. In ASPLOS, pages 139–152. ACM, 2013. 30. M. Sharir and A. Pnueli. Two approaches to interprocedural data flow analysis. New York Univ. Comput. Sci. Dept., New York, NY, 1978. 31. V. Srinivasan and T. W. Reps. An improved algorithm for slicing machine code. In OOPSLA, pages 378–393, 2016. 32. J. Talpin and P. Jouvelot. The type and effect discipline. In LICS, pages 162–173, 1992. 33. T. Teitelbaum. CodeSurfer. ACM SIGSOFT Software Eng. Notes, 25(1):99, 2000. 34. F. Tip. A survey of program slicing techniques. Journal of Programming Languages, 3(3):121–189, 1995. 35. A. Verdejo and N. Marti-Oliet. Executable structural operational semantics in Maude. Journal of Logic and Algebraic Programming, 67:226–293, 2006. 36. M. Weiser. Program slicing. In ICSE, pages 439–449. IEEE Press, 1981.
6cs.PL
arXiv:1603.05330v1 [math.GR] 17 Mar 2016 Groups not acting on compact metric spaces by homeomorphisms Azer Akhmedov Abstract: We show that the direct sum of uncountably many non-Abelian groups does not embed into the group of homeomorphisms of a compact metric space. The main result of this note does not seem to exist in the literature. Among other things, it provides very simple examples of left-orderable groups of continuum cardinality which do not embed in Homeo+ (R) 1 Theorem 1. Let X be a compact metric space, I be an uncountable set, and Gα be a non-Abelian group, for all α ∈ I. Then the direct sum ⊕ Gα does not embed into the group of homeomorphisms of X. α∈I Proof. We will assume that the direct sum ⊕ Gα embeds in Homeo(X). α∈I For all α ∈ I, let fα , gα be some non-commuting elements in Gα . We will denote the metric on X by d(., .). Notice that the group Homeo(X) of homeomorphisms of X also becomes a metric space where for φ, ψ ∈ Homeo(X), we define the metric by D(φ, ψ) = sup d(φ(x), ψ(x)). x∈X By compactness of X, we have a sequence Cn , n ≥ 1 of finite subsets of X such that (i) for all n ≥ 1, Cn is a n1 -net, i.e. for all x ∈ X, there exists z ∈ Cn such that d(z, x) < n1 , (ii) Cn ⊆ Cn+1 , for all n ≥ 1, (iii) ∪n≥1 Cn = X. (n) (n) Let Cn = {x1 , . . . , xpn }, n ≥ 1. For all n ≥ 1 and δ > 0, we will also write (n) Fn,δ = {φ ∈ Homeo(X) | diamφ(B 2 (xi )) < δ, ∀i ∈ {1, . . . , pn }} n 1It is well known that a countable group is left-orderable iff it embeds into Homeo+ (R). Thus it becomes an interesting question whether or not there exists a left-orderable group of continuum cardinality which does not embed in Homeo+ (R). This question has been addressed in a very recent paper [M] where two different examples have been constructed. 1 2 1 } there exists c > 0 i≥1 i and an uncountable set I1 ⊂ I such that for all α ∈ I1 we have D([fα , gα ], 1) > c. Since Homeo(X)\{1} = ∪ {φ | D(φ, 1) > By compactness, all homeomorphisms of X are uniformly continuous. Then there exists an uncountable set I2 ⊂ I1 and positive integers n, m c such that max{ n1 , m1 } < 10 and for all β ∈ I2 we have {fβ , gβ } ⊆ Fn, 1 . m Then, since Homeo(X) is separable, there exists an uncountable set I3 ⊂ I2 and f⋆ , g⋆ ∈ Homeo(X) such that for all γ ∈ I3 we have 1 max{D(fγ , f⋆ ), D(gγ , g⋆ )} < 100n . Then for all γ, η ∈ I3 and for all x ∈ X we have the inequalities 1 c d(gη fγ (x), gγ fγ (x)) < and d(fγ gη (x), fγ gγ (x)) < . 50n 5 On the other hand, for any two distinct η, γ ∈ I3 there exists x0 ∈ X such that d(fγ gγ (x0 ), gγ fγ (x0 )) > c. By triangle inequality, we obtain that d(gη fγ (x0 ), fγ gη (x0 )) > Thus [gη , fγ ] 6= 1. Contradiction.  c . 2 Remark. To obtain interesting applications of the main theorem, X can be taken to be an arbitrary compact manifold (with boundary). In the case of a closed interval I ∼ = [0, 1], we obtain a nonembeddability result into Homeo+ (R), i.e. the direct sum of uncountably many isomorphic copies of a non-Abelian group G does not embed in Homeo+ (R). The result of Theorem 1 can be extended to a much larger class of topological spaces. One can also drop or replace the non-Abelian condition on the group G in certain special contexts. References: [M] K.Mann, Left-orderable groups that don’t act on the line. Mathematische Zeitschrift vol. 280, issue 3, (2015) 905-918. Azer Akhmedov, Department of Mathematics, North Dakota State University, Fargo, ND, 58108, USA E-mail address: [email protected]
4math.GR
1 Reliable Generation of High-Performance Matrix Algebra Geoffrey Belter,† Elizabeth Jessup,‡ Thomas Nelson,† Boyana Norris,§ and Jeremy G. Siek† of Electrical, Computer, and Energy Engineering, University of Colorado, Boulder, CO 80309 † Department Email: [belter,Thomas.Nelson,Jeremy.Siek]@Colorado.EDU ‡ Department of Computer Science, University of Colorado, Boulder, CO 80309 Email: [email protected] § Mathematics and Computer Science Division, Argonne National Laboratory, Argonne, IL 60439 arXiv:1205.1098v1 [cs.MS] 5 May 2012 Email: [email protected] Abstract—Scientific programmers often turn to vendor-tuned Basic Linear Algebra Subprograms (BLAS) to obtain portable high performance. However, many numerical algorithms require several BLAS calls in sequence, and those successive calls result in suboptimal performance. The entire sequence needs to be optimized in concert. Instead of vendor-tuned BLAS, a programmer could start with source code in Fortran or C (e.g., based on the Netlib BLAS) and use a state-of-the-art optimizing compiler. However, our experiments show that optimizing compilers often attain only one-quarter the performance of hand-optimized code. In this paper we present a domain-specific compiler for matrix algebra, the Build to Order BLAS (BTO), that reliably achieves high performance using a scalable search algorithm for choosing the best combination of loop fusion, array contraction, and multithreading for data parallelism. The BTO compiler generates code that is between 16% slower and 39% faster than handoptimized code. I. I NTRODUCTION Traditionally, scientific programmers have used linear algebra libraries such as the Basic Linear Algebra Subprograms (BLAS) [14, 15, 23] and the Linear Algebra PACKage (LAPACK) [3] to perform their linear algebra calculations. A programmer links an application to vendor-tuned or autotuned implementations of these libraries to achieve efficient, portable applications. For programs that rely on kernels with high computational intensity, such as matrix-matrix multiply, this approach can achieve near optimal performance [35]. However, memory bandwidth, not computational capacity, limits the performance of many scientific applications [3], with data movement expected to dominate the costs in the foreseeable future [2]. Because each BLAS performs a single mathematical operation, such as matrix-vector multiplication, a tuned BLAS library has a limited scope within which to optimize memory traffic. Moreover, separately compiled BLAS limit the scope of parallelization on modern parallel architectures. Each BLAS call spawns threads and must synchronize before returning, but much of this synchronization is unnecessary when considering the entire sequence of matrix algebra operations. The BLAS Technical Forum suggested several new routines that combine sequences of routines, thereby enabling a larger scope for optimization [8, 18]. However, the number of useful BLAS combinations is larger than is feasible to implement for each new architecture. Instead of using vendor-optimized BLAS, a scientific programmer can start with source code in Fortran or C, perhaps based on the Netlib BLAS, and then use a state-of-the-art optimizing compiler to tune the code for the architecture of interest. However, our experiments with two industrial compilers (Intel and Portland Group) and one research compiler (Pluto [9]) show that, in many cases, these compilers achieve only one-quarter of the performance of hand-optimized code (see Section V-B). This result is surprising because the benchmark programs we tested are sequences of nested loops with affine array accesses, and the optimizations that we applied by hand (loop fusion, array contraction, and multithreading for data parallelism) are well established. Nevertheless, for some benchmarks, the compilers fail to recognize that an optimization is legal (semantics-preserving). For other benchmarks, they miscalculate the profitability of choosing one combination of optimizations over another combination. These observations demonstrate that achieving reliable, automatic generation of high-performance matrix algebra is nontrivial. In particular, the three main challenges are (1) recognizing whether an optimization is legal, (2) accurately assessing the profitability of optimizations and their parameters, and (3) efficiently searching a large, discontinuous space of optimization choices and parameters. In this paper, we present the Build to Order BLAS (BTO) compiler. It is the first compiler that solves all three of these challenges specifically for the domain of matrix algebra. BTO accepts as input a sequence of matrix and vector operations in a subset of MATLAB, together with a specification of the storage formats for the inputs and outputs, and produces optimized kernels in C. This choice of input language is part of our solution to the problem of determining whether an optimization is legal. The input language makes all data dependencies explicit, so there is no difficulty recognizing whether an optimization is semantics-preserving or not. Further, BTO uses a carefully designed internal representation for optimization choices that rules out many illegal choices while at the same time succinctly representing all the legal choices. To accurately assess profitability, the BTO compiler relies on a hybrid approach. Analytic modeling is used for 2 coarse-grained pruning whereas empirical timing is used to make the ultimate decisions. To find the best combination of optimizations within a large search space, BTO uses a genetic algorithm whose initial population is the result of a greedy, heuristic search. We described earlier prototypes of BTO in several papers [5, 6, 20, 32]. In these papers, we considered only a subset of the optimizations considered here; moreover, at the time of their writing, we had not yet developed a search algorithm that was scalable with respect to the number of optimizations and their parameters. The following are the specific, technical contributions of this paper. 1) We present an internal representation for optimization choices that is complete (includes all legal combinations of loop fusion, array contraction, and multithreading for data parallelism) but that inherently rules out many illegal combinations (Section III). 2) We present a scalable and effective search strategy: a genetic algorithm with an initial population seeded by a greedy search. We describe this strategy in Section IV and show in Section V-B that it produces code that is between 16% slower and 39% faster than handoptimized code. 3) We compare this genetic/greedy search strategy with several other strategies in order to reveal the rationale behind this strategy (Section V-D). We discuss related work in Section VI and conclude the paper in Section VII with a brief discussion of future work. II. BTO OVERVIEW Figure 1 shows an example BTO input file for the BATAX subprogram that performs the operations y ← βAT Ax for matrix A, vectors x and y, and scalar β. The user of BTO specifies the input types, including storage formats and a sequence of matrix, vector, and scalar operations; but the user does not specify how the operations are to be implemented. That is, the user does not identify such details as the kinds of loops or the number of threads. The BTO compiler produces a C implementation in two broad steps. It first chooses how to implement the operations in terms of loops, maximizing spatial locality by traversing memory via contiguous accesses. It then searches empirically for the combination of optimization decisions that maximizes performance. Sections III and IV describe the search process. BATAX in: x : A: out: y : { y = } Fig. 1. vector(column), beta : scalar , matrix(row) vector(column) beta ∗ A’ ∗ (A ∗ x) BTO input file for the BATAX kernel. Throughout the compilation process, BTO uses a dataflow graph representation, illustrated in Figure 2 for the BATAX kernel. The square boxes correspond to the input and output matrices and vectors, and the circles correspond to the operations (operations are labeled with numbers, which are used to identify the operations in the remainder of the paper). β x x x x 2 T A Fig. 2. 1 y 3 Dataflow graph for y ← βAT Ax. The BTO compiler uses a type system based on a container abstraction, which describes the iteration space of matrices and vectors. Containers may be oriented horizontally or vertically and can be nested. We assume that moving from one element to the next in a container is a constant-time operation and good for spatial locality, but we place no other restrictions on what memory layouts can be viewed as containers. The types are defined by the following grammar, in which R designates row, C designates column, and S designates scalar. orientations types O T ::= C | R ::= O<T > | S Figure 3 shows several types with a corresponding diagram depicting the container shapes: a row container with scalar elements (upper left), a nested container for a row-major matrix (right), and a partitioned row container (lower left). During the creation of the dataflow graph, each node is assigned a type. The input and outputs are assigned types derived from the input file specification, whereas the types associated with intermediate results are inferred by the BTO compiler. R<S> C<R<S>> R<R<S>> Fig. 3. Vector, partitioned vector, and matrix with their corresponding types. Note on the polyhedral model: The type system used by BTO and the polyhedral model [22] share a common goal: both describe a schedule to traverse an iteration space. Much of BTO’s functionality can be accomplished by using polyhedralbased tools. There are two motivations for using a domainspecific type system as BTO does: (1) ability to seamlessly perform additional optimizations (array contraction), and (2) extensibility with regard to sparse matrix storage formats. III. S EARCH S PACE This section describes the search space and challenges with regard to efficiently representing the space. We present a domain specific representation that enables BTO to eliminate many illegal points without spending any search time on them. 3 This section also sets up the discussion for specific search strategies in Section IV. A. Description of Search Space The optimization search space we consider here has three dimensions: (1) loop fusion, (2) dimension or direction of data partitioning, and (3) number of threads. Even considering only these three dimensions, there is a combinatorial explosion of optimization combinations that BTO considers. This search space is sparse, first consisting of a high ratio of illegal compared to legal programs. Within the legal programs, only a handful achieve good performance. The search space is also discrete because performance tends to cluster with no continuity between clusters. Efficiently searching this space is the goal, and doing so requires a well-designed representation. Early versions of BTO’s representation were too specific and therefore limited the performance. For example, they applied heuristics such as fusing loops at every opportunity. Experimental data show that in some cases it is best to back off from full fusion, and the representation needs to become more generic to accommodate that. At the other extreme, we discovered that an overly generic representation leads to the evaluation of an intractable number of illegal versions. For example, we tried a string-of-digits representation that we describe in the next subsection. With this approach, search time was dominated by the identification and discarding of illegal programs. Figure 4 shows a graphical representation of an overly general search space and what area of that search space BTO currently searches. The gray areas represent illegal programs. This area is large and, spending time in it makes search times intractable. This sections describes a representation that allows BTO to spend time only on the section labeled BTO Considered Search Space, which contains many fewer illegal points. Finally to further improve search times, within the legal space, BTO prunes points it deems unlikely to be unprofitable. The rest of this section walks through the findings that led to our current approach, as well as the representation that enables a scalable search. Illegal Legal Complete Search Space BTO Considered Search Space BTO Legal Points BTO Pruned Fig. 4. Representation of a typical search space showing how BTO avoids spending time searching a large portion of illegal points. adjacency matrix that created ((n − 1) ∗ n)/2 digits, where n is the number of operations; partitions were represented with 2n digits, where each operation had a direction of partition and a thread count. As an example, a three-operation program would be represented as follows. f, f, f, w, t, w, t, w, t 0 1 0 ≤ f ≤ w ≤ t ≤ ≤ ≤ max loop nest depth 3 max thread count In the presence of one level of data partitioning and for a matrix-vector type operation with a maximum thread count of 8, there are over 1.2 million combinations of loop fusion and thread parallelism. The primary advantage to this approach was that a search tool could easily manipulate these strings of digits with no domain knowledge. Unfortunately, search time was dominated by discarding illegal points. Many of the illegal points were caused by a disrespect of interaction between digits. We now summarize two important features that this representation does not encode. Fusion is an equivalence relation. If an operation a is fused with operation b and b is fused with c, then c must be fused with a. Consider a three-operation program and the representation of fusion with an adjacency matrix M , where M [a, b] shows the depth of fusion between the loop nests of a and b. Below, we show a valid fusion choice on the left and an invalid fusion choice on the right. Each value in the matrix specifies fusing up to two levels of nested loops. The matrix on the left describes fusing the outer loop of all three operations, but only b and c have the inner loop fused. The matrix on the right indicates fusing the inner loop of a with b and b with c, but not a and c, which of course is impossible. We can describe these constraints as forcing the relation specified in the adjacency matrix to be an equivalence relation at every depth. a a b c b 1 c 1 2 a a b c b 2 c 1 2 Fused operations must use the same number of threads. Consider a fuse graph that specifies a fusion of operations a and b but then a partition that specifies a use 4 threads and b use 6 threads. Partitioning the two operations with different thread counts guarantees that fusion of these two operations is not possible. Given the previous example program of three matrix-vector operation with a maximum thread count of 8, respecting these features will bring the possible points to consider down to a little over 1,000, or less than one-tenth of a percent of points to consider without respecting these features. B. Features of Search Space In an effort to interface with existing search tools, we initially represented every fusion and parting decision in an easy to manipulate set of digits. For fusion we used an C. Domain Specific Representation Designing a representation that respects the previously discussed features requires domain knowledge. At the expense 4 of having to custom-build search tools, we designed a representation to disallow, with no search time required, a large number of illegal points. Loop fusion is represented by fuse sets. Each operation is given a unique identifier, and loops are represented with {}. A single loop operation (e.g., dot product) is represented as {ID}, where ID is a number identifying an operation node in the dataflow graph. A two-loop operation, such as a matrixvector product, is represented as {{ID}}. When discussing a specific {}, we annotate it using {i }, where i describes an axis of the iteration space. We use i to describe the iteration over rows of a matrix and j for columns of a matrix. A complete iteration space for a matrix can be described as {i {j }} or {j {i }}. Fusion is described by putting two operations within the {}. For example, outer-loop fusion of two matrix-vector products is described by {j {i 1}{i 2}}, and fusion including the inner loops is described by {j {i 1 2}}. This notation encodes the equivalence relation of loop fusion, disallowing a huge number of illegal fusion combinations. In BTO, fuse sets are actually more general than described in the previous paragraph. In addition to representing loops, fuse sets can represent iterations over tiles, spawning threads for data parallelism, or loop unrolling. We refer to increasing the dimensionality of the iteration space in this way as “partitioning” since it conceptually cuts a matrix or vector into smaller parts. A matrix-vector operation of {i {j 1}} can be partitioned as {p(i) {i {j 1}}} or {p(j) {i {j 1}}}, where the {}s annotated with p(i) and p(j) describe the new iteration dimension and the existing i or j loop variables that the partition affects. The search tool must specify which existing loop is being modified and how many threads should be used. The important point here is that we can represent any level of nesting and describe both C loops and data parallelism. By extending the fuse set representation to partitioning, thread counts can be assigned to each set, eliminating the consideration of points with mismatched thread counts within a fused operation. BTO uses this representation to enumerate or manipulate the fuse sets and to generate the search space. This approach allows BTO to never touch the majority of the illegal points it encountered with more general-purpose search tools. D. Discarding Remaining Illegal Points Recall Figure 4 where the representation applied by BTO reduces the search space to the area labeled BTO Considered Search Space. In this search space, a significant number of illegal points remain. Identifying them as early as possible is key to a fast search. This section describes how BTO discards the remaining illegal points. Figure 2 shows the dataflow graph for the BATAX operation y ← βAT Ax first described in Section II. Figure 5 shows each operation in BATAX numbered according to its corresponding number in the dataflow graph. Let us assume for simplicity that subgraphs are fixed. Thus, although the scaling by β could be located differently in the graph, in this example it cannot. BTO performs type inference on the initial dataflow graph to check whether the input program makes sense, assigning types t0 = A ∗ x t1 = A’ ∗ t0 y = t1 ∗ beta Fig. 5. 1 2 3 Operation listing for y ← βAT Ax. to all operations in the process. As BTO considers different optimization choices, it incrementally updates the types to determine quickly whether an optimization choice results in incompatible types. In particular, illegal data dependency chains can be created with the fuse set representation and therefore must be checked against the data flow graph for correctness. The following is a partial list of the possible fuse sets for the running example. a: b: c: d: e: f: {{1}}{{2}}{{3}} {{1}{2}}{{3}} {{12}}{{3}} {{1}{3}}{{2}} {{1}{2}{3}} {{123}} Fuse set d says to fuse operations 1 and 3. However, referring to the dataflow graph in Figure 2, one can see that there is a data dependency (operation 2) between 1 and 3. A more subtle data dependency is caused by reduction operations. Figure 6 shows the pseudocode for the example. Examination of the outer loops (lines 1 and 4) show that the iterations are compatible and are legal to fuse. Looking at the inner loops (lines 2 and 5) we see compatible loops and assume fusion is possible. However, on line 3, t0 [ i ] is the destination of an accumulation and is not available for use until the inner loop is complete. The next operation consumes this result and so the inner loops cannot be fused. for i in 1 to M for j in 1 to N t0 [ i ] += A[i , j ] ∗ x[ j ] for i in 1 to M for j in 1 to N t1 [ j ] += A[i , j ] ∗ t0 [ i ] for j in 1 to N y[ j ] = t1 [ j ] ∗ beta Fig. 6. 1 2 3 4 5 6 7 8 Pseudocode for unfused operations as shown in Figure 5. The introduction of loops, the type inference, and the legality of partition introduction are all based on the underlying type system employed by BTO. This system is described in detail in previous papers [5]. Briefly, a set of rules describes legal linear algebra operations based on the types involved in the operation. Certain rules cause a reduction, so an examination of the types involved in an operation provides the loop nests and flags any loops as performing a reduction. In order to catch the reduction data dependency, data flow analysis is combined with the result of examining the type to determine that results are the destination of a reduction and that fusion cannot occur. The legality of every partitioning must also be checked for each operation. In the absence of fusion, doing so is simply of a matter of checking the type of each operand and the result 5 of a given operation. The challenge is in identifying the set of partitions for each operation such that fusion remains possible. The first operation of the BATAX example, t0 = A × x, can be partitioned in the following ways. (1) t0(p) = A(p, :) × x (2) t0 + = A(:, p) × x(p) {p(i) {i {j 1}}} {p(j) {i {j 1}}} Here we show the slicing of the matrix using the colon notation for a complete iteration and p for a subblock on which to operate in parallel (borrowing notation from MATLAB). On the right is the representation as a fuse set. Partitioning (1) cuts the rows of A and vector t0 while the second cuts the columns of A and the vector x. Partitioning (2) leads to a reduction at the parallel level, so t0 is not available for use until after a join. The second operation of the example, t1 = A × t0 can be partitioned in the following ways. (3) (4) t1(p) = A(p, :) × t0 t1 + = A(:, p) × t0(p) {p(j) {i {j 2}}} {p(i) {i {j 2}}} The question is how to partition operations 1 and 2 so that they can achieve fusion. Data dependence analysis says that the partition of operation 1, which introduces a reduction, will cause fusion to fail, so operation 1 must be partitioned by using method (1) thus limiting the options for operation 2. The matrix A is shared so, to achieve fusion after partitioning, A needs to be accessed the same way in both partition loops. From partitioning (1) we see that A is accessed as A(p, :). Because operation 2 accesses the transpose of A, we must select partitioning (4), accessing A as A(:, p). By examining the {} notation we similarly observe that the partitions introduced in (1) and (4) both generate {p(i) }. In large fuse sets, the likelihood of finding a correct set of operation partitions randomly is small. BTO uses a similar approach to that used in the BATAX example. At the start of a search, BTO enumerates the possible ways of partitioning for each individual operation. Then, when given a set of operations to fuse in the presence of partitioning, a list of operation partitionings that will allow fusion is found efficiently by comparing the shared data structures in the operation (e.g., the matrix A in BATAX). This list may consist of zero to many combinations that work for a fuse set, but all will be legal. This approach quickly rules out the illegal combinations, leaving only the legal points to consider. E. Discarding Unprofitable Points We again refer back to Figure 4, this time considering the BTO Legal Points, a small section labeled BTO Pruned represents legal points that typically exhibit poor performance. BTO uses a handful of heuristics to prune these poorly performing points. The first heuristic is to perform fusion only on operations that share an operand. For example, if one loop writes to a temporary matrix and another loop reads from the temporary, then fusing the two loops reduces memory traffic. Similarly, if two loops read from the same matrix, then fusion is likely to be profitable. On the other hand, fusing loops that do not share an operand is unlikely to reduce memory traffic. The next heuristic is that array contraction is always applied to temporary data structures in the presence of fusion. Again, reducing memory traffic almost always improves performance. The second two heuristics eliminate points without having to spend any time on those that are unprofitable. The array contraction is always performed while the contiguous traversal is encoded in the type system exploited by BTO. IV. G ENETIC /G REEDY S EARCH S TRATEGY This section describes the BTO search strategy based on a genetic algorithm whose initial population is determined by a greedy search that tries to maximally fuse loops. We refer to this search strategy as MFGA, for Maximal Fusion followed by Genetic Algorithm. Section V explores why this search is used, and the value of heuristics and alternatives. We explain MFGA using the y ← βAT Ax BATAX example from the previous section. Genetic algorithms are a broad category of global optimization techniques inspired by biological evolution [25]. In genetic algorithms, each code version is called an organism. A genetic algorithm uses a population of organisms. At each generation, the worst organisms are removed from the population and are replaced with newly generated organisms. A. Max Fuse The search begins with a greedy Max-Fuse (MF) heuristic: we attempt to fuse as many of the loops as possible to the greatest depth possible, subject to the constraints described in Section III. The MF search starts from unfused but partitioned versions of the kernel in which the axis of partitioning has not yet been decided. Continuing with the BATAX example from the previous section, the following represents the unfused partitioned kernel. The X, Y , and Z are unknowns determined during the MF search. {X {i {j 1}}}{Y {i {j 2}}}{Z {j 3}} To fuse the X and Y iterations, we need X = Y , so we proceed with the fusion and constrain ourselves to X = Y . {X {i {j 1}}}{X {i {j 2}}}{Z {j 3}} ⇒ {X {i {j 1}}{i {j 2}}}{Z {j 3}} At this point, X has to be p(i) because the alternative, p(j), would mean that the necessary results from operation 1 would not be available for operation 2. Next, we can also fuse the i iteration of operations 1 and 2. {p(i) {i {j 1}}{i {j 2}}}{Z {j 3}} ⇒ {p(i) {i {j 1}{j 2}}}{Z {j 3}} Because of the reduction in the matrix-vector product (operation 1), the j iteration of operations 1 and 2 cannot be fused. Next, we consider whether the p(i) iteration can be fused with Z. The p(i) iteration requires a reduction before the final vector scaling of operation 3, so 3 must reside in its own thread. Finally, there is only one axis of iteration in operation 3, so Z must be p(j). Therefore, the MF search produces the following organism: {p(i) {i {j 1}{j 2}}}{p(j) {j 3}}. 6 B. Generation of Initial Population by Mutation The initial population for the genetic algorithm is created by applying random mutation to the Max-Fuse point. Each mutation performs one of the following four changes: (1) add or remove fusion level, (2) add or remove partition level, (3) change the partition axis, or (4) change the number of threads. Mutations are constrained to the set of legal organisms; for example, attempting to add a mutation to the already maximally fused point from our previous example will fail, resulting in no change. However, mutations might randomly remove the partition from operation 3: {p(i) {i {j 1}{j 2}}}{p(j) {j 3}} ⇒ {p(i) {i {j 1}{j 2}}}{j 3} The Random search described in Section V-D2 consists of repeatedly applying random mutations to the organism without any further search. C. Selection and Crossover After the initial generation of organisms (and for every following generation), we compile and test every organism and record its runtime, which is the value the search tries to minimize. We then select 2N of the fittest organisms to be parents for the next generation, where the population size N can be user specified, but defaults to 20. a) Parent Selection Method: The population evolves via tournament selection [25]: k random organisms are chosen to be potential parents, and the potential parent with the best fitness becomes an actual parent. This process balances hill climbing with exploration, allowing less fit organisms to sometimes become parents, and thus helping the algorithm escape locally optimal solutions that are not globally optimal. Larger values of k cause the algorithm to converge more quickly on a solution, while smaller values of k converge more slowly but increases exploration. BTO uses k = 2 to favor exploration. b) Crossover: Crossover is a function that takes two parent organisms and randomly chooses features of the two parents to create a child organism. The key strength of genetic algorithms is that crossover can sometimes combine the strengths of two versions. Our crossover function generates the child recursively from the two parents, making fusion decisions at each level and making sure those decisions remain valid for inner levels. Our crossover function uses the type-based representation of each expression as described in Section II and performs crossover by comparing the two types. Continuing with the y ← βAT Ax example, consider the following two organisms A and B. example, crossover might choose parent A for the outermost level of operation 1, meaning 1 and 2 exist in the same thread (also using Parent A’s partitioning axis p(i) and thread number data). It then might choose Parent B for the next level, iteration i. This mechanism forces operation 1 and 2 not to be fused, resulting in {i {j 1}}{i {j 2}}. Then the crossover moves to operation 3 and the process continues. If B is chosen, the final child becomes {p(i) {i {j 1}}{i {j 2}}}{p(j) {j 3}}. The tournament selection process is repeated N times, creating a new generation of organisms. Fitness values are cached. If crossover ever produces an organism that was already tested in a previous generation, the old value is used to save search time. D. Search for Number of Threads BTO uses a fixed number of threads to execute all of the data-parallel partitions in a kernel. We refer to this as the global thread number heuristic. An alternative is to allow different numbers of threads for each partition, which we refer to as the exhaustive thread search. In Section V-D3, we present data that show that the exhaustive approach takes much more time but does not lead to significantly better results. BTO includes the search for the best number of threads in the MFGA algorithm. The initial number is set to the number of cores in the target computer architecture. The mutation function either increments or decrements the thread number of 2. The crossover function simply picks the thread number from one of the parents. After the genetic algorithm completes, MFGA performs an additional search for the best number of threads by testing the performance when using thread counts between 2 and the number of cores, incrementing by 2. V. R ESULTS We begin this section with a comparison of the performance of BTO-generated routines and several state-of-the-art tools and libraries that perform similar sets of optimizations, as well as hand-optimized code. The BTO compiler generates code that is between 16% slower and 39% faster than handoptimized code. The other automated tools and libraries achieve comparable performance to BTO and hand-optimized code for only a few of the kernels. For the smaller kernels in which we can exhaustively enumerate all possible combinations of optimizations, we show that the MFGA search method finds a routine that performs within 2% of the best found in the exhaustive search. We present empirical data that motivates our choice of the MFGA search strategy, comparing MFGA to several alternative strategies and analyzing the orthogonality of fusion choices versus number of threads. A : {p(i) {i {j 1}{j 2}}}{j 3} B : {p(i) {i {j 1}}}{p(i) {i {j 2}}}{p(j) {j 3}} Parent A partitions and partly fuses operations 1 and 2 but does not partition operation 3. Parent B has all partitions turned on but has not fused operations 1 and 2. Crossover chooses which parent to emulate for each operation, working from the outermost fuse level inwards. Each step constrains the possibilities for the other operations. In our A. Test Environment and Kernels The results in this section rely on the kernels shown in Table I. Some of these kernels respond well to loop fusion and data parallelism while others do not. Some of these kernels are in the updated BLAS [8] but have not been adopted by vendortuned BLAS libraries. These kernels also represent various uses of the BLAS. For example, the DGEMV kernel maps 7 // q = A ∗ p dgemv(’N’,A nrows,A ncols,1.0,A,lda,p,1,0.0,q,1); // s = A’ ∗ r dgemv(’T’,A nrows,A ncols,1.0,A,lda,r,1,0.0,s,1); Fig. 7. Example sequence of BLAS calls that implement BICGK. directly to a BLAS call while others are equivalent to multiple BLAS calls. As an example, Listing 7 shows the sequence of BLAS calls that implement the BICGK kernel. TABLE I K ERNEL SPECIFICATIONS . Kernel Operation z ← w − αv β ← zT u x←w+y+z w ← αx + βy AXPYDOT VADD WAXPBY ATAX BICGK DGEMV DGEMVT GEMVER GESUMMV y ← AT Ax q ← Ap s ← AT r z ← αAx + βy x ← βAT y + z w ← αAx B ← A + u1 v1T + u2 v2T x ← βB T y + z w ← αBx y ← αAx + βBx The computers used for testing include recent AMD and Intel multicore architectures which we describe in Table II. TABLE II S PECIFICATIONS OF THE TEST MACHINES . Processor Intel Westmere AMD Phenom II X6 AMD Interlagos Cores 24 6 64 Speed (GHz) 2.66 3.3 2.2 L1 (KB) 12 x 32 6 x 64 64 x 16 L2 (KB) 12 x 256 6 x 512 16 x 2048 L3 (MB) 2 x 12 1x6 8x8 B. Comparison to Similar Tools We begin by placing BTO performance results in context by comparing them with several state-of-the-art tools and libraries. BTO performs loop fusion and array contraction and makes use of data parallelism. BTO relies on the native compiler for loop unrolling and vectorization. The two compilers used to gather this data are the Intel C Compiler (ICC) [19] and the PGI C Compiler (PGCC) [27]. With the exception of the explicitly labeled PGCC results, all kernels are compiled using ICC. Both ICC and PGCC unroll loops and vectorize. They also identify and exploit data parallelism and perform loop fusion. We begin with a detailed comparison of BTO and five other approaches for generating high performance code on the Intel Westmere. We then give a brief summary of similar results on the AMD Phenom and Interlagos. The first approaches are using ICC and PGCC, which represent the best commercial compilers. The third approach is using Pluto [9], a source-to-source translator capable of performing loop fusion and identifying data parallelism. The fourth approach is using Intel’s Math Kernel Library (MKL) [19] which is a vendor-tuned BLAS implementation targeting Intel CPUs. The fifth is a hand-tuned implementation (applying loop fusion, array contraction, and data parallelism) created by an expert in performance tuning who works in the performance library group at Apple, Inc. The input for ICC, PGCC and Pluto is a translation of the BLAS calls to C loops. The compiler flags used with ICC were “-O3 -mkl -fno-alias” and the flags for PGCC were “-O4 -fast -Mipa=fast -Mconcur Mvect=fuse -Msafeptr” (“-Msafeptr” not used on Interlagos). Data parallelism is exploited by ICC, PGCC, Pluto, and MKL by using OpenMP [12]. BTO and the hand-tuned versions use Pthreads [26]. Figure 8 shows the speedup relative to ICC on the y-axis for several linear algebra kernels. (ICC performance is 1.) On the left are the three vector-vector kernels, and on the right are the six matrix-vector kernels, all from Table I. PGCC tends to do slightly better than ICC, with speedups ranging from 1.1 to 1.5 times faster. Examining the output of PGCC shows that all but GESUMMV and GEMVER were parallelized. However, PGCC’s ability to perform loop fusion was mixed; it fused the appropriate loops in AXPYDOT, VADD, and WAXPBY but complained of a “complex flow graph” on the remaining kernels and only achieved limited fusion. The MKL BLAS outperforms ICC by factors ranging from 1.4 to 4.2. The calls to BLAS routines prevent loop fusion, so significant speedups, such as those observed in AXPYDOT and GESUMMV, can instead be attributed to parallelism and well tuned vector implementations of the individual operations. We were unable to determine why the BLAS perform so well for AXPYDOT. Surprisingly, the BLAS DGEMV does not perform as well as Pluto and BTO. Given the lack of fusion potential in this kernel, we speculate that differences in the parallel implementations are the cause. The Pluto results show speedups ranging from 0.7 to 5.7 times faster than ICC. The worst-performing kernels are AXPYDOT, ATAX, and DGEMVT. These three kernels represent the only cases where Pluto did not introduce data parallelism. For the remaining two vector-vector kernels, VADD and WAXPBY, Pluto created the best-performing result, slightly better than the BTO and hand-tuned versions. Inspection shows that the only difference between Pluto, hand-tuned, and BTO in these cases was the use of OpenMP for Pluto and Pthreads for hand-tuned and BTO. The fusion was otherwise identical and the difference in thread count had little effect. For the matrix-vector operations, if we enabled fusion but not parallelization with Pluto’s flags, then Pluto matched BTO with respect to fusion. However, with both fusion and parallelization enabled, Pluto sometimes misses fusion and/or parallelization opportunities. For example BICGK was parallelized but not fused. The GEMVER results depend on the loop ordering in the input file. For GEMVER, Pluto performed either complete fusion with no parallelism or incomplete fusion with parallelism; the latter provided the best performance and is shown in Figure 8. The hand-tuned implementation is intended as a sanity check. For the vector-vector operations, the hand-tuned version 8 TABLE III P ERFORMANCE DATA FOR AMD P HENOM . BLAS NUMBERS FROM AMD’ S ACML. S PEEDUPS RELATIVE TO UNFUSED LOOPS COMPILED WITH PGCC (PGCC PERFORMANCE IS 1 AND NOT SHOWN ). B EST PERFORMING VERSION IN BOLD . Kernel AXPYDOT VADD WAXPBY ATAX BICGK DGEMV DGEMVT GEMVER GESUMMV BLAS 0.97 0.84 0.79 1.27 1.27 1.67 1.67 1.04 1.63 Pluto 1.81 1.33 1.40 0.69 0.80 0.71 0.71 1.61 0.63 HAND 1.58 1.50 1.68 2.92 2.80 1.85 1.85 2.61 1.74 BTO 1.86 1.83 1.91 2.92 2.84 1.89 1.89 2.34 1.75 is within a few percent of the best implementation. Typically the fusion in both the hand tuned and the best tool based version are identical with the primary difference being either thread count or what appears to be a difference between Pthreads and OpenMP performance. In the case of the matrixvector operations, the hand-tuned version is the best for all but DGEMV and GESUMMV, where it is equal to the best. The BTO performance results show speedups ranging from 3.2 to 6.9 times faster than ICC. For the vector-vector operations, the performance is similar to the hand-tuned version in all cases. Inspection shows that for AXPYDOT, BTO was slightly faster than the hand-tuned version because BTO did not fuse the inner loop while the hand-tuned version did. BTO performed slightly worse than hand-tuned on WAXPBY because of a difference in thread count. Similarly, the performance of the matrix-vector operations is close but slightly lower than that of the hand-tuned version. BTO fused the same as hand-tuned for BICGK, GEMVER and DGEMVT with the only difference being in thread count. For ATAX, both BTO and hand-tuned fused the same and selected the same number of threads, but BTO was slightly slower because of where it zeroed out a data structure. In the hand-tuned version the zeroing occurred in the threads, while in BTO’s case it occurred in the main thread. Similar results on AMD Phenom and AMD Interlagos are shown in Table III and Table IV, respectively. The Plutogenerated code for the matrix-vector operations tended to perform worse than that produced for the other methods evaluated. On this computer, achieving full fusion while maintaining parallelism is of great importance. As previously discussed, Pluto tended to achieve fusion or parallelism but struggled with the combination. These results demonstrate the difficulty of portable high-performance code generation even under autotuning scenarios. Summary: Compared with the best alternative approach for a given kernel, BTO performance ranges from 16% slower to 39% faster. Excluding hand-written comparison points, BTO performs between 14% worse and 229% better. Pluto, ICC, PGCC, and BLAS all achieve near-best performance for only a few points; however, BTO’s performance is most consistent across kernels and computers. Excluding the hand-optimized results, BTO finds the best version for 7 of 9 kernels on the Intel Westmere, all 9 kernels on the AMD Phenom, and 7 of TABLE IV P ERFORMANCE DATA FOR AMD I NTERLAGOS . BLAS NUMBERS FROM AMD’ S ACML. S PEEDUPS RELATIVE TO UNFUSED LOOPS COMPILED WITH PGCC (PGCC PERFORMANCE IS 1 AND NOT SHOWN ). B EST PERFORMING VERSION IN BOLD . Kernel AXPYDOT VADD WAXPBY ATAX BICGK DGEMV DGEMVT GEMVER GESUMMV BLAS 0.82 0.43 0.34 2.49 2.35 2.45 2.43 1.70 2.36 Pluto 1.60 1.05 1.06 0.43 1.60 0.89 0.43 2.00 0.37 HAND 1.73 1.14 1.16 4.09 3.03 1.66 4.08 4.15 1.65 BTO 1.61 1.15 1.11 4.28 4.22 2.07 4.03 4.05 2.03 9 kernels on the AMD Interlagos. Surprisingly, on the AMD Phenom, BTO surpassed the hand-optimized code for 7 of the 9 kernels and tied for one kernel. C. MFGA Compared to Exhaustive Searches In Section V-B, we presented results showing that BTO’s MFGA search strategy finds high-performing versions for a range of kernels. In this section, we show how the performance of the MFGA search strategy compares with the best version that can be produced using exhaustive or nearly exhaustive search strategies on Intel Westmere. These strategies require long-running searches that can take days to complete. For the smaller kernels, a completely exhaustive search is possible. For larger kernels, exhaustive search was not feasible, so we instead use a strategy that is exhaustive with respect to each optimization, but orthogonal between optimizations. For the largest kernels, GEMVER and DGEMV, even the orthogonal approach took too much time, not completing even after weeks of running. We compared the performance of kernels produced by MFGA as percentage of the exhaustive search for smaller kernels or as a percentage of the orthogonal search for larger kernels such as DGEMVT and GESUMMV. The results show that scalable search produces kernel performance within 1-2% of the best performance. D. Evaluation of Search Methods In the previous sections, we demonstrated that BTO is capable of generating high-performance routines. In this section, we examine the data that led to creating the MFGA search strategy. All of the experiments in this section were performed on the Intel Westmere. 1) Orthogonality of Fusion and Thread Search: The MFGA strategy, for the most part, treats decisions regarding fusion and thread count orthogonally, which significantly reduces the size of the search space. However, before we could employ this search method, we first had to show that it would lead to no degradation in performance. We define orthogonal search as first searching only the fusion dimension, then using only the best candidate, searching every viable thread count. We evaluated the effectiveness and 9 8 Speed Up Relative to ICC 7 6 8 PGI HAND BLAS (MKL) BTO PLUTO 7 6 5 5 4 4 3 3 2 2 1 1 0 AXPYDOT VADD WAXPBY 0 ATAX BICGK DGEMV DGEMVT GESUMMV GEMVER Fig. 8. Performance data for Intel Westmere. Speedups relative to unfused loops compiled with ICC (ICC performance is 1 and not shown). The left three kernels are vector-vector while the right six are matrix-vector operations. In all cases, BTO generates code that is between 16% slower and 39% faster than hand-optimized code and significantly faster than library and compiler-optimized versions. 9 8 7 Performance (GFLOPS) search time of the orthogonal search as compared to an exhaustive search using the smaller kernels: ATAX, AXPYDOT, BICGK, VADD, and WAXPBY. For all kernels, orthogonal search found the best-performing version while taking 1-8% of the time of exhaustive search, demonstrating that searching the space orthogonally dramatically reduces search time without sacrificing performance. This reduction in search time results in part from the chosen orthogonal ordering. By searching the fusion space first, we often dramatically reduce the number of data-parallel loops and hence the size of the subsequent thread-count search space. Thus, we see that fusion and thread search can be conducted orthogonally without a significant loss of kernel performance. 2) Fusion Search: Next we focus on fusion strategies. In this section we analyze our choice of using a combination of a genetic algorithm and the max-fuse heuristic. We compare four search strategies on our most challenging kernel, GEMVER. In particular, we test random search, our genetic algorithm without the max-fuse heuristic, the maxfuse heuristic by itself, and the combination of the max-fuse heuristic with the genetic algorithm (MFGA). As described in Section IV, the random search strategy and the genetic algorithm use the same mutation schemes, and thus their comparison shows the benefit of the crossover and selection methods. Figure 9 shows the performance over time of each of the search methods. (MF is a single point near 3 GFLOPS.) Because the search is stochastic, each of the lines in the chart is the average of two runs. MFGA finds the optimal point in less than 10 minutes on average. Without the MF heuristic, GA alone eventually reaches 90% of MFGA but requires over an hour of search time. The Random search plateaus without ever finding the optimal value. The MF heuristic by itself achieves 40% of MFGA. In conclusion, a combination of GA and MF is the best strategy for the fusion portion of the search. 3) Thread Search: Using the MFGA heuristic described in the previous section, we explore several possible thread search strategies, including the global thread number and the exhaustive strategies discussed in Section IV-D. The baseline test is the MFGA search with number of threads set equal MFGA GA Random Max Fuse 6 5 4 3 2 1 0 0 1000 2000 3000 total search time (s) 4000 5000 Fig. 9. GEMVER performance over time for different search strategies on Intel Westmere. MFGA finds the best version more quickly and consistently than either search individually. to the number of cores (24 for these experiments), which we refer to as the const strategy. Recall that the global strategy starts with MFGA and then searches over a single parameter for all loop nests for the number of threads. Recall that the exhaustive search replaces the single thread parameter with the full space of possible thread counts, i.e., considering the number of threads for each loop nest individually. The results for seven kernels are in Figure 10. The top chart shows the final performance of the best version found in each case. Searching over the thread space improves the final performance compared with using a constant number of threads (e.g., equal to the number of cores), with negligible difference in kernel performance between the global thread count (fixed count for all threads) and fully exhaustive approaches (varying thread counts for different operations). The bottom chart in Figure 10 shows the total search cost of the different thread search approaches, demonstrating that global thread search improves scalability without sacrificing performance. 0.07 0.06 0.05 0.04 0.03 0.02 0.01 0.00 search time (s) runtime (s) 10 700 600 500 400 300 200 100 0 exhaustive global const ATAX AXPYDOT BICGK DGEMV DGEMVTGESUMMV VADD WAXPBY exhaustive global ATAX AXPYDOT BICGK DGEMV DGEMVTGESUMMV VADD WAXPBY Fig. 10. Best runtime (top) and search time (bottom) for exhaustive and global searches. A constant thread number (e.g., equal to the number of cores) cannot achieve the runtime performance of either global or exhaustive thread search. Searching over a global thread count results in a much shorter search time without significantly worsening kernel performance. VI. R ELATED W ORK We describe the relationship between our contributions in this paper and related work in four areas of the literature: loop restructuring compilers, search strategies for autotuning, partitioning matrix computations, and empirical search. Loop Fusion and Parallelization: Megiddo and Sarkar [24] study the problem of deciding which loops to fuse in a context where parallelization choices have already been made (such as an OpenMP program). They model this problem as a weighted graph whose nodes are loops and whose edges are labeled with the runtime cost savings resulting from loop fusion. Because the parallelization choices are fixed prior to the fusion choices, their approach sometimes misses the optimal combination of parallelization and fusion decisions. Darte and Huard [13], on the other hand, study the space of all fusion decisions followed by parallelization decisions. Pouchet et al. [28] take a similar approach, they use a orthogonal approach that exhaustively searches over fusion decisions, then uses the polyhedral model with analytic models to make tiling and parallelization decisions. These approaches roughly correspond to the orthogonal search technique described in Section V-D1. Bondhugula et al. [9] employs the heuristic of maximally fusing loops. Loop fusion is generally beneficial, but too much can be detrimental as it can put too much pressure on registers and cache [21]. Bondhugula et al. [10] develop an analytic model for predicting the profitability of fusion and parallelization and show speedups relative to other heuristics such as always fuse and never fuse. However, they do not validate their model against the entire search space as we do where possible here. Search for Autotuning: Vuduc et al. [34] study the optimization space of applying register tiling, loop unrolling, software pipelining, and software prefetching to matrix multiplication. They show that this search space is difficult (a very small number of combinations achieve good performance), and present a statistical method for determining when a search has found a point that is close enough to the best. Balaprakash et al. [4] study the effectiveness of several search algorithms (random search, genetic algorithms, NelderMead simplex) to find the best combination of optimization decisions from among loop unrolling, scalar replacement, loop parallelization, vectorization, and register tilling as implemented in the Orio autotuning framework [17]. They conclude that the modified Nelder-Mead method is effective for their search problem. Chen et al. [11] develop a framework for empirical search over many loop optimizations such as permutation, tiling, unroll-and-jam, data copying, and fusion. They employ an orthogonal search strategy, first searching over unrolling factors, then tiling sizes, and so on. Tiwari et al. [33] describe an autotuning framework that combines ActiveHarmony’s parallel search backend with the CHiLL transformation framework. Looptool [29] and AutoLoopTune [30] support loop fusion, unroll-and-jam and array contraction. AutoLoopTune also supports tiling. POET [37] also supports a number of loop transformations. Partitioning Matrix Computations: The approach to partitioning matrix computations described in this paper is inspired by the notion of a blocked matrix view in the Matrix Template Library [31]. Several researchers have subsequently proposed similar abstractions, such as the hierarchically tiled arrays of Almasi et al. [1] and the support for matrix partitioning in FLAME [16]. Search with Empirical Evaluation: Bilmes et al. [7] and Whaley and Dongarra [35] autotune matrix multiplication using empirical evaluation to determine the profitability of optimizations. Zhao et al. [38] use exhaustive search and empirical testing to select the best combination of loop fusion decisions. Yi and Qasem [36] apply empirical search to determine the profitability of optimizations for register reuse, SSE vectorization, strength reduction, loop unrolling, and prefetching. Their framework is parameterized with respect to the search algorithm and includes numerous search strategies. VII. C ONCLUSIONS AND F UTURE W ORK For many problems in high-performance computing, the best solutions require extensive testing and tuning. We present an empirical autotuning approach for dense matrix algebra that is reliable and scalable. Our tool considers loop fusion, array contraction, and shared memory parallelism. Our experiments have shown that the BTO autotuning system outperforms standard optimizing compilers and a vendoroptimized BLAS library in most cases, and our results are competitive with hand-tuned code. We also describe how we developed our search strategies and tested the usefulness of each part of the search. Two big expansions of functionality are planned: distributed memory support and extension of matrix formats to include triangular, banded, and sparse. These extensions will improve the usefulness of BTO, while also providing an important stress test for the scalability of the search algorithms and code generation. 11 R EFERENCES [1] Gheorghe Almasi, Luiz De Rose, Jose Moreira, and David Padua. Programming for locality and parallelism with hierarchically tiled arrays. In The 16th International Workshop on Languages and Compilers for Parallel Computing, pages 162–176, College Station, TX, 2003. [2] S. Amarasinghe, D. Campbell, W. Carlson, A. Chien, W. Dally, E. Elnohazy, M. Hall, R. Harrison, W. Harrod, K. Hill, et al. Exascale software study: Software challenges in extreme scale systems. DARPA IPTO, Air Force Research Labs, Tech. Rep, 2009. [3] W. K. Anderson, W. D. Gropp, D. K. Kaushik, D. E. Keyes, and B. F. Smith. Achieving high sustained performance in an unstructured mesh CFD application. In Proceedings of the 1999 ACM/IEEE Conference on Supercomputing (CDROM), Supercomputing ’99, Portland, Oregon, 1999. ACM. [4] P. Balaprakash, S. Wild, and P. Hovland. Can search algorithms save large-scale automatic performance tuning? Procedia CS, 4:2136–2145, 2011. [5] Geoffrey Belter, E. R. Jessup, Ian Karlin, and Jeremy G. Siek. Automating the generation of composed linear algebra kernels. In SC ’09: Proceedings of the Conference on High Performance Computing Networking, Storage and Analysis, pages 1–12, New York, 2009. ACM. ISBN 978-1-60558-744-8. doi: http://doi.acm. org/10.1145/1654059.1654119. [6] Geoffrey Belter, Jeremy G. Siek, Ian Karlin, and E. R. Jessup. Automatic generation of tiled and parallel linear algebra routines. In Fifth International Workshop on Automatic Performance Tuning (iWAPT 2010), pages 1– 15, Berkeley, CA, June 2010. [7] Jeff Bilmes, Krste Asanovic, Chee-Whye Chin, and Jim Demmel. Optimizing matrix multiply using PHiPAC: A portable, high-performance, ANSI C coding methodology. In ICS ’97: Proceedings of the 11th International Conference on Supercomputing, pages 340–347, New York, 1997. ACM Press. ISBN 0-89791-902-5. doi: http://doi.acm.org/10.1145/263580.263662. [8] L. Susan Blackford, James Demmel, Jack Dongarra, Iain Duff, Sven Hammarling, Greg Henry, Michael Heroux, Linda Kaufman, Andrew Lumsdaine, Antoine Petitet, Roldan Pozo, Karin Remington, and R. Clint Whaley. An updated set of Basic Linear Algebra Subprograms (BLAS). ACM Transactions on Mathematical Software, 28(2):135–151, June 2002. [9] U. Bondhugula, A. Hartono, J. Ramanujam, and P. Sadayappan. Pluto: A practical and fully automatic polyhedral program optimization system. In Proceedings of the ACM SIGPLAN 2008 Conference on Programming Language Design and Implementation (PLDI 08), pages 101–113, Tucson, AZ, June 2008. [10] Uday Bondhugula, Oktay Gunluk, Sanjeeb Dash, and Lakshminarayanan Renganarayanan. A model for fusion and code motion in an automatic parallelizing compiler. In Proceedings of the 19th International Conference on Parallel Architectures and Compilation Techniques, PACT ’10, pages 343–352, New York, 2010. ACM. [11] C. Chen, J. Chame, and M. Hall. CHiLL: A framework for composing high-level loop transformations. Technical Report 08-897, Department of Computer Science, University of Southern California, 2008. [12] Leonardo Dagum and Ramesh Menon. Openmp: An industry-standard API for shared-memory programming. IEEE Comput. Sci. Eng., 5(1):46–55, January 1998. ISSN 1070-9924. doi: 10.1109/99.660313. URL http://dx.doi. org/10.1109/99.660313. [13] Alain Darte and Guillaume Huard. Loop shifting for loop parallelization. Technical Report 2000-22, Ecole Normale Superieure de Lyon, May 2000. [14] Jack J. Dongarra, Jeremy De Croz, Sven Hammarling, and Richard J. Hanson. An extended set of FORTRAN Basic Linear Algebra Subprograms. ACM Transactions on Mathematical Software, 14(1):1–17, March 1988. [15] Jack J. Dongarra, Jeremy Du Croz, Sven Hammarling, and Iain Duff. A set of level 3 Basic Linear Algebra Subprograms. ACM Transactions on Mathematical Software, 16(1):1–17, March 1990. [16] John A. Gunnels, Fred G. Gustavson, Greg M. Henry, and Robert A. van de Geijn. FLAME: Formal linear algebra methods environment. ACM Trans. Math. Softw., 27(4):422–455, 2001. [17] Albert Hartono, Boyana Norris, and Ponnuswamy Sadayappan. Annotation-based empirical performance tuning using Orio. In IPDPS ’09: Proceedings of the 2009 IEEE International Symposium on Parallel & Distributed Processing, pages 1–11, Washington, DC, 2009. IEEE Computer Society. ISBN 978-1-4244-3751-1. doi: http: //dx.doi.org/10.1109/IPDPS.2009.5161004. URL http: //www.mcs.anl.gov/uploads/cels/papers/P1556.pdf. Also available as Preprint ANL/MCS-P1556-1008. [18] Gary W. Howell, James W. Demmel, Charles T. Fulton, Sven Hammarling, and Karen Marmol. Cache efficient bidiagonalization using BLAS 2.5 operators. ACM Trans. Math. Softw., 34:14:1–14:33, May 2008. [19] Intel. Intel Composer. http://software.intel.com/en-us/ articles/intel-compilers, April 2012. [20] Ian Karlin, Elizabeth Jessup, Geoffrey Belter, and Jeremy G. Siek. Parallel memory prediction for fused linear algebra kernels. SIGMETRICS Perform. Eval. Rev., 38:43–49, March 2011. ISSN 0163-5999. doi: http://doi.acm.org/10.1145/1964218.1964226. URL http: //doi.acm.org/10.1145/1964218.1964226. [21] Ian Karlin, Elizabeth Jessup, and Erik Silkensen. Modeling the memory and performance impacts of loop fusion. Journal of Computational Science, In press, 2011. ISSN 1877-7503. doi: DOI:10.1016/j.jocs.2011.03.002. [22] Richard M. Karp, Raymond E. Miller, and Shmuel Winograd. The organization of computations for uniform recurrence equations. J. ACM, 14(3):563–590, July 1967. ISSN 0004-5411. doi: 10.1145/321406.321418. URL http://doi.acm.org/10.1145/321406.321418. [23] C. L. Lawson, R. J. Hanson, D. R. Kincaid, and F. T. Krogh. Basic Linear Algebra Subprograms for Fortran usage. ACM Transactions on Mathematical Software, 5 12 (3):308–323, September 1979. [24] Nimrod Megiddo and Vivek Sarkar. Optimal weighted loop fusion for parallel programs. In Proceedings of the Ninth Annual ACM Symposium on Parallel Algorithms and Architectures, SPAA ’97, pages 282–291, New York, 1997. ACM. [25] M. Mitchell. An introduction to genetic algorithms. The MIT Press, 1998. ISBN 0262631857. [26] Frank Mueller. Pthreads library interface. Technical report, Florida State University, 1999. [27] Portland Group. Portland group compiler. http://www. pgroup.com, April 2012. [28] Louis-Noël Pouchet, Uday Bondhugula, Cédric Bastoul, Albert Cohen, J. Ramanujam, and P. Sadayappan. Combined iterative and model-driven optimization in an automatic parallelization framework. In Proceedings of the 2010 ACM/IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’10, pages 1–11, Washington, DC, November 2010. IEEE Computer Society. [29] Apan Qasem, Guohua Jin, and John Mellor-Crummey. Improving performance with integrated program transformations. Technical Report TR03-419, Department of Computer Science, Rice University, October 2003. [30] Apan Qasem, Ken Kennedy, and John Mellor-Crummey. Automatic tuning of whole applications using direct search and a performance-based transformation system. The Journal of Supercomputing: Special Issue on Computer Science Research Supporting High-Performance Applications, 36(9):183–196, May 2006. [31] Jeremy G. Siek. A modern framework for portable high performance numerical linear algebra. Master’s thesis, University of Notre Dame, 1999. [32] Jeremy G. Siek, Ian Karlin, and E. R. Jessup. Build to order linear algebra kernels. In Workshop on Performance Optimization for High-Level Languages and Libraries (POHLL 2008), pages 1–8, Miami, FL, April 2008. [33] Ananta Tiwari, Chun Chen, Jacqueline Chame, Mary Hall, and Jeffrey K. Hollingsworth. A scalable autotuning framework for compiler optimization. In Proceedings of the 23rd IEEE International Parallel & Distributed Processing Symposium, Rome, Italy, May 2009. [34] Richard Vuduc, James W. Demmel, and Jeff A. Bilmes. Statistical models for empirical search-based performance tuning. International Journal of High Performance Computing Applications, 18(1):65–94, 2004. doi: 10.1177/1094342004041293. URL http://hpc.sagepub. com/content/18/1/65.abstract. [35] R. Clint Whaley and Jack J. Dongarra. Automatically tuned linear algebra software. In Supercomputing ’98: Proceedings of the 1998 ACM/IEEE conference on Supercomputing (CDROM), pages 1–27, Washington, DC, 1998. IEEE Computer Society. ISBN 0-89791-984-X. [36] Qing Yi and Apan Qasem. Exploring the optimization space of dense linear algebra kernels. In Languages and Compilers for Parallel Computing: 21th International Workshop, LCPC 2008, Edmonton, Canada, July 31 - August 2, 2008, Revised Selected Papers, pages 343–355, Berlin, 2008. Springer-Verlag. ISBN 978-3-540-89739-2. doi: http://dx.doi.org/10.1007/978-3-540-89740-8 24. [37] Qing Yi, Keith Seymour, Haihang You, Richard Vuduc, and Dan Quinlan. POET: Parameterized optimizations for empirical tuning. In Proceedings of the Parallel and Distributed Processing Symposium, 2007, pages 1– 8, Long Beach, CA, March 2007. IEEE. doi: 10.1109/ IPDPS.2007.370637. [38] Y. Zhao, Q. Yi, K. Kennedy, D. Quinlan, and R. Vuduc. Parameterizing loop fusion for automated empirical tuning. Technical Report UCRL-TR-217808, Center for Applied Scientific Computing, Lawrence Livermore National Laboratory, December 2005.
6cs.PL
1 Complex tensor factorisation with PARAFAC2 for the estimation of brain connectivity from the EEG arXiv:1705.02019v1 [cs.CE] 2 May 2017 Loukianos Spyrou, Mario Parra, and Javier Escudero Abstract—Objective: The coupling between neuronal populations and its magnitude have been shown to be informative for various clinical applications. One method to estimate brain connectivity is with electroencephalography (EEG) from which the cross-spectrum between different sensor locations is derived. We wish to test the efficacy of tensor factorisation in the estimation of brain connectivity. Methods: Complex tensor factorisation based on PARAFAC2 is used to decompose the EEG into scalp components described by the spatial, spectral, and complex trial profiles. An EEG model in the complex domain was derived that shows the suitability of PARAFAC2. A connectivity metric was also derived on the complex trial profiles of the extracted components. Results: Results on a benchmark EEG dataset confirmed that PARAFAC2 can estimate connectivity better than traditional tensor analysis such as PARAFAC within a range of signal-to-noise ratios. The analysis of EEG from patients with mild cognitive impairment or Alzheimer’s disease showed that PARAFAC2 identifies loss of brain connectivity better than traditional approaches and agreeing with prior pathological knowledge. Conclusion: The complex PARAFAC2 algorithm is suitable for EEG connectivity estimation since it allows to extract meaningful coupled sources and provides better estimates than complex PARAFAC. Significance: A new paradigm that employs complex tensor factorisation has demonstrated to be successful in identifying brain connectivity and the location of couples sources for both a benchmark and a real-world EEG dataset. This can enable future applications and has the potential to solve some the issues that deteriorate the performance of traditional connectivity metrics. Index Terms—complex tensor factorisation, PARAFAC2, connectivity, EEG I. I NTRODUCTION Tensor factorisation has found many applications in several areas such as antenna array processing, blind source separation, biomedical signal processing, feature extraction, and classification [1], [2], [3], [4]. A tensor is a multiway representation of data or a multidimensional array. Each dimension in the tensor is called a mode or a way. Using tensor factorisation, the true underlying structure of that data can be revealed. Tensor factorisation methods have been shown to be powerful for describing signals which in general change in time, frequency, and space. Tensor analysis can provide a good way to discover the main features of the data and extract the hidden underlying information especially in the case of having big data size. Several tensor based methods have been suggested for decomposition and multi-way representation of data. The PARAFAC decomposition [1], [2], [5] is one of the common This work was supported by EPSRC, UK, Grant No. EP/N014421/1. tensor factorisation methods which is a generalisation of singular value decomposition (SVD) to higher order tensors. Using the PARAFAC model, the data are decomposed into a sum of rank-1 tensors of lower dimensions than the original data. Therefore, as suggested in [6], it can be employed to compress the high dimensional data and extract their significant features. The application of tensor decomposition can be significant for biomedical signals, such as EEG [7], where many transient events and movement related sources and artifacts are involved and most sources are inherently nonstationary. Moreover, the related brain neural process exhibit specific space-timefrequency locations. EEG signals in particular, consist of multichannel recordings with good temporal resolution which subsequently offers good time-frequency resolution. The application of tensor analysis is then logical and the data can be factorised into its space, time and frequency modes [8], [9], [10], [11]. Tensor factorisation has been also applied to multisubject data where the data can be factorised in the group level, identifying the common components [10], [12]. The coupling between neural processes has been investigated for various mental tasks such as attention, spatial navigation, perceptual binding and memory [13], [14], [15], [16]. The activity in different areas can be phase-coupled, i.e., display systematic phase-delays over trials, a phenomenon called phase-synchronization, which has been hypothesized to be an important mechanism for creating a flexible communication structure between brain regions. However, it is wellknown that indexing phase-synchronization through scalpsensor (scalp-electrode) measurements can be complicated by five problems (see also [17]): (i) the choice of reference electrode [18], [19], (ii) volume-conduction of source activity [20], (iii) the presence of noise sources [21], (iv) samplesize bias [21], and (v) the coupling between sensors may not be due to the activity closest to those electrodes [22], [21]. These problems can spuriously inflate phase-synchronization indices and are partially overcome with the currently state-ofthe-art methods employing the imaginary part of coherence as a basic step in their algorithms. These algorithms optimise phase-synchronisation measurements by minimising the effect of volume conduction and the presence of noise sources. However, they suffer from the limitation of reduced performance in the presence of noise sources and sample-size bias. Tensor factorisation has been employed in brain connectivity studies primarily with the aim of dimensionality reduction or detection of dynamic changes [23], [24], [25], [26]. In this work, we extend the traditional tensor factorisation framework by considering complex valued tensors and we derive a connectivity metric based on the resulting factors. Complex 2 tensors have been also used in factorisation schemes in [27], [28], [29]. In [27] a multilinear decomposition is performed that explicitly models phase shifts between trials while in [28] phase shifts are also considered between electrodes, a phenomenon which arises in electrocorticography data. Unlike those studies we do not only consider phase shifts but a general EEG model which requires complex trial activations. Subsequently, the proposed methodology enables the estimation of connectivity between the components of the decomposition. This is accomplished by the decomposition of the EEG into channel, frequency and complex trial components. To this end, we derive an EEG model in the complex domain and show that PARAFAC2 is better suitable than PARAFAC in factorising that model and provide a metric that estimates the coupling between sources. In section II, we describe the EEG model in the complex domain and together with an introduction on connectivity measures. Section III formulates the factorisation procedure and we demonstrate the suitability of PARAFAC2 and a connectivity metric that is defined on the extracted components. In section IV we show results on a benchmark connectivity dataset and real Alzheimer’s EEG data. Section V puts the benchmark results into context, showcasing the conformity of the real AD data to prior pathological knowledge and the Scaffolding Theory of Cognitive Aging [30]. Section VI concludes the paper. II. EEG MODEL The EEG measures the concurrent activity from multiple neural sources mixed into multiple sensors. Various forward models have been developed that map the way that such sources are propagate and are mixed into the scalp electrode sensors [31], [32]. Each source usually describes a separate mental process or group of related processes [7] and estimating their properties has been attempted in a variety of ways [33], [34], [11]. EEG is traditionally analysed with respect to channels and temporal samples resulting in a model: X(t) = AS(t) = n X ai si (t) (1) i=1 where A ∈ Rm×n describes the forward model of n sources on m electrodes and S(t) ∈ Rn the source matrix where each source has a duration of T temporal samples. EEG sources are commonly modelled as kth order autoregressive (AR) processes [35]: si (t) = k X hi (τ )wi (t − τ ) (2) τ =1 where wi (t) is white gaussian noise and hi (t) the AR process parameters for the ith source. The parameters h(t) can generate a variety of source types such as narrowband and lagged sources. When two sources are connected this can be modelled by bivariate AR processes such as [36]:   X   T  si (t) hi (τ ) hij (τ ) wi (t − τ ) = (3) sj (t) hji (τ ) hj (τ ) wj (t − τ ) τ =1 The coefficients hij describe the connection between the ith and jth sources also allowing for directionality in the connectivity when hij 6= hji . Alternatively, each source may be considered in the frequency domain since many neural sources are oscillatory in nature [37]. The mixing model remains the same since frequency transforms are linear functions of the time domain signal. Note that the transformed sources si (f ) are now complex valued describing the power and phase as a function of frequency. In the frequency domain the EEG model is written as: X(f ) = AS(f ) = m X ai si (f ) (4) i=1 where X(f ) ∈ Cm×F and si (f ) ∈ C1×F with F the total number of frequency bins. Coupled sources are written as:      si (f ) hi (f ) hij (f ) wi (f ) = (5) sj (f ) hji (f ) hj (f ) wj (f ) Due to the low signal-to-noise ratio of EEG signals, datasets usually consist of multiple measurements of the same state or task that generates the sources of interest. These measurements are called trials and aid in increasing the SNR since undesired source activities are considered uncorrelated to the activities of interest. Similarly, in a continuous recording, data are segmented into non overlapping windows, again called trials, in order to facilitate analysis in shorter time segments. The model is then written as: X(f, k) = AS(f, k) = m X ai si (f, k) (6) i=1 where si (f, k) is the complex source activation at the fth frequency bin and kth trial. With the source model written as: si (f, k) = hi (f )wi (f, k) = pi (f )yi (f, k) (7) Such a model allows for time-shifts between trials. Also, it allows to separate the frequency profile, pi (f ), and trial to trial variations, yi (f, k), of each source resulting in: X(f, k) = m X ai pi (f )yi (f, k) (8) i=1 where pi (f ) ∈ CF describes the complex amplitude of the ith source at frequency f . The term yi (f, k) describes the trial to trial variations in amplitude and phase. Such a model allows for typical narrowband EEG sources such as alpha sources with sparse pi (f ). It is important to notice that yi (f, k) is both a function of frequency and trial. For sources that are not connected pi (f ) = hi (f ) and yi (f, k) = wi (f, k) which are the frequency transforms of the AR model and white noise realisation respectively. For a connected source such as: sj (f, k) = hj (f )wj (f, k) + hij (f )wi (f, k) (9) the pi (f ) and yi (f, k) describe more complicated relationships between the spectra and activations of the two sources. 3 A. Connectivity estimate Consider two electrodes xi and xj , the coupling between them can be estimated by a variety of methods which use the cross-spectrum as an initial step: Yi,j (f, k) = xi (f, k)xj (f, k)∗ (10) which is the cross-spectrum between the electrodes at frequency f and trial k. Subsequently, coupling is assumed to exist if an electrode is leading (or lagging) in phase consistently over trials. Several measures have been developed one of which is the phase lag index (PLI): Ψij (f ) = |E{sign(=(xi (f )xj (f )∗ ))}| (11) amplitude it achieves different complex values for different frequencies and trials, and b) differences between trials can be accommodated by considering that a variable process such as wi0 (f, k) = di (f, k)wi (f, k). For phase-shifts between trials we can consider: di (f, k) = exp(−jθk f ) being also a function of frequency and trials. Hence, this formulation allows the decomposition of EEG into complex sources that are potentially not phase locked to a stimulus. B. Connectivity estimation in component space It then becomes possible to measure connectivity information in component space by considering the trial activations. The connectivity measure is performed similarly to the crossspectrum between electrodes but now is between components: where the expectation is taken over trials. If the electrode signals are of consistently different phase then =(x1 (f )x2 (f )∗ ) will be of the same sign and Ψ(f ) will tend to 1. Measuring the brain connectivity using the PLI is optimal only for a pair of coupled sources as shown in [21]. For more than 2 coupled sources, cross-source interference arises and the optimality of the measure is lost in terms of volume conduction accuracy of spatial location. The PLI was chosen as the metric of interest since it is widely used in neuroimaging studies [38], [18], [39]. which measures the coupling between component i and j where si (f ) = pi (f )yi (f ). In order to obtain a connectivity profile over the scalp we can use that PLI value weight by the activation of the sources over the scalp: III. C OMPLEX TENSOR FACTORISATION which gives a symmetric connectivity profile of the coupling between the two sources. Furthermore, the frequency information can be incorporated by weighting by the mean frequency magnitude over a specific band of the desired sources: A. Tensor model In order to alleviate the aforementioned issues with simple connectivity measures we propose a tensor factorisation procedure where the EEG is decomposed into distinct components in the complex domain. We consider a tensor EEG model, directly resulting from Equation 8, as a sum of components where each one is described by a triplet of real activations over electrodes a, over complex frequencies p, and complex trials y as: Ψsij (f ) = |E{sign(=(si (f )sj (f )∗ )}| Caij = Ψsij (ai aTj + aj aTi ) 1X |si (fl )| + |sj (fl )|) L   y1 (f ) . . . pm (f )  ym (f ) (12) where X(f ) ∈ Cm×F ×K . yi (f ) ∈ CK×1 are the complex activations of the ith source over K trials placed in the matrix Y. P ∈ Cn×n is a diagonal matrix holding the complex frequency profiles of the m sources in the diagonal for a single frequency f . This model is the PARAFAC2 model. If the source activations were identical for all frequencies i.e. si (fn ) = si (fm ) then the model would correspond to the typical PARAFAC model with: X(f ) = AP(f )Y  p1 (f )  .. = A .    y1 ... ym  (13) pm (f ) There are two reasons that the source activations are dependent on the frequency: a) due to wi (f, k) being a complex source (16) l C. Complex PARAFAC2 The factorisation procedure entails alternating least squares minimisations of the following equation: A,P(f ),Y(f )  (15) L s T T Caf ij = Ψij (ai aj + aj ai )( argmin ||X(f ) − AP(f )Y(f )||2 X(f ) = AP(f )Y(f )  p1 (f )  .. = A . (14) (17) However, the solution to the factorisation of equation 17 is not unique [40] and the PARAFAC2 model imposes an additional constraint to facilitate uniqueness. This is accomplished by having the cross-products of the 3rd mode be constant over its index: Y(fi )H Y(fi ) = K, ∀i (18) which is implemented by having Y(f ) = Q(f )H where Q(f ) ∈ CK×R is an orthonormal matrix and H ∈ CR×R any square matrix. That leads to the modified factorisation algorithm as: argmin||Q(f )H X(f ) − AP(f )H||2 A,P(f ),H (19) which is solved by standard PARAFAC algorithms. Note that the minimisation over A is performed in the real domain. The constraint is not optimal for EEG data since it enforces the complex inner product between sources to be equal for all frequencies which is not necessarily true. However, in our case where sources are coupled only in a narrow band (e.g. alpha sources), the inner product in the rest of the frequency range 4 will be weighted by the activity on the 2nd mode. The results of the simulation also support the usefulness of the constraint in our setting (c.f. IV-A) D. Experimental validation and application to real world signals 1) Validation with synthetic data: The PARAFAC-2 algorithm is evaluated initially on the Berlin Brain Connectivity Benchmark [41]. This framework provides the capability of EEG data generation that resemble as much as possible real EEG data with customisable parameters. The simulation includes a realistic a 108-channel real head model and the generation of pseudo-EEG sources that can be either narrowband (e.g. alpha band) or pink noise sources corresponding to background brain activity. Furthermore, it enables the creation of coupled sources based on the bivariate AR model of Equation 3 or not coupled sources with zeros on the offdiagonals. The default settings provided in the framework correspond to a realistic EEG recording [41]. These include a pair of coupled sources with spread over the cortex resembling a brain network and a large number of background EEG activities. For the purposes of this study we desire to evaluate: a) the performance of the algorithm in estimating the coupled sources in terms of the power ratio (PR) of the coupled sources to the whole EEG power and b) the influence of the number of components of the tensor factorisation to the performance of the algorithm. We define three different metrics to accomplish this goal. Firstly, the explained variance (EV) of the tensor factorisation which describes how well the algorithm is fit to the data: P ||AD(f )Z(f )||2F f P (20) EV = ||X(f )||2F Each dataset is sliced into 1 second trials resulting in a EEG of dimensions 108×180. A common average reference is applied and the data are also detrended and baselined. Furthermore, we tensorise the data with the short time fourier transform with 1Hz Hanning tapers in the range of [1 − 40]Hz. This results in an EEG of dimensions 108 × 40 × 180 which is input to the PARAFAC2 and PARAFAC algorithms. To avoid the effect of local minima we perform 10 runs of 10 initialisations each and retain the run with the highest coupling value. This is performed for both the datasets that contain coupled sources and the ones that do not. All pairs of the trial mode factors are then input into equation 16 from which the pair with the highest coupling is selected to compute the CONN and LOC metrics. The CONN metric was estimated by finding the threshold that maximally separated the coupled datasets with the ones without coupling. The LOC was estimated by correlating the obtained spatial component of each of the paired sources with each of the lead-field of the head model and picking the octant with the highest correlation. 2) Illustration in AD: The algorithm was applied on two electroencephalography (EEG) datasets on a memory task from Alzheimer’s patients and control subjects [42]. In dataset1, there were 128-channel recordings from 13 patients with mild cognitive impairment (MCI) and 14 control subjects (mean age: 73) while for dataset-2 there were 64-channel recordings from 10 patients with MCI and carrying the gene of familial Alzheimer’s disease (FAD) and 10 control subjects (mean age: 44). Similar preprocessing is performed in the EEG signals of the AD datasets resulting in tensors 128/64×40× 50 with the number of trials slightly different between subjects with identical algorithm parameters as in the benchmark dataset. IV. R ESULTS f Secondly, a connectivity estimation metric CONN as described in [41] which describes the ability of the algorithm to detect whether there exist coupled sources in an EEG segment or recording. A correct estimation is awarded with +1 while a wrong one with −2 with the chance level being at −0.5. Lastly, the LOC metric as described in [41] which estimates how well the algorithm can identify the coupled sources and their spatial profile in terms of the brain octant they belong to. The LOC metric awards for each source +0.5 when the octant is predicted correctly and −0.5 otherwise. Chance level of this metric is −0.5. In summary the settings of the simulated EEG are: • Channels: 108 • Sampling frequency: 100Hz • Coupled sources: 2 • Noise sources: 500 • AR model order: 5 • Power ratio (PR) range: 20% - 90 % • Sensor noise: 10% • Chance a dataset contains coupled sources: 50% • Datasets for each PR: 100 • Duration of each dataset: 3 minutes • Realistic head model lead-fields: 2000 A. Simulated EEG Firstly, we apply the complex tensor factorisation algorithm for a range of PR values and for R = 2 and R = 8. The number of components was set to a maximum of 8 to avoid non-uniquness issues. For each PR value we generate 100 datasets where in each one the signal sources are in the alpha frequency band and the noise sources are pink noise realisations. Then, we compute the three metrics and the results are seen in Figure 1. In [36] a CONN value of 0.5 and a LOC value of 0.51 were obtained. B. Alzheimer’s EEG For both datasets, we applied a R = 8 component complex PARAFAC2 algorithm and calculated the connectivity map on the pair of sources with the highest connection value on the alpha (8-12Hz), beta (13-20Hz) and theta (4-7Hz) frequency bands, see equation 16. In Figures 2, 3 and 4 we show the connectivity map obtained with tensor factorisation on the alpha and beta bands. Figure 5 shows the connectivity map obtained through the standard PLI measure for beta bands only. An example source pair is shown in Figure 6. We also calculated the power ratio (PR) similar to the benchmark dataset. The differences in PR values between groups, 5 EV CONN 1 LOC 1 1 R=2, PARAFAC2 R=2, PARAFAC R=8, PARAFAC2 R=8, PARAFAC 0.9 0.8 0.7 0.5 0.5 0 0 0.6 0.5 0.4 0.3 0.2 0.1 0 0.2 0.4 0.6 0.8 -0.5 0.2 0.4 0.6 0.8 -0.5 0.2 0.4 0.6 0.8 PR Fig. 1. Explained variance (EV), CONN and LOC of the PARAFAC-2 algorithm for a range of PR values and different number of components. For each SNR value we generate 100 datasets where in each one the signal sources are in the alpha frequency band and the noise sources are pink noise realisations. task and frequency band were not significantly different with a mean of 0.35 for the MCI and 0.32 for the FAD group. There were statistically significant differences with an unpaired t-test in the coupling metric, Equation 14, between the MCI group and the matched controls (p < 0.05) for both the binding and the shape tasks with the MCI group exhibiting greater coupling. No differences were found for the MCI-FAD group and the matched controls. In terms of the power weighted metric of Equation 16 we performed a 3-way ANOVA analysis separately for the MCI and MCIFAD datasets. The factors were condition (patient-control), task (binding-shape) and frequency band (alpha-beta-theta), with the dependent variable being the average strength over the whole scalp. Significant differences were found in condition and frequency band for both datasets (MCI/condition: F = 8.49, p < 0.01, MCI/band: F = 3.77, p < 0.05, MCI-FAD/condition: F = 5.24, p < 0.05, MCI-FAD/band: F = 5.11, p < 0.01) with significant differences in task for only the MCI dataset only (MCI/task: F = 6.24, p < 0.05). Interactions between task and condition revealed significant differences in the MCI group between the controls and patients for both tasks. We also tested the correlation between the coupling metric and power weighted metric with significant anti-correlation (r = −0.5, p < 0.01) for the shape task and the patient group for both datasets. V. D ISCUSSION Complex tensor factorisation enables the estimation of brain connectivity in scalp source space and its efficacy was shown in both a benchmark EEG dataset and two EEG datasets comprising of Alzheimer patient and control data. Performing tensor factorisation in the complex domain enables the calculation of brain connectivity metrics since we obtain estimates of the sources phase information. The theoretical justification of using PARAFAC2 as the tensor factorisation model was demonstrated in sections II and III. In the former we describe the way neural processes are described in the complex domain and show their dependency on frequency and trial for both phase- and non phase-locked sources. Initially we measured the performance of the algorithm in the benchmark dataset, where we show in Figure 1, that the complex PARAFAC2 algorithm is able to decompose the underlying data into components that reflect the true activity better than complex PARAFAC while exhibiting good detection performance. Using such a benchmark dataset we were able to generate EEG signals of varying power ratios and evaluate the performance for a wide range. We measure three different performance metrics describing various aspects of the algorithm. In Figure 1 we showed the perfomance in terms of explained variance for various PR values and number of components R. This value describes how well the PARAFAC2 model can fit the data. Moreover, the efficacy in terms of extracting the desired sources is estimated in two ways. Firstly, by computing the CONN metric. This way we obtain an objective measurement of how powerful the signal has to be to be able to reliably extract its phase information. As observed, increasing the PR increases the CONN for PARAFAC2 but not for PARAFAC. Secondly, we 6 MCI Patient Binding MCI-FAD Control cen cen back back right right front front left left Patient Control back back central central front front 1 0.8 cen back right front left cen back right front back left central front back central front Alpha band 0.6 0.4 cen cen back back 0.2 Shape back back right right front front left left 0 cen back right front left cen back right front central central front front left back central front back central front Fig. 2. Connectivity map for the tensor-PLI measure and the MCI (left) and MCI-FAD (right) datasets in the alpha band for R = 8. Each point indicates the coupling between two electrodes which have been grouped into five regions over the scalp. MCI Patient Binding MCI-FAD Control cen cen back back right right front front left left Patient Control back back central central front front 1 0.8 cen back right front left cen back right front back left central front back central front Beta band 0.6 0.4 cen cen back back 0.2 Shape back back right right front front left left 0 cen back right front left cen back right front left central central front front back central front back central front Fig. 3. Connectivity map for the tensor-PLI measure and the MCI (left) and MCI-FAD (right) datasets in the beta band for R = 8. Each point indicates the coupling between two electrodes which have been grouped into five regions over the scalp. 7 MCI MCI-FAD Patient Binding Control cen cen back back right right front front left left Patient Control back back central central front front 1 0.8 cen back right front left cen back right front back left central front back central front Theta band 0.6 0.4 cen cen back back right right front front left left back back 0.2 Shape 0 cen back right front left cen back right front central central front front left back central front back central front Fig. 4. Connectivity map for the tensor-PLI measure and the MCI (left) and MCI-FAD (right) datasets in the theta band for R = 8. Each point indicates the coupling between two electrodes which have been grouped into five regions over the scalp. MCI Patient Binding cen cen back back right right front front left left cen back right front left Control cen back right front MCI-FAD Patient back back central central front front left back central front Control 0.25 back central front 0.2 Beta band cen Shape cen back back right right front front left left cen back right front left cen back right front left back back central central front front back central front 0.15 0.1 back central front Fig. 5. Connectivity map for the standard PLI measure and the MCI (left) and MCI-FAD (right) datasets in the beta band. Each point indicates the coupling between two electrodes which have been grouped into five regions over the scalp. 8 component 1 component 2 4 6 4 PSD PSD 3 2 2 1 0 0 0 20 freq 40 0 20 40 freq Fig. 6. Example source pair obtained by PARAFAC2. Top row shows the spatial topography of the two sources while the bottom row shows their frequency profiles. These two components had a connectivity strength of 0.25. estimate whether the location of the highest connected sources correspond to their true location. For all cases the increased efficacy with increased PR and R was evident. A ceiling level was reached at around 0.6 PR where R = 2 and R = 8 runs of PARAFAC2 performed equivalently. Further increase in R improves the results but the uniqueness requirements are violated as obtained through empirical results for PARAFAC2 [40], [43]. The obtained values for CONN and LOC can be contrasted to those obtained in [41] where CONN=0.51 and LOC=0.5 over 100 datasets for PR in the range of [0.20.9]. However, their work assumes prior knowledge of the oscillatory sources’ frequency bands; such information is not required in our algorithm. Furthermore, based on that prior knowledge of the frequency band a decision for the CONN or LOC was made in [36] only when the SNR is 50% higher than the background activity. Essentially, this renders the simulations for P R ≥ 0.7. In this work, we aim to describe the performance of PARAFAC and PARAFAC2 without any heuristic measures and establish a kind of benchmark that future studies can be compared to. In the real EEG dataset we demonstrate the performance of the algorithm by applying to two task based Alzheimer’s datasets. The motivation behind the tests is to test if prior physiological knowledge about the Alzheimer’s patients can be also obtained through complex PARAFAC2. Based on a memory task [42] the expectation is that the reduced performance of the patient groups should be explained by the loss of neural mechanisms. As seen in Figures 2, 3 and 4, the power adjusted connectivity metric, as defined in Equation 16, of the control groups is higher for both tasks and for the alpha, beta and theta frequency bands. In contrast, the synchronisation metric of Equation 14 was significantly higher for the MCI patient group compared to the matched controls. It has been demonstrated that MCI patients exhibit higher synchronisation in MEG studies [44] and functional MRI studies [45]. The disparity between lower power but higher synchronisation between the patients and controls of the MCI group but not the MCI-FAD group can be explained firstly by noting that the average age of the MCI group is much higher (73) than the MCI-FAD group (44). The Scaffolding Theory of Cognitive Aging and Decline (STCA) [46], [30] describes the compensatory mechanisms that are recruited by the brain to alleviate age related cognitive decline. In memory tasks, MCI patients exhibit increased connectivity between brain areas as aging progresses and compared to controls [30]. This is also shown in this study where increased connectivity is found in the MCI patient group only as compared to the age matched controls due to the larger cognitive decline corroborating the STCA theory. Lastly, the binding task consisted of more distributed brain activations for the binding than the shape task which provides further evidence that the binding tasks requires brain connectivity between different brain areas since the shape and colour binding process invokes separate brain centres [47]. VI. C ONCLUSIONS In this work we showed that complex tensor factorisation based on complex PARAFAC2 is suitable for EEG connectivity estimation and superior to the complex PARAFAC. By establishing that EEG data follow the PARAFAC2 model in the complex domain a tensor factorisation algorithm was successful in a benchmark and two Alzheimer’s EEG datasets. This work has the following implications. Firstly, the use of high order methods such as tensor factorisation is suitable for extracting coupled sources. And secondly, performing tensor factorisation in the complex domain allows for the connectivity information present in the data to be optimally exploited. Importantly, the decoupling of spatial, spectral, and synchronisation behaviour of networks is not possible with traditional connectivity metrics and this work aims to bridge that gap. This works opens up a new possibility in the inspection of EEG connectivity. Future work entails modification of the PARAFAC2 constraint to better facilitate the EEG data generation model. In that light, different data models will be considered such as phase/non-phase locked, event related potentials, and the presence of multiple coupled source pairs. We also to plan to validate the algorithm on a longitudinal AD dataset of more than 100 patients over 5 years. VII. ACKNOWLEDGMENTS We wish to thank Agustı́n Ibáñez for the provision of the dataset [42]. R EFERENCES [1] Rasmus Bro, “PARAFAC. Tutorial and applications,” in Chemometrics and Intelligent Laboratory Systems, 1997, vol. 38, pp. 149–171. [2] Richard A. Harshman, “Foundations of the parafac procedure: models and conditions for an explanatory multimodal factor analysis,” 1970. [3] Richard A. Harshman, “PARAFAC2: Mathematical and technical notes,” UCLA Working Papers in Phonetics, vol. 22, no. 10, pp. 30–44, 1972. [4] Pierre Comon, “Tensor decompositions, state of the art and applications,” arXiv preprint arXiv:0905.0454, 2009. [5] Pieter M. Kroonenberg and Jan De Leeuw, “Principal component analysis of three-mode data by means of alternating least squares algorithms,” Psychometrika, vol. 45, no. 1, pp. 69–97, 1980. [6] Andrzej Cichocki, “Tensor decompositions: a new concept in brain data analysis?,” arXiv preprint arXiv:1305.0395, 2013. [7] Sanei Sanei, Adaptive Processing of Brain Signals, Wiley, 2007. 9 [8] Evrim Acar, Canan Aykut-Bingol, Haluk Bingol, Rasmus Bro, and Bulent Yener, “Multiway analysis of epilepsy tensors,” Bioinformatics, vol. 23, no. 13, pp. i10–i18, 2007. [9] Hyekyoung Lee, Yong-deok Kim, Andrzej Cichocki, Seungjin Choi, and Machine Learning Group, “Nonnegative Tensor Factor- ization for Continuous EEG,” vol. 17, no. 4, 2007. [10] Loukianos Spyrou, Samaneh Kouchaki, and Sanei Sanei, “Multiview classification of brain data through tensor factorisation,” in Proceeding of IEEE Machine Learning for Signal Processing (MLSP). IEEE, 2015, pp. 1–6. [11] Fengyu Cong, Qiu-Hua Lin, Li-Dan Kuang, Xiao-Feng Gong, Piia Astikainen, and Tapani Ristaniemi, “Tensor decomposition of EEG signals: A brief review,” Journal of Neuroscience Methods, vol. 248, pp. 59–69, 2015. [12] Loukianos Spyrou, Samaneh Kouchaki, and Sanei Saeid, “Multiview classification and dimensionality reduction of scalp and intracranial eeg data through tensor factorisation,” Journal of Signal Processing Systems, pp. 1–12, 2016. [13] Lewis Wheaton Zoltan Mari Sherry Vorbach Mark Hallett Guido Nolte, Ou Bai, “Identifying true brain interaction from EEG data using the imaginary part of coherency,” . [14] Stefan Haufe, Ryota Tomioka, Guido Nolte, Klaus Robert Müller, and Motoaki Kawanabe, “Modeling sparse connectivity between underlying brain sources for EEG/MEG,” IEEE Transactions on Biomedical Engineering, vol. 57, no. 8, pp. 1954–1963, 2010. [15] M. J. Kaminski and K. J. Blinowska, “A new method of the description of the information flow in the brain structures,” Biological Cybernetics, vol. 65, no. 3, pp. 203–210, 1991. [16] Stefan Haufe, Vadim V. Nikulin, Klaus Robert Muller, and Guido Nolte, “A critical assessment of connectivity measures for EEG data: A simulation study,” NeuroImage, vol. 64, no. 1, pp. 120–133, 2013. [17] Frederik van de Steen, Luca Faes, Esin Karahan, Jitkomut Songsiri, Pedro A. Valdes-Sosa, and Daniele Marinazzo, “Critical Comments on EEG Sensor Space Dynamical Connectivity Analysis,” Brain Topography, pp. 1–12, 2016. [18] Cornelis J. Stam, Guido Nolte, and Andreas Daffertshofer, “Phase lag index: Assessment of functional connectivity from multi channel EEG and MEG with diminished bias from common sources,” Human Brain Mapping, vol. 28, no. 11, pp. 1178–1193, 2007. [19] Federico Chella, Vittorio Pizzella, Filippo Zappasodi, and Laura Marzetti, “Impact of the reference choice on scalp eeg connectivity estimation,” Journal of Neural Engineering, vol. 13, no. 3, pp. 036016, 2016. [20] Clemens Brunner, Martin Billinger, Martin Seeber, Timothy R. Mullen, and Scott Makeig, “Volume Conduction Influences Scalp-Based Connectivity Estimates,” Frontiers in Computational Neuroscience, vol. 10, no. November, pp. 121, 2016. [21] Martin Vinck, Robert Oostenveld, Marijn Van Wingerden, Franscesco Battaglia, and Cyriel M A Pennartz, “An improved index of phasesynchronization for electrophysiological data in the presence of volumeconduction, noise and sample-size bias,” NeuroImage, 2011. [22] Anton Sirota, Sean Montgomery, and Shigeyoshi Fujisawa, “Entrainment of neocortical neurons and gamma oscillations by the hippocampal theta rhythm,” Neuron, vol. 60, no. 4, pp. 683–697, 2008. [23] Arash Golibach Mahyari and Selin Aviyente, “Identification of dynamic functional brain network states through tensor decomposition,” Acoustics, Speech and Signal Processing (ICASSP), 2014 IEEE International Conference on, pp. 2099–2103, 2014. [24] Britta Pester, Carolin Ligges, Lutz Leistritz, Herbert Witte, and Karin Schiecke, “Advanced Insights into Functional Brain Connectivity by Combining Tensor Decomposition and Partial Directed Coherence,” PLoS One, vol. 10, 2015. [25] Daniel Abásolo, Roberto Hornero, Javier Escudero, and Pedro Espino, “A study on the possible usefulness of detrended fluctuation analysis of the electroencephalogram background activity in Alzheimer’s disease,” IEEE Transactions on Biomedical Engineering, vol. 55, no. 9, pp. 2171– 2179, 2008. [26] Nora Leonardi and Dimitri Van De Ville, “Identifying network correlates of brain states using tensor decompositions of whole-brain dynamic functional connectivity,” Proceedings - 2013 3rd International Workshop on Pattern Recognition in Neuroimaging, PRNI 2013, pp. 74–77, 2013. [27] Morten Mørup, Lars Kai Hansen, Sidse Marie Arnfred, Lek Heng Lim, and Kristoffer Hougaard Madsen, “Shift-invariant multilinear decomposition of neuroimaging data,” NeuroImage, vol. 42, no. 4, pp. 1439–1450, 2008. [28] Roemer van der Meij, Joshua Jacobs, and Eric Maris, “Uncovering phase-coupled oscillatory networks in electrophysiological data,” Human Brain Mapping, vol. 36, no. 7, pp. 2655–2680, 2015. [29] Samaneh Kouchaki, Shirin Enshaeifar, Clive Cheong Took, and Saeid Sanei, “Complex tensor based blind source separation of EEG for tracking P300 subcomponents,” Proceedings IEEE EMBC 2015, 2015. [30] Roberto Cabeza, Nicole D. Anderson, Jill K. Locantore, and Anthony R. McIntosh, “Aging Gracefully: Compensatory Brain Activity in HighPerforming Older Adults,” NeuroImage, vol. 17, no. 3, pp. 1394–1402, 2002. [31] “Review on solving the forward problem in EEG source analysis.,” Journal of neuroengineering and rehabilitation, vol. 4, pp. 46, jan 2007. [32] John C. Mosher, Richard M. Leahy, and Paul S. Lewis, “EEG and MEG: forward solutions for inverse methods,” IEEE Transactions on Biomedical Engineering, vol. 46, no. 3, pp. 245–259, 1999. [33] Christoph M. Michel, Micah M. Murray, Gran Lantz, Sara Gonzalez, Laurent Spinelli, and Rolando Grave de Peralta, “EEG source imaging.,” Clinical neurophysiology, vol. 115, no. 10, pp. 2195–222, Oct. 2004. [34] Loukianos Spyrou and Saeid Sanei, “Source localization of event-related potentials incorporating spatial notch filters,” IEEE Transactions on Biomedical Engineering, vol. 55, no. 9, pp. 2232–2239, 2008. [35] James Pardey, Stephen Roberts, and Lionel Tarassenko, “A review of parametric modelling techniques for EEG analysis,” Medical Engineering and Physics, vol. 18, no. 1, pp. 2–11, 1996. [36] Stefan Haufe and Arne Ewald, “A simulation framework for benchmarking EEG-based brain connectivity estimation methodologies,” . [37] “Mechanisms of evoked and induced responses in MEG/EEG,” NeuroImage, vol. 31, no. 4, pp. 1580–1591, 2006. [38] Matteo Fraschini, Matteo Demuru, Alessandra Crobe, Francesco Marrosu, Cornelius Stam, and Arjan Hillebrand, “The effect of epoch length on estimated EEG functional connectivity and brain network organisation,” Journal of Neural Engineering, vol. 13, no. 3, pp. 036015, 2016. [39] Shinya Kasakawa, Teruya Yamanishi, Tetsuya Takahashi, Kanji Ueno, Mitsuru Kikuchi, and Haruhiko Nishimura, Approaches of Phase Lag Index to EEG Signals in Alzheimer’s Disease from Complex Network Analysis, pp. 459–468, Springer International Publishing, Cham, 2016. [40] Henk Kiers, Jos Ten Berge, and Rasmus Bro, “PARAFAC2 Part I . A Direct Fitting Algorithm for the PARAFAC2 Model,” J. Chemom., vol. 13, no. July 1998, pp. 275–294, 1999. [41] Stefan Haufe and Arne Ewald, “A simulation framework for benchmarking EEG-based brain connectivity estimation methodologies,” . [42] M. Pietto, M. A. Parra, Trujillo N., Flores F., Garca A.M., Bustin J., Richly P., Manes F., Lopera F. Ibez A., and Baez S., “Behavioral and Electrophysiological Correlates of Memory Binding Deficits in Patients at Different Risk Levels for Alzheimers Disease,” Journal of Alzheimer’s Disease, vol. 53, pp. 1325–1340, 2016. [43] Rasmus Bro, Claus Anderson, and Henk Kiers, “PARAFAC2 Part II. Modeling chromatographic data with retention time shifts,” Journal of Chemometrics, vol. 13, no. 3-4, pp. 295–309, 1999. [44] Javier M. Buldú, Ricardo Bajo, Fernando Maestú, Nazareth Castellanos, Inmaculada Leyva, Pablo Gil, Irene Sendiña-Nadal, Juan A. Almendral, Angel Nevado, Francisco Del-Pozo, and Stefano Boccaletti, “Reorganization of functional networks in mild cognitive impairment,” PLoS ONE, vol. 6, no. 5, 2011. [45] B.C. Dickerson, “Increased hippocampal activation in mild cognitive impairment compared to normal aging and AD,” Biophysical Chemistry, vol. 257, no. 5, pp. 2432–2437, 2005. [46] Joshua Goh and D.C. Park, “Neuroplasticity and cognitive aging: The scaffolding theory of aging and cognition,” Restor Neurol Neurosci, vol. 27, no. 5, pp. 391–403, 2009. [47] Mario A. Parra, Sergio Della Sala, Robert H. Logie, and Alexa M. Morcom, “Neural correlates of shape-color binding in visual working memory,” Neuropsychologia, vol. 52, no. 1, pp. 27–36, 2014.
5cs.CE
SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 1 Software-Defined Microgrid Control for Resilience Against Cyber Attacks arXiv:1802.02936v1 [cs.SY] 8 Feb 2018 Pietro Danzi, Student Member, IEEE, Marko Angjelichinoski, Student Member, IEEE, Čedomir Stefanović, Senior Member, IEEE, Tomislav Dragičević, Member, IEEE, Petar Popovski, Fellow, IEEE Abstract—Microgrids (MGs) rely on networked control supported by off-the-shelf wireless communications. This makes them vulnerable to cyber-attacks, such as denial-of-service (DoS). In this paper, we mitigate those attacks by applying the concepts of (i) separation of data plane from network control plane, inspired by the software defined networking (SDN) paradigm, and (ii) agile reconfiguration of the data plane connections. In our architecture, all generators operate as either voltage regulators (active agents), or current sources (passive agents), with their operating mode being locally determined, according the global information on the MG state. The software-defined MG control utilizes the fact that, besides the data exchange on the wireless channel, the power-grid bus can be used to create side communication channels that carry control plane information about the state of the MG. For this purpose, we adopt power talk, a modem-less, low-rate, power-line communication designed for direct current (DC) MGs. The results show that the proposed software-defined MG offers superior performance compared to the static MG, as well as resilience against cyber attacks. Index Terms—power system security, distributed algorithms, microgrids, power system reliability, secondary control. I. I NTRODUCTION ICROGRIDS (MGs) are key components in the emerging distributed Smart Grid landscape. They are defined as localized and self-sustainable clusters of Distributed Energy Resources (DERs) and loads, interconnected via power distribution network through power electronic converters (PECs) [1]. Direct-current (DC) MGs are gaining popularity due to absence of reactive power, synchronization issues, as well as natural fit with emerging DC loads, energy storage systems and renewable sources [2]. The widespread adoption of the MG paradigm is attributed to the development of robust, secure, and non-supervised control systems, which are software-implemented and executed by PECs [3]. Hence, PECs take on the role of control agents that perform the local sampling of the grid state and the overall MG regulation. The control performed by PECs is usually hierarchically organized to distinguish among different objectives [4]. Specifically, the MG control architecture consists of three levels. The primary control is localized within the agent and guarantees the MG stability, while the secondary/tertiary control require cooperation among the agents in order to restore the voltage and optimize the power flow, respectively. M P. Danzi, M. Angjelichinoski, Č. Stefanović and P. Popovski are with the Department of Electronic Systems, Aalborg University, Denmark, Email: {pid,maa,cs,petarp}@es.aau.dk. Tomislav Dragičević is with the Department of Energy Technology, Aalborg University, Denmark, Email: [email protected]. The work presented in this paper was supported in part by EU, under grant agreement no. 607774 “ADVANTAGE". The cooperation among agents is supported by an external communication network, which can experience delay and packet loss, thereby deteriorating the MG operation. With non-ideal links, the secondary/tertiary control operate in a suboptimal regime. A possible solution is the adoption of robust control schemes that are tolerant against communication delays and/or packet drops, cf. [5]. However, when the communication network is attacked by e.g. Denial of Service (DoS), the secondary/tertiary control fails [6]. In addition to the poor adaptation to communication impairments, another deficiency of existing MG control is the information security: the increase of the number of attacks against big-scale power systems raises a concern also about the cyber-resilience of the small scale grids. In fact, even if the MG failure does not lead to large blackouts, it may damage sensitive loads, such as electronic equipment, or cause the tripping of DERs [7]. The concerns described above, as well as the possibility to abstract the agents’ functionalities from the PECs’ hardware, establish the motivation to redesign the multi-agent MG control towards a more reconfigurable and secure system. Unlike the existing works, the role of each agent in our proposal is not statically defined: thanks to software reconfiguration, a PEC can operate as an active control agent as well as passively act as a sensor that delegates the control to active agents. The operation mode is selected according to the MG status and to the status of the external communication network. The resulting architecture, first introduced in [8], is inspired by the concept of Software Defined Network (SDN) [9] that allows agile reconfiguration of the communication system due to function virtualization and data-control separation. We therefore denote the proposed architecture as software-defined MicroGrid control. In the proposed architecture, the data plane contains the actual information exchange between agents. The networking control plane is used by the agents to monitor and improve the links quality. In our framework, the two planes are physically separated via the use of different communication interfaces: wireless and power line communication (PLC), respectively. As a PLC solution, we use power talk [10]-[11], a modemless low-rate signalling technique designed specifically for the information exchange among controllers in a DC MG [12]. In this work, we enhance the operation of power talk with a Carrier Sense Multiple Access (CSMA) protocol, optimized for the use over this specific channel. We also propose an algorithm for the dynamic selection of the active DERs (i.e. agents), which is run in a distributed manner by the PECs, relying on the information exchanged via power talk. We SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) show the benefits of the dynamic agent selection, investigating the scenarios in which there are dynamic changes in: (i) the wireless data plane connectivity among DERs; and (ii) the generated power within the MG. The rest of the paper is organized as follows. Section II presents the background and motivation for this work. Section III introduces the system model. Section IV briefly presents power talk communications. Section V contains the description of the proposed architecture. Section VI verifies the viability of the framework through a simulation implemented in Simulink. Section VII concludes the paper. II. BACKGROUND AND M OTIVATION A number of robust networked control systems for DC MGs have emerged recently [13]. Besides the standard, centralized approach that is inherited from large-scale power systems, a distributed control implemented by multiple agents is a viable solution that mitigates the single-point-of-failure problem and increases the system modularity [1]. The distributed control is typically based on consensus algorithm, which permits the agents to converge to a global average using only the information exchanges that are performed among, in communication terms, neighboring agents [14], [5], [15]. Relying on the broadcasting nature of the wireless medium, it was observed that wireless solutions overcome standard wired solutions in the support of gossip consensus algorithms, cf. [5]. Potential wireless solutions to be used in MGs are cellular networks [16], ZigBee [14], Wi-Fi [5], or their combinations [17], where the choice depends on the MG extent, affordable cost, and required Quality of Service. However, the adoption of wireless technologies raises concerns regarding the reliability and security of the control. In the following text, we present two motivating problems that our framework aims to solve. 1) Selection of the active control agents: In a power grid, the positioning of the wireless transceivers is constrained by the physical location of the DERs, such that certain agents may not be even able to establish communication to the rest of the agents. This is illustrated in Fig. 1, where three communicating subsets are present, namely U1 , U2 and U3 . Here U3 has a single isolated agent, that can neither communicate to other agents nor participate in the networked secondary/tertiary control. Furthermore, a static selection of active agents, adopted in the state-of-art works, does not account for the cyberphysical variations occurring in the MG, e.g., (i) variations of the power generated by DERs, (ii) varying reliability of the wireless channel and (iii) modifications of the communication network graph. Therefore, the set of control agents should not be statically defined, but they should be able to adapt their control mode to the cyber-physical conditions of the MG. 2) Cyber-security: Employing off-the-shelf technologies, e.g. ZigBee or Wi-Fi, exposes the networked control to communication outages caused be external malicious entities, e.g. Denial Of Service (DoS) attacks. Previous works [6] show that a malicious attacker equipped with a jamming device can easily undermine the information exchange, causing the system to converge to an erroneous voltage level. Leveraging on the fact that the attacker is capable of jamming only a finite area, 2 U1 ρ = = = = = = = = U3 = PCC = Grid bus = U2 = = = = = = = DER Fig. 1: Representation of a MG in which PECs are interconnected by electrical bus (black connections) and communication links (dashed purple). active DERs should be selected outside of its communication range, to be able exchange control information. The key observation that underlies this work is that, besides the wireless network, DERs are interconnected by the electrical distribution network, which can be used as a side communication channel. This extra channel can bring the required resilience and security to the MG operation. The side channel is of a PLC nature; among the available PLC technologies, we adopt Power Line Signalling (PLS), which is a communication technique that does not require the installation of additional hardware, but relies on the PEC capabilities. Specifically, we employ power talk [10]-[11], which can be implemented as a simple upgrade of the PECs’ software. As power talk provides a low-rate channel that is not capable of sustaining the secondary control data traffic1 , it is only used as a side, secure, and resilient communication channel to perform control-plane exchanges that complement the wireless dataplane communication links. III. S YSTEM MODEL The scenario considered in this paper is a single-bus DC MG in which a group of U DERs is deployed to increase the selfsustainability of the installed load and to minimize the dependency to the main grid. We index the DERs in U = {1, ..., U} and model the load as resistive impedance with power demand Pd . DERs are interfaced to the distribution network bus by means of DC-DC PECs [3]. By P M = [P1, M , · · · , PU, M ] we denote a vector that contains the maximum produced power, or capacity, Í of each DER. We define the total generated power as Pg = u ∈U Pu, M . In our model, PECs have the dual-mode capability [18]: their software implements the logic of both Current Source Control (CSC) and Voltage Source Control (VSC), and they are able to switch between these operation modes seamlessly. This feature permits to use the interfaced DER at its full capacity when performing CSC, as well as to participate in the voltage control when performing VSC. Also, a stand-alone grid, such as an islanded MG, requires that a subset of DERs V, V ∈ U and |V | = V > 0, performs VSC. This subset 1 Note that the information required for the tertiary control can be exchanged via power talk [12]. SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 3 is called Voltage Source Set (VSS), where the set cardinality depends on the capacity of the resources. The remaining U −V DERs from the set U \ V perform CSC, thus constituting the passive agents of the network. A. Voltage Source Control The VSC is organized according to a hierarchical architecture [4], composed of three levels. 1) Primary control: A droop loop accomplishes the current sharing among the VSC units. The loop has a sampling/control period T pc and can be expressed at DER u as vu = vref − ru iu, u ∈ V, where vu and iu are the output voltage and current, vref is the reference voltage and ru is the virtual resistance. The loop is implemented by a PI controller with proportional parameter pc pc Kp and integral parameter Ki . This control loop depends only on local measurements, which causes the bus voltage deviations from the reference value vref . 2) Secondary control: A distributed secondary control is in charge of (i) the restoration of the voltage to vref and (ii) the proportional current sharing among generators [4], and is based on the local estimation of the average voltage v̄u and current i¯u in the MG. Among the multitude of distributed secondary control schemes [13], we adopt the solution proposed in [19], which utilizes two compensation terms δx i and δx v to balance the equation vu? = vref + δx i + δx v − ru iu, u ∈ V. (1) Two PI controllers, characterized by proportional and integral sc , K sc and K sc , K sc , respectively, generate the parameters Kv,p i,p v,i i,i correction terms according to: δx i = i˜u − αu · V · i¯u, where δx v = ṽu − v̄u, Pu, M αu = ÍV . v=0 Pv, M (2) (3) The scheme requires the global knowledge of P M , but improves the one adopted in [8] by promoting the proportional power sharing among VSC DERs. We compute the average values through a robust broadcast gossiping [5], suitably modified to include the proportional term αu . The algorithm requires the synchronization among agents, being executed in periods of duration T sc , which also determine the sampling frequency of the secondary control. The secondary control operation iterates through the following steps: 1) In secondary control period k, DER u ∈ V broadcasts a packet to the neighboring control agents over the wireless interface with payload au (k) = [v̄u (k), i¯u (k)], representing the local estimates of the average voltage and current measured by DERs, respectively. 2) During the same secondary control period k, DER u receives R packets broadcasted from neighboring agents, which are supplied as input to the robust broadcast gossip algorithm: ( Í j a j (k) , R>0 β m (k) + (1 − β ) u u u au (k + 1) = 0 R βu mu (k) + (1 − βu )au (k), R=0 where mu (k) = [ṽu (k), i˜u (k)] is the local measurement vector in secondary control period k, a j (k) is the status of agent j (assumed to be within the communication 0 range of agent u), au (k) = [0, i˜u (k)/(αu · V)] serves to compensate (3) when information from neighbors is not available and βu ∈ (0, 1) is the consensus weight for agent u; in this paper we adopt that βu = V −1, ∀u ∈ V. 3) The new status au (k + 1) is then forwarded to the local PI controllers, together with the measurement vector mu (k). 4) The PI controllers generate the reference voltage correction signals δx i and δx v of (2). In case of a load/generation change, the offsets δx i and δx v converge to stable values when a global consensus is reached by the described scheme. Note that the adopted broadcast gossip consensus algorithm provides high robustness against packet losses, see [5], because the local information is used in absence of external one. 3) Tertiary control: The tertiary control is in charge of the economic optimization, as well as the management of the bidirectional power flow with the main grid. The information exchange happens on lager time intervals, typically T tc = 5−30 minutes. For this reason, the communication requirements are less demanding and, in this work, we don’t adopt a tertiary control, but the proposed model can be easily extended. We further assume that P M is constant over a tertiary control period and that the demand is always satisfied, i.e. Pg > Pd . B. Current Source Control A PEC u that performs CSC permits the utilization of the DER as a passive agent. The electrical model consists of a current generator iu, M in parallel with an internal resistance approximated by rd [18]. As opposed to VSC DERs, CSC DERs do not participate in the active control and are excluded from the broadcast gossip algorithm. C. Communication System Each DER is equipped with an IEEE 802.11 wireless interface that supports the ad-hoc network mode, allowing decentralized information exchange and multicast packet transmission. The wireless interface is characterized by the communication range ρ, see Fig. 1, which determines the set of neighbors reachable by DER u, indicated with Nu . We assume that the links are bidirectional, i.e. the communication graph is undirected. Depending on the DERs positions and ρ, the wireless network graph G may be split into ω ≥ 1 subgraphs, where the j-th graph is denoted by G j , its set of DERs by U j , and ∪1≤ j ≤ω U j = U. To ensure convergence of the consensus algorithm, the graph connecting V should be strongly connected, i.e., V ⊆ U j for some j. The wireless network traffic consists of packets containing information required to run the secondary control, which are generated by DER u ∈ V. Table I gives a comparison between existing distributed secondary control schemes. Note that the number of DERs is usually limited, and the secondary control traffic has a duty cycle in the order of tens of milliseconds. SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 4 TABLE I: Comparison of existing communication models for distributed secondary control; n.d. means not declared. Paper [19] [5] [6] [14] [8] [15] Traffic T sc [ms] 100-1000 10 25 50 25 20 Packet size [bit] n.d. n.d. 16 ∼ 800 16 n.d. VSC P1 CSC Pg M 𝑃𝑢 M P2M P1 Network U Graph 6 Mesh, cross, ring, line 4 Mesh 6 Mesh 3 Mesh, directed 9 Random 10 Mesh P2 P3 PUM PU P3 Pd 𝑢∈𝑉 Fig. 2: Representation of the power sharing among DERs. J cq < pabs, (7) where 0 ≤ pabs ≤ 1 is the highest allowed probability of the event in which VSC DERs have to absorb power. If there is no solution to (7), we select the connected graph that provides the lowest J cq , to ensure that the algorithm always gives solution. Leveraging on the fact that in a typical scenario the set of DERs has low cardinality, see Table I, we propose Alg. 1. This is an exhaustive algorithm that builds an ordered collection L of all connected graphs, then selects the one that satisfies the selection conditions. The connectivity of graph connecting a generic set of DERs, W, can be verified, for instance, by means of the well-known Tarjan’s algorithm [21]. Algorithm 1 VSC set selector input PM , GU V ← ∅, V 0 ← ∅, p̂ ← 1, L ← D. Metrics Ð W {W:W ∈U, |W | ≤V } We use iv∗ to denote the output current of VSC DER v ∈ V, in the ideal case when the grid voltage is vref . The suboptimality of the secondary control with respect to the ideal case is expressed as the sum of the deviations of the output current of VSC DERs with respect to the corresponding iv∗ : Õ J sc = |iv − iv∗ |. (4) v ∈V We define J cq as the quality of specific selection of VSC set. In general, J cq can depend both on physical properties, such as the generation capacity, as well as cyber aspects, i.e. the wireless network graph connectivity or communication cost. We define J cq as the probability that the power demand is lower than the CSC DERs’ production, i.e. the probability that VSC DERs are absorbing energy:     Õ     cq (5) Pu . J = Prob Pd <     u ∈U\V   The above definition requires knowledge of the demand statistics, which can be modeled as Gaussian [20], i.e. Pd ∼ N (µ, σ 2 ). Then, we have: Í u ∈U\V Pu − µ cq J = 1 − Q(x), x = (6) σ where Q(x) is the Q-function. E. Selection of Voltage Source Controllers Different choices of DERs in V lead to different J sc and making necessary the formulation of a proper selection algorithm for the VSC set. As illustrated in Fig. 2, the set cardinality, V, should allow to meet the variations of demand: if too small, the VSC DERs may have to absorb energy; on the other hand, the inclusion of all DERs in V increases the communication cost and reduces the DER utilization efficiency. Furthermore, as discussed in Section II, possible choices of VSCs are constrained by the cyber network topology, i.e. all VSCs should be in the same, strongly connected, subset. The J cq , objective that we set is to find the connected set of DERs with lowest cardinality that gives for W in L do if W is not connected then L ← L\W else p ← J cq (PM, GW ) if p ≤ p̂ then p̂ ← p, V 0 ← W if p ≥ pabs then L ← L\W if |L| > 0 then V ← L[0] output V IV. P OWER TALK Power talk is a communication technique implemented within the primary control loops of the PECs [12]. The principle idea is to send information over the power grid buses by varying the droop control parameters of VSC DERs; in this paper, we focus on the scenario where the information is conveyed only through the variations of the reference voltage vref . These variations cause the variations of the steady state voltage that is observed by other PECs. We note that, in order to deviate the steady state voltage, the secondary control has to be temporary suspended in the grid during the signalling periods of power talk. In principle, power talk can use any modulation scheme [10] and channel coding. In this paper, we adopt a binary modulation, with symbol period T pt , amplitude apt , and no channel coding, cf. [10]-[11]. The observations of the transmitted symbols periods are with a lag of τ seconds, in order allow the bus to reach a steady state after vref has been deviated [22]. A. Power-Talk Communication Protocol We assume that signalling via power talk is performed periodically, through a power talk channel (PTCh) that is established in intervals of duration T PTCh seconds. As already SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 5 𝑇 tc 𝑇 sc Wireless interface 𝑇𝑑 Secondary control traffic 𝑇 PTCh Time Neighbors discovery Wireless interface Contention phase Contention-free phase 𝑐𝑓 𝑇𝑐 𝑇 𝑇e PTCh Power Talk interface PTCh Fig. 3: Time relationship between power talk and wireless interfaces. Power Talk Fig. 4: Wireless and power talk channel as seen by DER u during DVSSS messages exchange. Information transmitted by u is coloured in red. noted, the secondary control is suspended during the PTCh, and, thus, T PTCh should be as short as possible. The PTCh’s are triggered with a constant period: this permits to coordinate the VSC DERs in the suspension of the secondary control and keeps the design complexity low. In order to enable plug-andplay capability of the MG, here we enhance power talk with a Carrier Sense Multiple Access (CSMA) scheme. This enables random access to the shared channel, while keeping the time in which the communication system is idle low. Specifically, a CSMA protocol coordinates DER transmissions during T PTCh . The protocol is characterized by the carrier sensing duration, or virtual slot, σs , that is chosen based on the propagation delay in the grid. The channel access operates as follows. At the beginning of each PTCh period, each DER sets an internal counter to a uniformly randomly selected number in [0, B − 1], where B ∈ N is a design parameter. The counter is decremented for each idle virtual slot, σs , and, when it reaches zero, the DER starts the transmission. When a DER starts transmitting, the others stop decrementing their counter for the duration of a transmission, T dt , that is known a priori. In case of a collision, when more than one DER selects the same number of slots, the corresponding DERs do not retransmit. Instead, they keep the collision probability in a PTCh to be below a low target value through the appropriate selection of B, as described in the following section. The scheme, indicated as decentralized voltage sources set selection (DVSSS), is executed periodically and consists of the following steps, represented in Fig. 4: 1) All DERs activate the wireless interface and broadcast short, control plane packets for T d seconds. This step is required to notify their presence and obtain the list of their potential neighbors (neighbors discovery phase), and is executed T d seconds before the beginning of the power talk channel (PTCh). 2) DERs broadcast the information about their neighbors and generation capacity over the power talk interface. 3) Each of them locally executes Alg. 1. 4) If DER u ∈ V, then activate the VSC, tuning the consensus algorithm according to (3); otherwise activate the CSC and do not transmit over the wireless channel until the next subset selection. For simplicity, the DVSSS is run in every tertiary control period, T tc . The PTCh, used for control plane exchanges, is established with the same periodicity, i.e., every T e = T tc seconds, and its duration, T PTCh seconds, is divided in two phases. The first one is a CSMA-based contention phase of duration T c seconds, in which DERs notify their presence, operation required to permit addition/removal of DERs. The second phase is contention-free and of duration T cf seconds, in which each DER u broadcasts the lists of its wireless neighbours Nu . The total duration is: V. T HE S OFTWARE -D EFINED C ONTROL A RCHITECTURE T PTCh = T c + T cf . To demonstrate the advantages of the proposed softwaredefined control architecture, in the following text we present the potential application of decentralized voltage sources set selection. A. Decentralized Voltage Sources Set Selection (DVSSS) The operation of MGs is subject to variations in the generated power, wireless connectivity among the agents, due to e.g. wireless jamming from malicious agents, and grid topology, such as addition/removal of DERs and loads. Thus, Alg. 1 should be run periodically, e.g., every tertiary control period, in order to determine the current optimal set of VSC DERs V. Due to the lack of centralized coordination, this should be done in a decentralized manner: DERs receive updated information about DERs’ power capacity and connectivity, PM and G, execute Alg. 1 and thereby set their control mode. (8) During T c , each DER u contends the channel by means of the described CSMA protocol, and broadcasts a b−bit packet that contains its own ID and Pu, M . The duration of T c depends on (i) the CSMA parameters σs and B, (ii) pc , defined as the probability that all U DERs choose a different counter value B and there are no collisions, and (iii) the probability that all agents attempt the transmission before T c . We require that pc > p?c , where p?c is a target probability, and all DERs’ counters value reach zero before T c , which certainly happens if the number of idle virtual slots, Nb , is greater than B. These two conditions are, respectively:  c  T − U · T dt B!/(B − U)! ? > p , N = ≥ B, (9) pc = b c σs BU where T dt = b · T pt + τ is the duration of the transmission of one DER and τ is a guard time to account for the network SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) = = = DER 7 = = DER 8 DER 5 385 PCC Voltage [V] = = = = DER 6 = = = = = DER 4 DER 3 = = DER 2 = DER 1 6 CDC = Load DER 9 (a) Load change 380 375 1 2 3 1 2 3 200 DER 7 100 DER 5 5 0 DER 1 DER 4 Iterations of tertiary control DER 6 (a) DER 8 -200 DER 9 0 50 385 100 150 200 250 X [m] (b) Fig. 5: The case study MG. (a) Electrical scheme of the power talk communication network. The arrow up represents a load, the arrow down a DER. (b) Spatial position of DERs. The dashed lines are wireless communication links. TABLE II: Simulation parameters. Communication and algorithm parameters ρ 175 m Td 10 s Power talk parameters σs 0.003 s b 8 bits apt 0.5 V Control parameters T pc 10−4 s T sc 10−2 s sc sc K v, 0.1 K v, 20 p i pc Ki,sci 20 Kp 3 Electrical parameters vref 380 V CDC 2.2 · 10−3 F σ2 1.44 kW pmin 1 kW Voltage [V] -300 -50 DER 3 380 375 1 2 5 i2 0 i1, i 4, i 5 1 pabs 0.01 T pt 0.01 s rd Ki,scp pc Ki 0.385 0.1 170 µ pmax 14.44 kW 4 kW 2 3 Iterations of tertiary control (b) Fig. 6: Realization of the process when the wireless network graph G is (a) stable and (b) split due to a DoS attack. propagation delay. If we use U from the previous period, and fix a target p?c , we can find B and Tc . At the end of the contention period, DERs have the information about U as well as an ordered list of DERs’ IDs. In the contention-free phase, each DER access the channel in a token-based manner, where the token passing follows the list of IDs. The duration of this phase is simply T cf = b · T pt · e + U · τ, 3 10 Currents [A] Y [m] DER 2 0 -100 Currents [A] 10 (10) where e is the number of edges of the network graph, while U · τ stands for the addition of one guard interval per DER. VI. R ESULTS The proposed framework is verified through numerical simulation of a case-study DC MG with vref = 380 V and U = 9 DERs, which is isolated from the main grid at the point of common coupling (PCC). The overall electrical system, represented in Fig. 5(a), is inspired by [15]. Here we also take into account the relative positions of the DERs, see Fig. 5(b), where a wireless communication link (depicted in blue) between two DERs exists only if they are in the communication range ρ of each other. Further, the capacity CDC models the cumulative capacities of DERs’ output filters. The MG, parametrized as in Table II, is implemented in a MATLAB/Simulink simulator. 1) PTCh duration: The propagation delay observed in the grid is τ = 2.8 ms, and is used to set the value of σs . In the next step, we fix p?c = 0.8 and solve (9), obtaining B = 165 and T c = 1.24 s. For U = 9, a full-mesh graph has e = 36 edges, and we use these values to solve (10) and obtain T cf = 2.91. Finally, we set the duration of PTCh in our simulation as T PTCh = T c + T cf = 1.24 + 2.91 = 4.15 s. 2) Static Vs Dynamic set selection in case of DoS attacks: We initially assume that set of VSC DERs is V = {1, 2, 4, 5}, that form a strongly connected graph. In each tertiary control period, the capacity of DERs is selected uniformly in [pmin, pmax ], with values reported in Table II. In Fig. 6, we report voltage measured at PCC and currents measured by DERs, during a simulation with duration 3T tc . In the middle of each tertiary control period, a random load variation is triggered, to show the system adaptation to the load change. Initially, the VSC set is static and connected, see Fig. 6(a), the power injection is proportionally shared among DERs and the voltage is kept at the reference value vref . Fig. 6(b) shows the case when communication of DER 2 is jammed by an external attacker and VSC communication graph is split in two sub-sets {1, 4, 5} and {2}, resulting in unbalanced power SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 7 385 Voltage [V] PTCh 380 Currents [A] 375 10 1 2 3 2 3 5 0 1 Iterations of tertiary control Fig. 7: Realization when the DVSSSs selection is applied to counteract DoS. TABLE III: Comparison of metrics. (a) corresponds to the simulation of Fig. 6 and (b) to the one of Fig. 7. (a) Iteration 1 2 3 J cq 2.5 × 10−3 1.3 × 10−3 3.3 × 10−4 (b) J s c [A] 0 0 0 Iter. 1 2 3 J cq 2.5 × 10−3 1.3 × 10−3 3.3 × 10−4 J s c [A] 9.28 9.60 4.80 sharing. In particular, observe that DER 2 becomes isolated and prevented to participate to the consensus, injecting more current than required and causing the other three VSC DERs to compensate the error. We report in Table III the value of the metrics that express the secondary control sub-optimality and quality, respectively J sc ampere and J cq at the beginning of a tertiary control period, when the steady state is reached. Table III(a), that corresponds to the simulation of Fig. 6(a), shows that the secondary control cost is J sc = 0 in each period, since iv = iv?, ∀v ∈ V. Table III(b) corresponds to the simulation of Fig. 6(b), and shows how the graph split reflects in a positive J sc . The results clearly motivate the need of a dynamic selection algorithm for the DERs’ operating mode. Fig. 7 reports the simulation of the same process when we apply the proposed DVSSS algorithm. The VSC set, V = {1, 2, 4, 5}, is split by the attacker, but the information exchange over PTCh permits the execution of DVSSS algorithm and the establishment of a new connected set V = {1, 4, 5, 7}, excluding DER 2 from the active controllers and restoring the wireless network connectivity. In the second iteration of the DVSSS, a new set V = {3, 6, 8} is established, since it provides the lowest J cq in that tertiary control period. Compared to Fig. 6(b), the algorithm reduces the cost J sc to zero in each iteration as well as decreases J cq to 1.7 × 10−4 , 5.7 × 10−4 , 1.9 × 10−6 . The figure also shows a sample of the period when power talk takes place, which includes a CSMA phase of duration T c and a contention-free phase of duration T cf . 3) DVSSS and control quality improvement: In this scenario, the wireless network graph G is composed of ω ≥ 1 static subgraphs, and the vector of generated power, P M , is stochastic. We run Alg. 1 over 1000 realizations of P M . In Fig. 8(a) we show a histogram of the sets selected by different iterations of the algorithm, depending on P M , and in Fig. 8(b) the probability that J cq is lower than a target value x, obtained by the DVSSS and by the static selection. The results show that a dynamic selection provides an increased system reliability with respect to the cost function J cq , because J cq is lower than pabs in 99.9% of the cases. Secondly, we observe that there are cases in which the static selection outperforms the dynamic selection: the reason is that Alg. 1 selects the set with lowest cardinality that provides the target J cq , which is not necessarily the one that provides the lowest J cq . Finally, it is interesting to observe that, thanks to the presence of the power talk interface, the algorithm does not always select the VSC set in the subgraph Uω = {1, 2, 4, 5, 7}, but also in Uω = {3, 6, 8}. Finally, we verify that the proposed DVSSS improves J cq in general, by simulating random wireless network topologies, while keeping the same electrical parameters. For each G, that is not necessarily connected, we create 1000 realizations of P M and power demand Pd and then compare the statistics of DVSSS compared to a static system; for the static selection we used V that is the most frequently occurring in the DVSSS case. We generate 20 graphs according to this procedure (graph labeled with 1 is the one of Fig. 5(b)) and report a boxplot in Fig. 9 that indicates median value, lower and upper quartiles and outlier values (outside the upper quartile) of J cq . The figure shows that the proposed algorithm improves the statistics of J cq , by finding sets VSC sets that provide J cq < pabs in most of the cases, except for the case labeled with 17. The reason is that this graph is split in 4 subgraphs, limiting the possible solutions of Alg. 1, and making the consensus-based control ineffective. The occurrence of this graph warrants further investigation what kind of topologies should be used in order to avoid vast inefficiency. VII. C ONCLUSION Motivated by the limitations of the state-of-art distributed secondary control schemes, we have presented a new cyberpysical architecture tailored for DC MG and exploiting the communication potential residing in the MG electrical equipment. We have shown that the proposed framework improves the security (robustness against DoS attacks) and control quality (selection of a VSCs set that optimizes a pre-defined metric). Its cost, quantified as the duration of suspension of the secondary control to permit the information exchange over power talk, is kept low by sending a minimal amount of information over this interface. Furthermore, this framework promotes the active participation of the MG control in the management of the supporting communication network: the wireless network graph and the control mode are jointly adapted according to the control/communication variations. As a future work, it is interesting to study the topologies that can benefit most from dynamic reconfiguration and based on that, create suitable recommendations for topology deployment, both for the electrical and the wireless part. Finally, the proposed architecture is sufficiently general to support additional applications. For example, the information sent over the data plane, i.e., the wireless network, can be Frequency [%] SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) 8 {1,2,4,5} {1,2,4} {1,2,5} {1,2,4,5,7} {1,2} {3,6,8} 0.15 0.1 0.05 0 VSC set (a) 1 0.9 VSSS algorithm Static selection p abs 0.8 0.7 0 0.01 0.05 0.1 0.15 0.2 (b) Fig. 8: Application of the proposed selection algorithm to the grid of the case study. (a) Relative frequencies of V sets selected by Alg. 1. (b) Comparison of the probability of obtaining a J cq lower than a target value, with the solution provided by DVSSS and the static selection. J cq 1 0.5 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Graph (a) J cq 0.1 0.05 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Graph (b) Fig. 9: Boxplots representing the statistics of J cq in case of (a) static configuration of V and (b) when DVSSS is used. encrypted, and the encryption keys be exchanged over the network control plane, to make the data plane traffic decodable only by the PECs, which are the intended users. This implies that MG control layer is not delegating the task of securing the information to the communication interface, but actively contributes to the improvement of the security. R EFERENCES [1] L. Meng, Q. Shafiee, G. F. Trecate, H. Karimi, D. Fulwani, X. Lu, and J. M. Guerrero, “Review on control of dc microgrids,” IEEE Journal of Emerging and Selected Topics in Power Electronics, 2017. [2] L. E. Zubieta, “Are microgrids the future of energy?: Dc microgrids from concept to demonstration to deployment,” IEEE Electrification Magazine, vol. 4, no. 2, pp. 37–44, June 2016. [3] T. Dragičević, X. Lu, J. C. Vasquez, and J. M. Guerrero, “Dc microgrids; part i: A review of control strategies and stabilization techniques,” IEEE Transactions on Power Electronics, vol. 31, no. 7, pp. 4876–4891, July 2016. [4] J. M. Guerrero, J. C. Vasquez, J. Matas, L. G. De Vicuña, and M. Castilla, “Hierarchical control of droop-controlled ac and dc microgrids - a general approach toward standardization,” IEEE Transactions on Industrial Electronics, vol. 58, no. 1, pp. 158–172, 2011. [5] Q. Shafiee, T. Dragičević, P. Popovski, J. C. Vasquez, J. M. Guerrero et al., “Robust networked control scheme for distributed secondary control of islanded microgrids,” IEEE Transactions on Industrial Electronics, vol. 61, no. 10, pp. 5363–5374, 2014. [6] P. Danzi, Č. Stefanović, L. Meng, J. M. Guerrero, and P. Popovski, “On the impact of wireless jamming on the distributed secondary microgrid control,” in 2016 IEEE Globecom Workshops, Dec 2016, pp. 1–6. [7] L. Che, M. E. Khodayar, and M. Shahidehpour, “Adaptive protection system for microgrids: Protection practices of a functional microgrid system.” IEEE Electrification magazine, vol. 2, no. 1, pp. 66–80, 2014. [8] P. Danzi, M. Angjelichinoski, Č. Stefanović, and P. Popovski, “Antijamming strategy for distributed microgrid control based on power talk communication,” in Communications Workshops (ICC Workshops), 2017 IEEE International Conference on. IEEE, 2017, pp. 911–917. [9] D. Kreutz, F. M. Ramos, P. E. Verissimo, C. E. Rothenberg, S. Azodolmolky, and S. Uhlig, “Software-defined networking: A comprehensive survey,” Proceedings of the IEEE, vol. 103, no. 1, pp. 14–76, 2015. [10] M. Angjelichinoski, Č. Stefanović, P. Popovski, H. Liu, P. C. Loh, and F. Blaabjerg, “Power talk: How to modulate data over a dc micro grid bus using power electronics,” in 2015 IEEE Global Communications Conference (GLOBECOM), Dec 2015, pp. 1–7. [11] M. Angjelichinoski, Č. Stefanović, P. Popovski, H. Liu, P. C. Loh, and F. Blaabjer, “Multiuser communication through power talk in dc microgrids,” IEEE Journal on Selected Areas in Communications, vol. PP, no. 99, pp. 1–1, 2016. [12] Č. Stefanović, M. Angjelichinoski, P. Danzi, and P. Popovski, “Resilient and secure low-rate connectivity for smart energy applications through power talk in dc microgrids,” IEEE Communications Magazine, vol. 55, no. 10, pp. 83–89, 2017. [13] P. Wang, X. Lu, X. Yang, W. Wang, and D. Xu, “An improved distributed secondary control method for dc microgrids with enhanced dynamic current sharing performance,” IEEE Transactions on Power Electronics, vol. 31, no. 9, pp. 6658–6673, 2016. [14] S. T. Cady, A. D. Domínguez-García, and C. N. Hadjicostis, “A distributed generation control architecture for islanded ac microgrids,” IEEE Transactions on Control Systems Technology, vol. 23, no. 5, pp. 1717–1735, 2015. [15] T. Morstyn, B. Hredzak, G. D. Demetriades, and V. G. Agelidis, “Unified distributed control for dc microgrid operating modes,” IEEE Transactions on Power Systems, vol. 31, no. 1, pp. 802–812, 2016. [16] H. Liang, B. J. Choi, W. Zhuang, and X. Shen, “Stability enhancement of decentralized inverter control through wireless communications in microgrids,” IEEE Transactions on Smart Grid, vol. 4, no. 1, pp. 321– 331, 2013. [17] H. Liang, B. J. Choi, A. Abdrabou, W. Zhuang, and X. S. Shen, “Decentralized economic dispatch in microgrids via heterogeneous wireless networks,” IEEE Journal on Selected Areas in Communications, vol. 30, no. 6, pp. 1061–1074, July 2012. [18] T. Dragičević, J. M. Guerrero, J. C. Vasquez, and D. Škrlec, “Supervisory control of an adaptive-droop regulated dc microgrid with battery management capability,” IEEE Transactions on Power Electronics, vol. 29, no. 2, pp. 695–706, 2014. [19] L. Meng, T. Dragicevic, J. Roldán-Pérez, J. C. Vasquez, and J. M. Guerrero, “Modeling and sensitivity study of consensus algorithm-based distributed hierarchical control for dc microgrids,” IEEE Transactions on Smart Grid, vol. 7, no. 3, pp. 1504–1515, 2016. [20] S. Xia, X. Luo, K. W. Chan, M. Zhou, and G. Li, “Probabilistic transient stability constrained optimal power flow for power systems with multiple correlated uncertain wind generations,” IEEE Transactions on Sustainable Energy, vol. 7, no. 3, pp. 1133–1144, 2016. [21] R. Tarjan, “Depth-first search and linear graph algorithms,” SIAM journal on computing, vol. 1, no. 2, pp. 146–160, 1972. [22] M. Angjelichinoski, Č. Stefanović, P. Popovski, and F. Blaabjerg, “Power talk in dc micro grids: Constellation design and error probability SUBMITTED TO IEEE TRANSACTIONS ON SMART GRID (2018) performance,” in 2015 IEEE International Conference on Smart Grid Communications (SmartGridComm), Nov 2015, pp. 689–694. 9
3cs.SY
UNSUPERVISED DIFFUSION-BASED LMS FOR NODE-SPECIFIC PARAMETER ESTIMATION OVER WIRELESS SENSOR NETWORKS Jorge Plata-Chaves, Mohamad Hasan Bahari, Marc Moonen, Alexander Bertrand arXiv:1510.00984v1 [cs.SY] 4 Oct 2015 Department of Electrical Engineering-ESAT, STADIUS, KU Leuven, B-3001 Leuven, Belgium E-mails: {jplata, mohamadhasan.bahari, marc.moonen, alexander.bertrand}@esat.kuleuven.be ABSTRACT We study a distributed node-specific parameter estimation problem where each node in a wireless sensor network is interested in the simultaneous estimation of different vectors of parameters that can be of local interest, of common interest to a subset of nodes, or of global interest to the whole network. We assume a setting where the nodes do not know which other nodes share the same estimation interests. First, we conduct a theoretical analysis on the asymptotic bias that results in case the nodes blindly process all the local estimates of all their neighbors to solve their own node-specific parameter estimation problem. Next, we propose an unsupervised diffusionbased LMS algorithm that allows each node to obtain unbiased estimates of its node-specific vector of parameters by continuously identifying which of the neighboring local estimates correspond to each of its own estimation tasks. Finally, simulation experiments illustrate the efficiency of the proposed strategy. Index Terms— Distributed node-specific parameter estimation, wireless sensor networks, diffusion algorithm, adaptive clustering. 1. INTRODUCTION In most distributed estimation problems, it is generally assumed that the nodes in a wireless sensor network (WSN) are interested in the same network-wide signal or parameter (e.g. [1]-[5]). However, some applications such as speech enhancement in acoustic sensor networks [6]-[8], beamforming [9], or cooperative spectrum sensing in cognitive radio networks [10]-[11] are multi-task oriented. In these cases, special attention is required to more general distributed estimation techniques where the nodes cooperate although they have different but still partially-overlapping estimation interests and their observations may arise from different models. In the growing literature on node-specific parameter estimation (NSPE) problems over adaptive WSNs, two major groups of works can be identified. The first group assumes that all nodes know a priori the relationship between their estimation tasks and the estimation tasks of their neighbors. Within this category, the aforemenThis work was carried out at the ESAT Laboratory of KU Leuven, in the frame of KU Leuven Research Council CoE PFV/10/002 (OPTEC) and BOF/STG-14-005, Concerted Research Action GOA-MaNet, the Interuniversity Attractive Poles Programme initiated by the Belgian Science Policy Office IUAP P7/23 ‘Belgian network on stochastic modeling analysis design and optimization of communication systems’ (BESTCOM) 2012-2017, Research Project FWO nr. G.0763.12 ‘Wireless Acoustic Sensor Networks for Extended Auditory Communication’, and EU/FP7 project HANDiCAMS. The project HANDiCAMS acknowledges the financial support of the Future and Emerging Technologies (FET) programme within the Seventh Framework Programme for Research of the European Commission, under FETOpen grant number: 323944. The scientific responsibility is assumed by its authors. K" k" q qTo q1o o k 1" q o2 2" l q 3o Fig. 1. A wireless network of K nodes with NSPE interests. tioned prior information is leveraged to derive strategies that provide asymptotically unbiased solutions in an NSPE setting where the nodes have both overlapping and arbitrarily different estimation interests [12]-[16]. Additionally, this prior information is leveraged by different diffusion-based algorithms that apply different spatial regularizers to let each node solve its estimation task by using the local estimates of neighboring nodes with numerically similar estimation interests [17]-[18]. To avoid the bias that results from the combination of local estimates associated with different tasks [19]-[20], the second group of algorithms implement an inference algorithm together with an adaptive clustering technique that allows the nodes to infer which of their neighbors have the same interest [20]-[24]. However, since the proposed strategies run over diffusion networks where each node is only interested in one vector of parameters, the cooperation is finally limited to nodes that have exactly the same objectives once the clustering technique has converged. To the best of our knowledge, there are no unsupervised strategies that solve an NSPE problem where the nodes simultaneously estimate parameter vectors of local, common and/or global interest and where there is no prior information about the relationship between the NSPE tasks. Motivated by this fact, we propose an unsupervised diffusion-based LMS for NSPE with combination coefficients determined through a multi-task clustering technique in an adaptive fashion. In this clustering technique, each node solves a hypothesis testing problem to determine which of the local estimates of its neighbors correspond to each of its estimation tasks. Unlike the existing algorithms [20]-[24], the proposed scheme can yield asymptotically unbiased solutions and allows a beneficial cooperation among the nodes although they have different interests. Indeed, due to the exponential rate of decay for the probabilities of erroneous clustering, as the computer simulations show, the proposed scheme achieves the same steady-state mean square deviation (MSD) as the diffusion-based NSPE LMS (D-NSPE) algorithm that knows a priori the relationship between the node-specific tasks. 2. PROBLEM FORMULATION We consider a network consisting of K nodes randomly deployed over some region. Nodes that are able to exchange information in one hop are said to be neighbors. The neighborhood of any particular node k, including node k itself, is denoted as Nk . To ensure that the network is connected (see Fig. 1), the neighborhoods are set so that there is a path between any pair of nodes in the network. In the considered network, each node k, at discrete time i, has access to data {dk,i , Uk,i }, which are realizations related to events that coexist in the monitored area and which follow the relation dk,i = Uk,i wko + vk,i (1) where - wko equals the vector of dimension Mk that gathers all parameters of interest for node k, - vk,i denotes measurement and/or model noise with zero mean and covariance matrix Rvk ,i of dimensions Lk × Lk , - dk,i and Uk,i are zero-mean random variables with dimensions Lk × 1 and Lk × Mk , respectively. By processing the data set {dk,i , Uk,i }K k=1 , the objective of the network consists in finding the node-specific estimators {wk }K k=1 that minimize the following cost function Jglob ({wk }K k=1 ) = K X  E kdk,i − Uk,i wk k2 . (2) k=1 Unlike in papers addressing a single-task estimation problem, e.g., [3]-[4], here the parameter estimation interests may vary from node to node in (1), i.e., wko 6= w`o if k 6= `. Indeed, following the novel node-specific observation model considered in [14], [16], it is assumed that each node-specific vector wko may consist of a sub-vector of parameters of global interest to the whole network, sub-vectors of parameters of common interest to subsets of nodes including node k, and a sub-vector of local parameters for node k. In particular, it is considered that wko = col{qot }t∈Tk (3) where col{·} denotes a column operator stacking arguments on top of each other and where qot denotes an (Mt ×1) vector of parameters associated with the global, common or local estimation task t and where Tk equals an ordered set of indices t associated with the nk = o |T Pk | vectors qt that are of interest for node k. It is noted that Mk = M and that Tk ∈ T where T is the set of all parameter t t∈Tk estimation tasks in the entire network. As a result, the observation model in (1) can now be rewritten as X dk,i = Ukt ,i qot + vk,i (4) t∈Tk where Ukt ,i , equals a matrix of dimensions Lk × Mt that consists of the columns of Uk,i associated with qot . From (4), also note that the considered NSPE problem can be cast as minimizing K X k=1 E kdk,i − X Ukt ,i qt k2 (5) t∈Tk with respect to variables {qt }t∈T . The algorithms derived in [14] and [16] yield unbiased estimates of the node-specific vector of parameters by seeking the minimizer of the cost function in (5) under an incremental or diffusion mode of cooperation, respectively. However, to do so, each node should know a priori which of its neighbors share the same parameter estimation interests, i.e., are interested in estimating {qot }t∈Tk . Unfortunately, this prior information is not available in many scenarios. In this paper, we consider the more challenging problem of deriving a diffusion-based LMS algorithm that is able to solve the NSPE problem stated in (5) when the nodes do not know a priori which of their neighbors share the same NSPE interests. 3. PERFORMANCE OF THE D-NSPE LMS IN A SETTING WITH UNKNOWN RELATIONSHIPS BETWEEN TASKS In this section, in order to motivate the derivation of the proposed algorithm, we briefly analyze the performance of the diffusion-based solution derived in [16] when a node does not know which of the local estimates of its neighbors correspond to each of its tasks. For the sake of an easy exposition and without loss of generality, we assume that Mt = M for all t ∈ T . In brief, the D-NSPE LMS algorithm [16] is able to minimize (5) by implementing the following recursion at each node k:  Adaptation step. For each task  h t ∈ Tk execute i   (i−1)  ψ (i) = φ(i−1) + µ UH d − P k k,i kt ,i k,t k,t p∈Tk Ukp ,i φk,p  Combination step. For each task t ∈ Tk execute   P P  (i) (i) φk,t = `∈Nk p∈T` ck`,tp (i)ψ `,p . (6) (i) where φk,t is the local estimate of qot at node k and time instant i and {ck`,tp (i)} are time-varying convex combination coefficients that satisfy  ck`,tp (i) > 0 if ` ∈ Nk ∩ Ct and p = t, (7) ck`,tp (i) = 0 otherwise. and X X ck`,tp (i) = 1 (8) `∈Nk p∈T` with Ct denoting the set of nodes interested in estimating qot . Note that there are several policies to select the combination coefficients. On the one hand, the combination rule can be static, e.g., as in the uniform, Metropolis or relative-degree rule [25]. On the other hand, the coefficients can be adapted over time (e.g, see [21]). Independently of the selected combination policy, from (6) and (7), it can be noticed that the combination step associated with the estimation of qot at node k can only process local estimates of the same vector of parameters, i.e., p = t, transmitted by neighboring nodes, i.e., ` ∈ Nk . This particular constraint on the set of possible combination policies ensures asymptotical unbiasedness [16], i.e., (i) (i) (i) limi→∞ E{q̃ k,t } = 0 with q̃k,t = qot − col{φk,t }t∈Tk and wko defined in (3). However, it requires each node to know a priori which of the local estimates exchanged by its neighbors correspond to each of its parameter estimation tasks. When the nodes do not know a priori the relationship between the tasks, each node could implement a stand-alone LMS to solve its NSPE problem, which is equivalent to the implementation of (6)(8) with ckk,tt (i) = 1. Although this approach would again allow to find unbiased estimates of the node-specific vector of parameters that minimize (5), the nodes cannot take advantage of the well-known benefits provided by the cooperation. Alternatively, each node could blindly fuse all the local estimates exchanged by all its neighbors, which yields an implementation of (6) where the convex combination coefficients satisfy (8) and  ck`,tp (i) = αk`,tp > 0 if ` ∈ Nk , (9) ck`,tp (i) = 0 otherwise. 9" 3" 4" 5" 1" with αk`,tp equal to a positive constant for all k ∈ {1, 2, . . . , K}, ` ∈ Nk , t ∈ Tk and p ∈ T` . However, under this approach the estimates at the nodes will be biased. In particular, assuming that A1) vk,i is temporally and spatially white noise that is independent of U`,i0 for all ` and i0 , with k, ` ∈ {1, 2, . . . , K}. A2) Uk,i is temporally stationary, white and spatially independent with RUk = E{Uk,i UH k,i }; A3) Ukt ,i and Ukp ,i are independent for all k ∈ {1, 2, . . . , K} and t 6= p, the asymptotic bias of the estimates resulting from this cooperative approach is given by the following theorem (the proof is omitted due to space constraints). 7" (a) :"q#okl :"qo " 11 :"qo12" :"qo13" 6# 10# 9# 3# 4# 5# 1# 8# 2# 7# (10) (b) then the estimates generated by the D-NSPE LMS algorithm summarized in (6) converge in the mean when the convex combination coefficients satisfy (8) and (9). Furthermore, the estimation bias in the steady-state tends to  −1 (11) E{q̃(∞) } = I − C̆[I − M D] [I − C̆] qo (i) K o o with q̃ = col{col{q̃k,t }t∈Tk }K k=1 , q = col{col{qt }t∈Tk }k=1 K K D = diag{RUk }k=1 , M = diag{µk IMk }k=1 and C̆ = C ⊗ IM (i) where T  C = c1,T1 (1) · · · c1,T1 (n1 ) c2,T2 (1) · · · cK,TK (nK )  and ck,Tk (t) = col {col{ck`,Tk (t)p }p∈T` }K `=1 . 8" 2" Theorem 1. For any initial conditions and under assumptions A1A3, if the positive step-size of each node satisfies µk < 2/λmax ({RUkt }t∈Tk ), 6" 10" (12) Fig. 2. Topology with all the initial cooperation links (a) and the resulting cooperation links after multi-task clustering (b). (i) where ς k,t denotes the estimate of qot resulting from the noncooperative LMS performed by node k at time instant i with t ∈ Tk . Following similar arguments to [22], for sufficiently small step sizes, i.e., µk  1, and after sufficient iterations, i.e., i → ∞, it (i) (i) can be shown that the difference between ς k,t and ς `,p follows a Gaussian distribution: (i) (i) ς k,t − ς `,p ∼ N(qot − qop , µmax ∆k`,tp ) (14) From Theorem 1, we can deduce that the steady-state MSD in the estimation of qot at node k, i.e., limi→∞ kq̃ik,t k2 , can be very large when node k estimates qot by using a blind convex combination of all the local estimates of all its neighbors. As a result, the attained performance might be worse than the one achieved by the non-cooperative scheme. Note that (11) reduces to zero if ckk,tt = 1 for all k and t ∈ Tk , i.e., the non-cooperative case is indeed unbiased. Next, we will propose a scheme that combines the D-NSPE LMS algorithm and an adaptive multi-task clustering technique to avoid such a performance degradation and still leverage the cooperation among nodes interested in estimating different but overlapping vectors of parameters simultaneously. where µmax = max µk and ∆k`,tp is an M ×M symmetric, positive 4. UNSUPERVISED DIFFUSION-BASED LMS FOR NSPE kς k,t − ς `,p k2 ≷ τk`,tp k semi-definite matrix with k, ` ∈ {1, 2, . . . , K}, t ∈ Tk and p ∈ T` . If both estimates are associated with the same task, which is denoted as qot = qop from now on, from (14) note that with high probability (i) (i) kς k,t − ς `,p k2 = O(µmax ). On the contrary, if the local estimates are associated with different tasks, which will be denoted as qot 6= (i) (i) qop , then kς k,t − ς `,p k2 = O(1) will hold with high probability. (i) Thus, if node ` transmits ς `,p to node k with ` ∈ Nk \ {k} and p ∈ T` , node k can perform a hypothesis test to determine whether (i) the local estimate ς `,p at node ` corresponds to the estimation of the vector of parameters qot with t ∈ Tk : (i) (i) H0 (15) H1 Since the nodes do not know a priori the relationship between the NSPE tasks, they can initially focus on solving the NSPE problem of Section 2 by implementing the non-cooperative strategy. In particular, each agent can implement (6)-(8) with ckk,tt (i) = 1 for all k ∈ {1, 2, . . . , K} and t ∈ Tk , which corresponds to the following stand-alone LMS-type adaptation step i h X (i−1) (i) (i−1) ς k,t = ς k,t + µk UH Ukp ,i ς k,p kt ,i dk,i − (13) p∈Tk where H0 equals the hypothesis qot = qop , H1 denotes the hypothesis qot 6= qop and τk`,tp is a predefined threshold. A similar reasoning to [22] shows that the probabilities of false alarm and misdetection decay at exponential rates, i.e.,  (i)  (i) P kς k,t − ς `,p k2 > τk`,tp | qot = qop ≤ O(e−c1 /µmax ) (16)   (i) (i) P kς k,t − ς `,p k2 < τk`,tp | qot 6= qop ≤ O(e−c2 /µmax ) (17) node k can dynamically infer the set of indices ` ∈ N` and p ∈ T` for which ck`,tp (i) > 0 should be verified. At the same time, these task-specific neighborhoods can be used by each node k to perform the following diffusion-based NSPE strategy for each task t ∈ Tk  h i (i−1)  ψ (i) = φ(i−1) + µk UH dk,i − P kt ,i k,t k,t p∈Tk Ukp ,i φk,p P (i)  φ(i) = ck`,tp (i − 1)ψ . k,t −30 −40 500 1000 1500 2000 Network MSD in qo11 [dB] Network MSD in qok [dB] −20 −10 −20 −30 −40 −50 500 −10 −20 −30 −40 500 1000 1500 1000 1500 2000 Time, i 2000 Network MSD in qo13 [dB] (18) UD−NSPE LMS D−NSPE LMS Non cooperative LMS −10 Time, i Network MSD in qo12 [dB] where c1 , c2 > 0 denotes some positive constants and τk`,tp ∈ (0, dk`,tp ) with dk`,tp = kqto − qpo k2 . Thus, if τk`,tp and µmax are sufficiently small, as i approaches infinity, node k can know with (i) high probability if a local estimate ς `,p at node ` is associated with o the estimation of qt . This information can be used by node k to simultaneously cluster the local estimates of the nodes according to the task that they aim to solve. In particular, from the following set n o (i) (i) N k,t (i) = (`, p) : ` ∈ Nk , p ∈ T` , kς k,t − ς `,p k2 < τk`,tp 0 −10 −20 −30 −40 500 Time, i 1000 1500 2000 Time, i `,p (`,p)∈N k,t (i−1) (19) P where (`,p)∈N k,t (i−1) ck`,tp (i − 1) = 1. This leads to the following algorithm: Unsupervised Diffusion-based LMS for NSPE (UD-NSPE) (0) (0) • Start with any initial guesses ςk,t , φk,t and N k,t (−1) = {(k, t)} for all k ∈ {1, 2, . . . , K} and t ∈ Tk . • At each time i and each node k ∈ {1, 2, . . . , K}: (i) 1. Update ς k,t by executing (13) for each t ∈ Tk . (i) 2. Update φk,t by executing recursion (19) over the set N k,t (i − 1) for each t ∈ Tk . 3. Update the set N k,t (i) for each t ∈ Tk by using (18) (i) with {ς`,p ; ` ∈ Nk , p ∈ T` } from Step 1. Based on the multi-task clustering information resulting from (13) and (18), at each time instant i the proposed UD-NSPE LMS is able to leverage the cooperation among nodes with different but overlapping estimation interests. Despite this fact, from (17), note that UD-NSPE LMS still yields asymptotically unbiased estimates if the limi→∞ µk = 0 for all k ∈ {1, 2, . . . , K}. 5. SIMULATIONS To illustrate the effectiveness of the proposed algorithm, we consider a network formed by K = 10 nodes whose initial topology with all possible cooperation links is shown in Fig. 2(a). The red circles denote the nodes and the colored balls inside represent different tasks within each node. In the considered network, each node k is interested in estimating a vector of global parameters qo11 ∈ R3 and a vector of local parameters qok ∈ R3 with k ∈ {1, . . . , K}, denoted with green and magenta balls, respectively. Additionally, two different vectors of common parameters coexist, i.e., qo12 ∈ R3 and qo13 ∈ R3 , represented by blue and orange balls, respectively. Each entry of the global, common or local vector of parameters is randomly drawn from an uniform distribution defined in the interval (0,1). Moreover, the data observed by node k follows the observation model given in (1) with Lk = 1. Both the the background noise vk,i and the regressors uk,i are independently drawn from a Gaussian Fig. 3. Temporal evolution of the network MSD for the estimation of the different vectors of parameters. distribution that is spatially and temporally independent. In particular, vk,i follows a Gaussian distribution with zero mean and variance σv2k = 10−3 for all k. Similarly, the regressors uk,i are zero mean (1 × 3nk ) random vectors governed by a Gaussian distribution with zero mean and covariance matrix Ruk,i = σu2 k I3nk . The variance σu2 k is randomly chosen in (0, 1) so that the Signal-to-Noise-Ratio (SNR) at each node ranges from 10 dB to 20 dB. Furthermore, each step-size µk is set equal to 4·10−3 and a uniform combination policy has been selected to generate the combination coefficients. Fig. 2(b) shows the estimated cooperation links in the steadystate for one of the experiments. Note that cooperation links between local estimates of the same vector of parameters at different neighboring nodes remain active. On the contrary, cooperation links between local estimates of different vectors of parameters are dropped. For the UD-NSPE algorithm, the D-NSPE algorithm derived in [16] and the non-cooperative LMS, Fig. 3 plots the learning behaviour in terms of the network MSD associated with the estimation of the vectors of global, common and local parameters. To generate each plot, we have averaged the results over 100 randomly initialized independent experiments. Since the multi-task clustering technique correctly determines the links between local estimates of the same vector of parameters at different neighboring nodes, the UD-NSPE algorithm outperforms the non-cooperative LMS and achieves the same steady-state network MSD as the D-NSPE algorithm. 6. CONCLUSION We have considered an NSPE problem where the nodes simultaneously estimate vectors of local, common and global interest in a setting where the nodes do not know a priori which of the local estimates of their neighbors correspond to which estimation task. To solve this problem, we have presented an algorithm based on a diffusion-based NSPE LMS and a multi-task clustering technique that lets each node infer which of the local estimates of its neighbors correspond to each of its own estimation tasks. Unlike the existing schemes, the proposed algorithm can yield unbiased estimates for the NSPE problem while still leveraging the cooperation among nodes with different interests. Finally, the effectiveness of the proposed algorithm has been illustrated through computer simulations. 7. REFERENCES [1] G. Mateos, I. D. Schizas, and G. B. Giannakis, “Distributed recursive least-squares for consensus-based in-network adaptive estimation,” IEEE Transactions on Signal Processing, vol. 57, no. 11, pp. 4583–4588, 2009. [2] A. G. Dimakis, S. Kar, J. M. F. Moura, M. G. Rabbat, and A. Scaglione, “Gossip algorithms for distributed signal processing,” Proceedings of the IEEE, vol. 98, no. 11, pp. 1847– 1864, 2010. [3] C. G. Lopes and A. H. Sayed, “Incremental adaptive strategies over distributed networks,” IEEE Transactions on Signal Processing, vol. 55, no. 8, pp. 4064–4077, 2007. [4] F. S. Cattivelli and A. H. Sayed, “Diffusion LMS strategies for distributed estimation,” IEEE Transactions on Signal Processing, vol. 58, no. 3, pp. 1035–1048, 2010. [5] S. Chouvardas, K. Slavakis, and S. Theodoridis, “Adaptive robust distributed learning in diffusion sensor networks,” IEEE Transactions on Signal Processing, vol. 59, no. 10, pp. 4692– 4707, 2011. [6] S. Doclo, M. Moonen, T. Van den Bogaert, and J. Wouters, “Reduced-bandwidth and distributed mwf-based noise reduction algorithms for binaural hearing aids,” IEEE Transactions on Audio, Speech, and Language Processing, vol. 17, no. 1, pp. 38–51, 2009. [7] A. Bertrand and M. Moonen, “Distributed adaptive nodespecific signal estimation in fully connected sensor networks - part I: Sequential node updating,” IEEE Transactions on Signal Processing, vol. 58, no. 10, pp. 5277–5291, 2010. [8] J. Plata-Chaves, A. Bertrand, and M. Moonen, “Distributed signal estimation in a wireless sensor network with partiallyoverlapping node-specific interests or source observability,” in IEEE 40th International Conference on Acoustics, Speech and Signal Processing, 2015. ICASSP 2015, 2015. [9] A. Bertrand and M. Moonen, “Distributed node-specific LCMV beamforming in wireless sensor networks,” IEEE Transactions on Signal Processing, vol. 60, no. 1, pp. 233–246, 2012. [10] P. Di Lorenzo, S. Barbarossa, and A. H. Sayed, “Bio-inspired swarming for dynamic radio access based on diffusion adaptation,” in IEEE 19th European Signal Conference, 2011. EUSIPCO 2011, 2012, pp. 1–6. [11] P. Di Lorenzo, S. Barbarossa, and A. H. Sayed, “Bio-inspired decentralized radio access based on swarming mechanisms over adaptive networks,” IEEE Transactions on Signal Processing, vol. 61, no. 12, pp. 3183–3197, 2013. [12] V. Kekatos and G. B. Giannakis, “Distributed robust power system state estimation,” IEEE Transactions on Power Systems, vol. 28, no. 2, pp. 1617–1626, 2013. [13] J. Plata-Chaves, N. Bogdanovic, and K. Berberidis, “Distributed incremental-based RLS for node-specific parameter estimation over adaptive networks,” in IEEE 21st European Signal Conference, 2013. EUSIPCO 2013, 2013. [14] N. Bogdanovic, J. Plata-Chaves, and K. Berberidis, “Distributed incremental-based LMS for node-specific adaptive parameter estimation,” IEEE Transactions on Signal Processing, vol. 62, no. 20, pp. 5382–5397, 2014. [15] J. Chen, C. Richard, A. O. Hero III, and A. H. Sayed, “Diffusion LMS for multitask problems with overlapping hypothesis subspaces,” in IEEE International Workshop on Machine Learning for Signal Processing, MLSP 2014, 2014. [16] J. Plata-Chaves, N. Bogdanovic, and K. Berberidis, “Distributed diffusion-based LMS for node-specific parameter estimation over adaptive networks,” IEEE Transactions on Signal Processing, vol. 13, no. 63, pp. 3448–3460, 2015. [17] J. Chen, C. Richard, and A. H. Sayed, “Multitask diffusion adaptation over networks,” Submitted to Transactions on Signal Processing, 2013 [Online]. Available: http://arxiv.org/abs/1311.4894. [18] R. Nassif, C. Richard, A. Ferrari, and Ali H Sayed, “Proximal multitask learning over networks with sparsityinducing coregularization,” Submitted to IEEE Transactions on Signal Processing, 2015 [Online]. Available: http://arxiv.org/abs/1509.01360. [19] J. Chen and A. H. Sayed, “Distributed Pareto-optimal solutions via diffusion adaptation,” in IEEE Statistical Signal Processing Workshop, 2012. SSP 2012., 2012, pp. 648–651. [20] J. Chen, C. Richard, and A. H. Sayed, “Diffusion LMS over multitask networks,” IEEE Transactions on Signal Processing, vol. 63, no. 11, pp. 2733–2748, 2015. [21] X. Zhao and A. H. Sayed, “Clustering via diffusion adaptation over networks,” in 3rd International Workshop on Cognitive Information Processing, 2012. (CIP 2012), 2012, pp. 1–6. [22] X. Zhao and A. H. Sayed, “Distributed clustering and learning over networks,” IEEE Transactions on Signal Processing, vol. 63, no. 13, pp. 3285–3300, 2015. [23] J. Chen, C. Richard, and Sayed A. H., “Adaptive clustering for multi-task diffusion networks,” in IEEE 23rd European Signal Conference, 2015. EUSIPCO 2015, 2015, pp. 2746–2750. [24] S. Khawatmi, A. M. Zoubir, and Sayed A. H., “Decentralized clustering over adaptive networks,” in IEEE 23rd European Signal Conference, 2015. EUSIPCO 2015, 2015, pp. 2746– 2750. [25] A. H. Sayed, “Diffusion adaptation over networks,” To appear in E-Reference Signal Processing, R. Chellapa and S. Theodoridis, Eds., Elsevier, 2013, 2012 [Online]. Available: http://arxiv.org/abs/1205.4220.
3cs.SY
Spatial Interpolants Aws Albargouthi1 , Josh Berdine2 , Byron Cook3 , and Zachary Kincaid4 arXiv:1501.04100v1 [cs.LO] 16 Jan 2015 University of Wisconsin-Madison1 , Microsoft Research2 , University College London3 , University of Toronto4 Abstract. We propose SplInter, a new technique for proving properties of heap-manipulating programs that marries (1) a new separation logic–based analysis for heap reasoning with (2) an interpolation-based technique for refining heap-shape invariants with data invariants. SplInter is property directed, precise, and produces counterexample traces when a property does not hold. Using the novel notion of spatial interpolants modulo theories, SplInter can infer complex invariants over general recursive predicates, e.g., of the form all elements in a linked list are even or a binary tree is sorted. Furthermore, we treat interpolation as a black box, which gives us the freedom to encode data manipulation in any suitable theory for a given program (e.g., bit vectors, arrays, or linear arithmetic), so that our technique immediately benefits from any future advances in SMT solving and interpolation. 1 Introduction Since the problem of determining whether a program satisfies a given property is undecidable, every verification algorithm must make some compromise. There are two classical schools of program verification, which differ in the compromise they make: the static analysis school gives up refutation soundness (i.e., may report false positives); and the software model checking school gives up the guarantee of termination. In the world of integer program verification, both schools are well explored and enjoy cross-fertilization of ideas: each has its own strengths and uses in different contexts. In the world of heap-manipulating programs, the static analysis school is well-attended [10, 12, 14, 35], while the software model checking school has remained essentially vacant. This paper initiates a program to rectify this situation, by proposing one of the first path-based software model checking algorithms for proving combined shape-and-data properties. The algorithm we propose, SplInter, marries two celebrated program verification ideas: McMillan’s lazy abstraction with interpolants (Impact) algorithm for software model checking [25], and separation logic, a program logic for reasoning about shape properties [32]. SplInter (like Impact) is based on a pathsampling methodology: given a program P and safety property ϕ, SplInter constructs a proof that P is memory safe and satisfies ϕ by sampling a finite number of paths through the control-flow graph of P , proving them safe, and then assembling proofs for each sample path into a proof for the whole program. The key technical advance which enables SplInter is an algorithm for spatial interpolation, which is used to construct proofs in separation logic for the sample traces (serving the same function as Craig interpolation for first-order logic in Impact). SplInter is able to prove properties requiring integrated heap and data (e.g., integer) reasoning by strengthening separation logic proofs with data refinements produced by classical Craig interpolation, using a technique we call spatial interpolation modulo theories. Data refinements are not tied to a specific logical theory, giving us a rather generic algorithm and freedom to choose an appropriate theory to encode a program’s data. Fig. 1 summarizes the high-level operation of our algorithm. Given a program with no heap manipulation, SplInter only computes theory interpolants and behaves exactly like Impact, and thus one can thus view SplInter as a proper extension of Impact to heap manipulating programs. At the other extreme, given a program with no data manipulation, SplInter is a new shape analysis that uses path-based relaxation to construct memory safety proofs in separation logic. There is a great deal of work in the static analysis school on shape analysis and on combined shape-and-data analysis, which we will discuss further in Sec. 8. We do not claim superiority over these techniques (which have had the benefit of 20 years of active development). SplInter, as the first member of the software model checking school, is not better ; however, it is fundamentally different. Nonetheless, we will mention two of the features of SplInter (not enjoyed by any previous verification algorithm for shape-and-data properties) that make our approach worthy of exploration: path-based refinement and property-direction. – Path-based refinement: This supports a progress guarantee by tightly correlating program exploration with refinement, and by avoiding imprecision due to lossy join and widening operations employed by abstract domains. SplInter does not report false positives, and produces counterexamples for violated properties. This comes, as usual, at the price of potential divergence. – Property-direction: Rather than seeking the strongest invariant possible, we compute one that is just strong enough to prove that a desired property holds. Property direction enables scalable reasoning in rich program logics like the one described in this paper, which combines separation logic with first-order data refinements. We have implemented an instantiation of our generic technique in the T2 verification tool [37], and used it to prove correctness of a number of programs, partly drawn from open source software, requiring combined data and heap invariants. Our results indicate the usability and promise of our approach. Contributions We summarize our contributions as follows: 1. A generic property-directed algorithm for verifying and falsifying safety of programs with heap and data manipulation. 2. A precise and expressive separation logic analysis for computing memory safety proofs of program paths using a novel technique we term spatial interpolation. 3. A novel interpolation-based technique for strengthening separation logic proofs with data refinements. Spatial(T ) interpolants Path ⇡ from P Program P Property ' Heap prover (spatial interpolants) Path sampler Proof that ⇡ is safe P is safe w.r.t. ' Data prover (T interpolants) No proof found Path violates memory safety Path violates property ' Fig. 1. Overview of SplInter verification algorithm. 4. An implementation and an evaluation of our technique for a fragment of separation logic with linked lists enriched with linear arithmetic refinements. 2 Overview In this section, we demonstrate the operation of SplInter (Fig. 1) on the simple linked list example shown in Fig. 2. We assume that integers are unbounded (i.e., integer values are drawn from Z rather than machine integers) and that there is a struct called node denoting a linked list node, with a next pointer N and an in- 1: int i = nondet(); node* x = null; teger (data) element D. The function nondet() re2: while (i != 0) turns a nondeterministic integer value. This pronode* tmp = malloc(node); gram starts by building a linked list in the loop tmp->N = x; on location 2. The loop terminates if the initial tmp->D = i; value of i is > 0, in which case a linked list of x = tmp; size i is constructed, where data elements D of i--; list nodes range from 1 to i. Then, the loop at 3: while (x != null) location 3 iterates through the linked list assert- 4: assert(x->D >= 0); x = x->N; ing that the data element of each node in the list is > 0. Our goal is to prove that the assertion at location 4 is never violated. Fig. 2. Illustrative Example Sample a Program Path To start, we need a path π through the program to the assertion at location 4. Suppose we start by sampling the path 1,2,2,3,4, that is, the path that goes through the first loop once, and enters the second loop arriving at the assertion. This path is illustrated in Fig. 3 (where 2a indicates the second occurrence of location 2). Our goal is to construct a Hoare-style proof of this path: an annotation of each location along the path with a formula describing reachable states, such that location 4 is annotated with a formula implying that x->D >= 0. This goal is accomplished in two phases. First, we use spatial interpolation to compute a memory safety proof for the path π (Fig. 3(b)). Second, we use theory refinement to strengthen the memory safety proof and establish that the path satisfies the post-condition x->D >= 0 (Fig. 3(c)). Compute Spatial Interpolants The first step in constructing the proof is to find spatial interpolants: a sequence of separation logic formulas approximating the shape of the heap at each program location, and forming a Hoare-style memory safety proof of the path. Our spatial interpolation procedure is a two step process that first symbolically executes the path in a forward pass and then derives a weaker proof using a backward pass. The backward pass can be thought of as an under-approximate weakest precondition computation, which uses the symbolic heap from the forward pass to guide the under-approximation. We start by showing the symbolic heaps in Fig. 3(a), which are the result of the forward pass obtained by symbolically executing only heap statements along this program path (i.e., the strongest postcondition along the path). The separation logic annotations in Fig. 3 follow standard notation (e.g., [14]), where a formula is of the form Π : Σ, where Π is a Boolean first-order formula over heap variables (pointers) as well as data variables (e.g., x = null or i > 0), and Σ is a spatial conjunction of heaplets (e.g., emp, denoting the empty heap, or Z(x, y), a recursive predicate, e.g., that denotes a linked list between x and y). For the purposes of this example, we assume a recursive predicate ls(x, y) that describes linked lists. In our example, the symbolic heap at location 2a is true : x 7→ [d0 , null], where the heap consists of a node, pointed to by variable x, with null in the N field and the (implicitly existentially quantified) variable d0 in the D field (since so far we are only interested in heap shape and not data). The symbolic heaps determine a memory safety proof of the path, but it is too strong and would likely not generalize to other paths. The goal of spatial interpolation is to find a sequence of annotations that are weaker than the symbolic heaps, but that still prove memory safety of the path. A sequence of spatial interpolants is shown in Fig. 3(b). Note that all spatial interpolants are implicitly spatially conjoined with true; for clarity, we avoid explicitly conjoining formulas with true in the figure. For example, location 2 is annotated with true : ls(x, null) ∗ true, indicating that there is a list on the heap, as well as other potential objects not required to show memory safety. We compute spatial interpolants by going backwards along the path and asking questions of the form: how much can we weaken the symbolic heap while still maintaining memory safety? We will describe how to answer such questions in Section 4. Refine with Theory Interpolants Spatial interpolants give us a memory safety proof as an approximate heap shape at each location. Our goal now is to strengthen these heap shapes with data refinements, in order to prove that the assertion at the end of the path is not violated. To do so, we generate a system of Horn clause constraints from the path in some first-order theory admitting interpolation (e.g., linear arithmetic). These Horn clauses carefully encode the path’s data manipulation along with the spatial interpolants, which tell us heap shape at each location along the path. A solution of this constraint system, which can be solved using off-the-shelf interpolant generation techniques (e.g., [26, 34]), is a refinement (strengthening) of the memory safety proof. In this example, we encode program operations over integers in the theory of linear integer arithmetic, and use Craig interpolants to solve the system of int i = nondet(); node* x = null 1 2 assume(i != ); node* tmp = ...; tmp->N = x; tmp->D = i; x = tmp; i-- (a) true : emp x = null : emp + true : ls(x, null) (b) true : emp (c) * true : emp + * assume(i == ) 2a true : x 7! [d0 , null] true : x 7! [d0 , null] true : ls(x, null) true : ls(x, null) ... ... assert(x->D >= assume(x != null) 3 ) 4 true : x 7! [d0 , null] ... ... true : x 7! [d0 , n0 ] true : ls(( ⌫.⌫ > i), x, null) true : ls(( ⌫.⌫ > i), x, null) true : ls(( ⌫.⌫ > 0), x, null) d0 > 0 : x 7! [d0 , n0 ] Fig. 3. Path through program in Fig. 2, annotated with (a) results of forward symbolic execution, (b) spatial interpolants, and (c) spatial(T ) interpolants, where T is linear integer arithmetic. Arrows ⇒ indicate implication (entailment) direction. constraints. A solution of this system is a set of linear arithmetic formulas that refine our spatial interpolants and, as a result, imply the assertion we want to prove holds. One possible solution is shown in Fig. 3(c). For example, location 2a is now labeled with true : ls((λν.ν > i), x, null), where the green parts of the formula are those added by refinement. Specifically, after refinement, we know that all elements in the list from x to null after the first loop have data values greater than or equal to i, as indicated by the predicate (λν.ν > i). (In Section 3, we formalize recursive predicates with data refinements.) Location 4 is now annotated with d0 > 0 : x 7→ [d0 , n0 ] ∗ true, which implies that x->D >= 0, thus proving that the path satisfies the assertion. From Proofs of Paths to Proofs of Programs We go from proofs of paths to whole program proofs implicitly by building an abstract reachability tree as in Impact [25]. To give a flavour for how this works, consider that the assertions at 2 and 2a are identical: this implies that this assertion is an inductive invariant at line 2. Since this assertion also happens to be strong enough to prove safety of the program, we need not sample any longer unrollings of the first loop. However, since we have not established the inductiveness of the assertion at 3, the proof is not yet complete and more traces need to be explored (in fact, exploring one more trace will do: consider the trace that unrolls the second loop once and shows that the second time 3 is visited can also be labeled with true : ls((λν.ν > 0), x, null)). Since our high-level algorithm is virtually the same as Impact [25], we will not describe it further in the paper. For the remainder of this paper, we will concentrate on the novel contribution of our algorithm: computing spatial interpolants with theory refinements for program paths. 3 3.1 Preliminaries Separation Logic We define RSep, a fragment of separation logic formulas featuring points-to predicates and general recursive predicates refined by theory propositions. x, y ∈ HVar (Heap variables) a, b ∈ DVar (Data variables) A ∈ DTerm (Data terms) ϕ ∈ DFormula (Data formulas) Z ∈ RPred (Rec. predicates) θ ∈ Refinement ::= λ~a.ϕ X ⊆ Var ::= x | a E, F ∈ HTerm ::= null | x Æ ::= A | E Π ∈ Pure ::= true | E = E | E 6= E | ϕ |Π ∧Π ~ E) ~ E] ~ | Z(θ, ~ H ∈ Heaplet ::= true | emp | E 7→ [A, Σ ∈ Spatial ::= H | H ∗ Σ P ∈ RSep ::= (∃X. Π : Σ) Fig. 4. Syntax of RSep formulas. Fig. 4 defines the syntax of RSep formulas. In comparison with the standard list fragment used in separation logic analyses (e.g., [3, 13, 27]), the differentiating features of RSep are: (1) General recursive predicates, for describing unbounded pointer structures like lists, trees, etc. (2) Recursive predicates are augmented with a vector of refinements, which are used to constrain the data values appearing on the data structure defined by the predicate, detailed below. ~ E], ~ is a record consisting of (3) Each heap cell (points-to predicate), E 7→ [A, ~ of DTerm) followed by heap fields (a vector E ~ of HTerm). data fields (a vector A ~ and (Notationally, we will use di to refer to the ith element of the vector d, ~ ~ d[t/di ] to refer to the vector d with the ith element modified to t.) (4) Pure formulas contain heap and first-order data constraints. Our definition is (implicitly) parameterized by a first-order theory T . DVar denotes the set of theory variables, which we assume to be disjoint from HVar (the set of heap variables). DTerm and DFormula denote the sets of theory terms and formulas, and we assume that heap variables do not appear in theory terms. For an RSep formula P , Var(P ) denotes its free (data and heap) variables. We treat a Spatial formula Σ as a multiset of heaplets, and consider formulas to be equal when they are equal as multisets. For RSep formulas P = (∃XP . ΠP : ΣP ) and Q = (∃XQ . ΠQ : ΣQ ), we write P ∗ Q to denote the RSep formula P ∗ Q = (∃XP ∪ XQ . ΠP ∧ ΠQ : ΣP ∗ ΣQ ) assuming that XP is disjoint from Var(Q) and XQ is disjoint from Var(P ) (if not, then XP and XQ are first suitably renamed). For a set of variables X, we write (∃X. P ) to denote the RSep formula (∃X. P ) = (∃X ∪ XP . ΠP : ΣP ) Recursive predicates Each recursive predicate Z ∈ RPred is associated with a definition that describes how the predicate is unfolded. Before we formalize these definitions, we will give some examples. The definition of the list segment predicate from Sec. 2 is: ls(R, x, y) ≡ (x = y : emp) ∨ (∃d, n0 . x 6= y ∧ R(d) : x 7→ [d, n0 ] ∗ ls(R, n0 , y)) In the above, R is a refinement variable, which may be instantiated to a concrete refinement θ ∈ Refinement. For example, ls((λa.a > 0), x, y) indicates that there is a list from x to y where every element of the list is at least 0. A refined binary tree predicate is a more complicated example: bt(Q, L, R, x) = (x = null : emp) ∨ (∃d, l, r. Q(d) : x 7→ [d, l, r] ∗ bt((λa.Q(a) ∧ L(d, a)), L, R, l) ∗ bt((λa.Q(a) ∧ R(d, a)), L, R, r)) This predicate has three refinement variables: a unary refinement Q (which must be satisfied by every node in the tree), a binary refinement L (which is a relation that must hold between every node and its descendants to the left), and a binary refinement R (which is a relation that must hold between every node and its descendants to the right). For example, bt((λa.true), (λa, b.a > b), (λa, b.a 6 b), x) indicates that x is the root of a binary search tree, and bt((λa.a > 0), (λa, b.a 6 b), (λa, b.a 6 b), x) indicates that x is the root of a binary min-heap with non-negative elements. To formalize these definitions, we first define refinement terms and refined formulas: a refinement term τ is either (1) a refinement variable R or (2) an abstraction (λa1 , . . . , an .Φ), where Φ is a refined formula. A refined formula is a conjunction where each conjunct is either a data formula (DFormula) or the ~ of a refinement term to a vector of data terms (DTerm). application τ (A) A predicate definition has the form ~ ~x) ≡ (∃X1 . Π1 ∧ Φ1 : Σ1 ) ∨ · · · ∨ (∃Xn . Πn ∧ Φn : Σn ) Z(R, ~ is a vector of refinement variables, ~x is a vector of heap variables, and where R where refinement terms may appear as refinements in the spatial formulas Σi . We refer to the disjuncts of the above formula as the cases for Z, and define ~ ~x)) to be the set of cases of Z. R ~ and ~x are bound in cases(Z(R, ~ ~x)), cases(Z(R, and we will assume that predicate definitions are closed, that is, for each case of ~ the free heap variables belong to ~x, Z, the free refinement variables belong to R, and there are no free data variables. We also assume that they are well-typed in the sense that each refinement term τ is associated with an arity, and whenever ~ appears in a definition, the length of A ~ is the arity of τ . τ (A) Semantics The semantics of our logic, defined by a satisfaction relation s, h |= Q, is essentially standard. Each predicate Z ∈ RPred is defined to be the least solution1 to the following equivalence: ~ E) ~ R, ~ ⇐⇒ ∃P ∈ cases(Z(R, ~ ~x)). s, h |= P [θ/ ~ E/~ ~ x] s, h |= Z(θ, Note that when substituting a λ-abstraction for a refinement variable, we implicitly β-reduce resulting applications. For example, R(b)[(λa.a > 0)/R] = b > 0. Semantic entailment is denoted by P |= Q, and provable entailment by P ` Q. When referring to a proof that P ` Q, we will mean a sequent calculus proof. 1 Our definition does not preclude ill-founded predicates; such predicates are simply unsatisfiable, and do not affect the technical development in the rest of the paper. 3.2 Programs A program P is a tuple hV, E, vi , ve i, where – V is a set of control locations, with a distinguished entry node vi ∈ V and error (exit) node ve ∈ V , and – E ⊆ V × V is a set of directed edges, where each e ∈ E is associated with a program command ec . We impose the restriction that all nodes V \ {vi } are reachable from vi via E, and all nodes can reach ve . The syntax for program commands appears below. Note that the allocation command creates a record with n data fields, D1 , . . . , Dn , and m heap fields, N1 , . . . , Nm . To access the ith data field of a record pointed to by x, we use x->Di (and similarly for heap fields). We assume that programs are well-typed, but not necessarily memory safe. Assignment: x := Æ Heap store: x->Ni := E Heap load: y := x->Ni Assumption: assume(Π ) Data store: x->Di := A Data load: y := x->Di Allocation: x := new(n, m) Disposal: free(x) As is standard, we compile assert commands to reachability of ve . 4 Spatial Interpolants In this section, we first define the notion of spatial path interpolants, which serve as memory safety proofs of program paths. We then describe a technique for computing spatial path interpolants. This algorithm has two phases: the first is a (forwards) symbolic execution phase, which computes the strongest memory safety proof for a path; the second is a (backwards) interpolation phase, which weakens the proof so that it is more likely to generalize. Spatial path interpolants are bounded from below by the strongest memory safety proof, and (implicitly) from above by the weakest memory safety proof. Prior to considering the generation of inductive invariants using spatial path interpolants, consider what could be done with only one of the bounds, in general, with either a path-based approach or an iterative fixed-point computation. Without the upper bound, an interpolant or invariant could be computed using a standard forward transformer and widening. But this suffers from the usual problem of potentially widening too aggressively to prove the remainder of the path, necessitating the design of analyses which widen conservatively at the price of computing unnecessarily strong proofs. The upper bound neatly captures the information that must be preserved for the future execution to be proved safe. On the other hand, without the lower bound, an interpolant or invariant could be computed using a backward transformer (and lower widening). But this suffers from the usual problem that backward transformers in shape analysis explode, due to issues such as not knowing the aliasing relationship in the pre-state. The lower bound neatly captures such information, heavily reducing the potential for explosion. These advantages come at the price of operating over full paths from entry to error. Compared to a forwards iterative analysis, operating over full paths has the advantage of having information about the execution’s past and future when weakening at each point along the path. A forwards iterative anal- ~ ~n}. (Π : Σ)[x0 /x] ∗ x 7→ [d, ~ ~n]) (∃X. Π : Σ)) = (∃X ∪ {x0 , d, 0 ~ ~ where x , d, ~n are fresh, d = (d1 , . . . , dk ), and ~n = (n1 , . . . , nl ). ~ ~n]) = (∃X. Π ∧ Π 6= : Σ) exec(free(x), (∃X. Π : Σ ∗ z 7→ [d, ~ ~n] ` x = z and Π 6= is the where Π : Σ ∗ z 7→ [d, conjunction of all disequalities x 6= y s.t y 7→ [ , ] ∈ Σ. exec(x := new(k, l), exec(x := E, (∃X. Π : Σ)) = (∃X ∪ {x0 }. (x = E[x0 /x]) ∗ (Π : Σ)[x0 /x]) where x0 is fresh. exec(assume(Π 0 ), (∃X. Π : Σ)) = (∃X. Π ∧ Π 0 : Σ) . ~ ~n])) = (∃X. Π : Σ ∗ x 7→ [d, ~ ~n[E/ni ]]) exec(x->Ni := E, (∃X. Π : Σ ∗ z 7→ [d, ~ ~n] ` x = z . where i 6 |~n| and Π : Σ ∗ z 7→ [d, ~ ~n])) = exec(y := x->Ni , (∃X. Π : Σ ∗ z 7→ [d, ~ ~n])[y 0 /y]) (∃X ∪ {y 0 }. (y = ni [y 0 /y]) ∗ (Π : Σ ∗ z 7→ [d, ~ where i 6 |~n| and Π : Σ ∗ z 7→ [d, ~n] ` x = z, and y 0 is fresh. Fig. 5. Symbolic execution for heap statements. Data statements are treated as skips. ysis, on the other hand, trades the information about the future for information about many past executions through the use of join or widening operations. The development in this section is purely spatial: we do not make use of data variables or refinements in recursive predicates. Our algorithm is thus of independent interest, outside of its context in this paper. We use Sep to refer to the fragment of RSep in which the only data formula (appearing in pure assertions and in refinements) is true (this fragment is equivalent to classical separation logic). An RSep formula P , in particular including those in recursive predicate definitions, determines a Sep formula P obtained by replacing all refinements (both variables and λ-abstractions) with (λ~a.true) and all DFormulas in the pure part of P with true. Since recursive predicates, refinements, and DFormulas appear only positively, P is no stronger than any refinement of P . Since all refinements in Sep are trivial, we will omit them from the syntax (e.g., ~ rather than Z((λ~a.true), E)). ~ we will write Z(E) 4.1 Definition We define a symbolic heap to be a Sep formula where the spatial part is a *conjunction of points-to heaplets and the pure part is a conjunction of pointer (dis)equalities. Given a command c and a symbolic heap S, we use exec(c, S) to denote the symbolic heap that results from symbolically executing c starting in S (the definition of exec is essentially standard [3], and is shown in Fig. 5). Given a program path π = e1 , . . . , en , we obtain its strongest memory safety proof by symbolically executing π starting from the empty heap emp. We call this sequence of symbolic heaps the symbolic execution sequence of π, and say that a path π is memory-feasible if every formula in its symbolic execution sequence is consistent. The following proposition justifies calling this sequence the strongest memory safety proof. Proposition 1. For a path π, if the symbolic execution sequence for π is defined, then π is memory safe. If π is memory safe and memory-feasible, then its symbolic execution sequence is defined. Recall that our strategy for proving program correctness is based on sampling and proving the correctness of several program paths (á la Impact [25]). The problem with strongest memory safety proofs is that they do not generalize well (i.e., do not generate inductive invariants). One solution to this problem is to take advantage of property direction. Given a desired postcondition P and a (memory-safe and -feasible) path π, the goal is to come up with a proof that is weaker than π’s symbolic execution sequence, but still strong enough to show that P holds after executing π. Coming up with such “weak” proofs is how traditional path interpolation is used in Impact. In light of this, we define spatial path interpolants as follows: Definition 1 (Spatial path interpolant). Let π = e1 , . . . , en be a program path with symbolic execution sequence S0 , . . . , Sn , and let P be a Sep formula (such that Sn |= P ). A spatial path interpolant for π is a sequence I0 , . . . , In of Sep formulas such that – for each i ∈ [0, n], Si |= Ii ; – for each i ∈ [1, n], {Ii−1 } eci {Ii } is a valid triple in separation logic; and – In |= P . Our algorithm for computing spatial path interpolants is a backwards propagation algorithm that employs a spatial interpolation procedure at each backwards step. Spatial interpolants for a single command are defined as: Definition 2 (Spatial interpolant). Given Sep formulas S and I 0 and a command c such that exec(c, S) |= I 0 , a spatial interpolant (for S, c, and I 0 ) is a Sep formula I such that S |= I and {I} c {I 0 } is valid. Before describing the spatial interpolation algorithm, we briefly describe how spatial interpolation is used to compute path interpolants. Let us use itp(S, c, I) to denote a spatial interpolant for S, c, I, as defined above. Let π = e1 , . . . , en be a program path and let P be a Sep formula. First, symbolically execute π to compute a sequence S0 , . . . , Sn . Suppose that Sn ` P . Then we compute a sequence I0 , . . . , In by taking In = P and (for k < n) Ik = itp(Sk , eck+1 , Ik+1 ). The sequence I0 , . . . , In is clearly a spatial path interpolant. 4.2 Bounded Abduction Our algorithm for spatial interpolation is based on an abduction procedure. Abduction refers to the inference of explanatory hypotheses from observations (in contrast to deduction, which derives conclusions from given hypotheses). The variant of abduction we employ in this paper, which we call bounded abduction, is simultaneously a form of abductive and deductive reasoning. Seen as a variant of abduction, bounded abduction adds a constraint that the abduced hypothesis be at least weak enough to be derivable from a given hypothesis. Seen as a variant of deduction, bounded abduction adds a constraint that the deduced conclusion be at least strong enough to imply some desired conclusion. Formally, we define bounded abduction as follows: Definition 3 (Bounded abduction). Let L, M, R be Sep formulas, and let X be a set of variables. A solution to the bounded abduction problem L ` (∃X. M ∗ [ ]) ` R is a Sep formula A such that L |= (∃X. M ∗ A) |= R. Note how, in contrast to bi-abduction [10] where a solution is a pair of formulas, one constrained from above and one from below, a solution to bounded abduction problems is a single formula that is simultaneously constrained from above and below. The fixed lower and upper bounds in our formulation of abduction give considerable guidance to solvers, in contrast to bi-abduction, where the bounds are part of the solution. Sec. 6 presents our bounded abduction algorithm. For the remainder of this section, we will treat bounded abduction as a black box, and use L ` (∃X. M ∗ [A]) ` R to denote that A is a solution to the bounded abduction problem. 4.3 Computing Spatial Interpolants We now proceed to describe our algorithm for spatial interpolation. Given a command c and Sep formulas S and I 0 such that exec(c, S) ` I 0 , this algorithm must compute a Sep formula itp(S, c, I 0 ) that satisfies the conditions of Definition 2. Several examples illustrating this procedure are given in Fig. 3. This algorithm is defined by cases based on the command c. We present the cases for the spatial commands; the corresponding data commands are similar. Allocate Suppose c is x := new(n, m). We take itp(S, c, I 0 ) = (∃x. A), where A is obtained as a solution to exec(c, S) ` (∃~a, ~z. x 7→ [~a, ~z] ∗ [A]) ` I 0 , and ~a and ~z are vectors of fresh variables of length n and m, respectively. Deallocate Suppose c is free(x). We take itp(S, c, I 0 ) = (∃~a, ~z. I 0 ∗ x 7→ [~a, ~z]), where ~a and ~z are vectors of fresh variables whose lengths are determined by the unique heap cell which is allocated to x in S. Assignment Suppose c is x := E. We take itp(S, c, I 0 ) = I 0 [E/x]. Store Suppose c is x->Ni := E. We take itp(S, c, I 0 ) = (∃~a, ~z. A ∗ x 7→ [~a, ~z]), where A is obtained as a solution to exec(c, S) ` (∃~a, ~z. x 7→ [~a, ~z[E/zi ]]∗[A]) ` I 0 and where ~a and ~z are vectors of fresh variables whose lengths are determined by the unique heap cell which is allocated to x in S. Example 1. Suppose that S is t 7→ [4, y, null] ∗ x 7→ [2, null, null] where the cells have one data and two pointer fields, c is t->N0 := x, and I 0 is bt(t). Then we can compute exec(c, S) = t 7→ [4, x, null] ∗ x 7→ [2, null, null], and then solve the bounded abduction problem exec(c, S) ` (∃a, z1 . t 7→ [a, x, z1 ] ∗ [ ]) ` I 0 . One possible solution is A = bt(x) ∗ bt(z1 ), which yields itp(S, c, I 0 ) = (∃a, z0 , z1 . t 7→ [a, z0 , z1 ] ∗ bt(z1 ) ∗ bt(x)) . y Load Suppose c is y := x->Ni . Suppose that ~a and ~z are vectors of fresh variables ~ and |E| ~ where S is of the form Π : Σ ∗ w 7→ [A, ~ E] ~ and Π : of lengths |A| ~ E] ~ ` x = w (this is the condition under which exec(c, S) is defined, Σ ∗ w 7→ [A, see Fig. 5). Let y 0 be a fresh variable, and define S = (y = zi [y 0 /y]) ∗ (Π : Σ ∗ w 7→ [~a, ~z])[y 0 /y]. Note that S ` (∃y 0 . S) ≡ exec(c, S) ` I 0 . We take itp(S, c, I 0 ) = (∃~a, ~z. A[zi /y, y/y 0 ] ∗ x 7→ [~a, ~z]) where A is obtained as a solution to S ` (∃~a, ~z. x[y 0 /y] 7→ [~a, ~z] ∗ [A]) ` I 0 . Example 2. Suppose that S is y = t : y 7→ [1, null, x] ∗ x 7→ [5, null, null], c is y := y->N1 , and I 0 is y 6= null : bt(t). Then S is y = x ∧ y 0 = t : y 0 7→ [1, null, x] ∗ x 7→ [5, null, null] We can then solve the bounded abduction problem S ` (∃a, z0 , z1 . y 0 7→ [a, z0 , z1 ] ∗ [ ]) ` I 0 A possible solution is y 6= null ∧ y 0 = t : bt(z0 ) ∗ bt(z1 ), yielding itp(S, c, I 0 ) = (∃a, z0 , z1 .z1 6= null∧y = t : bt(z0 )∗bt(z1 )∗y 7→ [a, z0 , z1 ]) . y Assumptions The interpolation rules defined up to this point cannot introduce recursive predicates, in the sense that if I 0 is a *-conjunction of points-to predicates then so is itp(S, c, I 0 ).2 A *-conjunction of points-to predicates is exact in the sense that it gives the full layout of some part of the heap. The power of recursive predicates lies in their ability to be abstract rather than exact, and describe only the shape of the heap rather than its exact layout. It is a special circumstance that {P } c {I 0 } holds when I 0 is exact in this sense and P is not: intuitively, it means that by executing c we somehow gain information about the program state, which is precisely the case for assume commands. For an example of how spatial interpolation can introduce a recursive predicate at an assume command, consider the problem of computing an interpolant itp(S, assume(x 6= null), (∃a, z. x 7→ [a, z] ∗ true)) where S ≡ x 7→ [d, y] ∗ y 7→ [d0 , null]: a desirable interpolant may be ls(x, null) ∗ true. The disequality introduced by the assumption ensures that one of the cases of the recursive predicate ls(x, null) (where the list from x to null is empty) is impossible, which implies that the other case (where x is allocated) must hold. Towards this end, we now define an auxiliary function intro which we will use to introduce recursive predicates for the assume interpolation rules. Let P, Q be ~ be a vector Sep formulas such that P ` Q, let Z be a recursive predicate and E ~ P, Q) as follows: if P ` (∃∅. Z(E) ~ ∗ [A]) ` Q of heap terms. We define intro(Z, E, ~ ~ has a solution and A 0 Q, define intro(Z, E, P, Q) = Z(E) ∗ A. Otherwise, define ~ P, Q) = Q. intro(Z, E, ~ and Intuitively, the abduction problem has a solution when P implies Z(E) ~ Z(E) can be excised from Q. The condition A 0 Q is used to ensure that the 2 But if I 0 does contain recursive predicates, then itp(S, c, I 0 ) may also. ~ excision from Q is non-trivial (i.e., the part of the heap that satisfies Z(E) “consumes” some heaplet of Q). To define the interpolation rule for assumptions, suppose c is assume(E 6= ~ i i}i6n be an F) (the case of equality assumptions is similar). Letting {hZi , E ~ we define a enumeration of the (finitely many) possible choices of Z and E, formula M to be the result of applying intro to I 0 over all possible choices of Z ~ and E: ~ 1 , S ∧ E 6= F, intro(Z2 , E ~ 2 , S ∧ E 6= F, . . . )) M = intro(Z1 , E ~ n , S ∧E 6= where the innermost occurrence of intro in this definition is intro(Zn , E 0 F, I ). Since intro preserves entailment (in the sense that if P ` Q then P ` ~ P, Q)), we have that S ∧E 6= F ` M . From a proof of S ∧E 6= F ` M , intro(Z, E, we can construct a formula M 0 which is entailed by S and differs from M only in that it renames variables and exposes additional equalities and disequalities implied by S, and take itp(S, c, I 0 ) to be this M 0 . The construction of M 0 from M is straightforward but tedious. The procedure is detailed in Appendix D ; here, we will just give an example to give intuition on why it is necessary. Suppose that S is x = w : y 7→ z and I 0 is ls(w, z), and c is assume(x = y ). Since there is no opportunity to introduce new recursive predicates in I 0 , M is simply ls(w, z). However, M is not a valid interpolant since S 6|= M , so we must expose the equality x = w and rename w to y in the list segment in M 0 ≡ x = w : ls(y, z). In practice, it is undesirable to enumerate all possible choices of Z and ~ when constructing M (considering that if there are k in-scope data terms, E ~ A a recursive predicate of arity n requires enumerating k n choices for E). reasonable heuristic is to let Π be the strongest pure formula implied by S, ~ such that there is some and enumerate only those combinations of Z and E ~ x] ∧ Π ∧ x 6= y is unsatisfiable. For ~ ~x)) such that Π 0 [E/~ Π 0 : Σ 0 ∈ cases(Z(R, example, for assume(x 6= y), this heuristic means that we enumerate only hx, yi and hy, xi (i.e, we attempt to introduce a list segment from x to y and from y to x). We conclude this section with a theorem stating the correctness of our spatial interpolation procedure. Theorem 1. Let S and I 0 be Sep formulas and let c be a command such that exec(c, S) ` I 0 . Then itp(S, c, I 0 ) is a spatial interpolant for S, c, and I 0 . 5 Spatial Interpolation Modulo Theories We now consider the problem of refining (or strengthening) a given separation logic proof of memory safety with information about (non-spatial) data. This refinement procedure results in a proof of a conclusion stronger than can be proved by reasoning about the heap alone. In view of our example from Fig. 3, this section addresses how to derive the third sequence (Spatial Interpolants Modulo Theories) from the second (Spatial Interpolants). The input to our spatial interpolation modulo theories procedure is a path π, a separation logic (Sep) proof ζ of the triple {true : emp} π {true : true} (i.e., Entailment rules Star C0 I Π ∧ Φ : Σ0 ` Π 0 ∧ Φ0 : Σ00 C1 I Π ∧ Φ : Σ1 ` Π 0 ∧ Φ0 : Σ10 C0 ; C1 I Π ∧ Φ : Σ0 ∗ Σ1 ` Π 0 ∧ Φ0 : Σ00 ∗ Σ10 Points-to Π |= Π 0 ~ F ~ ] ` Π 0 ∧ Φ0 : E 7→ [A, ~ F ~] Φ0 ← Φ I Π ∧ Φ : E 7→ [A, Fold ~ E/~ ~ x] C I Π : Σ ` Π 0 : Σ 0 ∗ P [~τ /R, ~ ~ P ∈ cases(Z(R, x)) 0 0 ~ C I Π : Σ ` Π : Σ ∗ Z(~τ , E) Unfold ~ E/~ ~ x] ` Π 0 : Σ 0 C1 I Π : Σ ∗ P1 [~τ /R, ··· ~ E/~ ~ x] ` Π 0 : Σ 0 Cn I Π : Σ ∗ Pn [~τ /R, {P1 , . . . , Pn } = 0 0 ~ ~ ~ cases(Z(R, x)) C1 ; . . . ; Cn I Π : Σ ∗ Z(~τ , E) ` Π : Σ Predicate Π |= Π 0 Where τi = (λ~ai .Ψi ) 0 0 ai .Ψi0 ) Φ0 ← Φ; Ψ10 ← Ψ1 ∧ Φ; . . . ; Ψ|~ τ | ∧ Φ I and τi = (λ~ τ | ← Ψ|~ ~ ` Π 0 ∧ Φ0 : Z(τ~0 , E) ~ Π ∧ Φ : Z(~τ , E) Execution rules Free ~ E] ~ C I P ` Π ∧ Φ : Σ ∗ x 7→ [A, Data-Assume C I P ∧ϕ`Q C I {P } assume(ϕ) {Q} Sequence b C0 I {P } π0 {O} C I {P } free(x) {Π ∧ Φ : Σ} b π1 {Q} C1 I {O} C0 ; C1 I {P } π0 ; π1 {Q} Data-Load C1 b:Σ b ∗ x 7→ [A, ~ E]) ~ C0 I P ` (∃X. Π ∧ Φ 0 0 0 0 b b ~ E])[a ~ I (∃X, a . Π[a /a] ∧ Φ[a /a] ∧ a = Ai [a /a] : (Σ ∗ x 7→ [A, /a]) ` Q 0 C0 ; C1 I {P } a := x->Di {Q} Data-Assign C I (∃a0 . Π ∧ Φ[a0 /a] ∧ a = A[a0 /a] : Σ[a0 /a] ` Q) C I {Π ∧ Φ : Σ} a := A {Q} Data-Store b:Σ b ∗ x 7→ [A, ~ E]) ~ C0 I P ` (∃X. Π ∧ Φ 0 0 0 b b ~ ~ `Q C1 I (∃X, a . Π ∧ Φ ∧ a = A : Σ ∗ x 7→ [A[a /Ai ], E]) C0 ; C1 I {P } x->Di := A {Q} Alloc C I (∃x0 , ~a, ~ x. Π[x0 /x] ∧ Φ : Σ[x0 /x] ∗ x 7→ [~a, ~ x]) ` Q C I {Π ∧ Φ : Σ} x := new(n,m) Fig. 6. Constraint generation. {Q} Refined memory safety proof ζ 0 {R0 (i) : true} Constraint system C R0 (i0 ) ← true R1 (i0 ) ← R0 (i) i = nondet(); x = null {R1 (i) : ls((λa.Rls1 (ν, i)), x, null) ∗ true} R2 (i0 ) ← R1 (i) ∧ i 6= 0 ∧ i0 = i + 1 R3 (i) ← R2 (i) ∧ i = 0 assume(i != 0); ...; i--; {R2 (i) : ls((λa.Rls2 (ν, i)), x, null) ∗ true} R4 (i, d0 ) ← R3 (i) ∧ Rls3 (d0 , i) Rls2 (ν, i0 ) ← R1 (i) ∧ Rls1 (ν, i) ∧ i 6= 0 ∧ i0 = i + 1 assume(i == 0) {R3 (i) : ls((λa.Rls3 (ν, i)), x, null) ∗ true} Rls2 (ν, i0 ) ← R1 (i) ∧ ν = i ∧ i 6= 0 ∧ i0 = i + 1 Rls3 (ν, i) ← R2 (i) ∧ Rls2 (ν, i) ∧ i = 0 assume(x != null) {(∃d0 , y. R4 (i, d0 ) : x 7→ [d0 , y] ∗ true)} d0 > 0 ← R4 (i, d0 ) Solution σ R0 (i) : true R1 (i) : true R2 (i) : true R3 (i) : true R4 (i, d0 ) : d0 > 0 Rls1 (ν, i) : ν > i Rls2 (ν, i) : ν > i Rls3 (ν, i) : ν > 0 Fig. 7. Example constraints. a memory safety proof for π), and a postcondition ϕ. The goal is to transform ζ into an RSep proof of the triple {true : emp} π {ϕ : true}. The high-level operation of our procedure is as follows. First, we traverse the memory safety proof ζ and build (1) a corresponding refined proof ζ 0 where refinements may contain second-order variables, and (2) a constraint system C which encodes logical dependencies between the second-order variables. We then attempt to find a solution to C, which is an assignment of data formulas to the second-order variables such that all constraints are satisfied. If we are successful, we use the solution to instantiate the second-order variables in ζ 0 , which yields a valid RSep proof of the triple {true : emp} π {ϕ : true}. Horn Clauses The constraint system produced by our procedure is a recursionfree set of Horn clauses, which can be solved efficiently using existing first-order interpolation techniques (see [33] for a detailed survey). Following [17], we define a query to be an application Q(~a) of a second-order variable Q to a vector of (data) variables, and define an atom to be either a data formula ϕ ∈ DFormula or a query Q(~a). A Horn clause is of the form h ← b1 ∧ · · · ∧ bN where each of h, b1 , . . . , bN is an atom. In our constraint generation rules, it will be convenient to use a more general form which can be translated to Horn clauses: we will allow constraints of the form h1 ∧ · · · ∧ hM ← b1 ∧ · · · ∧ bN (shorthand for the set of Horn clauses {hi ← b1 ∧ · · · ∧ bN }16i6M ) and we will ~ (i.e., take arbitrary data terms as arguments allow queries to be of the form Q(A) rather than variables). If C and C 0 are sets of constraints, we will use C; C 0 to denote their union. A solution to a system of Horn clauses C is a map σ that assigns each secondorder variable Q of arity k a DFormula Qσ with free variables drawn from ~ν = hν1 , . . . , νk i such that for each clause h ← b1 ∧ · · · ∧ bN in C the implication ∀A.(hσ ⇐ (∃B.bσ1 ∧ · · · ∧ bσN )) holds, where A is the set of free variables in h and B is the set of variables free in some bi but not in h. In the above, for any data formula ϕ, ϕσ is defined to be ϕ, and for any query Q(~a), Q(~a)σ is defined to be Qσ [a1 /ν1 , . . . , ak /νk ] (where k is the arity of Q). Constraint Generation Calculus We will present our algorithm for spatial interpolation modulo theories as a calculus whose inference rules mirror the ones of separation logic. The calculus makes use of the same syntax used in recursive predicate definitions in Sec. 3. We use τ to denote a refinement term and Φ to denote a refined formula. The calculus has two types of judgements. An entailment judgement is of the form C I (∃X. Π ∧ Φ : Σ) ` (∃X 0 . Π 0 ∧ Φ0 : Σ 0 ) where Π, Π 0 are equational pure assertions over heap terms, Σ, Σ 0 are refined spatial assertions, Φ, Φ0 are refined formulas, and C is a recursion-free set of Horn clauses. Such an entailment judgement should be read as “for any solution σ to the set of constraints C, (∃X. Π ∧ Φσ : Σ σ ) entails (∃X 0 . Π 0 ∧ Φ0σ : Σ 0σ ),” where Φσ is Φ with all second order variables replaced by their data formula assignments in σ (and similarly for Σ σ ). Similarly, an execution judgement is of the form C I {(∃X. Π ∧ Φ : Σ)} π {(∃X 0 . Π 0 ∧ Φ0 : Σ 0 )} where π is a path and X, X 0 , Π, Π 0 , Φ, Φ0 , Σ, Σ 0 , and C are as above. Such an execution judgement should be read as “for any solution σ to the set of constraints C, {(∃X. Π ∧ Φσ : Σ σ )} π {(∃X 0 . Π 0 ∧ Φ0σ : Σ 0σ )} is a valid triple.” Let π be a path, let ζ be a separation logic proof of the triple {true : emp} π {true : true} (i.e., a memory safety proof for π), and let ϕ ∈ DFormula be a postcondition. Given these inputs, our algorithm operates as follows. We use ~v to denote a vector of all data-typed program variables. The triple is rewritten with refinements by letting R and R0 be fresh second-order variables of arity |~v | and conjoining R(~v ) and R0 (~v ) to the pre and post. By recursing on ζ, at each step applying the appropriate rule from our calculus in Fig. 6, we derive a judgement ζ0 C I {true ∧ R(~v ) : true} π {true ∧ R0 (~v ) : true} and then compute a solution σ to the constraint system C; R(~v ) ← true; ϕ ← R0 (~v ) (if one exists). The algorithm then returns ζ 0σ , the proof obtained by applying the substitution σ to ζ 0 . Intuitively, our algorithm operates by recursing on a separation logic proof, introducing refinements into formulas on the way down, and building a system of constraints on the way up. Each inference rule in the calculus encodes both the downwards and upwards step of this algorithm. For example, consider the Fold rule of our calculus: we will illustrate the intended reading of this rule with a concrete example. Suppose that the input to the algorithm is a derivation of the following form: ζ0 x 7→ [a, null] ` (∃b, y. x 7→ [b, y] ∗ ls(y, null)) Q(i) : x 7→ [a, null] ` R(i) : ls((λa.S(x, a)), x, null) Fold (i.e., a derivation where the last inference rule is an application of Fold, and the conclusion has already been rewritten with refinements). We introduce refinements in the premise and recurse on the following derivation: ζ0 Q(i) : x 7→ [a, null] ` (∃b, y. R(i) ∧ S(i, b) : x 7→ [b, y] ∗ ls((λa.S(x, a)), y, null)) The result of this recursive call is a refined derivation ζ00 as well as a constraint system C. We then return both (1) the refined derivation obtained by catenating the conclusion of the Fold rule onto ζ00 and (2) the constraint system C. A crucial point of our algorithm is hidden inside the hat notation in Fig. 6 b in Sequence): this notation is used to denote the introduction of fresh (e.g, O second-order variables. For many of the inference rules (such as Fold), the refinements which appear in the premises follow fairly directly from the refinements which appear in the conclusion. However, in some rules entirely new formulas appear in the premises which do not appear in the conclusion (e.g., in the Seb is an arbitrary formula which quence rule in Fig. 6, the intermediate assertion O has no obvious relationship to the precondition P or the postcondition Q). We refine such formula O by introducing a fresh second-order variable for the pure assertion and for each refinement term that appears in O. The following offers a concrete example. Example 3. Consider the trace π in Fig. 3. Suppose that we are given a memory safety proof for π which ends in an application of the Sequence rule: {true : emp} π0 {true : ls(x, null)} {true : ls(x, null)} π1 {(∃b, y. true : x 7→ [b, y])} {Q(i) : emp} π0 ; π1 {(∃b, y. R(i, b) : x 7→ [b, y])} Sequence where π is decomposed as π0 ; π1 , π0 is the path from 1 to 3, and π1 is the path from 3 to 4. Let O = true : ls(x, null) denote the intermediate assertion which apb we introduce two fresh second order variables, S pears in this proof. To derive O, b = S(i) : ls((λa.T (i, a)), x, null). (with arity 1) and T (with arity 2), and define O The resulting inference is as follows: {Q(i) : emp} π0 {S(i) : ls((λa.T (i, a)), x, null)} {S(i) : ls((λa.T (i, a)), x, null)} π1 {(∃b, y. R(i, b) : x 7→ [b, y])} {Q(i) : emp} π0 ; π1 {(∃b, y. R(i, b) : x 7→ [b, y])} y The following example provides a simple demonstration of our constraint generation procedure: Example 4. Recall the example in Fig. 3 of Sec. 2. The row of spatial interpolants in Fig. 3 is a memory safety proof ζ of the program path. Fig. 7 shows the refined proof ζ 0 , which is the proof ζ with second-order variables that act as placeholders for data formulas. For the sake of illustration, we have simplified the constraints by skipping a number of intermediate annotations in the Hoare-style proof. The constraint system C specifies the logical dependencies between the introduced second-order variables in ζ 0 . For instance, the relation between R2 and R3 is specified by the Horn clause R3 (i) ← R2 (i) ∧ i = 0, which takes into account the constraint imposed by assume (i == 0) in the path. The Horn clause d0 > 0 ← R4 (i, d0 ) specifies the postcondition defined by the assertion assert(x->D >= 0), which states that the value of the data field of the node x should be > 0. Replacing second-order variables in ζ 0 with their respective solutions in σ produces a proof that the assertion at the end of the path holds (last row of Fig. 3). y Soundness and Completeness The key result regarding the constraint systems produced by these judgements is that any solution to the constraints yields a valid refined proof. The formalization of the result is the following theorem. Theorem 2 (Soundness). Suppose that π is a path, ζ is a derivation of the judgement C I {P } π {Q}, and that σ is a solution to C. Then ζ σ , the proof obtained by applying the substitution σ to ζ, is a (refined) separation logic proof of {P σ } π {Qσ }. Another crucial result for our counterexample generation strategy is a kind of completeness theorem, which effectively states that the strongest memory safety proof always admits a refinement. Theorem 3 (Completeness). Suppose that π is a memory-feasible path and ζ is a derivation of the judgement C I {R0 (~v ) : emp} π {R1 (~v ) : true} obtained by symbolic execution. If ϕ is a data formula such that {true : emp} π {ϕ : true} holds, then there is a solution σ to C such that R1σ (~v ) ⇒ ϕ. 6 Bounded Abduction In this section, we discuss our algorithm for bounded abduction. Given a bounded abduction problem L ` (∃X. M ∗ [ ]) ` R we would like to find a formula A such that L ` (∃X. M ∗ A) ` R. Our algorithm is sound but not complete: it is possible that there exists a solution to the bounded abduction problem, but our procedure cannot find it. In fact, there is in general no complete procedure for bounded abduction, as a consequence of the fact that we do not pre-suppose that our proof system for entailment is complete, or even that entailment is decidable. Empty c Π |= Π 0 Star 0 Points-to c Π |= Π 0 True c Π : [E 7→ [a, F ]] ` Π : h[E 7→ [a, F ]]  E 7→ [a, F ]i 0 0 Π[E/x] : Σ[E/x] ` Π [E/x] : Σ [E/x] 0 0 0 Π : Σ1 ` Π : Σ1 0 0 0 Π : Σ0 ∗ Σ1 ` Π : Σ0 ∗ Σ1 0 0 Substitution 0 Π : Σ0 ` Π : Σ0 c Π : [emp] ` Π : h[emp]  empi Π :Σ`Π :Σ 0 Π |= x = E Π |= Π 0 0 c Π : Σ ` Π : h[true]  truei ∃-right P ` Q[Æ/x] P ` (∃x. Q) Fig. 8. Coloured strengthening. All primed variables are chosen fresh. High level description Our algorithm proceeds in three steps: 1. Find a colouring of L. This is an assignment of a colour, either red or blue, to each heaplet appearing in L. Intuitively, red heaplets are used to satisfy M , and blue heaplets are left over. This colouring can be computed by recursion on a proof of L ` (∃X. M ∗ true). 2. Find a coloured strengthening Π : [M 0 ]r ∗ [A]b of R. (We use the notation [Σ]r or [Σ]b to denote a spatial formula Σ of red or blue colour, respectively.) Intuitively, this is a formula that (1) entails R and (2) is coloured in such a way that the red heaplets correspond to the red heaplets of L, and the blue heaplets correspond to the blue heaplets of L. This coloured strengthening can be computed by recursion on a proof of L ` R using the colouring of L computed in step 1. 3. Check Π 0 : M ∗ A |= R, where Π 0 is the strongest pure formula implied by L. This step is necessary because M may be weaker than M 0 . If the entailment check fails, then our algorithm fails to compute a solution to the bounded abduction problem. If the entailment check succeeds, then Π 00 : A is a solution, where Π 00 is the set of all equalities and disequalities in Π 0 which were actually used in the proof of the entailment Π 0 : M ∗ A |= R (roughly, all those equalities and disequalities which appear in the leaves of the proof tree, plus the equalities that were used in some instance of the Substitution rule). First, we give an example to illustrate these high-level steps: Example 5. Suppose we want to solve the following bounded abduction problem: L ` ls(x, y) ∗ [ ] ` R where L = x 7→ [a, y] ∗ y 7→ [b, null] and R = (∃z. x 7→ [a, z] ∗ ls(y, null)). Our algorithm operates as follows: 1. Colour L: [x 7→ [a, y]]r ∗ [y 7→ [b, null]]b 2. Colour R: (∃z. [x 7→ [a, z]]r ∗ [ls(y, null)]b ) 3. Prove the entailment x 6= null ∧ y 6= null ∧ x 6= y : ls(x, y) ∗ ls(y, null) |= R This proof succeeds, and uses the pure assertion x 6= y. Our algorithm computes x 6= y : ls(y, null) as the solution to the bounded abduction problem. y We now elaborate our bounded abduction algorithm. We assume that L is quantifier free (without loss of generality, since quantified variables can be Skolemized) and saturated in the sense that for any pure formula Π 0 , if L ` Π 0 , where L = Π : Σ, then Π ` Π 0 . Step 1 The first step of the algorithm is straightforward. If we suppose that there exists a solution, A, to the bounded abduction problem, then by definition we must that have L |= (∃X. M ∗ A). Since (∃X. M ∗ A) |= (∃X. M ∗ true), we must also have L |= (∃X. M ∗ true). We begin step 1 by computing a proof of L ` (∃X. M ∗ true). If we fail, then we abort the procedure and report that we cannot find a solution to the abduction problem. If we succeed, then we can ~ F~ ] in L, either colour the heaplets of L as follows: for each heaplet E 7→ [A, ~ ~ E 7→ [A, F ] was used in an application of the Points-to axiom in the proof of ~ F~ ] red; otherwise, we colour L ` (∃X. M ∗ true) or not. If yes, we colour E 7→ [A, it blue. We denote a heaplet H coloured by a colour c by [H]c . Step 2 The second step is to find a coloured strengthening of R. Again, supposing that there is some solution A to the bounded abduction problem, we must have L |= (∃X. M ∗ A) |= R, and therefore L |= R. We begin step 2 by computing a proof of L ` R. If we fail, then we abort. If we succeed, then we define a coloured strengthening of R by recursion on the proof of L ` R. Intuitively, this algorithm operates by inducing a colouring on points-to predicates in the leaves of the proof tree from the colouring of L (via the Points-to rule in Fig. 8) and then only folding recursive predicates when all the folded heaplets have the same colour. More formally, for each formula P appearing as the consequent of some sequent in a proof tree, our algorithm produces a mapping from heaplets in P to coloured spatial formulas. The mapping is represented using the notation hΣ  Hi, which denotes that the heaplet H is mapped to the coloured spatial formula Σ. For each recursive predicate Z and each (∃X. Π : H1 ∗· · · ∗ Hn ) ∈ ~ ~x)), we define two versions of the fold rule, corresponding to when cases(Z(R, H1 , . . . , Hn are coloured homogeneously (Fold1) and heterogeneously (Fold2): Fold1 0 0 c c ~ x] (Π : Σ ` Π : Σ ∗ h[H1 ]  H1 i ∗· · · ∗ h[Hn ]  Hn i)[E/~ 0 0 c ~ ~ Π : Σ ` Π : Σ ∗ h[Z(E)]  Z(E)i Fold2 0 0 0 0 ~ x] (Π : Σ ` Π : Σ ∗ hΣ1  H1 i ∗· · · ∗ hΣn  Hn i)[E/~ 0 0 0 0 ~ Π : Σ ` Π : Σ ∗ hΣ ∗· · · ∗ Σ  Z(E)i 1 n The remaining rules for our algorithm are presented formally in Fig. 8.3 To illustrate how this algorithm works, consider the Fold1 and Fold2 rules. If a given (sub-)proof finishes with an instance of Fold that folds H1 ∗ · · · ∗ Hn into ~ we begin by colouring the sub-proof of Z(E), Π : Σ ` Π 0 : Σ 0 ∗ H1 ∗· · · ∗ Hn This colouring process produces a coloured heaplet Σi for each Hi . If there is ~ gets some colour c such that each Σi0 is [Hi ]c , then we apply Fold1 and Z(E) c ~ mapped to [Z(E)] . Otherwise (if there is some i such that Σi is not Hi or there is some i, j such that Σi and Σj have different colours), we apply Fold2, and ~ to Σ1 ∗· · · ∗ Σn . map Z(E) After colouring a proof, we define A to be the blue part of R. That is, if the colouring process ends with a judgement of 0 r 0 r Π : [Σ1 ]r ∗ [Σ2 ]b ` Π 0 : h[Σ11 ] ∗ [Σ12 ]b  H1 i ∗ · · · ∗ h[Σn1 ] ∗ [Σn2 ]b  Hn i (where for any coloured spatial formula Σ, its partition into red and blue heaplets is denoted by [Σ1 ]r ∗ [Σ2 ]b ), we define A to be Π 0 : Σ12 ∗· · · ∗ Σn2 . This choice is justified by the following lemma: Lemma 1. Suppose that 0 r 0 r Π : [Σ1 ]r ∗ [Σ2 ]b ` Π 0 : h[Σ11 ] ∗ [Σ12 ]b  H1 i ∗ · · · ∗ h[Σn1 ] ∗ [Σn2 ]b  Hn i is derivable using the rules of Fig. 8, and that the antecedent is saturated. Then the following hold: – Π 0 : Σ11 ∗ Σ12 ∗· · · ∗ Σn2 |= Π 0 : H1 ∗· · · ∗ Hn ; – Π : Σ1 |= Π 0 : Σ11 ∗· · · ∗ Σn1 ; and – Π : Σ2 |= Π 0 : Σ12 ∗· · · ∗ Σn2 . Step 3 The third step of our algorithm is to check the entailment Π : M ∗A |= R. To illustrate why this is necessary, consider the following example: Example 6. Suppose we want to solve the following bounded abduction problem: x 6= y : x 7→ [a, y] ` ls(x, y) ∗ [ ] ` x 7→ [a, y] . In Step 1, we compute the colouring x 6= y : [x 7→ [a, y]]r ∗ [emp]b of the left hand side. In step 2, we compute the colouring [x 7→ [a, y]]r ∗ [emp]b of the right hand side. However, emp is not a solution to the bounded abduction problem. In fact, there is no solution to the bounded abduction problem. Intuitively, this is because M is too weak to entail the red part of the right hand side. y 7 Implementation and Evaluation Our primary goal is to study the feasibility of our proposed algorithm. To that end, we implemented an instantiation of our generic algorithm with the linked list recursive predicate ls (as defined in Sec. 3) and refinements in the theory of linear arithmetic (QF LRA). The following describes our implementation and evaluation of SplInter in detail. 3 Note that some of the inference rules are missing. This is because these rules are inapplicable (in the case of Unfold and Inconsistent) or unnecessary (in the case of null-not-Lval and *-Partial), given our assumptions on the antecedent. Implementation We implemented SplInter in the T2 safety and termination verifier [37]. Specifically, we extended T2’s front-end to handle heapmanipulating programs, and used its safety checking component (which implements McMillan’s Impact algorithm) as a basis for our implementation of SplInter. To enable reasoning in separation logic, we implemented an entailment checker for RSep along with a bounded abduction procedure. We implemented a constraint-based solver using the linear rational arithmetic interpolation techniques of Rybalchenko and Stokkermans [34] to solve the non-recursive Horn clauses generated by SplInter. Although many off-theshelf tools for interpolation exist (e.g., [26]) we implemented our own solver for experimentation and evaluation purposes to allow us more flexibility in controlling the forms of interpolants we are looking for. We expect that SplInter would perform even better using these highly tuned interpolation engines. Our main goal is to evaluate the feasibility of our proposed extension of interpolation-based verification to heap and data reasoning, and not necessarily to demonstrate performance improvements against other tools. Nonetheless, we note that there are two tools that target similar programs: (1) Thor [22], which computes a memory safety proof and uses off-the-shelf numerical verifiers to strengthen it, and (2) Xisa [12], which combines shape and data abstract domains in an abstract interpretation framework. Thor cannot compute arbitrary refinements of recursive predicates (like the ones demonstrated here and required in our benchmarks) unless they are manually supplied with the required theory predicates. Instantiated with the right abstract data domains, Xisa can in principle handle most programs we target in our evaluation. (Xisa was unavailable for comparison [11].) Sec. 8 provides a detailed comparison with related work. Benchmarks To evaluate SplInter, we used a number of linked list benchmarks that require heap and data reasoning. First, we used a number of simple benchmarks: listdata is similar to Fig. 2, where a linked list is constructed and its data elements are later checked; twolists requires an invariant comparing data elements of two lists (all elements in list A are greater than those in list B); ptloop tests our spatial interpolation technique, where the head of the list must not be folded in order to ensure its data element is accessible; and refCount is a reference counting program, where our goal is to prove memory safety (no double free). For our second set of benchmarks, we used a cut-down version of BinChunker (http://he.fi/bchunk/), a Linux utility for converting between different audio CD formats. BinChunker maintains linked lists and uses their data elements for traversing an array. Our property of interest is thus ensuring that all array accesses are within bounds. To test our approach, we used a number of modifications of BinChunker, bchunk a to bchunk f, where a is the simplest benchmark and f is the most complex one. Heuristics We employed a number of heuristics to improve our implementation. First, given a program path to prove correct, we attempt to find a similar proof to previously proven paths that traverse the same control flow locations. This is similar to the forced covering heuristic of [25] to force path interpolants to generalize to inductive invariants. Second, our Horn clause solver uses Farkas’ Benchmark #ProvePath Time (s) T Time Sp. Time listdata 5 1.37 0.45 0.2 twolists 5 3.12 2.06 0.27 3 1.03 0.28 0.15 ptloop refCount 14 1.6 0.59 0.14 bchunk a 6 1.56 0.51 0.25 bchunk b 18 4.78 1.7 0.2 69 31.6 14.3 0.26 bchunk c bchunk d 23 9.3 4.42 0.27 52 30.1 12.2 0.25 bchunk e bchunk f 57 22.4 12.0 0.25 Table 1. Results of running SplInter on our benchmark set. lemma to compute linear arithmetic interpolants. We found that minimizing the number of non-zero Farkas coefficients results in more generalizable refinements. A similar heuristic is employed by [1]. Results Table 1 shows the results of running SplInter on our benchmark suite. Each row shows the number of calls to ProvePath (number of paths proved), the total time taken by SplInter in seconds, the time taken to generate Horn clauses and compute theory interpolants (T Time), and the time taken to compute spatial interpolants (Sp. Time). SplInter proves all benchmarks correct w.r.t. their respective properties. As expected, on simpler examples, the number of paths sampled by SplInter is relatively small (3 to 14). In the bchunk * examples, SplInter examines up to 69 paths (bchunk c). It is important to note that, in all benchmarks, almost half of the total time is spent in theory interpolation. We expect this can be drastically cut with the use of a more efficient interpolation engine. The time taken by spatial interpolation is very small in comparison, and becomes negligible in larger examples. The rest of the time is spent in checking entailment of RSep formulas and other miscellaneous operations. Our results highlight the utility of our proposed approach. Using our prototype implementation of SplInter, we were able to verify a set of realistic programs that require non-trivial combinations of heap and data reasoning. We expect the performance of our prototype implementation of SplInter can greatly improve with the help of state-of-the-art Horn clause solvers, and more efficient entailment checkers for separation logic. 8 Related Work Abstraction Refinement for the Heap To the best of our knowledge, the work of Botincan et al. [7] is the only separation logic shape analysis that employs a form of abstraction refinement. It starts with a family of separation logic domains of increasing precision, and uses spurious counterexample traces (reported by forward fixed-point computation) to pick a more precise domain to restart the analysis and (possibly) eliminate the counterexample. Limitations of this technique include: (1) The precision of the analysis is contingent on the set of abstract domains it is started with. (2) The refinement strategy (in contrast to SplInter) does not guarantee progress (it may explore the same path re- peatedly), and may report false positives. On the other hand, given a program path, SplInter is guaranteed to find a proof for the path or correctly declare it an unsafe execution. (3) Finally, it is unclear whether refinement with a powerful theory like linear arithmetic can be encoded in such a framework, e.g., as a set of domains with increasingly more arithmetic predicates. Podelski and Wies [30] propose an abstraction refinement algorithm for a shape-analysis domain with a logic-based view of three-valued shape analysis (specifically, first-order logic plus transitive closure). Spurious counterexamples are used to either refine the set of predicates used in the analysis, or refine an imprecise abstract transformer. The approach is used to verify specifications given by the user as first-order logic formulas. A limitation of the approach is that refinement is syntactic, and if an important recursive predicate (e.g., there is a list from x to null) is not explicitly supplied in the specification, it cannot be inferred automatically. Furthermore, abstract post computation can be expensive, as the abstract domain uses quantified predicates. Additionally, the analysis assumes a memory safe program to start, whereas, in SplInter, we construct a memory safety proof as part of the invariant, enabling us to detect unsafe memory operations that lead to undefined program behavior. Beyer et al. [5] propose using shape analysis information on demand to augment numerical predicate abstraction. They use shape analysis as a backup analysis when failing to prove a given path safe without tracking the heap, and incrementally refines TVLA’s [6] three-valued shape analysis [35] to track more heap information as required. As with [30], [5] makes an a priori assumption of memory safety and requires an expensive abstract post operator. Finally, Manevich et al. [23] give a theoretical treatment of counterexampledriven refinement in power set (e.g., shape) abstract domains. Combined Shape and Data Analyses The work of Magill et al. [22] infers shape and numerical invariants, and is the most closely related to ours. First, a separation logic analysis is used to construct a memory safety proof of the whole program. This proof is then instrumented by adding additional user-defined integer parameters to the recursive predicates appearing in the proof (with corresponding user-defined interpretations). A numerical program is generated from this instrumented proof and checked using an off-the-shelf verification tool, which need not reason about the heap. Our technique and [22]’s are similar in that we both decorate separation logic proofs with additional information: in [22], the extra information is instrumentation variables; in this paper, the extra information is refinement predicates. Neither of these techniques properly subsumes the other, and we believe that they may be profitably combined. An important difference is that we synthesize data refinements automatically from program paths, whereas [22] uses a fixed (though user-definable) abstraction. A number of papers have proposed abstract domains for shape and data invariants. Chang and Rival [12] propose a separation logic–based abstract domain that is parameterized by programmer-supplied invariant checkers (recursive predicates) and a data domain for reasoning about contents of these structures. McCloskey et al. [24] also proposed a combination of heap and numeric abstract domains, this time using 3-valued structures for the heap. While the approaches to combining shape and data information are significantly different, an advantage of our method is that it does not lose precision due to limitations in the abstract domain, widening, and join. Bouajjani et al. [8, 9] propose an abstract domain for list manipulating programs that is parameterized by a data domain. They show that by varying the data domain, one can infer invariants about list sizes, sum of elements, etc. Quantified data automata (QDA) [16] have been proposed as an abstract domain for representing list invariants where the data in a list is described by a regular language. In [15], invariants over QDA have been synthesized using language learning techniques from concrete program executions. Expressive logics have also been proposed for reasoning about heap and data [31], but have thus far been only used for invariant checking, not invariant synthesis. A number of decision procedures for combinations of the singly-linked-list fragment of separation logic with SMT theories have recently been proposed [28, 29]. Path-based Verification A number of works proposed path-based algorithms for verification. Our work builds on McMillan’s Impact technique [25] and extends it to heap/data reasoning. Earlier work [19] used interpolants to compute predicates from spurious paths in a CEGAR loop. Beyer et al. [4] proposed path invariants, where infeasible paths induce program slices that are proved correct, and from which predicates are mined for full program verification. Heizmann et al. [18] presented a technique that uses interpolants to compute path proofs and generalize a path into a visibly push-down language of correct paths. In comparison with SplInter, all of these techniques are restricted to first-order invariants. Our work is similar to that of Itzhaky et al. [21], in the sense that we both generalize from bounded unrollings of the program to compute ingredients of a proof. However, they compute proofs in a fragment of first-order logic that can only express linked lists and has not yet been extended to combined heap and data properties. Bibliography [1] Albarghouthi, A., McMillan, K.L.: Beautiful interpolants. In: Sharygina and Veith [36] [2] Ball, T., Jones, R.B. (eds.): CAV, LNCS, vol. 4144. Springer (2006) [3] Berdine, J., Calcagno, C., O’Hearn, P.W.: Symbolic execution with separation logic. In: Yi, K. (ed.) APLAS. LNCS, vol. 3780. Springer (2005) [4] Beyer, D., Henzinger, T.A., Majumdar, R., Rybalchenko, A.: Path invariants. In: Ferrante, J., McKinley, K.S. (eds.) PLDI. ACM (2007) [5] Beyer, D., Henzinger, T.A., Théoduloz, G.: Lazy shape analysis. In: Ball and Jones [2] [6] Bogudlov, I., Lev-Ami, T., Reps, T.W., Sagiv, M.: Revamping TVLA: Making parametric shape analysis competitive. In: Damm, W., Hermanns, H. (eds.) CAV. LNCS, vol. 4590. Springer (2007) [7] Botincan, M., Dodds, M., Magill, S.: Abstraction refinement for separation logic program analyses, http://www.cl.cam.ac.uk/˜mb741/papers/abs_ref_draft.pdf [8] Bouajjani, A., Dragoi, C., Enea, C., Rezine, A., Sighireanu, M.: Invariant synthesis for programs manipulating lists with unbounded data. In: Touili, T., Cook, B., Jackson, P. (eds.) CAV. LNCS, vol. 6174. Springer (2010) [9] Bouajjani, A., Dragoi, C., Enea, C., Sighireanu, M.: Abstract domains for automated reasoning about list-manipulating programs with infinite data. In: Kuncak, V., Rybalchenko, A. (eds.) VMCAI. LNCS, vol. 7148. Springer (2012) [10] Calcagno, C., Distefano, D., O’Hearn, P.W., Yang, H.: Compositional shape analysis by means of bi-abduction. In: Shao, Z., Pierce, B.C. (eds.) POPL. ACM (2009) [11] Chang, B.Y.E.: Personal communication [12] Chang, B.E., Rival, X.: Relational inductive shape analysis. In: Necula, G.C., Wadler, P. (eds.) POPL. ACM (2008) [13] Cook, B., Haase, C., Ouaknine, J., Parkinson, M.J., Worrell, J.: Tractable reasoning in a fragment of separation logic. In: Katoen, J., König, B. (eds.) CONCUR. LNCS, vol. 6901. Springer (2011) [14] Distefano, D., O’Hearn, P.W., Yang, H.: A local shape analysis based on separation logic. In: Hermanns, H., Palsberg, J. (eds.) TACAS, LNCS, vol. 3920. Springer (2006) [15] Garg, P., Löding, C., Madhusudan, P., Neider, D.: Learning universally quantified invariants of linear data structures. In: Sharygina and Veith [36] [16] Garg, P., Madhusudan, P., Parlato, G.: Quantified data automata on skinny trees: An abstract domain for lists. In: Logozzo, F., Fähndrich, M. (eds.) SAS. LNCS, vol. 7935. Springer (2013) [17] Gupta, A., Popeea, C., Rybalchenko, A.: Solving recursion-free horn clauses over LI+UIF. In: Yang, H. (ed.) APLAS. LNCS, vol. 7078. Springer (2011) [18] Heizmann, M., Hoenicke, J., Podelski, A.: Nested interpolants. In: Hermenegildo and Palsberg [20] [19] Henzinger, T.A., Jhala, R., Majumdar, R., McMillan, K.L.: Abstractions from proofs. In: Jones, N.D., Leroy, X. (eds.) POPL. ACM (2004) [20] Hermenegildo, M.V., Palsberg, J. (eds.): POPL. ACM (2010) [21] Itzhaky, S., Bjørner, N., Reps, T.W., Sagiv, M., Thakur, A.V.: Property-directed shape analysis. In: Biere, A., Bloem, R. (eds.) CAV. LNCS, vol. 8559. Springer (2014) [22] Magill, S., Tsai, M., Lee, P., Tsay, Y.: Automatic numeric abstractions for heapmanipulating programs. In: Hermenegildo and Palsberg [20] [23] Manevich, R., Field, J., Henzinger, T.A., Ramalingam, G., Sagiv, M.: Abstract counterexample-based refinement for powerset domains. In: Reps, T.W., Sagiv, M., Bauer, J. (eds.) Prog. Analysis and Compilation. LNCS, vol. 4444. Springer (2006) [24] McCloskey, B., Reps, T.W., Sagiv, M.: Statically inferring complex heap, array, and numeric invariants. In: Cousot, R., Martel, M. (eds.) SAS. LNCS, vol. 6337. Springer (2010) [25] McMillan, K.L.: Lazy abstraction with interpolants. In: Ball and Jones [2] [26] McMillan, K.L.: Interpolants from Z3 proofs. In: Bjesse, P., Slobodová, A. (eds.) FMCAD. FMCAD Inc. (2011) [27] Pérez, J.A.N., Rybalchenko, A.: Separation logic + superposition calculus = heap theorem prover. In: Hall, M.W., Padua, D.A. (eds.) PLDI. ACM (2011) [28] Pérez, J.A.N., Rybalchenko, A.: Separation logic modulo theories. In: Shan, C. (ed.) APLAS. LNCS, vol. 8301. Springer (2013) [29] Piskac, R., Wies, T., Zufferey, D.: Automating separation logic using SMT. In: Sharygina and Veith [36] [30] Podelski, A., Wies, T.: Counterexample-guided focus. In: Hermenegildo and Palsberg [20] [31] Qiu, X., Garg, P., Stefanescu, A., Madhusudan, P.: Natural proofs for structure, data, and separation. In: Boehm, H., Flanagan, C. (eds.) PLDI. ACM (2013) [32] Reynolds, J.C.: Separation logic: A logic for shared mutable data structures. In: LICS. IEEE Computer Society (2002) [33] Rümmer, P., Hojjat, H., Kuncak, V.: Classifying and solving horn clauses for verification. In: Cohen, E., Rybalchenko, A. (eds.) VSTTE. LNCS, vol. 8164. Springer (2013) [34] Rybalchenko, A., Sofronie-Stokkermans, V.: Constraint solving for interpolation. In: Cook, B., Podelski, A. (eds.) VMCAI. LNCS, vol. 4349. Springer (2007) [35] Sagiv, S., Reps, T.W., Wilhelm, R.: Parametric shape analysis via 3-valued logic. In: Appel, A.W., Aiken, A. (eds.) POPL. ACM (1999) [36] Sharygina, N., Veith, H. (eds.): CAV, LNCS, vol. 8044. Springer (2013) [37] T2. http://research.microsoft.com/en-us/projects/t2/ 1: function SplInter(P) 2: S←∅ 3: loop 4: π ← IsProof(S) 5: if π is empty then // S is a proof 6: return found proof S 7: else // π = vi , . . . , ve in P does not appear in S 8: κ ← ProvePath(π) 9: if κ is empty then // No proof computed for π 10: return found erroneous execution π 11: S0 ← ∅ 12: for each κ0 ∈ S do 13: (κ, κ0 ) ← Conj(κ, κ0 ) 14: S 0 ← S 0 ∪ {κ0 } 15: S ← S 0 ∪ {κ} Fig. 9. Main Algorithm of SplInter. A From Proofs of Paths to Proofs of Programs In this section, we describe how SplInter constructs a proof of correctness (i.e., unreachability of the error location ve ) of a program P = hV, E, vi , ve i from proofs of individual paths. We note that our algorithm is an extension of Impact [25] to RSep proofs; we refer the reader to [25] for optimizations and heuristics. The main difference is the procedure ProvePath, which constructs an RSep proof for a given program path. The Main Algorithm Figure 9 shows the main algorithm of SplInter. Elements of the set S are program paths from vi to ve , annotated with RSep formulas. For example, (a1 , v1 ), (a2 , v2 ), . . . , (an , vn ) is an annotated path where (1) {aj }j are RSep formulas; (2) v1 = vi and vn = ve ; (3) for j ∈ [1, n − 1], (vj , vj+1 ) ∈ E; (4) for each edge e = (vj , vj+1 ), {aj } ec {aj+1 } is valid; and (5) an is false (since we are interested in proving unreachability of ve ). SplInter uses the procedure IsProof to check if the set of annotated paths S represents a proof of correctness of the whole program. If not, IsProof samples a new program path (π) that does not appear in S. Using the procedure ProvePath, it tries to construct an annotation/proof (using spatial(T ) interpolants) of π. If no proof is constructed, SplInter concludes that π is a feasible execution to ve (or it performs unsafe memory operations). Otherwise, it uses the procedure Conj to strengthen the proofs of all program paths in S, adds the annotated path to S, and restarts the loop. 1: function ProvePath(π = v1 , . . . , vn ) 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: // Check if path is feasible (can reach error location ve ). let k be largest integer s.t. exec(v1 , . . . , vk ) is defined. symbHeap ← exec(v1 , . . . , vk ) // If π is memory-infeasible, // only compute spatial interpolants, // as theory interpolants are not needed if Sk |= false, where symbHeap = . . . , (Sk , vk ) then let k 0 6 k be the largest integer s.t. Sk0 6|= false spInt ← Spatial((v1 , . . . , vk0 ), Sk0 ) return spInt, (false, vk0 +1 ), . . . , (false, vn ) refSymbHeap ← Refine(symbHeap, false) if k = 0 or refSymbHeap is undefined then return no proof found 14: // Path infeasible – construct proof. spInt ← Spatial((v1 , . . . , vk ), true : true) spTheoryInt ← Refine(spInt, false) if spTheoryInt is undefined then return refSymbHeap, (false, vk+1 ), . . . , (false, vn ) 19: return spTheoryInt, (false, vk+1 ), . . . , (false, vn ) 15: 16: 17: 18: Fig. 10. Pseudocode for ProvePath. Note that the annotated paths in S represent an Abstract Reachability Tree (ART), as used in [25] as well as other software model checking algorithms. The tree in this case is rooted at vi , and branching represents when two paths diverge. We will now describe SplInter’s components in more detail. IsProof: Checking Proofs Given a set of annotated paths S, we use the procedure IsProof(S) to check if the annotations represent a proof of the Wwhole program. Specifically, for each v ∈ V , we use I(v) to denote the formula {aj | (aj , v) ∈ κ, κ ∈ S}. In other words, for each location v in P, we hypothesize an inductive invariant I(v) from our current annotations of paths passing through v. We can then check if our hypotheses indeed form an inductive invariant of the program. If so, the program is safe: since I(ve ) is always false (by definition), the fact that I is an invariant implies that the post-state of any execution which reaches ve must satisfy false, and therefore the error location ve is unreachable. Otherwise, IsProof returns a new program path on which our hypothesized invariant does not hold, which we use to refine our hypotheses. In practice, one can perform IsProof implicitly and lazily by maintaining a covering (entailment) relation [25] over the nodes of the ART. ProvePath: Constructing a Proof of a Path Figure 10 shows an algorithm for computing a proof of a path π. First, in lines 2-13, we check if π is feasible (i.e., whether π corresponds to a real program execution). We do this by computing the strongest postconditions along π (using exec) and then attempting to strengthen the annotation (using Refine) with theory interpolants to prove that false is a postcondition of π. If no such strengthening is found, we know that π is feasible (by Theorem 3). Note that if π is memory-infeasible (lines 7-10), then we only compute spatial interpolants along the memory-feasible prefix of the path and return the result. This is because when the path is memory-infeasible, we do not need data refinements along the path to prove it cannot reach ve . The function Spatial((v1 , . . . , vn ), P ) takes a program path π = v1 , . . . , vn and a Sep formula P and returns the path annotated with spatial interpolants w.r.t the postcondition P . The function Refine(κ, ϕ) takes an annotated program path κ with Sep formulas (from spatial interpolants) and a ϕ ∈ DFormula and returns a refined annotation of κ that proves the postcondition ϕ (using theory interpolants). If the path π is infeasible, we proceed by constructing spatial(T ) interpolants for it (lines 15-19). We use the function Spatial (Section 4) to construct spatial interpolants, which we then refine with theory interpolants using the function Refine (Section 5). Spatial path interpolants are computed with respect to the postcondition true : true, indicating that we are looking for a memory safety proof. Note that we might not be able to find theory interpolants if the spatial interpolants computed are too weak and hide important data elements (in which case, on line 18, we use the result of exec as the spatial interpolants – the strongest possible spatial interpolants). To illustrate how this could happen, consider Figure 11: a modification to our illustrative example from Figure 2. node* x = null; int i = 2; while (i > 0) node* tmp = malloc(node); tmp->N = x; tmp->D = i; x = tmp; i--; i = 1; P: while (x != null) if (isOdd(i)) assert(isOdd(x->D)) x = x->N; i++; Fig. 11. Refinement Example. Here, a list of length 2 is constructed. The second loop checks that nodes at odd positions in the linked list have odd data elements. Suppose SplInter samples the path that goes through the first loop twice and enters the second loop arriving at the assertion. Our spatial interpolation procedure will introduce a list segment ls(x, null) at location P. As a result, we cannot find a refinement that proves the assertion, since using the list segment predicate definition from Section 3 we cannot specify that the first element is odd and the second is even. This is because refinements must apply to all elements of ls, and cannot mention specific positions. In this case, we use the symbolic heaps as our spatial interpolants. That is, we annotate location P with x 7→ [d01 , e0 ] ∗ e0 7→ [d02 , null]. Consequently, theory interpolants are able to refine this by specifying that d01 is odd. Conj: Conjoining Proofs of Paths When a new annotated path κ is computed, we strengthen the proofs of all annotated paths κ0 in S that share a prefix with κ using an operation Conj(κ, κ0 ), defined in the following. (This is analogous to strengthening annotations of a path in an ART – all other paths sharing a prefix with the strengthened path also get strengthened.) Let 0 κ = (a1 , v1 ), . . . , (an , vn ) and κ0 = (a01 , v10 ), . . . , (a0m , vm ). Let k be the largest 0 integer such that for all j 6 k, vj = vj (i.e., k represents the longest shared prefix of κ and κ0 ). Conj returns a pair (κ, κ0 ) consisting of the strengthened annotations: κ ← (a1 ∧ a01 , v1 ), . . . , (ak ∧ a0k , vk ), (ak+1 , vk+1 ), . . . , (an , vn ) 0 0 κ0 ← (a1 ∧ a01 , v1 ), . . . , (ak ∧ a0k , vk ), (a0k+1 , vk+1 ), . . . , (a0m , vm ) The issue here is that RSep is not closed under logical conjunction (∧), since we do not allow logical conjunction of spatial conjunctions, e.g., (ls(x, y) ∗ true) ∧ (ls(y, z) ∗ true). In practice, we heuristically under-approximate the logical conjunction, using the strongest postcondition of the shared prefix to guide the under-approximation. Any under-approximation which over-approximates the strongest postcondition (including the strongest postcondition itself) is sound, but overly strong annotations may not generalize to a proof of the whole program. Note that the above transformation maintains the invariant that all paths in S are annotated with valid Hoare triples. B Proofs In this section, we present proof sketches for the theorems appearing in this paper. B.1 Proof of Theorem 1 Theorem 4. Let S and I 0 be RSep formulas and let c be a command such that exec(c, S) |= I 0 . Then (I) S |= itp(S, c, I 0 ) (II) {itp(S, c, I 0 )} c {I 0 } Proof. We prove one case to give intuition on why the theorem holds. Suppose c is an allocation statement x := new(n,m). Recall that we defined itp(S, c, I 0 ) = (∃x. A) where exec(c, S) ` (∃∅. (∃~a, ~z. x 7→ [~a, ~z]) ∗ [A]) ` I 0 Define S 0 = exec(c, S) = S[x0 /x] ∗ x 7→ [~a, ~z] for x0 , ~a, ~z fresh. First we show (I). By the properties of bounded abduction, we have S 0 = S[x0 /x] ∗ x 7→ [~a, ~z] |= A ∗ ((∃~a, ~z. x 7→ [~a, ~z])) from which we can see that S[x0 /x] |= A |= (∃x. A) and thus S |= (∃x. A) = itp(S, c, I 0 ) Next we show (II). We compute exec(c, (∃x. A)) = (∃x0 , ~a, ~z. ((∃x. A))[x0 /x] ∗ x 7→ [~a, ~z]) where x0 , ~a, ~z are fresh. ≡ (∃x0 , ~a, ~z. ((∃x. A)) ∗ x 7→ [~a, ~z]) ≡ ((∃x. A)) ∗ ((∃~a, ~z. x 7→ [~a, ~z])) Since S 0 is of the form S[x0 /x] ∗ x 7→ [~a, ~z] and S 0 |= A ∗ true, the only place where x may appear in A is in a disequality with some other allocated variable. It follows that ((∃x. A)) ∗ ((∃~a, ~z. x 7→ [~a, ~z])) ≡ A ∗ ((∃~a, ~z. x 7→ [~a, ~z])) By the properties of bounded abduction, we have A ∗ ((∃~a, ~z. x 7→ [~a, ~z])) |= I and thus exec(c, (∃x. A)) |= I and finally {itp(S, c, I 0 )} c {I 0 } B.2 Proof of Theorem 2 Theorem 5 (Soundness). Suppose that π is a path and that ζ is a proof of the judgement C I {Π : Σ} π {Π 0 : Σ 0 }, and that σ is a solution to C. Then ζ σ , the proof obtained by applying the substitution σ to ζ, is a (refined) separation logic proof of {(Π : Σ)σ } π {(Π 0 : Σ 0 )σ } . Proof. The proof proceeds by induction on ζ. We will give an illustrative example using an entailment judgement. Suppose that ζ is an entailment proof consisting of a single application of the Predicate rule: Predicate Π |= Π 0 0 Φ0 ← Φ; Ψ10 ← Ψ1 ∧ Φ;· · · ; Ψ|~ τ| ∧ Φ I τ | ← Ψ|~ 0 ~ ~ Π ∧ Φ : Z(~τ , E) ` Π ∧ Φ0 : Z(τ~0 , E) (where τi = (λ~ai .Ψi ) and τi0 = (λ~ai .Ψi0 )). Suppose that σ is a solution to the constraint system 0 C = Φ0 ← Φ; Ψ10 ← Ψ1 ∧ Φ;· · · ; Ψ|~ τ| ∧ Φ τ | ← Ψ|~ Since σ is a solution to C, we have that Φ0σ ⇐ Φσ and for all i, Ψi0σ ⇐ Ψiσ ∧ Φσ and thus (noting that Π |= Π 0 ) Π ∧ Φσ |= Π 0 ∧ Φ0σ and for all i, Ψiσ ∧ Π ∧ Φσ |= Ψi0σ It follows that ζ σ , given below, is a valid derivation: Predicate Π ∧ Φ0σ |= Π 0 ∧ Φ0σ B.3 Ψ1σ ∧ Π ∧ Φσ |= Ψ10 ··· Ψnσ ∧ Π ∧ Φσ |= Ψn0σ ~ ` Π 0 ∧ Φ0σ : Z(~τ σ , E) ~ Π ∧ Φσ : Z(~τ0σ , E) 1 Proof of Theorem 3 Theorem 6 (Completeness). Suppose that π is a memory-safe path and ζ is the proof of the judgement C I {R0 (~v ) : emp} π {R1 (~v ) : true} obtained by symbolic execution. If ϕ is a data formula such that {true : emp} π {ϕ : true} holds, then there is a solution σ to C such that R1σ (~v ) ⇒ ϕ. Proof. Consider that for each formula (∃X. Π : Σ) in a symbolic execution sequence, Σ is a *-conjunction of (finitely many) points-to predicates. The constraints we generate in this situation are the same as the ones that would be generated for a program which does not access the heap (but which has additional variables corresponding to data-typed heap fields). C Formalization of RSep and Sep In this section we present the full proof systems for RSep and Sep, as well as the full set of constraint generation rules which we described in Section 5. The syntax and semantics of RSep formulas, in terms of stacks and heaps, are shown in Figures 12 and 13. Syntax x, y ∈ HVar Heap variables A ∈ DTerm First-order term that evaluates to value in D a, b ∈ DVar Data variables ϕ ∈ DFormula Data formulas Z ∈ RPred Recursive predicates θ ∈ Refinement ::= λ~a.ϕ X ⊆ Var ::= x | a E, F ∈ HTerm ::= null | x Æ ::= A | E Π ∈ Pure ::= true | E = E | E 6= E | ϕ | Π ∧ Π ~ E) ~ E] ~ | Z(θ, ~ H ∈ Heaplet ::= true | emp | E 7→ [A, Σ ∈ Spatial ::= H | H ∗ Σ P ∈ RSep ::= (∃X. Π : Σ) Fig. 12. Syntax of RSep formulas. D Spatial interpolation for assumptions In the spatial interpolation rules for assume presented in Section 4, we encountered the following problem: we have an equality or disequality assertion Π, a symbolic heap S, and a formula M such that S ∧ Π ` M , and we need to compute a formula M 0 such that S ` M 0 and M 0 ∧ Π ` M . Moreover, we wish M 0 to be as weak as possible (i.e., M 0 should be “close to M ” rather than “close to S”). In this section, we will define a recursive procedure pitp(S, Π, M ) which takes as input a symbolic heap S, an equality or disequality formula Π, and a Sep formula M such that S ∧ Π ` M and computes a formula M 0 = pitp(S, Π, M ) such that S ` M 0 and M 0 ∧ Π ` M . We will assume that S = ΠS : ΣS is saturated in the sense that for any assertion Π0 , if S ` Π0 then ΠS ` Π0 , and that S ∧ Π is satisfiable. We observe that if M has existentially quantified variables, they can be instantiated using the proof of S ∧ Π ` M . Thus we may assume that M is quantifier-free, and write M as M = ΠM : H1 ∗· · · ∗ Hn The proof of S ∧ Π ` M also induces an n-colouring on S which colours each points-to predicate in S with the index i of the corresponding heaplet Hi (cf. step 1 of the bounded abduction procedure presented in Section 6). We may thus write S as follows: S = ΠS : [Σ1 ]1 ∗· · · ∗ [Σn ]n (such that for each i, ΠS ∧ Π : Σi ` ΠM : Hi ). 0 0 0 We will compute a pure formula ΠM such that ΠS ` ΠM and ΠM ∧ Π ` ΠM and for each i we will compute a formula Pi such that ΠS : Σi ` Pi and 0 Pi ∧ Π ` Hi . We then take pitp(S, Π, M ) to be ΠM : P1 ∗· · · ∗ Pn . 0 First, we show how to compute ΠM . Note that note that since S is saturated, the fact that S ∧ Π ` M implies ΠS ∧ Π ` ΠM . We will assume that ΠM consists of a single equality or disequality: the procedure can be extended to arbitrary conjunction by applying it separately for each conjunct and conjoining 0 the results. If ΠS ` ΠM then we simply take ΠM to be ΠM . Otherwise, assume w, x, y, z are such that Π is an equality or disequality w = x / w 6= x and ΠM is an equality or disequality y = z / y 6= z. Since ΠS ∧ Π ` ΠM and ΠS 6` ΠM , there is some y 0 , z 0 ∈ {w, x} such that ΠS ` y = y 0 ∧ z = z 0 (to see why, consider 0 each of the four cases for ΠS and ΠM ). We take ΠM to be y = y 0 ∧ z = z 0 . Finally, we show how to compute Pi (for each i ∈ [1, n]). If ΠS : Σi ` Hi , ~ for some then we simply take Pi to be Hi . Otherwise, suppose that Hi is Z(E) ~ (the case that Hi is a points-to predicate predicate Z and vector of heap terms E ~0 is essentially a special case). First, we attempt to find a vector of heap terms E 0 0 ~ such that ΠS : Σi ` Z(E ) and ΠS ∧ Π ` Ej = Ej for each j (noting that there ~ 0 to choose from). If we succeed, we may take Pi to be are finitely many such E V 0 0 0 ~ Π : Z(E ), where Π = pitp(S, Π, j Ej = Ej0 ). If we fail, then since ΠS ∧ Π : ~ x]. ~ there is some Q ∈ cases(Z(R, ~ ~x)) such that ΠS ∧ Π : Σi ` Q[E/~ Σi ` Z(E), ~ x]). We may take Pi to be pitp(ΠS : Σi , Π, Q[E/~ Semantic Domains Var = HVar + DVar Val = Loc + D Stack = Var → Val Heap = Loc *fin Rec Rec = hN *fin D, N *fin Loci State = Stack × Heap Satisfaction Semantics s, h |= E = F ⇐⇒ JEK(s) = JF K(s) s, h |= E 6= F ⇐⇒ JEK(s) 6= JF K(s) s, h |= ϕ ⇐⇒ JϕK(s) s, h |= Π1 ∧ Π2 ⇐⇒ (s, h |= Π1 ) and (s, h |= Π2 ) ~ ⇐⇒ ∃P ∈ cases(Z(R, ~ ~x)).s, h |= P [~τ /R, ~ E/~ ~ x] s, h |= Z(~τ , E) s, h |= emp ⇐⇒ dom(h) = ∅ ~ F~ ] ⇐⇒ dom(h) = {JEK(s)} s, h |= E 7→ [A, and h(JEK(s)) = ~ h{i 7→ JAi K(s)|i ∈ [1, |A|]}, {i 7→ JFi K(s)|i ∈ [1, |F~ |]}i s, h |= Σ ∗ Σ 0 ⇐⇒ there exists h0 , h1 s.t. h0 ] h1 = h and (s, h0 |= Σ) and (s, h1 |= Σ 0 ) s, h |= Π : Σ ⇐⇒ (s, h |= Π) and (s, h |= Σ) s, h |= (∃X. Π : Σ) ⇐⇒ there exists s : X → Val s.t. s ⊕ s, h |= Π : Σ Note that we model records (Rec) as two finite maps representing data fields and heap fields. We use ] to denote union of functions with disjoint domains, and ⊕ to denote overriding union of functions. Fig. 13. Stack/heap semantics of RSep formulas. Entailment rules Empty Π |= Π 0 0 Π : emp ` Π : emp ∃-left P [x0 /x] ` Q ∃-right P ` Q[Æ/x] (∃x. P ) ` Q P ` (∃x. Q) Predicate Π |= Π 0 ϕ1 ∧ Π |= ϕ01 ··· ϕn ∧ Π |= ϕ0n Where τi = (λ~ai .ϕi ) 0 0 and τi0 = (λ~ai .ϕ0i ) ~ ` Π : Z(~τ , E) ~ Π : Z(~τ , E) True Π |= Π 0 0 Points-to Π : Σ ` Π : true Π |= Π 0 ~ F ~ ] ` Π0 : E → ~ F ~] Π:E→ 7 [A, 7 [A, Star Π : Σ0 ` Π 0 : Σ00 Π : Σ1 ` Π 0 : Σ10 Π : Σ0 ∗ Σ1 ` Π 0 : Σ00 ∗ Σ10 Substitution Π[E/x] : Σ[E/x] ` Π 0 [E/x] : Σ 0 [E/x] 0 Π:Σ`Π :Σ Π |= x = E 0 null-not-Lval ~ F ~ ] ` Π 0 : Σ0 Π ∧ E 6= null : Σ ∗ E 7→ [A, ~ F ~ ] ` Π 0 : Σ0 Π : Σ ∗ E 7→ [A, *-Partial ~ E] ~ ∗ F 7→ [B, ~ F ~ ] ` Π 0 : Σ0 Π ∧ E 6= F : Σ ∗ E → 7 [A, ~ E] ~ ∗ F 7→ [B, ~ F ~ ] ` Π 0 : Σ0 Π : Σ ∗ E 7→ [A, Fold ~ E/~ ~ x] Π : Σ ` Π 0 : Σ 0 ∗ P [~τ /R, ~ ~ P ∈ cases(Z(R, x)) 0 0 ~ Π : Σ ` Π : Σ ∗ Z(~τ , E) Unfold ~ E/~ ~ x] ` Π 0 : Σ 0 Π : Σ ∗ P1 [~τ /R, ~ E/~ ~ x] ` Π 0 : Σ 0 ··· Π : Σ ∗ Pn [~τ /R, ~ ~ {P1 , . . . , Pn } = cases(Z(R, x)) ~ ` Π 0 : Σ0 Π : Σ ∗ Z(~τ , E) Fig. 14. RSep Proof System Execution rules Assign {Π : Σ} x := Æ {(∃x0 . Π[x0 /x] ∧ x = Æ[x0 /x] : Σ[x0 /x])} Sequence {P } π0 {O} Assume {Π : Σ} assume(Π 0 ) {Π ∧ Π 0 : Σ} {O} π1 {Q} {P } π0 ; π1 {Q} Data-Store ~ E] ~ Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, ~ ~ {Π : Σ} x->Di := A {Π 0 : Σ 0 ∗ x 7→ [A[A/A i ], E]} Heap-Store ~ E] ~ Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, 0 0 ~ ~ {Π : Σ} x->Ni := E {Π : Σ ∗ x 7→ [A, E[E/E i ]]} Data-Load {Π : Σ} y ~ E] ~ Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, := x->Di 0 ~ E])[y ~ {(∃y 0 . Π 0 [y 0 /y] ∧ y = Ai [y 0 /y] : (Σ 0 ∗ x 7→ [A, /y])} Free ~ E] ~ Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, {Π : Σ} free(x) {Π 0 : Σ 0 } Heap-Load {Π : Σ} y ~ E] ~ Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, := x->Ni 0 ~ E])[y ~ {(∃y 0 . Π 0 [y 0 /y] ∧ y = Ei [y 0 /y] : (Σ 0 ∗ x 7→ [A, /y])} Consequence P0 ` P {P } c {Q} 0 Q ` Q0 0 {P } c {Q } Alloc {Π : Σ} x := new(n,m) {(∃x0 , ~a, ~ y . Π[x0 /x] : Σ[x0 /x] ∗ x 7→ [~a, ~ y ])} Exists {P } c {Q} {(∃x. P )} c {Q} x∈ / Var(Q) ∪ Var(c) Fig. 15. RSep proof system. Predicate Π |= Π 0 ~ ` Π 0 : Z(E) ~ Π : Z(E) Fold ~ x] Π : Σ ` Π 0 : Σ 0 ∗ P [E/~ ~ ~ P ∈ cases(Z(R, x)) 0 0 ~ Π : Σ ` Π : Σ ∗ Z(E) Unfold ~ x] ` Π 0 : Σ 0 Π : Σ ∗ P1 [E/~ ··· ~ x] ` Π 0 : Σ 0 Π : Σ ∗ Pn [E/~ ~ ~ {P1 , . . . , Pn } = cases(Z(R, x)) ~ ` Π 0 : Σ0 Π : Σ ∗ Z(E) Fig. 16. Sep proof system. All other entailment and execution rules are as in Figure 14. Entailment rules Empty True Π |= Π 0 Φ ← Φ I Π ∧ Φ : emp ` Π ∧ Φ : emp 0 0 0 Π |= Π 0 Φ ← Φ I Π ∧ Φ : Σ ` Π 0 ∧ Φ0 : true 0 Inconsistent Π |= false ∃-left C I P [x0 /x] ` Q [] I Π ∧ Φ : Σ ` Π 0 ∧ Φ0 : Σ 0 C I (∃x. P ) ` Q Substitution C I Π[E/x] ∧ Φ : Σ[E/x] ` Π 0 [E/x] ∧ Φ0 : Σ 0 [E/x] Π |= x = E C I Π ∧ Φ : Σ ` Π 0 ∧ Φ0 : Σ 0 null-not-Lval ~ F ~ ] ` Π 0 ∧ Φ0 : Σ 0 C I Π ∧ Φ ∧ E 6= null : Σ ∗ E 7→ [A, ~ F ~ ] ` Π 0 ∧ Φ0 : Σ 0 C I Π ∧ Φ : Σ ∗ E 7→ [A, ∃-right C I P ` Q[Æ/x] C I P ` (∃x. Q) *-Partial ~ E] ~ ∗ F 7→ [B, ~ F ~ ] ` Π 0 ∧ Φ0 : Σ 0 C I Π ∧ E 6= F ∧ Φ : Σ ∗ E → 7 [A, ~ E] ~ ∗ F 7→ [B, ~ F ~ ] ` Π 0 ∧ Φ0 : Σ 0 C I Π ∧ Φ : Σ ∗ E 7→ [A, Star C0 I Π ∧ Φ : Σ0 ` Π 0 ∧ Φ0 : Σ00 C1 I Π ∧ Φ : Σ1 ` Π 0 ∧ Φ0 : Σ10 C0 ; C1 I Π ∧ Φ : Σ0 ∗ Σ1 ` Π 0 ∧ Φ0 : Σ00 ∗ Σ10 Points-to Π |= Π 0 ~ F ~ ] ` Π 0 ∧ Φ0 : E 7→ [A, ~ F ~] Φ0 ← Φ I Π ∧ Φ : E 7→ [A, Fold ~ E/~ ~ x] C I Π : Σ ` Π 0 : Σ 0 ∗ P [~τ /R, ~ ~ P ∈ cases(Z(R, x)) 0 0 ~ C I Π : Σ ` Π : Σ ∗ Z(~τ , E) Unfold ~ E/~ ~ x] ` Π 0 : Σ 0 C1 I Π : Σ ∗ P1 [~τ /R, ~ E/~ ~ x] ` Π 0 : Σ 0 ··· Cn I Π : Σ ∗ Pn [~τ /R, ~ ~ {P1 , . . . , Pn } = cases(Z(R, x)) ~ ` Π 0 : Σ0 C1 ; . . . ; Cn I Π : Σ ∗ Z(~τ , E) Predicate Π |= Π 0 Where τi = (λ~ai .Ψi ) 0 0 ~ ` Π 0 ∧ Φ0 : Z(τ~0 , E) ~ and τi0 = (λ~ai .Ψi0 ) Φ0 ← Φ; Ψ10 ← Ψ1 ∧ Φ; . . . ; Ψ|~ τ , E) τ | ← Ψ|~ τ | ∧ Φ I Π ∧ Φ : Z(~ Fig. 17. Constraint Generation: Entailment Rules Execution rules Free ~ E] ~ C I P ` Π ∧ Φ : Σ ∗ x 7→ [A, Data-Assume C I P ∧ϕ`Q C I {P } assume(ϕ) {Q} C I {P } free(x) {Π ∧ Φ : Σ} Sequence b C0 I {P } π0 {O} b π1 {Q} C1 I {O} C0 ; C1 I {P } π0 ; π1 {Q} Data-Load C1 b:Σ b ∗ x 7→ [A, ~ E]) ~ C0 I P ` (∃X. Π ∧ Φ 0 0 0 0 b b ~ E])[a ~ I (∃X, a . Π[a /a] ∧ Φ[a /a] ∧ a = Ai [a /a] : (Σ ∗ x 7→ [A, /a]) ` Q 0 C0 ; C1 I {P } a := x->Di {Q} Data-Assign C I (∃a0 . Π ∧ Φ[a0 /a] ∧ a = A[a0 /a] : Σ[a0 /a] ` Q) C I {Π ∧ Φ : Σ} a := A {Q} Data-Store b:Σ b ∗ x 7→ [A, ~ E]) ~ C0 I P ` (∃X. Π ∧ Φ 0 0 0 b b ~ ~ `Q C1 I (∃X, a . Π ∧ Φ ∧ a = A : Σ ∗ x 7→ [A[a /Ai ], E]) C0 ; C1 I {P } x->Di := A {Q} Alloc C I (∃x0 , ~a, ~ x. Π[x0 /x] ∧ Φ : Σ[x0 /x] ∗ x 7→ [~a, ~ x]) ` Q C I {Π ∧ Φ : Σ} x := new(n,m) {Q} Heap-Store ~ E] ~ C I Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, 0 0 ~ E[E/E ~ C I {Π : Σ} x->Ni := E {Π : Σ ∗ x 7→ [A, i ]]} Consequence C1 I P 0 ` Pb b C2 I {Pb} c {Q} b ` Q0 C3 I Q C1 ; C2 ; C3 I {P 0 } c {Q0 } Heap-Load C I {Π : Σ} y ~ E] ~ C I Π : Σ ` Π 0 : Σ 0 ∗ x 7→ [A, := x->Ni 0 ~ E])[y ~ {(∃y 0 . Π 0 [y 0 /y] ∧ y = Ei [y 0 /y] : (Σ 0 ∗ x 7→ [A, /y])} Fig. 18. Constraint Generation: Execution Rules
6cs.PL
arXiv:cs/0512057v1 [cs.PL] 14 Dec 2005 Resource Control for Synchronous Cooperative Threads∗ Roberto M. Amadio Université Paris 7 † Silvano Dal Zilio CNRS Marseille‡ 7th May 2017 Abstract We develop new methods to statically bound the resources needed for the execution of systems of concurrent, interactive threads. Our study is concerned with a synchronous model of interaction based on cooperative threads whose execution proceeds in synchronous rounds called instants. Our contribution is a system of compositional static analyses to guarantee that each instant terminates and to bound the size of the values computed by the system as a function of the size of its parameters at the beginning of the instant. Our method generalises an approach designed for first-order functional languages that relies on a combination of standard termination techniques for term rewriting systems and an analysis of the size of the computed values based on the notion of quasi-interpretation. We show that these two methods can be combined to obtain an explicit polynomial bound on the resources needed for the execution of the system during an instant. As a second contribution, we introduce a virtual machine and a related bytecode thus producing a precise description of the resources needed for the execution of a system. In this context, we present a suitable control flow analysis that allows to formulate the static analyses for resource control at byte code level. 1 Introduction The problem of bounding the usage made by programs of their resources has already attracted considerable attention. Automatic extraction of resource bounds has mainly focused on (first-order) functional languages starting from Cobham’s characterisation [18] of polynomial time functions by bounded recursion on notation. Following work, see e.g. ∗ Work partially supported by ACI Sécurité Informatique CRISS. Laboratoire Preuves, Programmes et Systèmes, UMR-CNRS 7126. ‡ Laboratoire d’Informatique Fondamentale de Marseille, UMR-CNRS 6166 † 1 [8, 19, 21, 23], has developed various inference techniques that allow for efficient analyses while capturing a sufficiently large range of practical algorithms. Previous work [10, 24] has shown that polynomial time or space bounds can be obtained by combining traditional termination techniques for term rewriting systems with an analysis of the size of computed values based on the notion of quasi-interpretation. Thus, in a nutshell, resource control relies on termination and bounds on data size. This approach to resource control should be contrasted with traditional worst case execution time technology (see, e.g., [30]): the bounds are less precise but they apply to a larger class of algorithms and are functional in the size of the input, which seems more appropriate in the context of the applications we have in mind (see below). In another direction, one may compare the approach with the one based on linear logic (see, e.g., [7]): while in principle the linear logic approach supports higher-order functions, it does not offer yet a user-friendly programming language. In [3, 4], we have considered the problem of automatically inferring quasi-interpretations in the space of multi-variate max-plus polynomials. In [1], we have presented a virtual machine and a corresponding bytecode for a first-order functional language and shown how size and termination annotations can be formulated and verified at the level of the bytecode. In particular, we can derive from the verification an explicit polynomial bound on the space required to execute a given bytecode. In this work, we aim at extending and adapting these results to a concurrent framework. As a starting point, we choose a basic model of parallel threads interacting on shared variables. The kind of concurrency we consider is a cooperative one. This means that by default a running thread cannot be preempted unless it explicitly decides to return the control to the scheduler. In preemptive threads, the opposite hypothesis is made: by default a running thread can be preempted at any point unless it explicitly requires that a series of actions is atomic. We refer to, e.g., [28] for an extended comparison of the cooperative and preemptive models. Our viewpoint is pragmatic: the cooperative model is closer to the sequential one and many applications are easier to program in the cooperative model than in the preemptive one. Thus, as a first step, it makes sense to develop a resource control analysis for the cooperative model. The second major design choice is to assume that the computation is regulated by a notion of instant. An instant lasts as long as a thread can make some progress in the current instant. In other terms, an instant ends when the scheduler realizes that all threads are either stopped, or waiting for the next instant, or waiting for a value that no thread can produce in the current instant. Because of this notion of instant, we regard our model as synchronous. Because the model includes a logical notion of time, it is possible for a thread to react to the absence of an event. The reaction to the absence of an event is typical of synchronous languages such as Esterel [9]. Boussinot et al. have proposed a weaker version of this feature where the reaction to the absence happens in the following instant [13] and they have implemented it in various programming environments based on C, Java, and Scheme [31]. Applications suited to this programming style include: event-driven applications, graphical user interfaces, simulations (e.g. N-bodies problem, cellular automata, ad hoc networks), web 2 services, multiplayer online games, . . . Boussinot et al. have also advocated the relevance of this concept for the programming of mobile code and demonstrated that the possibility for a ‘synchronous’ mobile agent to react to the absence of an event is an added factor of flexibility for programs designed for open distributed systems, whose behaviours are inherently difficult to predict. These applications rely on data structure such as lists and trees whose size needs to be controlled. Recently, Boudol [12] has proposed a formalisation of this programming model. Our analysis will essentially focus on a small fragment of this model without higher-order functions, and where the creation of fresh memory cells (registers) and the spawning of new threads is only allowed at the very beginning of an instant. We believe that what is left is still expressive and challenging enough as far as resource control is concerned. Our analysis goes in three main steps. A first step is to guarantee that each instant terminates (Section 3.1). A second step is to bound the size of the computed values as a function of the size of the parameters at the beginning of the instant (Section 3.2). A third step, is to combine the termination and size analyses. Here we show how to obtain polynomial bounds on the space and time needed for the execution of the system during an instant as a function of the size of the parameters at the beginning of the instant (Section 3.3). A characteristic of our static analyses is that to a great extent they make abstraction of the memory and the scheduler. This means that each thread can be analysed separately, that the complexity of the analyses grows linearly in the number of threads, and that an incremental analysis of a dynamically changing system of threads is possible. Preliminary to these analyses, is a control flow analysis (Section 2.1) that guarantees that each thread performs each read instruction (in its body code) at most once in an instant. This condition is instrumental to resource control. In particular, it allows to regard behaviours as functions of their initial parameters and the registers they may read in the instant. Taking this functional viewpoint, we are able to adapt the main techniques developed for proving termination and size bounds in the first-order functional setting. We point out that our static size analyses are not intended to predict the size of the system after arbitrarily many instants. This is a harder problem which in general requires an understanding of the global behaviour of the system and/or stronger restrictions on the programs we can write. For the language studied in this paper, we advocate a combination of our static analyses with a dynamic controller that at the end of each instant checks the size of the parameters of the system and may decide to stop some threads taking too much space. Along the way and in appendix A, we provide a number of programming examples illustrating how certain synchronous and/or concurrent programming paradigms can be represented in our model. These examples suggest that the constraints imposed by the static analyses are not too severe and that their verification can be automated. As a second contribution, we describe a virtual machine and the related bytecode for our programming model (Section 4). This provides a more precise description of the resources needed for the execution of the systems we consider and opens the way to the verification of resource bounds at the bytecode level, following the ‘typed assembly language’ approach adopted in [1] for the purely functional fragment of the language. More precisely, we de3 scribe a control flow analysis that allows to recover the conditions for termination and size bounds at bytecode level and we show that the control flow analysis is sufficiently liberal to accept the code generated by a rather standard compilation function. Proofs are available in appendix B. 2 A Model of Synchronous Cooperative Threads A system of synchronous cooperative threads is described by (1) a list of mutually recursive type and constructor definitions and (2) a list of mutually recursive function and behaviour definitions relying on pattern matching. In this respect, the resulting programming language is reminiscent of Erlang [5], which is a practical language to develop concurrent applications. The set of instructions a behaviour can execute is rather minimal. Indeed, our language can be regarded as an intermediate code where, for instance, general patternmatching has been compiled into a nesting of if then else constructs and complex control structures have been compiled into a simple tail-recursive form. Types We denote type names with t, t′ , . . . and constructors with c, c′ , . . . We will also denote with r, r′ , . . . constructors of arity 0 and of ‘reference’ type (see equation of kind (2) below) and we will refer to them as registers (thus registers are constructors). The values v, v ′, . . . computed by programs are first order terms built out of constructors. Types and constructors are declared via recursive equations that may be of two kinds: (1) (2) t = . . . | c of t1 , . . . , tn | . . . t = Ref (t′ ) with . . . | r = v | . . . In (1) we declare a type t with a constructor c of functional type (t1 , . . . , tn ) → t. In (2) we declare a type t of registers referencing values of type t′ and a register r with initial value v. As usual, type definitions can be mutually recursive (functional and reference types can be intermingled) and it is assumed that all types and constructors are declared exactly once. This means that we can associate a unique type with every constructor and that with respect to this association we can say when a value is well-typed. For instance, we may define the type nat of natural numbers in unary format by the equation nat = z | s of nat and the type llist of linked lists of natural numbers by the equations nlist = nil | cons of (nat, llist) and llist = Ref (nlist) with r = cons(z, r). The last definition declares a register r of type llist with initial value the infinite (cyclic) list containing only z’s. Finally, we have a special behaviour type, beh. Elements of type beh do not return a value but produce side effects. We denote with β either a regular type or beh. Expressions We let x, y, . . . denote variables ranging over values. The size |v| of a value v is defined by |c| = 0 and |c(v1 , . . . , vn )| = 1 + |v1 | + · · · + |vn |. In the following, we will use the vectorial notation a to denote either a vector a1 , . . . , an or a sequence a1 · · · an 4 of elements. We use σ, σ ′ , . . . to denote a substitution [v/x], where v and x have the same length. A pattern p is a well-typed term built out of constructors and variables. In particular, a shallow linear pattern p is a pattern c(x1 , . . . , xn ), where c is a constructor of arity n and the variables x1 , . . . , xn are all distinct. Expressions, e, and expression bodies, eb, are defined as: e ::= x | c(e1 , . . . , ek ) | f (e1 , . . . , en ) eb ::= e | match x with p then eb else eb where f is a functional symbol of type (t1 , . . . , tn ) → t, specified by an equation of the kind f (x1 , . . . , xn ) = eb, and where p is a shallow linear pattern. A closed expression body eb evaluates to a value v according to the following standard rules: (e1 ) (e4 ) r⇓r  (e2 ) e⇓v c(e) ⇓ c(v) (e3 ) [v/x]eb 1 ⇓ v  match c(v) with c(x) ⇓v then eb 1 else eb 2 e ⇓ v, (e5 )  f (x) = eb, [v/x]eb ⇓ v f (e) ⇓ v eb 2 ⇓ v c 6= d  match c(v) with d(x) ⇓v then eb 1 else eb 2 Since registers are constructors, rule (e1 ) is a special case of rule (e2 ); we keep the rule for clarity. Behaviours Some function symbols may return a thread behaviour b, b′ , . . . rather than a value. In contrast to ‘pure’ expressions, a behaviour does not return a result but produces side-effects by reading and writing registers. A behaviour may also affect the scheduling status of the thread executing it. We denote with b, b′ , . . . behaviours defined as follows: b ::= stop | f (e) | yield .b | next.f (e) | ̺ := e.b | read ̺ with p1 ⇒ b1 | · · · | pn ⇒ bn | [ ] ⇒ f (e) | match x with c(x) then b1 else b2 where: (i) f is a functional symbol of type t1 , . . . , tn → beh, defined by an equation f (x) = b, (ii) ̺, ̺′ , . . . range over variables and registers, and (iii) p1 , . . . , pn are either shallow linear patterns or variables. We also denote with [ ] a special symbol that will be used in the default case of read expressions (see the paragraph Scheduler below). Note that if the pattern pi is a variable then the following branches including the default one can never be executed. The effect of the various instructions is informally described as follows: stop, terminates the executing thread for ever; yield .b, halts the execution and hands over the control to the scheduler — the control should return to the thread later in the same instant and execution resumes with b; f (e) and next.f (e) switch to another behaviour immediately or at the beginning of the following instant; r := e.b, evaluates the expression e, assigns its value to r and proceeds with the evaluation of b; read r with p1 ⇒ b1 | · · · | pn ⇒ bn | [ ] ⇒ b, waits until the value of r matches one of the patterns p1 , . . . , pn (there could be no 5 delay) and yields the control otherwise; if at the end of the instant the thread is always stuck waiting for a matching value then it starts the behaviour b in the following instant; match v with p then b1 else b2 filters the value v according to the pattern p, it never blocks the execution. Note that if p is a pattern and v is a value there is at most one matching substitution σ such that v = σp. X Behaviour reduction is described by the 9 rules below. A reduction (b, s)→(b′ , s′) means that the behaviour b with store s runs an atomic sequence of actions till b′ , producing a store s′ , and returning the control to the scheduler with status X. A status is a value in {N, R, S, W } that represents one of the four possible state of a thread — N stands for next (the thread will resume at the beginning of the next instant), R for run, S for stopped, and W for wait (the thread is blocked on a read statement). (b1 ) S (stop, s) → (stop, s) (b2 ) R (yield .b, s) → (b, s) (b3 ) N (next .f (e), s) → (f (e), s) X X (b2 , s) → (b′ , s′ ), c 6= d ([v/x]b1 , s) → (b′ , s′ )    match c(v) match c(v) (b ) (b4 ) 5 X X  with c(x)  with d(x) , s → (b′ , s′ ) , s → (b′ , s′ ) then b1 else b2 then b1 else b2 X no pattern matches s(r) s(r) = σp, (σb, s) → (b′ , s′ ) (b7 ) (b6 ) W X (read r . . . , s) → (read r . . . , s) (read r with · · · | p ⇒ b | . . . , s) → (b′ , s′ )  (b8 ) e ⇓ v, f (x) = b, X ([v/x]b, s) → (b′ , s′ ) X (f (e), s) → (b′ , s′ ) (b9 ) e ⇓ v, X (b, s[v/r]) → (b′ , s′ ) X (r := e.b, s) → (b′ , s′ ) We denote with be either an expression body or a behaviour. All expressions and behaviours are supposed to be well-typed. As usual, all formal parameters are supposed to be distinct. In the match x with c(y) then be 1 else be 2 instruction, be 1 may depend on y but not on x while be 2 may depend on x but not on y. Systems We suppose that the execution environment consists of n threads and we associate with every thread a distinct identity that is an index in Zn = {0, 1, . . . , n − 1}. We let B, B ′ , . . . denote systems of synchronous threads, that is finite mappings from thread indexes to pairs (behaviour, status). Each register has a type and a default value — its value at the beginning of an instant — and we use s, s′ , . . . to denote a store, an association between registers and their values. We suppose that at the beginning of each instant the store is so , such that each register is assigned its default value. If B is a system and i ∈ Zn is a valid thread index then we denote with B1 (i) the behaviour executed by the thread i and with B2 (i) its current status. Initially, all threads have status R, the current thread index is 0, and B1 (i) is a behaviour expression of the shape f (v) for all i ∈ Zn . System reduction is described by a relation (B, s, i) → (B ′ , s′ , i′ ): the system B with store s and 6 current thread (index) i runs an atomic sequence of actions and becomes (B ′ , s′ , i′ ). X ′ ′ ′ ′ (s1 ) (B1 (i), s) → (b , s ), B2 (i) = R,′ B′ = B[(b , X)/i], (B, s, i) → (B [(B1 (k), R)/k], s′ , k) X (s2 ) (B1 (i), s) → (b′ , s′ ), B2 (i) = R, B ′ = B[(b′ , X)/i], B ′′ = U (B ′ , s′ ), N (B ′′ , so , 0) = k (B, s, i) → (B ′′ , so , k) N (B ′ , s′ , i) = k N (B ′ , s′ , i) ↑, Scheduler The scheduler is determined by the functions N and U. To ensure progress of the scheduling, we assume that if N returns an index then it must be possible to run the corresponding thread in the current instant and that if N is undefined (denoted N (. . . ) ↑) then no thread can be run in the current instant. If N (B, s, i) = k then B2 (k) = R or ( B2 (k) = W and B1 (k) = read r with · · · | p ⇒ b | . . . and some pattern matches s(r) i.e., ∃σ σp = s(r) ) If N (B, s, i) ↑ then ∀k ∈ Zn , B2 (k) ∈ {N, S} or ( B2 (k) = W, B1 (k) = read r with . . . , and no pattern matches s(r) ) When no more thread can run, the instant ends and the function U performs the following status transitions: N → R, W → R. We assume here that every thread in status W takes the [ ] ⇒ . . . branch at the beginning of the next instant. Note that the function N is undefined on the updated system if and only if all threads are stopped.  if B(i) = (b, S)  (b, S) U (B, s)(i) = (b, R) if B(i) = (b, N )  (f (e), R) if B(i) = (read r with · · · | [ ] ⇒ f (e), W ) Example 1 (channels and signals) The read instruction allows to read a register subject to certain filter conditions. This is a powerful mechanism which recalls, e.g., Linda communication [15], and that allows to encode various forms of channel and signal communication. (1) We want to represent a one place channel c carrying values of type t. We introduce a new type ch(t) = empty | full of t and a register c of type Ref (ch(t)) with default value empty. A thread should send a message on c only if c is empty and it should receive a message only if c is not empty (a received message is discarded). These operations can be modelled using the following two derived operators: send (c, e).b =def read c with empty ⇒ c := full(e).b receive(c, x).b =def read c with full(x) ⇒ c := empty.b (2) We want to represent a fifo channel c carrying values of type t such that a thread can always emit a value on c but may receive only if there is at least one message in the 7 channel. We introduce a new type fch(t) = nil | cons of t, fch(t) and a register c of type Ref (fch(t)) with default value nil. Hence a fifo channel is modelled by a register holding a list of values. We consider two read operations — freceive to fetch the first message on the channel and freceiveall to fetch the whole queue of messages — and we use the auxiliary function insert to queue messages at the end of the list: fsend (c, e).b =def read c with l ⇒ c := insert(e, l).b freceive(c, x).b =def read c with cons(x, l) ⇒ c := l.b freceiveall (c, x).b =def read c with cons(y, l) ⇒ c := nil.[cons(y, l)/x]b insert(x, l) = match l with cons(y, l′ ) then cons(y, insert(x, l′ )) else cons(x, nil) (3) We want to represent a signal s with the typical associated primitives: emitting a signal and blocking until a signal is present. We define a type sig = abst | prst and a register s of type Ref (sig) with default value abst, meaning that a signal is originally absent: emit(s).b =def s := prst.b wait (s).b =def read s with prst ⇒ b Example 2 (cooperative fragment) The cooperative fragment of the model with no synchrony is obtained by removing the next instruction and assuming that for all read instructions the branch [ ] ⇒ f (e) is such that f (. . . ) = stop. Then all the interesting computation happens in the first instant; threads still running in the second instant can only stop. By using the representation of fifo channels presented in Example 1(2) above, the cooperative fragment is already powerful enough to simulate, e.g., Kahn networks [20]. Next, to make possible a compositional and functional analysis for resource control, we propose to restrict the admissible behaviours and we define a simple preliminary control flow analysis that guarantees that this restriction is met. We then rely on this analysis to define a symbolic representation of the states reachable by a behaviour. Finally, we extract from this symbolic control points suitable order constraints which are instrumental to our analyses for termination and value size limitation within an instant. 2.1 Read Once Condition We require and statically check on the call graph of the program (see below) that threads can perform any given read instruction at most once in an instant. 1. We assign to every read instruction in a system a distinct fresh label, y, and we collect all these labels in an ordered sequence, y1 , . . . , ym . In the following, we will sometimes use the notation read hyi ̺ with . . . in the code of a behaviour to make visible the label of a read instruction. 2. With every function symbol f defined by an equation f (x) = b we associate the set L(f ) of labels of read instructions occurring in b. 8 3. We define a directed call graph G = (N, E) as follows: N is the set of function symbols in the program defined by an equation f (x) = b and (f, g) ∈ E if g ∈ Call(b) where Call (b) is the collection of function symbols in N that may be called in the current instant and which is formally defined as follows: Call (stop) = Call (next .g(e)) = ∅ Call (f (e)) = {f } Call (yield .b) = Call (̺ := e.b) = Call (b) Call (match x with p then b1 else b2 ) = Call (b1 ) S ∪ Call (b2 ) Call (read ̺ with p1 ⇒ b1 | · · · | pn ⇒ bn | [ ] ⇒ b) = i=1,...,n Call (bi ) We write f E ∗ g if the node g is the node f in the graph G. We denote S reachable from ∗ with R(f ) the set of labels {L(g) | f E g} and with yf the ordered sequence of labels in R(f ). The definition of Call is such that for every sequence of calls in the execution of a thread within an instant we can find a corresponding path in the call graph. Definition 3 (read once condition) A system satisfies the read once condition if in the call graph there are no loops that go through a node f such that L(f ) 6= ∅. Example 4 (alarm) We consider the representation of signals as in Example 1(3). We assume two signals sig and ring. The behaviour alarm(n, m) will emit a signal on ring if it detects that no signal is emitted on sig for m consecutive instants. The alarm delay is reset to n if the signal sig is present. alarm(x, y) = match y with s(y ′ ) then read hui sig with prst ⇒ next.alarm(x, x) | [ ] ⇒ alarm(x, y ′ ) else ring := prst.stop Hence u is the label associated with the read instruction and L(alarm) = {u}. Since the call graph has just one node, alarm, and no edges, the read once condition is satisfied. To summarise, the read once condition is a checkable syntactic condition that safely approximates the semantic property we are aiming at. Proposition 5 If a system satisfies the read once condition then in every instant every thread runs every read instruction at most once (but the same read instruction can be run by several threads). The following simple example shows that without the read once restriction, a thread can use a register as an accumulator and produce an exponential growth of the size of the data within an instant. 9 Example 6 (exponentiation) We recall that nat = z | s of nat is the type of tally natural numbers. The function dble defined below doubles the value of its parameter so that |dble(n)| = 2|n|. We assume r is a register of type nat with initial value s(z). Now consider the following recursive behaviour: dble(n) = match n with s(n′ ) then s(s(dble(n′ ))) else z exp(n) = match n with s(n′ ) then read r with m ⇒ r := dble(m).exp(n′ ) else stop The function exp does not satisfy the read once condition since the call graph has a loop on the exp node. The evaluation of exp(n) involves |n| reads to the register r and, after each read operation, the size of the value stored in r doubles. Hence, at end of the instant, the register contains a value of size 2|n| . The read once condition does not appear to be a severe limitation on the expressiveness of a synchronous programming language. Intuitively, in most synchronous algorithms every thread reads some bounded number of variables before performing some action. Note that while the number of variables is bounded by a constant, the amount of information that can be read in each variable is not. Thus, for instance, a ‘server’ thread can just read one variable in which is stored the list of requests produced so far and then it can go on scanning the list and replying to all the requests within the same instant. 2.2 Control Points From a technical point of view, an important consequence of the read once condition is that a behaviour can be described as a function of its parameters and the registers it may read during an instant. This fact is used to associate with a system satisfying the read once condition a finite number of control points. A control point is a triple (f (p), be, i) where, intuitively, f is the currently called function, p represents the patterns crossed so far in the function definition plus possibly the labels of the read instructions that still have to be executed, be is the continuation, and i is an integer flag in {0, 1, 2} that will be used to associate with the control point various kinds of conditions. If the function f returns a value and is defined by the equation f (x) = eb, then we associate with f the set C(f, x, eb) defined as follows: C(f, p, eb) = case eb of  : {(f (p), eb, 0)} e match x with c(y) : {(f (p), eb, 2)} ∪ C(f, [c(y)/x]p, eb 1 ) ∪ C(f, p, eb 2 ) then eb 1 else eb 2 On the other hand, suppose the function f is a behaviour defined by the equation f (x) = b. Then we generate a fresh function symbol f + whose arity is that of f plus the size of R(f ), thus regarding the labels yf (the ordered sequence of labels in R(f )) as part of the formal 10 parameters of f + . The set of control points associated with f + is the set C(f + , (x · yf ), b) defined as follows: C(f + , p, b) = case b of (C1 ) stop : {(f + (p), b, 2)} (C2 ) g(e) : {(f + (p), b, 0)} ′ (C3 ) yield .b : {(f + (p), b, 2)} ∪ C(f + , p, b′ ) (C4 ) next.g(e) : {(f + (p), b, 2), (f + (p), g(e), 2)} (C5 ) ̺ := e.b′ : {(f + (p), b, 2), (f + (p), e, 1)} ∪ C(f +, p, b′ )   match x with c(y) {(f + (p), b, 2)} ∪ C(f + , ([c(y)/x]p), b1 ) (C6 ) : then b1 else b2 ∪ C(f + , p, b2 )   {(f + (p), b, 2), (f + (p), g(e), 2)} read hyi ̺ with p1 ⇒ b1 | · · · | : ∪ C(f + , ([p1 /y]p), b1 ) ∪ . . . (C7 ) pn ⇒ bn | [ ] ⇒ g(e) ∪ C(f +, ([pn /y]p), bn ) By inspecting the definitions, we can check that a control point (f (p), be, i) has the property that Var(be) ⊆ Var (p). Definition 7 An instance of a control point (f (p), be, i) is an expression body or a behaviour be ′ = σ(be), where σ is a substitution mapping the free variables in be to values. The property of being an instance of a control point is preserved by expression body evaluation, behaviour reduction and system reduction. Thus the control points associated with a system do provide a representation of all reachable configurations. Indeed, in Appendix B we show that it is possible to define the evaluation and the reduction on pairs of control points and substitutions. Proposition 8 Suppose (B, s, i) → (B ′ , s′ , i′ ) and that for all thread indexes j ∈ Zn , B1 (j) is an instance of a control point. Then for all j ∈ Zn , we have that B1′ (j) is an instance of a control point. In order to prove the termination of the instant and to obtain a bound on the size of computed value, we associate order constraints with control points: Control point (f (p), e, 0) (f + (p), g(e), 0) (f + (p), e, 1) (f + (p), be, 2) Associated constraint f (p) ≻0 e f + (p) ≻0 g+ (e, yg ) f + (p) ≻1 e no constraints A program will be deemed correct if the set of constraints obtained from all the function definitions can be satisfied in suitable structures. We say that a constraint e ≻i e′ has index i. We rely on the constraints of index 0 to enforce termination of the instant and on those of index 0 or 1 to enforce a bound on the size of the computed values. Note that the constraints are on pure first order terms, a property that allows us to reuse techniques developed in the standard term rewriting framework (cf. Section 3). 11 Example 9 With reference to Example 4, we obtain the following control points: (alarm + (x, y, u), match . . . , 2) (alarm + (x, y, u), prst, 1) (alarm + (x, s(y ′ ), u), read . . . , 2) (alarm + (x, s(y ′ ), prst), next.alarm(x, x), 2) (alarm + (x, y, u), ring := prst.stop, 2) (alarm + (x, z, u), stop, 2) (alarm + (x, s(y ′ ), u), alarm (x, y ′ ), 2) (alarm + (x, s(y ′ ), prst), alarm(x, x), 2) The triple (alarm + (x, y, u), prst, 1) is the only control point with a flag different from 2. It corresponds to the constraint alarm + (x, y, u) ≻1 prst, where u is the label associated with the only read instruction in the body of alarm. We note that no constraints of index 0 are generated and so, in this simple case, the control flow analysis can already establish the termination of the thread and all is left to do is to check that the size of the data is under control, which is also easily verified. In Example 2, we have discussed a possible representation of Kahn networks in the cooperative fragment of our model. In general Kahn networks there is no bound on the number of messages that can be written in a fifo channel nor on the size of the messages. Much effort has been put into the static scheduling of Kahn networks (see, e.g., [22, 16, 17]). This analysis can be regarded as a form of resource control since it guarantees that the number of messages in fifo channels is bounded (but says nothing about their size). The static scheduling of Kahn network is also motivated by performance issues, since it eliminates the need to schedule threads at run time. Let us look in some detail at the programming language Lustre, that can be regarded as a language for programming Kahn networks that can be executed synchronously. Example 10 (read once vs. Lustre) A Lustre network is composed of four types of nodes: the combinatorial node, the delay node, the when node, and the merge node. Each node may have several input streams and one output stream. The functional behaviour of each type of node is defined by a set of recursive definitions. For instance, the node When has one boolean input stream b — with values of type bool = false | true — and one input stream s of values. A When node is used to output values from s whenever b is true. This behaviour may be described by the following recursive definitions: When(false · b, x · s) = When(b, s), When(true · b, x · s) = x · When(b, s), and When(b, s) = ǫ otherwise. Here is a possible representation of the When node in our model, where the input streams correspond to one place channels b, c (cf. Example 1(1)), the output stream to a one place channel c′ and at most one element in each input stream is processed per instant. When() = read hui b with full(true) ⇒ read hvi c with full(x) ⇒ c′ := x.next.When() | [ ] ⇒ When() | full(false) ⇒ next.When() | [ ] ⇒ When() While the function When has no formal parameters, we consider the function When + with two parameters u and v in our size and termination analyses. 12 3 Resource Control Our analysis goes in three main steps: first, we guarantee that each instant terminates (Section 3.1), second we bound the size of the computed values as a function of the size of the parameters at the beginning of the instant (Section 3.2), and third we combine the termination and size analyses to obtain polynomial bounds on space and time (Section 3.3). As we progress in our analysis, we refine the techniques we employ. Termination is reduced to the general problem of finding a suitable well-founded order over first-order terms. Bounding the size of the computed values is reduced to the problem of synthesizing a quasi-interpretation. Finally, the problem of obtaining polynomial bounds is attacked by combining recursive path ordering termination arguments with quasi-interpretations. We selected these techniques because they are well established and they can handle a significant spectrum of the programs we are interested in. It is to be expected that other characterisations of complexity classes available in the literature may lead to similar results. 3.1 Termination of the Instant We recall that a reduction order > over first-order terms is a well-founded order that is closed under context and substitution: t > s implies C[t] > C[s] and σt > σs, where C is any one hole context and σ is any substitution (see, e.g, [6]). Definition 11 (termination condition) We say that a system satisfies the termination condition if there is a reduction order > such that all constraints of index 0 associated with the system hold in the reduction order. In this section, we assume that the system satisfies the termination condition. As expected this entails that the evaluation of closed expressions succeeds. Proposition 12 Let e be a closed expression. Then there is a value v such that e ⇓ v and e ≥ v with respect to the reduction order. Moreover, the following proposition states that a behaviour will always return the control to the scheduler. Proposition 13 (progress) Let b be an instance of a control point. Then for all stores X s, there exist X, b′ and s′ such that (b, s) → (b′ , s′ ). Finally, we can guarantee that at each instant the system will reach a configuration in which the scheduler detects the end of the instant and proceeds to the reinitialisation of the store and the status (as specified by rule (s2 )). Theorem 14 (termination of the instant) All sequences of system reductions involving only rule (s1 ) are finite. 13 Proposition 13 and Theorem 14 are proven by exhibiting a suitable well-founded measure which is based both on the reduction order and the fact that the number of reads a thread may perform in an instant is finite. Example 15 (monitor max value) We consider a recursive behaviour monitoring the register i (acting as a fifo channel) and parameterised on a number x representing the largest value read so far. At each instant, the behaviour reads the list l of natural numbers received on i and assigns to o the greatest number in x and l. f (x) = yield .read hii i with l ⇒ f1 (maxl (l, x)) f1 (x) = o := x.next.f (x) max (x, y) = match x with s(x′ ) then match y with s(y ′ ) then s(max (x′ , y ′ )) else s(x′ ) else y maxl (l, x) = match l with cons(y, l′ ) then maxl (l′ , max (x, y)) else x It is easy to prove the termination of the thread by recursive path ordering, where the function symbols are ordered as f + > f1+ > maxl > max , the arguments of maxl are compared lexicographically from left to right, and the constructor symbols are incomparable and smaller than any function symbol. 3.2 Quasi-interpretations Our next task is to control the size of the values computed by the threads. To this end, we propose a suitable notion of quasi-interpretation (cf. [10, 3, 4]). Definition 16 (assignment) Given a program, an assignment q associates with constructors and function symbols, functions over the non-negative reals R+ such that: (1) If c is a constant then qc is the constant 0. (2) If c is a constructor with arity n ≥ 1 then qc is a function in (R+ )n → R+ such that qc (x1 , . . . , xn ) = d + Σi∈1..n xi , for some d ≥ 1. (3) If f is a function (name) with arity n then qf : (R+ )n → R+ is monotonic and for all i ∈ 1..n we have qf (x1 , . . . , xn ) ≥ xi . An assignment q is extended to all expressions e as follows, giving a function expression qe with variables in Var (e): qx = x , qc(e1 ,...,en) = qc (qe1 , . . . , qen ) , qf (e1 ,...,en) = qf (qe1 , . . . , qen ) . Here qx is the identity function and, e.g., qc (qe1 , . . . , qen ) is the functional composition of the function qc with the functions qe1 , . . . , qen . It is easy to check that there exists a constant δq depending on the assignment q such that for all values v we have |v| ≤ qv ≤ δq · |v|. Thus the quasi-interpretation of a value is always proportional to its size. 14 Definition 17 (quasi-interpretation) An assignment is a quasi-interpretation, if for all constraints associated with the system of the shape f (p) ≻i e, with i ∈ {0, 1}, the inequality qf (p) ≥ qe holds over the non-negative reals. Quasi-interpretations are designed so as to provide a bound on the size of the computed values as a function of the size of the input data. In the following, we assume given a suitable quasi-interpretation, q, for the system under investigation. Example 18 With reference to Examples 6 and 15, the following assignment is a quasiinterpretation (the parameter i corresponds to the label of the read instruction in the body of f ). We give no quasi-interpretations for the function exp because it fails the read once condition: qnil = qz = 0 , qs (x) = x + 1 , qcons (x, l) = x + l + 1 , qdble (x) = 2 · x , qf + (x, i) = x + i , qf + (x) = x , qmaxl (x, y) = qmax (x, y) = max (x, y) . 1 One can show [3, 4] that in the purely functional fragment of our language every value v computed during the evaluation of an expression f (v1 , . . . , vn ) satisfies the following condition: |v| ≤ qv ≤ qf (v1 ,...,vn ) = qf (qv1 , . . . , qvn ) ≤ qf (δq · |v1 |, . . . , δq · |vn |) . (1) We generalise this result to threads as follows. Theorem 19 (bound on the size of the values) Given a system of synchronous threads B, suppose that at the beginning of the instant B1 (i) = f (v) for some thread index i. Then the size of the values computed by the thread i during an instant is bounded by qf + (v,u) where u are the values contained in the registers at the time they are read by the thread (or some constant value, if they are not read at all). Theorem 19 is proven by showing that quasi-interpretations satisfy a suitable invariant. In the following corollary, we note that it is possible to express a bound on the size of the computed values which depends only on the size of the parameters at the beginning of the instant. This is possible because the number of reads a system may perform in an instant is bounded by a constant. Corollary 20 Let B be a system with m distinct read instructions and n threads. Suppose B1 (i) = fi (vi ) for i ∈ Zn . Let c be a bound of the size of the largest parameter of the functions fi and the largest default value of the registers. Suppose h is a function bounding all the quasi-interpretations, that is, for all the functions fi+ we have h(x) ≥ qf + (x, . . . , x) i over the non-negative reals. Then the size of the values computed by the system B during an instant is bounded by hn·m+1 (c). 15 Example 21 The n·m iterations of the function h predicted by Corollary 20 correspond to a tight bound, as shown by the following example. We assume n threads and one register, r, of type nat with default value z. The control of each thread is described as follows: f (x0 ) = read r with x1 ⇒ r := dble(max (x1 , x0 )). read r with x2 ⇒ r := dble(x2 ). ...... read r with xm ⇒ r := dble(xm ).next .f (dble(xm )) . For this system we have c ≥ |x0 | and h(x) = qdble (x) = 2 · x. It is easy to show that, at the end of an instant, there have been n · m assignments to the register r (m for every thread in the system) and that the value stored in r is dble n·m (x0 ) of size 2n·m · |x0 |. 3.3 Combining Termination and Quasi-interpretations To bound the space needed for the execution of a system during an instant we also need to bound the number of nested recursive calls, i.e. the number of frames that can be found on the stack (a precise definition of frame is given in the following Section 4). Unfortunately, quasi-interpretations provide a bound on the size of the frames but not on their number (at least not in a direct implementation that does not rely on memoization). One way to cope with this problem is to combine quasi-interpretations with various families of reduction orders [24, 10]. In the following, we provide an example of this approach based on recursive path orders which is a widely used and fully mechanizable technique to prove termination [6]. Definition 22 We say that a system terminates by LPO, if the reduction order associated with the system is a recursive path order where: (1) symbols are ordered so that function symbols are always bigger than constructor symbols and two distinct constructor symbols are incomparable; (2) the arguments of function symbols are compared with respect to the lexicographic order and those of constructor symbols with respect to the product order. Note that because of the hypotheses on constructors, this is actually a special case of the lexicographic path order. For the sake of brevity, we still refer to it as LPO. Definition 23 We say that a system admits a polynomial quasi-interpretation if it has a quasi-interpretation where all functions are bounded by a polynomial. The following property is a central result of this paper. Theorem 24 If a system B terminates by LPO and admits a polynomial quasi-interpretation then the computation of the system in an instant runs in space polynomial in the size of the parameters of the threads at the beginning of the instant. The proof of Theorem 24 is based on Corollary 20 that provides a polynomial bound on the size of the computed values and on an analysis of nested calls in the LPO order that can be found in [10]. The point is that the depth of such nested calls is polynomial in the size of the values and that this allows to effectively compute a polynomial bounding the space necessary for the execution of the system. 16 Example 25 We can check that the order used in Example 15 for the functions f + , f1+ , max and maxl is indeed a LPO. Moreover, from the quasi-interpretation given in Example 18, we can deduce that the function h(x) has the shape a · x + b (it is affine). In practice, many useful functions admit quasi-interpretations bound by an affine function such as the max-plus polynomials considered in [3, 4]. The combination of LPO and polynomial quasi-interpretation actually provides a characterisation of PSPACE. In order to get to PTIME a further restriction has to be imposed. Among several possibilities, we select one proposed in [11]. We say that the system terminates by linear LPO if it terminates by LPO as in definition 22 and moreover if in all the constraints f (p) ≻0 e or f + (p) ≻0 g + (e) of index 0 there is at most one function symbol on the right hand side which has the same priority as the (unique) function symbol on the left-hand side. For instance, the Example 15 falls in this case. In op. cit., it is shown by a simple counting argument that the number of calls a function may generate is polynomial in the size of its arguments. One can then restate theorem 24 by replacing LPO with linear LPO and PSPACE with PTIME. We stress that these results are of a constructive nature, thus beyond proving that a system ‘runs in PSPACE (or PTIME)’, we can extract a definite polynomial that bounds the size needed to run a system during an instant. In general, the bounds are rather rough and should be regarded as providing a qualitative rather than quantitative information. In the purely functional framework, M. Hofmann [19] has explored the situation where a program is non-size increasing which means that the size of all intermediate results is bounded by the size of the input. Transferring this concept to a system of threads is attractive because it would allow to predict the behaviour of the system for arbitrarily many instants. However, this is problematic. For instance, consider again example 25. By Theorem 24, we can prove that the computation of a system running the behaviour f (x0 ) in an instant requires a space polynomial in the size of x0 . Note that the parameter of f is the largest value received so far in the register i. Clearly, bounding the value of this parameter for arbitrarily many instants requires a global analysis of the system which goes against our wish to produce a compositional analysis in the sense explained in the Introduction. An alternative approach which remains to be explored could be to develop linguistic tools and a programming discipline that allow each thread to control locally the size of its parameters. 4 A Virtual Machine We describe a simple virtual machine for our language thus providing a concrete intuition for the data structures required for the execution of the programs and the scheduler. Our motivations for introducing a low-level model of execution for synchronous threads are twofold: (i) it offers a simple formal definition for the space needed for the execution of an instant (just take the maximal size of a machine configuration), and (ii) it explains some of the elaborate mechanisms occurring during the execution, like the synchronisation with 17 the read instruction and the detection of the end of an instant. A further motivation which is elaborated in Section 4.5 is the possibility to carry on the static analyses for resource control at bytecode level. The interest of bytecode verification is now well understood, and we refer the reader to [25, 26]. 4.1 Data Structures We suppose given the code for all the threads running in a system together with a set of types and constructor names and a disjoint set of function names. A function name f will also denote the sequence of instructions of the associated code: f [i] stands for the ith instruction in the (compiled) code of f and |f | stands for the number of instructions. The configuration of the machine is composed of a store s, that maps registers to their current values, a sequence of records describing the state of each thread in the system, and three local registers owned by the scheduler whose role will become clear in Section 4.3. A thread identifier, t, is simply an index in Zn . The state of a thread t is a pair (st t , Mt ) where st t is a status and Mt is the memory of the thread. A memory M is a sequence of frames, and a frame is a triple (f, pc, ℓ) composed of a function name, the value of the program counter (a natural number in 1..|f |), and a stack of values ℓ = v1 · · · vk . We denote with |ℓ| the number of values in the stack. The status of a thread is defined as in the source language, except for the status W which is refined into W (j, n) where: j is the index where to jump at the next instant if the thread does not resume in the current instant, and n is the (logical) time at which the thread is suspended (cf. Section 4.3). 4.2 Instructions The set of instructions of the virtual machine together with their operational meaning is described in Table 1. All instructions operate on the frame of the current thread t and the memory Mt — the only instructions that depend on or affect the store are read and write. For every segment of bytecode, we require that the last instruction is either return, stop or tcall and that the jump index j in the instructions branch c j and wait j is within the segment. 4.3 Scheduler In Table 2 we describe a simple implementation of the scheduler. The scheduler owns three registers: (1) tid that stores the identity of the current thread, (2) time for the current time, and (3) wtime for the last time the store was modified. The notion of time here is of a logical nature: time passes whenever the scheduler transfers control to a new thread. Like in the source language, so denotes the store at the beginning of each instant. The scheduler triggers the execution of the current instruction of the current thread, whose index is stored in tid, with a call to run(tid). The call returns the label X associated with the instruction in Table 1. By convention, take X = ǫ when no label is displayed. If X 6= ǫ then the scheduler must take some action. Assume tid stores the thread index t. We denote 18 Table 1: Bytecode instructions f [pc] load k branch c j branch c j build c n call g n tcall g n return read r read k write r write k Current memory Following memory ′ M · (f, pc, ℓ · v · ℓ ) → M · (f, pc + 1, ℓ · v · ℓ′ · v), |ℓ| = k − 1 M · (f, pc, ℓ · c(v1 , . . . , vn )) → M · (f, pc + 1, ℓ · v1 · · · vn ) M · (f, pc, ℓ · d(. . .)) → M · (f, j, ℓ · d(. . .)) c 6= d M · (f, pc, ℓ · v1 · · · vn ) → M · (f, pc + 1, ℓ · c(v1 , . . . , vn )) M · (f, pc, ℓ · v1 · · · vn ) → M · (f, pc, ℓ · v1 · · · vn ) · (g, 1, v1 · · · vn ) M · (f, pc, ℓ · v1 · · · vn ) → M · (g, 1, v1 · · · vn ) M · (g, pc ′ , ℓ′ · v′ ) · (f, pc, ℓ · v) → M · (g, pc ′ + 1, ℓ′ · v), ar (f ) = |v′ | (M · (f, pc, ℓ), s) → (M · (f, pc + 1, ℓ · s(r)), s) (M · (f, pc, ℓ · r · ℓ′ ), s) → (M · (f, pc + 1, ℓ · r · ℓ′ · s(r)), s), |ℓ| = k − 1 (M · (f, pc, ℓ · v), s) → (M · (f, pc + 1, ℓ), s[v/r]) (M · (f, pc, ℓ · r · ℓ′ · v), s) → (M · (f, pc + 1, ℓ · r · ℓ′ ), s[v/r]), |ℓ| = k − 1 stop M · (f, pc, ℓ) → ǫ yield M · (f, pc, ℓ) → M · (f, pc + 1, ℓ) next M · (f, pc, ℓ) → M · (f, pc + 1, ℓ) wait j M · (f, pc, ℓ · v) → M · (f, j, ℓ) S R N W pc tid the program counter of the top frame (f, pc t , ℓ) in Mt , if any, Itid the instruction f [pc t ] (the current instruction in the thread) and st tid the state st t of the thread. Let us explain the role of the status W (j, n) and of the registers time and wtime. We assume that a thread waiting for a condition to hold can check the condition without modifying the store. Then a thread waiting since time m may pass the condition only if the store has been modified at a time n with m < n. Otherwise, there is no point in passing the control to it1 . With this data structure we also have a simple method to detect the end of an instant, it arises when no thread is in the running status and all waiting threads were interrupted after the last store modification occurred. In models based on preemptive threads, it is difficult to foresee the behaviour of the scheduler which might depend on timing information not available in the model. For this reason and in spite of the fact that most schedulers are deterministic, the scheduler is often modelled as a non-deterministic process. In cooperative threads, as illustrated here, the interrupt points are explicit in the program and it is possible to think of the scheduler as a deterministic process. Then the resulting model is deterministic and this fact considerably simplifies its programming, debugging, and analysis. 1 Of course, this condition can be refined by recording the register on which the thread is waiting, the shape of the expected value,. . . 19 Table 2: An implementation of the scheduler for t in Zn do { st t := R; } s := so ; tid := time := wtime := 0; while (tid ∈ Zn ) { if Itid = (write ) then wtime := time; if Itid = (wait j ) then st tid := W (pc tid + 1, time); X := run(tid); if X 6= ǫ then { if X 6= W then st tid := X; tid := N (tid, st ); if tid ∈ Zn then { st tid := R; time := time + 1; } else { s := so ; wtime := time; tid := N (0, st ); forall i in Zn do { if st i = W (j, ) then pc i := j; if st i 6= S then st i := R; } } } If N (tid, st) = k ∈ Zn If N (tid, st) ∈ / Zn (initialisation) (the initial thread is of index 0) (loop until all threads are blocked) (record store modified) (save continuation for next instant) (run current thread) (update thread status) (compute index of next active thread) (test whether all threads are blocked) (if not, prepare next thread to run) (else, initialisation of the new instant) (select thread to run, starting from 0) Conditions on N : then st k = R or (st k = W (j, n) and n < wtime) then ∀k ∈ Zn (st k 6= R and (st k = W (j, n) implies n ≥ wtime)) 20 Table 3: Compilation of source code to bytecode Compilation of expression bodies: =  C ′ (e, η) · return (branch c j) · C(eb 1 , η ′ · y) · if η = η ′ · x      match x with c(y) (j : C(eb 2 , η)) ,η = C then eb 1 else eb 2 (load i(x, η)) · (branch c j) · o.w.    C(eb 1 , η · y) · (j : C(eb 2 , η · x)) C(e, η) Auxiliary compilation of expressions: C ′ (x, η) = (load i(x, η)) C ′ (c(e1 , . . . , en ), η) = C ′ (e1 , η) · . . . · C ′ (en , η) · (build c n) C ′ (f (e1 , . . . , en ), η) = C ′ (e1 , η) · . . . · C ′ (en , η) · (call f n) Compilation of behaviours: C(stop, η) C(f (e1 , . . . , en ), η) C(yield .b, η) C(next.f (e), η) C(̺ := e.b, η) = = = = = stop C ′ (e1 , η) · · · C ′ (en , η) · (tcall f n) yield · C(b, η) next · C(f (e), η) ′ C  (e, η) · (write i(̺, η))′ · C(b, η) (branch c j) · C(b1 , η · y) · if η = η ′ · x      match x with c(y) (j : C(b2 , η)) C ,η = then b1 else b2 (load i(x, η)) · (branch c j) · o.w.    C(b1 , η · y) · (j : C(b2 , η · x))    j0 : (read i(̺, η)) · . . . · read ̺ with · · · | cℓ (yℓ ) ⇒ bℓ | C ,η = jℓ : (branch cℓ jℓ+1 ) · C(bℓ , η · yℓ )·  · · · y k ⇒ bk · · · j : · · · jk : C(bk , η · yk )  ℓ+1    j0 : (read i(̺, η)) · . . . · read ̺ with · · · | cℓ (yℓ ) ⇒ bℓ | ,η = jℓ : (branch cℓ jℓ+1 ) · C(bℓ , η · yℓ )·  C · · · | [ ] ⇒ g(e) jℓ+1 : · · · jn : (wait j0 ) · C(g(e), η) 21 4.4 Compilation In Table 3, we describe a possible compilation of the intermediate language into bytecode. We denote with η a sequence of variables. If x is a variable and η a sequence then i(x, η) is the index of the rightmost occurrence of x in η. For instance, i(x, x · y · x) = 3. By convention, i(r, η) = r if r is a register constant. We also use the notation j : C(be, η) to indicate that j is the position of the first instruction of C(be, η). This is just a convenient notation since, in practice, the position can be computed explicitly. With every function definition f (x1 , . . . , xn ) = be we associate the bytecode C(be, x1 · · · xn ). Example 26 (compiled code) We show below the result of the compilation of the function alarm in Example 4: 1 2 3 4 5 4.5 : : : : : branch s 12 read sig branch prst 8 next load 1 6 7 8 9 10 : : : : : load 1 tcall alarm 2 wait 2 load 1 load 2 11 12 13 14 : : : : tcall alarm 2 build prst 0 write ring stop Control Flow Analysis Revisited As a first step towards control flow analysis, we analyse the flow graph of the bytecode generated. Definition 27 (flow graph) The flow graph of a system is a directed graph whose nodes are pairs (f, i) where f is a function name in the program and i is an instruction index, 1 ≤ i ≤ |f |, and whose edges are classified as follows: Successor: An edge ((f, i), (f, i+ 1)) if f [i] is a load, branch, build, call, read, write, or yield instruction. Branch: An edge ((f, i), (f, j)) if f [i] = branch c j. Wait: An edge ((f, i), (f, j)) if f [i] = wait j. Next: An edge ((f, i), (f, i + 1)) if f [i] is a wait or next instruction. Call: An edge ((f, i), (g, 1)) if f [i] = call g n or f [i] = tcall g n. The following is easily checked by inspecting the compilation function. Properties Tree and Read-Wait entail that the only cycles in the flow graph of a function correspond to the compilation of a read instruction. Property Next follows from the fact that, in a behaviour, an instruction next is always followed by a function call f (e). Property ReadOnce is a transposition of the read once condition (Section 2.1) at the level of the bytecode. 22 Proposition 28 The flow graph associated with the compilation of a well-formed system satisfies the following properties: Tree: Let G′ be the flow graph without wait and call edges. Let G′f be the full subgraph of G′ whose nodes have the shape (f, i). Then G′f is a tree with root (f, 1). Read-Wait: If f [i] = wait j then f [j] = read r and there is a unique path from (f, j) to (f, i) and in this path, every node corresponds to a branch instruction. Next: Let G′ be the flow graph without call edges. If ((f, i), (f, i + 1)) is a next edge then for all nodes (f, j) accessible from (f, i + 1), f [j] is not a read instruction. Read-Once: Let G′ be the flow graph without wait edges and next edges. If the source code satisfies the read once condition then there is no loop in G′ that goes through a node (f, i) such that f [i] is a read instruction. In [1], we have presented a method to perform resource control verifications at bytecode level. This work is just concerned with the functional fragment of our model. Here, we outline its generalisation to the full model. The main problem is to reconstruct a symbolic representation of the values allocated on the stack. Once this is done, it is rather straightforward to formulate the constraints for the resource control. We give first an informal description of the method. 1. For every segment f of bytecode instructions with, say, formal parameters x1 , . . . , xn and for every instruction i in the segment, we compute a sequence of expressions e1 · · · em and a substitution σ. 2. The expressions (ei )i∈1..m are related to the formal parameters via the substitution σ. More precisely, the variables in the expressions are contained in σx1 , . . . , σxn and the latter forms a linear pattern. 3. Next, let us look at the intended usage of the formal expressions. Suppose at run time the function f is called with actual parameters u1 , . . . , un and suppose that following this call, the control reaches instruction i with a stack ℓ. Then we would like that: • The values u1 , . . . , un match the pattern σx1 , . . . , σxn via some substitution ρ. • The stack ℓ contains exactly m values v1 , . . . , vm whose types are the ones of e1 , . . . , em , respectively. • Moreover ρ(ei ) is an over-approximation (w.r.t. size and/or termination) of the value vi , for i = 1, . . . , m. In particular, if ei is a pattern, we want that ρ(ei ) = vi . We now describe precisely the generation of the expressions and the substitutions. This computation is called shape analysis in [1]. For every function f and index i such that f [i] is a read instruction we assume a fresh variable xf,i . Given a total order on the function 23 symbols, such variables can be totally ordered with respect to the index (f, i). Moreover, for every index i in the code of f , we assume a countable set xi,j of distinct variables. We assume that the bytecode comes with annotations assigning a suitable type to every constructor, register, and function symbol. With every function symbol f of type t → beh, comes a fresh function symbol f + of type t, t′ → beh so that |t′| is the number of read instructions accessible from f within an instant. Then, as in the definition of control points (Section 2.2), the extra arguments in f + corresponds to the values read in the registers within an instant. The order is chosen according to the order of the variables associated with the read instructions. In the shape analysis, we will consider well-typed expressions obtained by composition of such fresh variables with function symbols, constructors, and registers. In order to make explicit the type of a variable x we will write xt . For every function f , the shape analysis computes a vector σ = σ1 , . . . , σ|f | of substitutions and a vector E = E1 , . . . , E|f | of sequences of well-typed expressions. We let Ei and σi denote the sequence Ei and the substitution σi respectively (the ith element in the vector), and Ei [k] the k th element in Ei . We also let hi = |Ei | be the length of the ith sequence. 1 n We assume σ1 = id and E1 = xt1,1 · · · xt1,n , if f : t1 , . . . , tn → β is a function of arity n. The main case is the branch instruction: f [i] = branch c j Conditions c : t → t, Ei = E · e, e : t, and either e = c(e), σi+1 = σi , Ei+1 = E · e or e = d(e), c 6= d, σj = σi , Ej = Ei n 1 )/x], or e = xt , σj = σi , Ej = Ei , σ ′ = [c(xti+1,h , . . . , xti+1,h i+1 i ′ ′ σi+1 = σ ◦ σi , Ei+1 = σ (E) · xi+1,hi · · · xi+1,hi+1 . The constraints for the remaining instructions are given in Table 4, where it is assumed that σi+1 = σi except for the instructions tcall and return (that have no direct successors in the code of the function). Example 29 We give the shape of the values on the stack (a side result of the shape analysis) for the bytecode obtained from the compilation of the function f defined in Example 15: Instruction 1 : yield 2 : read i 3 : load 1 Shape x x x·l Instruction 4 : call maxl 2 5 : call f1 1 6 : return Shape x·l·x x · maxl (l, x) x · f1 (maxl (l, x)) Note that the code has no branch instruction, hence the substitution σ is always the identity. Once the shapes are generated it is rather straightforward to determine a set of constraints that entails the termination of the code and a bound on the size of the computed values. For instance, assuming the reduction order is a simplification order, it is enough to require that f + (x, l) > f1 (maxl (l, x)), i.e. the shape of the returned value, f1 (maxl(l, x)), is less than the shape of the call, f + (x, l). 24 Table 4: Shape analysis at bytecode level f [i] = load k build c n call g n tcall g n return read r read k write r write k yield next wait j Conditions k ∈ 1..hi , Ei+1 = Ei · Ei [k] c : t → t, Ei = E · e, |e| = n, e : t, Ei+1 = E · c(e) g : t → t, Ei = E · e, |e| = n, e : t, Ei+1 = E · g(e) g : t → β, Ei = E · e, |e| = n, e : t f : t → t, Ei = E · e, e : t r : Ref (t), Ei+1 = Ei · xtf,i k ∈ 1..hi , Ei [k] : Ref (t), Ei+1 = Ei · xtf,i r : Ref (t), Ei = E · e, e : t, Ei+1 = E k ∈ 1..hi , Ei [k] : Ref (t), Ei = E · e, e : t, Ei+1 = E Ei+1 = Ei Ei+1 = Ei Ei = Ej · xtf,j , Ei+1 = Ej , σi = σj If one can find a reduction order and an assignment satisfying the constraints generated from the shape analysis then one can show the termination of the instant and provide bounds on the size of the computed values. We refrain from developing this part which is essentially an adaptation of Section 3 at bytecode level. Moreover, a detailed treatment of the functional fragment is available in [1]. Instead, we state that the shape analysis is always successful on the bytecode generated by the compilation function described in Table 3 (see Appendix B.8). This should suggest that the control flow analysis is not overly constraining though it can certainly be enriched in order to take into account some code optimisations. Theorem 30 The shape analysis succeeds on the compilation of a well-formed program. 5 Conclusion The execution of a thread in a cooperative synchronous model can be regarded as a sequence of instants. One can make each instant simple enough so that it can be described as a function — our experiments with writing sample programs show that the restrictions we impose do not hinder the expressivity of the language. Then well-known static analyses used to bound the resources needed for the execution of first-order functional programs can be extended to handle systems of synchronous cooperative threads. We believe this provides some evidence for the relevance of these techniques in concurrent/embedded programming. We also expect that our approach can be extended to a richer programming model including more complicated control structures. The static analyses we have considered do not try to analyse the whole system. On the contrary, they focus on each thread separately and can be carried out incrementally. Moreover, it is quite possible to perform them at bytecode level. These characteristics are 25 particularly interesting in the framework of ‘mobile code’ where threads can enter or leave the system at the end of each instant as described in [12]. Acknowledgements and Publication History We would like to thank the referees for their valuable comments. Thanks to G. Boudol and F. Dabrowski for comments and discussions on a preliminary version of this article that was presented at the 2004 International Conference on Concurrency Theory. In the present paper, we consider a more general model which includes references as first class values and requires a reformulation of the control flow analysis. Moreover, we present a new virtual machine, a number of examples, and complete proofs not available in the conference paper. References [1] R. Amadio, S. Coupet-Grimal, S. Dal-Zilio, and L. Jakubiec. A functional scenario for bytecode verification of resource bounds. In Proceedings of CSL – International Conference on Computer Science Logic, Lecture Notes in Computer Science 3210, Springer, 2004. [2] R. Amadio, S. Dal-Zilio. Resource control for synchronous cooperative threads. In Proceedings CONCUR – 15th International Conference on Concurrency Theory, Lecture Notes in Computer Science 3170, Springer, 2004. [3] R. Amadio. Max-plus quasi-interpretations. In Proceedings of TLCA – 6th International Conference on Typed Lambda Calculi and Applications, Lecture Notes in Computer Science 2701, Springer, 2003. [4] R. Amadio. Synthesis of max-plus quasi-interpretations. In Fundamenta Informaticae, 65(1-2):29-60, 2005. [5] J. Armstrong, R. Virding, C. Wikström, M. Williams. Concurrent Programming in Erlang. Prentice-Hall 1996. [6] F. Baader and T. Nipkow. Term rewriting and all that. Cambridge University Press, 1998. [7] P. Baillot and V. Mogbil, Soft lambda calculus: a language for polynomial time computation. In Proceedings of FOSSACS – 7th International Conference on Foundations of Software Science and Computation Structures, Lecture Notes in Computer Science 2987, Springer, 2004. [8] S. Bellantoni and S. Cook. A new recursion-theoretic characterization of the poly-time functions. Computational Complexity, 2:97–110, 1992. [9] G. Berry and G. Gonthier, The Esterel synchronous programming language. Science of computer programming, 19(2):87–152, 1992. 26 [10] G. Bonfante, J.-Y. Marion, and J.-Y. Moyen. On termination methods with space bound certifications. In Proceedings Perspectives of System Informatics, Lecture Notes in Computer Science 2244, Springer, 2001. [11] G. Bonfante, J.-Y. Marion, J.-Y. Moyen. Quasi-interpretations. Internal report LORIA, November 2004, available from the authors. [12] G. Boudol, ULM, a core programming model for global computing. In Proceedings of ESOP – 13th European Symposium on Programming, Lecture Notes in Computer Science 2986, Springer, 2004. [13] F. Boussinot and R. De Simone, The SL Synchronous Language. IEEE Trans. on Software Engineering, 22(4):256–266, 1996. [14] J. Buck. Scheduling dynamic dataflow graphs with bounded memory using the token flow model. PhD thesis, University of California, Berkeley, 1993. [15] N. Carriero and D. Gelernter. Linda in Context. Communication of the ACM, 32(4): 444-458, 1989. [16] P. Caspi. Clocks in data flow languages. Theoretical Computer Science, 94:125–140, 1992. [17] P. Caspi and M. Pouzet. Synchronous Kahn networks. In Proceedings of ICFP – ACM SIGPLAN International Conference on Functional Programming, SIGPLAN Notices 31(6), ACM Press, 1996. [18] A. Cobham. The intrinsic computational difficulty of functions. In Proceedings Logic, Methodology, and Philosophy of Science II, North Holland, 1965. [19] M. Hofmann. The strength of non size-increasing computation. In Proceedings of POPL – 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 2002. [20] G. Kahn. The semantics of a simple language for parallel programming. In Proceedings IFIP Congress, North-Holland, 1974. [21] N. Jones. Computability and complexity, from a programming perspective. MIT-Press, 1997. [22] E. Lee and D. Messerschmitt. Static scheduling of synchronous data flow programs for digital signal processing. IEEE Transactions on Computers, 1:24–35, 1987. [23] D. Leivant. Predicative recurrence and computational complexity i: word recurrence and poly-time. Feasible mathematics II, Clote and Remmel (eds.), Birkhäuser:320– 343, 1994. 27 [24] J.-Y. Marion. Complexité implicite des calculs, de la théorie à la pratique. Université de Nancy. Habilitation à diriger des recherches, 2000. [25] G. Morriset, D. Walker, K. Crary and N. Glew. From system F to typed assembly language. In ACM Transactions on Programming Languages and Systems, 21(3):528569, 1999. [26] G. Necula. Proof carrying code. In Proceedings of POPL – 24th SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM, 1997. [27] M. Odersky. Functional nets. In Proceedings of ESOP – 9th European Symposium on Programming, Lecture Notes in Computer Science 1782, Springer, 2000. [28] J. Ousterhout. Why threads are a bad idea (for most purposes). Invited talk at the USENIX Technical Conference, 1996. [29] Th. Park. Bounded scheduling of process networks. PhD thesis, University of California, Berkeley, 1995. [30] P. Puschner and A. Burns (eds.), Real time systems 18(2/3), Special issue on Worstcase execution time analysis, 2000. [31] Reactive Programming, INRIA http://www-sop.inria.fr/mimosa/rp. A Sophia-Antipolis, Mimosa Project. Readers-Writers and Other Synchronisation Patterns A simple, maybe the simplest, example of synchronisation and resource protection is the single place buffer. The buffer (initially empty) is implemented by a thread listening to two signals. The first on the register put to fill the buffer with a value if it is empty, the second on the register get to emit the value stored in the buffer by writing it in the special register result and flush the buffer. In this encoding, the register put is a one place channel and get is a signal as in Example 1. Moreover, owing to the read once condition, we are not able to react to several put/get requests during the same instant — only if the buffer is full can we process one get and one put request in the same instant. Note that the value of the buffer is stored on the function call to full (v), hence we use function parameters as a kind of private memory (to compare with registers that model shared memory). empty() = read put with full(x) ⇒ next.full (x) | [ ] ⇒ empty() full(x) = read get with prst ⇒ result := x.yield .empty() | [ ] ⇒ full(x) Another common example of synchronisation pattern is a situation where we need to protect a resource that may be accessed both by ‘readers’ (which access the resource without modifying it) and ‘writers’ (which can access and modify the resource). This form of 28 access control is common in databases and can be implemented using traditional synchronisation mechanisms such as semaphores, but this implementation is far from trivial [27]. In our encoding, a control thread secures the access to the protected resource. The other threads, which may be distinguished by their identity id (a natural number), may initiate a request to access / release the resource by sending a special value on the dedicated register req. The thread regulating the resource may acknowledge at most one request per instant and allows the sender of a request to proceed by writing its id on the register allow at the next instant. The synchronisation constraints are as follows: there can be multiple concurrent readers, there can be only one writer at any one time, pending write requests have priority over pending read requests (but do not preempt ongoing read operations). We define a new algebraic datatype for assigning requests: request = startRead(nat) | startWrite(nat) | endRead | endWrite | none The value startRead(id ) indicates a read request from the thread id , the other constructors correspond to requests for starting to write, ending to read or ending to write — the value none stands for no requests. A startRead operation requires that there are no pending writes to proceed. In that case we increment the number of ongoing readers and allow the caller to proceed. By contrast, a startWrite puts the monitor thread in a state waiting to process the pending write request (function pwrite), which waits for the number of readers to be null and then allows the thread that made the pending write request to proceed. An endRead and endWrite request is always immediately acknowledged. The thread protecting the resource starts with the behaviour onlyreader(z), defined in Table 5, meaning the system has no pending requests for reading or writing. The behaviour onlyreader(x) encodes the state of the controller when there is no pending write and x readers. In a state with x pending readers, when a startWrite request from the thread id is received, the controller thread switches to the behaviour pwrite(id, x), meaning that the thread id is waiting to write and that we should wait for x endRead requests before acknowledging the request to write. A thread willing to read on the protected resource should repeatedly try to send its request on the register req then poll the register allow, e.g., with the behaviour askRead(id ).read allow with id ⇒ · · · where askRead (id ) is a shorthand for read req with none ⇒ req := startRead(id ). The code for a thread willing to end a read session is similar. It is simple to change our encoding so that multiple requests are stored in a fifo queue instead of a one place buffer. B B.1 Proofs Preservation of Control Points Instances Proposition 31 8 Suppose (B, s, i) → (B ′ , s′ , i′ ) and that for all thread indexes j ∈ Zn , B1 (j) is an instance of a control point. Then for all j ∈ Zn , we have that B1′ (j) is an instance of a control point. 29 Table 5: Code for the Readers-Writers pattern onlyreader (x) = match x with s(x′ ) then read req with endRead ⇒ next.onlyreader (x′ ) | startWrite(y) ⇒ next.pwrite(y, s(x′ )) | startRead(y) ⇒ next.allow := y.onlyreader (s(s(x′ ))) | [ ] ⇒ onlyreader (s(x′ )) else read req with startWrite(y) ⇒ next.allow := y.pwrite(y, z) | startRead(y) ⇒ next.allow := y.onlyreader (s(z)) | [ ] ⇒ onlyreader (z) = match x with s(x′ ) then match x′ with s(x′′ ) then read req with endRead ⇒ next.pwrite(id , s(x′′ )) | [ ] ⇒ pwrite(id , s(s(x′′ ))) else read req with endRead ⇒ next.allow := id .pwrite(id , z) | [ ] ⇒ pwrite(id , s(z)) else read req with endWrite ⇒ next.onlyreader (z) | [ ] ⇒ pwrite(id , z) pwrite(id , x) Proof. Let (f (p), be, i) be a control point of an expression body or of a behaviour. In Table 6, we reformulate the evaluation and the reduction by replacing expression bodies or behaviours by triples (f (p), be, σ) where (f (p), be, i) is a control point and σ is a substitution mapping the variables in p to values. By convention, we take σ(r) = r if r is a register. We claim that the evaluation and reduction in Table 6 are equivalent to those presented in Section 2 in the following sense: 1. (f (p), e0 , σ) ⇓ v iff σe0 ⇓ v. X X 2. (f + (p), b0 , s, σ) → (g + (q), b′0 , s′, σ ′ ) iff σb0 → σ ′ b′0 . In the following proofs we will refer to the rules in Table 6. The revised formulation X makes clear that if b is an instance of a control point and (b, s)→(b′ , s′ ) then b′ is an instance. It remains to check that being an instance is a property preserved at the level of system reduction. We proceed by case analysis on the last reduction rule used in the derivation of (B, s, i) → (B ′ , s′ , i′ ). (s1 ) One of the threads performs one step. The property follows by the analysis on behaviours. (s2 ) One of the threads performs one step. Moreover, the threads in waiting status take the 30 Table 6: Expression body evaluation and behaviour reduction revised (e0 ) (e1 ) (f (p), x, σ) ⇓ σ(x) (f (p), r, σ) ⇓ r (f (p), ei , σ) ⇓ vi i ∈ 1..n, (f (p), ei , σ) ⇓ vi i ∈ 1..n g(x) = eb, (g(x), eb, [v/x]) ⇓ v (e3 ) (e2 ) (f (p), c(e), σ) ⇓ c(v) (f (p), g(e), σ) ⇓ v σ(x) = d(. . .), σ(x) = c(v), (f (p), eb 2 , σ) ⇓ v (f ([c(x)/x]p), eb 1 , [v/x] ◦ σ) ⇓ v     (e5 ) (e4 ) match x match x f (p), f (p), with c(x) with c(x) , σ ⇓ v , σ ⇓ v then eb 1 else eb 2 then eb 1 else eb 2 (b1 ) S (f + (p), stop, σ, s) → (f + (p), stop, σ, s) (b2 ) (b3 ) (b4 ) R (f + (p), yield .b, σ, s) → (f + (p), b, σ, s) N (f + (p), next .g(e), σ, s) → (f + (p), g(e), σ, s) X (f + ([c(x)/x]p), b1 , [v/x]◦ σ, s) → (f1+ (p′ ), b′ , σ ′ , s′ ) match x with c(x) X f + (p), , σ, s → (f1+ (p′ ), b′ , σ ′ , s′ ) then b1 else b2 σ(x) =  c(v), X + ′ + ′ ′ ′ σ(x)  = d(. . .), c 6= d, (f (p), b2 , σ,  s) → (f1 (p ), b , σ , s ) (b5 ) match x with c(x) X f + (p), , s, σ → (f1+ (p′ ), b′ , σ ′ , s′ ) then b1 else b2 no pattern matches s(σ(̺)) (b6 ) W (f + (p), read ̺ with . . . , σ, s) → (f + (p), read ̺ with . . . , σ, s) X (b7 ) σ1 (p) = s(σ(̺)), (f + ([p/y]p), b, σ1 ◦ σ, s) → (f1+ (p′ ), b′ , σ ′ , s′ ) X (f + (p), read hyi ̺ with · · · | p ⇒ b | . . . , σ, s) → (f1+ (p′ ), b′ , σ ′ , s′ ) σe ⇓ v, g(x) = b, (b8 ) X (g+ (x, yg ), b, [v/x], s) → (f1+ (p′ ), b′ , σ ′ , s′ ) X (f + (p), g(e), σ, s) → (f1+ (p′ ), b′ , σ ′ , s′ ) X (b9 ) σe ⇓ v, (f + (p), b, σ, s[v/σ(̺)]) → (f1+ (p′ ), b′ , σ ′ , s′ ) X (f + (p), ̺ := e.b, σ, s) → (f1+ (p′ ), b′ , σ ′ , s′ ) 31 [ ] ⇒ g(e) branch of the read instructions that were blocking. A thread read ̺ . . . | [ ] ⇒ g(e) in waiting status is an instance of a control point (f + (p), read ̺ . . . | [ ] ⇒ g(e0), j). By (C7 ), (f + (p), g(e0 ), 2) is a control point, and g(e) is one of its instances. ✷ B.2 Evaluation of Closed Expressions Proposition 32 12 Let e be a closed expression. Then there is a value v such that e ⇓ v and e ≥ v with respect to the reduction order. As announced, we refer to the rules in Table 6. We recall that the order > or ≥ refers to the reduction order that satisfies the constraints of index 0. We start by proving the following working lemma. Lemma 33 For all well formed triples, (f (p), eb, σ), there is a value v such that (f (p), eb, σ) ⇓ v. Moreover, if eb is an expression then σ(eb) ≥ v else f (σp) ≥ v. Proof. We proceed by induction on the pair (f (σp), eb) ordered lexicographically from left to right. The first argument is ordered according to the reduction order and the second according to the structure of the expression body. eb ≡ x. We apply rule (e0 ) and σ(x) ≥ σ(x). eb ≡ r. We apply rule (e1 ) and σ(r) = r ≥ r. eb ≡ c(e1 , . . . , en ). We apply rule (e2 ). By inductive hypothesis, (f (p), ei , σ) ⇓ vi for i ∈ 1..n and σei ≥ vi . By definition of reduction order, we derive σ(c(e1 , . . . , en )) ≥ c(v1 , . . . , vn ). eb ≡ f (e1 , . . . , en ). We apply rule (e3 ). By inductive hypothesis, (f (p), ei , σ) ⇓ vi for i ∈ 1..n and σei ≥ vi . By the definition of the generated constraints f (p) > g(e), which by definition of reduction order implies that f (σp) > g(σe) ≥ g(v) = g([v/x]x). Thus by inductive hypothesis, g(x, eb, [v/x]) ⇓ v. We conclude by showing by case analysis that g(σe) ≥ v. • eb is an expression. By the constraint we have g(x) > eb, and by inductive hypothesis [v/x]eb ≥ v. So g(σe) ≥ g(v) > [v/x]eb ≥ v. • eb is not an expression. Then by inductive hypothesis, g(v) ≥ v and we know g(σe) ≥ g(v). eb ≡ match x with c(x) . . . . We distinguish two cases. • σ(x) = c(v). Then rule (e4 ) applies. Let σ ′ = [v/x]◦σ. Note that σ ′ ([c(x)/x]p) = σp. By inductive hypothesis, we have that (f ([c(x)/x]p), eb 1 , σ ′ ) ⇓ v. We show by case analysis that f (σp) ≥ v. 32 – eb 1 is an expression. By inductive hypothesis, σ ′ (eb 1 ) ≥ v. By the constraint, f ([c(x)/x]p) > eb 1 . Hence, f (σp) = f (σ ′ [c(x)/x]p) > σ ′ (eb 1 ). – eb 2 is not an expression. By inductive hypothesis, we have that f (σp) equals f (σ ′ [c(x)/x]p) ≥ v. • σ(x) = d(. . .) with c 6= d. Then rule (e5 ) applies and an argument simpler than the one above allows to conclude. ✷ Relying on Lemma 33 we can now prove Proposition 12, that if e is a closed expression and e ⇓ v then e ≥ v in the reduction order. Proof. We proceed by induction on the structure of e. e is value v. Then v ⇓ v and v ≥ v. e ≡ c(e1 , . . . , en ). By inductive hypothesis, ei ⇓ vi and ei ≥ vi for i ∈ 1..n. By definition of reduction order, c(e) ≥ c(v). e ≡ f (e1 , . . . , en ). By inductive hypothesis, ei ⇓ vi and ei ≥ vi for i ∈ 1..n. Suppose f (x) = eb. By Lemma 33, (f (x), eb, [v/x]) ⇓ v and either f (v) ≥ v or f (x) > eb and σ(eb) ≥ v. We conclude by a simple case analysis. ✷ B.3 Progress Proposition 34 13 Let b be an instance of a control point. Then for all stores s, there X exists a store s′ and a status X such that (b, s) → (b′ , s′ ). Proof. We start by defining a suitable well-founded order. If b is a behaviour, then let nr (b) be the maximum number of reads that b may perform in an instant. Moreover, let ln(b) be the length of b inductively defined as follows: ln(stop) = ln(f (e)) = 0 ln(yield .b) = ln(̺ := e.b) = 1 + ln(b) ln(next.f (e)) = 2 ln(match x with c(x) then b1 else b2 ) = 1 + max (ln(b1 ), ln(b2 )) ln(read ̺ with . . . | pi ⇒ bi | . . . | [ ] ⇒ f (e)) = 1 + max (. . . , ln(bi ), . . .) If the behaviour b is an instance of the control point γ ≡ (f + (p), b0 , i) via a substitution σ then we associate with the pair (b, γ) a measure: µ(b, γ) =def (nr(b), f + (σp), ln(b)) . We assume that measures are lexicographically ordered from left to right, where the order on the first and third component is the standard order on natural numbers and the order on the second component is the reduction order considered in study of the termination conditions. This is a well-founded order. Now we show the assertion by induction on µ(b, γ). We proceed by case analysis on the structure of b. b ≡ stop. Rule (b1 ) applies, with X = S, and the measure stays constant. 33 b ≡ yield .b′ . Rule (b2 ) applies, with X = R, and the measure decreases because ln(b) decreases. b ≡ next.b′ . Rule (b3 ) applies, with X = N, and the measure decreases because ln(b) decreases. b ≡ match . . . . creases. Rules (b4 ) or (b5 ) apply and the measure decreases because ln(b) de- b ≡ read . . . . If no pattern matches then rule (b6 ) applies and the measure is left unchanged. If a pattern matches then rule (b7 ) applies and the measure decreases because nr (b) decreases and then the induction hypothesis applies. b ≡ g(e). Rule (b8 ) applies to (f + (p), g(e0 ), σ), assuming e = σe0 . By Proposition 12, we know that e ⇓ v and e ≥ v in the reduction order. Suppose g is associated to the declaration g(x) = b. The constraint associated with the control point requires f + (p) > g + (e0 , yg ). Then using the properties of reduction orders we observe: f + (σp) > g + (σe0 , yg ) = g + (e, yg ) ≥ g + (v, yg ) Thus the measure decreases because f + (σp) > g + (v, yg ), and then the induction hypothesis applies. b ≡ ̺ := e.b′ . By Proposition 12, we have e ⇓ v. Hence rule (b9 ) applies, the measure decreases because ln(b) decreases, and then the induction hypothesis applies. ✷ Remark 35 We point out that in the proof of proposition 13, if X = R then the measure decreases and if X ∈ {N, S, W } then the measure decreases or stays the same. We use this observation in the following proof of Theorem 14. B.4 Termination of the Instant Theorem 36 14 All sequences of system reductions involving only rule (s1 ) are finite. Proof. We order the status of threads as follows: R > N, S, W . With a behaviour B1 (i) coming with a control point γi , we associate the pair µ′ (i) = (µ(B1 (i), γi ), B2 (i)) where µ is the measure defined in the proof of Proposition 13. Thus µ′ (i) can be regarded as a quadruple with a lexicographic order from left to right. With a system B of n threads we associate the measure µB =def (µ′ (0), . . . , µ′(n − 1)) that is a tuple. We compare such tuples using the product order. We prove that every system reduction sequence involving only rule (s1 ) terminates by proving that this measure decreases during reduction. We recall the rule below: X (B1 (i), s) → (b′ , s′ ), B2 (i) = R, B ′ = B[(b′ , X)/i], N (B ′ , s′ , i) = k (B, s, i) → (B ′ [(B1′ (k), R)/k], s′ , k) 34 Let B ′′ = B ′ [(B1′ (k), R)/k]. We proceed by case analysis on X and B2′ (k). If B2′ (k) = R then µ′ (k) is left unchanged. The only other case is B2′ (k) = W . In this case the conditions on the scheduler tell us that i 6= k. Indeed, the thread k must be blocked on a read r instruction and it can only be scheduled if the value stored in r has been modified, which means than some other thread than k must have modified r. For the same reason, some pattern in the read r instruction of B1 (k) matches s′ (r), which means that the number of reads that B1 (k) may perform in the current instant decreases and that µ′ (k) also decreases. X By hypothesis we have (B1 (i), s) → (b′ , s′ ), hence by Remark 35, µ′ (i) decreases or stays the same. By the previous line of reasoning µ′ (k) decreases and the other measures µ′ (j) stay the same. Hence the measure µB decreases, as needed. ✷ B.5 Bounding the Size of Values for Threads Theorem 37 19 Given a system of synchronous threads B, suppose that at the beginning of the instant B1 (i) = f (v) for some thread index i. Then the size of the values computed by the thread i during an instant is bounded by qf + (v,u) where u are the values contained in the registers at the time they are read by the thread (or some constant value, if they are not read at all). In Table 6, we have defined the reduction of behaviours as a big step semantics. In Table 7 we reformulate the operational semantics following a small step approach. First, note that there are no rules corresponding to (b1 ), (b3 ) or (b6 ) since these rules either terminate or suspend the computation of the thread in the instant. Second, the reduction makes abstraction of the memory and the scheduler. Instead, the reduction relation is parameterized on an assignment δ associating values with the labels of the read instructions. The assignment δ is a kind of oracle that provides the thread with the finitely many values (because of the read once condition) it may read within the current instant. The assignment δ provides a safe abstraction of the store s used in the transition rules of Table 6. Note that the resulting system represents more reductions than can actually occur in the original semantics within an instant. Namely, a thread can write a value v in r and then proceed to read from r a value different from v without yielding the control. This kind of reduction is impossible in the original semantics. However, since we do not rely on a precise monitoring of the values written in the store, this loss of precision does not affect our analysis. Next we prove that if (f + (p), b, σ) →δ (g + (q), b′ , σ ′ ) then qf + (σ′′ ◦σ(p)) ≥ qg+ (σ′ (q)) over the non-negative reals, where σ ′′ is either the identity or the restriction of δ to the label of the read instruction in case (b′ 7 ). Proof. By case analysis on the small step rules. Cases (b′ 2 ), (b′ 5 ) and (b′ 9 ) are immediate. (b′ 4 ) The assertion follows by a straightforward computation on substitutions. (b′ 7 ) Then σ ′′ (y) = δ(y) = [σ1 (p)/y] and recalling that patterns are linear, we note that: f + ((σ ′′ ◦ σ)(p)) = f + ((σ1 ◦ σ)[p/y](p)). 35 Table 7: Small step reduction within an instant (b′ 2 ) (f + (p), yield .b, σ) →δ (f + (p), b, σ) match x with c(x)  , σ →δ (f + ([c(x)/x]p), b1 , [v/x] ◦ σ) if (1) (b′ 4 ) f + (p), then b1 else b2 match x with c(x)  (b′ 5 ) f + (p), , σ →δ (f + (p), b2 , σ) if σ(x) = d(. . .), c 6= d then b1 else b2 (b′ 7 ) (f + (p), read hyi ̺ with · · · | p ⇒ b | . . . , σ) →δ (f + ([p/y]p), b, σ1 ◦ σ) if (2) (b′ 8 ) (f + (p), g(e), σ) →δ (g+ (x, yg ), b, [v/x]) if σe ⇓ v and g(x) = b (b′ 9 ) (f + (p), ̺ := e.b, σ) →δ (f + (p), b, σ) if σe ⇓ v where: (1) ≡ σ(x) = c(v) and (2) ≡ σ1 (p) = δ(y). (b′ 8 ) By the properties of quasi-interpretations, we know that qσ(e) ≥ qv . By the constraints generated by the control points, we derive that qf + (p) ≥ qg+ (e,yg ) over the nonnegative reals. By the substitutivity property of quasi-interpretations, this implies that qf + (σ(p)) ≥ qg+ (σ(e,yg )) . Thus we derive, as required: qf + (σ(p)) ≥ qg+ (σ(e,yg )) ≥ qg+ (v,yg ) . ✷ It remains to support our claim that all values computed by the thread i during an instant have a size bounded by qf (v,u) where u are either the values read by the thread or some constant value. Proof. By inspecting the shape of behaviours we see that a thread computes values either when writing into a register or in recursive calls. We consider in turn the two cases. Writing Suppose (f + (p, yf ), b, σ) →∗δ (g + (q), ̺ := e.b′ , σ ′ ) by performing a series of reads recorded by the substitution σ ′′ . Then the invariant we have proved above implies that: qf + ((σ′′ ◦σ)(p,yf )) ≥ qg+ (σ′ q) over the non-negative reals. If some of the variables in yf are not instantiated by the substitution σ ′′ , then we may replace them by some constant. Next, we observe that the constraint of index 1 associated with the control point requires that qg+ (q) ≥ qe and that if σ(e) ⇓ v then this implies qg+ (σ′ (q)) ≥ qσ′ (e) ≥ qv ≥ |v|. Recursive call Suppose (f + (p, yf ), b, σ) →∗δ (g + (q), h(e), σ ′ ) by performing a series of reads recorded by the substitution σ ′′ . Then the invariant we have proved above implies that: qf + ((σ′′ ◦σ)(p,yf )) ≥ qg+ (σ′ (q)) over the non-negative reals. Again, if some of the variables in yf are not instantiated by the substitution σ ′′ , then we may replace them by some constant value. Next we observe that the constraint of index 0 associated with the control point requires that qg+ (q) ≥ qh+ (e,yh ) . Moreover, if σ ′ (e) ⇓ v then qg+ (σ′ (q)) ≥ qh+ (σ′ (e,yh )) ≥ qh+ (v,yh ) ≥ qvi ≥ |vi |, where vi is any of the values in v. The last inequation relies on the monotonicity property of assignments, see property (3) in Definition 16, that is ✷ qh+ (z1 , . . . , zn ) ≥ zj for all j ∈ 1..n. B.6 Bounding the Size of Values for Systems Corollary 38 20 Let B be a system with m distinct read instructions and n threads. 36 Suppose B1 (i) = fi (vi ) for i ∈ Zn . Let c be a bound of the size of the largest parameter of the functions fi and the largest default value of the registers. Suppose h is a function bounding all the quasi-interpretations, that is, for all the functions fi+ we have h(x) ≥ qfi+ (x, . . . , x) over the non-negative reals. Then the size of the values computed by the system B during an instant is bounded by hn·m+1 (c). Proof. Because of the read once condition, during an instant a system can perform a (successful) read at most n · m times. We proceed by induction on the number k of reads the system has performed so far to prove that the size of the values is bounded by hk+1 (c). k = 0 If no read has been performed, then Theorem 19 can be applied to show that all values have size bound by h(c). k > 0 Inductively, the size of the values in the parameters and the registers is bounded by hk (c). Theorem 19 says that all the values that can be computed before performing a new read have a size bound by h(hk (c)) = hk+1 (c). ✷ B.7 Combination of LPO and Polynomial Quasi-interpretations Theorem 39 24 If a system B terminates by LPO and admits a polynomial quasi-interpretation then the computation of the system in an instant runs in space polynomial in the size of the parameters of the threads at the beginning of the instant. Proof. We can always choose a polynomial for the function h in corollary 20. Hence, hnm+1 is also a polynomial. This shows that the size of all the values computed by the system is bounded by a polynomial. The number of values in a frame depends on the number of formal parameters and local variables and it can be statically bound. It remains to bound the number of frames on the stack. Note that behaviours are tail recursive. This means that the stack of each thread contains a frame that never returns a value plus possibly a sequence of frames that relate to the evaluation of expressions. From this point on, one can follow the proof in [10]. The idea is to exploit the characteristics of the LPO order: a nested sequence of recursive calls f1 (v1 ), . . . , fn (vn ) must satisfy f1 (v1 ) > · · · > fn (vn ), where > is the LPO order on terms. Because of the polynomial bound on the size of the values and the characteristics of the LPO on constructors, one can provide a polynomial bound on the length of such strictly decreasing sequences and therefore a polynomial bound on the size of the stack needed to execute the system. ✷ B.8 Compiled Code is Well-shaped Theorem 40 30 The shape analysis succeeds on the compilation of a well-formed program. Let be be either a behaviour or an expression body, η be a sequence of variables, and E be a sequence of expressions. We say that the triple (be, η, E) is compatible if for all variables x free in be, the index i(x, η) is defined and if η[k] = x then E[k] = x. Moreover, 37 we say that the triple is strongly compatible if it is compatible and |η| = |E|. In the following we will neglect typing issues that offer no particular difficulty. First we prove the following lemma. Lemma 41 If (e, η, E) is compatible then the shape analysis of C ′ (e, η) starting from the shape E succeeds and produces a shape E · e. Proof. By induction on the structure of e. e ≡ x Then C ′ (x, η) = load i(x, η). We know that i(x, η) is defined and η[k] = x implies E[k] = x. So the shape analysis succeeds and produces E · x. e ≡ c(e1 , . . . , en ) Then C ′ (c(e1 , . . . , en ), η) = C ′ (e1 , η) · · · C ′ (en , η)(build c n). We note that if e′ is a subexpression of e, e′′ is another expression, and (e, η, E) is compatible then (e′ , η, E · e′′ ) is compatible too. Thus we can apply the inductive hypothesis to e1 , . . . , en and derive that the shape analysis of C ′ (e1 , η) starting from E succeeds and produces E · e1 ,. . . , and the shape analysis of C ′ (en , η) starting from E · e1 · · · en−1 succeeds and produces E · e1 · · · en . Then by the definition of shape analysis of build we can conclude. e ≡ f (e1 , . . . , en ) An argument similar to the one above applies. Next we generalise the lemma to behaviours and expression bodies. ✷ Lemma 42 If (be, η, E) is strongly compatible then the shape analysis of C(be, η) starting from the shape E succeeds. Proof. be ≡ e We have that C(e, η) = C ′ (e, η)·return and the shape analysis on C ′ (e, η) succeeds, producing at least one expression. be ≡ match x with c(y) then eb 1 else eb 2 Following the definition of the compilation function, we distinguish two cases: • η ≡ η ′ · x: Then C(be, η) = (branch c j) · C(eb 1 , η ′ · y) · (j : C(eb 2 , η) ). By the hypothesis of strong compatibility, E ≡ E ′ · x and by definition of shape analysis on branch we get on the then branch a shape [c(y)/x]E ′ · y up to variable renaming. We observe that (eb 1 , η ′ · y, [c(y)/x]E ′ · y) are strongly compatible (note that here we rely on the fact that η ′ and E ′ have the same length). Hence, by inductive hypothesis, the shape analysis on C(eb 1 , η ′ · y) succeeds. As for the else branch, we have a shape E ′ · x and since (eb 2 , η ′ · x, E ′ · x) are strongly compatible we derive by inductive hypothesis that the shape analysis on C(eb 2 , η) succeeds. • η 6≡ η ′ · x: The compiled code starts with (load i(x, η)) which produces a shape E · x. Then the analysis proceeds as in the previous case. be ≡ stop The shape analysis succeeds. be ≡ f (e1 , . . . , en ) By lemma 41, we derive that the shape analysis of C ′ (e1 , η)· . . .·C ′ (en , η) 38 succeeds and produces E · e1 · · · en . We conclude applying the definition of the shape analysis for tcall. be ≡ yield .b The instruction yield does not change the shape and we can apply the inductive hypothesis on b. be ≡ next.g(e) The instruction next does not change the shape and we can apply the inductive hypothesis on g(e). be ≡ ̺ := e.b By lemma 41, we have the shape E · e. By definition of the shape analysis on write, we get back to the shape E and then we apply the inductive hypothesis on b. be ≡ match . . . The same argument as for expression bodies applies. be ≡ read ̺ with c1 (y1 ) ⇒ b1 | . . . | cn (yn ) ⇒ bn | [ ] ⇒ g(e) We recall that the compiled code is: j0 : (read i(̺, η)) · (branch c1 j1 ) · C(b1 , η · y1 ) · · · jn−1 : (branch cn jn ) · C(bn , η · yn ) · jn : (wait j0 ) · C(g(e), η) The read instruction produces a shape E · y. Then if a positive branch is selected, we have a shape E · yk for k ∈ 1..n. We note that the triples (bk , η · yk , E · yk ) are strongly compatible and therefore the inductive hypothesis applies to C(bk , η · yk ) for k ∈ 1..n. On the other hand, if the last default branch [ ] is selected then by definition of the shape analysis on wait we get back to the shape E and again the inductive hypothesis applies to C(g(e), η). The case where a pattern can be a variable is similar. To conclude the proof we notice that for every function definition f (x) = be, taking η = x = E we have that (be, η, E) are strongly compatible and thus by lemma 42 the shape analysis succeeds on C(be, η) starting from E. ✷ 39
6cs.PL
Local Private Hypothesis Testing: Chi-Square Tests 1 arXiv:1709.07155v2 [math.ST] 9 Mar 2018 1 , Marco Gaboardi1 , and Ryan Rogers2 University at Buffalo, The State University of New York 2 University of Pennsylvania March 12, 2018 Abstract The local model for differential privacy is emerging as the reference model for practical applications of collecting and sharing sensitive information while satisfying strong privacy guarantees. In the local model, there is no trusted entity which is allowed to have each individual’s raw data as is assumed in the traditional curator model for differential privacy. Individuals’ data are usually perturbed before sharing them. We explore the design of private hypothesis tests in the local model, where each data entry is perturbed to ensure the privacy of each participant. Specifically, we analyze locally private chi-square tests for goodness of fit and independence testing, which have been studied in the traditional, curator model for differential privacy. 1 Introduction Hypothesis testing is a widely applied statistical tool used to test whether given models should be rejected, or not, based on sampled data from a population. Hypothesis testing was initially developed for scientific and survey data, but today it is also an essential tool to test models over collections of social network, mobile, and crowdsourced data (American Statistical Association, 2014; Hunter et al., 2008; Steele et al., 2017). Collected data samples may contain highly sensitive information about the subjects, and the privacy of individuals can be compromised when the results of a data analysis are released. In work from Homer et al. (2008), it was shown that a subject in a dataset can be identified as being in the case or control group based on the aggregate statistics of a genetic-wide association study (GWAS). Privacy-risks may bring data contributors to opt out, which reduces the confidence in the data study. A way to address this concern is by developing new techniques to support privacy-preserving data analysis. Among the different approaches, differential privacy (Dwork et al., 2006b) has emerged as a viable solution: it provides strong privacy guarantees and it allows to release accurate statistics. A standard way to achieve differential privacy is by injecting some statistical noise in the computation of the data analysis. When the noise is carefully chosen, it helps to protect the individual privacy without compromising the utility of the data analysis. Several recent works have studied differentially private hypothesis tests that can be used in place of the standard, non-private hypothesis tests (Uhler et al., 2013; Yu et al., 2014; Sheffet, 2015; Karwa and Slavković, 2016; Wang et al., 2015; Gaboardi et al., 2016; Kifer and Rogers, 2017; Cai et al., 2017). These tests work in the curator model of differential privacy. In this model, the data is centrally stored and the curator carefully injects noise in the computation of the data analysis in order to satisfy differential privacy. In this work we instead address the local model of privacy, formally introduced by Raskhodnikova et al. (2008). The first differentially private algorithm called randomized response – in fact it predates the definition of differential privacy by more than 40 years – guarantees differential privacy in the local model (Warner, 1965). In this model, there is no trusted centralized entity which is responsible for the noise injection. Instead, each individual adds enough noise to guarantee differential privacy for their own data, which provides a stronger 1 privacy guarantee when compared to traditional differential privacy. The data analysis is then run over the collection of the individually sanitized data. The local model of differential privacy is a convenient model for several applications: for example it is used to collect statistics about the activity of the Google Chrome Web browser users (Erlingsson et al., 2014), and to collect statistics about the typing patterns of Apple’s iPhone users (Apple Press Info, 2016). Despite these applications, the local model has received far less attention than the more standard centralized curator model. This is in part due to the more firm requirements imposed by this model, which make the design of effective data analysis harder. Our main contribution is in designing chi-square hypothesis tests for the local model of differential privacy. Similar to previous works we focus on goodness of fit and independence hypothesis tests. Most of the differentially private chi-square hypothesis tests proposed so far are based on mechanisms that add noise in some form to the aggregate data, e.g. the cells of the contingency tables, or the resulting chi-square statistics value. These approaches cannot be used in the local model, since noise needs to be added at the individual’s data level. We then consider instead general privatizing techniques in the local model, and we study how to build new hypothesis tests with them. Each test we present is characterized by a specific local model mechanism. The main technical challenge for designing each test is to create statistics, which incorporate the local model mechanisms, that converge as we collect more data to a chi-square distribution, as in the classical chi-square tests. We then use these statistics to find the critical value to correctly bound the Type I error. We present three different goodness of fit tests: LocalNoiseGOF presents a statistic that guarantees the convergence to a chi-square distribution under the null hypothesis so that we can use the correct critical values when local (concentrated) differential privacy is guaranteed by adding Laplace or Gaussian noise to the individual data; LocalExpGOF also provides a statistic that converges to a chi-square under the null hypothesis when a private value for each individual is selected by using the exponential mechanism (McSherry and Talwar, 2007); finally, LocalBitFlipGOF introduces a statistic that converges to a chi-square distribution when the data is privatized using a bit flipping algorithm (Bassily and Smith, 2015), which provide better accuracy for higher dimensional data. Further, we develop corresponding independence tests: LocalNoiseIND, LocalExpIND, and LocalBitFlipIND. For all these tests we study their asymptotic behavior. A desiderata for private hypothesis tests is to have a guaranteed upper bound on the probability of a false discovery (or Type I error) – rejecting a null hypothesis or model when the data was actually generated from it – and to minimize the probability of a Type II error, which is failing to reject the null hypothesis when the model is indeed false. This latter criteria corresponds to the power of the statistical test. We then present experimental results showing the power of the different tests which demonstrates that no single local differentially private algorithm is best across all data dimensions and privacy parameter regimes. 2 Related Works There have been several works in developing private hypothesis test for categorical data, but all look at the traditional model of (concentrated) differential privacy instead of the local model, which we consider here. Several works have explored private statistical inference for GWAS data, (Uhler et al., 2013; Yu et al., 2014; Johnson and Shmatikov, 2013). Following these works, there has also been general work in private chi-square hypothesis tests, where the main tests are for goodness of fit and independence testing, although some do extend to more general tests (Wang et al., 2015; Gaboardi et al., 2016; Kifer and Rogers, 2017; Cai et al., 2017; Kakizaki et al., 2017). Among these, the works most related to ours are the ones by (Gaboardi et al., 2016; Kifer and Rogers, 2017). We will compare our work with these in Section 4 after introducing them. There has also been work in private hypothesis testing for ordinary least squares regression (Sheffet, 2015). There are other works that have studied statistical inference and estimators in the local model of differential privacy. Duchi et al. (2013b,a) focus on controlling disclosure risk in statistical estimation and inference by ensuring the analysis satisfies local differential privacy. They provide minimax convergence rates to show the tight tradeoffs between privacy and statistical efficiency, i.e. the number of samples required to give quality 2 estimators. In their work, they show that a generalized version of randomized response gives optimal sample complexity for estimating the multinomial probability vector. We use this idea as the basis for our hypothesis test LocalBitFlipGOF. Kairouz et al. (2014) also considers hypothesis testing in the local model, although they measure utility in terms of f -divergences and do not give a decision rule, i.e. when to reject a given null hypothesis. We provide statistics whose distributions asymptotically follow a chi-square distribution, which allows for approximating statistical p-values that can be used in a decision rule. We consider their extremal mechanisms and empirically confirm their result that for small privacy regimes (small ) one mechanism has higher utility than other mechanisms and for large privacy regimes (large ) a different mechanism outperforms the others. However, we measure utility in terms of the power of a locally private hypothesis test subject to a given Type I error bound. Other notable works in the local privacy model include Pastore and Gastpar (2016); Kairouz et al. (2016); Ye and Barg (2017) 3 Preliminaries We consider datasets x = (x1 , · · · , xn ) ∈ X n in some data universe X , typically X = {0, 1}d where d is the dimensionality. We first present the standard definition of differential privacy, as well as its variant concentrated differential privacy. We say that two datasets x , x 0 ∈ X n are neighboring if they differ in at most one element, i.e. ∃i ∈ [n] such that xi 6= x0i and ∀j 6= i, xj = x0j . Definition 3.1 [Dwork et al. (2006b,a)]. An algorithm M : X n → Y is (, δ)-differentially private (DP) if for x) ∈ S] ≤ e Pr [M(x x0 ) ∈ S]+δ. all neighboring datasets x , x 0 ∈ X n and for all outcomes S ⊆ Y, we have Pr [M(x We then state the definition of zero-mean concentrated differential privacy. Definition 3.2 [Bun and Steinke (2016)]. An algorithm M : X n → Y is ρ-zero-mean concentrated differentially private (zCDP) if for all neighboring datasets x , x 0 ∈ X n , we have the following bound for all t > 0 x), where the expectation is over outcomes y ∼ M(x       2 x) = y] Pr [M(x E exp t ln −ρ ≤ et ρ . x0 ) = y] Pr [M(x Note that in both of these privacy definitions, it is assumed that all the data is stored in a central location and the algorithm M can access all the data. Most of the work in differential privacy has been in this trusted curator model. One of the main reasons for this is that we can achieve much greater accuracy in our differentially private statistics when used in the curator setting. However, in many cases, having a trusted curator is too strong of an assumption. We then define local differential privacy, formalized by Raskhodnikova et al. (2008) and Dwork and Roth (2014), which does not require the subjects to release their raw data, rather each data entry is perturbed to prevent the true entry from being stored. Thus, local differential privacy ensures a very strong privacy guarantee. Definition 3.3 [LR Oracle]. Given a dataset x , a local randomizer oracle LRx (·, ·) takes as input an index i ∈ [n] and an -DP algorithm R, and outputs y ∈ Y chosen according to the distribution of R(xi ), i.e. LRx (i, R) = R(xi ). Definition 3.4 [Raskhodnikova et al. (2008)]. An algorithm M : X n → Y is (, δ)-local differentially private (LDP) if it accesses the input database x via the LR oracle LRx with the following restriction: if LR(i, Rj ) Pk for j ∈ [k] are M’s invocations of LRx on index i, then each Rj for j ∈ [k] is (j , δj )- DP and j=1 j ≤ , Pk j=1 δj ≤ δ. An easy consequence of this definition is that an algorithm which is (, δ)-LDP is also (, δ)-DP. Note that these definitions can be extended to include ρ-local zCDP (LzCDP) where each local randomizer is ρj -zCDP Pk and j=1 ρj ≤ ρ. We point out the following connection between LzCDP and LDP , which follows directly from results in Bun and Steinke (2016) Lemma 3.5. If M : Xn → Y is (, 0)-LDP then it is also 2 /2-LzCDP. If M is ρ-LzCDP, then it is also  p ρ + 2ρ ln(2/δ) , δ -LDP for any δ > 0. 3 Thus, in the local setting, ( pure) LDP (where δ = 0) provides the strongest level of privacy, followed by LzCDP and then approximate-LDP (where δ > 0). 4 Chi-Square Hypothesis Tests As was studied in Gaboardi et al. (2016), Wang et al. (2015), and Kifer and Rogers (2017), we will study hypothesis tests with categorical data. A null hypothesis, or model H0 is how we might expect the data to be generated. The goal for hypothesis testing is to reject the null hypothesis if the data is not likely to have been generated from the given model. As is common in statistical inference, we want to design hypothesis tests to bound the probability of a false discovery (or Type I error), i.e. rejecting a null hypothesis when the data was actually generated from it, by at most some amount α, such as 5%. However, designing tests that achieve this is easy, because we can just ignore the data and always fail to reject the null hypothesis, i.e. have an inconclusive test. Thus, we would additionally like to design our tests so that they can reject H0 if the data was not actually generated from the given model. We then want to minimize the probability of a Type II error, which is failing to reject H0 when the model is false, subject to a given Type I error. For goodness of fit testing, we assume that each individual’s data X i for i ∈ [n] is sampled i.i.d. from Multinomial(1, p ) where p ∈ Rd>0 and p | ·11 = 1. The classical chi-square hypothesis test (without privacy) forms Pn Pd (Hj −np0j )2 . the histogram H = (H1 , · · · , Hd ) = i=1 X i and computes the chi-square statistic T = j=1 np0 j The reason for using this statistic is that it converges in distribution to χ2d−1 as more data is collected, i.e. n → ∞, when H0 : p = p 0 holds. Hence, we can ensure the probability of false discovery to be close to α as long as we only reject H0 when T > χ2d−1,1−α where the critical value χ2d−1,1−α is defined as the following h i quantity Pr χ2d−1 > χ2d−1,1−α = α. 4.1 Prior Private Chi-square Tests in the Curator Model One approach for chi-square private hypothesis tests that was explored by Gaboardi et al. (2016) and Wang et al. (2015) is to add noise (Gaussian or Laplace) directly to the histogram to ensure privacy and then use the classical test statistic. Note that the resulting asymptotic distribution needs to be modified for such changes to the statistic – it is no longer a chi-square random variable. To introduce the different statistics, we will consider goodness of fit testing after adding noise Z from distribution Dn to the histogram of counts e = H + Z , which ensures ρ-zCDP when D = N (0, 1/ρ) and -DP when D = Lap(2/). The chi-square H statistic then becomes 2 d X Hi + Zi − np0i e (D) = T where Z ∼ Dn . (1) 0 np i i=1 They then show that this statistic converges in distribution to a linear combination of chi-squared random variables, when D ∼ N (0, 1/ρ) and ρ is also decreasing with n. In followup work from Kifer and Rogers (2017), the authors showed that modifying the chi-square statistic to account for the additional noise leads to tests with better empirical power. The projected statistic from  defn Kifer and Rogers (2017) is the following where we use projection matrix Π = Id − d1 11 | , middle matrix  | −1 Mσ = Π Diag p 0 + σ − p 0 p 0 Π, and sample noise Z ∼ Dn , (n) TKR (σ; D) = n  H +Z − p0 n 4 |  Mσ  H +Z − p0 . n (2) 1 We use D = Lap(2/) with σ = n82 for an -DP claim or D = N (0, 1/ρ) with σ = nρ for a ρ-zCDP claim. When comparing the power of all our tests, we will be considering the alternate H1 : p = p 1n where ∆ p 1n = p 0 + √ n where 1 |∆ = 0. (3) (n) Theorem 4.1 [Kifer and Rogers (2017)]. Under the null hypothesis H0 : p = p 0 , the statistic TKR  given in (2) for ρ > 0 converges in distribution to χ2d−1 . Further, under the alternate hypothesis the resulting asymptotic distribution is a noncentral chi-square random variable,   1 D (n) TKR ; N (0, 1/ρ) → nρ   −1   2 | 0 0 0 | χd−1 ∆ Diag(pp ) − p p + 1/ρId ∆ . 1 nρ ; N (0, 1/ρ) H1 : p = p 1n , When D = Lap(2/), we can still obtain the null hypothesis distribution using Monte Carlo simulations to estimate the critical value, since the asymptotic distribution will no longer be chi-square. That is, we can obtain m samples from the statistic under the null hypothesis with Laplace noise added to the histogram of counts. We can then guarantee that the probability of a false discovery is at most α as long as m > d1/αe (see Gaboardi et al. (2016) for more details). 5 Local Private Chi-Square Goodness of Fit Tests We now turn to designing local private goodness of fit tests. We begin by showing how the existing statistics from the previous section can be used in the local setting and then develop new tests based on the exponential mechanism (McSherry and Talwar, 2007) and bit flipping (Bassily and Smith, 2015). Each test is locally private because it perturbs each individual’s data through a local randomizer. We finish the section by empirically checking the power of each test to see which tests outperform others in different parameter regimes. We empirically show that the power of a test is directly related to the size of the noncentral parameter of the chi-square statistic under the alternate distribution. 5.1 Goodness of Fit Test with Noise Addition   In the local model we can add Z i ∼ N 0 , ρ1 Id independent noise to each individual’s data X i to ensure  i.i.d. ρ-LzCDP or Z i ∼ Lap 2 independent noise to X i to ensure -LDP. In either case, the resulting noisy b = H + Z where Z = P Z i will have variance that scales with n for fixed privacy parameters histogram H i b = H +Z Z , ρ > 0. Consider the case where we add Gaussian noise, which results in the following histogram, H   (n) n e (ρ/n) or T where Z ∼ N 0 , ρ Id . Thus, we can use either statistic T (ρ/n), with the latter statistic KR typically having better empirical power (Kifer and Rogers, 2017). We then give our first local private hypothesis test in Algorithm 1. Theorem 5.1. LocalNoiseGOF is ρ-LzCDP when D = N (0, 1/ρ) and -LDP when D = Lap(2/). Proof. The proof follows from the fact that we are adding appropriately scaled noise to each individual’s data via the Gaussian mechanism and then LocalNoiseGOF aggregates the privatized data, which is just a post-processing function on the privatized data. 5  Algorithm 1 Locally Private GOF Test:LocalNoiseGOF x1 , · · · , x n ), ρ, α, H0 : p = p 0 . Input: x =P (x n Let H = `=1 x ` if D = N (0, n/ρ) then (n) Set q = TKR (1/ρ; D) given in (2). if q > χ2d−1,1−α Decision ← Reject. else P Decision ← Fail to Reject. n if D = i=1 Lap(2/) then  (n) Set q = TKR 8/2 ; D given in (2).  (n) Sample m > d1/αe from the distribution of TKR 8/2 ; D assuming H0 Set τ to be the d(m + 1)(1 − α)eth largest sample. if q > τ Decision ← Reject. else Decision ← Fail to Reject. Output: Decision Although we cannot guarantee the probability of a Type I error at most α due to the fact that we use the asymptotic distribution (as in the tests from prior work and the classical chi-square tests without privacy), we expect the Type I errors to be similar to those from the nonprivate test. Note that the test can be modified to accommodate arbitrary noise distributions, e.g. Laplace to ensure differential privacy as was done in Kifer and Rogers (2017). In this case, we can use a Monte Carlo (MC) approach to estimate the critical value τ that ensures the probability of a Type I error is at most α if we reject H0 when the statistic is larger than τ . For the local setting, if each individual perturbs each coordinate by adding Lap (2/) then this will ensure our test is -LDP. However, the sum of independent Laplace random variables is not Laplace, so we will need to estimate a sum of n independent Laplace random variables using MC. In the experiments section we will compare the other local private tests with the version of LocalNoiseGOF which uses Laplace noise and samples m entries from the exact distribution under H0 to find the critical value. Rather than having to add noise to each component of the original data histogram, we consider applying randomized response to obtain a LDP hypothesis test. We will use a form of the exponential mechanism (McSherry and Talwar, 2007) given in Algorithm 2 which takes a single data entry from the set {ee1 , · · · , e d }, where e j ∈ Rd is the standard basis element with a 1 in the jth coordinate and is zero elsewhere, and reports the original entry with probability slightly more than uniform and otherwise reports a different element. Note that MEXP takes a single data entry and is -differentially private. Algorithm 2 Exponential Mechanism: MEXP Input: x ∈ {ee1 , · · · , ed }, . x, z ) = 1{x x = z} Let q(x x with probability Select x̌ x Output: x̌ x,x̌ x)] exp[ q(x e −1+d We have the following result when we use MEXP on each data entry to obtain a private histogram. Pn i.i.d. X i } ∼ Multinomial(1, p ) and we write Ȟ H = Lemma 5.2. If we have histogram H = i=1 X i , where {X Pn X i , ) for each i ∈ [n], then Ȟ H ∼ Multinomial(n, p̌p) where i=1 MEXP (X     1 e + (1 − p ) . (4) p̌p = p e + d − 1 e + d − 1 H , we can create a chi-square statistic by subtracting Ȟ H by its Once we have identified the distribution of Ȟ expectation and dividing the difference by the expectation. Hence testing H0 : p = p 0 after the data has 6 H . We will use the passed through the exponential mechanism, is equivalent to testing H0 : p = pˇ0 with data Ȟ following classical result to prove our theorems. µ, Σ) and Σ is a projection matrix of rank ν and Σµ µ = µ then Theorem 5.3 [Ferguson (1996)]. If X ∼ N (µ µ|µ ). X | X ∼ χ2ν (µ H which will have the correct asymptotic We can then form a chi-square statistic using the private histogram Ȟ distribution. H be given in Lemma 5.2 with Theorem 5.4. Let H ∼ Multinomial(n, p ) and Ȟ  privacy parameter  > 0. 1 Under the null hypothesis H0 : p = p 0 , we have for pˇ0 = e +d−1 ep 0 + (1 − p 0 ) , and (n) TExp () = d X (Ȟj − np̌0j )2 D 2 → χd−1 . np̌0j j=1 (5) D (n) Further, with alternate H1 : p = p 1n , the resulting asymptotic distribution is the following, TExp () →    2P ∆2j d e −1 χ2d−1 j=1 p̌0 e +d−1 j  q q |  √  Ȟ H /n−pˇ0 0 , I − n , which converges in distribution to N pˇ0 pˇ0 , by the central limit d pˇ0 q q | theorem. We then apply Theorem 5.3 with µ = 0 and Id − pˇ0 pˇ0 being a projection matrix of rank d − 1. Proof. Let V = 1 In the we assume holds, in which case V converges in distribution second statement q q |  the alternate p = p  q q      |   ∆ e −1 −1 e −1 ∆ ∆ pˇ0 pˇ0 . We then verify that ee+d−1 Id − pˇ0 pˇ0 to N = to  +d−1 ˇ 0 e +d−1 pˇ0 , Id − e p pˇ0 prove the second statement. We then base our LDP goodness of fit test on this result to obtain the correct critical value to reject the null hypothesis based on a chi-square distribution. The test is presented in Algorithm 3. The following result is Algorithm 3 Local DP GOF Test: LocalExpGOF x1 , · · · , x n ), , α, H0 : p = p 0 . Input: x = (x 0 1 Let p̌p = e +d−1 ep 0 + (1 − p 0 ) . Pn H = i=1 MEXP (x xi , ). Let Ȟ Pd (ȟj −np̌0j )2 Set q = j=1 np̌0 j if q > χ2d−1,1−α Decision ← Reject. else Decision ← Fail to Reject. Output: Decision immediate from the exponential mechanism being -DP and the fact that we use it as a local randomizer. Theorem 5.5. LocalExpGOF is -LDP. Proof. The proof follows from the fact that we use MEXP for each individual’s data and then LocalExpGOF aggregates the privatized data, which is just a post-processing function. 5.2 Goodness of Fit Test with Bit Flipping Note that the noncentral parameter in Theorem 5.4 goes to zero as d grows large due to the coefficient being   2 e −1 . Thus, for large dimensional data the exponential mechanism cannot reject a false null hypothesis. e +d−1 7 We next consider another differentially private algorithm M : {ee1 , · · · , e d } → {0, 1}d , given in Algorithm 4 used in Bassily and Smith (2015) that flips each bit with some biased probability. Algorithm 4 Bit Flip Local Randomizer: Mbit Input: x ∈ {ee1 , · · · , e d }, . for j ∈ [d] do Set zj = xj with probability Output: z e/2 , e/2 +1 otherwise zj = (1 − xj ). Theorem 5.6. The algorithm Mbit is -DP. We then want to form a statistic based on the output z ∈ {0, 1}d that is asymptotically distributed as a chi-square under the null hypothesis. We defer the proof to the appendix. Lemma 5.7. We consider data X i ∼ Multinomial(1, p ) for each i ∈ [n]. We define the following covariance  /2  [(e/2 −1)p +1] e −1 , in terms of α = matrix Σ(pp) and mean vector pe =  e/2 +1 e/2 +1 | Σ(pp) =α2 [Diag (pp) − p (pp) ] + e/2 e/2 + 1 2 Id (6)  √ e D e = Pn Mbit (X X i ) has the following asymptotic distribution n H e 0 p The histogram H i=1 n − p → N (0 , Σ(p )) . Further, Σ(pp) is invertible for any  > 0 and p > 0 . Following a similar analysis in Kifer and Rogers (2017) and using Theorem 5.3, we can form the following e and projection matrix Π = Id − 1 11 | , as statistic for null hypothesis H0 : p = p 0 in terms of the histogram H d  0 well as the covariance matrix Σ p 0 and mean vector pe both given in (6) where we replace p with p 0 : !| ! e e  H H (n) 0 0 −1 TBitFlip () = n − pe ΠΣ p Π − pe0 ] (7) n n We can then design a hypothesis test based on the outputs from Mbit in Algorithm 5 Algorithm 5 Local DP GOF Test: LocalBitFlipGOF x , · · · , xn ), , α, H0 : p = p0 . Input: x = (x Pn1 e xi , ). Let H = i=1 Mbit (x (n) Set q = TBitFlip () if q > χ2d−1,1−α Decision ← Reject. else Decision ← Fail to Reject. Output: Decision Theorem 5.8. LocalBitFlipGOF is -LDP. We now show that the statistic in (7) is asymptotically distributed as χ2d−1 . (n) Theorem 5.9. If the null hypothesis H0 : p = p 0 holds, then the statistic TBitFlip () is asymptotically (n) D distributed as a chi-square, i.e. TBitFlip () → χ2d−1 . Further, if we consider the alternate H1 : p = p 1 then   2 D (n) e/2 −1 | 0 −1 p TBitFlip () → χ2d−1 · ∆ Σ(p ) ∆ . e/2 +1    √  He D n n − pe0 → N 0 , Σ(pe0 ) . Since Σ(pe0 ) is full rank and has an eigenvector that is all ones. Thus, we can diagonalize the covariance matrix as Σ(pe0 ) = BDB | where D is a Proof. From Lemma 5.7, we know that 8 Noncentral Parameter with eps = 4 6 20 Noncentral Parameter with eps = 3 2.0 Noncentral Parameter with eps = 2 0.5 Noncentral Parameter with eps = 1 LocalGaussGOF LocalGaussGOF LocalGaussGOF LocalExpGOF LocalExpGOF LocalExpGOF LocalExpGOF LocalBitFlipGOF LocalBitFlipGOF LocalBitFlipGOF LocalBitFlipGOF 10 20 30 40 15 0 Dimension d 20 40 60 80 0 0 0.0 0.0 1 0.1 5 10 Noncentral Parameter Coefficient 4 3 2 Noncentral Parameter Coefficient 0.5 1.0 Noncentral Parameter Coefficient 0.3 0.2 Noncentral Parameter Coefficient 1.5 0.4 5 LocalGaussGOF 0 Dimension d 100 200 300 400 0 200 Dimension d 400 600 800 1000 Dimension d Figure 1: The coefficient on ∆ |∆ in the noncentral parameter for the local private tests where “LocalGaussGOF" is LocalNoiseGOF with Gaussian noise, LocalExpGOF, and LocalBitFlipGOF for various dimensions d and . diagonal matrix and B has orthogonal columns with one of them being d1 1 . Thus, we have ! e √ H D nΣ(pe0 )−1/2 Π − pe0 → N (00, Λ) n where Λ = Σ(pe0 )−1/2 ΠBDB | ΠΣ(pe0 )−1/2 . Hence, Λ will be the identity matrix with a single zero on the diagonal. We then apply Theorem 5.3 tp prove the first statement.    √ e D pe0 → N α · ∆, Σ(pe0 ) . To prove the second statement we assume that p = p1 holds, which gives n H n − Thus, !   e √ H D −1/2 e e 0 0 −p → N α · Σ(pe0 )−1/2∆ , Λ nΣ(p ) Π n We again use Theorem 5.3 to obtain the noncentral parameter α2 · ∆ | Σ(pe0 )−1∆ . 5.3 Comparison of Noncentral Parameters We now compare the noncentral parameters of the three local private tests we presented in Algorithms 1, 3 and 5. We consider the null hypothesis p 0 = (1/d, · · · , 1/d) for d > 2, and alternate H1 : p = p 0 + √∆n . In this case, we can easily compare the various noncentral parameters for various privacy parameters and dimensions d. In Figure 1 we give the coefficient to the term ∆ |∆ in the noncentral parameter of the asymptotic distribution for each local private test presented thus far. The larger this coefficient is, the better the power will be for any alternate ∆ vector. Note that in LocalNoiseGOF, we set ρ = 2 /8 which makes the variance the same as for a random variable distributed as Lap(2/) for an -DP guarantee – recall that LocalNoiseGOF with Gaussian noise does not satisfy -DP for any  > 0. We give results for  ∈ {1, 2, 3, 4} which are all in the range of privacy parameters that have been considered in actual locally differentially private algorithms used in practice.1 From the plots, we see how LocalExpGOF may outperform LocalBitFlipGOF depending on the privacy parameter and dimension of the data. We can use these plots to determine which test to use given  and dimension of data d. When H0 is not uniform, we can use the noncentral parameters given for each test to determine which test has the largest noncentral parameter for a particular privacy budget . 5.4 Empirical Results We then empirically compare the power between LocalNoiseGOF with Laplace noise in Algorithm 1, LocalExpGOF in Algorithm 3, and LocalBitFlipGOF in Algorithm 5. Recall that all three of these tests have 1 In Erlingsson et al. (2014), we know that Google uses  = ln(3) ≈ 1.1 in RAPPOR and from Aleksandra Korolova’s Twitter post on September 13, 2016 https://twitter.com/korolova/status/775801259504734208 we know that Apple uses  = 1, 4. 9 the same privacy benchmark of local differential privacy. For LocalNoiseGOF with Laplace noise, we will use m = 999 samples in out Monte Carlo simulations. In our experiments we fix α = 0.05 and  ∈ {1, 2, 4}. We then consider null hypotheses of the form p 0 = (1/d, 1/d, · · · , 1/d) and alternate H1 : p = p 0 + η(1, −1, · · · , 1, −1) for some η > 0. In Figure 2, we plot the number of times our tests correctly rejects the null hypothesis in 1000 independent trials for various sample sizes n and privacy parameters . 1.0 Empirical Power Curves for Local DP GOF 1.0 Empirical Power Curves for Local DP GOF NonPrivate Power 0.4 0.2 0.0 0.0 0.2 0.4 Power 0.6 0.8 1 2 4 0.6 0.8 epsilon 5000 10000 15000 20000 0 n 10000 20000 30000 40000 50000 n Figure 2: Comparison of empirical power among the classical non-private test and the local private tests LocalNoiseGOF with Laplace noise (solid line), LocalExpGOF (dashed line), and LocalBitFlipGOF (dotted line); in the left plot, d = 4 and η = 0.01, in the right plot, d = 40 and η = 0.005. From Figure 2, we can see that the test statistics that have the largest noncentral parameter for a particular dimension d and privacy parameter  will have the best empirical power. When d = 4, we see that LocalExpGOF performs the best. However, for d = 40 it is not so clear cut. When  = 4, we can see that LocalExpGOF does the best, but then when  = 2, LocalBitFlipGOF does best. Thus, the best Local DP Goodness of Fit test depends on the noncentral parameter, which is a function of , the null hypothesis p 0 , and alternate p = p 0 + ∆ . Note that the worst local DP test also depends on the privacy parameter and the dimension d. Based on our empirical results, we see that no single locally private test is best for all data dimensions. Knowing the corresponding noncentral parameter for a given problem is useful in determining which tests to use, where the larger the noncentral parameter is the higher the power will be. 6 Local Private Independence Tests We now show that our techniques can be extended to include composite hypothesis tests, where we test whether the data comes from a whole family of probability distributions. We will focus on independence testing, but much of the theory can be extended to general chi-square tests. We will closely follow the presentation and notation as in (Kifer and Rogers, 2017). i.i.d. i.i.d. U ` }n`=1 ∼ Multinomial(1, π (1) ) for π (1) ∈ Rr , {V V ` }n`=1 ∼ We consider two multinomial random variables {U (2) (2) c (1) (2) π π π π Multinomial(1, ) for ∈ R and no component of or is zero. Without loss of generality, we will consider an individual to be in one of r groups who reports a data record that is one of c categories. The Pin n collected data consists of n joint outcomes H whose (i, j)th coordinate is Hi,j = `=1 1{U`,i = 1 & V`,j = 1}. Note that H is then the contingency table over the joint outcomes. U ` }n`=1 and {V V ` }n`=1 , we have Under the null hypothesis of independence between {U    | π (1) , π (2) ) π (1) , π (2) ) = π (1) π (2) H ∼ Multinomial n, p (π where p (π 10 (8) π (1) , π (2) ) and so What makes this test difficult is that the analyst does not know the data distribution p (π cannot simply plug it into the chi-square statistic. Rather, we use the data to estimate the best guess for the unknown probability distribution that satisfies the null hypothesis. Note that without privacy, each individual ` ∈ [n] is reporting a r × c matrixP X ` which would be 1 in exactly n one location. Thus we can alternatively write the contingency table as H = `=1 X ` . We then use the three local private algorithms we presented earlier for noise addition, exponential mechanism, and bit flipping to see how we can form a private chi-square statistic for independence testing. We want to be able to ensure the privacy of both the group and the category that each individual belongs to. For completeness, we will present the minimum chi-square asymptotic theory from Ferguson (1996) that was used in Kifer and Rogers (2017). We will use this theory to design general chi-square test statistics for local differentially private hypothesis tests. Consider a d dimensional random vector V (n) and a k ≤ d dimensional parameter space Θ, which is an open subset of Rk . We want to measure the distance between the random variable V (n) and some model A(θθ ) that maps parameters in Θ to Rd . We then use the following quadratic form where M (θθ ) ∈ Rd×d is a positive-semidefinite matrix.  |   n V (n) − A(θθ ) M (θθ ) V (n) − A(θθ ) (9) We want to ensure the following assumptions hold. Assumption 6.1. For all θ ∈ Θ, we have • There exists a parameter θ ? ∈ Θ such that for some model A(·) and covariance matrix C(·)  √  (n) D n V − A(θθ ? ) → N (00, C(θθ ? )) • A(θθ ) is bicontinuous. • A(θθ ) has continuous first partial derivatives, denoted as Ȧ(θθ ), with full rank k. • The matrix M (θθ ) is continuous in θ and there exists an η > 0 such that M (θθ ) − ηId is positive definite in an open neighborhood of θ ? . We will then use the following useful result from Kifer and Rogers (2017)[Theorem 4.2]. Theorem 6.2 [Kifer and Rogers (2017)]. Let ν be the rank of C(θθ ? ). If Assumption 6.1 holds, and for all θ ∈ Θ we have C(θθ )M (θθ )C(θθ ) = C(θθ ) C(θθ )M (θθ )Ȧ(θθ ) = Ȧ(θθ ) P V (n) ) → θ ? we have Then for any estimate φ(V n  |  o D V (n) )) V (n) − A(θθ ) min n V (n) − A(θθ ) M (φ(V → χ2ν−k . θ ∈Θ To ensure the assumptions hold, we will assume that each component of π (1) , π (2) is positive, i.e. π (i) > 0 for i = 1, 2. 6.1 Independence Test with Noise Addition For noise we will have the following contingency table H + Z (treating H as an r × c vector) where  addition,  n Z = N 0 , ρ for ρ-LzCDP or Z is the sum of n independent Laplace random vectors with scale parameter 2/ in each coordinate for -LDP, although we will only consider the Gaussian noise case. We can then use 11 the same statistic presented in Kifer and Rogers (2017) with a rescaling of the variance in the P noise and c flattening the contingency table as a vector. For convenience, we write the marginals as Hi,· = j=1 Hi,j P 2 and similarly for H·,j . Further, we will write n b = n + i,j Zi,j in the following test statistic,     1 1 (2) b = b = π (Hi,· + Zi,· ) : i ∈ [r] , π (H·,j + Z·,j ) : j ∈ [c] n b n b    | 1 (1) (1) (1) c = Diag p (b b(2) ) − p (b b(2) ) p (b b(2) ) + Irc M π ,π π ,π π ,π ρ |  −1        1 (1) (2) (1) (2) (1) (2) c b (n) ρ/n; (π p p π H + Z − np π , π Π M Π H + Z − np π , π T , π ) = KR n (1) (10) We use this statistic because it is asymptotically distributed as a chi-square random variable given the null hypothesis holds, which follows directly from the general chi-square theory presented in Kifer and Rogers (2017). Theorem 6.3. Under the null hypothesis that U and V are independent, then we have as n → ∞ n  o D b (n) ρ/n; (π π (1) , π (2) ) min T → χ2(r−1)(c−1) . KR π (2) π (1) ,π We present the test in Algorithm 6 for Gaussian noise which uses the statistic in (10). Algorithm 6 LzCDP Independence Test with Gaussian Mechanism: LocalNoiseIND x1 ,P Input: (x · · · , x n ), ρ, α. n Let H = `=1 x ` n o (1) (2) b (n) ρ/n; (π π Set q = minπ (1) ,ππ (2) T , π ) given in (10). KR if q > χ2(r−1)(c−1),1−α then Decision ← Reject. else Decision ← Fail to Reject. Output: Decision We then have the following result which follows from the privacy analysis from before. Theorem 6.4. LocalNoiseIND is ρ-LzCDP. 6.2 Independence Test with the Exponential Mechanism Next we want to design an independence test when the data is generated from MEXP given in Algorithm 2. 1 H ∼ Multinomial n, p̌p(π π (1) , π (2) ) where β = e +rc−1 In this case our contingency table can be written as Ȟ and we use (4) to get     π (1) , π (2) ) = β (e − 1) π (1) π (2) p̌p(π | +1 (11) We then obtain an estimate for the unknown parameters,  | b(2) will follow a common rule of thumb for small sample sizes, so that if nb π (1) π ≤ 5 for any cell, then we simply fail to reject H0 2 We 12  Ȟi,· π = − cβ : i ∈ [r] , π̌ β (e − 1) n   1 Ȟ·,j (2) π = π̌ − rβ : j ∈ [c] β (e − 1) n   2 (1) (2) π π Ȟ − np̌ π̌ , π̌ X i,j i,j (n) TExp () = Ť π (1) , π̌ π (2) ) np̌i,j (π̌ i,j (1)  1 (12) We can then prove the following result, which uses Theorem 6.2. Theorem 6.5. Assuming U and V are independent with true probability vectors π (1) , π (2) > 0 respectively, (n) D TExp () → χ2(r−1)(c−1) . then as n → ∞ we have Ť (1) (2) π (1) , π̌ π (2) both converge Proof.  Note  that π̌   in probability to the true parameters π , π , respectively due (1) (2) H /n = p̌p(π π , π ) and V Ȟ H /n → 0. We then form the following statistic in terms of parameters to E Ȟ θ (1) in the r dimensional simplex with all positive components and θ (2) in the c dimensional simplex with all positive components,   (n) TExp θ (1) , θ (2) ;  Ť  |  −1   H /n − p̌p(θθ (1) , θ (2) ) Diag p̌p(π̌ π (1) , π̌ π (2) ) H /n − p̌p(θθ (1) , θ (2) ) = n Ȟ Ȟ We then have the following calculation,   n (n)  o π (1) , π̌ π (2) = argmin Ť TExp θ (1) , θ (2) ;  . π̌ θ (2) θ (1) ,θ |  D √ H /n − p̌p(π π (1) , π (2) ) → N (00, C(θθ )) where C(θθ ) = Diag(p̌p(θθ (1) , θ (2) ))−p̌p(θθ (1) , θ (2) ) p̌p(θθ (1) , θ (2) ) Note that n Ȟ is the covariance matrix for the multinomial random variable. We then apply Theorem 6.2 to prove the statement, so we verify that the following equalities hold,  −1 C(θθ ) · Diag p̌p(θθ (1) , θ (2) ) · C(θθ ) = C(θθ ) and  −1   |  C(θθ ) · Diag p̌p(θθ (1) , θ (2) ) ∇ θ (1) θ (2)     |  = Irc − p̌p(θθ (1) , θ (2) )11| ∇ θ (1) θ (2)   |  = ∇ θ (1) θ (2) where the last equality follows from the last coordinates of each probability vector can be written as Pr−1 Pc−1 (2) (1) (2) θr = 1 − i=1 θi and θc = 1 − j=1 θj . We then use this result to design our private chi-square test for independence. We then have the following result which again follows from the privacy analysis from before. Theorem 6.6. LocalExpIND is -LDP. 13 Algorithm 7 Local DP IND Test: LocalExpIND x1 , · · · , x n ), , α, H0 : p = p 0 . Input: x =P (x xi , ). H = ni=1 MEXP (x Let Ȟ (n) TExp () from (12) Set q = Ť if q > χ2d−1,1−α , Decision ← Reject. else Decision ← Fail to Reject. Output: Decision 6.3 Independence Test with Bit Flipping Lastly, we P design an independence test when thedata is reported via Mbit in Algorithm 4. Assuming n π (1) , π (2) ) in π (1) , π (2) ) , then we know that replacing p 0 with p (π that H = `=1 X ` ∼ Multinomial n, p (π Section 5.2 gives us the following asymptotic distribution (treating the contingency table of values as a vector) with covariance matrix Σ(·) given in (6)      e/2 − 1   | e √  1  H  π (1) π (2) + /2 n  −  /2  n  e +1 e + 1  | {z } e(π π (1) ,π π (2) ) p    |  D → N 0 , Σ π (1) π (2) (13) Similar to analysis for Theorem 6.5, we start with a rough estimate for the  /2  unknown parameters which converges in probability to the true estimates, so we again use α = ee/2 −1 to get +1 e π (1) e π (2) 1 α  e i,· c H − /2 : i ∈ [r] n e +1  1 α  ! e ·,j r H : j ∈ [c] − /2 n e +1 = = !  (14) We then give the resulting statistic, parameterized by the unknown parameters π (`) , for ` ∈ {1, 2}. For middle | −1   f = ΠΣ π e(1) π e(2) matrix M Π, we have    | 1 e (1) (2) (1) (2) e (n) T θ , θ ;  = H − ne p θ , θ BitFlip n    (1) (2) e f M H − ne p θ ,θ (15) Theorem 6.7. Under the null hypothesis that U and V are  independent with true  probability vectors  D 2 (n) (1) (2) (1) (2) e π , π > 0 respectively, then we have as n → ∞, minθ (1) ,θθ (2) T BitFlip θ , θ ;  → χ(r−1)(c−1) . Proof. As in the proof of Theorem 6.5, |we will use Theorem 6.2, so we first need to the verify the following equality holds, where p (θθ ) = θ (1) θ (2) −1 ΠΣ (pp(θθ )) Π · Σ (pp(θθ )) · ΠΣ (pp(θθ )) Π = ΠΣ (pp(θθ )) Π. Recall that Σ(pp(θθ )) has an eigenvector of all 1’s and the other eigenvectors are orthogonal to it. Hence, when we diagonalize Σ(pp(θθ )) = BDB | , then ΠB is going to be the same as B except the column of all 1’s becomes 14 zero, which we will denote as B ∗ . Hence, Σ(pp(θθ ))ΠΣ(pp(θθ ))−1 ΠΣ(pp(θθ )), becomes BD∗ B | where D∗ is the same as D except the eigenvalue on the diagonal for the eigenvector of all 1’s becomes zero. Then projecting the resulting matrix with Π will not change the resulting product We then have ΠΣ (pp(θθ )) Π · Σ (pp(θθ )) −1 · ΠΣ (pp(θθ )) Π = ΠBD B Π = ΠΣ(pp(θθ ))Π. ∗ | We then need to show that the following equality holds ΠΣ (pp(θθ )) Π · Σ(pp(θθ ))−1 Π∇e p (θθ (1) , θ (2) ) = Π∇e p (θθ (1) , θ (2) ) We again use the fact that Σ(pp(θθ )) has an eigenvector that is all 1’s. Hence, we have ΠΣ(pp(θθ ))Π = Σ(pp(θθ )) − e/2 11 | . rc · (e/2 + 1)2 We then have, ΠΣ (pp(θθ )) Π · Σ(pp(θθ ))−1 Π∇e p (θθ (1) , θ (2) )   e/2 | = Σ(pp(θθ )) − 1 1 rc · (e/2 + 1)2  = · Σ(pp(θθ ))−1 Π∇e p (θθ (1) , θ (2) )  1 Irc − 11 | Π∇e p (θθ (1) , θ (2) ) rc = ΠΠ∇e p (θθ (1) , θ (2) ) = Π∇e p (θθ (1) , θ (2) ). Algorithm 8 Local DP IND Test: LocalBitFlipIND x1 , · · · , xn ), , α. Input: (x Pn e xi , ). Let H = i=1 M  bit (x e (n) π (1) , π (2) ) q = minπ (1) ,ππ (2) T BitFlip ; (π   from (15). if q > χ2(r−1)(c−1),1−α Decision ← Reject. else Decision ← Fail to Reject. Output: Decision We present the test in Algorithm 8. The following result follows from same privacy analysis as before. Theorem 6.8. LocalBitFlipIND is -LDP. 6.4 Empirical Results As we did for the locally private goodness of fit tests, we empirically compare the power for our various tests for independence. We consider the null hypothesis that the two sequences of categorical random variables U ` }n`=1 and {V V ` }n`=1 are independent of one another. Under an alternate hypothesis, we generate the {U contingency data according to a non-product distribution. We fix the distribution p (1) for the contingency 15 U ` }n`=1 , π (2) ∈ Rc is the table to be of the following form, where π (1) ∈ Rr is the unknown distribution for {U n V ` }`=1 , and r, c are even unknown distribution for {V  | p (1) = π (1) π (2) + η(1, −1, · · · , −1, 1)| (1, −1, · · · , −1, 1) (16) Note that the hypothesis test does not know the underlying π (i) for i ∈ {1, 2}, but to generate the data we must fix these distributions. We show power results when the marginal distributions satisfy π (1) = (1/r, · · · , 1/r) and π (2) = (1/c, · · · , 1/c). In Figure 3, we give results for various n and  ∈ {1, 2, 4} for the case when (r, c) = (2, 2) and η = 0.01 as well as the case when (r, c) = (10, 4) and η = 0.005. Note that we only give results for the two tests LocalExpIND and LocalBitFlipIND. 1.0 Empirical Power Curves for Local DP IND 1.0 Empirical Power Curves for Local DP IND NonPrivate Power 0.4 0.2 0.0 0.0 0.2 0.4 Power 0.6 0.8 1 2 4 0.6 0.8 epsilon 5000 10000 15000 20000 25000 0 n 10000 20000 30000 40000 50000 n Figure 3: Comparison of empirical power of classical non-private test versus local private tests LocalExpIND (dashed line), and LocalBitFlipIND (dotted line). In the left plot we set (r, c) = (2, 2) and η = 0.01 while we set (r, c) = (10, 4) and η = 0.005 in the right plot for the contingency table data distribution given in (16). 7 Conclusion We have designed several hypothesis tests, each depending on different local differentially private algorithms: LocalNoiseGOF (LocalLapGOF), LocalExpGOF, and LocalBitFlipGOF as well as their corresponding independence tests LocalNoiseIND, LocalExpIND, and LocalBitFlipIND. This required constructing different statistics so that the resulting distribution after injecting noise into the data in order to satisfy privacy could be closely approximated with a chi-square distribution. Hence, we designed rules for when a null hypothesis H0 should be rejected while satisfying some bound α on Type I error. Further, We showed that each statistic has a noncentral chi-square distribution when the data is drawn from some alternate hypothesis H1 . Depending on the form of the alternate probability distribution, the dimension of the data, and the privacy parameter, either LocalExpGOF or LocalBitFlipGOF gave better power. This corroborates the results from Kairouz et al. (2014) who showed that in hypothesis testing, different privacy regimes have different optimal local differentially private mechanisms, although utility in their work was in terms of KL divergence. Our results show that the power of the test is directly related to the noncentral parameter of the test statistic that is used. This requires the data analyst to carefully consider alternate hypotheses, as well as the data dimension and privacy parameter for a particular test and then see which test statistic results in the largest noncentral parameter. We focused primarily on goodness of fit testing, where the null hypothesis is a single probability distribution. We further developed local private independence tests which resulted in using previous general 16 chi-square theory presented in Kifer and Rogers (2017). This basic framework can be used to develop other chi-square hypothesis tests where the null hypothesis is not a single parameter. We hope that this will lead to future work on designing local differentially private hypothesis tests beyond chi-square testing. 17 References American Statistical Association. Discovery with Data: Leveraging Statistics with Computer Science to Transform Science and Society, 2014. URL http://www.amstat.org/policy/pdfs/ BigDataStatisticsJune2014.pdf. Apple Press Info. Apple previews ios 10, the biggest ios release ever, 2016. URL https://www.apple.com/ pr/library/2016/06/13Apple-Previews-iOS-10-The-Biggest-iOS-Release-Ever.html. Raef Bassily and Adam Smith. Local, private, efficient protocols for succinct histograms. In Proceedings of the Forty-seventh Annual ACM Symposium on Theory of Computing, STOC ’15, pages 127–135, New York, NY, USA, 2015. ACM. ISBN 978-1-4503-3536-2. doi: 10.1145/2746539.2746632. URL http://doi.acm.org/10.1145/2746539.2746632. Mark Bun and Thomas Steinke. Concentrated differential privacy: Simplifications, extensions, and lower bounds. In Theory of Cryptography - 14th International Conference, TCC 2016-B, Beijing, China, October 31 - November 3, 2016, Proceedings, Part I, pages 635–658, 2016. doi: 10.1007/978-3-662-53641-4_24. URL http://dx.doi.org/10.1007/978-3-662-53641-4_24. Bryan Cai, Constantinos Daskalakis, and Gautam Kamath. Priv’it: Private and sample efficient identity testing. In International Conference on Machine Learning, 2017. John C. Duchi, Michael I. Jordan, and Martin J. Wainwright. Local privacy and statistical minimax rates. In 54th Annual IEEE Symposium on Foundations of Computer Science, FOCS 2013, 26-29 October, 2013, Berkeley, CA, USA, pages 429–438, 2013a. doi: 10.1109/FOCS.2013.53. URL https: //doi.org/10.1109/FOCS.2013.53. John C. Duchi, Martin J. Wainwright, and Michael I. Jordan. Local privacy and minimax bounds: Sharp rates for probability estimation. In Advances in Neural Information Processing Systems 26: 27th Annual Conference on Neural Information Processing Systems 2013. Proceedings of a meeting held December 5-8, 2013, Lake Tahoe, Nevada, United States., pages 1529–1537, 2013b. URL http://papers.nips.cc/paper/ 5013-local-privacy-and-minimax-bounds-sharp-rates-for-probability-estimation. Cynthia Dwork and Aaron Roth. The algorithmic foundations of differential privacy. Foundations and Trends R in Theoretical Computer Science, 9(3–4):211–407, 2014. ISSN 1551-305X. doi: 10.1561/0400000042. URL http://dx.doi.org/10.1561/0400000042. Cynthia Dwork, Krishnaram Kenthapadi, Frank McSherry, Ilya Mironov, and Moni Naor. Our data, ourselves: Privacy via distributed noise generation. In Advances in Cryptology - EUROCRYPT 2006, 25th Annual International Conference on the Theory and Applications of Cryptographic Techniques, St. Petersburg, Russia, May 28 - June 1, 2006, Proceedings, pages 486–503, 2006a. doi: 10.1007/11761679_29. Cynthia Dwork, Frank Mcsherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In In Proceedings of the 3rd Theory of Cryptography Conference, pages 265–284. Springer, 2006b. Úlfar Erlingsson, Vasyl Pihur, and Aleksandra Korolova. Rappor: Randomized aggregatable privacy-preserving ordinal response. In Proceedings of the 2014 ACM SIGSAC Conference on Computer and Communications Security, CCS ’14, pages 1054–1067, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2957-6. doi: 10.1145/2660267.2660348. URL http://doi.acm.org/10.1145/2660267.2660348. T.S. Ferguson. A Course in Large Sample Theory. Chapman & Hall Texts in Statistical Science Series. Taylor & Francis, 1996. ISBN 9780412043710. URL https://books.google.com/books?id=DDh_OiTw9agC. Marco Gaboardi, Hyun Woo Lim, Ryan Rogers, and Salil P. Vadhan. Differentially private chi-squared hypothesis testing: Goodness of fit and independence testing. In Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48, ICML’16, pages 2111–2120. JMLR.org, 2016. URL http://dl.acm.org/citation.cfm?id=3045390.3045613. 18 Nils Homer, Szabolcs Szelinger, Margot Redman, David Duggan, Waibhav Tembe, Jill Muehling, John V. Pearson, Dietrich A. Stephan, Stanley F. Nelson, and David W. Craig. Resolving individuals contributing trace amounts of dna to highly complex mixtures using high-density snp genotyping microarrays. PLoS Genet, 4(8), 08 2008. David R. Hunter, Steven M. Goodreau, and Mark S. Handcock. Goodness of fit of social network models. Journal of the American Statistical Association, 103:248–258, 2008. URL http://EconPapers.repec.org/ RePEc:bes:jnlasa:v:103:y:2008:m:march:p:248-258. Aaron Johnson and Vitaly Shmatikov. Privacy-preserving data exploration in genome-wide association studies. In Proceedings of the 19th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’13, pages 1079–1087, New York, NY, USA, 2013. ACM. Peter Kairouz, Sewoong Oh, and Pramod Viswanath. Extremal mechanisms for local differential privacy. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger, editors, Advances in Neural Information Processing Systems 27, pages 2879–2887. Curran Associates, Inc., 2014. URL http: //papers.nips.cc/paper/5392-extremal-mechanisms-for-local-differential-privacy.pdf. Peter Kairouz, Keith Bonawitz, and Daniel Ramage. Discrete distribution estimation under local privacy. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, pages 2436–2444, 2016. URL http://jmlr.org/proceedings/papers/v48/ kairouz16.html. Kazuya Kakizaki, Kazuto Fukuchi, and Jun Sakuma. Differentially private chi-squared test by unit circle mechanism. In Doina Precup and Yee Whye Teh, editors, Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pages 1761–1770, International Convention Centre, Sydney, Australia, 06–11 Aug 2017. PMLR. URL http://proceedings.mlr.press/ v70/kakizaki17a.html. Vishesh Karwa and Aleksandra Slavković. Inference using noisy degrees: Differentially private β-model and synthetic graphs. Ann. Statist., 44(P1):87–112, 02 2016. Daniel Kifer and Ryan Rogers. A New Class of Private Chi-Square Hypothesis Tests. In Aarti Singh and Jerry Zhu, editors, Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, volume 54 of Proceedings of Machine Learning Research, pages 991–1000, Fort Lauderdale, FL, USA, 20–22 Apr 2017. PMLR. URL http://proceedings.mlr.press/v54/rogers17a.html. Frank McSherry and Kunal Talwar. Mechanism design via differential privacy. In Annual IEEE Symposium on Foundations of Computer Science (FOCS), Providence, RI, October 2007. IEEE. URL https://www. microsoft.com/en-us/research/publication/mechanism-design-via-differential-privacy/. A. Pastore and M. Gastpar. Locally differentially-private distribution estimation. In 2016 IEEE International Symposium on Information Theory (ISIT), pages 2694–2698, July 2016. doi: 10.1109/ISIT.2016.7541788. Sofya Raskhodnikova, Adam Smith, Homin K. Lee, Kobbi Nissim, and Shiva Prasad Kasiviswanathan. What can we learn privately? 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, 00: 531–540, 2008. ISSN 0272-5428. doi: doi.ieeecomputersociety.org/10.1109/FOCS.2008.27. Or Sheffet. Differentially private least squares: Estimation, confidence and rejecting the null hypothesis. arXiv preprint arXiv:1507.02482, 2015. Jessica E. Steele, Pål Roe Sundsøy, Carla Pezzulo, Victor A. Alegana, Tomas J. Bird, Joshua Blumenstock, Johannes Bjelland, Kenth Engø-Monsen, Yves-Alexandre de Montjoye, Asif M. Iqbal, Khandakar N. Hadiuzzaman, Xin Lu, Erik Wetter, Andrew J. Tatem, and Linus Bengtsson. Mapping poverty using mobile phone and satellite data. Journal of The Royal Society Interface, 14(127), 2017. ISSN 1742-5689. doi: 10.1098/rsif.2016.0690. URL http://rsif.royalsocietypublishing.org/content/14/127/20160690. 19 Caroline Uhler, Aleksandra Slavkovic, and Stephen E. Fienberg. Privacy-preserving data sharing for genomewide association studies. Journal of Privacy and Confidentiality, 5(1), 2013. Yue Wang, Jaewoo Lee, and Daniel Kifer. Differentially private hypothesis testing, revisited. arXiv preprint arXiv:1511.03376, 2015. Stanley L. Warner. Randomized response: A survey technique for eliminating evasive answer bias. Journal of the American Statistical Association, 60:63–69, 1965. M. Ye and A. Barg. Optimal schemes for discrete distribution estimation under local differential privacy. In 2017 IEEE International Symposium on Information Theory (ISIT), pages 759–763, June 2017. doi: 10.1109/ISIT.2017.8006630. Fei Yu, Stephen E. Fienberg, Aleksandra B. Slavkovic, and Caroline Uhler. Scalable privacy-preserving data sharing methodology for genome-wide association studies. Journal of Biomedical Informatics, 50:133–141, 2014. 20 A Omitted Proofs Proof of Lemma 5.7. This follows from the central limit theorem. We first compute the expected value e/2 1 hei 1 E H = /2 p + /2 (1 − p ). n e +1 e +1 In order to compute the covariance matrix, we consider the diagonal term (j, j) i h /2 1 e j )2 = e pj + /2 (1 − pj ) E (H /2 e +1 e +1 Next we compute the off diagonal term (j, k) h i  e/2 2 ej H ek = E H Pr [Xj = 1 & Xk = 1] e/2 + 1 + + e/2 e/2 + 1 1 2 (Pr [Xj = 1 & Xk = 0] + Pr [Xj = 0 & Xk = 1]) 2 Pr [Xj = 0 & Xk = 0] e/2 + 1  2 h i 1 /2 = e (p + p ) + (1 − p − p ) j k j k e/2 + 1 Before we construct the covariance matrix, we simplify a few terms h i h i2 e j )2 − E H ej E (H  2       2  1 /2 /2 /2 /2 = e − 1 e + 1 p + 1 + e − e − 1 p + 1 j j e/2 + 1 2 h    i 1 2 /2 /2 /2 2 /2 e − 1 e + 1 − 2 p − (e − 1) (p ) + e = j j e/2 + 1   2 1 /2 /2 = 2 e − 1 pj (1 − pj ) + e e/2 + 1 Further, we have h i h i h i ej H ek − E H ej E H ek E H  2 h    i 1 /2 /2 /2 = e − 1 (p + p ) + 1 − (e − 1)p + 1 (e − 1)p + 1 j k j k e/2 + 1  /2 2 e −1 = − /2 pj pk e +1 Putting this together, the covariance matrix can then be written as h  | i h i  h i| e H e e E H e Σ(pp) = E H −E H  /2 2 e −1 e/2 | p p = [Diag (p ) − p (p ) ] + 2 Id e/2 + 1 e/2 + 1 21
10math.ST
The `∞ Perturbation of HOSVD and Low Rank Tensor Denoising Dong Xia and Fan Zhou arXiv:1707.01207v2 [math.ST] 13 Jul 2017 University of Wisconsin - Madison and Georgia Institute of Technology Email: [email protected], [email protected] (July 14, 2017) Abstract The higher order singular value decomposition (HOSVD) of tensors is a generalization of matrix SVD. The perturbation analysis of HOSVD under random noise is more delicate than its matrix counterpart. Recent progress has been made in Richard and Montanari [2014], Zhang and Xia [2017] and Liu et al. [2017] demonstrating that minimax optimal singular spaces estimation and low rank tensor recovery in `2 -norm can be obtained through polynomial time algorithms. In this paper, we analyze the HOSVD perturbation under Gaussian noise based on a second order method, which leads to an estimator of singular vectors with sharp bound in `∞ -norm. A low rank tensor denoising estimator is then proposed which achieves a fast convergence rate characterizing the entry-wise deviations. The advantages of these `∞ -norm bounds are displayed in applications including high dimensional clustering and sub-tensor localizations. 1 Introduction A tensor is a mutliarray of more than 2 dimensions, which can be viewed as a higher order generalization of matrices. Data of tensor types has been widely available in many fields, such as image and video processing (see Liu et al. [2013], Westin et al. [2002], Hildebrand and Rüegsegger [1997], Li and Li [2010], Vasilescu and Terzopoulos [2002]); latent variable modeling (see Anandkumar et al. [2014], Cichocki et al. [2015], Chaganty and Liang [2013]); genomic signal processing (Omberg et al. 1 [2007], Muralidhara et al. [2011] and Ponnapalli et al. [2011]) and references therein. It is demanding to handle these datasets in order to take the most advantages of the tensor structures. The task is challenging due to the highly non-convexity of tensor related optimization problems. For instance, computing the tensor operator norm is generally NP-hard while it can be implemented fast for matrices, see Hillar and Lim [2013]. The higher order singular value decomposition (HOSVD) is one machinery to deal with tensors which generalizes the matrix SVD to higher order tensors, see De Lathauwer et al. [2000b], Bergqvist and Larsson [2010], Chen and Saad [2009] and Kolda and Bader [2009]. The conceptual simplicity and computational efficiency make HOSVD popular and successful on several applications including face recognition (see Vasilescu and Terzopoulos [2002]), genomic signal processing (see Muralidhara et al. [2011]) and more examples in a survey paper Acar and Yener [2009]. Basically, the HOSVD unfolds a higher order tensor into matrices and treat it with standard matrix techniques to obtain the principal singular subspaces in each dimension, see more details in Section 2. Although HOSVD is appealing, there are several fundamental theoretical mysteries yet to be uncovered. One important problem is to study the perturbation of HOSVD when stochastic noise is observed. The difficulty comes from both methodological and theoretical aspects. The computation of HOSVD is essentially reduced to matrix SVD which can be achieved efficiently. This naive estimator is actually statistically suboptimal and further power iterations can lead to a minimax optimal estimator, see Richard and Montanari [2014], Zhang and Xia [2017], Hopkins et al. [2015], Liu et al. [2017] and references therein. Another intriguing phenomenon is on the signal-to-noise ratio (SNR) exhibiting distinct computational and statistical phase transitions, which do not exist for matrices. In particular, there is a gap on SNR between statistical optimality and computational optimality for HOSVD, see Zhang and Xia [2017]. For introductory simplicity ∗ , we consider the third-order tensors where an unknown tensor A ∈ Rd×d×d with multilinear ranks (r, r, r) is planted in a noisy observation Y with Y = A + Z ∈ Rd×d×d ∗ Results of this paper cover the general case where A is d1 × d2 × d3 with multilinear ranks (r1 , r2 , r3 ), and can be easily generalized to higher order tensors. 2 with Z(i, j, k) ∼ N (0, σ 2 ) being i.i.d. for i, j, k ∈ [d] and [d] := {1, . . . , d}. The signal strength Λ(A) is defined as the smallest nonzero singular values of matricizations of A, see definitions in Section 3.3. Let U, V, W ∈ Rd×r denote the singular vectors of A in the corresponding dimensions. It was proved (see Zhang and Xia [2017] and Liu et al. [2017]) that if the signal strength Λ(A) ≥ D1 σd3/4 for a large enough constant D1 > 0, the following bound holds r −1/2 max n bU b > − UU> U bV b > − VV> , V `2 cW c > − WW> , W `2 o `2  = Op  σd1/2 σd3/2 , + Λ(A) Λ2 (A) b V, b W c represent the naive SVD obtained from noisy tensor Y and k · k` denotes the where U, 2 Euclidean norm. Power iterations (also called higher order orthogonal iterations, see De Lathauwer e V, e W) f to et al. [2000a]) can improve the estimate (denoted by U, r −1/2 max n eU e > − UU> U eV e > − VV> , V `2 fW f > − WW> , W `2 o `2  = Op  σd1/2 , Λ(A) (1.1) which is minimax optimal (see Zhang and Xia [2017]). Moreover, it is demonstrated in Zhang and  Xia [2017] via an assumption on hypergraphical planted clique detection that if Λ(A) = o σd3/4 , then all polynomial time algorithms produce trivial estimates of U, V, W. This paper is focused on the estimation of linear forms of tensor singular vectors. More specifi cally, consider singular vectors U = u1 , . . . , ur ∈ Rd×r and our goal is to estimate huj , xi for fixed x ∈ Rd and j = 1, . . . , r. By choosing x over the canonical basis vectors in Rd , we end up with an estimation of uj whose componentwise perturbation bound can be atttained. Unlike the `2 -norm perturbation bound, the `∞ bound can characterize the entrywise sign consistency and entrywise significance (i.e. entrywise magnitude) of singular vectors. The componentwise signs of singular vectors have been utilized in numerous applications, such as community detection (see Florescu and Perkins [2015], Newman [2004], Mitra [2009] and Jin [2015]). The entrywise significance is useful in submatrix localizations, see Cai et al. [2015], Ma and Wu [2015] and references therein. We show in Section 4 that `∞ bounds require a weaker condition than `2 bounds to guarantee exact clustering in high dimensions. Furthermore, it enables us to construct a low rank estimator of A with a sharp 3 b − Ak` . To the best of our knowledge, ours is the first result concerning the low bound on kA ∞ rank tensor denoising with sharp `∞ bound. To better present our results, we consider orthogonal decomposable third order tensors with A= r X  λk uk ⊗ vk ⊗ wk , λ1 ≥ . . . ≥ λr > 0 k=1 where U = (u1 , . . . , ur ), V = (v1 , . . . , vr ) and W = (w1 , . . . , wr ) are d × r orthonormal matri   ces. The k-th eigengap is written as ḡk M1 (A) = ḡk M2 (A) = ḡk M3 (A) = min λk−1 −   λk , λk − λk+1 where we preset λ0 = +∞ and λr+1 = 0. We show that if ḡk M1 (A)M> 1 (A) ≥  D1 σλ1 d1/2 + σ 2 d3/2 , the following bound holds for any x ∈ Rd ,  hb uk , xi − (1 + bk )1/2 huk , xi = Op kxk`2 λ1 σ + dσ 2  ḡk M1 (A)M> 1 (A)   = Op  kxk`2 . d1/2 where bk ∈ [−1/2, 0] is an absolute constant which does not depend on x. If r = 1 (rank one spiked tensor PCA model, see Richard and Montanari [2014]) such that  Λ(A) = ḡ1 M1 (A) = λ1 , we get 1/2 hb u1 , xi − (1 + b1 )  hu1 , xi = Op  σ2d σ + kxk`2 . Λ(A) Λ2 (A) By taking x over the canonical basis vectors in Rd , the above fact implies that b 1 − (1 + b1 ) u 1/2 u1 `∞ = Op   log d 1/2 d under the eigengap condition λ1 ≥ D1 σd3/4 which is a standard requirement in tensor PCA † . b is constructed under the same conditions such that Moreover, a low rank estimator (denoted by A) b − Ak` = Op kA ∞  2 σ d λ1 +σ  ku1 k`∞ kv1 k`∞ + ku1 k`∞ kw1 k`∞ + kv1 k`∞ kw1 k`∞ †   We shall point out that a similar result on matrix SVD has appeared in Koltchinskii and Xia [2016] which is suboptimal for tensors. Indeed, the result in Koltchinskii and Xia [2016] is established under the eigengap condition λ1 ≥ D1 σd. 4  implying that the `∞ bound is determined by the coherence max ku1 k`∞ , kv1 k`∞ , kw1 k`∞ . Our main contribution is on the theoretical front. The HOSVD is essentially the standard SVD computed on an unbalanced matrix where the column size is much larger than the row size. The perturbation tools such as Wedin’s sin Θ theorem (Wedin [1972]) characterize the `2 bounds through the larger dimension, even when the left singular space lies in a low dimensional space. At the high level, the HOSVD is connected to the one-sided spectral analysis, see Wang [2015], Cai and Zhang [2016] and references therein, which provide sharp perturbation bounds in `2 -norm. There are recent bounds (see Fan et al. [2016] and Cape et al. [2017]) in `∞ -norm developed under additional constraint (incoherent singular spaces) and structural noise (sparse noise). To obtain a sharp `∞ -norm bound, we borrow the instruments invented by Koltchinskii and Lounici [2016] and extensively applied in Koltchinskii and Xia [2016]. Our framework is built upon a second order method of estimating the singular subspaces, which improves the eigengap requirement than the first order method. Similar techniques have been proposed for solving tensor completion (Xia and Yuan [2017]) and tensor PCA (Liu et al. [2017]). The success of this seemingly natural treatment hinges upon delicate dealing with the correlations among higher order terms. We benefit from these `∞ -norm spectral bound by proposing a low rank estimator for tensor denoising such that entrywise perturbation is guaranteed through the tensor incoherence. We organize our paper as follows. Tensor notations and preliminaries on HOSVD are explained in Section 2. Our main theoretical contributions are presented in Section 3 which includes the `∞ -norm bound on singular vector perturbation and the accuracy of a low rank tensor denoising estimator. In Section 4, we apply our theoretical results on applications including high dimensional clustering and sub-tensor localizations to manifest the advantages of utilizing `∞ bounds. The proofs are provided in Section 5. 5 2 Preliminaries on Tensor and HOSVD 2.1 Notations We first review some notations which will be used through the paper. We use boldfaced upper-case letters to denote tensors or matrices, and use the same letter in normal font with indices to denote its entries. We use boldfaced lower-case letters to represent vectors, and the same letter in normal font with indices to represent its entries. For notationaly simplicity, our main context is focused on third-order tensors, while our results can be easily generalized to higher order tensors. Given a third-order tensor A ∈ Rd1 ×d2 ×d3 , define a linear mapping M1 : Rd1 ×d2 ×d3 7→ Rd1 ×(d2 d3 ) such that  M1 (A) i1 , (i2 − 1)d3 + i3 = A(i1 , i2 , i3 ), i1 ∈ [d1 ], i2 ∈ [d3 ], i3 ∈ [d3 ] which is conventionally called the unfolding (or matricization) of tensor A. The columns of matrix M1 (A) are called the mode-1 fibers of A. The corresponding matricizations M2 (A) and M3 (A) can be defined through a similar fashion. The multilinear ranks of A are then defined by:  r1 (A) := rank M1 (A) ,  r2 (A) := rank M2 (A) , r3 (A) := rank M3 (A)  Note that r1 (A), r2 (A), r3 (A) are unnecessarily equal with each other in general. We write r(A) :=  r1 (A), r2 (A), r3 (A) . The marginal product ×1 : Rr1 ×r2 ×r3 × Rd1 ×r1 7→ Rd1 ×r2 ×r3 is given by C ×1 U = X r1  C(j1 , j2 , j3 )U (i1 , j1 ) , i1 ∈[d1 ],j2 ∈[r2 ],j3 ∈[r3 ] j1 =1 and ×2 and ×3 are defined similarly. Therefore, we write the mutilinear product of tensors C ∈ Rr1 ×r2 ×r3 , U ∈ Rd1 ×r1 , V ∈ Rd2 ×r2 and W ∈ Rd3 ×r3 as C · (U, V, W) = C ×1 U ×2 V ×3 W ∈ Rd1 ×d2 ×d3 . 6 We use k · k to denote the operator norm of matrices and k · k`2 and k · k`∞ to denote `2 and `∞ norms of vectors, or vectorized matrices and tensors. 2.2 HOSVD and Eigengaps  For a tensor A ∈ Rd1 ×d2 ×d3 with multilinear ranks r(A) = r1 (A), r2 (A), r3 (A) , let U ∈ Rd1 ×r1 (A) , V ∈ Rd2 ×r2 (A) and W ∈ Rd3 ×r3 (A) be the left singular vectors of M1 (A), M2 (A) and M3 (A) respectively, which can be computed efficiently via matricization followed by thin singular value decomposition. The higher order singular value decomposition (HOSVD) refers to the decomposition A = C ×1 U ×2 V ×3 W (2.1) where the r1 (A) × r2 (A) × r3 (A) core tensor C is obtained by C := A ×1 U> ×2 V> ×3 W> . Suppose that a noisy version of A is observed: Y =A+Z where Z ∈ Rd1 ×d2 ×d3 is a noise tensor with i.i.d. entries satisfying Z(i, j, k) ∼ N (0, σ 2 ). By observing Y, the goal is to estimate U, V and W. An immediate solution is to compute HOSVD b ∈ Rd1 ×r1 , V b ∈ Rd2 ×r2 , W c ∈ Rd3 ×r3 be the corresponding top singular of Y. To this end, let U b V b vectors of M1 (Y), M2 (Y) and M3 (Y). The key factor characterizing the perturbation of U, c is the so-called eigengap. and W b is essentially via matrix SVD on M1 (A). It suffices to consider Observe that the computing of U eigengaps for matrices. Given a rank r matrix M ∈ Rm1 ×m2 with SVD: M= r X λk gk ⊗ hk  k=1 where singular values λ1 ≥ λ2 ≥ . . . ≥ λr > 0 and {g1 , . . . , gr } are the corresponding left singular vectors and {h1 , . . . , hr } are its corresponding right singular vectors. Introduce further λ0 = +∞ 7 and λr+1 = 0. The k-th eigengap of matrix M is then defined by  ḡk (M) := min λk − λk+1 , λk−1 − λk , ∀ 1 ≤ k ≤ r. b ∈ Rd1 ×r1 are the top-r1 left singular vectors of M1 (A) and M1 (Y) respectively. Recall that U, U By Wedin’s sin Θ theorem (Wedin [1972]), bU b > − UU> k = O kU  ḡr1  kM1 (Z)k  , M1 (A)M> 1 (A) which is generally suboptimal especially when M1 (Z) ∈ Rd1 ×(d2 d3 ) is unbalanced such that d2 d3  d1 . Sharper bounds in `2 -norm concerning one sided perturbation have been derived in Wang [2015] and Cai and Zhang [2016]. In this paper, we focus on the perturbation bound in `∞ -norm. To this   b = u b1, . . . , u b r . We are interested in the perturbation of linear end, write U = u1 , . . . , ur and U b and W. c forms hb uk , xi for x ∈ Rd1 . Similar results can be obtained for singular vectors V 3 Main Results 3.1 Second Order Spectral Analysis The `∞ -norm spectral perturbation for balanced matrices has been developed in Koltchinskii and b k denotes the k-th Xia [2016]. Recall that uk denotes the k-th left singular vector of M1 (A) and u left singular vector of M1 (Y) where M1 (A) is of size d1 × (d2 d3 ). The operator norm kM1 (Z)k is determined by the larger dimension (d1 ∨ d2 d3 ), see Section 5. It turns out that the machinery in Koltchinskii and Xia [2016] is suboptimal meaning that the eigengap requirement becomes  1/2 , which shall be unnecessarily strong in view of the recent ḡk M1 (A)M> 1 (A) ≥ D1 σ d1 ∨ d2 d3 results in Cai and Zhang [2016], Zhang and Xia [2017] and Liu et al. [2017]. b Basically, the top left singular In this paper, we conduct a second order spectral analysis for U. vectors of M1 (Y) are also the top eigenvectors of M1 (Y)M> 1 (Y). The second order method seeks 8 the spectral perturbation on M1 (Y)M> 1 (Y) instead of on M1 (Y). Clearly, > d1 ×d1 M1 (Y)M> 1 (Y) = M1 (A)M1 (A) + Γ ∈ R > > where Γ = M1 (A)M> 1 (Z) + M1 (Z)M1 (A) + M1 (Z)M1 (Z). Note that U are the leading eigen> b vectors of M1 (A)M> 1 (A) and U are the top-r1 eigenvectors of M1 (Y)M1 (Y). Moreover, the following fact is obvious:    2 ḡr1 M1 (A)M> 1 (A) ≥ ḡr1 M1 (A) . The advantage of our method comes from the observation that even though E M1 (Z)M> 1 (Z) is 2 of the order σ 2 (d1 ∨ d2 d3 ), the symmetric matrix M1 (Z)M> 1 (Z) is concentrated at d2 d3 σ Id1 such that (see more details in Section 5)  1/2  2 2 M1 (Z)M> (Z) − σ d d I = O σ d d d . 2 3 d1 p 1 2 3 1 Note that subtracting by an identity matrix does not change the eigen-structure. The second order method introduces the additional term M1 (A)M> 1 (Z) whose operator norm is bounded by √ D1 σ d1 M1 (A) with high probability, which creates a constraint on the condition number of M1 (A). Moreover, in order to characterize a sharp perturbation bound of linear forms hb uk , xi, we need to pay more attention to dealing with correlations among the higher order terms than the first order method in Koltchinskii and Xia [2016]. 3.2 Perturbation of Linear Forms of Singular Vectors In this section, we present our main theorem characterizing the perturbation of linear forms hb uk , xi b k is the k-th left singular vector of M1 (Y). Our results have similar for any x ∈ Rd1 , where u implications as the previous work Koltchinskii and Xia [2016], meaning that the bias Eb uk − uk is well aligned with uk . Therefore, by correcting the bias term, we are able to obtain a sharper estimation of linear forms huk , xi. To this end, denote the condition number of the matrix M1 (A) 9 by  λmax M1 (A)  κ M1 (A) = λmin M1 (A)  where λmax (·) and λmin (·) return the largest and smallest nonzero singular values. 1/2 Theorem 1. Let M := M1 (A) and δ(d1 , d2 , d3 ) = σd1 kMk+σ 2 (d1 d2 d3 )1/2 and suppose d2 d3 e−d1 /2 ≤  1. There exist absolute constants D1 , D2 > 0 such that the following fact holds. If ḡk MM> ≥ D1 δ(d1 , d2 , d3 ), there exist a constant bk ∈ [−1/2, 0] which depends only on σ and A such that for any x, the following bound holds with probability at least 1 − e−t , 1/2 hb uk , xi − (1 + bk )   2 1/2 σ 2 d1  δ(d1 , d2 , d3 )  1/2 σkMk + σ (d2 d3 ) huk , xi ≤ D2 t + kxk`2 ḡk (MM> ) ḡk (MM> ) ḡk (MM> ) for all log 8 ≤ t ≤ d1 .  It is easy to check that the condition ḡk M1 (A)M> 1 (A) ≥ D1 δ(d1 , d2 , d3 ) holds whenever    1/2 ḡk M1 (A) ≥ D1 σ(d1 d2 d3 )1/4 + σd1 κ M1 (A) .  If κ M1 (A) ≤  d2 d3 1/4 , d1  the above bound becomes ḡk M1 (A) ≥ D1 σ(d1 d2 d3 )1/4 which is a standard requirement in tensor SVD or PCA, see Zhang and Xia [2017], Hopkins et al. [2015] and Richard and Montanari [2014]. By taking x over the standard basis vectors in Rd1 and choosing bk . t ≥ D3 log1/2 d1 , we end up with a `∞ -norm perturbation bound for empirical singular vector u Corollary 1. Under the conditions in Theorem 1, there exists a universal constant D1 > 0 such that the following bound holds with probability at least 1 − 1/2 b k − (1 + bk ) u uk `∞ ≤ D1 1 d1 ,  log d 1/2 1 d1  d 1/2  1 + . d2 d3 If d1  d2  d3  d, we obtain  b k − (1 + bk )1/2 uk P u `∞ 10 ≥ D1  log d 1/2  d ≤ 1 d which has an analogous form to the perturbation bound in Koltchinskii and Xia [2016] implying a famous delocalization phenomenon in random matrix theory, see Rudelson et al. [2015] and Vu and Wang [2015] and references therein. The bias bk is usually unknown and we borrow the idea in Koltchinskii and Xia [2016] to estimate bk based on two independent samples. Suppose that two independent noisy version of A ∈ Rd1 ×d2 ×d3 are observed with Y(1) = A+Z(1) and Y(2) = A + Z(2) where Z(1) and Z(2) have i.i.d. centered Gaussian entries with variance σ 2 .   (1) (2) b k and u b k denote the k-th left singular vector of M1 Y(1) and M1 Y(2) respectively. The Let u (1) (2) (1) (2) b k and u b k are chosen such that hb b k i ≥ 0. Define the estimator of bk by signs of u uk , u (1) (2) bbk := hb b k i − 1. uk , u e k := Define the scaled version of empirical singular vector u bk u (1+b bk )1/2 , which is not necessarily a unit vector. Theorem 2. Under the assumptions in Theorem 1, there exists an absolute constant D1 > 0 such that for any x ∈ Rd1 , the follow bound holds with probability at least 1 − e−t for all t ≥ 0,   2 1/2 σ 2 d1  δ(d1 , d2 , d3 )  bbk − bk ≤ D1 t1/2 σkMk + σ (d2 d3 ) + ḡk (MM> ) ḡk (MM> ) ḡk (MM> ) and e k − uk , x u   2 1/2 σ 2 d1  δ(d1 , d2 , d3 )  1/2 σkMk + σ (d2 d3 ) ≤ D1 t + kxk`2 ḡk (MM> ) ḡk (MM> ) ḡk (MM> ) where M = M1 (A). Remark 1. If d/2 ≤ mink dk ≤ maxk dk ≤ 2d, we get   log d 1/2  1 P ke uk − uk k`∞ ≥ D1 ≤ . d d   1/2 d σ 2 d log1/2 d Moreover, if rank(A) = (1, 1, 1), we can write ke u1 − u1 k`∞ = Op σ log + where 2 Λ(A) Λ (A)  1/2   σ 2 d3/2 u1 − u1 k`2 = Op σd Λ(A) = λmin M1 (A) . Note that ke Λ(A) + Λ2 (A) , see Zhang and Xia [2017]. 11 3.3 Low Rank Tensor Denoising `∞ Bound e = (ũ1 , . . . , ũr ) ∈ In this section, we consider low rank estimate of A through projection of Y. Let U 1 e ∈ Rd1 ×r1 be scaled singular vectors each of which is computed as in Theorem 2. Similarly, let V f ∈ Rd3 ×r3 be the corresponding scaled singular vectors computed from M2 (Y) and Rd2 ×r2 and W M3 (Y). Define the low rank estimate e := Y ×1 P e ×2 P e ×3 P f A U V W e e> e where PU e represents the scaled projector PU e := UU . Clearly, rank(A) = (r1 , r2 , r3 ) which serves e namely, the upper bound as a low rank estimate of A. We characterize the entrywise accuracy of A, e − Ak` in terms of the coherence of U, V and W. Our kA e − Ak` bound relies on the of kA ∞ ∞ simultaneous `∞ -norm perturbation bounds on ũk , ṽk , w̃k . We shall need the following conditions on the eigengaps: for a large enough constant D1 > 0,    1/2 2 1/2 , ḡk M1 (A)M> 1 (A) ≥ D1 σd1 Λ(A) + σ (d1 d2 d3 ) 1 ≤ k ≤ r1 , (3.1)    1/2 2 1/2 ḡk M2 (A)M> (A) ≥ D σd , Λ(A) + σ (d d d ) 1 1 2 3 2 2 1 ≤ k ≤ r2 , (3.2)    1/2 2 1/2 ḡk M3 (A)M> , (A) ≥ D σd Λ(A) + σ (d d d ) 1 1 2 3 3 3 1 ≤ k ≤ r3 , (3.3) where     Λ(A) := max λmax M1 (A) , λmax M2 (A) , λmax M3 (A) . Similarly, define n   o Λ(A) := min λmin M1 (A) , λmin M2 (A) , λmin M3 (A) and the overall eigengap   1/2  1/2  1/2 > > ḡmin A := min ḡk1 M1 (A)M> 1 (A) , ḡk2 M2 (A)M2 (A) , ḡk3 M3 (A)M3 (A)  12  , 1 ≤ k1 ≤ r1 , 1 ≤ k2 ≤ r2 , 1 ≤ k3 ≤ r3 .  By definition, it is clear that Λ(A) ≥ ḡmin (A). Observe that kY−Ak`∞ = Op σ log1/2 (d1 ∨d2 ∨d3 ) . e j, k) e j, k) − A(i, j, k) ≥ D1 σ log1/2 (d1 ∨ d2 ∨ d3 ), it is reasonable to reset A(i, Therefore, if A(i, to Y (i, j, k), although it could ruin the low rank structure. To this end, define the thresholding estimator b = Sτ,Y (A) e ∈ Rd1 ×d2 ×d3 A such that for all i ∈ [d1 ], j ∈ [d2 ], k ∈ [d3 ],   b j, k) = 1 |A(i, e j, k) − Y (i, j, k)| ≤ τ A(i, e j, k) + 1 |A(i, e j, k) − Y (i, j, k)| > τ Y (i, j, k). A(i, Theorem 3. Suppose conditions (3.1) (3.2) (3.3) hold and assume that for all i ∈ [d1 ], j ∈ [d2 ], k ∈ [d3 ], r > kU ei k`2 ≤ µU r1 , d1 r > kV ej k`2 ≤ µV for some constants µU , µV , µW ≥ 0. Suppose that r 2 d 2 r2 , d2 > kW ek k`2 ≤ µW r r3 d3 ≤ min1≤k≤3 dk ≤ max1≤k≤3 dk ≤ 2d and b =S e ≤ min1≤k≤3 rk ≤ max1≤k≤3 rk ≤ 2r. Let A 6 log1/2 d,Y (A). There exists an absolute constant D2 > 0 such that, with probability at least 1 − d1 ,  b −A A `∞ ≤ D2 min σr 3  κ e(A)σ κ e2 (A) + ḡmin (A) d   µU µV + µU µW + µV µW log3/2 d  , σ log1/2 d , where κ e(A) = Λ(A)/ḡmin (A). Remark 2. To highlight the contribution of Theorem 3, let r = O(1) and κ e(A) = O(1). Note that the coherence constants 1 ≤ µU , µV , µW ≤ d1/2 . Even for almost spiked tensor such that 13 µU = µV = µW = d(1−ε)/2 , we obtain b − Ak` = Op kA ∞   σ 2 d1−ε σ  3/2 + log d . ḡmin (A) d  It worths to point out that the minimax optimal bound of estimating A in `2 -norm is O σd1/2 , see Zhang and Xia [2017]. Theorem 3 is more interesting when A is incoherent such that µU , µV , µW = O(1). We conclude that b − Ak` = Op kA ∞ 4   σ2 σ  3/2 + log d . ḡmin (A) d Applications 4.1 High dimensional clustering Many statistical and machine learning tasks are associated with clustering high dimensional data, see McCallum et al. [2000], Parsons et al. [2004], Fan and Fan [2008], Hastie et al. [2009], Friedman [1989] and references therein. We consider a two-class Gaussian mixture model such that each data point yi ∈ Rp can be represented by yi = −`i β + (1 − `i )β + εi ∈ Rp where the associated label `i ∈ {0, 1} for i = 1, 2, . . . , n is unknown and the noise vector εi ∼ N (0, Ip ). The vector β ∈ Rp is unknown with p  n. Given the data matrix Y = y1 , . . . , y n > ∈ Rn×p ,  the goal is to conduct bi-clustering. Let nk := Card {1 ≤ i ≤ n : `i = k} for k = 0, 1 such that n0 + n1 = n. Observe that EY has rank 1 and its leading left singular vector u ∈ Rn with u(i) = 1 − `i `i − 1/2 , 1/2 n n 14 1 ≤ i ≤ n. The signs of u immediately produce the cluster membership. Moreover, the leading singular value b denotes the leading left singular vector of Y. By Corollary 1, if of EY is n1/2 kβk`2 . Let u  kβk`2 ≥ D1 1 ∨ (p/n)1/4 such that |(1 + bk )−1/2 − 1| ≤ 1/2, then  P b − (1 + bk ) u 1/2 u `∞ ≤ D2  1 (p/n)1/2  1 + + kβk`2 kβk2`2 kβk2`2 r log n  n  ≥1− 1 . n  1/4  On this event, if kβk`2 ≥ D1 n1/6 ∨ (np)1/16 ∨ p log(n)/n kb u − uk`∞ ≤ kb u − (1 + bk )1/2 uk`∞ + (1 + bk )−1/2 − 1 kuk`∞ ≤ kb u − (1 + bk )1/2 uk`∞ + 3 1 ≤ 1/2 1/2 2n 4n   implying that if `i = `j , then sign u b(i) = sign u b(j) for all 1 ≤ i, j ≤ n. Therefore, in order to guarantee exact clustering, the `∞ bound requires  1/4  kβk`2 ≥ D1 n1/6 ∨ (np)1/16 ∨ p log(n)/n , while the `2 bound in Cai and Zhang [2016] requires  kβk`2 ≥ D1 n1/2 ∨ (np)1/4 ∨ (p/n)1/4 . 4.2 Subtensor localization In gene expression association analysis (see Hore et al. [2016], Xiong et al. [2012], Kolar et al. [2011] and Ben-Dor et al. [2003]) and planted clique detection (see Brubaker and Vempala [2009], Anandkumar et al. [2013] and Gauvin et al. [2014]), the goal is equivalent to localizing a sub-tensor whose entries are statistically more significant than the others. One simple model characterizing this type of tensor data is as Y = λ1C1 ⊗ 1C2 ⊗ 1C3 + Z ∈ Rd1 ×d2 ×d3 15 with Ck ⊂ [dk ] for k = 1, 2, 3. The vector 1Ck ∈ Rpk is a zero-or-one vector whose entry equals 1 only when the index belongs to Ck . The noise tensor Z has i.i.d. entries such that Z(i, j, k) ∼ N (0, 1). Given the noisy observation of Y, the goal is to localize the unknown subsets C1 , C2 and C3 . The appealing scenario is λ = O(1). The tensor EY has rank 1 with leading singular value λ|C1 |1/2 |C2 |1/2 |C3 |1/2 and corresponding singular vectors u= 1 1C , |C1 |1/2 1 v= 1 1C |C2 |1/2 2 and w = 1 1C , |C3 |1/2 3 where |C| denotes the cardinality of C. By Theorem 1, if λ ≥ D1 |C enough constant D1 > 0, then with probability at least 1 − 1 dmax 1| (d1 d2 d3 )1/4 1/2 |C |1/2 |C |1/2 2 3 for a large where dmax := (d1 ∨ d2 ∨ d3 ) and we assume dmax ≤ D1 (d1 d2 d3 )1/2 , kb u − (1 + b1 ) 1/2 uk`∞   D1 D1 d1 (d1 d2 d3 )1/2 D1 (d2 d3 )1/2 ≤ + . + λ|C1 |1/2 |C2 |1/2 |C3 |1/2 λ2 |C1 ||C2 ||C3 | λ2 |C1 ||C2 ||C3 | λ2 |C1 ||C2 ||C3 |   d 1/2  1 1 ≤ D1 1/2 + . d2 d3 d1 b1 denote the locations of entries of u b whose magnitudes are among the |C1 | largest, it If we let C b1 = C1 on the above event if D2 |C1 |d1 ≤ d2 d3 for a large enough is straightforward to show that C constant D2 > 0. 5 Proofs For notational brevity, we write A . B if there exists an absolute constant D1 such that A ≤ D1 B. A similar notation would be & and A  B means that A . B and A & B simultaneously. If the constant D1 depends on some parameter γ, we shall write .γ , &γ and γ . Recall that the HOSVD is translated directly from SVD on M1 (A) and the matrix perturbation model M1 (Y) = M1 (A) + M1 (Z). Without loss of generality, it suffices to focus on matrices with unbalanced sizes. In the remaining context, we write A, Z, Y ∈ Rm1 ×m2 instead of M1 (A), M1 (Z), M1 (Y) ∈ Rm1 ×m2 , where m1 = d1 and m2 = d2 d3 such that m1 . m2 . The 16 second order spectral analysis begins with YY> = AA> + Γ, where Γ = AZ> + ZA> + ZZ> . Suppose that A has the thin singular value decomposition A= r1 X  λk uk ⊗ hk ∈ Rm1 ×m2 k=1  where {h1 , . . . , hr1 } ⊂ span vj ⊗ wk> : j ∈ [r2 ], k ∈ [r3 ] are the right singular vectors of A. Moreover, AA> admits the eigen-decomposition: > AA = r1 X  λ2k uk ⊗ uk . k=1 In an identical fashion, denote the eigen-decomposition of YY> by YY> = m1 X  b2 u bk . λ k bk ⊗ u k=1 Even though Theorem 1 and Theorem 2 are stated when the singular value λk has multiplicity 1, we present more general results in this section. Note that when there are repeated singular values, the singular vectors are not uniquely defined. In this case, let µ1 > µ2 > . . . > µs > 0 be distinct singular values of A with s ≤ r1 . Denote ∆k := {j : λj = µk } for 1 ≤ k ≤ s and νk := Card(∆k ) the multiplicity of µk . Let µs+1 = 0 which is a trivial eigenvalue of AA> with multiplicity m1 − r1 . Then, the spectral decomposition of AA> can be represented as AA> = s+1 X µ2k Puu k k=1 where the spectral projector Puu k := P j∈∆k uj ⊗ uj which is uniquely defined. Correspondingly, 17 define the empirical spectral projector based on eigen-decomposition of YY> , b uu := P k X bj ⊗ u bj . u j∈∆k b uu x, y for x, y ∈ Rm1 . Observe that We develop a sharp concentration bound for bilinear forms P k b := Γ − m2 σ 2 Im and the spectral YY> has an identical eigen-space as YY> − m2 σ 2 Im1 . Let Γ 1 b analysis shall be realized on AA> + Γ. Several preliminary facts are introduced as follows. It is clear that the k-th eigengap is   ḡk AA> := min µ2k−1 − µ2k , µ2k − µ2k+1 for 1 ≤ k ≤ s, where we set µ0 = +∞. The proof of Lemma 1 is provided in the Appendix. Lemma 1. For any deterministic matrix B ∈ Rm3 ×m2 , the following bounds hold   1/2 1/2 EkBZ> k . σkBk m1 + m3 + (m1 m3 )1/4 (5.1) EZZ> − m2 σ 2 Im1 . σ 2 (m1 m2 )1/2 . For any t > 0, the following inequalities hold with probability at least 1 − e−t ,   1/2 1/2 kBZ> k . σkBk m1 + m3 + (m1 m3 )1/4 + t1/2 + (m1 t)1/4 1/2 ZZ> − m2 σ 2 Im1 . σ 2 m2 5.1 1/2 m1 Proof of Theorem 1 To this end, define Cuu k := X µ2 s6=k s 1 Puu − µ2k s and Phh k := X j∈∆k 18 hj ⊗ hj .  + t1/2 . (5.2) Theorem 1 is decomposed of two separate components. Theorem 4 provides the concentration bound for hPk x, yi − EhPk x, yi by Gaussian isoperimetric inequality and the proof is postponed b uu − Puu . to the Appendix. In Theorem 5, we characterize the bias EP k k  1/2 Theorem 4. Let δ(m1 , m2 ) := µ1 σm1 +σ 2 (m1 m2 )1/2 and suppose that ḡk AA> ≥ D1 δ(m1 , m2 ) for a large enough constant D1 > 0. Then, for any x, y ∈ Rm1 , there exists an absolute constant D2 > 0 such that for all log 8 ≤ t . m1 , the following bound holds with probability at least 1 − e−t ,   2 1/2 uu uu 1/2 σµ1 + σ m2 b b hPk x, yi − EhPk x, yi ≤ D2 t kxk`2 kyk`2 . ḡk AA>  1/2 Theorem 5. Let δ(m1 , m2 ) := µ1 σm1 +σ 2 (m1 m2 )1/2 and suppose that ḡk AA> ≥ D1 δ(m1 , m2 ) for a large enough constant D1 > 0 and m2 e−m1 /2 ≤ 1. Then there exists an absolute constant D2 > 0 such that 2 2 1/2  b uu − Puu Puu ≤ D2 νk σ m1 + σ m2 + σµ1 b uu − Puu − Puu EP EP k k k k k k ḡk AA>   δ(m1 , m2 )  . ḡk AA> b uu in Lemma 3 that Proof of Theorem 5. Recall the representation formula of P k b b uu = Puu + ESk (Γ) EP k k b := AZ> + ZA> + ZZ> − m2 σ 2 Im . To this end, define where Γ 1 e := Γ b − ZPhh Z> − νk σ 2 Im Γ 1 k    b uu = Puu + ESk (Γ) e + ESk (Γ) b − ESk (Γ) e . We derive an upper bound such that we can write EP k k e − ESk (Γ) b and the proof can be found in the Appendix. Lemma 2 implies that our on ESk (Γ) b with Γ. e analysis can be proceeded by replacing Γ 19 Lemma 2. There exists a universal constant D1 > 0 such that if m2 e−m1 /2 ≤ 1, then 2 e − ESk (Γ) b ≤ D1 σµ1 + σ m1 ESk (Γ) ḡk (AA> )   δ(m1 , m2 ) . ḡk (AA> ) 1/2 b + D1 σµ1 t1/2 + D2 σ 2 m t1/2 for 0 < t ≤ m1 to be determined later and large Let δt = EkΓk 2  b ≥ δt ≤ e−t . We write enough constants D1 , D2 > 0 such that P kΓk b uu − Puu − Puu ESk (Γ)P e uu = ESk (Γ) b − ESk (Γ) e EP k k k k    uu ⊥ uu ⊥ uu ⊥ e e uu + (Puu )⊥ Sk (Γ)(P e e ≤ δt +E Puu S ( Γ)(P ) + (P ) S ( Γ)P ) 1 kΓk k k k k k k k k    uu ⊥ uu ⊥ uu ⊥ uu ⊥ e e uu e e > δt . 1 kΓk +E Puu k Sk (Γ)(Pk ) + (Pk ) Sk (Γ)Pk + (Pk ) Sk (Γ)(Pk )  m1 . Similar to the ⊥ e e uu We prove an upper bound for E x, (Puu k ) Sk (Γ)Pk y 1 kΓk ≤ δt for x, y ∈ R e ≤ δt , Sk (Γ) e is represented in approach in Koltchinskii and Xia [2016], under the assumption kΓk the following analytic form, e =− Sk (Γ) 1 2πi I  r X e RAA> (η)dη (−1)r RAA> (η)Γ γk r≥2 where γk is a circle on the complex plane with center µ2k and radius ḡk (AA> ) , 2 and RAA> (η) is the resolvent of the operator AA> with RAA> (η) = (AA> − ηIm1 )−1 which can be explicitly written as RAA> (η) := (AA> − ηIm1 )−1 = X s µ2s 1 Puu . −η s We also denote e AA> (η) := RAA> (η) − R X 1 1 uu P = Puu . µ2s − η s µ2k − η k s6=k It is easy to check that   ⊥ e r RAA> (η)Puu = (Puu )⊥ RAA> (η)Γ e r (Puu RAA> (η)Γ k ) k k 20 µ2k 1 Puu −η k  =  r X s−1 uu  r−s uu  1 1 e AA> (η)Γ e e RAA> (η)Γ e e AA> (η)Γ e r Puu , R Pk Γ R Pk + 2 k 2 2 (µk − η) s=2 µk − η where we used the formula (a + b)r = br + Pr s−1 a(a s=1 b + b)r−s . As a result, ⊥ e uu (Puu k ) Sk (Γ)Pk =− X r≥2 1 (−1) 2πi r I γk  r X    1 e AA> (η)Γ e s−1 Puu Γ e RAA> (η)Γ e r−s Puu R k k 2 2 (µk − η) s=2  r uu 1 e e + 2 R > (η)Γ Pk dη. µk − η AA For any x, y ∈ Rm1 , we shall derive an upper bound for D E     e AA> (η)Γ e s−1 Puu Γ e RAA> (η)Γ e ≤ δt , e r−s Puu y 1 kΓk E x, R k k uu Recall that rank(Puu k ) = νk and Pk = P j∈∆k s = 2, . . . , r. uj ⊗ uj . Then, E    e RAA> (η)Γ e r−s Puu y e AA> (η)Γ e s−1 Puu Γ x, R k k E X D    e AA> (η)Γ e s−1 uj ⊗ uj Γ e RAA> (η)Γ e r−s Puu y = x, R k D j∈∆k = X  e RAA> (η)Γ e r−s Puu y, uj Γ k  e AA> (η)Γ e s−2 R e AA> (η)Γu e j, x . R j∈∆k Observe that  e r−s+1 kyk` e RAA> (η)Γ e r−s Puu y, uj ≤ kRAA> (η)kr−s kΓk Γ k 2   (r−s) 2 e r−s+1 kyk` . kΓk ≤ 2 ḡk (AA> ) Therefore, D E      e AA> (η)Γ e s−1 Puu Γ e RAA> (η)Γ e r−s Puu y 1 kΓk e ≤ δt E x, R k k 21 (5.3) = X e RAA> (η)Γ e E Γ r−s Puu k y, uj e AA> (η)Γ e R s−1   e ≤ δt uj , x 1 kΓk j∈∆k ≤ X e RAA> (η)Γ e E1/2 Γ r−s   e Puu k y, uj 1 kΓk ≤ δt 2 j∈∆k × E1/2 ≤     e AA> (η)Γ e s−1 uj , x 1 kΓk e ≤ δt R r−s X 2δt δt kyk`2 E1/2 > ḡk (AA ) e AA> (η)Γ e R s−2 2  2 e AA> (η)Γu e j , x 1 kΓk e ≤ δt . R (5.4) j∈∆k It then remains to bound, for each j ∈ ∆k , E1/2 D  E2   e ≤ δt . e AA> (η)Γ e s−2 R e AA> (η)Γu e j , x 1 kΓk R Recall that we can write e = AZ> + ZA> + Z Γ X > 2 Phh k0 Z − σ (m2 − νk )Im1 k0 6=k and correspondingly e j = AZ> uj + ZA> uj + Z Γu X > 2 Phh k0 Z uj − σ (m2 − νk )uj . k0 6=k We write D E D E   e AA> (η)Γ e s−2 R e AA> (η)Γu e j, x = R e AA> (η)Γ e s−2 R e AA> (η)ZA> uj , x R D E  e AA> (η)Γ e s−2 R e AA> (η)AZ> uj , x + R D  X  E  > 2 e AA> (η)Γ e s−2 R e AA> (η) Z + R Phh Z u − σ (m − ν )u ,x . 0 j 2 j k k (5.5) (5.6) (5.7) k0 6=k The upper bounds of (5.5), (5.7) and (5.6) shall be obtained separately via different representations. 22 Bound of E1/2 e AA> (η)Γ e R s−2 e AA> (η)ZA> uj , x R 2   e ≤ δt . 1 kΓk Observe that A> uj = µk hj ∈ Rm2 for j ∈ ∆k such that > ZA uj = µk Zhj = µk m1 X hzi , hj iei i=1 > where {e1 , . . . , em1 } denote the canonical basis vectors in Rm1 and {z> 1 , . . . , zm1 } denote the rows of Z. Therefore,  e AA> (η)Γ e s−2 R e AA> (η)ZA> uj , x R =µk m1 X e AA> (η)Γ e hzi , hj i R s−2 e AA> (η)ei , x . R i=1 e AA> (η) = It is clear that hzi , hj i, i = 1, . . . , m1 are i.i.d. and hzi , hj i ∼ N (0, σ 2 ). Recall that R  P Puu k0 e e s−2 R e AA> (η) can be viewed as a linear combination of k0 6=k µ2 −η , implying that RAA> (η)Γ k0 operators uu e uu uu e uu e uu (Puu t1 ΓPt2 )(Pt2 ΓPt3 ) . . . (Pts−2 ΓPts−1 ) e uu where t1 , . . . , ts−1 6= k. For each Puu t1 ΓPt2 , we have uu > uu uu > uu uu e uu Puu t1 ΓPt2 = Pt1 AZ Pt2 + Pt1 ZA Pt2 + Pt1 Z X  uu > uu Pt2 − σ 2 (m2 − νk )Puu Phh t1 Pt2 . k0 Z k0 6=k > uu > uu Clearly, Puu t1 AZ is a function of random vectors Pt1 Azi , i = 1, . . . , m1 ; ZA Pt2 is a function P P hh > hh 2 > of random vectors Puu t2 Azi , i = 1, . . . , m1 ; Z k0 6=k Pk0 Z = Z k0 6=k (Pk0 ) Z is a function of random vectors Phh k0 zi , i = 1, . . . , m1 . The following facts are obvious uu 2 uu 2 uu Ehzi , hj iPuu t1 Azi = Pt1 A(Ezi ⊗ zi )hj = σ Pt1 Ahj = σ µk Pt1 uj = 0, and hh 2 hh Ehzi , hj iPhh k0 zi = Pk0 (Ezi ⊗ zi )hj = σ Pk0 hj = 0, 23 ∀k 0 6= k. ∀t1 6= k   hh Since hzi , hj i, i = 1, . . . , m1 are Gaussian random variables and Puu t1 Azi , Pk0 zi , i = 1, . . . , m1  are (complex) Gaussian random vectors, uncorrelations indicate that hzi , hj i : i = 1, . . . , m1 are   hh 0 independent with Puu t1 Azi , Pk0 zi : t1 6= k, k 6= k, i = 1, . . . , m1 . We conclude that hzi , hj i : i =   e AA> (η)Γ e s−2 R e AA> (η)ei , x , i = 1, . . . , m1 . 1, . . . , m1 are independent with R To this end, define the complex random variables ωi (x) =  e AA> (η)Γ e s−2 R e AA> (η)ei , x = ω (1) (x) + ω (2) (x)Im ∈ C, R i i i = 1, . . . , m1 where Im denotes the imaginary number. Then, e AA> (η)Γ e R s−2 e AA> (η)ZA> uj , x = µk R m1 X m1  X  (1) (2) hzi , hj iωi (x) + µk hzi , hj iωi (x) Im i=1 i=1 =: κ1 (x) + κ2 (x)Im ∈ C.  hh 0 Conditioned on Puu t1 Azi , Pk0 zi : t1 6= k, k 6= k, i = 1, . . . , m1 , we get Eκ21 (x) = µ2k σ 2 m1  X 2 (1) ωi (x) i=1 and Eκ1 (x)κ2 (x) = µ2k σ 2 m1 X (1) (2) ωi (x)ωi (x) i=1 implying that the centered Gaussian random vector (κ1 (x), κ2 (x)) has covariance matrix:   m1 X (k1 ) (k2 ) 2 2 µk σ ωi (x)ωi (x) . k1 ,k2 =1,2 i=1 Finally, E1/2  e AA> (η)Γ e s−2 R e AA> (η)ZA> uj , x R 2      e ≤ δt = E1/2 κ2 (x) + κ2 (x) 1 kΓk e ≤ δt 1 kΓk 1 2 = σµk E1/2 m1 X i=1 24 (1) ωi (x) 2  2   (2) e ≤ δt + ωi (x) 1 kΓk = σµk E1/2 m1 X   2 e ≤ δt . ωi (x) 1 kΓk i=1 Moreover, m1 X ωi (x) 2 = i=1 m1 X  e AA> (η) R e AA> (η)Γ e s−2 x, ej R 2  e AA> (η) R e AA> (η)Γ e s−2 x ≤ R 2 `2 i=1 e AA> (η)k2(s−1) kΓk e 2(s−2) kxk2 ≤ ≤ kR `2  2(s−1) 2 e 2(s−2) kxk2 . kΓk `2 ḡk (AA> ) As a result,    e ≤ δt e AA> (η)Γ e s−2 R e AA> (η)ZA> uj , x 2 1 kΓk R  2(s−1) s−2   2 2δt σµk  e 2(s−2) kxk2 1 kΓk e ≤ δt ≤ ≤ σµk E1/2 k Γk kxk`2 . ` 2 ḡk (AA> ) ḡk (AA> ) ḡk (AA> ) E1/2 Bound of E1/2  e AA> (η)AZ> uj , x e AA> (η)Γ e s−2 R R 2  e ≤ δt . 1 kΓk With a little abuse on the notations, we denote by z1 , . . . , zm2 ∈ Rm1 the corresponding columns of Z in this paragraph. Then, e AA> (η)Γ e R s−2 e AA> (η)AZ> uj , x = R m2 X hzi , uj i D e AA> (η)Γ e R s−2 E e AA> (η)Aei , x . R i=1  e AA> (η)Γ e s−2 R e AA> (η) can be represented as linear combination of operators Similarly, R    e uu Puu ΓP e uu . . . Puu ΓP e uu , Puu t1 ΓPt2 t2 t3 ts−2 ts−1 t1 , . . . , ts−1 6= k. To this end, we write uu > uu uu > uu uu e uu Puu t1 ΓPt2 = Pt1 AZ Pt2 + Pt1 ZA Pt2 + Pt1 Z X k0 6=k 25  uu > uu Phh Pt2 − σ 2 (m2 − νk )Puu t1 Pt2 . k0 Z > uu uu > uu uu Observe that Puu t1 AZ Pt2 , Pt1 ZA Pt2 and Pt1 Z P k0 6=k  > Puu are functions of random Phh t2 k0 Z uu vectors {Puu t1 zi , Pt2 zi : t1 , t2 6= k, i = 1, . . . , m2 }. Moreover,  uu 2 uu Ehzi , uj iPuu t1 zi = Pt1 Ezi ⊗ zi uj = σ Pt1 uj = 0, which implies that {hzi , uj i : i = 1, . . . , m2 } and n ∀ t1 6= k o  e AA> (η)Γ e s−2 R e AA> (η)Aei , x : i = 1, . . . , m2 R are independent. Following an identical analysis as above, we get E1/2  e AA> (η)Γ e s−2 R e AA> (η)AZ> uj , x R Bound of E1/2 D e AA> (η)Γ e R s−2 2  e ≤ δt ≤ 1 kΓk s−2 2δt σµ1  kxk`2 . ḡk (AA> ) ḡk (AA> ) E2   e AA> (η) Z P 0 Phh0 Z> uj , x 1 kΓk e ≤ δt . R k 6=k k Note that we e AA> (η)uj = 0 in (5.7). Again, let {z1 , . . . , zm } ⊂ Rm1 denote the corresponding used the fact R 2 columns of Z. We write X   > e AA> (η)Γ e s−2 R e AA> (η) Z R uj , x Phh k0 Z k0 6=k = m2 X e AA> (η)Γ e hzi , uj i R s−2 e AA> (η)Z R X  Phh k0 ei , x . k0 6=k i=1  e AA> (η)Γ e s−2 R e AA> (η)Z is a function of random vectors In a similar fashion, we show that R   uu Pt zi : t 6= k, i = 1, . . . , m2 which are independent with hzi , uj i : i = 1, . . . , m2 . Then, E1/2 D E2 X    > e AA> (η)Γ e s−2 R e AA> (η) Z e ≤δ R Phh uj , x 1 kΓk k0 Z k0 6=k e AA> (η)k2(s−1) kΓk e 2(s−2) kZ ≤ E1/2 σ 2 kR X 2 2 e Phh k0 k kxk`2 1 kΓk ≤ δt  k0 6=k 1/2 . P > where we used the fact E1/2 ( k0 6=k Phh k0 )Z 2 s−2 δt σ 2 m2  kxk`2 . ḡk (AA> ) ḡk (AA> ) 1/2 . σm2 26 from Lemma 1. Finalize the proof of Theorem. Combining the above bounds into (5.6), (5.5) and (5.7), we conclude that E1/2 e AA> (η)Γ e R s−2 2 e AA> (η)Γu e j, x R  s−2 2 1/2  2δt e ≤ δt . σ m2 + σµ1 1 kΓk kxk`2 . ḡk (AA> ) ḡk (AA> ) Continue from (5.4) and we end up with e AA> (η)Γ e E x, R s−1   e e r−s Puu y 1 kΓk e ≤ δt (Puu k Γ) RAA> (η)Γ k 1/2 .νk δt r−2 σ 2 m2 + σµ1  2δt kxk`2 kyk`2 . ḡk (AA> ) ḡk (AA> ) Plug the bounds into (5.3),  ⊥ e e uu E (Puu k ) Sk (Γ)Pk y, x 1 kΓ ≤ δt k 1/2 2 r−2 X πḡk (AA> )  2 σ 2 m2 + σµ1  2δt . (r − 1)ν δ kxk`2 kyk`2 k t 2π ḡk (AA> ) ḡk (AA> ) ḡk (AA> ) r≥2 ≤ D1 νk 1/2 r−1  X 2δt σ 2 m2 + σµ1 kxk kyk (r − 1) ` ` 2 2 ḡk (AA> ) ḡk (AA> ) r≥2 where we used the fact H γk  r e AA> (η)Γ e r Puu dη = 0. By the inequality P R r≥1 rq = k q , ∀q (1−q)2 <1 and the fact D1 δt ≤ ḡk (AA> ) for some large constant D1 > 0 and t ≤ m1 , we conclude with   2 1/2  2δt ⊥ e ≤ δt k . νk σ m2 + σµ1 e uu y, x 1 kΓ E (Puu ) S ( Γ)P kxk`2 kyk`2 , k k k ḡk (AA> ) ḡk (AA> ) ∀x, y ∈ Rm1 implying that 1/2 ⊥ e uu e E(Puu k ) Sk (Γ)Pk 1 kΓk ≤ δt  . νk  σ 2 m2 + σµ1  2δt . ḡk (AA> ) ḡk (AA> ) The same bound holds for uu ⊥ e e EPuu k Sk (Γ)(Pk ) 1 kΓk ≤ δt  and 27 ⊥ uu ⊥ e e E(Puu k ) Sk (Γ)(Pk ) 1 kΓk ≤ δt  , following the same arguments. As a result,    ⊥ uu uu ⊥ uu ⊥ uu ⊥ e uu e e e ≤ δt E (Puu 1 kΓk k ) Sk (Γ)Pk + Pk Sk (Γ)(Pk ) + (Pk ) Sk (Γ)(Pk ) 1/2 . νk  σ 2 m2 + σµ1  2δt . ḡk (AA> ) ḡk (AA> ) (5.8) e ≥ δm ) ≤ e−m1 /2 , we get By choosing t = m1 such that P(kΓk 1    uu ⊥ uu uu uu ⊥ uu ⊥ uu ⊥ e e e e > δm E (Pk ) Sk (Γ)Pk + Pk Sk (Γ)(Pk ) + (Pk ) Sk (Γ)(Pk ) 1 kΓk 1    ⊥ uu ⊥ uu ⊥ uu ⊥ e uu + Puu Sk (Γ)(P e e e > δm ≤ E (Puu ) S ( Γ)P ) + (P ) S ( Γ)(P ) 1 kΓk k k 1 k k k k k k   e e > δm ≤ E1/2 kSk (Γ)k e 2 P1/2 kΓk e > δm ≤ EkSk (Γ)k1 kΓk 1 1 2  δ   δm1 2 −m1 /2 m1 1/2 e . P k Γk > δ e , . m 1 ḡk (AA> ) ḡk (AA> ) which is clearly dominated by (5.8). Substitute the above bounds into (5.1) and we get 1/2   2 b uu − Puu − Puu Sk (Γ)P e uu ≤ kESk (Γ) e − Sk (Γ)k b + D1 νk σ m2 + σµ1 2δ(m1 , m2 ) EP k k k k ḡk (AA> ) ḡk (AA> ) 1/2 σ 2 m2 + σ 2 m1 + σµ1  2δ(m1 , m2 )  . ≤ D2 νk ḡk (AA> ) ḡk (AA> ) Proof of Theorem 1. Combining Theorem 4 and Theorem 5, we conclude that for any x, y ∈ Rm1 with probability at least 1 − e−t for all log 8 ≤ t ≤ m1 , b uu x, y − Puu x, y − Puu (EP b uu − Puu )Puu x, y P k k k k k k   1/2 2 2 σµ1 + σ m2 σ m1 δ(m1 , m2 ) . t1/2 + kxk`2 kyk`2 . > ḡk (AA ) ḡk2 (AA> ) b uu b k ⊗ u b k , we can write In the case νk = 1 such that Puu k = uk ⊗ uk and Pk = u uu uu uu b uu Puu k (EPk − Pk )Pk = bk Pk 28 where bk = Ehb uk , uk i2 − 1 ∈ [−1, 0]. b uu − Puu k . Moreover, a simple fact is bk ≤ EkP k k δ(m1 ,m2 ) . ḡk (AA> ) If ḡk (AA> ) ≥ Dδ(m1 , m2 ) for a large enough constant D > 0, we can ensure bk ∈ [−1/2, 0]. Then, with probability at least 1 − e−t ,  b uu − (1 + bk )Puu x, y P k k  . 1/2 + σ 2 m2 ḡk (AA> ) 1/2 σµ1 t  σ 2 m1 δ(m1 , m2 ) kxk`2 kyk`2 . + ḡk2 (AA> ) By choosing x = y = uk , we obtain for all log 8 ≤ t ≤ m1 ,  P 2 hb uk , uk i − (1 + bk ) & t 1/2 + σ 2 m2 ḡk (AA> ) 1/2 σµ1 σ 2 m1 δ(m1 , m2 ) + ḡk2 (AA> )  ≤ e−t . Denote this event by E1 . Observe that if the constant C > 0 is large enough and m1  m2 , we conclude that on event E1 , hb uk , uk i2 ≥ 14 . Then, on event E1 , hb uk , xi − p 1 + bk huk , xi ≤ p 1 + bk − 1 + bk |huk , xi| hb uk , uk i 1 hb uk , uk ihb uk , xi − (1 + bk )huk , xi hb uk , uk i √  uk , uk i2 |huk , xi| 1 + bk 1 + bk − hb 1 b uu − (1 + bk )Puu uk , x  √ + P = k k hb uk , uk i hb uk , uk i 1 + bk + hb uk , uk i   2 1/2 σ 2 m1 δ(m1 , m2 ) 1/2 σµ1 + σ m2 .t kxk`2 + kxk`2 , ḡk (AA> ) ḡk (AA> ) ḡk (AA> ) + which concludes the proof after replacing A with M1 (A) and µ1 with kM1 (A)k. 5.2 Proof of Corollary 1 The proof of Corollary 1 is identical to the proof of Corollary 1.5 in Koltchinskii and Xia [2016] and will be skipped here. 29 5.3 Proof of Theorem 3 e j, k) − A(i, j, k) for i ∈ [d1 ], j ∈ [d2 ], k ∈ [d3 ]. To this It suffices to prove the upper bound of A(i, end, denote by ei the i-th canonical basis vectors. Observe that D E e − A, ei ⊗ ej ⊗ ek = A ×1 P e ×2 P e ×3 P f − A, ei ⊗ ej ⊗ ek A U V W D E + Z ×1 PU × P × P , e ⊗ e ⊗ e . 2 3 i j k e e f V W  Some preliminary facts shall be concluded from Theorem 1. There exists an event E2 with P E2 ≥ 1− 1 d2 on which e e> i U−U  `2 . σΛ(A)r1/2 + σ 2 dr1/2 log1/2 d 2 (A) ḡmin and by Theorem 2 2 e > U − Ir ≤ kU e > U − Ir kF . rkU e > U − Ir k` . σΛ(A)r + σ dr log1/2 d. U 1 1 1 ∞ 2 (A) ḡmin The following decomposition is straightforward,    A · PU e , PV e , PW e − PU , PV , PW + A · PU , PV e − PV , PW f − A = A · PU   +A · PU , PV , PW e − PU , PV e − PV , PW f − PW + A · PU   +A · PU e − PV , PW e − PU , PV , PW f − PW f − PW + A · PU , PV +A · PU e − PU , PV e − PV , PW f − PW  Recall that A = C · (U, V, W) and we get D E     > > e e> A · PU (ej ⊗ ek ). e − PU , PV , PW , ei ⊗ ej ⊗ ek = ei U U U − U M1 (C) V ⊗ W Observe that     >   e U e > U − U = e> U e −U U e U + e> U U e > U − Ir e> U i i i 1 30 implying that on event E2 ,    e e> e> i U U U −U `2 e − U)> ei ≤ (U `2 e > Uk + U> U − Ir kU> ei k` kU 1 2 σΛ(A)r1/2 + σ 2 dr1/2 σΛ(A)r + σ 2 dr 1/2 > . log d + kU e k log1/2 d i `2 2 (A) 2 (A) ḡmin ḡmin . σΛ(A)r + σ 2 dr log1/2 d, 2 (A) ḡmin e > Uk ≤ kUkkUk e where we used the facts kU ≤ (1 + bk )−1/2 = O(1) and 1/2 kU> ei k`2 = UU> , ei ⊗ ei ≤ 1. Therefore, on event E2 ,  σΛ(A)r + σ 2 dr 1/2 . Λ(A) log d kV> ej k`2 kW> ek k`2 . 2 (A) ḡmin   A · PU e − PU , PV , PW , ei ⊗ ej ⊗ ek Similar bounds hold for  A · PU , PV e − PV , PW , ei ⊗ ej ⊗ ek and  A · PU , PV , PW f − PW , ei ⊗ ej ⊗ ek . Following the same method, we can show that on event E2 ,  A · PU e − PU , PV e − PV , PW , ei ⊗ ej ⊗ ek  . Λ(A) 2 σΛ(A)r + σ 2 dr 1/2 log d kW> ek k`2 2 (A) ḡmin and 3 σΛ(A)r + σ 2 dr 1/2 . Λ(A) log d . 2 (A) ḡmin   A · PU e − PU , PV e − PV , PW f − PW , ei ⊗ ej ⊗ ek We conclude that on event E2 ,  A · PU e , PV e , PW f − A, ei ⊗ ej ⊗ ek 31   σΛ(A)r + σ 2 dr 1/2 . Λ(A) log d kV> ej k`2 kW> ek k`2 2 (A) ḡmin  +kU> ei k`2 kW> ek k`2 + kU> ei k`2 kV> ej k`2  2   σΛ(A)r + σ 2 dr 1/2 > > > +Λ(A) log d kV e k + kU e k + kW e k j i `2 `2 k `2 2 (A) ḡmin 3  σΛ(A)r + σ 2 dr 1/2 log d . +Λ(A) 2 (A) ḡmin Recall that for all i ∈ [d1 ], j ∈ [d2 ], k ∈ [d3 ] > r kU ei k`2 ≤ µU r , d r > kV ej k`2 ≤ µV r , d r > kW ek k`2 ≤ µW r d and conditions (3.1) (3.2) (3.3) imply  log d 1/2 σΛ(A)r + σ 2 dr 1/2 log d . r . 2 (A) d ḡmin We end up with a simpler bound on event E2 ,  A · PU e , PV e , PW f − A, ei ⊗ ej ⊗ ek   σe κ(A) κ e2 (A) 3 (µU µV + µU µW + µV µW ) log3/2 d . σr + ḡmin (A) d (5.9) where κ e(A) = Λ(A)/ḡmin (A). Next, we prove the upper bound of Z · (PU e , PV e , PW f ), ei ⊗ ej ⊗ ek and we proceed with the same decomposition. Observe that Z · (PU , PV , PW ), ei ⊗ ej ⊗ ek = Z, (PU ei ) ⊗ (PV ej ) ⊗ (PW ek )   2 2 2 ∼ N 0, σ 2 PU ei `2 PV ej `2 PW ek `2 The standard concentration inequality of Gaussian random variables yields that with probability 32 at least 1 − 1 , d2 . σkU> ei k`2 kV> ej k`2 kW> ek k`2 log1/2 d  r 3/2 µU µV µW log1/2 d. .σ d Z · (PU , PV , PW ), ei ⊗ ej ⊗ ek 1 , d2 Similarly, with probability at least 1 −  Z · PU e − PU , PV , PW , ei ⊗ ej ⊗ ek    > > = e> e − PU M1 (Z) V ⊗ W (V ej ) ⊗ (W ek ) i PU > > ≤ k(PU e − PU )ei k`2 M1 (Z)(V ⊗ W) kV ej k`2 kW ek k`2 > > . σd1/2 k(PU e − PU )ei k`2 kV ej k`2 kW ek k`2 where we used Lemma 1 for the upper bound of M1 (Z)(V ⊗ W) . Moreover, since µU ≥ 1,  PU e − PU ei `2 e − U)ei k` + kU e − Uk` kU> ei k` ≤ k(U 2 2 2 . σΛ(A)r + σ 2 dr µU log1/2 d. 2 (A) ḡmin Denote the above event by E3 . On E2 ∩ E3 ,  Z · PU e − PU , PV , PW , ei ⊗ ej ⊗ ek σr . 1/2 d   σΛ(A)r + σ 2 dr µU µV µW log1/2 d. 2 (A) ḡmin Similar bounds can be attained for  Z · PU , PV e − PV , PW , ei ⊗ ej ⊗ ek and  Z · PU , PV , PW f − PW , ei ⊗ ej ⊗ ek . In an identical fashion, on event E2 ∩ E3 ,  Z · PU e − PU , PV e − PV , PW , ei ⊗ ej ⊗ ek . σr 33 1/2  σΛ(A)r + σ 2 dr 2 (A) ḡmin 2 µU µV µW log d. and  Z · PU e − PU , PV e − PV , PW f − PW , ei ⊗ ej ⊗ ek 3  2 1/2 σΛ(A)r + σ dr µU µV µW log3/2 d. . σd 2 (A) ḡmin Observe by conditions (3.1) (3.2) (3.3) that σΛ(A)r + σ 2 dr r . 1/2 . 2 ḡmin (A) d We conclude on event E2 ∩ E3 with  Z · PU e , PW e , PV f , ei ⊗ ej ⊗ ek σr2 . 1/2 d   σΛ(A)r + σ 2 dr µU µV µW log3/2 d. 2 (A) ḡmin (5.10) By combining (5.9) and (5.10), we get on event E2 ∩ E3 , e − A, ei ⊗ ej ⊗ ek A  σe κ(A) κ e2 (A) . σr + (µU µV + µU µW + µV µW ) log3/2 d ḡmin (A) d   σr2 σΛ(A)r + σ 2 dr µU µV µW log3/2 d + 1/2 2 (A) ḡmin d   σe κ(A) κ e2 (A) 3 . σr + (µU µV + µU µW + µV µW ) log3/2 d, ḡmin (A) d 3  √  b is where the last inequality is due to fact ḡmin (A) & σd3/4 and max µU , µV , µW . d. Since A b the bound on kA b − Ak` is obvious. an entrywise thresholding on A, ∞ References Evrim Acar and Bülent Yener. Unsupervised multiway data analysis: A literature survey. IEEE transactions on knowledge and data engineering, 21(1):6–20, 2009. Animashree Anandkumar, Rong Ge, Daniel Hsu, and Sham Kakade. A tensor spectral approach 34 to learning mixed membership community models. In Conference on Learning Theory, pages 867–881, 2013. Animashree Anandkumar, Rong Ge, Daniel Hsu, Sham M Kakade, and Matus Telgarsky. Tensor decompositions for learning latent variable models. The Journal of Machine Learning Research, 15(1):2773–2832, 2014. Amir Ben-Dor, Benny Chor, Richard Karp, and Zohar Yakhini. Discovering local structure in gene expression data: the order-preserving submatrix problem. Journal of computational biology, 10 (3-4):373–384, 2003. Göran Bergqvist and Erik G Larsson. The higher-order singular value decomposition: Theory and an application [lecture notes]. IEEE Signal Processing Magazine, 27(3):151–154, 2010. S Charles Brubaker and Santosh S Vempala. Random tensors and planted cliques. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, pages 406–419. Springer, 2009. T Tony Cai and Anru Zhang. Rate-optimal perturbation bounds for singular subspaces with applications to high-dimensional statistics. arXiv preprint arXiv:1605.00353, 2016. T Tony Cai, Tengyuan Liang, and Alexander Rakhlin. Computational and statistical boundaries for submatrix localization in a large noisy matrix. arXiv preprint arXiv:1502.01988, 2015. Joshua Cape, Minh Tang, and Carey E Priebe. The two-to-infinity norm and singular subspace geometry with applications to high-dimensional statistics. arXiv preprint arXiv:1705.10735, 2017. Arun T Chaganty and Percy Liang. Spectral experts for estimating mixtures of linear regressions. In Proceedings of the 30th International Conference on Machine Learning (ICML-13), pages 1040–1048, 2013. Jie Chen and Yousef Saad. On the tensor svd and the optimal low rank orthogonal approximation of tensors. SIAM Journal on Matrix Analysis and Applications, 30(4):1709–1734, 2009. 35 Andrzej Cichocki, Danilo Mandic, Lieven De Lathauwer, Guoxu Zhou, Qibin Zhao, Cesar Caiafa, and Huy Anh Phan. Tensor decompositions for signal processing applications: From two-way to multiway component analysis. IEEE Signal Processing Magazine, 32(2):145–163, 2015. Lieven De Lathauwer, Bart De Moor, and Joos Vandewalle. On the best rank-1 and rank-(r1, r2,..., rn) approximation of higher-order tensors. SIAM Journal on Matrix Analysis and Applications, 21(4):1324–1342, 2000a. Lieven De Lathauwer, Bart De Moor, and Joos Vandewalle. A multilinear singular value decomposition. SIAM journal on Matrix Analysis and Applications, 21(4):1253–1278, 2000b. Jianqing Fan and Yingying Fan. High dimensional classification using features annealed independence rules. Annals of statistics, 36(6):2605, 2008. Jianqing Fan, Weichen Wang, and Yiqiao Zhong. An `∞ eigenvector perturbation bound and its application to robust covariance estimation. arXiv preprint arXiv:1603.03516, 2016. Laura Florescu and Will Perkins. Spectral thresholds in the bipartite stochastic block model. arXiv preprint arXiv:1506.06737, 2015. Jerome H Friedman. Regularized discriminant analysis. Journal of the American statistical association, 84(405):165–175, 1989. Laetitia Gauvin, André Panisson, and Ciro Cattuto. Detecting the community structure and activity patterns of temporal networks: a non-negative tensor factorization approach. PloS one, 9(1):e86028, 2014. Trevor Hastie, Robert Tibshirani, and Jerome Friedman. Unsupervised learning. In The elements of statistical learning, pages 485–585. Springer, 2009. T Hildebrand and P Rüegsegger. A new method for the model-independent assessment of thickness in three-dimensional images. Journal of microscopy, 185(1):67–75, 1997. 36 Christopher J Hillar and Lek-Heng Lim. Most tensor problems are NP-hard. Journal of the ACM (JACM), 60(6):45, 2013. Samuel B Hopkins, Jonathan Shi, and David Steurer. Tensor principal component analysis via sum-of-square proofs. In COLT, pages 956–1006, 2015. Victoria Hore, Ana Viñuela, Alfonso Buil, Julian Knight, Mark I McCarthy, Kerrin Small, and Jonathan Marchini. Tensor decomposition for multiple-tissue gene expression experiments. Nature Genetics, 48(9):1094–1100, 2016. Jiashun Jin. Fast community detection by score. The Annals of Statistics, 43(1):57–89, 2015. Mladen Kolar, Sivaraman Balakrishnan, Alessandro Rinaldo, and Aarti Singh. Minimax localization of structural information in large noisy matrices. In Advances in Neural Information Processing Systems, pages 909–917, 2011. Tamara G Kolda and Brett W Bader. Tensor decompositions and applications. SIAM review, 51 (3):455–500, 2009. Vladimir Koltchinskii and Karim Lounici. Asymptotics and concentration bounds for bilinear forms of spectral projectors of sample covariance. In Annales de l’Institut Henri Poincaré, Probabilités et Statistiques, volume 52, pages 1976–2013. Institut Henri Poincaré, 2016. Vladimir Koltchinskii and Karim Lounici. Concentration inequalities and moment bounds for sample covariance operators. Bernoulli, 23(1):110–133, 2017. Vladimir Koltchinskii and Dong Xia. Perturbation of linear forms of singular vectors under gaussian noise. In High Dimensional Probability VII, pages 397–423. Springer, 2016. Nan Li and Baoxin Li. Tensor completion for on-board compression of hyperspectral images. In Image Processing (ICIP), 2010 17th IEEE International Conference on, pages 517–520. IEEE, 2010. 37 Ji Liu, Przemyslaw Musialski, Peter Wonka, and Jieping Ye. Tensor completion for estimating missing values in visual data. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(1):208–220, 2013. Tianqi Liu, Ming Yuan, and Hongyu Zhao. Characterizing spatiotemporal transcriptome of human brain via low rank tensor decomposition. arXiv preprint arXiv:1702.07449, 2017. Zongming Ma and Yihong Wu. Computational barriers in minimax submatrix detection. The Annals of Statistics, 43(3):1089–1116, 2015. Andrew McCallum, Kamal Nigam, and Lyle H Ungar. Efficient clustering of high-dimensional data sets with application to reference matching. In Proceedings of the sixth ACM SIGKDD international conference on Knowledge discovery and data mining, pages 169–178. ACM, 2000. Pradipta Mitra. Entrywise bounds for eigenvectors of random graphs. Electronic journal of combinatorics, 16(1):R131, 2009. Chaitanya Muralidhara, Andrew M Gross, Robin R Gutell, and Orly Alter. Tensor decomposition reveals concurrent evolutionary convergences and divergences and correlations with structural motifs in ribosomal rna. PloS one, 6(4):e18768, 2011. Mark EJ Newman. Detecting community structure in networks. The European Physical Journal B-Condensed Matter and Complex Systems, 38(2):321–330, 2004. Larsson Omberg, Gene H Golub, and Orly Alter. A tensor higher-order singular value decomposition for integrative analysis of DNA microarray data from different studies. Proceedings of the National Academy of Sciences, 104(47):18371–18376, 2007. Lance Parsons, Ehtesham Haque, and Huan Liu. Subspace clustering for high dimensional data: a review. Acm Sigkdd Explorations Newsletter, 6(1):90–105, 2004. Sri Priya Ponnapalli, Michael A Saunders, Charles F Van Loan, and Orly Alter. A higher-order 38 generalized singular value decomposition for comparison of global mrna expression from multiple organisms. PloS one, 6(12):e28072, 2011. Emile Richard and Andrea Montanari. A statistical model for tensor PCA. In Advances in Neural Information Processing Systems, pages 2897–2905, 2014. Mark Rudelson, Roman Vershynin, et al. Delocalization of eigenvectors of random matrices with independent entries. Duke Mathematical Journal, 164(13):2507–2538, 2015. M Vasilescu and Demetri Terzopoulos. Multilinear analysis of image ensembles: Tensorfaces. Computer Vision?ECCV 2002, pages 447–460, 2002. Roman Vershynin. Introduction to the non-asymptotic analysis of random matrices. arXiv preprint arXiv:1011.3027, 2010. Van Vu and Ke Wang. Random weighted projections, random quadratic forms and random eigenvectors. Random Structures & Algorithms, 47(4):792–821, 2015. Rongrong Wang. Singular vector perturbation under gaussian noise. SIAM Journal on Matrix Analysis and Applications, 36(1):158–177, 2015. Perke Wedin. Perturbation bounds in connection with singular value decomposition. BIT Numerical Mathematics, 12(1):99–111, 1972. C-F Westin, Stephan E Maier, Hatsuho Mamata, Arya Nabavi, Ferenc A Jolesz, and Ron Kikinis. Processing and visualization for diffusion tensor mri. Medical image analysis, 6(2):93–108, 2002. Dong Xia and Ming Yuan. On polynomial time methods for exact low rank tensor completion. arXiv preprint arXiv:1702.06980, 2017. Qing Xiong, Nicola Ancona, Elizabeth R Hauser, Sayan Mukherjee, and Terrence S Furey. Integrating genetic and gene expression evidence into genome-wide association analysis of gene sets. Genome research, 22(2):386–397, 2012. 39 Anru Zhang and Dong Xia. Guaranteed tensor pca with optimality in statistics and computation. arXiv preprint arXiv:1703.02724, 2017. A Proof of Lemma 1 Let zi ∈ Rm1 , i = 1, . . . , m2 denote the columns of Z. Then, we write ZZ> − σ 2 m2 Im1 = m2 X  zi ⊗ zi − σ 2 Im1 . i=1 Similarly, let z̃j ∈ Rm1 , j = 1, . . . , m1 denote the rows of Z and observe that kBZ> k = kBZ> ZB> k1/2 and BZ> ZB> = m1  X    Bžj ⊗ Bžj − σ 2 BB> . j=1 The inequalities (5.6) and (5.2) are on the concentration of sample covariance operator, where a sharp bound has been derived in Koltchinskii and Lounici [2017] and will be skipped here. B Proof of Theorem 4 The following spectral representation formula is needed whose proof can be found in Koltchinskii and Lounici [2016]. Lemma 3. The following bound holds b uu − Puu k ≤ kP k k b 4kΓk . ḡk (AA> ) b uu can be represented as Moreover, P k b uu − Puu = Lk (Γ) b + Sk (Γ) b P k k 40 b = Puu ΓC b uu + Cuu ΓP b uu and where Lk (Γ) k k k k  b kSk (Γ)k ≤ 14 b kΓk ḡk (AA> ) 2 . b = 0, we immediately get ELk (Γ) b = 0. Then, Since EΓ b uu y − E x, P b uu y = x, Lk (Γ)y b b b x, P + x, Sk (Γ)y − E x, Sk (Γ)y . k k Lemma 4. For any x, y ∈ Rm1 , there exists an absolute constant D1 > 0 such that for all 0 ≤ t ≤ m1 , with probability at least 1 − e−t ,   2 1/2 1/2 σµ1 + σ m2 b hx, Lk (Γ)yi ≤ D1 t kxk`2 kyk`2 . ḡk (AA> ) Proof. Recall that b = AZ> + ZA> + ZZ> − m2 σ 2 Im . Γ 1 b Then, we write x, Lk (Γ)y as b uu x, Puu yi b b uu x, Cuu yi + hΓC hx, Lk (Γ)yi = hΓP k k k k uu > > > 2 uu uu = h(AZ> + ZA> + ZZ> − m2 σ 2 Im1 )Puu k x, Ck yi + h(AZ + ZA + ZZ − m2 σ Im1 )Ck x, Pk yi. It suffices to consider the following terms separately for x, y ∈ Rm1 : hZA> x, yi, hAZ> x, yi,  ZZ> − m2 σ 2 Im1 x, y . It is straightforward to check that hZA> x, yi is a normal random variable with zero mean and variance EhZA> x, yi2 = EhZ, y ⊗ (A> x)i2 = σ 2 ky ⊗ (A> x)k2`2 = σ 2 kyk2`2 kA> xk2`2 , 41 where we used the fact that Z is a m1 × m2 matrix with i.i.d. N (0, σ 2 ) entries. Therefore, uu 2 EhZA> Puu k x, Ck yi ≤ where we used the facts kCk k ≤ 1 ḡk (AA> ) σ 2 µ2k kxk2`2 kyk2`2 , 2 > ḡk (AA ) and kA> Puu k k ≤ µk . By the standard concentration inequality of Gaussian random variables, we get for all t ≥ 0,  > uu Puu k x, Ck y > uu Cuu k x, Pk y ZA P ≥ 2t 1/2 ≥ 2t 1/2 σµk kxk`2 kyk`2 ḡk (AA> )  ≤ e−t . σµ1 kxk`2 kyk`2 ḡk (AA> )  ≤ e−t . Similarly, for all t ≥ 0,  ZA P  uu uu uu ZZ> − m2 σ 2 Im1 Puu k x, Ck y . Recall that Pk Ck = 0 implying We next turn to the bound of m1 denote the columns of Z such uu that it suffices to consider ZZ> Puu k x, Ck y . Let z1 , . . . , zm2 ∈ R  that zi ∈ N 0, σ 2 Im1 for 1 ≤ i ≤ m2 . Write > ZZ uu (Puu k x), Ck y = m2 X uu zi , Puu k x zi , Ck y . i=1   uu uu uu Observe that E Puu k zi ⊗ Ck zi = 0 implying that zi , Pk x is independent of zi , Ck y . By concentration inequalities of Gaussian random variables, for all t ≥ 0,  uu ZZ> (Puu P k x), Ck y 1/2 ≥ 2t kyk`2 σ  uu 2 1/2 i=1 hzi , Pk xi ḡk (AA> ) Pm2 n o uu hzi , Pk xi : i = 1, . . . , m2 ≤ e−t . By [Vershynin, 2010, Prop 5.16], the following bound holds with probability at least 1 − e−t , m2 X   1/2 1/2 2 2 2 hzi , Puu xi − σ m kxk . σ m t + t kxk`2 . 2 k `2 2 i=1 42 If t . m1 ≤ m2 , we conclude that there exists an absolute constant D1 > 0 such that 1/2 σ 2 m2 t1/2 ≥ D1 kxk`2 kyk`2 ḡk (AA> )  uu P ZZ> (Puu k x), Ck y  ≤ e−t . To sum up, for all 0 ≤ t . m1 , the following bound holds with probability at least 1 − e−t , b x, Lk (Γ)y 1/2 .t  1/2  σµ1 + σ 2 m2 ḡk (AA> ) kxk`2 kyk`2 which concludes the proof. b b It remains to derive the upper bound of hx, Sk (Γ)yi − Ehx, Sk (Γ)yi .The following lemma is due to Koltchinskii and Lounici [2016]. 1/2 Lemma 5. Let δ(m1 , m2 ) := σµ1 m1 +σ 2 (m1 m2 )1/2 and suppose that δ(m1 , m2 ) ≤ 1−γ > 2(1+γ) ḡk (AA ) b 1, Γ b 2 ∈ Rm1 ×m1 for some γ ∈ (0, 1). There exists a constant Dγ > 0 such that, for all symmetric Γ  b 1 k, kΓ b 2 k ≤ (1 + γ)δ(m1 , m2 ), satisfying the condition max kΓ b1 − Γ b 2 k. b 1 ) − Sk ( Γ b 2 )k ≤ Dγ δ(m1 , m2 ) kΓ kSk (Γ ḡk2 (AA> ) Define function ϕ(·) : R+ 7→ [0, 1] such that ϕ(t) = 1 for 0 ≤ t ≤ 1 and ϕ(t) = 0 for t ≥ (1 + γ) and ϕ is linear in between. Then, function ϕ is Lipschitz on R+ with constant 1 γ. To illustrate b on Z, we write Γ(Z) b b To this end, fix x, y ∈ Rm1 and constants the dependence of Γ instead of Γ. δ1 , δ2 > 0 and define the function D   kZk  b  E  kΓ(Z)k b ϕ . Fδ1 ,δ2 ,x,y (Z) := x, Sk Γ(Z) y ϕ δ1 δ2 where we view Z as a point in Rm1 ×m2 rather than a random matrix. Lemma 6. For any δ1 ≤ 1−γ > 2(1+γ) ḡk (AA ) for some γ ∈ (0, 1) and δ2 > 0, there exists an absolute 43 constant Cγ > 0 such that Fδ1 ,δ2 ,x,y (Z1 ) − Fδ1 ,δ2 ,x,y (Z2 ) ≤ Cγ  δ1 δ1  kZ1 − Z2 kkxk`2 kyk`2 µ + δ + 1 2 δ2 ḡk2 (AA> ) b kZk b Proof of Lemma 6. Since ϕ( kΓ(Z)k δ1 )ϕ( δ2 ) 6= 0 only if kΓ(Z)k ≤ (1 + γ)δ1 and kZk ≤ (1 + γ)δ2 , Lemma 3 implies that Fδ1 ,δ2 ,x,y (Z) = Case 1: max  D   kZk  b  E  kΓ(Z)k δ2 b ≤ 14(1 + γ)2 2 1 > . x, Sk Γ(Z) y ϕ ϕ δ1 δ2 ḡk (AA ) b 1 ) , Γ(Z b 2) Γ(Z ≤ (1 + γ)δ1 and  max kZ1 k, kZ2 k ≤ (1 + γ)δ2 . b By the Lipschitzity of function ϕ, Lemma 5 and definition of Γ(Z), it is easy to check   b 1 ) − Sk Γ(Z b 2 ) kkxk` kyk` |Fδ1 ,δ2 ,x,y (Z1 ) − Fδ1 ,δ2 ,x,y (Z2 )| ≤ kSk Γ(Z 2 2 + 2 2 14(1 + γ)2 δ1 b b 2 ) kxk` kyk` + 14(1 + γ) δ1 kZ1 − Z2 kkxk` kyk` Γ(Z ) − Γ(Z 1 2 2 2 2 γḡk2 (AA> ) δ2 γḡk2 (AA> ) ≤ Dγ 2 2 δ1 b 1 ) − Γ(Z b 2 )kkxk` kyk` + 14(1 + γ) δ1 kZ1 − Z2 kkxk` kyk` k Γ(Z 2 2 2 2 ḡk2 (AA> ) δ2 γḡk2 (AA> )  δ1  δ1 µ + δ + kZ1 − Z2 kkxk`2 kyk`2 . ≤ Dγ 2 1 2 δ2 ḡk (AA> )  b 2 )k ≥ (1 + γ)δ1 and max kZ1 k, kZ2 k ≤ (1 + γ)δ2 . kΓ(Z b 2 )k  b 2 )k ≥ (1 + γ)δ1 , we have ϕ kΓ(Z Since kΓ(Z = 0 and Fδ1 ,δ2 ,x,y (Z2 ) = 0. Then, δ1 b 1 )k ≤ (1 + γ)δ1 , Case 2: kΓ(Z     E  b b 1 ) y ϕ kΓ(Z1 )k ϕ kZ1 k x, Sk Γ(Z δ1 δ2 D E     D E     b b   b 1 ) y ϕ kΓ(Z1 )k ϕ kZ1 k − x, Sk Γ(Z b 1 ) y ϕ kΓ(Z2 )k ϕ kZ1 k = x, Sk Γ(Z δ1 δ2 δ1 δ2  1 b 1) b 1 ) − Γ(Z b 2 )kkxk` kyk` ≤ Sk Γ(Z kΓ(Z 2 2 δ1 γ  (1 + γ)2 δ12 ≤ 2 2µ + 2(1 + γ)δ kZ1 − Z2 kkxk`2 kyk`2 1 2 ḡk (AA> )δ1 γ δ1 ≤ Dγ 2 (µ1 + δ2 )kZ1 − Z2 kkxk`2 kyk`2 . ḡk (AA> ) Fδ1 ,δ2 ,x,y (Z1 ) − Fδ1 ,δ2 ,x,y (Z2 ) = D 44 b 1 )k ≤ (1 + γ)δ1 , Case 3: kΓ(Z b 2 )k ≥ (1 + γ)δ1 , kΓ(Z kZ1 k ≤ (1 + γ)δ2 , kZ2 k ≥ (1 + γ)δ2 . kZ1 k ≥ (1 + γ)δ2 , kZ2 k ≥ (1 + γ)δ2 . It can be proved similarly as Case 2. b 1 )k ≤ (1 + γ)δ1 , Case 4: kΓ(Z b 2 )k ≥ (1 + γ)δ1 , kΓ(Z It is a trivial case since Fδ1 ,δ2 ,x,y (Z1 ) = Fδ1 ,δ2 ,x,y (Z2 ) = 0.  b 1 )k, kΓ(Z b 2 )k ≤ (1 + γ)δ1 , kZ1 k ≤ (1 + γ)δ2 , Case 5: max kΓ(Z kZ2 k ≥ (1 + γ)δ2 . Again, we have Fδ1 ,δ2 ,x,y (Z2 ) = 0. Then,     E  b b 1 ) y ϕ kΓ(Z1 )k ϕ kZ1 k x, Sk Γ(Z δ1 δ2 D b 1 )k   kZ1 k  D b 1 )k   kZ2 k   E  kΓ(Z  E  kΓ(Z b 1) y ϕ b 1) y ϕ = x, Sk Γ(Z ϕ − x, Sk Γ(Z ϕ δ1 δ2 δ1 δ2 2 2  1 (1 + γ) δ1 b 1) kZ1 − Z2 kkxk`2 kyk`2 ≤ Sk Γ(Z kZ1 − Z2 kkxk`2 kyk`2 ≤ 2 δ2 γ ḡk (AA> )δ2 γ δ1 δ1 ≤ Dγ 2 kZ1 − Z2 kkxk`2 kyk`2 . ḡk (AA> ) δ2 Fδ1 ,δ2 ,x,y (Z1 ) − Fδ1 ,δ2 ,x,y (Z2 ) = D All the other cases shall be handled similarly and we conclude the proof. Note that kZ1 − Z2 k ≤ kZ1 − Z2 k`2 , Lemma 6 indicates that Fδ1 ,δ2 ,x,y (Z) is Lipschitz with constant Dγ  δ1 δ1  µ + δ + kxk`2 kyk`2 . 1 2 δ2 ḡk2 (AA> ) 1/2 Lemma 7. Let δ(m1 , m2 ) := σµ1 m1 b ≤ + σ 2 (m1 m2 )1/2 and suppose that EkΓk 1−γ > 2 ḡk (AA ) for some γ ∈ (0, 1). There exists some constant Dγ such that for any x, y ∈ Rm1 and all log 8 ≤ t ≤ m1 , the following inequality holds with probability at least 1 − e−t , 2 1/2  σµ1 + σ m2 b b hx, Sk (Γ)yi − Ehx, Sk (Γ)yi ≤ Dγ t1/2 ḡk (AA> )  δ(m1 , m2 ) kxk`2 kyk`2 . ḡk (AA> ) Proof of Lemma 7. Choose δ1 = δ1 (m1 , m2 ) and δ2 = δ2 (m1 , m2 ) as follows where log 8 ≤ t ≤ m1 is to be determined: e + D1 t1/2 (σµ1 + σ 2 m1/2 ) δ1 (m1 , m2 ) := δ1 (m1 , m2 , t) := EkΓk 2 45 δ2 (m1 , m2 ) := δ2 (m1 , m2 , t) := EkZk + D2 σt1/2  b ≥ δ1 (m1 , m2 , t) ≤ e−t and P kZk ≥ and the constants D1 , D2 > 0 are chosen such that P kΓk  b δ2 (m1 , m2 , t) ≤ e−t . Let M := Med(hx, Sk (Γ)yi) denote its median. 1/2 Case 1: D1 t1/2 (µ1 σ + σ 2 m2 ) ≤ γ > 4 ḡk (AA ). Then, δ1 ≤ (1 − γ2 ) ḡk (AA 2 >) = 1−2γ 0 ḡk (AA> ) 1+2γ 0 2 for some γ 0 ∈ (0, 1/2). By Lemma 6, Fδ1 ,δ2 ,x,y (·) satisfies the Lipschitz condition. By definition of b b ≤ δ1 , kZk ≤ δ2 }. By Lemma 1 Fδ1 ,δ2 ,x,y (Z), we have Fδ1 ,δ2 ,x,y (Z) = hx, Sk (Γ)yi on the event {kΓk and t ≥ log 8, n o n o b ≤ δ1 , kZk ≤ δ2 P Fδ1 ,δ2 ,x,y (Z) ≥ M ≥ P Fδ1 ,δ2 ,x,y (Z) ≥ M, kΓk n o b b ≤ δ1 , kZk ≤ δ2 } ≥ P hx, Sk (Γ)yi ≥ M − P{kΓk n o n o n o b b ≤ δ1 − P kZk ≤ δ2 ≥ 1 − 1 − 1 = 1/4, ≥ P hx, Sk (Γ)yi ≥ M − P kΓk 2 8 8 and similarly, n o P Fδ1 ,δ2 ,x,y (Z) ≤ M ) ≥ 1/4. It follows from Gaussian isoperimetric inequality (see [Koltchinskii and Xia, 2016, Lemma 2.6]) and Lemma 6 that with some constant Dγ > 0, for all t ≥ log 8 with probability at least 1 − e−t , Fδ1 ,δ2 ,x,y (Z) − M ≤ Dγ σδ1 t1/2  δ1  µ + δ + kxk`2 kyk`2 . 1 2 δ2 ḡk2 (AA> ) 1/2 Since t ≤ m1 ≤ m2 , it is easy to check by Lemma 1 that δ1  σµ1 m1 + σ 2 (m1 m2 )1/2 and  1/2 b ≤ δ1 , kZk ≤ δ2 ≥ 1 − 2e−t . As a result, with probability at least δ2  σm2 . Moreover, P kΓk 1 − e−3t , 1/2 1/2 σµ1 t b hx, Sk (Γ)yi − M ≤ Dγ + σ 2 m2 t1/2 ḡk (AA> )   δ(m1 , m2 ) kxk`2 kyk`2 . ḡk (AA> ) 1/2 Case 2: D1 t1/2 (σµ1 + σ 2 m2 ) > γ4 ḡk (AA> ). It implies that b ≤ D1 EkΓk (1 − γ) 1/2 1/2 t (σµ1 + σ 2 m2 ), γ 46 (B.1) 1/2 and δ1 ≤ Dγ t1/2 (σµ1 + σ 2 m2 ). By Lemma 1 and Lemma 3, with probability at least 1 − e−t , 1/2 2 2 b b ≤ Dγ t (σµ1 + σ m2 ) kxk` kyk` , |hx, Sk (Γ)yi| ≤ kSk (Γ)k 2 2 ḡk2 (AA> ) which immediately yields that 1/2 M ≤ Dγ (σµ1 + σ 2 m2 )2 kxk`2 kyk`2 . ḡk2 (AA> ) The above inequalities imply that with probability at least 1 − e−t for log 8 ≤ t ≤ m1 , 2 1/2 2 (σµ1 + σ m2 ) b |hx, Sk (Γ)yi − M | ≤ Dγ t kxk`2 kyk`2 ḡk2 (AA> )   1/2 σµ1 t1/2 + σ 2 m2 t1/2 δ(m1 , m2 ) kxk`2 kyk`2 . ≤ Dγ ḡk (AA> ) ḡk (AA> ) (B.2) Therefore, bounds (B.1) and (B.2) hold in both cases. The rest of the proof is quite standard by integrating the exponential tails and will be skipped here, see Koltchinskii and Xia [2016]. Proof of Theorem 4. By Lemma 4 and Lemma 7, if D1 δ(m1 , m2 ) ≤ ḡk (AA> ) for a large enough constant D1 > 0 such that γ ≤ 1/2, we conclude that for all log 8 ≤ t ≤ m1 , with probability at least 1 − 2e−t , b ky x, P ≤ Dt 1/2 + σ 2 m2 kxk`2 kyk`2 ḡk (AA> ) 1/2 σµ1 which concludes the proof after adjusting the constant D accordingly. C Proof of Lemma 2 1/2 +D σ 2 m1/2 t1/2 b Observe that for any x, y ∈ Rm1 with kxk`2 = kyk`2 = 1 and δt = EkΓk+D 1 σµ1 t 2 2 with t ≤ m1 and some γ ∈ (0, 1/2],  e − Sk (Γ) b y E x, Sk (Γ) e − Sk (Γ) b ≤ E Sk (Γ) 47     e − Sk (Γ) b 1 kΓk e ≤ (1 + γ)δt 1 kΓk b ≤ (1 + γ)δt = E Sk (Γ)     e − Sk (Γ) b 1 kΓk e ≤ (1 + γ)δt 1 kΓk b > (1 + γ)δt + E Sk (Γ)     e − Sk (Γ) b 1 kΓk e > (1 + γ)δt 1 kΓk b ≤ (1 + γ)δt + E Sk (Γ)     e − Sk (Γ) b 1 kΓk e > (1 + γ)δt 1 kΓk b > (1 + γ)δt + E Sk (Γ)    e ≥ δt , P kΓk b ≥ δt ≤ e−t . By where the constants D1 , D2 > 0 are chosen such that max P kΓk Lemma 5,     e − Sk (Γ) b 1 kΓk e ≤ (1 + γ)δt 1 kΓk b ≤ (1 + γ)δt E Sk (Γ) ≤ Dγ By writing Phh k := δt e EkΓ 2 ḡk (AA> ) P j∈∆k > 2 ZPhh k Z − σ νk Im1 = b ≤ Dγ − Γk δt > EkZPhh k Z 2 ḡk (AA> ) − νk σ 2 Im1 k. hj ⊗ hj , we obtain X (Zhj ) ⊗ (Zhj ) − σ 2 νk Im1 = νk  1 X (Zhj ) ⊗ (Zhj ) − σ 2 Im1 . νk j∈∆k j∈∆k where νk = Card(∆k ). The vectors Zhj ∼ N (0, σ 2 Im1 ) and {Zhj : . . . , j ∈ ∆k } are independent. By Koltchinskii and Lounici [2017], E r m 1 X m1  1 (Zhj ) ⊗ (Zhj ) − σ 2 Im1 . σ 2 ∨ . νk νk νk j∈∆k Since νk ≤ m1 , we conclude with     e − Sk (Γ) b 1 kΓk e ≤ (1 + γ)δt 1 kΓk b ≤ (1 + γ)δt .γ E Sk (Γ)   δt m1 σ 2 . ḡk (AA> ) ḡk (AA> ) Choose t = m1 , by Lemma 3 and Lemma 1,     e − Sk (Γ) b 1 kΓk b ≤ (1 + γ)δm 1 kΓk e > (1 + γ)δm E Sk (Γ) 1 1 48 (C.1)   2 e 2 δm kΓk 1 e > (1 + γ)δm E 1 k Γk 1 ḡk2 (AA> ) ḡk2 (AA> )   2 4 δm δm δ(m1 , m2 ) σµ1 + σ 2 m1 −m1 /2 1/2 e 4 −m1 /2 1 1 .γ 4 e E kΓk . 4 e . ḡk (AA> ) ḡk (AA> ) ḡk (AA> ) ḡk (AA> ) ≤ Dγ which is clearly dominated by (C.1) for t = m1 and m2 e−m1 /2 ≤ 1. The other terms are bounded in a similar fashion. To sum up, we obtain 2 e − ESk (Γ)k b . σµ1 + σ m1 kESk (Γ) ḡk (AA> ) 49   δ(m1 , m2 ) . ḡk (AA> )
10math.ST
Bayesian sparse multiple regression for simultaneous arXiv:1612.00877v3 [stat.ME] 21 Sep 2017 rank reduction and variable selection Antik Chakraborty Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Anirban Bhattacharya Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Bani K. Mallick Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Abstract We develop a Bayesian methodology aimed at simultaneously estimating low-rank and row-sparse matrices in a high-dimensional multiple-response linear regression model. We consider a carefully devised shrinkage prior on the matrix of regression coefficients which obviates the need to specify a prior on the rank, and shrinks the regression matrix towards low-rank and row-sparse structures. We provide theoretical support to the proposed methodology by proving minimax optimality of the posterior mean under the prediction risk in ultra-high dimensional settings where the number of predictors can grow sub-exponentially relative to the sample size. A one-step post-processing scheme induced by group lasso penalties on the rows of the estimated coefficient matrix is proposed for variable selection, with default choices of tuning parameters. We additionally provide an estimate of the rank using a novel optimization function achieving dimension reduction in the covariate space. We exhibit the performance of the proposed methodology in an extensive simulation study and a real data example. Key Words: Bayesian; High dimension; Shrinkage prior; Posterior concentration; Dimension reduction; Variable selection. Short title: Bayesian sparse multi-task learner 1 Introduction Studying the relationship between multiple response variables and a set of predictors has broad applications ranging from bioinformatics, econometrics, time series analysis to growth curve models. The least squares solution in a linear multiple response regression problem is equivalent to performing separate least squares on each of the responses (Anderson, 1984) and ignores any potential dependence among the responses. In the context of multiple response regression, a popular technique to achieve parsimony and interpretability is to consider a reduced-rank decomposition of the coefficient matrix, commonly known as reduced rank regression (Anderson, 1951; Izenman, 1975; Velu & Reinsel, 2013). Although many results exist about the asymptotic properties of reduced rank estimators (Anderson, 2002), formal statistical determination of the rank remains difficult even with fixed number of covariates and large sample size. The problem becomes substantially harder when a large number of covariates are present, and has motivated a series of recent work on penalized estimation of low rank matrices, where either the singular values of the coefficient matrix (Chen et al., 2013; Yuan et al., 2007), or the rank itself (Bunea et al., 2011) is penalized. Theoretical evaluations of these estimators focusing on adaptation to the oracle convergence rate when the true coefficient matrix is of low rank has been conducted (Bunea et al., 2011). It has also been noted (Bunea et al., 2012) that the convergence rate can be improved when the true coefficient matrix has zero rows and variable selection is incorporated within the estimation procedure. Methods that simultaneously handle rank reduction and variable selection include Bunea et al. (2012); Chen & Huang (2012); Yuan et al. (2007). To best of our knowledge, uncertainty characterization for the parameter estimates from these procedures is currently not available. The first fully systematic Bayesian treatment of reduced rank regression was carried out in Geweke (1996), where conditioned on the rank, independent Gaussian priors were placed on the elements of the coefficient matrix. While formal Bayesian model selection can be performed to determine the rank (Geweke, 1996), calculation of marginal likelihoods for various candidate ranks gets computationally burdensome with increasing dimensions. The problem of choosing the rank is not unique to reduced rank regression and is ubiquitous in situations involving low rank decompositions, with factor models being a prominent example. Lopes & West (2004) placed a prior on the number of factors and proposed a computationally intensive reversible jump algorithm (Green, 1 1995) for model fitting. As an alternative, Bhattacharya & Dunson (2011) proposed to increasingly shrink the factors starting with a conservative upper bound and adaptively collapsing redundant columns inside their MCMC algorithm. Recent advancements in Bayesian matrix factorization have taken a similar approach; see for example, Alquier (2013); Babacan et al. (2011); Lim & Teh (2007); Salakhutdinov & Mnih (2008). From a Bayesian point of view, a natural way to select variables in a single-response regression framework is to use point mass mixture priors (George & McCulloch, 1993; Scott et al., 2010) which allow a subset of the regression coefficients to be exactly zero. These priors were also adapted to multiple response regression by several authors (Bhadra & Mallick, 2013; Brown et al., 1998; Lucas et al., 2006; Wang, 2010). Posterior inference with such priors involves a stochastic search over an exponentially growing model space and is computationally expensive even in moderate dimensions. To alleviate the computational burden, a number of continuous shrinkage priors have been proposed in the literature which mimic the operating characteristics of the discrete mixture priors. Such priors can be expressed as Gaussian scale mixtures (Polson & Scott, 2010), leading to block updates of model parameters; see Bhattacharya et al. (2016a) for a review of such priors and efficient implementations in high-dimensional settings. To perform variable selection with these continuous priors, several methods for post-processing the posterior distribution have been proposed (Bondell & Reich, 2012; Hahn & Carvalho, 2015; Kundu et al., 2013). In this article we simultaneously address the problems of dimension reduction and variable selection in high-dimensional reduced rank models from a Bayesian perspective. We develop a novel shrinkage prior on the coefficient matrix which encourages shrinkage towards low-rank and row-sparse matrices. The shrinkage prior is induced from appropriate shrinkage priors on the components of a full-rank decomposition of the coefficient matrix, and hence bypasses the need to specify a prior on the rank. We provide theoretical understanding into the operating characteristics of the proposed prior in terms of a novel prior concentration result around rank-reduced and lowsparse matrices. The prior concentration result is utilized to prove minimax concentration rates of the posterior under the fractional posterior framework of Bhattacharya et al. (2016c) in a ultrahighdimensional setting where the number of predictor variables can grow sub-exponentially in the sample size. The continuous nature of the prior enables efficient block updates of parameters inside a Gibbs 2 sampler. In particular, we adapt an algorithm for sampling structured multivariate Gaussians from Bhattacharya et al. (2016a) to efficiently sample a high-dimensional matrix in a block. We propose two independent post-processing schemes to achieve row sparsity and rank reduction with encouraging performance. A key feature of our post-processing schemes is to exploit the posterior summaries to offer careful default choices of tuning parameters, resulting in a procedure which is completely free of tuning parameters. The resulting row-sparse and rank-reduced coefficient estimate is called a Bayesian sparse multi-task learner (BSML). We illustrate the superiority of BSML over its competitors through a detailed simulation study and the methodology is applied to a Yeast cell cycle data set. 2 Bayesian sparse multitask learner 2.1 Model and Prior Specification Suppose, for each observational unit i = 1, . . . , n, we have a multivariate response yi ∈ ℜq on q variables of interest, along with information on p possible predictors xi ∈ ℜp , a subset of which are assumed to be important in predicting the q responses. Let X ∈ ℜn×p denote the design matrix whose ith row is xTi , and Y ∈ ℜn×q the matrix of responses with the ith row as yiT . The multivariate linear regression model is, Y = XC + E, E = (eT1 , . . . , eTn )T , (1) where we follow standard practice to center the response and exclude the intercept term. The rows of the error matrix are independent, with ei ∼ N(0, Σ). Our main motivation is the highdimensional case where p ≥ max{n, q}, although the method trivially applies to p < n settings as well. We shall also assume the dimension of the response q to be modest relative to the sample size. The basic assumption in reduced rank regression is that rank(C) = r ≤ min(p, q), whence C admits a decomposition C = B∗ AT∗ with B∗ ∈ ℜp×r and A∗ ∈ ℜq×r . While it is possible to treat r as a parameter and assign it a prior distribution inside a hierarchical formulation, posterior inference on r requires calculation of intractable marginal likelihoods or resorting to complicated reversible jump Markov chain Monte Carlo algorithms. To avoid specifying a prior on r, we work within a parameter-expanded framework (Liu & Wu, 1999) to consider a potentially full-rank decomposition 3 C = BAT with B ∈ ℜp×q and A ∈ ℜq×q , and assign shrinkage priors to A and B to shrink out the redundant columns when C is indeed low rank. This formulation embeds all reduced-rank models inside the full model; if a conservative upper bound q ∗ ≤ q on the rank is known, the method can be modified accordingly. The role of the priors on B and A is important to encourage appropriate shrinkage towards reduced-rank models, which is discussed below. We consider independent standard normal priors on the entries of A. As an alternative, a uniform prior on the Stiefel manifold (Hoff, 2009) of orthogonal matrices can be used. However, our numerical results suggested significant gains in computation time using the Gaussian prior over the uniform prior with no discernible difference in statistical performance. The Gaussian prior allows an efficient block update of vec(A), whereas the algorithm of Hoff (2009) involves conditional Gibbs update of each column of A. Our theoretical results also suggest that the shrinkage provided by the Gaussian prior is optimal when q is modest relative to n, the regime we operate in. We shall henceforth denote ΠA to denote the prior on A, i.e., ahk ∼ N(0, 1) independently for h, k = 1, . . . , q. Recalling that the matrix B has dimension p × q, with p potentially larger than n, stronger shrinkage is warranted on the columns of B. We use independent horseshoe priors (Carvalho et al., 2010) on the columns of B, which can be represented hierarchically as bjh | λjh , τh ∼ N(0, λ2jh τh2 ), λjh ∼ Ca+ (0, 1), τh ∼ Ca+ (0, 1), (2) independently for j = 1, . . . , p and h = 1, . . . , q, where Ca+ (0, 1) denotes the truncated standard half-Cauchy distribution with density proportional to (1 + t2 )−1 1(0,∞) (t). We shall denote the prior on the matrix B induced by the hierarchy in (2) by ΠB . We shall primarily restrict attention to settings where Σ is diagonal, Σ = diag(σ12 , . . . , σq2 ), noting that extensions to non-diagonal Σ can be incorporated in a straightforward fashion. For example, for moderate q, a conjugate inverse-Wishart prior can be used as a default. Furthermore, if Σ has a factor model or Gaussian Markov random field structure, they can also be incorporated using standard techniques (Bhattacharya & Dunson, 2011; Rue, 2001). The cost-per-iteration of the Gibbs sampler retains the same complexity as in the diagonal Σ case; see §3 for more details. In the diagonal case, we assign independent improper priors π(σh2 ) ∝ σh−2 , h = 1, . . . , q on the diagonal elements, and call the resulting prior ΠΣ . 4 The model augmented with the above priors now takes the shape Y = XBAT + E, B ∼ ΠB , ei ∼ N(0, Σ), A ∼ ΠA , Σ ∼ ΠΣ . (3) (4) We shall refer to the induced prior on C = BAT by ΠC . 2.2 Concentration results In this section, we establish a minimax posterior concentration result under the prediction loss when the number of covariates are allowed to grow sub-exponentially in n. To best of our knowledge, this is the first such result in Bayesian reduced rank regression models. We are also not aware of a similar result in any model involving the horseshoe or another polynomial tailed shrinkage prior in ultrahigh-dimensional settings. Armagan et al. (2013) applied the general theory of posterior consistency (Ghosal et al., 2000) to linear models with growing number of covariates and established consistency for the horseshoe prior with a sample size dependent hyperparameter choice when p = o(n). Results (Ghosh & Chakrabarti, 2017; van der Pas et al., 2014) that quantify rates of convergence focus exclusively on the normal means problem, with their proofs crucially exploiting an exact conjugate representation of the posterior mean. In this article, we study concentration properties of the posterior distribution in model (3) in p ≫ n settings. To aid the theoretical analysis, we adopt the fractional posterior framework of Bhattacharya et al. (2016c), where a fractional power of the likelihood function is combined with a prior using the usual Bayes formula to arrive at a fractional posterior distribution. It is sufficient to verify a prior mass condition on Kullback–Leibler neighborhoods of the true parameter for the fractional posterior to concentrate at the true parameter, obviating the construction of sieves and verification of prior tail conditions to prove consistency of the actual posterior (Ghosal et al., 2000). Our key contribution is the development of a novel non-asymptotic prior concentration result for the horseshoe prior around sparse vectors in Lemma S1 in the supplemental document. The only other instance of a similar prior concentration result in p ≫ n settings that we are aware of is for the Dirichlet–Laplace prior (Pati et al., 2014). We believe our prior concentration result will be of independent interest in various other models involving the horseshoe prior. We first list the assumptions needed for our concentration result. 5 Assumption 2.1 (Growth of number of covariates). log p/n ≤ γ for some γ ∈ (0, 1). Assumption 2.2 (Response covariance). The error covariance Σ is known, and without loss of generality, assume Σ = Iq . Assumption 2.3 (True coefficient matrix). The true coefficient matrix C0 admits the decomposition C0 = B0 AT0 where B0 ∈ ℜp×r0 and A0 ∈ ℜq×r0 for some r0 = κq, κ ∈ (0, 1]. We additionally assume that A0 is semi-orthogonal, i.e. AT0 A0 = Ir0 , and all but s rows of B0 are identically zero for some s = o(p). Finally, max | C0jh |< T for some T > 0. j,h Assumption 2.4. The number of response variables q is fixed. Assumption 2.5 (Design matrix). For Xj the jth column of X, max1≤j≤p kXj k ≍ n. γ Assumption 1 allows the number of covariates p to grow at a sub-exponential rate of en for some γ ∈ (0, 1). Assumption 2 is made for technical convenience and is not critical as Σ is only a q × q matrix. Assumption 3 posits that the true coefficient matrix C0 admits a reduced-rank decomposition with the matrix B0 row-sparse. Assumption 4 can be relaxed to let q grow slowly with n. Assumption 5 is a standard minimal assumption on the design matrix, and is satisfied with large probability if the elements of the design matrix are independently drawn from a fixed probability distribution, such as N(0, 1). Fix α ∈ (0, 1). Recall the prior ΠC on C defined after equation (4). The α-fractional posterior for C under model (3) is given by Πn,α (C) ∝ e−α tr{(Y −XC)(Y −XC) T }/2 ΠC (C), (5) where we used Assumption 2 to set Σ = Iq . Assuming the data is generated with a true coefficient matrix C0 , we wish to show that the α-fractional posterior Πn,α (·) concentrates around C0 under the averaged prediction loss kXC − XC0 k2F /(nq), where k·k2F denotes the Frobenius norm of a matrix. Theorem 2.6 states a non-asymptotic concentration bound for Πn,α below. Theorem 2.6. Fix α ∈ (0, 1) and let Πn,α be defined as in (5). Suppose assumptions 1-5 are satisfied. Let ǫn = {(qr0 + r0 s log p)/n}1/2 . Then for any D ≥ 2 and t > 0,   2(D + 3t) 2 2 1 2 p×q kXC − XC0 kF ≥ ǫn | Y ≤ e−tnǫn Πn,α C ∈ ℜ : nq α(1 − α) holds with probability at least 1 − 2/{(D − 1 + t)nǫ2n } under the true distribution. 6 A proof of Theorem 2.6 is provided in the Appendix. An immediate consequence is that the R posterior mean C = C Πn,α (dC) satisfies kXC − XC0 k2F /(nq) . Kǫ2n with large probability for some constant K > 0. It then follows from Bunea et al. (2012) that the posterior mean achieves the minimax rate as a frequentist estimate. A main ingredient of the proof is a novel non-asymptotic prior concentration result for the prior ΠC . Building on a sequence of results, we prove in Lemma S4 of the supplementary document that if C0 satisfies Assumption 3, then 2 ΠC (C : kC − C0 kF < ǫn ) ≥ e−Knǫn , where K is a positive constant. The implication is that the prior places sufficient mass to minimax neighborhoods of the truth, which drives the concentration of the fractional posterior Πn,α . We expect the concentration results to hold as well for the actual posterior, i.e., when α = 1, which, however, is well beyond the scope of the current paper. For model (3), raising the likelihood to a fractional power only results in a change in the (co)variance term, and hence our Gibbs sampler can be easily adapted to sample from the fractional posterior. Our numerical investigations found the point estimates to be virtually indistinguishable from the actual posterior when the fractional power α is close to one, e.g., 0.95 or 0.99, justifying our choice of the theoretical environment. It was also theoretically shown in Bhattacharya et al. (2016c) that as α → 1−, the fractional posterior converges weakly to the usual posterior. 3 Posterior Computation Exploiting the conditional conjugacy of the proposed prior, we develop a straightforward and efficient Gibbs sampler to update the model parameters in (3) from their full conditional distributions. We use vectorization to update parameters in blocks. Specifically, in what follows, we will make multiple usage of the following identity. For matrices Φ1 , Φ2 , Φ3 with appropriate dimensions, and vec(A) denoting column-wise vectorization, we have, vec(Φ1 Φ2 Φ3 ) = (ΦT3 ⊗ Φ1 )vec(Φ2 ) = (ΦT3 ΦT2 ⊗ Ik )vec(Φ1 ), where the matrix Φ1 has k rows and ⊗ denotes the Kronecker product. 7 (6) Letting θ | − denote the full conditional distribution of a parameter θ given other parameters and the data, the Gibbs sampler cycles through the following steps, sampling parameters from their full conditional distributions: Step 1. To sample B | −, use (6) to vectorize Y = XBAT + E to obtain, y = (X ⊗ A)β + e, (7) e with where β = vec(B T ) ∈ ℜpq×1 , y = vec(Y T ) ∈ ℜnq×1 , and e = vec(E T ) ∼ Nnq (0, Σ) e = diag(Σ, . . . , Σ). Multiplying both sides of (7) by Σ e −1/2 yields ye = Xβ e + ee where ye = Σ e −1/2 y, Σ e =Σ e −1/2 (X ⊗ A) and ee = Σ e −1/2 e ∼ Nnq (0, Inq ). Thus, the full conditional distribution β | − ∼ X −1 ) with Λ = diag(λ2 τ 2 , . . . , λ2 τ 2 , . . . , λ2 τ 2 , . . . , λ2 τ 2 ). e T X+Λ e e T e, Ω−1 ), where ΩB = (X Npq (Ω−1 pq q p1 1 1q q 11 1 B X y B Naively sampling from the full conditional of β has complexity O(p3 q 3 ) which becomes highly expensive for moderate values of p and q. Bhattacharya et al. (2016a) recently developed an algorithm to sample from a class of structured multivariate normal distributions whose complexity scales linearly in the ambient dimension. We adapt the algorithm in Bhattacharya et al. (2016a) as follows: (i) Sample u ∼ N(0, Λ) and δ ∼ N(0, Inq ) independently. e + δ. (ii) Set v = Xu e X e T + Inq )w = (ỹ − v) to obtain w. (iii) Solve (XΛ e T w. (iv) Set β = u + ΛX It follows from Bhattacharya et al. (2016a) that β obtained from steps (i) - (iv) above produce a sample from the desired full conditional distribution. One only requires matrix multiplications and linear system solvers to implement the above algorithm, and no matrix decomposition is required. It follows from standard results (Golub & van Loan, 1996) that the above steps have a combined complexity of O(q 3 max{n2 , p}), a substantial improvement over O(p3 q 3 ) when p ≫ max{n, q}. Step 2. To sample A | −, once again vectorize Y = XBAT + E, but this time use the equality of the first and the third terms in (6) to obtain, y = (XB ⊗ Iq )a + e, where e and y are the same as in step 1, and a = vec(A) ∈ ℜq (8) 2 ×1 . The full conditional posterior T e −1/2 (XB ⊗ Iq2 ) and e, Ω−1 distribution a | − ∼ N(Ω−1 A ), where ΩA = (X∗ X∗ + Iq 2 ), X∗ = Σ A X∗ y 8 e −1/2 y. To sample from the full conditional of a, we use the algorithm from §3.1.2 of Rue ye = Σ (2001). Compute the Cholesky decomposition (X∗T X∗ + Iq2 ) = LLT . Solve the system of equations: Lv = X∗T ỹ, LT m = v, and LT w = z, where z ∼ N(0, Iq2 ). Finally obtain a sample as a = m + w. Step 3. To sample σh2 | −, observe that σh2 | − ∼ inverse-Gamma(n/2, Sh /2) independently across h, where Sh = {Yh − (XBAT )h }T {Yh − (XBAT )h }, with Φh denoting the hth column of a matrix Φ. Step 4. The global and local scale parameters λjh ’s and τh ’s have independent conditional posteriors across j and h, which can be sampled via a slice sampling scheme provided in the online supplement to Polson et al. (2014). We illustrate the sampling technique for a generic local shrinkage parameter λjh ; a similar scheme works for τh . Setting ηjh = λ−2 jh , the slice sampler proceeds by sampling ujh | ηjh ∼ Unif(0, 1/(1 + ηjh )) and then sampling ηjh | ujh ∼ Exp(2τh2 /b2jh )I{ηjh < (1 − ujh )/ujh }, a truncated exponential distribution. The Gibbs sampler above can be trivially modified to accommodate non-diagonal Σ. Steps 1-2 do not assume any structure for Σ. The matrix Σ−1/2 can be computed in O(q 3 ) steps using standard algorithms, which does not increase the overall complexity of steps 1 and 2 since since q < n ≪ p by assumption. Step 3 will change depending on the prior on Σ; for example, a conjugate update is retained under an inverse-Wishart prior on Σ. Modifications to situations where Σ has a graphical/factor model structure is also straightforward. Point estimates of C, such as the posterior mean, or element-wise posterior median, are readily obtained from the Gibbs sampler along with a natural uncertainty quantification, which can be used for point and interval predictions. However, the continuous nature of our prior implies that such point estimates will be non-sparse and full rank with probability one, and hence not directly amenable for variable selection and rank estimation. Motivated by our concentration result in Theorem 2.6 that the posterior mean XC increasingly concentrates around XC0 , we propose two simple post-processing schemes for variable selection and rank estimation below. The procedures are completely automated and do not involve any input of tuning parameters from the user’s end. 9 3.1 Post processing for variable selection bR for C as the solution to We first focus on variable selection. We define a row-sparse estimate C the optimization problem   p X (j) 2 b µj kΓ k2 , CR = arg min kXC − XΓkF + Γ∈ℜp×q (9) j=1 where Φ(j) represents the j th row of a matrix Φ, and the µj s are predictor specific regularization parameters. The objective function aims to find a row-sparse solution close to the posterior mean in terms of the prediction loss, with the sparsity driven by the group lasso penalty (Yuan & Lin, 2006). For a derivation of the objective function in (9) from a utility function perspective as in Hahn & Carvalho (2015), refer to the Appendix. To solve (9), we set the sub-gradient of (9) with respect to Γ(j) to zero and replace kΓ(j) k by a data dependent quantity to obtain the soft thresholding estimate, ! 1 µ (j) j b = C 1− XjT Rj , R XjT Xj 2kXjT Rj k (10) + where for x ∈ ℜ, x+ = max(x, 0), and Rj is the residual matrix obtained after regressing XC on X P b (k) . For practical implementation, we use C leaving out the j th predictor, Rj = XC − k6=j Xk C R as our initial estimate and make a single pass through each variable to update the initial estimate according to (10). With this initial choice, Rj = Xj C (j) and kXjT Rj k = kXj k2 kC j k. Derivation of (10) is deferred to the Appendix. While the p tuning parameters µj can be chosen by cross-validation, the computational cost explodes with p to search over a grid in p dimensions. Exploiting the presence of an optimal initial estimate in the form of C, we recommend default choices for the hyperparameters as µ bj = 1/kC j k−2 . (j) When predictor j is not important, the minimax ℓ2 -risk for estimating C0 kC (j) is (log q)/n, so that k ≍ (log q)/n. Since kXj k2 ≍ n by assumption, µ bj /kXjT Rj k ≍ n1/2 /(log q)3/2 ≫ 1, implying a strong penalty for all irrelevant predictors. Following Hahn & Carvalho (2015), posterior uncertainty in variable selection can be gauged if necessary by replacing C with the individual posterior samples for C in (9). 10 3.2 Post processing for rank estimation bR , with C bR obtained from (10). To estimate the rank, we threshold the singular values of X C bR . For s1 , . . . , sq In situations where row sparsity is not warranted, C can be used instead of C bR , and a threshold ω > 0, define the thresholded singular values as the singular values of X C νh = sh I(sh > ω) for h = 1, . . . , q. We estimate the rank as the number of nonzero thresholded P P singular values, that is, rb = qh=1 I(νh > 0) = qh=1 I(sh > ω). We use the largest singular value of bR as the default choice of the threshold parameter ω, a natural candidate for the maximum Y − XC noise level in the model. 4 Simulation Results We performed a thorough simulation study to assess the performance of the proposed method across different settings. For all our simulation settings the sample size n was fixed at 100. We considered 3 different (p, q) combinations, (p, q) = (500, 10), (200, 30), (1000, 12). The data were generated from the model Y = XC0 + E. Each row of the matrix E was generated from a multivariate normal distribution with diagonal covariance matrix having diagonal entries uniformly chosen between 0.5 and 1.75. The columns of the design matrix X were independently generated from N(0, ΣX ). We X ), σ X = 1, σ X = 0.5 for i 6= j. The true coefficient considered two cases, ΣX = Ip , and ΣX = (σij jj ij matrix C0 = B∗ AT∗ , with B∗ ∈ ℜp×r0 and A∗ ∈ ℜr×r0 , with the true rank r0 ∈ {3, 5, 7}. The entries of A∗ were independently generated from a standard normal distribution. We generated the entries in the first s = 10 rows of B∗ independently from N(0, 1), and the remaining (p − s) rows were set equal to zero. As a competitor, we considered the sparse partial least squares (SPLS) approach due to Chun & Keleş (2010). Partial least squares minimizes the least square criterion between the response Y and design matrix X in a projected lower dimensional space where the projection direction is chosen to preserve the correlation between Y and X as well as the variation in X. Chun & Keleş (2010) suggested adding lasso type penalties while optimizing for the projection vectors for sparse high dimensional problems. Since SPLS returns a coefficient matrix which is both row sparse and rank bRR from C bR for a fair comparison. Recalling that C bR reduced, we create a rank reduced matrix C bR . Trunhas zero rows, let SbR denote the sub-matrix corresponding to the non-zero rows of C 11 cate the singular value decomposition of SbR to the first rb terms as obtained in §3.2. Insert back bR in the resulting matrix to obtain C bRR . Clearly, C bRR ∈ ℜp×q the zero rows corresponding to C bRR as the Bayesian sparse so created is row sparse and has rank at most rb; we shall refer to C multi-task learner (BSML). Matlab implementation of the proposed method can be found online at www.stat.tamu.edu/ antik/software.html. b of C, we consider the mean square error, MSE = kC b − C0 k2 /(pq), and For an estimator C F b − XC0 k2 /(nq) to measure its performance. The the mean square prediction error, MSPE = kX C F bRR for different settings are reported in squared estimation and prediction errors of SPLS and C table 1 along with the estimates of rank. In our simulations we used the default 10 fold cross validation in the cv.spls function from the R package spls. The SPLS estimator of the rank is the one for which the minimum cross validation error is achieved. We observed highly accurate estimates of the rank for the proposed method, whereas SPLS overestimated the rank in all the settings considered. The proposed method also achieved superior performance in terms of the two squared errors, improving upon SPLS by as much as 5 times in some cases. Additionally, we observed that the performance of SPLS deteriorated relative to BSML with increasing number of covariates. In terms of variable selection, both methods had specificity and sensitivity both close to one in all the simulation settings listed in table 1. Since SPLS consistently overestimated the rank, we further investigated the effect of the rank on variable selection. We focused on the simulation case (p, q, r0 ) = (1000, 12, 3), and fit both methods with different choices of the postulated rank between 3 and 9. For the proposed method, we set q ∗ in §2.1 to be the postulated rank, that is, considered B ∈ ℜp×q and A ∈ ℜq×q for q ∗ ∈ {3, . . . , 9}. For SPLS, we simply input q ∗ as the number of ∗ ∗ hidden components inside the function spls. Figure 1 plots the sensitivity and specificity of BSML and SPLS as a function of the postulated rank. While the specificity is robust for either method, the sensitivity of SPLS turned out to be highly dependent on the rank. The left panel of figure 1 reveals that at the true rank, SPLS only identifies 40% of the significant variables, and only achieves a similar sensitivity as BSML when the postulated rank is substantially overfitted. BSML, on the other hand, exhibits a decoupling effect wherein the overfitting of the rank does not impact the variable selection performance. We conclude this section with a simulation experiment carried out in a correlated response 12 setting. Keeping the true rank r0 fixed at 3, the data were generated similarly as before except that the individual rows ei of the matrix E was generated from N(0, Σ), with Σii = 1, Σij = 0.5, 1 ≤ i 6= j ≤ p. To accommodate the non-diagonal error covariance, we placed a inverseWishart(q, Iq ) prior on Σ. An associate editor pointed out the recent article (Ruffieux et al., 2017) which used spike-slab priors on the coefficients in a multiple response regression setting. They implemented a variational algorithm to posterior inclusion probabilities of each covariate, which is available from the R package locus. To select a model using the posterior inclusion probabilities, we used the median probability model (Barbieri & Berger, 2004); predictors with a posterior inclusion probability less than 0.5 were deemed irrelevant. We implemented their procedure with the prior average number of predictors to be included in the model conservatively set to 25 which worked favorably for their procedure. We observed a fair degree of sensitivity to this parameter, which when set to the true value 10, resulted in comparatively poor performance. Table 2 reports sensitivity and specificity of this procedure and ours, averaged over 50 replicates. While the two methods performed almost identically in the relatively low dimensional setting (p, q) = (200, 30), BSML consistently outperformed Ruffieux et al. (2017) when the dimension was higher. Table 1: Estimation and predictive performance of the proposed method (BSML) versus SPLS across different simulation settings. We report the average estimated rank (r̂), Mean Square Error, MSE (×10−4 ) and Mean Square Predictive Error, MSPE, across 50 replications. For each setting the true number of signals were 10 and sample size was 100. For each combination of (p, q, r0 ) the columns of the design matrix were generated from N(0, ΣX ). Two different choices of ΣX was X ),σ X = 1,σ X = 0.5 for i 6= j (correlated). The considered. ΣX = Ip (independent) and ΣX = (σij jj ij method achieving superior performance for each setting is highlighted in bold. Rank 3 (p,q) (200,30) (500,10) (1000,12) Independent Correlated Independent Correlated Independent Correlated Measures BSML SPLS BSML SPLS BSML SPLS BSML SPLS BSML SPLS BSML SPLS r̂ 3.0 7.9 3.0 9.4 3.0 9.7 3.0 8.8 3.2 9.4 3.4 8.9 MSE 3 14 5 15 3 7 5 30 3 50 3 38 MSPE 0.07 0.25 0.06 0.17 0.22 0.15 0.34 0.21 0.35 4.19 0.30 1.51 5 r̂ MSE MSPE 5 5 0.11 9.7 69 3.8 4.9 9 0.09 12.2 61 4.6 4.9 3 0.17 9.9 10 0.41 4.8 6 0.20 9.8 24 0.38 5.1 2 0.32 9.9 108 9.54 5.1 4 0.32 9.9 129 4.63 7 r̂ MSE MSPE 6.9 6 0.12 10.3 116 10.81 6.9 10 0.11 15.8 112 9.01 6.8 3 0.16 10 20 0.72 6.7 5 0.16 9.7 49 0.92 6.8 2 0.32 10.2 195 16.70 6.6 4 0.31 11.5 261 7.44 13 0.4 Specificity 0.6 0.8 Sensitivity 0.6 0.8 1.0 1.0 Figure 1: Average sensitivity and specificity across 50 replicates is plotted for different choices of the postulated rank. Here (p, q, r0 ) = (1000, 12, 3). Values for BSML (SPLS) are in bold (dashed). 3 4 5 6 7 Postulated rank 8 BSML SPLS 0.4 BSML SPLS 9 3 4 5 6 7 Postulated rank 8 9 Table 2: Variable selection performance of the proposed method in a non-diagonal error structure setting; ei ∼ Σ, σii = 1, σij = 0.5. Sensitivity and specificity of BSML is compared with Ruffieux et al. (2017). BSML r0 = 3 5 Ruffieux et al. (2017) (p, q) Measure Independent Correlated Independent Correlated (200,30) Sensitivity Specificity 1 0.90 1 0.84 0.96 0.77 0.87 0.67 (500,10) Sensitivity Specificity 1 0.99 0.99 0.99 0.9 0.80 0.8 0.64 (1000,12) Sensitivity Specificity 0.99 0.99 0.99 0.99 0.92 0.80 0.63 0.64 Yeast Cell Cycle Data Identifying transcription factors which are responsible for cell cycle regulation is an important scientific problem (Chun & Keleş, 2010). The yeast cell cycle data from Spellman et al. (1998) contains information from three different experiments on mRNA levels of 800 genes on an αfactor based experiment. The response variable is the amount of transcription (mRNA) which was measured every 7 minutes in a period of 119 minutes, a total of 18 measurements (Y ) covering two 14 cell cycle periods. The ChIP-chip data from Lee et al. (2002) on chromatin immunoprecipitation contains the binding information of the 800 genes for 106 transcription factors (X). We analyze this data available publicly from the R package spls which has the above information completed for 542 genes. The yeast cell cycle data was also analyzed in Chen & Huang (2012) via sparse reduced rank regression (SRRR). Scientifically 21 transcription factors of the 106 were verified by Wang et al. (2007) to be responsible for cell cycle regulation. The proposed BSML procedure identified 33 transcription factors. Corresponding numbers for SPLS and SRRR were 48 and 69 respectively. Of the 21 verified transcription factors, the proposed method selected 14, whereas SPLS and SRRR selected 14 and 16 respectively. 10 additional transcription factors that regulate cell cycle were identified by Lee et al. (2002), out of which 3 transcription factors were selected by our proposed method. Figure 2 plots the posterior mean, bRR , and 95 % symmetric pointwise credible intervals for two common effects BSML estimate C ACE2 and SW14 which are identified by all the methods. Similar periodic pattern of the estimated effects are observed as well for all the other two methods in contention, perhaps unsurprisingly due to the two cell cycles during which the mRNA measurements were taken. Similar plots for the remaining 19 effects identified by our method are placed inside the supplemental document. The proposed automatic rank detection technique estimated a rank of 1 which is significantly bR showed a significant drop different from SRRR (4) and SPLS (8). The singular values of Y − X C in magnitude after the first four values which agrees with the findings in Chen & Huang (2012). The 10-fold cross validation error with a postulated rank of 4 for BSML was 0.009 and that of SPLS was 0.19. We repeated the entire analysis with a non-diagonal Σ, which was assigned an inverse-Wishart prior. No changes in the identification of transcription factors or rank estimation were detected. 15 20 40 60 80 0.05 −0.05 Estimated effect 0 −0.15 0.05 −0.05 −0.15 Estimated effect 0.15 SWI4 0.15 ACE2 100 120 0 20 40 60 80 100 120 Figure 2: Estimated effects of ACE2 and SWI4, two of 33 transcription factors with non-zero effects on cell cycle regulation. Both have been scientifically verified by Wang et al. (2007). Dotted lines correspond to 95% posterior symmetric credible intervals, bold lines represent the posterior mean bRR . and the dashed lines plot values of the BSML estimate C Appendix Proof of theorem 2.6 (n) Proof. For C ∈ ℜp×q , we write pC to denote the density of Y |X which is proportional to e−α tr{(Y −XC)(Y −XC) }/2 . For any C ∗ ∈ ℜp×q we define a ǫ-neighborhood as,   Z Z (n) (n) (n) 2 (n) 2 n 2 (n) (n) ∗ p×q n Bn (C , ǫ) = C ∈ ℜ : pC ∗ log(pC ∗ /pC )dµ ≤ nǫ , pC ∗ log (pC ∗ /pC )dµ ≤ nǫ , T (11) and finally we let the Rényi divergence of order α as, Dα(n) (C, C0 ) = (n) (n) Dα(n) (pC , pC0 ) 1 log = α−1 Z (n) (n) {pC }α {pC0 }1−α dµ(n) (12) (n) We start by characterizing Bn (C0 , ǫ) and Dα (C, C0 ) in terms of X and C. It is easy to observe n o 1 that B(C0 , ǫ) ⊃ A(C0 , ǫ) = C ∈ ℜp×q : nq kXC − XC0 k2F ≤ ǫ2 for all ǫ > 0. We also have, Dα(n) (C, C0 ) = α kXC − XC0 k2F . 2 We now provide an upper bound to the mean prediction error kXC − XC0 k2F . We have, kX(C − C0 )k2F ≤ kXk2F kC − C0 k2F ≤ q max kXj k2 kC − C0 k2F = nqkC − C0 k2F , 1≤j≤p where the first inequality follows from the Cauchy-Schwartz inequality and the last equality holds due to assumption 5, for a sufficiently large n. 16 We proceed with a prior concentration result on Bn (C0 , ǫn ) with ǫn = {(qr0 + r0 s log p)/n}1/2 .  We prove in Lemma S4 in the supplemental document that ΠC (Bn ) ≥ ΠC (An ) ≥ ΠC C : kC − C0 k2F ≤ ǫ2n /M ≥ 2 e−Knǫn for some positive constant K. The statement of the theorem then follows from Theorem 3.2 of Bhattacharya, Pati, Yang (2016). Derivation of (9) Suppose Y ∗ ∈ ℜn×q be n future observations with design points X so that given C, Y ∗ can be decomposed into Y ∗ = XC + E ∗ where E ∗ has the same distribution as E in (1). We define the utility function in terms of loss of predicting these n new future observations. To encourage sparsity in rows of a coefficient matrix Γ that balances the prediction we add a group lasso penalty (Yuan & Lin, 2006) to this utility function. We define the utility function as, L(Y ∗ , Γ) = kY ∗ − XΓk2F + p X j=1 µj kΓ(j) k2 (13) where the p tuning parameters {µj }pj=1 control the penalty for selecting each predictor variable and Φ(j) represents the j th row of any matrix Φ. Intuitively we want µj to be small if the j th predictor is important and vice versa. The expected risk, E{L(Y ∗ , Γ)}, after integrating over the space of all such future observations given C and Σ, is L(Γ, C, Σ) = q tr(Σ) + kXC − XΓk2F + p X j=1 µj kΓ(j) k2 . (14) Finally we take expectation of this quantity with respect to π(C, Σ | Y, X) and drop the constant terms to obtain (9). Derivation of (10) We let Φj and Φ(j) denote the j th column and row of a generic matrix Φ. Using the subgradient of (9) with respect to Γ(j) (Friedman et al., 2007), we have 2XjT (XΓ − XC) + µj αj = 0, j = 1, . . . , p, (15) where αj = Γ(j) /kΓ(j) k if kΓ(j) k = 6 0 and kαj k < 1 when kΓ(j) k = 0. For Γ(j) = 0 we can P rewrite (15) as, 2XjT ( k6=j Xk Γ(k) − XC) + µj αj = 0 which imply that αj = −2XjT Rj /µj , where Rj is the residual matrix obtained after regressing XC on X leaving out the j th predictor, Rj = 17 XC − P k6=j Xk Γ(k) . We can use this to set Γ(j) to zero: if αj < 1 set Γ(j) = 0. Otherwise we have 2XjT (Xj Γ(j) − Rj ) + µj Γj /kΓ(j) k = 0. Solving for Γ(j) in the above equation we then get, Γ (j) =  µj Xj Xj + 2kΓ(j) k T −1 XjT Rj . (16) This solution is dependent on the unknown quantity || Γ(j) ||. However, taking norm on both sides in (16) we get a value of kΓ(j) k which does not involve any unknown quantities: kΓ(j) k = (kXjT Rj k−   µj /2)/XjT Xj . Substituting this in (16) we get, Γ(j) = (XjT Xj )−1 1 − µj /2kXjT Rj k XjT Rj . Finally, combining the case when Γ(j) = 0, we have (10). References Alquier, P. (2013). Bayesian methods for low-rank matrix estimation: Short survey and theoretical study. In Algorithmic Learning Theory. Springer. Anderson, T. (1984). Multivariate statistical analysis. Willey and Sons, New York, NY . Anderson, T. (2002). Specification and misspecification in reduced rank regression. Sankhyā: The Indian Journal of Statistics, Series A , 193–205. Anderson, T. W. (1951). Estimating linear restrictions on regression coefficients for multivariate normal distributions. The Annals of Mathematical Statistics , 327–351. Armagan, A., Dunson, D. B., Lee, J., Bajwa, W. U. & Strawn, N. (2013). Posterior consistency in linear models under shrinkage priors. Biometrika 100, 1011–1018. Babacan, S. D., Molina, R. & Katsaggelos, A. K. (2011). Variational Bayesian super resolution. IEEE Transactions on Image Processing 20, 984–999. Barbieri, M. M. & Berger, J. O. (2004). Optimal predictive model selection. The Annals of Statistics 32, 870–897. Bhadra, A. & Mallick, B. K. (2013). Joint high-dimensional bayesian variable and covariance selection with an application to eqtl analysis. Biometrics 69, 447–457. Bhattacharya, A., Chakraborty, A. & Mallick, B. K. (2016a). Fast sampling with gaussian scale mixture priors in high-dimensional regression. Biometrika 103, 985–991. 18 Bhattacharya, A. & Dunson, D. (2011). Sparse Bayesian infinite factor models. Biometrika 98, 291–306. Bhattacharya, A., Dunson, D. B., Pati, D. & Pillai, N. S. (2016b). Sub-optimality of some continuous shrinkage priors. Stochastic Processes and their Applications 126, 3828 – 3842. In Memoriam: Evarist Giné. Bhattacharya, A., Pati, D. & Yang, Y. (2016c). Bayesian fractional posteriors. arXiv preprint arXiv:1611.01125 . Bondell, H. D. & Reich, B. J. (2012). Consistent high-dimensional Bayesian variable selection via penalized credible regions. Journal of the American Statistical Association 107, 1610–1624. Brown, P. J., Vannucci, M. & Fearn, T. (1998). Multivariate Bayesian variable selection and prediction. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 60, 627–641. Bunea, F., She, Y. & Wegkamp, M. H. (2011). Optimal selection of reduced rank estimators of high-dimensional matrices. The Annals of Statistics 39, 1282–1309. Bunea, F., She, Y., Wegkamp, M. H. et al. (2012). Joint variable and rank selection for parsimonious estimation of high-dimensional matrices. The Annals of Statistics 40, 2359–2388. Carvalho, C., Polson, N. & Scott, J. (2010). The horseshoe estimator for sparse signals. Biometrika 97, 465–480. Chen, K., Dong, H. & Chan, K.-S. (2013). Reduced rank regression via adaptive nuclear norm penalization. Biometrika 100, 901–920. Chen, L. & Huang, J. Z. (2012). Sparse reduced-rank regression for simultaneous dimension reduction and variable selection. Journal of the American Statistical Association 107, 1533– 1545. Chun, H. & Keleş, S. (2010). Sparse partial least squares regression for simultaneous dimension reduction and variable selection. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 72, 3–25. 19 Friedman, J., Hastie, T., Höfling, H. & Tibshirani, R. (2007). Pathwise coordinate optimization. The Annals of Applied Statistics 1, 302–332. George, E. I. & McCulloch, R. E. (1993). Variable selection via Gibbs sampling. Journal of the American Statistical Association 88, 881–889. Geweke, J. (1996). Bayesian reduced rank regression in econometrics. Journal of econometrics 75, 121–146. Ghosal, S., Ghosh, J. K. & van der Vaart, A. W. (2000). Convergence rates of posterior distributions. The Annals of Statistics 28, 500–531. Ghosh, P. & Chakrabarti, A. (2017). Asymptotic optimality of one-group shrinkage priors in sparse high-dimensional problems. Bayesian Analysis To appear. Golub, G. H. & van Loan, C. F. (1996). Matrix Computations. John Hopkins University Press, 3rd ed. Green, P. J. (1995). Reversible jump Markov chain Monte Carlo computation and Bayesian model determination. Biometrika 82, 711–732. Hahn, P. R. & Carvalho, C. M. (2015). Decoupling shrinkage and selection in Bayesian linear models: a posterior summary perspective. Journal of the American Statistical Association 110, 435–448. Hoff, P. (2009). Simulation of the matrix Bingham-von Mises-Fisher distribution, with applications to multivariate and relational data. Journal of Computational and Graphical Statistics 18, 438–456. Izenman, A. J. (1975). Reduced-rank regression for the multivariate linear model. Journal of Multivariate Analysis 5, 248–264. Kundu, S., Baladandayuthapani, V. & Mallick, B. K. (2013). Bayes regularized graphical model estimation in high dimensions. arXiv preprint arXiv:1308.3915 . 20 Lee, T. I., Rinaldi, N. J., Robert, F., Odom, D. T., Bar-Joseph, Z., Gerber, G. K., Hannett, N. M., Harbison, C. T., Thompson, C. M., Simon, I. et al. (2002). Transcriptional regulatory networks in saccharomyces cerevisiae. Science 298, 799–804. Lim, Y. J. & Teh, Y. W. (2007). Variational Bayesian approach to movie rating prediction. In Proceedings of KDD cup and workshop, vol. 7. Citeseer. Liu, J. S. & Wu, Y. N. (1999). Parameter expansion for data augmentation. Journal of the American Statistical Association 94, 1264–1274. Lopes, H. F. & West, M. (2004). Bayesian model assessment in factor analysis. Statistica Sinica , 41–67. Lucas, J., Carvalho, C., Wang, Q., Bild, A., Nevins, J. & West, M. (2006). Sparse statistical modelling in gene expression genomics. Bayesian Inference for Gene Expression and Proteomics 1, 0–1. Pati, D., Bhattacharya, A., Pillai, N. S., Dunson, D. et al. (2014). Posterior contraction in sparse Bayesian factor models for massive covariance matrices. The Annals of Statistics 42, 1102–1130. Polson, N. G. & Scott, J. G. (2010). Shrink globally, act locally: sparse Bayesian regularization and prediction. Bayesian Statistics 9, 501–538. Polson, N. G., Scott, J. G. & Windle, J. (2014). The Bayesian bridge. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 76, 713–733. Rue, H. (2001). Fast sampling of gaussian markov random fields. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 63, 325–338. Ruffieux, H., Davison, A. C., Hager, J. & Irincheeva, I. (2017). Efficient inference for genetic association studies with multiple outcomes. Biostatistics , To appear. Salakhutdinov, R. & Mnih, A. (2008). Bayesian probabilistic matrix factorization using markov chain monte carlo. In Proceedings of the 25th international conference on Machine learning. ACM. 21 Scott, J. G., Berger, J. O. et al. (2010). Bayes and empirical-Bayes multiplicity adjustment in the variable-selection problem. The Annals of Statistics 38, 2587–2619. Spellman, P. T., Sherlock, G., Zhang, M. Q., Iyer, V. R., Anders, K., Eisen, M. B., Brown, P. O., Botstein, D. & Futcher, B. (1998). Comprehensive identification of cell cycle–regulated genes of the yeast saccharomyces cerevisiae by microarray hybridization. Molecular biology of the cell 9, 3273–3297. van der Pas, S., Kleijn, B. & van der Vaart, A. (2014). The horseshoe estimator: Posterior concentration around nearly black vectors. Electronic Journal of Statistics 8, 2585–2618. Velu, R. & Reinsel, G. C. (2013). Multivariate reduced-rank regression: theory and applications, vol. 136. Springer Science & Business Media. Vershynin, R. (2010). Introduction to the non-asymptotic analysis of random matrices. arXiv preprint arXiv:1011.3027 . Wang, H. (2010). Sparse seemingly unrelated regression modelling: Applications in finance and econometrics. Computational Statistics & Data Analysis 54, 2866–2877. Wang, L., Chen, G. & Li, H. (2007). Group scad regression analysis for microarray time course gene expression data. Bioinformatics 23, 1486–1494. Yuan, M., Ekici, A., Lu, Z. & Monteiro, R. (2007). Dimension reduction and coefficient estimation in multivariate linear regression. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 69, 329–346. Yuan, M. & Lin, Y. (2006). Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 68, 49–67. 22 Supplementary material Antik Chakraborty Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Anirban Bhattacharya Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Bani K. Mallick Department of Statistics, Texas A&M University, College Station 3143 TAMU, TX 77843-3143, USA [email protected] Convention Equations defined in this document are numbered (S1), (S2) etc, while (1), (2) etc refer to those defined in the main document. Similar for lemma, theorems etc. S.1 Proof of theorem 2.6 We establish few results in the following sequence of lemmas needed to prove Theorem 1. Recall Ca+ (0, 1) denotes the half-Cauchy distribution with density proportional to (1 + t2 )−1 1(0,∞) (t). For a vector β ∈ ℜp , let ΠHS denote the prior on β defined by the hierarchy, βj | λj , τ ∼ N(0, λ2j τ 2 ), λj ∼ Ca+ (0, 1), (j = 1, . . . , p) (j = 1, . . . , p) (S.1) τ ∼ Ca+ (0, 1). We first state a novel prior concentration result for the horseshoe prior which bounds from below the probability assigned to an Euclidean neighborhood of a sparse vector. 1 Lemma S.1.1. Suppose β0 ∈ l0 [s; p] where l0 [s; p] = {β0 ∈ ℜp : #(1 ≤ j < p : β0j 6= 0) ≤ s}. Let S = {j : β0j 6= 0} so that |S| ≤ s. Assume s = o(p) and log p/n ≤ γ for some γ ∈ (0, 1) and max | β0j |≤ M for some M > 0 and for j ∈ S. Suppose β ∼ ΠHS . Define δ = {(s log p)/n}1/2 . Then we have, for some positive constant K, ΠHS (kβ − β0 k2 < δ) ≥ e−Ks log p . Proof. Using the conditional formulation of prior (S.1) we have, Z ΠHS (kβ − β0 k2 < δ) = pr(kβ − β0 k2 < δ | τ )f (τ )dτ Zτ pr(kβ − β0 k2 < δ | τ )f (τ )dτ, ≥ (S.2) I τ∗ where Iτ∗ = [τ∗ /2, τ∗ ] with τ∗ = (s/p)3/2 (log p/n)1/2 . We first provide lower bound of the conditional probability pr(kβ − β0 k2 < δ | τ ∈ Iτ∗ ) by dividing it into two terms and providing lower bounds for each of them. For τ ∈ Iτ ∗ we have,     δ δ pr(kβ − β0 k < δ | τ ) ≥ pr kβS − β0S k2 < | τ pr kβS c k2 < | τ 2 2   Y Y  δ δ ≥ pr |βj − β0j | < √ | τ pr |βj | < √ | τ 2 p 2 s j∈S j∈S c s     p−s δ δ pr |βj | < √ | τ = pr |βj − β0j | < √ | τ . 2 s 2 p (S.3) √ √ √ We proceed with pr(|βj | < δ/2 p | τ ) for τ ∈ Iτ ∗ . We have, with R = 1/ 2π 3 and δ∗ = δ/2 p, ! Z R δ∗ 4τ 2 pr(|βj | < δ∗ | τ ) ≥ log 1 + 2 dβj 2τ −δ∗ βj ! Z δ∗ Z R R δ∗ 4τ 2 /βj2 4τ 2 = dβj log 1 + 2 dβj ≥ τ 0 τ 0 1 + 4τ 2 /βj2 βj Z δ∗ 1 δ∗ dβj = 2K arctan = 4Rτ 2 2 2τ βj + 4τ 0       π 2τ π 2τ∗ 4s ≥ 2R − − ≥R = Rπ 1 − , 2 δ∗ 2 δ∗ πp where we have used the inequalities log(1 + x) ≥ x/(x + 1) for x > −1 and arctan x > (π/2 − 1/x) in succession. 2 For pr(| βj − β0j |< δ0 |τ ) with τ ∈ Iτ∗ , we have, letting δ0 = 2−1 {(log p)/n}1/2 , Z Z √ 1 dλj dβj exp{−βj2 /(2λ2j τ 2 )} pr(| βj − β0j |< δ0 | τ ) = 2π −3/2 λj τ (1 + λ2j ) λj |βj −β0 |<δ0 Z 4/τ∗ √ −3/2 Z 1 ≥ 2π dλj dβj exp{−βj2 /(2λ2j τ 2 )} λj τ (1 + λ2j ) |βj −β0 |<δ0 1/τ∗ Z 4/τ∗ Z 1 ≥ (2π)−3/2 exp(−βj2 /2) 2 dλj dβj , 1/τ∗ 1 + λj |βj −β0 |<δ0 since for λj ∈ [1/τ∗ , 4/τ∗ ], 1/λj τ ≥ 1/4 and exp{−βj2 /(2λ2j τ 2 )} ≥ exp (−βj2 /2). Continuing, Z −3/2 3τ∗ pr(| βj − β0j |< δ0 | τ ) ≥ (2π) exp (−βj2 /2)dβj 16 + τ∗2 |βj −β0 |<δ0 3τ∗ ≥ (2π)−3/2 exp{−(M + 1)2 /2}δ0 16 + τ∗2  3/2 log p s , ≈ K∗ p n for some positive constant K∗ . Substituting these bounds in S.3, we have, pr(kβ − β0 k < δ | τ ∈ Iτ∗ ) ≥ e−Ks log p , (S.4) where K is a positive constant. The proof is completed upon observing that pr(τ ∈ Iτ∗ ) ≈ τ∗ /2, so that with a slight abuse of notation we get, ΠHS (kβ − β0 k < δ) ≥ e−Ks log p , (S.5) for some positive constant K. Recall the prior ΠB from the main document. If a matrix B ∈ ℜp×q ∼ ΠB then each column of B is a draw from ΠHS In the following Lemma we generalize Lemma S.1.1 to provide a lower bound on the probability the prior ΠB assigns to Frobenius neighborhoods of B0 ∈ ℜp×r0 . By assumption 3 the h-th column of B0 , bh ∈ l0 [s; p]. In order to make the Frobenius neighborhood well defined we append (q − r0 ) zero columns to the right of B0 and set B0∗ = (B0 | Op×(q−r0 ) ). Lemma S.1.2. Let the entries of B0∗ ∈ ℜp×q satisfy max | B0∗ |≤ M for some positive constant M . Suppose B is a draw from ΠB . Define δB = {(r0 s log p)/n}1/2 . Then for some positive constant K we have, ΠB (kB − B0∗ kF < δB ) ≥ e−Kr0 s log p . 3 Proof. Observe that, since by assumption 3, r0 = κq for some κ ∈ (0, 1], ΠB (kB − B0∗ kF < δB ) ≥ = = = q Y h=1 r0 Y h=1 r0 Y h=1  q Y h=1   ΠHS kbh − b0h k2 < q −1/2 δB 1/2 ΠHS kbh − b0h k2 < α{(s log p)/n}  1/2 ΠHS kbh − b0h k2 < α{(s log p)/n}  1/2 ΠHS kbh − b0h k2 < α{(s log p)/n}   Y q h=r0 +1  Y q h=r0 +1  1/2 ΠHS kbh − b0h k2 < α{(s log p)/n}  1/2 ΠHS kbh k2 < α{(s log p)/n}   . From Lemma S.1.1 we have, ΠHS [kbh − b0h k2 < α{(s log p)/n}1/2 ] ≥ e−K1 s log p . Arguments along  the same line of lemma S.1.1 can also be applied to obtain that, ΠHS kbh k2 < α{(log p)/n}1/2 ≥ e−K2 log p for some positive K2 . Combining these two lower bounds in the above display we have, ΠB (kB − B0 kF < δB ) ≥ e−K1 r0 s log p e−K2 (q−r0 ) log p . Since r0 = κq, the result follows immediately with K = K1 + (1/κ − 1)K2 . Similar to the previous lemma, the following result provides a lower bound on the probability assigned to Frobenius neighborhoods of A0 by the prior ΠA . Again we append (q − r0 ) columns at the right of A0 and set A0∗ = (A0 | Oq×(q−r0 ) ). Lemma S.1.3. Suppose the matrix A ∼ ΠA . Let δA = (qr0 /n)1/2 . Then for some positive constant K we have, ΠA (kA − A0∗ kF < δA ) ≥ e−Kqr0 . Proof. First we use vectorization to obtain ΠA (kA − A0 kF < δA ) = ΠA (ka − a0 k2 < δA ), where 2 a, a0 ∈ ℜq . Using Anderson’s lemma (Bhattacharya et al., 2016b) for multivariate Gaussian distributions, we then have, 2 /2 ΠA (ka − a0 k2 < δA ) ≥ e−ka0 k pr(kak2 < δA /2) = e−r0 /2 pr(kak2 < δA /2). 4 The quantity pr(kak < δA /2) can be bounded from below as, 2 2 2 2 pr(kak2 < δA /2) ≥ {pr(| aj |< δA /q)}q ≥ me−δA (δA /q)q ≈ e−q , where m is a positive constant. Since r0 = κq, it follows that ΠA (kA − A0 kF < δA ) ≥ e−Kqr0 for some positive K. Our final result will concern the prior mass assigned to Frobenius neighborhoods of C ∈ ℜp×q . As in the main document we write ΠC for prior on C = BAT induced from ΠB and ΠA . Lemma S.1.4. Suppose C0 satisfies assumption 3. Let C ∼ ΠC with ΠC as defined above. Define δC = {(qr0 + r0 s log p)/n}1/2 . Then for some positive constant K, ΠC (kC − C0 kF < δC ) ≥ e−K(qr0 +r0 s log p) . Proof. Using the triangle inequality followed by the fact that for two matrices P and Q, kP QkF ≤ smax (P )kQkF where smax (P ) is the largest singular value of P , we have, kC − C0 kF = kBAT − B0 AT0 kF = kBAT − B0 AT + B0 AT − B0 AT0 kF = k(B − B0∗ )AT + B0 (A − A0∗ )T kF ≤ k(B − B0 )AT kF + kB0 (A − A0 )T kF ≤ smax (A)k(B − B0 )kF + smax (B0 )kA − A0 kF , where smax (A) and smax (B0 ) are the largest singular values of A and B0 respectively. From standard random matrix theory it is well known that for a random matrix of dimension m × n with independent Gaussian entries, the largest singular admits a high probability upper bound; for every √ √ t ≥ 0, smax(A) ≤ m + n + t with probability at least 1 − 2 exp (−t2 /2) (Vershynin, 2010). Also since the elements of B0 are bounded, so is smax (B0 ), say by ξ. For a sufficiently large positive √ number L and for A ∈ E = {A : smax (A) ≤ 2 q + L} we then have, √ kC − C0 kF ≤ (2 q + L)kB − B0∗ kF + ξkA − A0 kF . √ Thus we have, ΠC (kC − C0 kF < δC ) ≥ ΠC {(2 q + L)kB − B0 kF + ξkA − A0 kF < δC }. Since δC = {(qr0 + r0 s log p)/n}1/2 ≥ 2−1/2 {(r0 s log p/n)1/2 + (qr0 )1/2 } = 2−1/2 (δB + δA ), the probability 5 ΠC (kC − C0 kF < δC ) ≥ ΠB (kB − B0 kF < m1 δB )ΠA (kA − A0 kF < m2 δA ), where m1 and m2 are positive constants. From lemma S.1.2 it follows that, ΠB (kB − B0 kF < m1 δA ) ≥ e−K1 r0 s log p and from lemma S.1.3 we have, ΠA (kA − A0 kF < m2 δA /β) ≥ e−K2 qr0 . Hence ΠC (E ∩ {C : kC − C0 kF < δC }) ≥ e−K(qr0 +r0 s log p) . Since for two sets E1 and E2 , pr(E1 ∪ E2 ) ≥ pr(E1 ) + pr(E2 ) − 1, the Lemma is proved. Yeast cell cycle data The yeast cell cycle data consists of mRNA measurements Y , measured every 7 minutes in a period of 119 minutes. The covariates X are binding information on 106 transcription factors. When applied to this data, the proposed method identified 33 transcription factors out of 106 that driving the variation in mRNA measurements. 14 of the identified transcription factors are among the 21 scientifically verified (Lee et al., 2002). In the main document we provided estimated effects of two of the 21 scientifically verified transcription factors. Here we plot the estimated effects of the remaining transcriptions factors that were scientifically verified. 6 Figure S3: Estimated effects of the 19 of 21 scientifically verified transcription factors selected by the proposed method. Effects of other two, viz. ACE2 and SWI4 are included in the main manuscript. Red lines correspond to 95% posterior symmetric credible intervals, black lines reprebRR . sent the posterior mean and the blue dashed line plots values of the BSML estimate C 80 120 40 80 120 40 80 120 40 80 120 7 0.06 −0.06 80 120 0.1 0 80 120 0.04 40 STE12 0.3 0.04 0 −0.04 80 120 0 SKN7 0.00 0.00 40 80 120 0 GCR2 0.02 0 REB1 −0.06 −0.02 0 40 −0.02 0.00 40 0 GCR1 −0.04 0 MET31 40 BAS1 −0.04 80 120 0 0.00 0.00 −0.03 40 0.04 0.04 80 120 −0.04 40 0 GCN4 0.00 0.04 0.00 0 80 120 ABF1 40 80 120 LEU3 0.04 80 120 40 0.00 40 0 0 40 80 120 −0.06 0 FKH1 0.00 0.00 80 120 MCM1 0.02 40 −0.1 80 120 STB1 −0.10 0.00 −0.10 0 0.00 40 −0.10 −0.1 0 0.04 −0.04 80 120 NDD1 CBF1 −0.08 40 0.1 0.00 0 0.10 80 120 FKH2 0.2 40 MBP1 0.10 0.15 −0.15 0.0 −0.2 0 −0.15 SWI6 0.00 0.2 SWI5 0 40 80 120
10math.ST
1 Under consideration for publication in Theory and Practice of Logic Programming arXiv:0906.4474v2 [cs.PL] 25 Jun 2009 As Time Goes By: Constraint Handling Rules A Survey of CHR Research from 1998 to 2007 JON SNEYERS, PETER VAN WEERT, TOM SCHRIJVERS, and LESLIE DE KONINCK Dept. of Computer Science, K.U.Leuven, Belgium (e-mail: FirstName.LastName @cs.kuleuven.be) submitted 27 March 2008; revised 9 March 2009; accepted 24 June 2009 Abstract Constraint Handling Rules (CHR) is a high-level programming language based on multiheaded multiset rewrite rules. Originally designed for writing user-defined constraint solvers, it is now recognized as an elegant general purpose language. CHR-related research has surged during the decade following the previous survey by Frühwirth (1998). Covering more than 180 publications, this new survey provides an overview of recent results in a wide range of research areas, from semantics and analysis to systems, extensions and applications. KEYWORDS: Constraint Handling Rules, CHR, survey Contents 1 Introduction 1.1 Historical Overview 1.2 Constraint Handling Rules 2 Semantics 2.1 Logical Semantics 2.2 Operational Semantics 3 Program Analysis 3.1 Confluence 3.2 Termination 3.3 Complexity 4 Systems and Implementation 4.1 Systems 4.2 Compilation 4.3 Programming Environments 5 Extensions and Variants 5.1 Deviating Operational Semantics 5.2 Language Extensions 5.3 Solver Hierarchies 2 2 4 6 7 8 11 11 12 13 14 14 17 21 21 22 23 25 6 Relation to Other Formalisms 6.1 Set-Based Formalisms 6.2 Graph-Based Formalisms 7 Applications 7.1 Constraint Solvers 7.2 Union-Find and Other Classic Algorithms 7.3 Programming Language Development 7.4 Industrial CHR Users 8 Conclusions 8.1 Survey Coverage and Bibliographic Meta-Information 8.2 Retrospection 8.3 Grand Challenges References 25 25 26 27 27 31 31 34 35 35 36 38 39 1 Introduction Constraint Handling Rules (CHR) is a high-level programming language based on multi-headed, committed-choice, guarded multiset rewrite rules. Originally designed in 1991 by Frühwirth (1992; 1995; 1998; 2009) for the special purpose of adding user-defined constraint solvers to a host-language, CHR has matured over the last decade to a powerful and elegant general-purpose language with a wide spectrum of application domains. Its logical semantics and monotonicity properties naturally lead to anytime, online, and concurrent programs. The previous survey on CHR (Frühwirth 1998) was written in 1998. The aim of this paper is to complement that survey by giving an overview of the last decade of CHR-related research. We advise readers that are not yet familiar with CHR to read Frühwirth (1998) first as we have kept the amount of overlap minimal. Overview. We start with a short historical overview of the past 10 years of CHR research, followed by an introduction to the language itself. Section 2 describes the logical and operational semantics; Section 3 covers program analysis topics such as confluence, termination, and complexity. Next, in Section 4, we discuss the different CHR systems and compilation techniques. Extensions and variants of CHR are dealt with in Section 5, while Section 6 discusses the relation between CHR and other formalisms. In Section 7 we give an overview of the many applications of CHR. Finally, Section 8 concludes this survey. 1.1 Historical Overview Early CHR research is performed at the Ludwig Maximilians Universität (LMU) and the European Computer-Industry Research Centre (ECRC), both in Munich, by Frühwirth (who later moves to Ulm) and his students Abdennadher (who later moves to Cairo), Meuss, and Wolf (in Berlin). At the end of the nineties, CHR research focusses on theoretical properties of 2 Fig. 1. CHR research groups all over the world: 1. Ulm, Germany (Frühwirth, Meister, Betz, Djelloul, Raiser, . . . ); 2. Leuven, Belgium (Schrijvers, Demoen, Sneyers, De Koninck, Van Weert, . . . ); 3. Melbourne, Australia (Duck, Stuckey, Garcı́a de la Banda, Wazny, Brand, . . . ); 4. Vienna, Austria (Holzbaur); 5. Berlin, Germany (Wolf); 6. Roskilde, Denmark (Christiansen); 7. Paris, France (Coquery, Fages); 8. Castellón, Spain (Escrig, . . . ); 9. Bologna/Ferrara, Italy (Mello, Lamma, Tacchella, . . . ); 10. Chieti, Italy (Meo, . . . ); 11. Cairo, Egypt (Abdennadher, . . . ); 12. Michigan, USA (Sarna-Starosta); 13. Vancouver, Canada (Dahl); 14. Recife, Brazil (Robin, Vitorino, . . . ); 15. Singapore (Sulzmann, Lam); CHR programs like confluence, completion, operational equivalence, termination, and complexity (Section 3). In the same period, the seminal Holzbaur-Frühwirth CHR system in SICStus Prolog is developed (Holzbaur and Frühwirth 1998; 1999; 2000a) and the first CHR systems in Java are created (Section 4.1.3). Until about 2001, most of the CHR research is still done in Germany and Vienna; other groups are discovering CHR, at first mostly as an implementation language for applications. For instance, Sulzmann et al. use CHR for type systems (Section 7.3.1) and Christiansen and Dahl develop CHR grammars for language processing (Section 7.3.3). Meanwhile, Brand, Monfroy, Abdennadher and Rigotti study the automatic generation of CHR programs (Section 7.1.5). Starting around 2002 there is a strong growth of international research interest in CHR, leading to a series of workshops on CHR (Frühwirth and Meister 2004; Schrijvers and Frühwirth 2005b; Schrijvers and Frühwirth 2006; Djelloul, Duck et al. 2007). Figure 1 gives an (incomplete) overview of the most active CHR research groups all over the world. In 2003 and 2004, the groups in Melbourne and Leuven start working on (static) analysis and optimizing compilation of CHR, culminating in the Ph.D. theses of Duck (2005) and Schrijvers (2005). This work leads to the formulation of the refined operational semantics (Section 2.2.2) and the creation of new, highly optimizing CHR systems (Section 4.2). In Leuven and Brazil, research starts around 2005 on search and Java implementations of CHR (Sections 4.1.3 and 5.2.1), while the Ulm group investigates 3 alternative logical semantics for CHR (Section 2.1). The study of an implementation of the union-find algorithm in CHR leads to a focus on compiler optimizations (Section 4.2.2) and the use of CHR for general-purpose programming (Section 7.2). Recent trends in CHR-related research include the relation between CHR and other formalisms (Section 6), extensions and variants of CHR (Section 5), and a renewed interest in theoretical properties like confluence, termination, and complexity (Section 3). In the context of the NICTA project “G12”, the Melbourne group is currently developing Cadmium, an ACD term rewriting language which extends CHR (Section 6). The Ulm group is currently researching global constraints in the context of the DFG project “GLOBCON”; this work is related to automatic rule generation (Section 7.1.5) and program transformation (Section 4.2.3). 1.2 Constraint Handling Rules To make this survey somewhat self-contained, we briefly introduce the syntax and informal semantics of Constraint Handling Rules. For a gentler introduction to CHR, we refer the reader to Frühwirth (1998), Frühwirth and Abdennadher (2003), Schrijvers (2005), Duck (2005), or Frühwirth (2009). CHR is embedded in a host language H that provides data types and a number of predefined constraints. These constraints are called host language constraints or built-in constraints. The traditional host language of CHR is Prolog. Its only host language constraint is equality of Herbrand terms; its data types are Prolog variables and terms. We denote the host language in which CHR is embedded between round brackets: i.e. CHR(H) denotes CHR embedded in host language H. Most systems are CHR(Prolog) systems, but there are also several implementations of CHR(Java) and CHR(Haskell), and recently a CHR(C) system was developed. A thorough discussion of existing CHR implementations is given in Section 4. We require the host language to provide at least the basic constraints true and fail, and syntactic equality (“==”) and inequality (“\==”) checks. 1.2.1 Syntax CHR constraint symbols are drawn from the set of predicate symbols, denoted by a functor/arity pair. CHR constraints, also called constraint atoms or constraints for short, are atoms constructed from these symbols and the data types provided by the host language. A CHR program P consists of a sequence of CHR rules. There are three kinds of rules: (where l, m, n, o ≥ 1) • Simplification rules: • Propagation rules: • Simpagation rules: h1 , . . . , hn ⇐⇒ g1 , . . . , gm | b1 , . . . , bo . h1 , . . . , hn =⇒ g1 , . . . , gm | b1 , . . . , bo . h1 , . . . , hl \ hl+1 , . . . , hn ⇐⇒ g1 , . . . , gm | b1 , . . . , bo . The sequence, or conjunction, h1 , . . . , hn are CHR constraints; together they are called the head or head constraints of the rule. A rule with n head constraints is called an n-headed rule and when n > 1, it is a multi-headed rule. All the head 4 constraints of a simplification rule and the head constraints hl+1 , . . . , hn of a simpagation rule are called removed head constraints. The other head constraints — all heads of a propagation rule and h1 , . . . , hl of a simpagation rule — are called kept head constraints. The conjunction b1 , . . . , bo consists of CHR constraints and host language constraints; it is called the body of the rule. The part of the rule between the arrow and the body is called the guard. It is a conjunction of host language constraints. The guard “g1 , . . . , gm | ” is optional; if omitted, it is considered to be “true | ”. A rule is optionally preceded by name @ where name is a term. No two rules may have the same name, and rules without an explicit name get a unique name implicitly. For simplicity, both simplification and propagation rules are often treated as special cases of simpagation rules. The following notation is used: Hk \ Hr ⇐⇒ G | B If Hk is empty, then the rule is a simplification rule. If Hr is empty, then the rule is a propagation rule. At least one of Hr and Hk must be non-empty. 1.2.2 Informal Semantics A derivation starts from an initial query: a multiset of constraint atoms, given by the user. This multiset of constraints is called the constraint store. The derivation proceeds by applying the rules of the program, which modify the constraint store. When no more rules can be applied, the derivation ends; the final constraint store is called the solution or solved form. Rules modify the constraint store in the following way. A simplification rule can be considered as a rewrite rule which replaces the left-hand side (the head constraints) with the right-hand side (the body constraints), on the condition that the guard holds. The double arrow indicates that the head is logically equivalent to the body, which justifies the replacement. The intention is that the body is a simpler, or more canonical form of the head. In propagation rules, the body is a consequence of the head: given the head, the body may be added (if the guard holds). Logically, the body is implied by the head so it is redundant. However, adding redundant constraints may allow simplifications later on. Simpagation rules are a hybrid between simplification rules and propagation rules: the constraints before the backslash are kept, while the constraints after the backslash are removed. 1.2.3 Examples The program leq (Fig. 2) is a classic example CHR program to solve less-than-orequal constraints. The first rule, reflexivity, replaces the trivial constraint leq(X,X) by true. Operationally, this entails removing this constraint from the constraint store (the multiset of all known CHR constraints). The second rule, antisymmetry, states that leq(X,Y) and leq(Y,X) are logically equivalent to X = Y. Operationally this means that constraints matching the left-hand side may be removed from the 5 reflexivity antisymmetry idempotence transitivity @ @ @ @ leq(X,X) ⇐⇒ true. leq(X,Y), leq(Y,X) ⇐⇒ X = Y. leq(X,Y) \ leq(X,Y) ⇐⇒ true. leq(X,Y), leq(Y,Z) =⇒ leq(X,Z). Fig. 2. The CHR(Prolog) program leq, a solver for the less-than-or-equal constraint. generate @ upto(N) ⇐⇒ N > 1 | prime(N), upto(N-1). done @ upto(1) ⇐⇒ true. remove nonprime @ prime(A) \ prime(B) ⇐⇒ B mod A = 0 | true. Fig. 3. The CHR program primes, a prime number sieve. store, after which the Prolog built-in equality constraint solver is used to unify X and Y. The third rule, idempotence, removes redundant copies of the same leq/2 constraint. It is necessary to do this explicitly since CHR has multiset semantics. The last rule, transitivity, is a propagation rule that computes the transitive closure of the leq/2 relation. An example derivation could be as follows: (transitivity) (antisymmetry) (Prolog) (antisymmetry) ֌ ֌ ֌ ֌ leq(A,B), leq(B,C), leq(C,A) leq(A,B), leq(B,C), leq(C,A), leq(B,A) leq(B,C), leq(C,A), A = B leq(A,C), leq(C,A), A = B A = C, A = B Figure 3 lists another simple CHR(Prolog) program called primes, a CHR variant of the Sieve of Eratosthenes. Dating back to at least 1992 (Frühwirth 1992), this is one of the very first examples where CHR is used as a general-purpose programming language. Given a query of the form “upto(n)”, where n is a positive integer, it computes all prime numbers up to n. The first rule (generate) does the following: if n > 1, it ‘simplifies’ upto(n) to upto(n − 1) and adds a prime(n) constraint. The second rule handles the case for n = 1, removing the upto(1) constraint. Note that removing a constraint is done by simplifying it to the built-in constraint true. The third and most interesting rule (remove nonprime) is a simpagation rule. If there are two prime/1 constraints prime(A) and prime(B), such that B is a multiple of A, the latter constraint is removed. The effect of the remove nonprime rule is to remove non-primes. As a result, if the rules are applied exhaustively, the remaining constraints correspond exactly to the prime numbers up to n. 2 Semantics In this section, we give an overview of both the logical (declarative) semantics and the operational semantics of CHR. The logical semantics (Section 2.1) constitute the formal foundations for the CHR programming language, whilst the operational semantics (Section 2.2) determine the behavior of actual implementations. 6 2.1 Logical Semantics 2.1.1 Classical Logic Semantics ¯ ) Let x̄ denote the variables occurring only in the body of the rule. We use ∀(F to denote universal quantification over all free variables in F . A simplification rule H ⇐⇒ G | B corresponds to a logical equivalence, under the condition that ¯ the guard is satisfied: ∀(G → (H ↔ ∃x̄B)). A propagation rule H =⇒ G | B ¯ corresponds to a logical implication if the guard is satisfied: ∀(G → (H → ∃x̄B)). A simpagation rule Hk \ Hr ⇐⇒ G | B corresponds to a conditional equivalence: ¯ → (Hk → (Hr ↔ ∃x̄B))). The (classical) logical semantics (Frühwirth 1998) of ∀(G a CHR program — also called its logical reading, declarative semantics, or declarative interpretation — is given by the built-in constraint theory DH (which defines the built-ins of the host language H) in conjunction with the logical formulas for each rule. As an example, consider the program leq of Fig. 2. The logical formulas corresponding to its rules are the following:  ∀x, y : x = y → (leq(x, y) ↔ true) (reflexivity)    ′ ′ ′ ′ ′ ′ ∀x, y, x , y : x = x ∧ y = y → (leq(x, y) ∧ leq(y , x ) ↔ x = y) (antisymmetry) ′ ′ ′ ′ ′ ′  ∀x, y, x , y : x = x ∧ y = y → (leq(x, y) → (leq(x , y ) ↔ true)) (idempotence)   ∀x, y, y ′ , z : y = y ′ → (leq(x, y) ∧ leq(y ′ , z) → leq(x, z)) (transitivity) or equivalently:  ∀x : leq(x, x) (reflexivity)    ∀x, y : leq(x, y) ∧ leq(y, x) ↔ x = y (antisymmetry)  true (idempotence)   ∀x, y, z : leq(x, y) ∧ leq(y, z) → leq(x, z) (transitivity) Note the strong correspondence between the syntax of the CHR rules, their logical reading, and the natural definition of partial order. The classical logical reading, however, does not reflect CHR’s multiset semantics (the idempotence rule is logically equivalent to true). Also, the classical logic reading does not always make sense. For example, consider the classical logic reading of the primes program of Fig. 3:  ′ ′ ′ (generate)  ∀n : n > 1 → upto(n) ↔ ∃n prime(n) ∧ n = n − 1 ∧ upto(n ) upto(1) ↔ true (done)  ∀a, b : a|b → prime(a) → (prime(b) ↔ true) (remove nonprime) which is equivalent to:  (generate)  ∀n > 1 : upto(n) ↔ prime(n) ∧ upto(n − 1) upto(1) (done)  ∀a, b : prime(a) ∧ a|b → prime(b) (remove nonprime) The last formula nonsensically states that a number is prime if it has a prime factor. 7 2.1.2 Linear Logic Semantics For general-purpose CHR programs such as primes, or programs that rely on CHR’s multiset semantics, the classical logic reading is often inconsistent with the intended meaning (see previous section). To overcome these limitations, Bouissou (2004) and Betz and Frühwirth (2005; 2007) independently proposed an alternative declarative semantics based on (intuitionistic) linear logic. The latter, most comprehensive study provides strong soundness and completeness results, as well as a semantics for the CHR∨ extension of CHR (see Section 5.2.1). For CHR programs whose constraints represent a multiset of resources, or whose rules represent unidirectional actions or updates, a linear logic semantics proves much more appropriate. A simple example is the following coin-throwing simulator (which depends on the nondeterminism in the operational semantics): throw(Coin) ⇐⇒ Coin = head. throw(Coin) ⇐⇒ Coin = tail. The classical logic reading of this program entails head = tail. The linear logic reading of the coin-throwing program boils down to the following formula: !(throw(Coin) ⊸ (Coin = head)&(Coin = tail)) In natural language, this formula means “you can always replace throw(Coin) with either (Coin = head) or (Coin = tail), but not both”. This corresponds to the committed-choice and unidirectional rule application of CHR. 2.1.3 Transaction Logic Semantics The linear logic semantics is already closer to the operational semantics than the CHR classical logical semantics. However, it still does not allow precise reasoning about CHR derivations: while derivations correspond to proofs of logic equivalence of the initial and the final state, it only allows reasoning on the result of an execution, not on the execution itself. The transaction logic semantics (Meister, Djelloul et al. 2007) bridges the remaining gap between the logical and operational semantics of CHR by providing a framework for both inside one formal system. 2.2 Operational Semantics The behavior of CHR implementations is determined by their operational semantics. As the original theoretical semantics of CHR (Section 2.2.1) proved too nondeterministic for practical programming, more deterministic instances have been specified that offer more execution control (Sections 2.2.2 and 2.2.3). 2.2.1 Theoretical Operational Semantics ωt The operational semantics ωt of CHR (Frühwirth 1998), sometimes also called theoretical or high-level operational semantics, is highly nondeterministic. It is formulated as a state transition system. 8 Definition 2.1 An identified CHR constraint c#i is a CHR constraint c associated with some unique integer i, the constraint identifier. This number serves to differentiate between copies of the same constraint. We introduce the functions chr (c#i) = c and id (c#i) = i, and extend them to sequences and sets of identified CHR constraints in the obvious manner, e.g., id (S) = {i|c#i ∈ S}. Definition 2.2 An execution state σ is a tuple hG, S, B, Tin . The goal G is a multiset of constraints to be rewritten to solved form. The CHR constraint store S is a set of identified CHR constraints that can be matched with rules in the program P. Note that chr (S) is a multiset although S is a set. The built-in constraint store B is the conjunction of all built-in constraints that have been posted to the underlying solver. These constraints are assumed to be solved (implicitly) by the host language H. The propagation history T is a set of tuples, each recording the identities of the CHR constraints that fired a rule, and the name of the rule itself. The propagation history is used to prevent trivial non-termination for propagation rules: a propagation rule is allowed to fire on a set of constraints only if the constraints have not been used to fire the same rule before.1 Finally, the counter n ∈ N represents the next integer that can be used to number a CHR constraint. We use σ, σ0 , σ1 , . . . to denote execution states and Σchr to denote the set of all execution states. For a given CHR program P, the transitions are defined by the binary relation ֌P ⊂ Σchr × Σchr shown in Figure 4. Execution proceeds by exhaustively applying the transition rules, starting from an initial state. The Solve transition solves a built-in constraint from the goal, the Introduce transition inserts a new CHR constraint from the goal into the CHR constraint store, and the Apply transition fires a rule instance. A rule instance instantiates a rule with CHR constraints matching the heads, using a matching substitution (a one-way variable substitution). Relatively strong soundness and completeness results (Frühwirth 1998) link the logical semantics and the operational semantics. Maher (2002) discusses the notion of propagation completeness and proves an impossibility result for CHR. Variants of ωt have been introduced to formalize extensions and variants of CHR. For example, the operational semantics of CHR∨ (Abdennadher 2000), probabilistic CHR (Frühwirth, Di Pierro et al. 2002), and CHR with aggregates (Sneyers, Van Weert et al. 2007) are all based on ωt . We discuss these and other extensions in Section 5. We should also mention the work on an and-compositional semantics for CHR (Delzanno, Gabbrielli et al. 2005; Gabbrielli and Meo 2009), which allows one to 1 Early work on CHR, as well as some more recent publications (e.g., Bouissou 2004; Duck, Stuckey et al. 2007; Haemmerlé and Fages 2007), use a token store instead of a propagation history (this explains the convention of denoting the propagation history with T). A token store contains a token for every potential (future) propagation rule application, which is removed when the rule is actually applied. The propagation history formulation is dual, but closer to most implementations. Confusingly, the term token store has also been used for what is commonly referred to as the “propagation history” (e.g., Chin, Sulzmann et al. 2003; Tacchella, Gabbrielli et al. 2007). 9 1. Solve. h{c} ⊎ G, S, B, Tin ֌P hG, S, c ∧ B, Tin ¯ ∅ B. where c is a built-in constraint and DH |= ∃ 2. Introduce. h{c} ⊎ G, S, B, Tin ֌P hG, {c#n} ∪ S, B, Tin+1 ¯ ∅ B. where c is a CHR constraint and DH |= ∃ 3. Apply. hG, H1 ⊎ H2 ⊎ S, B, Tin ֌P hB ⊎ G, H1 ⊎ S, θ ∧ B, T ∪ {h}in where P contains a (renamed apart) rule of the form r @ H1′ \ H2′ ⇐⇒ G | B, θ is a matching substitution such that chr(H1 ) = θ(H1′ ) and chr(H2 ) = θ(H2′ ), ¯ ∅ B) ∧ (B → ∃ ¯ B (θ ∧ G)). h = (r, id(H1 ), id(H2 )) 6∈ T, and DH |= (∃ Fig. 4. The transition rules of the theoretical operational semantics ωt , defining ¯B (B1 ) ֌P . We use ⊎ for multiset union. For constraint conjunctions B1 and B2 , ∃ 2 denotes ∃X1 , . . . , Xn : B1 , with {X1 , . . . , Xn } = vars(B1 )\vars(B2 ). retrieve the semantics of a conjunctive query given the semantics of the conjuncts. This property is a first step towards incremental and modular analysis and verification tools. 2.2.2 Refined Operational Semantics ωr The refined operational semantics ωr (Duck, Stuckey et al. 2004) instantiates the ωt operational semantics by removing much of the nondeterminism. It formally captures the behavior of many CHR implementations (see also Section 4). CHR programs often rely on the execution control offered by the ωr semantics for correctness, or to achieve a good time complexity. The refined operational semantics uses a stack of constraints: when a new constraint arrives in the constraint store it is pushed on the stack. The constraint on top of the stack is called the active constraint. The active constraint attempts to match rule heads, together with suitable constraints from the constraint store (partner constraints), All occurrences of the active constraint are tried in the order in which they occur in the program. When all occurrences have been tried, the constraint is popped from the stack. When a rule fires, its body is executed immediately from left to right, thereby potentially suspending the active constraint because of newly arriving constraints. When a constraint becomes topmost again, it resumes its search for matching clauses. Alternative formalizations of the ωr semantics have been made for easier reasoning about certain optimizations or analyses. Examples are the call-based refined operational semantics ωc (Schrijvers, Stuckey et al. 2005) and the semantics for occurrence representations ωo (Sneyers, Schrijvers et al. 2005). Variants of ωr have also been introduced to formalize implementations of proposed extensions to CHR or variants of CHR. To mention just a few of them: the ω¬r semantics for CHR¬ (Van Weert, Sneyers et al. 2006), the ωr∨ semantics for CHR∨ which is equivalent to the tree-based ω semantics (De Koninck, Schrijvers et al. 2006b), the set-based ωset semantics of CHRd (Sarna-Starosta and Ramakrishnan 2007), and the concurrent refined semantics (Lam and Sulzmann 2007). These extensions and variants are discussed in more detail in Section 5. 10 2.2.3 Priority Semantics ωp While the refined operational semantics reduces most of the nondeterminism of the ωt semantics, it arguably does not offer the CHR programmer an intuitive and predictable way to influence control flow. The ωr semantics in a sense forces the programmer to understand and take into account how CHR implementations work, to achieve the desired execution control. De Koninck, Schrijvers et al. (2007b) introduced the extension CHRrp , with a corresponding operational semantics called ωp . The programmer assigns a priority to every rule. The ωp semantics is an instantiation of ωt which ensures that of all applicable rules, the one with the highest priority is applied first. This feature gives the programmer a much more precise and high-level control over program execution compared to the ωr semantics. 3 Program Analysis In this section we discuss important properties of CHR programs: confluence (Section 3.1), termination (Section 3.2), and complexity (Section 3.3), as well as (semi-) automatic analysis of these properties. Program analyses that are mostly used for optimizing compilation are discussed in Section 4.2.2. 3.1 Confluence If for a given CHR program, for all initial states, any ωt derivation from that state results in the same final state, the program is called confluent. Confluence has been investigated thoroughly in the context of CHR (Abdennadher, Frühwirth et al. 1999). Two important results are discussed already in (Frühwirth 1998): the existence of a decidable, sufficient and necessary test for confluence of terminating programs, and the result that confluence implies correctness (consistency of the logical reading). Confluence under the refined ωr semantics is investigated in Chapter 6 of (Duck 2005), which also discusses a refined confluence test. Recently, the topic of confluence received renewed attention because certain problems and limitations of the confluence test have surfaced. Firstly, many programs that are in practice confluent fail this confluence test because non-confluence originates from unreachable states. The more powerful notion of observable confluence (Duck, Stuckey et al. 2007) takes reachability into account. Secondly, the standard notion of confluence is only applicable to terminating programs. Raiser and Tacchella (2007) extended the notion of confluence to non-terminating programs. Haemmerlé and Fages (2007) develop a notion of abstract critical pairs for rewriting systems in general. They illustrate this notion for CHR’s theoretical semantics. A particularly interesting result is that some traditional critical pairs can be disregarded because they are redundant. Related Analyses. Abdennadher and Frühwirth (1998) showed how to do completion of CHR programs. Completion is a technique to transform a non-confluent program into a confluent one by adding rules. It allows extension, modification and specialization of existing programs. 11 A very useful notion is that of operational equivalence of two CHR programs. Two programs are operationally equivalent if for each query, the answer is the same (modulo variable renaming) according to each program. A straightforward extension of confluence, called compatibility of two programs, is shown to be too weak to capture the operational equivalence of CHR programs (Abdennadher and Frühwirth 1999; Abdennadher 2001). Instead, Abdennadher and Frühwirth (1999) give a decidable, sufficient, and necessary syntactic condition for operational equivalence of wellbehaved (confluent and terminating) CHR programs. A sufficient syntactic condition is also given for the equivalence of two CHR constraints, defined in two different well-behaved CHR programs. The latter condition is also shown necessary for an interesting class of CHR programs. Abdennadher and Frühwirth (2004) investigated the merging of two well-behaved CHR solvers. If the two programs are not compatible, well-behavedness can be regained by completion. Furthermore, Abdennadher and Frühwirth (2004) identify a class of solvers whose union is always confluent, and argue why finding a class whose union preserves termination is hard. Finally, Abdennadher and Frühwirth (2004) present a method to remove redundant rules from CHR programs, based on the notion of operational equivalence. 3.2 Termination The first work on termination analysis of CHR programs was presented by Frühwirth (2000). Frühwirth demonstrated that termination proof techniques from logic programming and term rewrite systems can be adapted to the CHR context. Termination of CHR programs is proved by defining a ranking function from computation states to a wellfounded domain such that the rank of consecutive computation states decreases. A condition on simplification rules guarantees such rank decreases for all consecutive states. This approach, however, cannot prove termination of CHR programs with propagation rules, because it is impossible to show decreases between consecutive states as these rules do not remove constraints from the store. Recently, two new results on termination analysis of CHR were presented. Pilozzi, Schrijvers et al. (2007) describe a termination preserving transformation of CHR programs to Prolog programs. By reusing termination tools from logic programming and, indirectly, from term rewriting, proofs of termination of the transformed CHR programs are generated automatically, yielding the first fully automatic termination prover for CHR. The transformation, however, does not consider propagation histories. As such, it is applicable only to CHR programs without propagation rules. A transformation of single-headed propagation rules to equivalent simplification rules overcomes this problem partially. The second contribution is presented by Voets, Pilozzi et al. (2007). Compare to previous approaches, theirsapproach is applicable to a much larger class of CHR programs. By formulating a new termination condition that verifies conditions imposed on the dynamic process of adding constraints to the store, they derive conditions for both simplification and propagation rules. 12 3.3 Complexity For various CHR programs — general purpose programs as well as constraint solvers — an accurate, though rather ad hoc, complexity analysis has been made. We list the most notable examples in Section 3.3.1. While ad hoc methods give the most accurate results in practice, they cannot easily be generalized. Therefore, more structured approaches to complexity analysis have been proposed by means of meta-complexity theorems. An overview is given in Section 3.3.2. 3.3.1 Ad Hoc Analysis A CHR implementation of the classical union-find algorithm was proven optimal by Schrijvers and Frühwirth (2006). Sneyers, Schrijvers et al. (2006a) showed the optimal complexity of an implementation of Dijkstra’s shortest path algorithm that uses Fibonacci heaps. Frühwirth (2005a) formulated the complexity of a generalpurpose lexicographical order constraint solver in terms of the number of ask and tell built-in constraints encountered during execution. Finally, Meister, Djelloul et al. (2006) derived the complexity of a solver for existentially quantified equations over finite and infinite trees, using bounds on the derivation length. 3.3.2 Meta-Complexity Results Frühwirth (2001; 2002a; 2002b) investigated the time complexity of simplification rules for naive implementations of CHR. In this approach, a suitable termination order (called a tight ranking) is used as an upper bound on the derivation length. Combined with a worst-case estimate of the number and cost of rule application attempts, this results in a complexity meta-theorem which gives a rough upper bound of the time complexity. Recent work on optimizing compilation of CHR (cf. Section 4.2.2) allows meta-theorems that give much tighter complexity bounds. We now discuss two distinct approaches. Ganzinger and McAllester (2002) propose a formalism called Logical Algorithms (LA) and prove a meta-complexity result. De Koninck, Schrijvers et al. (2007a) establish a close correspondence between CHR and LA (see also Section 6.1.3), allowing the LA meta-complexity result to be applied (indirectly) to a large class of CHR programs. De Koninck, Schrijvers et al. (2007a) actually address the metacomplexity of CHRrp programs, an extension of CHR discussed in Section 5.1.3. All CHR programs are also CHRrp programs. The Logical Algorithms approach was previously used, in a more ad hoc way, by Christiansen (2005) to derive the complexity of CHR grammars (see Section 7.3.3). Sneyers, Schrijvers et al. (2009) explicitly decouple the two steps in the approach of Frühwirth (2002a; 2002b) by introducing abstract CHR machines. In the first step, the number of rule applications is estimated; this corresponds to the number of CHR machine steps. If a suitable termination order can be found, it can be used to show an upper bound. However for programs that are non-terminating in general, like a RAM machine simulator, or for which no suitable ranking can be found, other techniques have to be used to prove complexity properties. In the second 13 step, the complexity of rule application is computed for a given CHR program; this corresponds to simulating a CHR machine on a RAM machine. The first step depends only on the operational semantics of CHR, whereas the second step depends strongly on the performance of the code generated by the CHR compiler. 3.3.3 Complexity-wise Completeness of CHR Sneyers, Schrijvers et al. (2009) also consider the space complexity of CHR programs. Some compiler optimizations like memory reuse (Sneyers, Schrijvers et al. 2006b) are crucial to achieve tight space complexity bounds (cf. Section 4.2.2). The most interesting result of Sneyers, Schrijvers et al. (2009) is the following “complexitywise completeness” result for CHR, which implies that “everything can be done efficiently in CHR”: For every algorithm (RAM machine program) which uses at least as much time as space, a CHR program exists which can be executed in the K.U.Leuven CHR system with time and space complexity within a constant from the original complexities. Complexity-wise completeness implies Turing completeness but is a much stronger property. 4 Systems and Implementation CHR is first and foremost a programming language. Hence, a large part of CHR research has been devoted to the development of CHR systems and efficient execution of CHR programs. The two most comprehensive works on this subject are the Ph.D. theses of Duck (2005) and Schrijvers (2005). In this section, we provide an overview of their work as well as the many other contributions to the field. 4.1 Systems Since the conception of CHR a large number of CHR systems (compilers, interpreters and ports) have been developed. In particular, in the last ten years the number of systems has exploded. Figure 5 presents a timeline of system development, branches and influences. We discuss these systems, grouped by host language or host paradigm, in more detail. 4.1.1 CHR(LP) Logic Programming is the natural host language paradigm for CHR. Hence, it is not surprising that the CHR(Prolog) implementations are the most established ones. Holzbaur and Frühwirth (2000a) have laid the groundwork with their general compilation scheme for Prolog. This compilation scheme was first implemented in SICStus Prolog by Holzbaur, and later further refined in HAL by Holzbaur, Garcı́a de la Banda et al. (2005) and in hProlog by Schrijvers and Demoen (2004b). The latter system, called the K.U.Leuven CHR system, was subsequently ported to many other Prolog systems and is currently available in XSB (Schrijvers, Warren et al. 2003; Schrijvers and Warren 2004), SWI-Prolog (Schrijvers, Wielemaker et al. 2005), YAP, B-Prolog (using Action Rules; 14 Fig. 5. A timeline of CHR implementations. Schrijvers, Zhou et al. 2006), SICStus 4 and Ciao Prolog. Another system directly based on the work of Holzbaur and Schrijvers is the CHR library for SiLCC by Bouissou (2004). SiLCC is a programming language based on linear logic and concurrent constraint programming. All of these systems compile CHR programs to host language programs. The only available interpreter for CHR(Prolog) is TOYCHR2 . Recently, systems with deviating operational semantics have been developed. The CHRd system by Sarna-Starosta and Ramakrishnan (2007) runs in XSB, SWIProlog and hProlog. It features a constraint store with set semantics and is particularly suitable for tabled execution. The CHRrp system by De Koninck, Stuckey et al. (2008) for SWI-Prolog provides rule priorities. 2 by Gregory J. Duck, 2003. Download: http://www.cs.mu.oz.au/∼gjd/toychr/ 15 4.1.2 CHR(FP) As type checking is one of the most successful applications of CHR in the context of Functional Programming (see Section 7.3.1), several CHR implementations were developed specifically for this purpose. Most notable is the Chameleon system (Stuckey and Sulzmann 2005) which features CHR as the programming language for its extensible type system. Internally, Chameleon uses the HaskellCHR implementation3 . The earlier HCHR prototype (Chin, Sulzmann et al. 2003) had a rather heavy-weight and impractical approach to logical variables. The aim of a 2007 Google Summer of Code project was to transfer this CHR based type checking approach to two Haskell compilers (YHC and nhc98). The project led to a new CHR interpreter for Haskell, called TaiChi (Boespflug 2007). With the advent of software transactional memories (STM) in Haskell, two prototype systems with parallel execution strategies have been developed: STMCHR4 and Concurrent CHR (Lam and Sulzmann 2007). These systems are currently the only known CHR implementations that exploit the inherent parallelism in CHR programs. Concurrent CHR also serves as the basis for Haskell-Join-Rules (Sulzmann and Lam 2007b) (cf. Section 6.1.2). We also mention the Haskell library for the PAKCS implementation of the functional logic language Curry (Hanus 2006). The PAKCS system actually compiles Curry code to SICStus Prolog, and its CHR library is essentially a front-end for the SICStus Prolog CHR library. The notable added value of the Curry front-end is the (semi-)typing of the CHR code. 4.1.3 CHR(Java) and CHR(C) Finally, CHR systems are available for both Java and C. These multiparadigmatic integrations of CHR and mainstream programming languages offer powerful synergetic advantages to the software developer: they facilitate the development of application-tailored constraint systems that cooperate efficiently with existing host language components. For a detailed discussion on the different conceptual and technical challenges encountered when embedding CHR into an imperative host language, we refer to Van Weert, Wuille et al. (2008). CHR(Java). There are at least four implementations of CHR in Java. The earliest is the Java Constraint Kit (JaCK) by Abdennadher (2001) and others (Abdennadher, Krämer et al. 2002). It consists of three major components: 1. JCHR (Schmauß 1999) — a CHR dialect intended to resemble Java, in order to provide an intuitive programming experience. No operational semantics is specified for this system, and its behavior deviates from other CHR implementations. 3 4 by Gregory J. Duck, 2004. Download: http://www.cs.mu.oz.au/∼gjd/haskellchr/ by Michael Stahl, 2007. Download: http://www.cs.kuleuven.be/∼dtai/projects/CHR/ 16 2. VisualCHR (Abdennadher and Saft 2001) — an interactive tool visualizing the execution of JCHR (cf. Section 4.3). 3. JASE (Krämer 2001) — a “Java Abstract Search Engine” in which tree-based search strategies can be specified. The JASE library is added to the JaCK framework as an orthogonal component. It provides a number of utility classes that aid the user to implement search algorithms in the Java host language. A typical algorithm consists of the following two operations, executed in a loop: a JCHR handler is run until it reaches a fix-point, after which a new choice is made. If an inconsistency is found, backtracking is used to return to the previous choice point. JASE aids in maintaining the search tree, and can be configured to use either trailing or copying. DJCHR (Dynamic JCHR; Wolf 2001a) is an implementation of adaptive CHR (see Section 5.1.4). The incremental adaptation algorithm underlying DJCHR maintains justifications for rule applications and constraint additions. Wolf (2005) shows that these justifications, and in particular those of any derived false constraint, also serve as a basis for intelligent search strategies. As in JaCK, the different search algorithms are implemented orthogonally to the CHR program. Wolf’s approach confirms that advanced search strategies are often more efficient than a low-level, built-in implementation of chronological backtracking (as in Prolog). The K.U.Leuven JCHR system (Van Weert, Schrijvers et al. 2005) addresses the main issue of JaCK, its poor performance. The focus of K.U.Leuven JCHR is on both performance and integration with the host language. K.U.Leuven JCHR handlers integrate neatly with existing Java code, and it is currently one of the most efficient CHR systems available. The current implementation does not feature search capabilities. Finally, the CHORD system (Constraint Handling Object-oriented Rules with Disjunctive bodies)5 , developed as part of the ORCAS project (Robin and Vitorino 2006), is a Java implementation of CHR∨ (Menezes, Vitorino et al. 2005). CHR(C). CCHR (Wuille, Schrijvers et al. 2007) implements CHR for C. It is an extremely efficient CHR system conforming to the ωr refined operational semantics. It uses a syntax that is intuitive to both CHR adepts and imperative programmers. 4.2 Compilation Considerable research has been conducted on the efficient compilation of CHR. Section 4.2.1 provides an overview of the compilation schemes used by the different CHR systems; Sections 4.2.2 and 4.2.3 survey existing analyses and optimizations. 4.2.1 Compilation Schemes The first CHR compilation scheme, for ECLi PSe Prolog, was described by Frühwirth and Brisset (1995). Holzbaur and Frühwirth (1999; 2000a) have adapted this scheme from ECLi PSe ’s 5 by Jairson Vitorino and Marcos Aurelio, 2005, http://chord.sourceforge.net/ 17 fairly specific suspension mechanism to the more primitive and flexible attributed variables feature found in SICStus Prolog. The latter form has been adopted by HALCHR, K.U.Leuven CHR, and was formalized in the refined operational semantics (Duck, Stuckey et al. 2004). A good overview of the compilation scheme can be found in the Ph.D. theses of Duck (2005) and Schrijvers (2005), and in (Van Weert, Wuille et al. 2008). In its essence, the scheme maps each constraint to a procedure. Imposing the constraint then corresponds to calling the procedure. This procedure puts the new constraint in the constraint store datastructure, and attempts to fire rules involving the new constraint. For the latter purpose, the scheme contains an occurrence procedure for each occurrence of the constraint symbol in a rule. The main constraint procedure calls these occurrence procedures in the textual order of the rules. The reactivation of a constraint is realized through calling the occurrence procedures anew. Each procedure looks up the required additional constraints in the constraint store datastructure and checks both the guard and propagation history. If all tests succeed, the rule is committed to: an entry is added to the propagation history, the appropriate matching constraints are removed from the constraint store and the body of the rule is executed. The Prolog compilation scheme is specifically designed for the built-in constraint theory of Herbrand equations. Duck, Stuckey et al. (2003) show how it can be extended to cover arbitrary constraint theories and solvers. Schrijvers, Zhou et al. (2006) experimented with an action rules compilation scheme in BProlog. However, capturing the intricate reactivation behavior of CHR’s refined operational semantics turned out to be hard because the action rules’ behavior differs considerably on that account. Lam and Sulzmann (2007) showed that software transactional memories (STM), as supported by the Glasgow Haskell Compiler, are a good match for the concurrent implementation of CHR. Sulzmann and Lam (2007a) also explored the use of Haskell’s laziness and concurrency abstractions for implementing the search of partner constraints. CHR(Java). Both JaCK (Schmauß 1999) and CHORD take a different approach compared to most other CHR compilers. Their front-end transforms the CHR source files to Java code that initializes the data structures of a generic runtime. CHR programs are then essentially interpreted. No major optimizations are performed. DJCHR uses a compilation scheme similar to the basic CHR(Prolog) scheme, but extended with truth maintenance facilities required for adaptive constraint handling (Wolf 2001a). Justifications for constraints and rule applications are implemented efficiently using bit vectors. The runtime also implements adaptive unification and entailment algorithms. Following the approach of Holzbaur and Frühwirth (1999; 2000a), fast partner constraint retrieval is achieved using a form of attributed variables (Wolf 2001b). K.U.Leuven JCHR and CCHR. The compilation schemes used by the K.U.Leuven JCHR and CCHR systems (Van Weert, Schrijvers et al. 2005; Wuille, Schrijvers et al. 2007) 18 are based on the basic compilation scheme for CHR(Prolog), modified to fit an imperative language (Van Weert, Wuille et al. 2008). Searching for partner constraints is done through explicit iteration. Also, the data structures required for the implementation of the constraint store are implemented more naturally and efficiently in an imperative host language than in an LP language. An important issue is that the host language typically cannot handle recursive calls efficiently. The common CHR(Prolog) scheme was therefore adjusted significantly to avoid frequent call stack overflows. The compilation scheme used by the K.U.Leuven JCHR system is described in detail in (Van Weert 2008). The CCHR compiler performs some limited optimizations, like memory reuse, basic join ordering (see Section 4.2.2), as well as imperative-language specific optimizations. The K.U.Leuven JCHR compiler implements most of the optimizations mentioned in Section 4.2.2. For more details, see (Van Weert, Wuille et al. 2008). CHRrp . A compilation scheme for CHRrp that is strongly based on the one for regular CHR in Prolog, is presented in (De Koninck, Stuckey et al. 2008). It is formalized in the refined priority semantics ωrp , which combines the refined operational semantics ωr of regular CHR, with the priority semantics ωp of CHRrp . The main differences are the following. The initial goal, as well as rule bodies, are executed in batch mode, i.e., no rule can fire as long as there are unprocessed goal or body constraints (i.e., the Apply transition is not allowed if the Introduce transition is applicable, cf. Fig. 4). New constraints are scheduled for activation at all priorities at which they have occurrences, instead of being activated as soon as they are processed. Constraints are activated at a given priority and as such only consider those rules that share this priority. Finally, after each rule firing, it is checked whether a scheduled constraint needs to be activated. To deal with so-called dynamic priority rules, which are rules for which the actual priority is only determined at runtime, a source-to-source transformation is given in (De Koninck, Stuckey et al. 2008), that transforms these rules to the desired form for the ωrp semantics. 4.2.2 Analysis and Optimizing Compilation A number of (mostly static) analyses and optimizations have been proposed to increase the performance of CHR systems (Holzbaur, Garcı́a de la Banda et al. 2005; Schrijvers 2005; Duck 2005; Van Weert, Wuille et al. 2008). Without going into the technical details, we very briefly discuss a list of recent optimizations: Indexing. The efficient, selective lookup of candidate partner constraints is indispensable for the efficient determination of matching rules. The traditional CHR(Prolog) compilation scheme (see Section 4.2.1) uses attributed variables for a constant time lookup of the constraints containing a known, unbound variable. Holzbaur, Garcı́a de la Banda et al. (2005) propose the use of a balanced tree for the lookup of constraints via known ground arguments, which allows for logarithmic worst-case time lookup. Schrijvers (2005) further improves this 19 using hash tables to get amortized constant time constraint store operations. Sneyers, Schrijvers et al. (2006a) finally introduce array-based indexes to obtain correct space and time complexity guarantees (see also (Sneyers, Schrijvers et al. 2009)). Sarna-Starosta and Schrijvers (2007) show how indexing on compound term patterns is reduced to the above indexing techniques via program transformation. Abstract interpretation. Schrijvers, Stuckey et al. (2005) present a general and systematic framework for program analysis of CHR for optimized compilation based on abstract interpretation. Two instances are given: late storage analysis (for reducing constraint store updates) and groundness analysis. Functional dependencies. Functional dependency analysis (Duck and Schrijvers 2005) is a third instance of the abstract interpretation framework. It aims at tracking the cardinality of constraints (zero, one or more) for specializing constraint store indexes and related operations. Guard optimization. The guard optimization (Sneyers, Schrijvers et al. 2005) removes redundant conjuncts in rule guards by reasoning on the ramifications of the refined operational semantics. More precisely, non-applicability of rules containing earlier removed occurrences of a constraint, can be used to infer redundant guard conditions. Continuation optimization. The continuation optimization (Sneyers, Schrijvers et al. 2005) uses a similar reasoning to skip occurrences that can never lead to rule firings. Delay avoidance. Schrijvers and Demoen (2004a) and Holzbaur, Garcı́a de la Banda et al. (2005) describe techniques for avoiding the unnecessary delay and reactivation of constraints. Memory reuse. Two memory optimizations (in-place updates and suspension reuse) were introduced by Sneyers, Schrijvers et al. (2006b). They significantly reduce the memory footprint and the time spent in garbage collection. Join ordering. The time complexity of executing a CHR program is often determined by the join ordering — the order in which partner constraints are looked up in order to find matching rules. Holzbaur, Garcı́a de la Banda et al. (2005) and Duck (2005) discussed ad-hoc heuristics for join ordering. De Koninck and Sneyers (2007) proposed a more rigorous investigation. 4.2.3 Code Specialization and Transformation Most of the optimizations in the previous section are not expressible as source-tosource transformations. Like compiler optimization, program transformation can also be used to improve performance. The first proposal for CHR source-to-source transformation, by Frühwirth (2005c), adds redundant, specialized rules to a CHR program; these rules capture the effect of the original program for a particular goal. In more recent work, Tacchella, Gabbrielli et al. (2007) adapt the conventional notion of unfolding to CHR. While the above study program transformation from a more theoretical point of view, Sarna-Starosta and Schrijvers (2007) show that various program transformation techniques improve indexing performance. Frühwirth and Holzbaur (2003) propose to express CHR source-to-source trans20 formations in CHR itself, and they show how to implement various language extensions (such as probabilistic CHR) by transformation to plain CHR. Van Weert, Sneyers et al. (2008) implemented an extension of CHR with aggregates (see Section 5.2.2) using a similar approach, with a more expressive transformation language. 4.3 Programming Environments Over the past decade there has been an exponential increase in the number of CHR systems (Section 4.1), and CHR compilation techniques have matured considerably (Section 4.2). The support for advanced software development tools, such as debuggers, refactoring tools, and automated analysis tools, lags somewhat behind, and remains an important challenge for the CHR community. VisualCHR (Abdennadher and Saft 2001), part of JaCK (see Section 4.1.3), is an interactive tool visualizing the execution of CHR rules. It can be used to debug and to improve the efficiency of constraint solvers. Both Holzbaur’s CHR implementation and the K.U.Leuven CHR system feature a trace-based debugger that is integrated in the Prolog four port tracer. A generic trace analysis tool, with an instantiation for CHR, is presented in (Ducassé 1999). Checked type annotations are useful both for documentation and debugging purposes. CHR systems with a typed host language commonly perform type checking, or even type inference. The K.U.Leuven CHR system also allows optional type declarations, with both dynamic and static type checking. Coquery and Fages (2005) present a generic type system for CHR(H) (cf. also Section 7.3.1). Ringwelski and Schlenker (2000a) propose the automatic inference of imported and exported symbols of CHR solvers, and the composition of solvers by matching up their interfaces (Ringwelski and Schlenker 2000b). Schumann (2002) presents a literate programming system for CHR. The system allows for generating from the same literate program source both an algorithm specification typeset in LATEX using mathematical notation, and the corresponding executable CHR source code. Based on the theoretical results of Abdennadher, Frühwirth et al. (1999) (see Section 3.1), Bouissou (2004) implemented a confluence analyzer in CHR. Duck (2005) presents and evaluates a confluence checker based on the refined operational semantics. We do not know of any practical implementations of the other analyses of Section 3.1. 5 Extensions and Variants Over the years, weaknesses and limitations of CHR have been identified, for instance regarding execution control, expressivity, modularity, incrementality, and search. In this section we consider extensions and variants of CHR that were proposed to tackle these issues. 21 5.1 Deviating Operational Semantics We first discuss variants of CHR with an operational semantics that deviates from the commonly used refined operational semantics discussed in Section 2.2.2. 5.1.1 Probabilistic CHR Probabilistic CHR (PCHR; Frühwirth, Di Pierro et al. 2002) extends CHR with probabilistic choice between the applicable rules in any state (though only for a given active constraint). It supports the implementation of algorithms like simulated annealing, which is often used for constrained optimization. It also gives rise to new concepts like probabilistic confluence and probabilistic termination. In PCHR, the probabilities are either a fixed number or an arithmetic expression involving variables that appear in the head. The latter are called parametrised probabilities. The actual probability that a rule is executed in a given state is found by dividing the rule probability by the sum of the probabilities of all fireable rule instances. Frühwirth, Di Pierro et al. (2002) give an implementation of PCHR by means of a source-to-source transformation using the framework proposed by Frühwirth and Holzbaur (2003). As a simple example, the following PCHR program simulates tossing a coin: toss(Coin) <=>0.5: Coin=head. toss(Coin) <=>0.5: Coin=tail. Given a toss/1 constraint, one of the rules will be applied, with equal probability. 5.1.2 CHRd The CHRd system (CHR with distributed constraint store) of Sarna-Starosta and Ramakrishnan (2007) alleviates the limitations of conventional CHR systems for efficient tabled evaluation encountered by Schrijvers and Warren (2004). For this purpose it implements a set-based operational semantics, i.e. the constraint store is a set rather than a multiset. Moreover, CHRd’s constraint store has no global access point; constraints can only be retrieved through their logical variables. This rules out (the efficient execution of) of ground CHR programs. 5.1.3 CHRrp CHRrp (De Koninck, Schrijvers et al. 2007b) is CHR extended with user-definable rule priorities. A rule’s priority is either a number or an arithmetic expression involving variables that appear in the rule heads. The latter allows different instances of a rule to be executed at different priorities. The following CHRrp -related topics are dealt with in other sections: its operational semantics in Section 2.2.3; its compilation schema in Section 4.2.1; and its implementation for SWI-Prolog in Section 4.1.1. An example that illustrates the power of dynamic priorities is the following CHRrp implementation of Dijkstra’s algorithm: 22 1 :: source(V) ==> dist(V,0). 1 :: dist(V,D1) \ dist(V,D2) <=> D1 =< D2 | true. D+2 :: dist(V,D), edge(V,C,W) ==> dist(W,D+C). The priority of the last rule makes sure that new distance labels are propagated in the right order: first the nodes closest to the source node. 5.1.4 Adaptive CHR Constraint solving in a continuously changing, dynamic environment often requires immediate adaptation of the solutions, i.e. when constraints are added or removed. By nature, CHR solvers already support efficient adaptation when constraints are added. Wolf (1999; 2000) introduces an extended incremental adaptation algorithm which is capable of adapting CHR derivations after constraint deletions as well. This algorithm is further improved by Wolf (2000a) with the elimination of local variables using early projection. An efficient implementation exists in Java (Wolf 2001a; 2001b; cf. Section 4.1.3). Interesting applications of adaptive CHR include adaptive solving of soft constraints, discussed in Section 7.1, and the realization of intelligent search strategies, discussed in Sections 4.1.3 and 5.2.1. 5.2 Language Extensions We now discuss some additional language features that have been added to the CHR language. 5.2.1 Disjunction and Search Most constraint solvers require search next to constraint simplification and propagation. However pure CHR does not offer any support for search. Abdennadher and Schütz (1998) propose a solution to this problem: an extension of CHR with disjunctions in rule bodies (see also Abdennadher 2000; 2001). The resulting language is denoted CHR∨ (pronounced “CHR-or”), and is capable of expressing several declarative evaluation strategies, including bottom-up evaluation, top-down evaluation, model generation and abduction (see Section 7.3.2 for abduction). Any (pure) Prolog program can be rephrased as an equivalent CHR∨ program (Abdennadher 2000; 2001). An interesting aspect of CHR∨ is that the extension comes for free in CHR(Prolog) implementations by means of the built-in Prolog disjunction and search mechanism. As a typical example of programming in CHR∨ , consider the following rule: labeling, X::Domain <=> member(X,Domain), labeling. Note the implicit disjunction in the call to the Prolog predicate member/2. Various ways have been proposed to make the search in CHR∨ programs more flexible and efficient. Menezes, Vitorino et al. (2005) present a CHR∨ implementation for Java in which the search tree is made explicit and manipulated at runtime 23 to improve efficiency. The nodes in the search tree can be reordered to avoid redundant work. De Koninck, Schrijvers et al. (2006b) extend both the theoretical and refined operational semantics of CHR towards CHR∨ . The theoretical version leaves the search strategy undetermined, whereas the refined version allows the specification of various search strategies. In the same work, an implementation for different strategies in CHR(Prolog) is realized by means of a source-to-source transformation. For CHR(Java) systems, unlike for CHR(LP) systems, the host language does not provide search capabilities. The flexible specification of intelligent search strategies has therefore received considerable attention in several CHR(Java) systems (Krämer 2001; Wolf 2005). As described in Section 4.1.3, in these systems, the search strategies are implemented and specified in the host language itself, orthogonally to the actual CHR program. Wolf, Robin et al. (2007) propose an implementation of CHR∨ using the ideas of (Wolf 2005), in order to allow a more declarative formulation of search in the bodies of CHR rules, while preserving efficiency and flexibility. A refined operational semantics of the proposed execution strategy is presented as well. Along these lines is the approach proposed by Robin, Vitorino et al. (2007), where disjunctions in CHR∨ are transformed into special purpose constraints that can be handled by an external search component such as JASE (Krämer 2001). 5.2.2 Negation and Aggregates CHR programmers often want to test for the absence of constraints. CHR was therefore extended with negation as absence by Van Weert, Sneyers et al. (2006). Negation as absence was later generalized to a much more powerful language feature, called aggregates (Sneyers, Van Weert et al. 2007). Aggregates accumulate information over unbounded portions of the constraint store. Predefined aggregates include sum, count, findall, and min. The proposed extension also features nested aggregate expressions over guarded conjunctions of constraints, and applicationtailored user-defined aggregates. Aggregates lead to increased expressivity and more concise programs. An implementation based on source-to-source transformations (Van Weert, Sneyers et al. 2008) is available. The implementation uses efficient incremental aggregate computation, and empirical results show that the desired runtime complexity is attainable with an acceptable constant time overhead. As an example of nested aggregate expressions, consider the following rule: eulerian, forall(node(N),( count(edge(N,_),X), count(edge(_,N),X) )) <=> writeln(graph_is_eulerian). The above rule is applicable if for every constraint node(N), the number of outgoing edges in N equals the number of incoming edges (i.e. if the first number is X, the other number must also be X). 24 5.3 Solver Hierarchies While the theory of the CHR language generally considers arbitrary built-in solvers, traditional CHR implementations restrict themselves to the Herbrand equality constraint solver, with very little, if any, support for other constraint solvers. Duck, Stuckey et al. (2003) show how to build CHR solvers on top of arbitrary built-in constraint solvers by means of ask constraints. The ask constraints signal the CHR solver when something has changed in the built-in store with respect to variables of interest. Then the relevant CHR constraints may be reactivated. Schrijvers, Demoen et al. (2006) provide an automated means for deriving ask versions of CHR constraints. In this way full hierarchies of constraint solvers can be written in CHR, where one CHR solver serves as the built-in solver for another CHR solver. 6 Relation to Other Formalisms The relation of CHR to other formalisms has recently received quite a lot of attention. In this section we give a brief overview. As a general remark, we should mention that most of the formalisms related to CHR are limited to ground terms and lack the equivalent of propagation rules. In that sense, they are subsumed by CHR. Also, CHR can be seen as an instance or a generalization of concurrent constraint programming, constraint logic programming, constraint databases, and deductive databases. Logical formalisms. In Section 2.1, we discussed the logical semantics of CHR. CHR can be given a classical logic semantics (Frühwirth 1998), a linear logic semantics (Betz and Frühwirth 2005; 2007), and a transaction logic semantics (Meister, Djelloul et al. 2007). Also, it should be noted that CHR∨ subsumes Prolog. Frame-Logic (F-Logic) is an object-oriented extension of classical predicate logic. Käser and Meister (2006) explore the relation between CHR and F-Logic by implementing (a fragment of) F-Logic in CHR. Term rewriting. CHR can be considered as associative and commutative (AC) term rewriting of flat conjunctions. The term rewriting literature inspired many results for CHR, for example on confluence (see Section 3.1) and termination (see Section 3.2). Recently, Duck, Stuckey et al. (2006) proposed the formalism of ACD term rewriting, which subsumes both AC term rewriting and CHR. 6.1 Set-Based Formalisms Numerous formalisms have been proposed that are based on (multi-)set rewriting. 6.1.1 Production Rules / Business Rules Production rules, or business rules as they are now often called, is a rule-based paradigm closely related to CHR. Classic matching algorithms, such as RETE and 25 LEAPS, have influenced early work on CHR compilation. Production rules have also inspired the research towards extending CHR with aggregates (see Section 5.2.2). 6.1.2 Join-Calculus The join-calculus is a calculus for concurrent programming, with both stand-alone implementations and extensions of general purpose languages, such as JoCaml (OCaml), Join Java and Polyphonic C#. Sulzmann and Lam (2007b) propose a Haskell language extension for supporting join-calculus-style concurrent programming, based on CHR. Join-calculus rules, called chords, are essentially guardless simplification rules with linear match patterns. In a linear pattern, different head conjuncts are not allowed to share variables. Hence, CHR offers considerably increased expressivity over the join-calculus: propagation rules, general guards and non-linear patterns. 6.1.3 Logical Algorithms As already mentioned in Section 3.3.2, CHR is strongly related to the Logical Algorithms (LA) formalism by Ganzinger and McAllester (2002). De Koninck, Schrijvers et al. (2007a) have showed how LA programs can easily be translated into CHRrp programs. The opposite only holds for a subset of CHRrp since the LA language lacks the ability to plug in any built-in constraint theory, and also only supports ground constraints (called assertions in LA terminology). The correspondence between both languages makes it possible to apply the meta-complexity result for LA to a subset of CHRrp as explained in Section 3.3.2. It is also interesting that the first actual implementation of LA is that of De Koninck, Schrijvers et al. (2007a), which compiles the language into (regular) CHR rules. 6.1.4 Equivalent Transformation Rules The Equivalent Transformation (ET) computation model is a rewriting system which consists of the application of conditional multi-headed multi-body ET rules (ETR). Although CHR and ETR are similar in syntax, they have different theoretical bases: CHR is based on logical equivalence of logical formulas, whereas ETR is based on the set equivalence of descriptions. Shigeta, Akama et al. (2006) investigate the relation between CHR and ETR. 6.2 Graph-Based Formalisms Recently, CHR has also been related to a number of graph-based formalisms: 6.2.1 Graph Transformation Systems Raiser (2007) describes an elegant embedding of Graph Transformation Systems (GTS) in CHR. The confluence properties (see Section 3.1) for CHR and GTS are 26 similar; in particular, a sufficient criterion for confluence of a GTS is the confluence of the corresponding CHR program. Using a slightly weaker notion of confluence of CHR (in the spirit of observable confluence; Duck, Stuckey et al. 2007), standard CHR confluence checkers can be reused to decide GTS confluence. 6.2.2 Petri Nets Petri nets are a well-known formalism for the modeling and analysis of concurrent processes. Betz (2007) provides a first study of the relation between CHR and Petri nets. He provides a sound and complete translation of place/transition nets (P/T nets) — a standard variant of Petri nets — into a small segment of CHR. P/T nets are, unlike CHR (cf. Section 3.3), not Turing complete. A translation of a significant subsegment of CHR into colored Petri nets is presented as well by Betz (2007). This work is a promising first step towards cross-fertilization between both formalisms. Results from Petri nets could for instance be applied to analyze concurrency properties of CHR programs. 6.2.3 LMNtal LMNtal (Ueda et al. 2006) is a language based on hierarchical graph rewriting which intends to unify constraint-based concurrency and CHR. It uses logical variables to represent connectivity and so-called membranes to represent hierarchy. Flat LMNtal rules (rules without membranes) can be seen as simplification rules in CHR. 7 Applications The main application domain considered in the previous CHR survey (Frühwirth 1998) is the development of constraint solvers. It also discusses two other applications of CHR in some depth. The first one is related to the problem of finding an optimal placement of wireless transmitters (Frühwirth and Brisset 1998; 2000); the second one is an expert system for estimating the maximum fair rent in the city of Munich, called the Munich Rent Advisor (Frühwirth and Abdennadher 2001). In this section, we give an overview of more recent applications of CHR. 7.1 Constraint Solvers CHR was originally designed specifically for writing constraint solvers. We discuss some recent examples of constraint solvers written in CHR. The following examples illustrate how CHR can be used to build effective prototypes of non-trivial constraint solvers: Lexicographic order. Frühwirth (2006a) presented a constraint solver for a lexicographic order constraint in terms of inequality constraints offered by the underlying solver. The approach is general in that it can be used for any constraint domain offering inequality (less-than) constraints between problem variables. Still, the program is very concise and elegant; it consists of just six rules. 27 Rational trees. Meister, Djelloul et al. (2006) presented a solver for existentially quantified conjunctions of non-flat equations over rational trees. The solver consists of a transformation to flat equations, after which a classic CHR solver for rational trees can be used. This results in a complexity improvement with respect to previous work. In (Djelloul, Dao et al. 2007), the solver for rational trees is used as part of a more general solver for (quantified) first-order constraints over finite and infinite trees. Sequences. Kosmatov (2006a; 2006b) has constructed a constraint solver for sequences, inspired by an earlier solver for lists by Frühwirth. The solver expresses many sequence constraints in terms of two basic constraints, for sequence concatenation and size. Non-linear constraints. A general purpose CHR-based CLP system for nonlinear (polynomial) constraints over the real numbers was presented by De Koninck, Schrijvers et al. (2006a). The system, called INCLP(R), is based on interval arithmetic and uses an interval Newton method as well as constraint inversion to achieve respectively box and hull consistency. Interactive constraint satisfaction. Alberti, Gavanelli et al. (2005) describe the implementation of a CLP language for expressing Interactive Constraint Satisfaction Problems (ICSP). In the ICSP model incremental constraint propagation is possible even when variable domains are not fully known, performing acquisition of domain elements only when necessary. Solvers derived from union-find. Frühwirth (2006b) proposes linear-time algorithms for solving certain boolean equations and linear polynomial equations in two variables. These solvers are derived from the classic union-find algorithm (see Section 7.2). In the rest of this subsection we discuss, in a bit more detail, some typical application domains in which CHR has been used to implement constraint solvers. 7.1.1 Soft Constraints and Scheduling An important class of constraints are the so-called soft constraints which are used to represent preferences amongst solutions to a problem. Unlike hard (required) constraints which must hold in any solution, soft (preferential) constraints must only be satisfied as far as possible. Bistarelli, Frühwirth et al. (2004) present a series of constraint solvers for (mostly) extensionally defined finite domain soft constraints, based on the framework of c-semirings. In this framework, soft constraints can be combined and projected onto a subset of their variables, by using the two operators of a c-semiring. A node and arc consistency solver is presented, as well as complete solvers based on variable elimination or branch and bound optimization. Another well-known formalism for describing over-constrained systems is that of constraint hierarchies, where constraints with hierarchical strengths or preferences can be specified, and non-trivial error functions can be used to determine the solutions. Wolf (2000b) proposes an approach for solving dynamically changing constraint hierarchies. Constraint hierarchies over finite domains are transformed 28 into equivalent constraint systems, which are then solved using an adaptive CHR solver (Wolf, Gruenhagen et al. 2000; Wolf 2001a; see Section 5.1.4). Scheduling. Abdennadher and Marte (2000) have successfully used CHR for scheduling courses at the university of Munich. Their approach is based on a form of soft constraints, implemented in CHR, to deal with teacher’s preferences. A related problem, namely that of assigning classrooms to courses given a timetable, is dealt with by Abdennadher, Saft et al. (2000). An overview of both applications is found in (Abdennadher 2001). 7.1.2 Spatio-Temporal Reasoning In the context of autonomous mobile robot navigation, a crucial research topic is automated qualitative reasoning about spatio-temporal information, including orientation, named or compared distances, cardinal directions, topology and time. The use of CHR for spatio-temporal reasoning has received considerable research attention. We mention in particular the contributions of Escrig et al. (Escrig and Toledo 1998a; 1998b; Cabedo and Escrig 2003). Meyer (2000) has applied CHR for the constraint-based specification and implementation of diagrammatic environments. Grammar-based specifications of diagrammatic objects are translated to directly executable CHR rules. This approach is very powerful and flexible. The use of CHR allows the integration with other constraint domains, and additional CHR rules can easily be added to model more complex diagrammatic systems. Similar results are obtained with CHRG in the context of natural language processing (see Section 7.3.3). 7.1.3 Multi-Agent Systems FLUX (Thielscher 2002; 2005) is a high-level programming system, implemented in CHR and based on fluent calculus, for cognitive agents that reason logically about actions in the context of incomplete information. An interesting application of this system is FLUXPLAYER (Schiffel and Thielscher 2007), which won the 2006 General Game Playing (GGP) competition at AAAI’06. Seitz, Bauer et al. (2002) and Alberti et al. (2004; 2004; 2006) also applied CHR in the context of multi-agent systems. Lam and Sulzmann (2006) explore the use of CHR as an agent specification language, founded on CHR’s linear logic semantics (see Section 2.1.2). They introduce a monadic operational semantics for CHR, where special action constraints have to be processed in sequence. They reason about the termination and confluence properties of the resulting language. They were also the first to propose the use of invariants for CHR confluence testing, an approach that was later formalized by Duck, Stuckey et al. (2007) — cf. Section 3.1. 29 7.1.4 Semantic Web and Web 3.0 One of the core problems related to the so-called Semantic Web is the integration and combination of data from diverse information sources. Bressan and Goh (1998) describe an implementation of the coin (context interchange) mediator that uses CHR for solving integrity constraints. In more recent work, CHR is used for implementing an extension of the coin framework, capable of handling more data source heterogeneity (Firat 2003). Badea, Tilivea et al. (2004) present an improved mediator-based integration system. It allows forward propagation rules involving model predicates, whereas coin only allows integrity constraints on source predicates. The Web Ontology Language (OWL) is based on Description Logic (DL). Various rule-based formalisms have been considered for combination and integration with OWL or other description logics. Frühwirth (2007) proposes a CHR-based approach to DL and DL rules. Simply encoding the first-order logic theory of the DL in CHR results in a concise, correct, confluent and concurrent CHR program with performance guarantees. The Cuypers Multimedia Transformation Engine (Geurts, van Ossenbruggen et al. 2001) is a prototype system for automatic generation of Web-based presentations adapted to device-specific capabilities and user preferences. It uses CHR and traditional CLP to solve qualitative and quantitative spatio-temporal constraints. 7.1.5 Automatic Generation of Solvers Many authors have investigated the automatic generation of CHR rules, constituting a constraint solver, from a formal specification. Most authors consider extensionally defined constraints over (small) finite domains as the specification. A first line of work is that of Apt and Monfroy (2001). From an extensional definition of a finite domain constraint, a set of propagation rules is derived. These rules reduce the domain of one variable based on the domains of the other variables involved in the same constraint. As an extension, Brand and Monfroy (2003) propose to transform the derived rules to obtain stronger propagation rules. This technique is useful to obtain derived versions of constraints, such as the conjunction of two constraints. A second line of work is that of Abdennadher and Rigotti. In (2004) they derive propagation rules from extensionally defined constraints. There are two main differences with the previous line of work. Firstly, the rules are assembled from given parts, and, secondly, propagation rules are transformed into simplification rules when valid. This algorithm is implemented by the Automatic Rule Miner tool (Abdennadher, Olama et al. 2006). They extend their approach to intensional constraint definitions, where constraints are defined by logic programs (2005), and further to symbolically derive rules from the logic programs, rather than from given parts (2008). Brand (2002) has proposed a method to eliminate redundant propagation rules 30 and applies it to rules generated by RuleMiner: one of the algorithms that forms the basis of the Automatic Rule Miner tool by Abdennadher et al. (2006). 7.2 Union-Find and Other Classic Algorithms CHR is used increasingly as a general-purpose programming language. Starting a trend of investigating this side of CHR, Schrijvers and Frühwirth (2005a; 2006) implemented and analyzed the classic union-find algorithm in CHR. In particular, they showed how the optimal complexity of this algorithm can be achieved in CHR — a non-trivial achievement since this is believed to be impossible in pure Prolog. This work lead to parallel versions of the union-find algorithm (Frühwirth 2005b) and several derived algorithms (Frühwirth 2006b). Inspired by the specific optimal complexity result for the union-find algorithm, Sneyers, Schrijvers et al. (2009) have generalized this to arbitrary (RAM-machine) algorithms (see Section 3.3.2). The question of finding elegant and natural implementations of classic algorithms in CHR remains nevertheless an interesting research topic. Examples of recent work in this area are implementations of Dijkstra’s shortest path algorithm using Fibonacci heaps (Sneyers, Schrijvers et al. 2006a) and the preflow-push maximal flow algorithm (Meister 2006). 7.3 Programming Language Development Another application area in which CHR has proved to be useful is the development of programming languages. CHR has been applied to implement additional programming language features such as type systems (Section 7.3.1), metaprogramming (Section 7.3.4), and abduction (Section 7.3.2). Also, CHR has been used to implement new programming languages, especially in the context of computational linguistics (Section 7.3.3). Finally, CHR has been used for testing and verification (Section 7.3.5). 7.3.1 Type Systems CHR’s aptness for symbolic constraint solving has led to many applications in the context of type system design, type checking and type inference. While the basic Hindley-Milner type system requires no more than a simple Herbrand equality constraint, more advanced type systems require custom constraint solvers. Alves and Florido (2002) presented the first work on using Prolog and CHR for implementing the type inference framework HM(X), i.e. type inference for extensions of the Hindley-Milner type system. This work was followed up by TypeTool (Simões and Florido 2004), a tool for visualizing the type inference process. The most successful use of CHR in this area is for Haskell type classes. Type classes are a principled approach to ad hoc function overloading based on type-level constraints. By defining these type class constraints in terms of a CHR program (Stuckey and Sulzmann 2005) the essential properties of the type checker (soundness, completeness and termination) can easily be established. Moreover, various 31 extensions, such as multi-parameter type classes (Sulzmann, Schrijvers et al. 2006) and functional dependencies (Sulzmann, Duck et al. 2007) are easily expressed. At several occasions Sulzmann argues for HM(CHR), where the programmer can directly implement custom type system extensions in CHR. Wazny (2006) has made considerable contributions in this setting, in particular to type error diagnosis based on justifications. Coquery and Fages (2003; 2005) presented TCLP, a CHR-based type checker for Prolog and CHR(Prolog) that deals with parametric polymorphism, subtyping and overloading. Schrijvers and Bruynooghe (2006) reconstruct type definitions for untyped functional and logic programs. Finally, Chin, Craciun et al. (2006) presented a control-flow-based approach for variant parametric polymorphism in Java. 7.3.2 Abduction Abduction is the inference of a cause to explain a consequence: given B determine A such that A → B. It has applications in many areas: diagnosis, recognition, natural language processing, type inference, . . . The earliest paper connecting CHR with abduction is that of Abdennadher and Christiansen (2000). It shows how to model logic programs with abducibles and integrity constraints in CHR∨ . The disjunction is used for (naively) enumerating the alternatives of the abducibles, while integrity constraints are implemented as propagation rules. The HYPROLOG system of Christiansen and Dahl (2005a) combines the above approach to abductive reasoning with abductive-based logic programming in one system. Both the abducibles and the assumptions are implemented as CHR constraints. Christiansen (2006) also proposes the use of CHR for the implementation of global abduction, an extended form of logical abduction for reasoning about a dynamic world. Gavanelli, Lamma et al. (2003) propose two variant approaches to implementing abductive logic programming. The first is similar to the above approach, but tries to leverage as much as possible from a more efficient boolean constraint solver, rather than CHR. The second approach propagates abducibles based on integrity constraints. The system of Alberti, Chesani et al. (2005) extends the abductive reasoning procedure with the dynamic acquisition of new facts. These new facts serve to confirm or disconfirm earlier hypotheses. Sulzmann, Wazny et al. (2005) show that advanced type system features give rise to implications of constraints, or, in other words, constraint abduction. An extension of their CHR-based type checking algorithm is required to deal with these implications. 7.3.3 Computational Linguistics CHR allows flexible combinations of top-down and bottom-up computation (Abdennadher and Schütz 1998), and abduction fits naturally in CHR as well (see Section 7.3.2). It is therefore not 32 surprising that CHR has proven a powerful implementation and specification tool for language processors. Penn (2000) focuses on another benefit CHR provides to computational linguists, namely the possibility of delaying constraints until their arguments are sufficiently instantiated. As a comprehensive case study he considers a grammar development system for HPSG, a popular constraint-based linguistic theory. Morawietz and Blache (2002) show that CHR allows a flexible and perspicuous implementation of a series of standard chart parsing algorithms (cf. also Morawietz (2000)), as well as more advanced grammar formalisms such as minimalist grammars and property grammars. Items of a conventional chart parser are modeled as CHR constraints, and new constraints are deduced using constraint propagation. The constraint store represents the chart, from which the parse tree can be determined. Along the same lines is the CHR implementation of a context-sensitive, rule-based grammar formalism by Garat and Wonsever (2002). A more recent application of CHR in the context of natural language processing is (Christiansen and Have 2007), where a combination of Definite Clause Grammars (DCG) and CHR is used to automatically derive UML class diagrams from use cases written in a restricted natural language. CHR Grammars. The most successful approach to CHR-based language processing is given by CHR grammars (CHRG), a highly expressive, bottom-up grammar specification language proposed by Christiansen (2005). Contrary to the aforementioned approaches, which mostly use CHR as a general-purpose implementation language, Christiansen recognizes that the CHR language itself can be used as a powerful grammar formalism. CHRG’s, built as a relatively transparent layer of syntactic sugar over CHR, are to CHR what DCG’s are to Prolog. CHRG’s inherent support for context-sensitive rules readily allows linguistic phenomena such as long-distance reference and coordination to be modeled naturally (Christiansen 2005; Aguilar-Solis and Dahl 2004; Dahl 2004). CHRG grammar rules can also use extra-grammatical hypotheses, modeled as regular CHR constraints. This caters, e.g., for straightforward implementations of assumption grammars and abductive language interpretation with integrity constraints. Applications of CHRG. Using CHRG, Dahl and Blache (2005) develop directly executable specifications of property grammars. They show this combination of grammar formalisms to be robust, and able to handle various levels of granularity, as well as incomplete and incorrect input. In (Dahl and Gu 2006), an extension of this approach is used to extract concepts and relations from biomedical texts. Dahl and Voll (2004) generalize the property grammar parsing methodology into a general concept formation system, providing a cognitive sciences view of problem solving. Applications of this formalism include early lung cancer diagnosis (Barranco-Mendoza 2005, Chapter 4), error detection and correction of radiology reports obtained from speech recognition (Voll 2006, Section 5.2.8), and the analysis of biological sequences (Bavarian and Dahl 2006). 33 Christiansen and Dahl (2003) use an abductive model based on CHRG to diagnose and correct grammatical errors. Other applications of CHRG include the characterization of the grammar of ancient Egyptian hieroglyphs (Hecksher, Nielsen et al. 2002), linguistic discourse analysis (Christiansen and Dahl 2005b), and the disambiguation of biological text (Dahl and Gu 2007). An approach similar to CHRG is taken by Bès and Dahl (2003) for the parsing of balanced parentheses in natural language. 7.3.4 Meta-Programming Christiansen and Martinenghi (2000) develops a meta-programming environment, DemoII, that relies on CHR for its powerful features. Firstly, the meta-interpreter is made reversible in order to both evaluate queries and generate programs. Secondly, soundness of negation-as-failure is achieved through incremental evaluation. 7.3.5 Testing and Verification Another application domain for which CHR has proved useful is software testing and verification. Ribeiro, Zúquete et al. (2000) present a CHR-based tool for detecting security policy inconsistencies. Lötzbeyer and Pretschner (2000) and Pretschner, Slotosch et al. (2004) propose a model-based testing methodology, in which test cases are automatically generated from abstract models using CLP and CHR. They consider the ability to formulate arbitrary test case specifications by means of CHR to be one of the strengths of their approach. Gouraud and Gotlieb (2006) use a similar approach for the automatic generation of test cases for the Java Card Virtual Machine (JCVM). A formal model of the JCVM is automatically translated into CHR, and the generated CHR program is used to generate test cases. More of an exploration than testing application is the JmmSolve framework (Schrijvers 2004). Its purpose is to explore and test the behavior of declarative memory models for Java, based on the Concurrent Constraint-based Memory Machines proposal of V. Saraswat. 7.4 Industrial CHR Users Although most CHR systems are essentially still research prototypes, there are a few systems that can be considered to be robust enough for industrial application. We give a few examples of companies that are currently using CHR. The New-Zealand-based company Scientific Software & Systems Ltd. (2008) is one of the main industrial users of CHR. The company uses CHR throughout its flagship product the SecuritEase stock broking system6 . SecuritEase provides front office (order entry) and back-office (settlement and delivery) functions for stock brokers in Australia and New Zealand. Inside SecuritEase CHR is used for: 1. implementing the logic to recognize advantageous market conditions to automatically place orders in equity markets, 6 http://www.securitease.com/ 34 2. translating high-level queries to SQL, 3. describing complex relationships between mutually dependent fields on user input screens, and calculating the consequences of user input actions, and 4. realizing a Financial Information eXchange (FIX) server. The Canadian company Cornerstone Technology Inc.7 has created an inference engine for solving and optimizing collections of design constraints, using Prolog and CHR. The design constraints work together to determine what design configuration to use, select components from catalogs, compute dimensions for custom components, and arrange the components into assemblies. The engine allows for generating, interactive editing, and validating of injection mould designs. Part of the system is covered by US Patent 7,117,055. BSSE System and Software Engineering8, a German company specializing in the discipline of full automation of software development, uses K.U.Leuven JCHR for the generation of test data for unit tests. At the MITRE Corporation9, CHR is used in the context of optical network design. It is used to implement constraint-based optimization, network configuration analysis, and as a tool coordination framework. 8 Conclusions In this section, we first try to assess to what extent we have covered the CHR literature in this survey (Section 8.1). Next, in Section 8.2, we look back at the research topics that were mentioned in the previous CHR survey (Frühwirth 1998) as being open issues. Finally, to conclude this survey, we propose four remaining “grand challenges” for CHR researchers. 8.1 Survey Coverage and Bibliographic Meta-Information This survey cites 182 publications related to CHR. For convenience, we define the total number of CHR-related publications as the number of publications that cite (Frühwirth 1998), according to Google Scholar (with some manual corrections for errors in the Google Scholar result list). Figure 6 compares the number of publications we cite in this survey with the total number of CHR-related publications since 1998. Globally, we cite roughly half of the CHR-related publications; the remaining half are preliminary versions of cited publications and papers that use CHR or refer to CHR in only a relatively minor way. Figure 7 shows how CHR authors have collaborated. This graph is derived from the joint authorships of papers cited in this survey. 7 8 9 http://www.cornerstonemold.com/ http://www.bsse.biz/ http://www.mitre.org/ 35 50 100 citing the previous survey (source: Google Scholar) cited in this survey, of which... ... from Melbourne/Singapore ... from Leuven ... from Ulm % covered Number of publications... 40 90 80 35 70 30 60 25 50 20 40 15 30 10 20 5 10 0 Percentage covered 45 0 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 Year Fig. 6. Estimation of the number of CHR-related publications and the number of CHR-related publications cited in this survey (and their origin). 8.2 Retrospection The first CHR survey (Frühwirth 1998) ended with a list of research topics from the first draft paper on CHR in 1991, noting that most of those topics were still open in 1998. We re-examine that list: • Termination and confluence. As seen in Sections 3.1 and 3.2, both confluence (Abdennadher, Frühwirth et al. 1999; Duck 2005; Duck, Stuckey et al. 2007; Raiser and Tacchella 2007) and termination (Frühwirth 2000; Pilozzi, Schrijvers et al. 2007; Voets, Pilozzi et al. 2007) have received a great deal of attention in the past ten years. While substantial results have been obtained for confluence, this notion turned out to be rather impractical. The recent proposal of observable confluence seems to be a first step towards a more practical notion of confluence. In the area of termination analysis there appears to be a much wider scope for improvement. Existing work, mostly carrying over results of other programming languages, only works for a limited fraction of programs. Propagation rules and logical variables, part of typical CHR programs, cannot be dealt with. An important breakthrough is still ahead of us. • Negation and entailment of constraints. Negation as absence (Van Weert, Sneyers et al. 2006) was recently explored (see Section 5.2.2), but this has little relation to the logical negation of constraints. The topic of entailment is closely related to building solver hierarchies (Duck, Stuckey et al. 2003; Schrijvers, Demoen et al. 2006) (see Section 5.3). Both topics are still an important issue today. • Combination and communication of solvers. This topic is again related to solver hierarchies (see the item above), but also to integration of solvers (Abdennadher and Frühwirth 2004) (see Section 3.1). Another potential approach could be based on a compositional 36 Lamma Milano Schmauss Chesani Alberti Gabbrielli Krämer Will Delzanno Torroni Tacchella Rigotti Gavanelli Saft Salem Meo Mello Sobhi Raiser Olama Daolio Thabet Marte Aguilar-Solis Abdennadher Bavarian Schütz Blache Dahl Gruenhagen Geske Morawietz Christiansen Brisset Wolf Meuss Bes Gu Dao Djelloul Voll Have Vitorino Martinenghi Robin Meister Frühwirth Menezes Kaeser Betz Aurelio Holzbaur Toledo García de la Banda Warren Stuckey Wielemaker Monfroy Brand Escrig Zhou Apt Demoen Wuille Cabedo Sulzmann Peyton-Jones Schrijvers Haemmerlé Duck Van Weert De Koninck Wang Wazny Chin Sneyers Fages Sarna-Starosta De Schreye Pilozzi Bruynooghe Coquery Lam Voets Ramakrishnan Fig. 7. CHR author collaboration graph. Two authors are connected if they have co-authored a CHR-related paper cited in this survey. The number of co-authored papers is reflected in the edge thickness. 37 • • • • • • semantics for CHR (Delzanno, Gabbrielli et al. 2005) (see Section 2.2). In any case, this is still an important open research topic. Correctness w.r.t. specifications, debugging. Although some progress has been made (Section 4.3), these topics are still mostly open. Soft constraints with priorities. As we discussed in Section 7.1, two distinct approaches were proposed for dealing with (prioritized) soft constraints in CHR. Dynamic constraints, removable constraints. Wolf, Gruenhagen et al. (2000) designed an incremental adaptation algorithm that supports dynamic and removable constraints. An efficient implementation of adaptive CHR exists for Java (Wolf 2001a). We discussed this in Sections 5.1.4 and 4.1.3 respectively. Automatic labeling, variable projection. While progress has been made on several accounts of constraint solver support, these topics have not been addressed yet. The topic of projection, the elimination of existentially quantified variables, is particularly challenging to generalize to arbitrary CHR solvers. Any progress would be highly significant. Partial evaluation. Section 4.2.3 mentions recent work in this area (Frühwirth 2005c; Tacchella, Gabbrielli et al. 2007; Sarna-Starosta and Schrijvers 2007). For now, it is clear that the multi-headedness of CHR makes a straightforward application of partial evaluation techniques for conventional languages to CHR programs nearly impossible. Further investigation of techniques tailored towards CHR are necessary to make substantial improvements. Abstract interpretation. A general framework for abstract interpretation in the context of CHR was proposed (Schrijvers, Stuckey et al. 2005) (see Section 4.2.2). However, only a limited number of analyses have been formulated in the framework so far. Moreover, little information is present in a CHR program on its own. In order to make analysis results more accurate, we require an analysis framework that encompasses both CHR and its host language. Such a framework should prove to be beneficial to the accuracy of the analyses for both languages. 8.3 Grand Challenges Much progress has been made in the last ten years and many of the open problems have been resolved. However, a few difficult questions are still unresolved, and in the meantime many more problems have become apparent. In our view the following four topics are grand challenges that must be addressed by the CHR research community in the next decade. These four grand challenges are not only of technical interest, they are also vital for the further adoption of the CHR community and user-base. 1. Programming environments and tools. If measured by current standards, which dictate that a language is only as good as its tools, CHR is a poor language indeed. While several strong theoretical results have been obtained in the field of program analysis for CHR, little (if any) effort has been made to embody these results into a practical tool for day-to-day programming. For example, programmers have to manually check for confluence, and, in the case of non-confluence, complete their solvers by hand. 38 2. Execution control. Compared to the refined operational semantics, the rule priorities of the CHRrp semantics are a step in the realization of Kowalski’s slogan “Algorithm = Logic + Control” in the context of CHR. However, there are still many challenges in finding satisfactory ways to allow programmers to fine-tune the execution strategy of their programs. 3. Parallelism, concurrency. Recent theoretical work (Frühwirth 2005b; Meister 2006) confirms CHR’s inherent aptness for parallel programming. Truly leveraging the full power of current and future multi-core processors through CHR, however, requires practical, efficient, concurrent implementations. Currently, these implementations are still in early stages (cf. Section 4.1.2 for a discussion of some early Haskell-based prototypes). Many important problems are still to be researched in this domain, from language features and semantics, to analysis, implementation, and optimization. 4. Scaling to industrial applications. Strong theoretical results have been obtained concerning the performance of CHR (cf. Section 3.3.2), and these have also been reflected in the actual runtimes of CHR programs. However, CHR is still at least one or two orders of magnitude slower than most conventional programming languages and constraint solvers. This becomes particularly apparent for CHR applications that surpass the toy research programs of 10 lines: industrial applications for instance, such as those mentioned in Section 7.4, easily count 100 to 1000 lines. The refined semantics compilation scheme (see Section 4) was not designed or benchmarked with such program sizes in mind. Some potential scalability aspects are: • • • • huge constraint stores that have to be persistent and/or distributed; (dynamic) optimizations, also for variants and extensions of CHR; incremental compilation, run-time rule assertion, reflection; higher-order / meta-programming. These and other aspects must be investigated to achieve further industrial adoption. Acknowledgments The authors would like to thank Alan Baljeu (Cornerstone), Bart Demoen, Mike Elston (Scientific Software & Systems), Thom Frühwirth, Ralf Gerlich (BSSE), Gerda Janssens, Paolo Pilozzi, Dean Voets, Jonathan Weston-Dawkes (MITRE), and Pieter Wuille for their invaluable contributions to this paper. Jon Sneyers and Leslie De Koninck are funded by Ph.D. grants of the Institute for the Promotion of Innovation through Science and Technology in Flanders (IWTVlaanderen). Peter Van Weert is a Research Assistant of the fund for Scientific Research - Flanders (Belgium) (F.W.O. - Vlaanderen). Tom Schrijvers is a PostDoctoral Researcher of the fund for Scientific Research - Flanders. References Abdennadher, S. 2000. A language for experimenting with declarative paradigms. In 39 RCoRP ’00(bis): Proc. 2nd Workshop on Rule-Based Constraint Reasoning and Programming, T. Frühwirth et al., Eds. Abdennadher, S. 2001. Rule-based constraint programming: Theory and practice. Habilitationsschrift. Institute of Computer Science, LMU, Munich, Germany. Abdennadher, S. and Christiansen, H. 2000. An experimental CLP platform for integrity constraints and abduction. In FQAS ’00: Proc. 4th Intl. Conf. Flexible Query Answering Systems. Springer, 141–152. Abdennadher, S. and Frühwirth, T. 1998. On completion of Constraint Handling Rules. In CP ’98, M. J. Maher and J.-F. Puget, Eds. LNCS, vol. 1520. Springer, 25–39. Abdennadher, S. and Frühwirth, T. 1999. Operational equivalence of CHR programs and constraints. In CP ’99, J. Jaffar, Ed. LNCS, vol. 1713. Springer, 43–57. Abdennadher, S. and Frühwirth, T. 2004. Integration and optimization of rule-based constraint solvers. In LOPSTR ’03, M. Bruynooghe, Ed. LNCS, vol. 3018. Springer, 198–213. Abdennadher, S., Frühwirth, T., and Holzbaur, C., Eds. 2005. Special Issue on Constraint Handling Rules. Theory and Practice of Logic Programming, vol. 5(4–5). Abdennadher, S., Frühwirth, T., and Meuss, H. 1999. Confluence and semantics of constraint simplification rules. Constraints 4, 2, 133–165. Abdennadher, S., Krämer, E., Saft, M., and Schmauß, M. 2002. JACK: A Java Constraint Kit. In WFLP ’01: Proc. 10th Intl. Workshop on Functional and (Constraint) Logic Programming, Selected Papers, M. Hanus, Ed. ENTCS, vol. 64. Elsevier, 1–17. See also http://pms.ifi.lmu.de/software/jack/. Abdennadher, S. and Marte, M. 2000. University course timetabling using Constraint Handling Rules. In Holzbaur and Frühwirth (2000b), 311–325. Abdennadher, S., Olama, A., Salem, N., and Thabet, A. 2006. ARM: Automatic Rule Miner. In LOPSTR ’06, Revised Selected Papers. LNCS, vol. 4407. Springer. Abdennadher, S. and Rigotti, C. 2004. Automatic generation of rule-based constraint solvers over finite domains. ACM TOCL 5, 2, 177–205. Abdennadher, S. and Rigotti, C. 2005. Automatic generation of CHR constraint solvers. In Abdennadher, Frühwirth et al. (2005), 403–418. Abdennadher, S. and Saft, M. 2001. A visualization tool for Constraint Handling Rules. In WLPE ’01, A. Kusalik, Ed. Abdennadher, S., Saft, M., and Will, S. 2000. Classroom assignment using constraint logic programming. In PACLP ’00: Proc. 2nd Intl. Conf. and Exhibition on Practical Application of Constraint Technologies and Logic Programming. Abdennadher, S. and Schütz, H. 1998. CHR∨ , a flexible query language. In FQAS ’98: Proc. 3rd Intl. Conf. on Flexible Query Answering Systems, T. Andreasen, H. Christiansen, and H. Larsen, Eds. LNAI, vol. 1495. Springer, 1–14. Abdennadher, S. and Sobhi, I. 2008. Generation of rule-based constraint solvers: Combined approach. In LOPSTR ’07, Revised Selected Papers, A. King, Ed. LNCS, vol. 4915. Aguilar-Solis, D. and Dahl, V. 2004. Coordination revisited – a Constraint Handling Rule approach. In IBERAMIA ’04: Proc. 9th Ibero-American Conf. on AI. LNCS, vol. 3315. 315–324. Alberti, M., Chesani, F., Gavanelli, M., and Lamma, E. 2005. The CHR-based implementation of a system for generation and confirmation of hypotheses. In Wolf, Frühwirth et al. (2005), 111–122. Alberti, M., Daolio, D., Torroni, P., Gavanelli, M., Lamma, E., and Mello, P. 2004. Specification and verification of agent interaction protocols in a logic-based 40 system. In SAC ’04: Proc. 19th ACM Symp. Applied Computing, H. Haddad et al., Eds. ACM Press, 72–78. Alberti, M., Gavanelli, M., Lamma, E., Chesani, F., Mello, P., and Torroni, P. 2006. Compliance verification of agent interaction: a logic-based software tool. Applied Artificial Intelligence 20, 2–4, 133–157. Alberti, M., Gavanelli, M., Lamma, E., Mello, P., and Milano, M. 2005. A CHR-based implementation of known arc-consistency. In Abdennadher, Frühwirth et al. (2005), 419–440. Alberti, M., Gavanelli, M., Lamma, E., Mello, P., and Torroni, P. 2004. Specification and verification of agent interaction using social integrity constraints. In LCMAS’03: Logic and Communication in Multi-Agent Systems. ENTCS, vol. 85(2). Elsevier, 94–116. Alves, S. and Florido, M. 2002. Type inference using Constraint Handling Rules. In WFLP ’01: Proc. 10th Intl. Workshop on Functional and (Constraint) Logic Programming, Selected Papers, M. Hanus, Ed. ENTCS, vol. 64. Elsevier, 56–72. Apt, K. R. and Monfroy, E. 2001. Constraint programming viewed as rule-based programming. TPLP 1, 6, 713–750. Badea, L., Tilivea, D., and Hotaran, A. 2004. Semantic Web Reasoning for OntologyBased Integration of Resources. PPSWR ’04: Proc. 2nd Intl. Workshop on Principles And Practice Of Semantic Web Reasoning 3208, 61–75. Barranco-Mendoza, A. 2005. Stochastic and heuristic modelling for analysis of the growth of pre-invasive lesions and for a multidisciplinary approach to early cancer diagnosis. Ph.D. thesis, Simon Fraser University, Canada. Bavarian, M. and Dahl, V. 2006. Constraint based methods for biological sequence analysis. J. UCS 12, 11, 1500–1520. Bès, G. G. and Dahl, V. 2003. Balanced parentheses in NL texts: a useful cue in the syntax/semantics interface. In Proc. Lorraine-Saarland Workshop on Prospects and Advances in the Syntax/Semantics Interface. Poster Paper. Betz, H. 2007. Relating coloured Petri nets to Constraint Handling Rules. In Djelloul, Duck et al. (2007), 33–47. Betz, H. and Frühwirth, T. 2005. A linear-logic semantics for Constraint Handling Rules. In CP ’05. LNCS, vol. 3709. Springer, 137–151. Betz, H. and Frühwirth, T. 2007. A linear-logic semantics for Constraint Handling Rules with disjunction. In Djelloul, Duck et al. (2007), 17–31. Bistarelli, S., Frühwirth, T., Marte, M., and Rossi, F. 2004. Soft constraint propagation and solving in Constraint Handling Rules. Computational Intelligence: Special Issue on Preferences in AI and CP 20, 2 (May), 287–307. Boespflug, M. 2007. TaiChi:how to check your types with serenity. The Monad.Reader 9, 17–31. Bouissou, O. 2004. A CHR library for SiLCC. Diplomathesis. Technical University of Berlin, Germany. Brand, S. 2002. A note on redundant rules in rule-based constraint programming. In Joint ERCIM/CologNet Intl. Workshop on Constraint Solving and Constraint Logic Programming, Selected papers. LNCS, vol. 2627. Springer, 279–336. Brand, S. and Monfroy, E. 2003. Deductive generation of constraint propagation rules. In RULE ’03: 4th Intl. Workshop on Rule-Based Programming, G. Vidal, Ed. ENTCS, vol. 86(2). Elsevier, 45–60. Bressan, S. and Goh, C. H. 1998. Answering queries in context. In FQAS ’98: Proc. 3rd Intl. Conf. on Flexible Query Answering Systems, T. Andreasen, H. Christiansen, and H. Larsen, Eds. LNAI, vol. 1495. Springer, 68–82. 41 Cabedo, L. M. and Escrig, M. T. 2003. Modeling motion by the integration of topology and time. J. UCS 9, 9, 1096–1122. Chin, W.-N., Craciun, F., Khoo, S.-C., and Popeea, C. 2006. A flow-based approach for variant parametric types. SIGPLAN Not. 41, 10, 273–290. Chin, W.-N., Sulzmann, M., and Wang, M. 2003. A type-safe embedding of Constraint Handling Rules into Haskell. Honors Thesis. School of Computing, National University of Singapore. Christiansen, H. 2005. CHR grammars. In Abdennadher, Frühwirth et al. (2005), 467– 501. Christiansen, H. 2006. On the implementation of global abduction. In CLIMA ’06: 7th Intl. Workshop on Computational Logic in Multi-Agent Systems – Revised, Selected and Invited Papers, K. Inoue, K. Satoh, and F. Toni, Eds. LNCS, vol. 4371. Springer, 226–245. Christiansen, H. and Dahl, V. 2003. Logic grammars for diagnosis and repair. Intl. J. Artificial Intelligence Tools 12, 3, 227–248. Christiansen, H. and Dahl, V. 2005a. HYPROLOG: A new logic programming language with assumptions and abduction. In Gabbrielli and Gupta (2005), 159–173. Christiansen, H. and Dahl, V. 2005b. Meaning in context. In CONTEXT ’05: Proc. 4th Intl. and Interdisciplinary Conf. Modeling and Using Context. LNAI, vol. 3554. Springer, 97–111. Christiansen, H. and Have, C. T. 2007. From use cases to UML class diagrams using logic grammars and constraints. In RANLP ’07: Proc. Intl. Conf. Recent Adv. Nat. Lang. Processing. 128–132. Christiansen, H. and Martinenghi, D. 2000. Symbolic constraints for meta-logic programming. In Holzbaur and Frühwirth (2000b), 345–367. Coquery, E. and Fages, F. 2003. TCLP: A type checker for CLP(X ). In WLPE ’03, F. Mesnard and A. Serebrenik, Eds. K.U.Leuven, Dept. Comp. Sc., Technical report CW 371. 17–30. Coquery, E. and Fages, F. 2005. A type system for CHR. In Schrijvers and Frühwirth (2005b), 19–33. Dahl, V. 2004. An abductive treatment of long distance dependencies in CHR. In CSLP ’04: Proc. First Intl. Workshop on Constraint Solving and Language Processing. LNCS, vol. 3438. Springer, 17–31. Invited Paper. Dahl, V. and Blache, P. 2005. Extracting selected phrases through constraint satisfaction. In Proc. 2nd Intl. Workshop on Constraint Solving and Language Processing. Dahl, V. and Gu, B. 2006. Semantic property grammars for knowledge extraction from biomedical text. In Etalle and Truszczynski (2006), 442–443. Poster Paper. Dahl, V. and Gu, B. 2007. A CHRG analysis of ambiguity in biological texts. In CSLP ’07: Proc. 4th Intl. Workshop on Constraints and Language Processing. Extended Abstract. Dahl, V. and Niemelä, I., Eds. 2007. ICLP ’07: Proc. 23rd Intl. Conf. Logic Programming. LNCS, vol. 4670. Springer. Dahl, V. and Voll, K. 2004. Concept formation rules: An executable cognitive model of knowledge construction. In NLUCS ’04: Proc. First Intl. Workshop on Natural Language Understanding and Cognitive Sciences. De Koninck, L., Schrijvers, T., and Demoen, B. 2006a. INCLP(R) - Interval-based nonlinear constraint logic programming over the reals. In Fink, Tompits et al. (2006), 91–100. De Koninck, L., Schrijvers, T., and Demoen, B. 2006b. Search strategies in CHR(Prolog). In Schrijvers and Frühwirth (2006), 109–123. 42 De Koninck, L., Schrijvers, T., and Demoen, B. 2007a. The correspondence between the Logical Algorithms language and CHR. In Dahl and Niemelä (2007), 209–223. De Koninck, L., Schrijvers, T., and Demoen, B. 2007b. User-definable rule priorities for CHR. In PPDP ’07, M. Leuschel and A. Podelski, Eds. ACM Press, 25–36. De Koninck, L. and Sneyers, J. 2007. Join ordering for Constraint Handling Rules. In Djelloul, Duck et al. (2007), 107–121. De Koninck, L., Stuckey, P. J., and Duck, G. J. 2008. Optimizing compilation of CHR with rule priorities. In Proc. 9th Intl. Symp. Functional and Logic Programming, J. Garrigue and M. Hermenegildo, Eds. LNCS, vol. 4989. Springer, 32–47. Delzanno, G., Gabbrielli, M., and Meo, M. C. 2005. A compositional semantics for CHR. In PPDP ’05, P. Barahona and A. Felty, Eds. ACM Press, 209–217. Demoen, B. and Lifschitz, V., Eds. 2004. ICLP ’04: Proc. 20th Intl. Conf. Logic Programming. LNCS, vol. 3132. Springer. Djelloul, K., Dao, T.-B.-H., and Frühwirth, T. 2007. Toward a first-order extension of Prolog’s unification using CHR: a CHR first-order constraint solver over finite or infinite trees. In SAC ’07: Proc. 2007 ACM Symp. Applied computing. ACM Press, 58–64. Djelloul, K., Duck, G. J., and Sulzmann, M., Eds. 2007. CHR ’07: Proc. 4th Workshop on Constraint Handling Rules. Ducassé, M. 1999. Opium: an extendable trace analyzer for Prolog. J. Logic Programming 39, 1–3, 177–223. Duck, G. J. 2005. Compilation of Constraint Handling Rules. Ph.D. thesis, University of Melbourne, Victoria, Australia. Duck, G. J. and Schrijvers, T. 2005. Accurate functional dependency analysis for Constraint Handling Rules. In Schrijvers and Frühwirth (2005b), 109–124. Duck, G. J., Stuckey, P. J., and Brand, S. 2006. Etalle and Truszczynski (2006), 117–131. ACD term rewriting. In Duck, G. J., Stuckey, P. J., Garcı́a de la Banda, M., and Holzbaur, C. 2003. Extending arbitrary solvers with Constraint Handling Rules. In PPDP ’03. ACM Press, 79–90. Duck, G. J., Stuckey, P. J., Garcı́a de la Banda, M., and Holzbaur, C. 2004. The refined operational semantics of Constraint Handling Rules. In Demoen and Lifschitz (2004), 90–104. Duck, G. J., Stuckey, P. J., and Sulzmann, M. 2007. Observable confluence for Constraint Handling Rules. In Dahl and Niemelä (2007), 224–239. Escrig, M. T. and Toledo, F. 1998a. A framework based on CLP extended with CHRs for reasoning with qualitative orientation and positional information. J. Visual Languages and Computing 9, 1, 81–101. Escrig, M. T. and Toledo, F. 1998b. Qualitative Spatial Reasoning: Theory and Practice — Application to Robot Navigation. IOS Press. Etalle, S. and Truszczynski, M., Eds. 2006. ICLP ’06: Proc. 22nd Intl. Conf. Logic Programming. LNCS, vol. 4079. Springer. Fink, M., Tompits, H., and Woltran, S., Eds. 2006. WLP ’06: Proc. 20th Workshop on Logic Programming. T.U.Wien, Austria, INFSYS Research report 1843-06-02. Firat, A. 2003. Information integration using contextual knowledge and ontology merging. Ph.D. thesis, MIT Sloan School of Management, Cambridge, Massachusetts, USA. Frühwirth, T. 1992. Constraint simplification rules. Tech. Rep. ECRC-92-18, European Computer-Industry Research Centre, Munich, Germany. July. 43 Frühwirth, T. 1995. Constraint Handling Rules. In Constraint Programming: Basic and Trends — Selected Papers of the 22nd Spring School in Theoretical Computer Sciences, May 16–20, 1994, A. Podelski, Ed. LNCS, vol. 910. Springer, 90–107. Frühwirth, T. 1998. Theory and practice of Constraint Handling Rules. J. Logic Programming, Special Issue on Constraint Logic Programming 37, 1–3, 95–138. Frühwirth, T. 2000. Proving termination of constraint solver programs. In New Trends in Constraints, Joint ERCIM/Compulog Net Workshop, October 1999, Selected papers, K. Apt, A. Kakas, E. Monfroy, and F. Rossi, Eds. LNCS, vol. 1865. Springer, 298–317. Frühwirth, T. 2001. On the number of rule applications in constraint programs. In Declarative Programming - Selected Papers from AGP 2000, A. Dovier, M. C. Meo, and A. Omicini, Eds. ENTCS, vol. 48. Elsevier, 147–166. Frühwirth, T. 2002a. As time goes by: Automatic complexity analysis of simplification rules. In KR ’02: Proc. 8th Intl. Conf. Princ. Knowledge Representation and Reasoning, D. Fensel, F. Giunchiglia, D. McGuinness, and M.-A. Williams, Eds. Morgan Kaufmann, 547–557. Frühwirth, T. 2002b. As time goes by II: More automatic complexity analysis of concurrent rule programs. In QAPL ’01: Proc. First Intl. Workshop on Quantitative Aspects of Programming Languages, A. D. Pierro and H. Wiklicky, Eds. ENTCS, vol. 59(3). Elsevier. Frühwirth, T. 2005a. Logical rules for a lexicographic order constraint solver. In Schrijvers and Frühwirth (2005b), 79–91. Frühwirth, T. 2005b. Parallelizing union-find in Constraint Handling Rules using confluence. In Gabbrielli and Gupta (2005), 113–127. Frühwirth, T. 2005c. Specialization of concurrent guarded multi-set transformation rules. In LOPSTR ’04, S. Etalle, Ed. LNCS, vol. 3573. Springer, 133–148. Frühwirth, T. 2006a. Complete propagation rules for lexicographic order constraints over arbitrary domains. In Recent Advances in Constraints, CSCLP ’05: Joint ERCIM/CoLogNET Intl. Workshop on Constraint Solving and CLP, Revised Selected and Invited Papers. LNAI, vol. 3978. Springer. Frühwirth, T. 2006b. Deriving linear-time algorithms from union-find in CHR. In Schrijvers and Frühwirth (2006), 49–60. Frühwirth, T. 2007. Description logic and rules the CHR way. In Djelloul, Duck et al. (2007), 49–61. Frühwirth, T. 2009. Constraint Handling Rules. Cambridge University Press. To appear. Frühwirth, T. et al., Eds. 2000. RCoRP ’00: Proc. 1st Workshop on Rule-Based Constraint Reasoning and Programming. Frühwirth, T. and Abdennadher, S. 2001. The Munich rent advisor: A success for logic programming on the internet. TPLP 1, 3, 303–319. Frühwirth, T. and Abdennadher, S. 2003. Essentials of Constraint Programming. Springer. Frühwirth, T. and Brisset, P. 1995. High-level implementations of Constraint Handling Rules. Tech. Rep. ECRC-95-20, European Computer-Industry Research Centre. Frühwirth, T. and Brisset, P. 1998. Optimal placement of base stations in wireless indoor telecommunication. In CP ’98, M. J. Maher and J.-F. Puget, Eds. LNCS, vol. 1520. Springer, 476–480. Frühwirth, T. and Brisset, P. 2000. Placing base stations in wireless indoor communication networks. IEEE Intelligent Systems and Their Applications 15, 1, 49–53. Frühwirth, T., Di Pierro, A., and Wiklicky, H. 2002. Probabilistic Constraint Handling Rules. In WFLP ’02: Proc. 11th Intl. Workshop on Functional and (Constraint) 44 Logic Programming, Selected Papers, M. Comini and M. Falaschi, Eds. ENTCS, vol. 76. Elsevier. Frühwirth, T. and Holzbaur, C. 2003. Source-to-source transformation for a class of expressive rules. In AGP ’03: Joint Conf. Declarative Programming APPIA-GULPPRODE, F. Buccafurri, Ed. 386–397. Frühwirth, T. and Meister, M., Eds. 2004. CHR ’04: 1st Workshop on Constraint Handling Rules: Selected Contributions. Gabbrielli, M. and Gupta, G., Eds. 2005. ICLP ’05: Proc. 21st Intl. Conf. Logic Programming. LNCS, vol. 3668. Springer. Gabbrielli, M. and Meo, M. C. 2009. A compositional semantics for CHR. ACM TOCL 10, 2. Ganzinger, H. and McAllester, D. A. 2002. Logical algorithms. In Stuckey (2002), 209–223. Garat, D. and Wonsever, D. 2002. A constraint parser for contextual rules. In Proc. 22nd Intl. Conf. of the Chilean Computer Science Society. IEEE Computer Society, 234–242. Gavanelli, M., Lamma, E., Mello, P., et al. 2003. Interpreting abduction in CLP. In AGP ’03: Joint Conf. Declarative Programming APPIA-GULP-PRODE, F. Buccafurri, Ed. 25–35. Geurts, J., van Ossenbruggen, J., and Hardman, L. 2001. Application-specific constraints for multimedia presentation generation. In MMM ’01: Proc. 8th Intl. Conf. on Multimedia Modeling. 247–266. Gouraud, S.-D. and Gotlieb, A. 2006. Using CHRs to generate functional test cases for the Java card virtual machine. In PADL ’06: Proc. 8th Intl. Symp. Practical Aspects of Declarative Languages, P. Van Hentenryck, Ed. LNCS, vol. 3819. Springer, 1–15. Haemmerlé, R. and Fages, F. 2007. Abstract critical pairs and confluence of arbitrary binary relations. In RTA ’07: Proc. 18th Intl. Conf. Term Rewriting and Applications. LNCS, vol. 4533. Springer. Hanus, M. 2006. Adding Constraint Handling Rules to Curry. In Fink, Tompits et al. (2006), 81–90. Hecksher, T., Nielsen, S. T., and Pigeon, A. 2002. A CHRG model of the ancient Egyptian grammar. Unpublished student project report, Roskilde University, Denmark. Holzbaur, C. and Frühwirth, T. 1998. Constraint Handling Rules reference manual, release 2.2. Tech. Rep. TR-98-01, Österreichisches Forschungsinstitut für Artificial Intelligence, Wien. Holzbaur, C. and Frühwirth, T. 1999. Compiling Constraint Handling Rules into Prolog with attributed variables. In PPDP ’99, G. Nadathur, Ed. LNCS, vol. 1702. Springer, 117–133. Holzbaur, C. and Frühwirth, T. 2000a. A Prolog Constraint Handling Rules compiler and runtime system. In Holzbaur and Frühwirth (2000b), 369–388. Holzbaur, C. and Frühwirth, T., Eds. 2000b. Special Issue on Constraint Handling Rules. Journal of Applied Artificial Intelligence, vol. 14(4). Holzbaur, C., Garcı́a de la Banda, M., Stuckey, P. J., and Duck, G. J. 2005. Optimizing compilation of Constraint Handling Rules in HAL. In Abdennadher, Frühwirth et al. (2005), 503–531. Käser, M. and Meister, M. 2006. Implementation of an F-Logic kernel in CHR. In Schrijvers and Frühwirth (2006), 33–47. Kosmatov, N. 2006a. A constraint solver for sequences and its applications. In Proc. 2006 ACM Symp. on Applied Computing. ACM Press, 404–408. 45 Kosmatov, N. 2006b. Constraint solving for sequences in software validation and verification. In INAP ’05: Proc. 16th Intl. Conf. Applications of Declarative Programming and Knowledge Management. LNCS, vol. 4369. Springer, 25–37. Krämer, E. 2001. A generic search engine for a Java Constraint Kit. Diplomarbeit. Institute of Computer Science, LMU, Munich, Germany. Lam, E. S. and Sulzmann, M. 2006. Towards agent programming in CHR. In Schrijvers and Frühwirth (2006), 17–31. Lam, E. S. and Sulzmann, M. 2007. A concurrent Constraint Handling Rules semantics and its implementation with software transactional memory. In DAMP ’07: Proc. ACM SIGPLAN Workshop on Declarative Aspects of Multicore Programming. ACM Press. System’s homepage at http://taichi.ddns.comp.nus.edu.sg/taichiwiki/CCHR/. Lötzbeyer, H. and Pretschner, A. 2000. AutoFocus on constraint logic programming. In LPSE ’00: Proc. Intl. Workshop on (Constraint) Logic Programming and Software Engineering. Maher, M. J. 2002. Propagation completeness of reactive constraints. In Stuckey (2002), 148–162. Meister, M. 2006. Fine-grained parallel implementation of the preflow-push algorithm in CHR. In Fink, Tompits et al. (2006), 172–181. Meister, M., Djelloul, K., and Frühwirth, T. 2006. Complexity of a CHR solver for existentially quantified conjunctions of equations over trees. In CSCLP ’06: Proc. 11th Annual ERCIM Workshop on Constraint Solving and Constraint Programming, F. Azevedo et al., Eds. LNCS, vol. 4651. Springer, 139–153. Meister, M., Djelloul, K., and Robin, J. 2007. A unified semantics for Constraint Handling Rules in transaction logic. In LPNMR ’07: Proc. 9th Intl. Conf. Logic Programming and Nonmonotonic Reasoning, C. Baral, G. Brewka, and J. S. Schlipf, Eds. LNCS, vol. 4483. Springer, 201–213. Menezes, L., Vitorino, J., and Aurelio, M. 2005. A high performance CHR∨ execution engine. In Schrijvers and Frühwirth (2005b), 35–45. Meyer, B. 2000. A constraint-based framework for diagrammatic reasoning. In Holzbaur and Frühwirth (2000b), 327–344. Morawietz, F. 2000. Chart parsing and constraint programming. In COLING ’00: Proc. 18th Intl. Conf. on Computational Linguistics, M. Kay, Ed. Morgan Kaufmann. Morawietz, F. and Blache, P. 2002. Parsing natural languages with CHR. Unpublished Draft. Penn, G. 2000. Applying Constraint Handling Rules to HPSG. In Frühwirth et al. (2000). Pilozzi, P., Schrijvers, T., and De Schreye, D. 2007. Proving termination of CHR in Prolog: A transformational approach. In WST ’07: 9th Intl. Workshop on Termination. Pretschner, A., Slotosch, O., Aiglstorfer, E., and Kriebel, S. 2004. Model-based testing for real. J. Software Tools for Technology Transfer (STTT) 5, 2–3, 140–157. Raiser, F. 2007. Graph transformation systems in CHR. In Dahl and Niemelä (2007), 240–254. Raiser, F. and Tacchella, P. 2007. On confluence of non-terminating CHR programs. In Djelloul, Duck et al. (2007), 63–76. Ribeiro, C., Zúquete, A., Ferreira, P., and Guedes, P. 2000. Security policy consistency. In Frühwirth et al. (2000). Ringwelski, G. and Schlenker, H. 2000a. Type inference in CHR programs for the composition of constraint systems. In WLP ’00: Proc. 15th Workshop on Logic Programming, S. Abdennadher, U. Geske, and D. Seipel, Eds. 137–146. Ringwelski, G. and Schlenker, H. 2000b. Using typed interfaces to compose CHR 46 programs. In RCoRP ’00(bis): Proc. 2nd Workshop on Rule-Based Constraint Reasoning and Programming, T. Frühwirth et al., Eds. Robin, J. and Vitorino, J. 2006. ORCAS: Towards a CHR-based model-driven framework of reusable reasoning components. In Fink, Tompits et al. (2006), 192–199. Robin, J., Vitorino, J., and Wolf, A. 2007. Constraint programming architectures: Review and a new proposal. J. UCS 13, 6, 701–720. Sarna-Starosta, B. and Ramakrishnan, C. 2007. Compiling Constraint Handling Rules for efficient tabled evaluation. In PADL ’07: Proc. 9th Intl. Symp. Practical Aspects of Declarative Languages, M. Hanus, Ed. LNCS, vol. 4354. Springer, 170–184. System’s homepage at http://www.cse.msu.edu/∼bss/chr d. Sarna-Starosta, B. and Schrijvers, T. 2007. Indexing techniques for CHR based on program transformation. Tech. Rep. CW 500, K.U.Leuven, Dept. Comp. Sc. Aug. Schiffel, S. and Thielscher, M. 2007. Fluxplayer: A successful general game player. In AAAI ’07: Proc. 22nd AAAI Conf. Artificial Intelligence. AAAI Press, 1191–1196. Schmauß, M. 1999. An implementation of CHR in Java. Diplomarbeit. Institute of Computer Science, LMU, Munich, Germany. Schrijvers, T. 2004. Jmmsolve: A generative java memory model implemented in Prolog and CHR. In Demoen and Lifschitz (2004), 475–476. Schrijvers, T. 2005. Analyses, optimizations and extensions of Constraint Handling Rules. Ph.D. thesis, K.U.Leuven, Leuven, Belgium. Schrijvers, T. and Bruynooghe, M. 2006. Polymorphic algebraic data type reconstruction. In PPDP ’06, A. Bossi and M. Maher, Eds. ACM Press, 85–96. Schrijvers, T. and Demoen, B. 2004a. Antimonotony-based delay avoidance for CHR. Tech. Rep. CW 385, K.U.Leuven, Dept. Comp. Sc. July. Schrijvers, T. and Demoen, B. 2004b. The K.U.Leuven CHR system: Implementation and application. In Frühwirth and Meister (2004), 8–12. System’s homepage at http://www.cs.kuleuven.be/∼toms/CHR/. Schrijvers, T., Demoen, B., Duck, G. J., Stuckey, P. J., and Frühwirth, T. 2006. Automatic implication checking for CHR constraints. In RULE ’05: 6th Intl. Workshop on Rule-Based Programming. ENTCS, vol. 147(1). Elsevier, 93–111. Schrijvers, T. and Frühwirth, T. 2005a. Analysing the CHR implementation of unionfind. In Wolf, Frühwirth et al. (2005), 135–146. Schrijvers, T. and Frühwirth, T., Eds. 2005b. CHR ’05: Proc. 2nd Workshop on Constraint Handling Rules. K.U.Leuven, Dept. Comp. Sc., Technical report CW 421. Schrijvers, T. and Frühwirth, T., Eds. 2006. CHR ’06: Proc. 3rd Workshop on Constraint Handling Rules. K.U.Leuven, Dept. Comp. Sc., Technical report CW 452. Schrijvers, T. and Frühwirth, T. 2006. Optimal union-find in Constraint Handling Rules. TPLP 6, 1–2, 213–224. Schrijvers, T., Stuckey, P. J., and Duck, G. J. 2005. Abstract interpretation for Constraint Handling Rules. In PPDP ’05, P. Barahona and A. Felty, Eds. ACM Press, 218–229. Schrijvers, T. and Warren, D. S. 2004. Constraint Handling Rules and tabled execution. In Demoen and Lifschitz (2004), 120–136. Schrijvers, T., Warren, D. S., and Demoen, B. 2003. CHR for XSB. In CICLOPS ’03: Proc. 3rd Intl. Colloq. on Implementation of Constraint and Logic Programming Systems, R. Lopes and M. Ferreira, Eds. University of Porto, Portugal, Dept. Comp. Sc., Technical report DCC-2003-05. 7–20. Schrijvers, T., Wielemaker, J., and Demoen, B. 2005. Poster: Constraint Handling Rules for SWI-Prolog. In Wolf, Frühwirth et al. (2005). 47 Schrijvers, T., Zhou, N.-F., and Demoen, B. 2006. Translating Constraint Handling Rules into Action Rules. In Schrijvers and Frühwirth (2006), 141–155. Schumann, E. T. 2002. A literate programming system for logic programs with constraints. In WFLP ’02: Proc. 11th Intl. Workshop on Functional and (Constraint) Logic Programming, M. Comini and M. Falaschi, Eds. University of Udine, Research Report UDMI/18/2002/RR. Scientific Software & Systems Ltd. 2008. Company Profile: Solving problems with proven solutions. Available at http://www.sss.co.nz/. Seitz, C., Bauer, B., and Berger, M. 2002. Planning and scheduling in multi agent systems using Constraint Handling Rules. In IC-AI ’02: Proc. Intl. Conf. Artificial Intelligence. CSREA Press. Shigeta, Y., Akama, K., Mabuchi, H., and Koike, H. 2006. Converting Constraint Handling Rules to Equivalent Transformation Rules. JACIII 10, 3, 339–348. Simões, H. and Florido, M. 2004. TypeTool: A type inference visualization tool. In WFLP ’04: Proc. 13th Intl. Workshop on Functional and (Constraint) Logic Programming, H. Kuchen, Ed. RWTH Aachen, Dept. Comp. Sc., Technical report AIB-2004-05. 48–61. Sneyers, J., Schrijvers, T., and Demoen, B. 2005. Guard and continuation optimization for occurrence representations of CHR. In Gabbrielli and Gupta (2005), 83–97. Sneyers, J., Schrijvers, T., and Demoen, B. 2006a. Dijkstra’s algorithm with Fibonacci heaps: An executable description in CHR. In Fink, Tompits et al. (2006), 182– 191. Sneyers, J., Schrijvers, T., and Demoen, B. 2006b. Memory reuse for CHR. In Etalle and Truszczynski (2006), 72–86. Sneyers, J., Schrijvers, T., and Demoen, B. 2009. The computational power and complexity of Constraint Handling Rules. ACM TOPLAS 31, 2. Sneyers, J., Van Weert, P., and Schrijvers, T. 2007. Aggregates for Constraint Handling Rules. In Djelloul, Duck et al. (2007), 91–105. Stuckey, P. J., Ed. 2002. ICLP ’02: Proc. 18th Intl. Conf. Logic Programming. LNCS, vol. 2401. Springer. Stuckey, P. J. and Sulzmann, M. 2005. A theory of overloading. ACM TOPLAS 27, 6, 1216–1269. Sulzmann, M., Duck, G. J., Peyton-Jones, S., and Stuckey, P. J. 2007. Understanding functional dependencies via Constraint Handling Rules. J. Functional Prog. 17, 1, 83–129. Sulzmann, M. and Lam, E. S. 2007a. Compiling Constraint Handling Rules with lazy and concurrent search techniques. In Djelloul, Duck et al. (2007), 139–149. Sulzmann, M. and Lam, E. S. 2007b. Haskell - Join - Rules. In IFL ’07: 19th Intl. Symp. Implementation and Application of Functional Languages, O. Chitil, Ed. 195–210. Sulzmann, M., Schrijvers, T., and Stuckey, P. J. 2006. Principal type inference for GHC-style multi-parameter type classes. In APLAS ’06: Proc. 4th Asian Symp. on Programming Languages and Systems, N. Kobayashi, Ed. LNCS, vol. 4279. Springer, 26–43. Sulzmann, M., Wazny, J., and Stuckey, P. J. 2005. Constraint abduction and constraint handling rules. In Schrijvers and Frühwirth (2005b), 63–78. Tacchella, P., Gabbrielli, M., and Meo, M. C. 2007. Unfolding in CHR. In PPDP ’07, M. Leuschel and A. Podelski, Eds. ACM Press, 179–186. Thielscher, M. 2002. Reasoning about actions with CHRs and finite domain constraints. In Stuckey (2002), 70–84. 48 Thielscher, M. 2005. FLUX: A logic programming method for reasoning agents. In Abdennadher, Frühwirth et al. (2005), 533–565. Ueda, K. et al. 2006. LMNtal as a unifying declarative language. In Schrijvers and Frühwirth (2006), 1–15. Invited talk. Van Weert, P. 2008. Compiling Constraint Handling Rules to Java: A reconstruction. Tech. Rep. CW 521, K.U.Leuven, Dept. Comp. Sc. Aug. Van Weert, P., Schrijvers, T., and Demoen, B. 2005. K.U.Leuven JCHR: a user-friendly, flexible and efficient CHR system for Java. In Schrijvers and Frühwirth (2005b), 47–62. System’s homepage at http://www.cs.kuleuven.be/∼petervw/JCHR/. Van Weert, P., Sneyers, J., and Demoen, B. 2008. Aggregates for CHR through program transformation. In LOPSTR ’07, Revised Selected Papers, A. King, Ed. LNCS, vol. 4915. Van Weert, P., Sneyers, J., Schrijvers, T., and Demoen, B. 2006. Extending CHR with negation as absence. In Schrijvers and Frühwirth (2006), 125–140. Van Weert, P., Wuille, P., Schrijvers, T., and Demoen, B. 2008. CHR for imperative host languages. In Special Issue on Constraint Handling Rules. LNAI, vol. 5388. Springer. Voets, D., Pilozzi, P., and De Schreye, D. 2007. A new approach to termination analysis of Constraint Handling Rules. In Djelloul, Duck et al. (2007), 77–89. Voll, K. 2006. A methodology of error detection: Improving speech recognition in radiology. Ph.D. thesis, Simon Fraser University, Canada. Wazny, J. 2006. Type inference and type error diagnosis for Hindley/Milner with extensions. Ph.D. thesis, University of Melbourne, Australia. Wolf, A. 1999. Adaptive Constraintverarbeitung mit Constraint-Handling-Rules – ein allgemeiner Ansatz zur Lösung dynamischer Constraint-probleme. Ph.D. thesis, Technical University Berlin, Berlin, Germany. Wolf, A. 2000a. Projection in adaptive constraint handling. In New Trends in Constraints, Joint ERCIM/Compulog Net Workshop, October 1999, Selected papers, K. Apt, A. Kakas, E. Monfroy, and F. Rossi, Eds. LNCS, vol. 1865. Springer, 318–338. Wolf, A. 2000b. Toward a rule-based solution of dynamic constraint hierarchies over finite domains. In Frühwirth et al. (2000). Wolf, A. 2001a. Adaptive constraint handling with CHR in Java. In CP ’01, T. Walsh, Ed. LNCS, vol. 2239. Springer, 256–270. Wolf, A. 2001b. Attributed variables for dynamic constraint solving. In Proc. 14th Intl. Conf. Applications of Prolog. Prolog Association of Japan, 211–219. Wolf, A. 2005. Intelligent search strategies based on adaptive Constraint Handling Rules. In Abdennadher, Frühwirth et al. (2005), 567–594. Wolf, A., Frühwirth, T., and Meister, M., Eds. 2005. W(C)LP ’05: Proc. 19th Workshop on (Constraint) Logic Programming. Ulmer Informatik-Berichte, vol. 200501. Universität Ulm, Germany. Wolf, A., Gruenhagen, T., and Geske, U. 2000. On incremental adaptation of CHR derivations. In Holzbaur and Frühwirth (2000b), 389–416. Wolf, A., Robin, J., and Vitorino, J. 2007. Adaptive CHR meets CHR∨ : An extended refined operational semantics for CHR∨ based on justifications. In Djelloul, Duck et al. (2007), 1–15. Wuille, P., Schrijvers, T., and Demoen, B. 2007. CCHR: the fastest CHR implementation, in C. In Djelloul, Duck et al. (2007), 123–137. System’s homepage at http://www.cs.kuleuven.be/∼pieterw/CCHR/. 49
6cs.PL
Multi-focus Attention Network for Efficient Deep Reinforcement Learning Jinyoung Choi1, Beom-Jin Lee2, and Byoung-Tak Zhang2 1 Interdisciplinary 2School Program in Cognitive Science, Seoul National University of Computer Science and Engineering, Seoul National University {jychoi,bjlee,btzhang}@bi.snu.ac.kr Abstract Deep reinforcement learning (DRL) has shown incredible performance in learning various tasks to the human level. However, unlike human perception, current DRL models connect the entire low-level sensory input to the state-action values rather than exploiting the relationship between and among entities that constitute the sensory input. Because of this difference, DRL needs vast amount of experience samples to learn. In this paper, we propose a Multi-focus Attention Network (MANet) which mimics human ability to spatially abstract the low-level sensory input into multiple entities and attend to them simultaneously. The proposed method first divides the low-level input into several segments which we refer to as partial states. After this segmentation, parallel attention layers attend to the partial states relevant to solving the task. Our model estimates state-action values using these attended partial states. In our experiments, MANet attains highest scores with significantly less experience samples. Additionally, the model shows higher performance compared to the Deep Q-network and the single attention model as benchmarks. Furthermore, we extend our model to attentive communication model for performing multi-agent cooperative tasks. In multi-agent cooperative task experiments, our model shows 20% faster learning than existing state-of-the-art model. Introduction Deep reinforcement learning has shown incredible performance in learning various tasks to the human level. Deep Q-network (DQN) successfully learned to play Atari 2600 games and achieved human-level scores in many games (Mnih et al. 2015) and Zhang et al. (2015) used DQN for robotic arm control attaining high performance results. However, DQN connects entire low-level sensory input to the state-action values rather than exploiting the relationship inter and intra entities that constitute the sensory input. Copyright © 2017, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved. Figure 1. Examples of grid world navigation. In spite of same relative position of A and W1, DQN has to learn these cases independently. For example, assume the grid world navigation task using the map (Figure 1). The agent receives the image representing the whole grid as input and each cell in the grid is rendered as a small box in the image. The agent (A) visits waypoints (W1, W2, W3, W4) in an orderly sequence. In two images (Figure 1), the positions of A and W1 are different but their relative positions are same. Therefore, if a RL model can attend to A and W1, it may learn the task faster by applying same policy. However, DQN perceives two images in Figure 1 as completely different states. Therefore, DQN has to learn policy about every possible placement of entities (A and Ws) independently. The number of possible placement of entities grows exponentially with the number of entities. Thus, DQN requires enormous experience samples to learn and training DQN is often intractable in real world environment where the agent cannot expect to experience exactly the same scene repetitively. Recently, to overcome this limitation, works like (Sorokin et al. 2015; Oh et al. 2016) applied attention concepts to the DRL models in order to learn Atari 2600 and Minecraft maze task, respectively. However, their attention mechanisms used only one softmax layer. Hence, their models show significant difficulty in attending to multiple entities (or memories) with equal importance whereas humans Figure 2. Illustration of our model’s structure. have ability to attend to multiple entities simultaneously (Finke et al. 2007). In this paper, we propose a Multi-focus Attention Network (MANet) that enhances the agent’s ability to attend to important entities by using multiple parallel attentions. Our model segments the low-level sensory input into multiple segments which we refer to as partial states. Parallel attention layers attend to partial states that are relevant to solving the task. Then the attended partial states estimate stateaction values. In experiments, our model shows remarkably faster learning speed and higher performance than DQN and single attention model. Furthermore, by viewing partial states as partially observed states perceived by multiple agents, we extend our model to the multi-agent reinforcement learning model. In the multi-agent cooperation task, our model learns roughly 20% faster than the state-of-the-art model (Sukhbaatar, Szlam, and Fergus 2016). Related Works Deep Reinforcement Learning: Deep neural networks have been successful in supervised learning tasks like image classification (Krizhevsky, Sutskever, Hinton. 2012; He et al. 2015). Recently, (Mnih et al. 2015) proposed a Deep Q-Network(DQN), which used deep convolutional neural network for state-action value function approximation. DQN learned many Atari 2600 games to the humanlevel in an end-to-end fashion. Zhang et al. (2015) applied DQN to the robotic arm control and trained the robot arm using simulation images. However training DQN requires long time and enormous experiences, making the direct application to the real-world environment intractable. Many works have followed to accelerate learning speed of DQN. Mnih et al. (2016) proposed asynchronous learning methods and Nair et al. (2015) proposed massively parallel methods. Both methods boosted learning speed of DQN greatly. However, these methods focused on exploiting massive computing powers rather than improving the model’s efficiency. Cognitive Science: In developmental psychology literatures, there is evidence that human cognitive system is found on some core knowledge: entities, other agents (actions), numbers, spaces (Spelke and Kinzler 2007). Attention is considered important in perceiving coherent entities or agents. Furthermore, there is evidence that humans have the ability to attend to multiple entities simultaneously (Finke et al. 2007). Our work is inspired by these insights, focusing on simultaneous attention for fast and efficient learning. Attention in Deep Reinforcement Learning: Recently, visual attention has been successful in many supervised learning tasks like caption generation (Xu et al. 2015), image generation (Gregor et al. 2015), language translation (Bahdanau et al. 2014). Following these achievements in supervised learning domain, Sorokin et al. (2015) proposed Deep Attention Recurrent Q-Network (DARQN), which integrated attention mechanism into DQN. DARQN surpassed the performance of DQN in some Atari 2600 games. However, it failed to surpass DQN in many Atari 2600 games. Oh et al. (2016) proposed Memory Q-Network (MQN), which used attention for context dependent memory retrieval. MQN outperformed DQN by a large margin in maze tasks, which require ability to memorize important information for long time-steps. In contrast to these works, we use attention to extract important partial states in the input of one time-step and apply multiple attention layers to attend to multiple partial states for fast and efficient learning Multi-Agent Communication: In many multi-agent reinforcement learning models, communication between agents is usually pre-determined (Busoniu, Babuska, and De Schutter 2008). Recently, Sukhbaatar, Szlam, and Fergus (2016) proposed Communication Neural Net (CommNN). CommNN learns not only the policy for individual agents, but also the communication protocol between agents in an end-to-end fashion. CommNN outperformed noncommunicative models and baselines in various multiagent cooperative tasks. In contrast to CommNN, our model encodes two different feature. One estimates the stateaction values and the other is used for communication between agents. Furthermore, agents attend to other agents that have important information. These attributes enable clear and rich communication between agents, leading to faster learning. Multi-focus Attention Network Background: Deep Q Learning We use Deep Q-Learning framework introduced by Mnih et al. (2015). Deep Q-Learning uses neural network to approximate the state-action value function. Let be a lowlevel sensory input at time step t, be a discrete action at t, be a reward at t. Then the loss function of Deep QLearning framework is defined as follows: = { + γ ∗ max ( , )− ( , )} (1) where γ is the discount coefficient and is the possible actions can be chosen at t+1, is neural network (Q network) and is target network. The target network is used to stabilize learning. It has same structure to the Q network and weights of the Q network are copied to the target network periodically. We also use replay memory mechanism (Lin. 1993) which stores transitions {( , , , )} and uses randomly sampled transitions to train the network. Single Agent Setting Our model (Figure 2) consists of 4 modules: (a) Input segmentation, (b) Feature extraction, (c) Parallel attentions, (d) State-action value estimation. Input Segmentation: Input segmentation module segments the low-level sensory input into multiple segments which we refer to as partial states. This can be done by various methods. In our experiments, we used simple grid method. We partitioned input image into uniform grid and used the cells (small image patches) in the grid as partial states. We believe that we can apply more sophisticated methods like super-pixel segmentation (Achanta et al. 2010) or spatial transformer networks (Jaderberg, Simonyan, and Zisserman 2015). We will explore the feasibility in future works. Feature Extraction: The feature extraction module extracts key and value features from each of partial states. The key features are used to determine where the model should attend and the value features are used to encode information for state-action value estimation. This two stream feature extraction is inspired by (Oh et al. 2016). For each partial state, we first define common feature as follows: ( ) = ∈ (0,1, … . , ) (2) where K is the number of partial states, is the common feature for i-th partial state, is extraction function, and is i-th partial state. In our experiments, we used deep convolutional neural network and deep neural network as . Additionally, we concatenated index of the partial state to the common feature. Using the extracted , we define key and value feature as follows: = = ∗ (3) ( ∗ ) (4) where is the key feature for i-th partial state, is the value feature for i-th partial state, is non-linear activation function, and , are the weight matrixes. We use leaky ReLU (Maas 2013) as . Parallel Attentions: Using the key features extracted from the feature extraction module, parallel attention layers determine what partial states are important by using the following equations: = ( ∑ ∗ ( ) ∗ ∈ (0,1, … , ) (5) ) where N is the number of attention layers, is i-th element of n-th soft attention weight vector, ∈ {0,1, … , K} − i and is n-th selector vector which is trainable like other weights of network. All are randomly initialized in the beginning of training. Since multiple can be initialized similarly and it can be inefficient if multiple attend to the same partial states, we explore two regularization methods, entropy and distance, to encourage each attends to different partial states. = = ∗ ∑ ‖ ∗ exp(− ∑ ‖ ∗ , ( − (6) ) ) (7) is entropy regularization, which encourages each attention layer to attend to the one partial state. is distance regularization, which encourages each attention layer to attend to different partial states from other attention layers. Those regularization terms are added to loss function, weighted by , respectively. We investigate the effects of these regularizations in detail in the experiment section. State-action Value Estimation: Using attention weights from parallel attention layers, weighted value feature is defined as ℎ = ∑ ∗ (8) where ℎ is the n-th sum of value features weighted by . Then the concatenated feature for state-action value estimation is defined as = {ℎ , ℎ , … , ℎ } (9) The concatenated feature is used to estimate state-action value as follows: = ( ) (10) where is function approximation. In experiments, we used one fully-connected layer followed by one linear layer as . has output units for each action so ( , ) for all possible actions are calculated with single feed-forward pass. Extension to the Multi-Agent Reinforcement Learning In multi-agent reinforcement learning tasks, agents perceive partially observed states, which are part of the whole environment state. Agents have to communicate with each other to share information and cooperate to solve the task. If we use the partially observed states perceived by multiple agents as the partial states of our model, MANet can be extended to the model that can control multiple agents. Using parallel attentions, MANet can learn not only the policy for individual agents but also the communication protocol between agents in an end-to-end fashion. For this purpose, we change modules of our model as follows: Input Segmentation: As mentioned above, we use partially observed states from multiple agents as partial states of our model. Thus, extra segmentation process is not required. Feature Extraction: In the multi-agent setting, each agent should be able to attend to different agents according to their situation. Thus, each agent requires different selector vectors. For this purpose, we extract both key features and selector vectors from inputs of each agent. Equation (2)−(4) are extended as follows: = ( ) = = ∈ (0,1, … . , ) ∗ ∗ (11) (12) (13) = ( ∗ ) (14) where K is the number of agents and selector vectors. is the weight for Attentive Communication: Attention weights for each agent are calculated using = ( ∑ ∗ ( ) ∗ , ) ∈ (0,1, … , ) (15) In this formulation, means the attention weight from the agent j to the agent i. Higher can be interpreted like the agent j has information which is important for the agent i. State-action Value Estimation: In the multi-agent setting, all agents have their own action so we need state-action values for each agent. For each agent, communication feature and concatenated feature for state-action value estimation are defined respectively as ℎ = ∑ ∗ ={ ∈ (0,1, … , ) ,ℎ } (16) (17) where ℎ is the communication feature for i-th agent. And state-action values for each agent are defined as = ( ) (18) We do not use entropy or distance regularization in the multi agent setting because not like single agent setting, are different for all agents so s are unlikely to have similar values. Instead, we add regularization term = ∗( ∗ ) (19) to the loss function since these values easily diverge without regularization in our experiments. Experiments We designed two game environments, one for single agent task and the other for multi-agent cooperative task. We trained our model as well as the state-of-the-art model and baselines on these environments. Following subsections will cover details about environments and results of experiments. Navigation Experiments for Single Agent Task Environment: For the single agent task, we designed a navigation task in the grid world with waypoints (Figure 1). The map is 8*8 grid and there are 4 waypoints. The agent has to visit the waypoints in an orderly sequence. In each Figure 3. Learning curves for navigation task. time-step, the agent can move up, down, left, or right. The agent gets reward of 1 when it reaches the proper waypoint, 3 when it has visited all waypoints and -0.01 for each movement. The episode ends when the agent reaches the last waypoint or 200 time-steps have passed. Each cell in the grid is rendered as 5*5 patch so the size of input image is 40*40. The cell that contains the agent is colored green and cells that contain waypoints are colored red. Waypoints that have to be visited earlier have darker color. Training Details: We trained our model, single attention model and DQN. Our model used two attention layers. Details about network structures and hyper parameters are given in supplementary material. Quantitative Results: As shown in the learning curves presented in Figure 3, our model showed great improvement in the training speed and performances. Our model reached near-optimal score (we define near-optimal as score over 6.7) roughly two times faster than the single attention model (Table 1). This result shows that parallel attentions clearly benefits learning complex task. DQN reached near optimal score in only one of three training cases. Furthermore, comparing to the successful case of the DQN, our model reached near-optimal score nearly 3.5 times faster than the DQN (Table 1). Qualitative Results and Effect of Regularization: Examples of the game screenshots and the corresponding attention weights (computed by equation 5) from the proposed model are depicted in Figure 4. As illustrated in Figure 4, in every case of trainings, one of the attention layer mainly attended to the next waypoint and the other one mainly attended to the agent. We also examined attention weights and learning curves of our model with regularizations. As seen in supplementary material, although attention weights of regularized model were more concentrated Table 1. Epochs required for mean score over 6.7 MANet epoch 57 Single Attention 95 DQN 198 Figure 4. Game screen(left) and visualization of attentions(middle, right) in navigation task. In all cases of our experiments, one of attention layers attended to the next waypoint (middle) and the other one attended to the agent (right). to one partial state, there was no significant difference in performances. We hypothesize that at least in our domain of experiments, random initialization was enough to make attention layers attend to different partial states. We leave the exploration of other regularization methods and investigation of effects of regularizations in other domains to the future work. Combat Experiments for Multi-Agent Task Environment: To compare our model’s performance to baselines and the state-of-the-art model, we implemented modified version of combat environment used in (Sukhbaatar, Szlam, and Fergus 2016). In the combat experiments, two teams battle in 15*15 grid. Each team has five agents. Each team has fixed starting point and agents are spawned randomly in its surrounding 3*3 area when the episode begins. Each agent has 3 health points and can perceive its surrounding 5*5 area. Agents can take 10 actions: moving up, down, left, right, attacking enemy by specifying its index (1~5), or doing nothing. The attack is effective only when the target is in the attacker’s surrounding 3*3 area and successful attack reduces target’s health point by 1. An agent dies when its health point becomes 0. Agents must have 1 time-step of cool time after the attack. The episode ends when one team wins or 80 time-steps have passed (timeout). The model controls one of the team and the other team is controlled by hard-coded bots. As like (Sukhbaatar, Szlam, and Fergus 2016), our hard-coded bots move randomly until any of the bots spots the enemy. After any of the bots spots the enemy, all bots move to nearest spotted enemy and attack it. The model gets reward Figure 6. Game screens (left) and visualization of attention matrixes (right) in the combat task. (i,j)-th cell in attention matrixes is attention weight from the agent j to the agent i. brighter (i,j)-th cell means that the agent i mainly attends to the agent j. Figure 5. Learning curves for combat task. The plot on the top is the average reward per episode while the bottom plot is the winning rate. of 3.0 when it wins the game and gets reward of -3.0 when it loses or draws (timeout). To encourage agents to attack and accelerate the learning, reward of 1.0 is given for every successful attack and reward of (-1.0 * sum of health points of remaining bots) is given when the model loses or draws. All rewards are shared between agents. Each agent’s input is 150-dimensional vector which is concatenation of twenty-five 6-dimensional vectors that encode [x, y, index, team, health, cool-time] of cells in the agent’s surrounding 5*5 area. If there is no agent or bot in the cell, the values of index, team, health and cool-time are 0. Training Details: We trained our model, CommNN (Sukhbaatar, Szlam, and Fergus 2016), No-communication model, and Dense communication model (mapping concatenation of inputs of all agents to the state-action values of all agents). Details about the network structures and hyper parameters are given in supplementary material. Quantitative Results: As shown in the learning curves in Figure 5, our model showed roughly 20% faster learning speed than CommNN (Table 2). Though we could not compare the performances accurately because both our model and CommNN reached the near-optimal scores (we define near-optimal as winning rate over 90%), our model showed slightly better performances. Table 2. Epochs required for mean winning rate over 90% epoch MANet 73 CommNN 93 Nocomm X Dense X Qualitative Results: Examples of game screenshots and corresponding attention weights from our model are presented in Figure 6. As shown in Figure 6, attention weights were concentrated to the agents which are engaging the enemies (top of Figure 6). This helped our agents to successfully defeat enemies by focusing their fire power on the one enemy at a time (bottom of Figure 6). Conclusion We propose a Multi-focus Attention Network, which can effectively attend to multiple partial states constituting the sensory input to learn faster. Our model shows improved performance and faster learning compared to DQN and the single attention model on the single agent task. Moreover, extended model for multi-agent RL shows faster learning than the state-of-the-art model. In future work, we intend to apply more sophisticated segmentation methods and experiment our model on real world environment. Secondly, we will explore communication between agents having different state-action spaces. Lastly, we will apply parallel attention layers in both spatial and temporal manner. Our final goal is to achieve modular RL model for robot training in the real world. Acknowledgments This research was supported by a grant to Bio-Mimetic Robot Research Center Funded by Defense Acquisition Program Administration, and by Agency for Defense Development (UD130070ID). References Achanta, R., Shaji, A., Smith, K., Lucchi, A., Fua, P., and Süsstrunk, S. 2010. Slic superpixels. EPFL-REPORT-149300. Bahdanau, D., Cho, K., and Bengio, Y. 2014. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473. Busoniu, L., Babuska, R., and De Schutter, B. 2008. A comprehensive survey of multiagent reinforcement learning. IEEE Transactions on Systems, Man, And Cybernetics-Part C: Applications and Reviews, 38 (2), 2008. Mnih, V., Kavukcuoglu, K., Silver, D., Rusu, A., Veness, J., Bellemare, M., Graves, A., Riedmiller, M., Fidjeland, A., Ostrovski, G., Petersen, S., Beattie, C., Sadik, A., Antonoglou, I., King, H., Kumaran, D., Wierstra, D., Legg, S., and Hassabis, D. Humanlevel control through deep reinforcement learning. Nature, 518(7540):529–533, 02 2015. Finke, K., Schneider, W. X., Redel, P., Dose, M., Kerkhoff, G., Müller, H. J., and Bublak, P. 2007. The capacity of attention and simultaneous perception of objects: A group study of Huntington's disease patients. Neuropsychologia, 45(14), 3272-3284. Gregor, K., Danihelka, I., Graves, A., Rezende, D. J., and Wierstra, D. 2015. DRAW: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623. He, K., Zhang, X., Ren, S., and Sun, J. 2015. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385. Jaderberg, M., Simonyan, K., and Zisserman, A. (2015). Spatial transformer networks. In Advances in Neural Information Processing Systems (pp. 2017-2025). Kingma, D., and Ba, J. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980. Krizhevsky, A., Sutskever, I., and Hinton, G. E. 2012. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems (pp. 1097-1105). Lin, L. J. 1993. Reinforcement learning for robots using neural networks. Carnegie-Mellon Univ Pittsburgh PA School of Computer Science. (No. CMU-CS-93-103). Maas, A. L., Hannun, A. Y., & Ng, A. Y. 2013. Rectifier nonlinearities improve neural network acoustic models. In Proc. ICML (Vol. 30, No. 1). Mnih, V., Badia, A. P., Mirza, M., Graves, A., Lillicrap, T. P., Harley, T., Silber, D., and Kavukcuoglu, K. 2016. Asynchronous methods for deep reinforcement learning. arXiv preprint arXiv:1602.01783. Nair, A., Srinivasan, P., Blackwell, S., Alcicek, C., Fearon, R., De Maria, A., Panneershelvam, V., Suleyman, M., Beattie, C., Petersen, S., Legg, S., Mnih, V., Kavukcuoglu, K., and Silber, D. 2015. Massively parallel methods for deep reinforcement learning. arXiv preprint arXiv:1507.04296. Oh, J., Chockalingam, V., Singh, S., and Lee, H. 2016. Control of Memory, Active Perception, and Action in Minecraft. arXiv preprint arXiv:1605.09128. Sorokin, I., Seleznev, A., Pavlov, M., Fedorov, A., and Ignateva, A. 2015. Deep Attention Recurrent Q-Network. arXiv preprint arXiv:1512.01693. Spelke, E. S., and Kinzler, K. D. 2007. Core knowledge. Developmental science, 10(1), 89-96. Sukhbaatar, S., Szlam, A., and Fergus, R. 2016. Learning Multiagent Communication with Backpropagation. arXiv preprint arXiv:1605.07736. Xu, K., Ba, J., Kiros, R., Cho, K., Courville, A., Salakhutdinov, R., Zemel, R., and Bengio, Y. 2015. Show, attend and tell: Neural image caption generation with visual attention. arXiv preprint arXiv:1502.03044, 2(3), 5. Zhang, F., Leitner, J., Milford, M., Upcroft, B., and Corke, P. 2015. Towards Vision-Based Deep Reinforcement Learning for Robotic Motion Control. Paper presented at the Australasian Conference on Robotics and Automation (ACRA) 2015
2cs.AI
TRANSACTIONS OF THE AMERICAN MATHEMATICAL SOCIETY Volume 00, Number 0, Pages 000–000 S 0002-9947(XX)0000-0 arXiv:1511.08239v4 [math.GR] 19 Jan 2018 MONOID VARIETIES WITH EXTREME PROPERTIES MARCEL JACKSON AND EDMOND W. H. LEE Dedicated to the 81st birthday of John L. Rhodes Abstract. Finite monoids that generate monoid varieties with uncountably many subvarieties seem rare, and surprisingly, no finite monoid is known to generate a monoid variety with countably infinitely many subvarieties. In the present article, it is shown that there are, nevertheless, many finite monoids with simple descriptions that generate monoid varieties with continuum many subvarieties; these include inherently nonfinitely based finite monoids and all monoids for which xyxy is an isoterm. It follows that the join of two Cross monoid varieties can have a continuum cardinality subvariety lattice that violates the ascending chain condition. Regarding monoid varieties with countably infinitely many subvarieties, the first example of a finite monoid that generates such a variety is exhibited. A complete description of the subvariety lattice of this variety is given. This lattice has width three and contains only finitely based varieties, all except two of which are Cross. 1. Introduction A monoid is a semigroup with an identity element. Any semigroup S without identity element can be converted into the monoid S 1 = S ∪ {1}, where multiplication involving 1 is defined by 1 · x = x · 1 = x for all x ∈ S 1 . In the present article, the notion of a monoid is attached ambiguously to either a semigroup with identity element in the plain signature { · } or to a semigroup with identity element 1 in the enriched signature { · , 1}. To distinguish this difference for any class M of monoids at the varietal level, let Vsem M denote semigroup variety generated by M and let Vmon M denote the monoid variety generated by M. More generally, bold upper case letters A, B, C, . . . represent semigroup varieties, while blackboard bold upper case letters A, B, C, . . . represent monoid varieties. In the semigroup signature { · }, monoids have played a conspicuous role in the study of semigroup varieties with extreme properties. For instance, a finite semigroup is inherently nonfinitely based if and only if it contains an inherently nonfinitely based submonoid [39, 40]; recall that an algebra A is inherently nonfinitely based if every locally finite variety containing A is nonfinitely based. The first two published examples of nonfinitely based finite semigroups, due to Perkins [38], are monoids. The first example—the monoid B21 obtained from the Brandt semigroup B2 = a, b a2 = b2 = 0, aba = a, bab = b 2010 Mathematics Subject Classification. 20M07. The first author was supported by ARC Discovery Project DP1094578 and Future Fellowship FT120100666. c XXXX American Mathematical Society 1 2 M. JACKSON AND E. W. H. LEE of order five—is now known to be one of only four nonfinitely based semigroups or order six [30]; the other example is a monoid that is nilpotent in the sense that every sufficiently long product not involving the identity element is equal to the zero element. Nilpotent monoids emerged as a significant source of nonfinitely based finite semigroups [11, 12, 16, 42, 43] and of semigroups that generate varieties with continuum many subvarieties [10]. A variety of algebras that contains finitely many subvarieties is said to be small. A Cross variety is a variety that is finitely based, finitely generated, and small. The present article is concerned with monoid varieties that are not small. A variety with countably infinitely many subvarieties is said to be of type ℵ0 , while a variety with continuum many subvarieties is said to be of type 2ℵ0 . 1.1. Finite monoids that generate monoid varieties of type 2ℵ0 . The subvarieties of a variety V of algebras constitute a complete lattice L(V) with respect to class inclusion. For any monoid M , the lattice L(Vmon {M }) order-embeds into the lattice L(Vsem {M }) in the obvious manner, so in one sense, the latter lattice is as complicated as the former. However, there exist examples of finite monoids M where the monoid variety Vmon {M } is small even though the semigroup variety Vsem {M } is of type 2ℵ0 ; the monoid N61 obtained from the nilpotent semigroup N6 = a, b a2 = b2 = aba = 0 of order six is one such example [10, 13]. At the moment, the only examples of finite monoids that generate monoid varieties of type 2ℵ0 are those of Jackson and McKenzie [15] arising from certain graph-encoding technique. But these monoids, the smallest of which is of order 20, have a somewhat nontrivial description. In the present article, results of Jackson [10] are extended to the monoid setting to exhibit new easily described examples of monoids that generate monoid varieties of type 2ℵ0 . In particular, these examples include many nilpotent monoids and all inherently nonfinitely based finite monoids. It is also shown that the join of two Cross monoid varieties can be of type 2ℵ0 . 1.2. Finite monoids that generate varieties of type ℵ0 . Many finite semigroups are known to generate varieties of type ℵ0 . For instance, an abundance of examples can be found from varieties generated by completely 0-simple semigroups [22, 31]; the Brandt semigroup B2 is an example [20] in particular. Another easy method of locating varieties of type ℵ0 is to consider hereditarily finitely based varieties, that is, varieties all subvarieties of which are finitely based. Since every hereditarily finitely based variety contains at most countably many subvarieties, nonsmall hereditarily finitely based varieties are of type ℵ0 . For example, commutative semigroups are long known to be hereditarily finitely based [38]; since the commutative monoid N21 obtained from the nilpotent semigroup N 2 = a a2 = 0 generates a nonsmall semigroup variety [5, Figure 5(b)], the direct product of N21 with any finite commutative semigroup generates a semigroup variety of type ℵ0 . The situation changes drastically when monoid varieties are considered. It so happens that hereditarily finitely based monoid varieties generated by presently known finite monoids—commutative monoids [9], idempotent monoids [2, 7, 8], nilpotent monoids [23], and 2-testable monoids [24] to name a few—are all Cross and so are not of type ℵ0 . In fact, no example of a finite monoid is known to MONOID VARIETIES WITH EXTREME PROPERTIES 3 generate a monoid variety of type ℵ0 . The present article exhibits the first such example. Specifically, a certain monoid E 1 of order six is shown to generate a nonsmall, hereditarily finitely based monoid variety. 1.3. Organization. There are six sections in the present article. Notation and background material are given in §2. In §3, a certain nilpotent monoid of order nine is shown to generate a monoid variety of type 2ℵ0 . Based on this result, a number of other monoid varieties of type 2ℵ0 are also exhibited. In §4, all inherently nonfinitely based finite monoids are shown to generate monoid varieties of type 2ℵ0 . The two well-known inherently nonfinitely based monoids of order six are thus small examples that generate monoid varieties of type 2ℵ0 ; whether or not these two examples are minimal is discussed. In §5, the subvariety lattice of a monoid variety generated by a certain monoid E 1 of order six is completely described; in particular, this variety is nonsmall and hereditarily finitely based and so is of type ℵ0 . In §6, some other extreme properties satisfied by monoid varieties are discussed and related open questions are posed. 2. Preliminaries 2.1. Words and identities. Let A be a countably infinite alphabet. For any subset X of A , let X + and X ∗ denote the free semigroup and free monoid over X , respectively. Elements of A are called variables, and elements of A ∗ are called words. The empty word, more conveniently written as 1, is the identity element of the monoid A ∗ . For any word w, • • • • the content of w, denoted by con(w), is the set of variables occurring in w; the number of occurrences of a variable x in w is denoted by occ(x, w); a variable x in w is simple if occ(x, w) = 1; the initial part of w, denoted by ini(w), is the word obtained by retaining the first occurrence of each variable in w. For any x1 , x2 , . . . , xr ∈ A , let w[x1 , x2 , . . . , xr ] denote the word obtained by applying the substitution that fixes x1 , x2 , . . . , xr and assigns the value 1 to all other variables. For example, w[x] = xocc(x,w) for any x ∈ con(w). An identity is an expression u ≈ v, where u, v ∈ A ∗ . A semigroup S satisfies an identity u ≈ v, written S |= u ≈ v, if for any substitution θ : A → S, the equality uθ = vθ holds in S. For any class K of semigroups, write K |= u ≈ v to indicate that S |= u ≈ v for all S ∈ K. A monoid that satisfies an identity u ≈ v clearly also satisfies the identity u[x1 , x2 , . . . , xr ] ≈ v[x1 , x2 , . . . , xr ] for any x1 , x2 , . . . , xr ∈ A . An identity w ≈ w′ is directly deducible from an identity u ≈ v if some substitution θ : A → A ∗ and words a, b ∈ A ∗ exist such that {w, w′ } = {a(uθ)b, a(vθ)b}. An identity w ≈ w′ is deducible from a set Σ of identities, written Σ ⊢ w ≈ w′ , if there exists a sequence w = u0 , u1 , . . . , ur = w ′ of distinct words such that each identity ui ≈ ui+1 is directly deducible from some identity in Σ. By Birkhoff’s completeness theorem of equational logic, a deduction Σ ⊢ w ≈ w′ holds if and only if any monoid that satisfies the identities in Σ also satisfies the identity w ≈ w′ ; see Burris and Sankappanavar [3, Theorem 14.19]. 4 M. JACKSON AND E. W. H. LEE 2.2. Varieties. A variety is a class of algebras that is closed under the formation of homomorphic images, subalgebras, and arbitrary direct products. Equivalently, a variety V is a class of algebras that satisfy some set Σ of identities; in this case, Σ is said to be a basis for V, or V is defined by Σ. For any variety V and set Σ of identities, let VΣ denote the subvariety of V defined by Σ. A variety is finitely based if it has some finite basis, finitely generated if it is generated by some finite algebra, and small if it contains finitely many subvarieties. A variety is Cross if it is finitely based, finitely generated, and small. The following well- and long-known result can be found, after easy modification, in Oates-MacDonald and Vaughan-Lee [36, p. 370]. Lemma 2.1. A locally finite variety V of algebras is finitely generated if and only if there exists no W strictly increasing infinite chain V1 ⊂ V2 ⊂ V3 ⊂ · · · of varieties such that V = i≥1 Vi . Consequently, any locally finite, small variety is finitely generated. For any subvariety U of a variety V, let [U, V] denote the interval of all subvarieties of V containing U. Let L(V) denote the lattice of all subvarieties of V, that is, L(V) = [0, V], where 0 is the trivial variety. For any class M of monoids, let Vsem M denote semigroup variety generated by M and let Vmon M denote the monoid variety generated by M. Lemma 2.2 (Jackson [14, Lemma 1.1]). Let M be any class of monoids and let S be any semigroup. Then S ∈ Vsem M implies that S 1 ∈ Vmon M. 2.3. Rees quotients of free monoids. For any words u, v ∈ A ∗ , the expression u  v indicates that u is a factor of v, that is, v ∈ A ∗ uA ∗ . For any set W ⊆ A ∗ of words, define the factorial closure of W to be the set W  of all words that are factors of some word in W : W  = {u ∈ A ∗ | u  w for some w ∈ W }. Then IW = A ∗ \W  is an ideal of A ∗ . Let MW denote the Rees quotient A ∗ /IW . Equivalently, MW can be treated as the monoid that consists of every factor of every word in W , together with a zero element 0, with binary operation · given by ( uv if uv is a factor of some word in W , u·v = 0 otherwise. Example 2.3. The monoids M{x} and M{xyx} are isomorphic to the monoids N21 and N61 in §1.1, respectively, while M∅ = {0, 1} is the semilattice of order two. Remark 2.4. The Rees quotient A ∗ /IW is more commonly denoted in the literature by S(W ); see, for example, Jackson [10, 11, 13], Jackson and Sapir [16], Lee [23, 24, 26], and O. Sapir [42]. But in retrospect, the symbol S(W ) might have been better used to denote the Rees quotient A + /IW without identity element. A word w is an isoterm for a class M of monoids if whenever M |= w ≈ w′ for some w′ ∈ A + , then w ≈ w′ is satisfied by all monoids; in other words, once all instances of 1 have been removed by applications of x1 7→ x and 1x 7→ x, the two words w and w′ are identical. Lemma 2.5 (Jackson [13, Lemma 3.3]). For any class M of monoids and any set W of words, MW ∈ Vmon M if and only if each word in W is an isoterm for M. MONOID VARIETIES WITH EXTREME PROPERTIES 5 2.4. Varieties generated by some small monoids. The monoids B01 , I 1 , J 1 , L12 , and R21 obtained from the following semigroups are required in later sections: B0 = a, b, c a2 = a, b2 = b, ab = ba = 0, ac = cb = c , I = a, b ab = a, ba = 0, b2 = b , J = a, b ba = a, ab = 0, b2 = b , L2 = a, b a2 = ab = a, b2 = ba = b , R2 = a, b a2 = ba = a, b2 = ab = b . Note that B0 , I, and J are subsemigroups of the Brandt semigroup B2 , while L2 and R2 are the left- and right-zero semigroups of order two, respectively. Write B10 = Vmon {B01 }, I1 = Vmon {I 1 }, L12 = Vmon {L12 }, J1 = Vmon {J 1 }, and R12 = Vmon {R21 }. For any set W ⊆ A ∗ of words, write MW = Vmon {MW }. Proposition 2.6 (Lee [24, Proposition 4.1]). The monoid variety L12 ∨ M{x} ∨ R12 is Cross, and the lattice L(L12 ∨ M{x} ∨ R12 ) is given in Figure 1. L12 ∨ M{x} ∨ R12 r ✟✟❍❍ ❍❍ ✟ 1 1 L12 ∨ B10 ✟✟ 1 L ∨ R12 ❍❍rB0 ∨ R2 r r 2 ✟ ❍ ✟ ❍ ✟ ✟ ❍ ✟ ❍❍ ✟ ❍❍ 1 ❍ r❍✟ ✟✟ 1 ❍❍ L12 ∨ M{x} ✟ ✟ ✟r M{x} ∨ R2 ❍ ✟ B ❍❍ ✟ ✟ ❍❍ 0✟✟ ❍ r ❍✟ ✟ ✟ ✟❍ ❍ ✟❍ ❍ ✟ ✟ ❍ ❍❍r 1 ✟ ❍ r✟ ❍ L12 r✟ 1 ✟r✟ ❍❍ ✟ R2 I1 ❍❍ J ✟ ❍ ✟✟ ❍ r ✟ ❍❍ M{xy} ✟✟ M{x} r ❍❍ ✟✟ ❍❍r✟✟ M∅ r 0 Figure 1. The lattice L(L12 ∨ M{x} ∨ R12 ) 2.5. Words with overlapping variables. The monoid M{xyx} plays a crucial role in the investigation of semigroup varieties of type 2ℵ0 .  Proposition 2.7 (Jackson [10, §3]). The variety Vsem M{xyx} is of type 2ℵ0 . In the proof of Proposition 2.7, Jackson established the irredundancy of the  following identity system within the equational theory of Vsem M{xyx} : (2.1) {xun ≈ un , un x ≈ un | n = 3, 4, 5, . . .} where un = hx1 x2 x3 x4 h · y1 z1 y1 · y2 z2 y2 · · · yn zn yn · tx5 x6 x7 x8 t. 6 M. JACKSON AND E. W. H. LEE More specifically, Jackson [10, proof of Theorem 3.2] demonstrated that for any identity basis Σ for M{xyx} and any subset N of {3, 4, 5, . . .}, the deduction Σ ∪ {xun ≈ un , un x ≈ un | n ∈ N} ⊢ {xuk ≈ uk , uk x ≈ uk } holds if and only if k ∈ N. It follows that each subset of {3, 4, 5, . . .} corresponds  uniquely to a subvariety of Vsem M{xyx} , thus establishing Proposition 2.7. One main goal of the present article is to exhibit finite monoids that generate monoid varieties of type 2ℵ0 . The monoid M{xyx} does not serve this purpose because it generates a monoid variety with only five subvarieties [13, Lemma 4.4]. It turns out that words of the following form with overlapping variables will be useful in all of the examples of the present article regarding monoid varieties of type 2ℵ0 : (2.2) x0 ? x1 ? x0 · x2 x1 · x3 x2 · x4 x3 · · · xn−1 xn−2 · xn ? xn−1 ? xn The segments indicated by question marks are either empty or filled by variables different from x0 , x1 , . . . , xn . Note that crucially, assigning 1 to any of the variables x0 , x1 , . . . , xn destroys the overlapping pattern; this eliminates applicability of such reduced words to similar patterns in different numbers of variables. In particular, “short” identities formed by words of the form (2.2) are not deducible from “long” identities similarly formed. Remark 2.8. Identities formed by words of the form (2.2) were first employed by Lee [26, 27] and Lee and Zhang [32] to exhibit several examples of nonfinitely generated monoid varieties. 3. New examples of monoid varieties of type 2ℵ0 The main example of this section is the monoid variety M{xyxy}. In §3.1, this variety is shown to be of type 2ℵ0 . Therefore any monoid variety that contains the monoid M{xyxy} is also of type 2ℵ0 . In particular, it is shown in §3.2 that the join of two Cross monoid varieties can be of type 2ℵ0 . Two open questions regarding semigroup varieties are also shown to have answers within the context of monoid varieties. In §3.3, the monoid variety generated by all monoids of order n is investigated. It is shown that this variety is of type 2ℵ0 if and only if n ≥ 4. 3.1. The variety M{xyxy}. In the present subsection, define the words wn = x0 · yz · x1 x0 · x2 x1 · x3 x2 · · · xn xn−1 · yz · xn and wn′ = x0 · zy · x1 x0 · x2 x1 · x3 x2 · · · xn xn−1 · zy · xn . Lemma 3.1. For each n ≥ 3, the words wn and wn′ are isoterms for M{xyxy}. Proof. By symmetry, it suffices to show that wn is an isoterm for M{xyxy}. Let wn ≈ u be any identity satisfied by M{xyxy}. Then the identities wn [y, z] ≈ u[y, z], wn [z, x0 ] ≈ u[z, x0 ], wn [y, x0 ] ≈ u[y, x0 ], wn [z, xn ] ≈ u[z, xn ], wn [y, xn ] ≈ u[y, xn ], and wn [xi , xi+1 ] ≈ u[xi , xi+1 ] are satisfied by M{xyxy}. Since wn [y, z] = yzyz, wn [z, x0 ] = x0 zx0 z, wn [y, x0 ] = x0 yx0 y, wn [z, xn ] = zxn zxn , wn [y, xn ] = yxn yxn , and wn [xi , xi+1 ] = xi xi+1 xi xi+1 are isoterms for M{xyxy}, it follows that (a) u[xi , xi+1 ] = xi xi+1 xi xi+1 for all i ∈ {0, 1, . . . , n − 1}, MONOID VARIETIES WITH EXTREME PROPERTIES 7 (b) u[y, x0 ] = x0 yx0 y, u[y, xn ] = yxn yxn , (c) u[z, x0 ] = x0 zx0 z, u[z, xn ] = zxn zxn , (d) u[y, z] = yzyz. Then (a) implies that for any i ∈ {0, 1, . . . , n − 2}, the word u[xi , xi+1 , xi+2 ] is p = xi xi+1 xi xi+2 xi+1 xi+2 or q = xi xi+1 xi+2 xi xi+1 xi+2 . Suppose that u[xi , xi+1 , xi+2 ] = q. Then since wn [xi , xi+1 , xi+2 ] ≈ u[xi , xi+1 , xi+2 ] is an identity of M{xyxy} and wn [xi , xi+1 , xi+2 ] = p, it follows that p ≈ q is an identity of M{xyxy}. Therefore p[xi , xi+2 ] ≈ q[xi , xi+2 ] is also an identity of M{xyxy}; but this is impossible because q[xi , xi+2 ] = xi xi+2 xi xi+2 is an isoterm for M{xyxy}, while p[xi , xi+2 ] = x2i x2i+2 . Hence u[xi , xi+1 , xi+2 ] = p, that is, (e) u[xi , xi+1 , xi+2 ] = xi xi+1 xi xi+2 xi+1 xi+2 for all i ∈ {0, 1, . . . , n − 2}. It is then routinely shown by (a) and (e) that (f) u[x0 , x1 , . . . , xn ] = x0 · x1 x0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn xn−1 · xn . Now (b) implies that occ(y, u) = 2, where the first y of u is sandwiched between the two occurrences of x0 , while the second y of u is sandwiched between the two occurrences of xn . Hence by (f), u[y, x0 , x1 , . . . , xn ] = x0 · y r1 x1 y r2 x0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn y s1 xn−1 y s2 · xn for some (r1 , r2 ), (s1 , s2 ) ∈ {(1, 0), (0, 1)}. Note that wn [y, x1 ] ≈ u[y, x1 ] is an identity of M{xyxy}, where wn [y, x1 ] = yx21 y and u[y, x1 ] = y r1 x1 y r2 x1 y. Since the word x1 yx1 y is an isoterm for M{xyxy}, it follows that u[y, x1 ] 6= x1 yx1 y so that (r1 , r2 ) 6= (0, 1). By a symmetrical argument, wn [y, xn−1 ] ≈ u[y, xn−1 ] is an identity of M{xyxy}, where wn [y, xn−1 ] = yx2n−1 y and u[y, xn−1 ] = yxn−1 y s1 xn−1 y s2 , whence (s1 , s2 ) 6= (1, 0). Therefore (r1 , r2 ) = (1, 0) and (s1 , s2 ) = (0, 1) so that (g) u[y, x0 , x1 , . . . , xn ] = x0 · yx1 x0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn xn−1 y · xn . Using (c) instead of (b), the preceding argument can be repeated to give (h) u[z, x0 , x1 , . . . , xn ] = x0 · zx1 x0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn xn−1 z · xn . It is then easily deduced from (d), (g), and (h) that u = wn .  Remark 3.2. The requirement that n ≥ 3 in Lemma 3.1 is necessary since the word w2 is not an isoterm for the monoid M{xyxy}. Specifically, M{xyxy} satisfies the nontrivial identity w2 ≈ x0 x1 · yz · x0 x2 · yz · x1 x2 . Lemma 3.3. Let n, k ≥ 3 with n 6= k and let θ : A → A ∗ be any substitution. (i) If wn θ  wk , then wn θ = wn′ θ. (ii) If wn′ θ  wk , then wn θ = wn′ θ. Proof. Since wn and wn′ are obtained from one another by interchanging the variables y and z, it suffices to verify part (i). Suppose that wn θ  wk . Then clearly wn θ = wn′ θ if yθ = 1 or zθ = 1. Thus assume that yθ 6= 1 6= zθ; in what follows, a contradiction is deduced from this assumption, whence the proof is complete. First observe that (a) the only factors of wk that have more than one occurrence in wk are the individual variables and the word yz. 8 M. JACKSON AND E. W. H. LEE Therefore since wn θ = · · · (yθ)(zθ) · · · (yθ)(zθ) · · ·  wk with yθ 6= 1 6= zθ, the only possibility is yθ = y and zθ = z. wn = x0 · y z · x1 x0 · x2 x1 · · · xn xn−1 · y z · xn θ: ❄❄ ❄❄ wk = x0 · y z · x1 x0 · x2 x1 · · · xk xk−1 · y z · xk It follows that the factor wn θ of wk contains both occurrences of yz and so also all variables in between, whence (b) con(wn θ) = con(wk ). Now since yθ = y and zθ = z, it follows from (a) that xj θ ∈ {1, x0 , x1 , . . . , xk } for all xj in con(wn ). It thus follows from (b) that (c) for any xi ∈ con(wk ), there exists some xj ∈ con(wn ) such that xj θ = xi ; (d) if xj θ = xi , then θ sends the first (respectively, second) xj in wn to the first (respectively, second) xi in wk . In particular, (c) and the assumption n 6= k imply that n > k. wn = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · xk+1 xk · · · xn xn−1 · y z · xn θ: ❄❄ ❄❄ wk = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · y z · xk By (c), there exists some xj ∈ con(wn ) such that xj θ = x0 . By (d), the substitution θ sends the first (respectively, second) xj in wn to the first (respectively, second) x0 in wk . Since the first factor yz of wk is sandwiched between the two occurrences of x0 , the first factor yz of wn is also sandwiched between the two occurrences of xj ; this forces j = 0, so that x0 θ = x0 . wn = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · xk+1 xk · · · xn xn−1 · y z · xn θ: ❄ ❄❄ ❄ ❄❄ wk = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · y z · xk Since k < n, the argument in the previous paragraph can be repeated to show that xi θ = xi for all subsequent i = 1, 2, . . . , k − 1. wn = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · xk+1 xk · · · xn xn−1 · y z · xn θ: ❄ ❄❄ ❄❄ ❄❄ ❄ ❄ ❄ ❄❄ wk = x0 · y z · x1 x0 · x2 x1 · · · xk−1 xk−2 · xk xk−1 · y z · xk By (c), there exists some xj ∈ con(wn ) such that xj θ = xk . Since the factor xk−1 yz of wk is sandwiched between the two occurrences of xk , both the second variable xk−1 in wn and the second factor yz in wn are sandwiched between the two occurrences of xj . But it is easily seen that no such variable xj exists.  Theorem 3.4. The variety M{xyxy} is of type 2ℵ0 . Proof. Let Γ be any identity basis for the monoid M{xyxy}. For any subset N of {3, 4, 5, . . .}, define the identity system ΓN = {wn ≈ wn′ | n ∈ N}. In what follows, it is shown that the deduction Γ ∪ ΓN ⊢ wk ≈ wk′ holds if and only if k ∈ N. Therefore MONOID VARIETIES WITH EXTREME PROPERTIES 9 each subset of {3, 4, 5, . . .} corresponds to a unique subvariety of M{xyxy}, whence the theorem is established. Suppose that the deduction Γ ∪ ΓN ⊢ wk ≈ wk′ holds for some k ∈ / N. Then there exists a sequence wk = u0 , u1 , . . . , ur = wk′ of distinct words such that each identity ui ≈ ui+1 is directly deducible from some identity γi in Γ ∪ ΓN . By Lemma 3.1, the word wk = u0 is an isoterm for M{xyxy}. Therefore the monoid M{xyxy} does not satisfy the identity u0 ≈ u1 , whence Γ 0 u0 ≈ u1 . Hence the identity γ0 is in ΓN , say γ0 is wn ≈ wn′ for some n ∈ N. Now {u0 , u1 } = {a(wn θ0 )b, a(wn′ θ)b} for some a, b ∈ A ∗ implies that either wn θ0 or wn′ θ0 is a factor of u0 = wk . Since n 6= k, it follows from Lemma 3.3 that wn θ0 = wn′ θ0 , whence the contradiction u0 = u1 is deduced.  As shown in Jackson and Sapir [16], there exist infinitely many finite sets W of words such that MW is finitely based with M{xyxy} ∈ MW ; one such example is W = {xyxy, xy 2 x, x2 y 2 }. Therefore there exists an abundance of finitely based, finitely generated monoid varieties of type 2ℵ0 . Many finite J -trivial monoids from Volkov [49], several of which are finitely based, also generate monoid varieties of type 2ℵ0 due to the inclusion of M{xyxy}. 3.2. Joins of Cross monoid varieties. Lemma 3.5 (Oates and Powell [35]). Any finite group generates a Cross monoid variety. Lemma 3.6 (Lee [24, Lemma 3.4(i) and Proposition 4.1]). Any monoid that satisfies the identity xyxzx ≈ xyzx generates a Cross monoid variety. Lemma 3.7 (Lee and Zhang [32]). Up to isomorphism and anti-isomorphism, the monoid P21 obtained from the semigroup P2 = a, b a2 = ab = a, b2 a = b2 is the only monoid of order five that generates a nonsmall monoid variety; every other monoid of order five or less generates a Cross monoid variety. Using Theorem 3.4 and Lemmas 3.5–3.7, many examples of two Cross monoid varieties can be found with join that is of type 2ℵ0 . For instance, the symmetric group S3 on three symbols and the monoid M{x2 } of order four generate Cross monoid varieties. But since the word xyxy is an isoterm for S3 , M{x2 } , the join  Vmon {S3 } ∨ M{x2 } = Vmon S3 , M{x2 } contains M{xyxy} by Lemma 2.5 and so is of type 2ℵ0 . For an aperiodic example, consider the semigroup A0 = a, b a2 = a, b2 = b, ab = 0 of order four. Then the variety {L12 , A10 , R21 } is Cross by Lemma 3.6, but the  1Vmon 1 word xyxy is an isoterm for L2 , A0 , R21 , M{x2 } so that the join  Vmon {L12 , A10 , R21 } ∨ M{x2 } = Vmon L12 , A10 , R21 , M{x2 } contains M{xyxy} by Lemma 2.5. Presently, a few questions regarding semigroup varieties remain open. 10 M. JACKSON AND E. W. H. LEE Question 3.8 (Jackson [10, Question 3.15]). Are there finitely generated, small semigroup varieties U and V such that the join U ∨ V is of type 2ℵ0 ? A variety V is said to satisfy the ascending chain condition if the lattice L(V) satisfies the same condition. Question 3.9 (Shevrin et al. [44, Question 10.2(a)]). Are there semigroup varieties U and V with the ascending chain condition such that the join U ∨ V does not satisfy the same condition? Observe that the proof of Theorem 3.4 actually established a stronger result: the lattice of all subsets of {3, 4, 5, . . .} order-embeds into the lattice L(M{xyxy}). Hence within the context ofmonoids, Questions 3.8 and 3.9 are positively answered by the Cross varieties U ∈ Vmon {L12 , A10 , R21 }, Vmon {S3 } and V = M{x2 }. 3.3. Variety generated by all monoids of order n. Let Mn denote the class of all monoids of order n. Since there exist finitely many pairwise nonisomorphic monoids of order n, the variety Vmon Mn is the join of finitely many varieties. By Lemma 3.7, the variety Vmon M4 is the join of finitely many Cross varieties. Proposition 3.10. (i) The variety Vmon M2 contains four subvarieties. (ii) The variety Vmon M3 contains 60 subvarieties. (iii) The variety Vmon M4 is of type 2ℵ0 . Proof. For each n ≥ 1, let Zn denote the cyclic group of order n. (i) It is well known that the variety Vmon M2 = Vmon {M∅, Z2 } contains four subvarieties: 0, M∅, Vmon {Z2 }, and itself. (ii) Up to isomorphism and anti-isomorphism, all semigroups of order three are listed in Luo and Zhang [33, Table 2]. It is easily deduced that Vmon M3 = Vmon {L12 , M{x}, R21 , Z2 , Z3 }. Following Luo and Zhang [33, §4], the variety Vmon {L12 , M{x}, R21 , Zn } can be shown to be defined by the identities xn+1 hx ≈ xhx, xhxtx ≈ x2 htx, xhxyty ≈ xhyxty. It is then routinely shown that (a) the lattice L(Vmon M3 ) is the disjoint union of L(Vmon {L12 , M{x}, R21 }), [Vmon {Z2 }, Vmon {L12 , M{x}, R21 , Z2 }], [Vmon {Z3 }, Vmon {L12 , M{x}, R21 , Z3 }], and [Vmon {Z2 , Z3 }, Vmon{L12 , M{x}, R21 , Z2 , Z3 }]; (b) the latter three intervals in (a) are isomorphic to L(Vmon {L12 , M{x}, R21 }). By Proposition 2.6, the lattice L(Vmon {L12 , M{x}, R21 }) contains 15 varieties. Therefore by (a) and (b), the number of subvarieties of Vmon M3 is 15 × 4 = 60. (iii) The class M4 contains L12 , M{x2 }, and the monoid T2 of transformations of {1, 2}, which can be given by T2 = a, b a2 = ba = a, b2 = 1 . Hence Vmon {L12 , M{x2 }, T2 } ⊆ Vmon M4 . It is easily checked that xyxy is an isoterm for {L12 , M{x2 }, T2 } so that M{xyxy} ∈ Vmon {L12 , M{x2 }, T2 } by Lemma 2.5. The result thus holds by Theorem 3.4. MONOID VARIETIES WITH EXTREME PROPERTIES 11 Alternately, it follows from Lee and Li [29, Theorem 1.1] that the identities x13 hxkx ≈ xhxkx, xhx2 kx ≈ x3 hkx, xhykxytxdy ≈ xhykyxtxdy, xhy 2 x2 ky ≈ xhx2 y 2 ky, xhykxytydx ≈ xhykyxtydx constitute a basis for the variety Vmon M4 ; the monoid M{xyxy} satisfies these identities and so belongs to the variety.  Consequently, the monoid variety Vmon Mn is of type 2ℵ0 if and only if n ≥ 4. It turns out that by Jackson [10, Corollary 3.17] and Luo and Zhang [33], a similar result holds for the semigroup variety Vsem Mn . n=2 n=3 n≥4 Number of subvarieties of Vsem Mn 32 ℵ0 2ℵ0 Number of subvarieties of Vmon Mn 4 60 2ℵ0 4. Varieties generated by inherently nonfinitely based finite monoids An algebra A is inherently nonfinitely based if every locally finite variety containing A is nonfinitely based. M. V. Sapir [40] provided an elegant description of inherently nonfinitely based finite semigroups based on Zimin words z1 , z2 , z3 , . . . defined by z1 = x1 and zn+1 = zn xn+1 zn for all n ≥ 1. Theorem 4.1 (M. V. Sapir [40, Proposition 7]). A finite semigroup is inherently nonfinitely based if and only if all Zimin words are isoterms for it. Using Theorem 4.1, Jackson [10, proof of Corollary 3.9] demonstrated that the variety generated by any inherently nonfinitely based finite semigroup contains the monoid M{xyx}; in view of Proposition 2.7, such a variety is of type 2ℵ0 . But since the monoid variety M{xyx} contains only five subvarieties [13, Lemma 4.4], the inclusion of the monoid M{xyx} is insufficient for a monoid variety to be of type 2ℵ0 . M. V. Sapir has also provided a structural description of inherently nonfinitely based finite semigroups that is detailed enough to provide an algorithm that decides if a finite semigroup is inherently nonfinitely based [39, Theorem 1]. It is natural to question if such an algorithm exists for finite monoids. Question 4.2 (M. V. Sapir [41, Problem 3.10.12]). Is there an algorithm that decides if a finite monoid is inherently nonfinitely based as a monoid? In the present section, arguments from §3 are adapted to show that any inherently nonfinitely based finite monoid generates a monoid variety of type 2ℵ0 . In §4.1, it is shown that a finite monoid is inherently nonfinitely based as a semigroup if and only if it is inherently nonfinitely based as a monoid. It follows that Question 4.2 is affirmatively answered by the aforementioned algorithm of M. V. Sapir [39, Theorem 1]. In §4.2, some preliminary results regarding Zimin words are established. Main results of the section are then established in §4.3. 4.1. Inherently nonfinitely based finite monoids. Theorem 4.3. The following statements on any finite monoid M are equivalent : (i) M belongs to some finitely based locally finite semigroup variety; (ii) M belongs to some finitely based locally finite monoid variety. 12 M. JACKSON AND E. W. H. LEE Consequently, M is an inherently nonfinitely based semigroup if and only if M is an inherently nonfinitely based monoid. Proof. (i) implies (ii). Suppose that M belongs to some finitely based locally finite semigroup variety V. Let Σ be any finite identity basis for V and let V denote the monoid variety defined by Σ. Evidently, the monoid variety V is finitely based and M ∈ V. Moreover, V is locally finite, because any of its finitely generated monoids has its semigroup reduct in V, and hence is finite. (ii) implies (i). Suppose that M belongs to some finitely based locally finite monoid variety V. Let Σ be any finite identity basis for V. If Σ contains some identity u ≈ v with con(u) 6= con(v), say x ∈ con(u)\ con(v), then M satisfies the identity xocc(x,u) ≈ 1 and so is a finite group; it is well known that all finite groups are finitely based [35], so that Vsem {M } is the required finitely based locally finite semigroup variety containing M . Therefore it suffices to assume that every identity u ≈ v in Σ satisfies the property that con(u) = con(v). Let Σ′ be the result of adding to Σ all nontrivial identities obtained from identities in Σ by assigning 1 to some variables and reducing modulo x1 7→ x and 1x 7→ x. It is clear that in the semigroup signature, Σ′ has the same power of deduction for semigroup identities as Σ has for semigroup identities in the monoid signature: any application of u ≈ v from Σ in an equational deduction can be replaced by an application of some identity in Σ′ obtained from u ≈ v by variable deletion. Thus Σ′ is a finite identity basis defining the semigroup variety V generated by the semigroup reducts of monoids in V. Clearly the semigroup variety V is finitely based and M ∈ V. As the monoid variety V is locally finite, it is also uniformly locally finite in the sense that for each n ∈ {1, 2, 3, . . .}, there is a number k such that any n-generated member has at most k elements [34]. Therefore the semigroup variety V is also locally finite.  4.2. Some results on Zimin words. Lemma 4.4. Suppose that zn+1 is an isoterm for a monoid M . Then zn is also an isoterm for M . Proof. If zn is not an isoterm for M , say M satisfies a nontrivial identity zn ≈ w for some w ∈ A + , then M also satisfies the nontrivial identity zn xn+1 zn ≈ wxn+1 w, whence zn+1 = zn xn+1 zn is not an isoterm for M .  Lemma 4.5. Let w ≈ w′ be any identity satisfied by a monoid M . Suppose that zn is an isoterm for M for some n ≥ 2. Then: (i) con(w) = con(w′ ); (ii) occ(x, w) = 1 if and only if occ(x, w′ ) = 1; (iii) w[x, y] = xyx if and only if w′ [x, y] = xyx. Proof. By Lemma 4.4, the words z1 = x1 and z2 = x1 x2 x1 are isoterms for M . Parts (i) and (ii) are then easily established. Part (iii) holds because the identity w[x, y] ≈ w′ [x, y] is satisfied by M and xyx is an isoterm.  Lemma 4.6. For each n ≥ 3, the word zn can be written as   n−1 Y (4.1) zn = p1 (pi+1 pi ) qn = p1 · p2 p1 · · · pn−1 pn−2 · pn pn−1 · qn , i=1 where p1 , p2 , . . . , pn , qn ∈ A + satisfy the following: MONOID VARIETIES WITH EXTREME PROPERTIES 13 (I) con(pi ) ⊆ {x1 , x2 , . . . , xi } for each i ∈ {1, 2, . . . , n}; (II) occ(xi , pi ) = 1 for each i ∈ {1, 2, . . . , n}; (III) con(qn ) ⊆ {x1 , x2 , . . . , xn−2 }. Proof. The basic case holds because z3 = x1 x2 x1 x3 x1 x2 x1 . |{z} |{z} |{z} | {z } |{z} |{z} p1 p2 p1 p3 p2 q3 Suppose that n ≥ 4 and the result holds for zn−1 . That is, zn−1 = p1 · p2 p1 · · · pn−1 pn−2 · qn−1 where p1 , p2 , . . . , pn−1 , qn−1 ∈ A + satisfy the following: (I′ ) con(pi ) ⊆ {x1 , x2 , . . . , xi } for each i ∈ {1, 2, . . . , n − 1}; (II′ ) occ(xi , pi ) = 1 for each i ∈ {1, 2, . . . , n − 1}; (III′ ) con(qn−1 ) ⊆ {x1 , x2 , . . . , xn−3 }. Then zn = zn−1 xn zn−1 = p1 · p2 p1 · · · pn−1 pn−2 · qn−1 xn p1 · p2 p1 · · · pn−2 pn−3 · pn−1 pn−2 · qn−1 | {z } {z } | pn qn is of the form (4.1). It follows from (I′ )–(III′ ) that con(pn ) = con(qn−1 ) ∪ {xn } ∪ con(p1 · p2 p1 · · · pn−2 pn−3 ) ⊆ {x1 , x2 , . . . , xn−3 } ∪ {xn } ∪ {x1 , x2 , . . . , xn−2 } ⊆ {x1 , x2 , . . . , xn }, occ(xn , pn ) = occ(xn , qn−1 ) + 1 + occ(xn , p1 · p2 p1 · · · pn−2 pn−3 ) = 0 + 1 + 0 = 1, and con(qn ) = con(pn−2 ) ∪ con(qn−1 ) ⊆ {x1 , x2 , . . . , xn−2 } ∪ {x1 , x2 , . . . , xn−3 } ⊆ {x1 , x2 , . . . , xn−2 }. Therefore (I)–(III) hold.  4.3. Main results of section. Theorem 4.7. Suppose that all Zimin words are isoterms for a monoid M . Then the monoid variety Vmon {M } is of type 2ℵ0 . Corollary 4.8. The monoid variety M{z1 , z2 , . . .} is of type 2ℵ0 . Proof. By Lemma 2.5, all Zimin words are isoterms for M{z1 , z2 , . . .}. The result then follows from Theorem 4.7.  Corollary 4.9. Any inherently nonfinitely based finite monoid generates a monoid variety of type 2ℵ0 . Proof. By Theorems 4.1 and 4.3, all Zimin words are isoterms for any inherently nonfinitely based finite monoid. The result then follows from Theorem 4.7.  14 M. JACKSON AND E. W. H. LEE It is well known that the monoid A12 obtained from A2 = a, b a2 = aba = a, b2 = 0, bab = b and the monoid B21 are inherently nonfinitely based semigroups [40] of order six. Trahtman [46] proved that the semigroup variety Vsem {A12 } is of type 2ℵ0 , while Jackson [10] proved that the semigroup variety Vsem {B21 } also has the same type. (Three finitely based monoids of order six have also been found to generate semigroup varieties of type 2ℵ0 [6].) The question of whether or not the monoid varieties Vmon {A12 } and Vmon {B21 } are of type 2ℵ0 was posed by Lee [24, Question 7.4]. By Theorem 4.3 and Corollary 4.9, the answer to this question is affirmative. The remainder of this subsection is devoted to the proof of Theorem 4.7. For each n ≥ 3, define the words wn = x0 hx1 yzx0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn yzxn−1 txn and wn′ = x0 hx1 zyx0 · x2 x1 · x3 x2 · · · xn−1 xn−2 · xn zyxn−1 txn . Lemma 4.10. Suppose that z5 is an isoterm for a monoid M . Then wn [x0 , h, y, z, x1 ] and wn [xn , t, y, z, xn−1 ] are also isoterms for M . Proof. By symmetry, it suffices to show that w = wn [x0 , h, y, z, x1 ] = x0 hx1 yzx0 x1 yz is an isoterm for the monoid M . Let w ≈ w′ be any identity satisfied by M . Since con(w) = {x0 , h, y, z, x1 } and w[x0 , h] = x0 hx0 , it follows from Lemma 4.5 that con(w′ ) = {x0 , h, y, z, x1 } and w′ [x0 , h] = x0 hx0 . Therefore (a) w′ = ax0 bhcx0 d for some a, b, c, d ∈ {y, z, x1 }∗ . Let θ : {x0 , h, y, z, x1 } → A + denote the substitution given by (x0 , h, y, z, x1 ) 7→ (x1 x2 x1 x4 x1 , x2 x1 x3 x1 x2 x1 x5 x1 , x1 , x3 , x2 ). Then (b) wθ = x1 x2 x1 x4 x1 · x2 x1 x3 x1 x2 x1 x5 x1 · x2 x1 x3 · x1 x2 x1 x4 x1 · x2 x1 x3 {z } | {z } | {z } | {z } | {z } | x0 θ hθ (x1 yz)θ x0 θ (x1 yz)θ ∗ is a factor of z5 , that is, z5 = e(wθ)f for some e, f ∈ A . If wθ 6= w′ θ, then e(wθ)f 6= e(w′ θ)f so that z5 ≈ e(w′ θ)f is contradictorily a nontrivial identity satisfied by M . Therefore wθ = w′ θ, whence by (a) and (b), w′ θ = aθ · x1 x2 x1 x4 x1 · bθ · x2 x1 x3 x1 x2 x1 x5 x1 · cθ · x1 x2 x1 x4 x1 · dθ = x1 x2 x1 x4 x1 · x2 x1 x3 x1 x2 x1 x5 x1 · x2 x1 x3 · x1 x2 x1 x4 x1 · x2 x1 x3 . Since a, b, c, d ∈ {y, z, x1 }∗ implies that aθ, bθ, cθ, dθ ∈ {x1 , x2 , x3 }∗ , it follows that (a) a = b = 1 and c = d = x1 yz. Consequently, w′ = x0 hx1 yzx0 x1 yz = w. Lemma 4.11. Suppose that zn+2 is an isoterm for a monoid M . Then wn [h, x0 , x1 , . . . , xn ] are also isoterms for M . and wn [x0 , x1 , . . . , xn , t]  MONOID VARIETIES WITH EXTREME PROPERTIES 15 Proof. By symmetry, it suffices to show that w = wn [x0 , x1 , . . . , xn , t] = x0 · x1 x0 · x2 x1 · · · xn xn−1 · txn is an isoterm for the monoid M . Let w ≈ w′ be any identity satisfied by M . Since con(w) = {x0 , x1 , . . . , xn , t} and w[xn , t] = xn txn , it follows from Lemma 4.5 that con(w′ ) = {x0 , x1 , . . . , xn , t} and w′ [xn , t] = xn txn . Therefore (a) w′ = axn btcxn d for some a, b, c, d ∈ {x0 , x1 , . . . , xn−1 }∗ . On the other hand, by Lemma 4.6, zn+2 = p1 · p2 p1 · p3 p2 · · · pn+1 pn · pn+2 pn+1 · qn+2 for some p1 , p2 , . . . , pn+2 , qn+2 ∈ A + such that (b) con(pi ) ⊆ {x1 , x2 , . . . , xi } for each i ∈ {1, 2, . . . , n + 2}, (c) occ(xi , pi ) = 1 for each i ∈ {1, 2, . . . , n + 2}, and (d) con(qn+2 ) ⊆ {x1 , x2 , . . . , xn }. Let θ : {x0 , x1 , . . . , xn , t} → A + denote the substitution given by (x0 , x1 , . . . , xn−1 , xn , t) 7→ (p1 , p2 , . . . , pn , pn+1 , pn+2 ). Then (e) wθ = p1 · p2 p1 · p3 p2 · · · pn pn−1 · pn+1 pn · pn+2 pn+1 and (f) w′ θ = aθ · pn+1 · bθ · pn+2 · cθ · pn+1 · dθ where (g) aθ, bθ, cθ, dθ ∈ {p1 , p2 , . . . , pn }∗ . Note that zn+2 = (wθ)qn+2 . Hence if wθ 6= w′ θ, then (wθ)qn+2 6= (w′ θ)qn+2 so that zn+2 ≈ (w′ θ)qn+2 is contradictorily a nontrivial  identity satisfied by M . Therefore wθ = w′ θ. Since xn+1 , xn+2 ∈ / con (abcd)θ by (b) and (g), a simple inspection of (e) and (f) yields aθ = p1 · p2 p1 · p3 p2 · · · pn−1 pn−2 · pn pn−1 , bθ = pn , and cθ = dθ = 1. It is then clear that (h) c = d = 1 and b = xn−1 . Since xn ∈ con(pn )\ con(p1 p2 · · · pn−1 ) by (b) and (c), the variable xn occurs precisely once in aθ, whence a = a′ xn−1 b′ for some a′ , b′ ∈ {x0 , x1 , . . . , xn−2 }∗ . Since the factor pn of aθ is preceded by one pn−1 and immediately followed by one pn−1 , it follows from (b) and (c) that a = a′′ xn−2 b′′ xn−1 xn−2 for some a′′ , b′′ ∈ {x0 , x1 , . . . , xn−3 }∗ . This argument can be repeated to obtain a = x0 · x1 x0 · x2 x1 · · · xn−3 xn−4 · xn−2 xn−3 · xn−1 xn−2 . ′ Hence w = axn btcxn d = w by (a) and (h).  Lemma 4.12. Suppose that all Zimin words are isoterms for a monoid M . Then for each n ≥ 3, the words wn and wn′ are also isoterms for M . Proof. By Lemmas 4.10 and 4.11, all neighboring variables in wn and wn′ are fixed in their relative positions.  Lemma 4.13. Let n, k ≥ 3 with n 6= k and let θ : A → A ∗ be any substitution. (i) If wn θ  wk , then wn θ = wn′ θ. (ii) If wn′ θ  wk , then wn θ = wn′ θ. 16 M. JACKSON AND E. W. H. LEE Proof. This is very similar to Lemma 3.3.  Proof of Theorem 4.7. This is similar to the proof of Theorem 3.4.  5. A monoid variety of type ℵ0 This section is concerned with the monoid E 1 obtained from the semigroup E = a, b, c a2 = ab = 0, ba = ca = a, b2 = bc = b, c2 = cb = c of order five; the multiplication table of this semigroup is given by 0 0 0 0 0 0 E 0 a ac b c a 0 0 0 a a ac 0 0 0 ac ac b 0 0 ac b c c 0 ac ac b c The monoid E 1 was first investigated in Lee and Li [28, §14], where its identities were shown to be finitely axiomatized by (5.1a) (5.1b) x3 ≈ x2 , x2 yx ≈ xyx, xyx2 ≈ xyx, xy 2 x ≈ x2 y 2 . The main aim of the present section is to show that the variety E1 = Vmon {E 1 } is of type ℵ0 . For this purpose, the monoid Q1 obtained from the semigroup Q = a, b, c a2 = a, ab = b, ca = c, ac = ba = cb = 0 of order five plays an important role. It is routinely checked that the monoids L12 , B01 , and Q1 satisfy the identities (5.1) so the varieties L12 , B10 , and Q1 = Vmon {Q1 } are subvarieties of E1 . In §5.1, the lattice L(E1 ) is decomposed into the union of the lattice L(L12 ∨ Q1 ) and the interval [L12 ∨ Q1 , E1 ]. The lattice L(L12 ∨ Q1 ) is shown in §5.2 to be finite, while the interval [L12 ∨ Q1 , E1 ] is shown in §5.3 to be countably infinite. Therefore the monoid E 1 generates a monoid variety of type ℵ0 . A complete description of the lattice L(E1 ) is given in §5.4. 5.1. A decomposition of L(E1 ). Proposition 5.1. L(E1 ) = L(L12 ∨ Q1 ) ∪ [L12 ∨ Q1 , E1 ]. Lemma 5.2 (Lee [24, §4]). The variety L12 ∨ B10 is defined by the identities (5.1) and xyxzx ≈ xyzx. Lemma 5.3 (Lee [27, §5]). (i) The variety Q1 is Cross. (ii) The variety Q1 is defined by the identities (5.1a) and x2 y 2 ≈ y 2 x2 . (iii) The lattice L(Q1 ) is given in Figure 2. Lemma 5.4. Let V be any subvariety of E1 . Then one of the following holds: (i) L12 ∨ Q1 ⊆ V; MONOID VARIETIES WITH EXTREME PROPERTIES 17 Q1 r r B10 ❅ ❅r J1 I1 r ❅ ❅r M{xy} r M{x} r M∅ r 0 Figure 2. The lattice L(Q1 ) (ii) V ⊆ L12 ∨ B10 ; (iii) V ⊆ Q1 . Proof. Suppose that L12 ∨ Q1 * V so that either L12 ∈ / V or Q1 ∈ / V. Lemma 2.2, either L2 ∈ / Vsem V or Q ∈ / Vsem V. Then by Case 1. L2 ∈ / Vsem V. Then it follows from Almeida [1, Proposition 10.10.2(b)] that the variety Vsem V satisfies the identity x2 (y 2 x2 )2 ≈ (y 2 x2 )2 . (5.2) Since (5.2) (5.1b) (5.1a) y 2 x2 ≈ (y 4 x2 )x2 ≈ y 2 x2 y 2 x2 ≈ x2 (y 2 x2 y 2 )x2 (5.1b) (5.1b) (5.1a) ≈ x2 y 4 x4 ≈ x6 y 4 ≈ x2 y 2 , the variety Vsem V satisfies the identity x2 y 2 ≈ y 2 x2 . Hence the inclusion V ⊆ Q1 holds by Lemma 5.3(ii). Case 2. Q ∈ / Vsem V. Then it follows from Almeida [1, Lemma 6.5.14] that the variety Vsem V satisfies one of the identities: (5.3) x2 yx2 zx2 ≈ x2 yzx2 , (5.4) (x2 yx2 )2 ≈ x2 yx2 . If Vsem V |= (5.3), then (5.3) (5.1a) (5.1a) xyxzx ≈ x2 yx2 zx2 ≈ x2 yzx2 ≈ xyzx; if Vsem V |= (5.4), then (5.1a) (5.4) (5.1a) xyxzx ≈ x2 yx2 zx2 ≈ (x2 yx2 zx2 )2 ≈ (xy 2 xz 2 x2 )2 (5.1b) (5.1a) (5.4) (5.1a) ≈ (x2 y 2 z 2 x2 )2 ≈ (x2 yzx2 )2 ≈ x2 yzx2 ≈ xyzx. In any case, the variety Vsem V satisfies the identity xyxzx ≈ xyzx. Therefore the inclusion V ⊆ L12 ∨ B10 holds by Lemma 5.2.  Proof of Proposition 5.1. The inclusion B10 ⊆ Q1 from Figure 2 implies the inclusion L12 ∨ B10 ⊆ L12 ∨ Q1 , while the inclusion Q1 ⊆ L12 ∨ Q1 is obvious. Therefore L12 ∨ B10 and Q1 are subvarieties of L12 ∨ Q1 . The result then follows from Lemma 5.4.  18 M. JACKSON AND E. W. H. LEE 5.2. The lattice L(L12 ∨ Q1 ). Proposition 5.5. The lattice L(L12 ∨ Q1 ) is given in Figure 3. Proof. Recall from the proof of Proposition 5.1 that L12 ∨ B10 and Q1 are subvarieties of L12 ∨ Q1 . By Lemma 5.4, any proper subvariety of L12 ∨ Q1 is contained in either L12 ∨ B10 or Q1 . Therefore L12 ∨ B10 and Q1 are the only maximal proper subvarieties of L12 ∨ Q1 , whence the result holds by Figures 1 and 2.  L12 ∨ Q1 r ❅ L12 ∨ B10 r ❅r Q1 ❅ 1 L12 ∨ M(x) r ❅r B0 ❅ ❅ r ❅r J1 ❅ 1 I ❅ ❅r L12 r M(xy) ❅ ❅ r M(x) ❅ ❅r M(1) r 0 Figure 3. The lattice L(L12 ∨ Q1 ) 5.3. The interval [L12 ∨ Q1 , E1 ]. For each n ≥ 1, define the identity   Y Y n n 2 2 (ei hi ) y 2 x2 , (ei hi ) x y ≈ σn : i=1 i=1 where ei = ( x2 y2 if i is odd, if i is even. For instance, the first three identities are σ1 : x2 h1 · x2 y 2 ≈ x2 h1 · y 2 x2 , σ2 : x2 h1 · y 2 h2 · x2 y 2 ≈ x2 h1 · y 2 h2 · y 2 x2 , σ3 : x2 h1 · y 2 h2 · x2 h3 · x2 y 2 ≈ x2 h1 · y 2 h2 · x2 h3 · y 2 x2 . Let σ∞ denote the identity x2 y 2 hx2 y 2 ≈ x2 y 2 hy 2 x2 . Proposition 5.6. The varieties in the interval [L12 ∨ Q1 , E1 ] constitute the chain (5.5) E1 {σ1 } ⊂ E1 {σ2 } ⊂ · · · ⊂ E1 {σ∞ } ⊂ E1 . Consequently, L12 ∨ Q1 = E1 {σ1 }. The proof of Proposition 5.6 is given at the end of the subsection. Lemma 5.7. The inclusions in (5.5) hold. Proof. There are three cases. MONOID VARIETIES WITH EXTREME PROPERTIES 19 Case 1. E1 {σn } ⊂ E1 {σn+1 } for any finite n. The inclusion E1 {σn } ⊆ E1 {σn+1 } holds because σn+1 is obtained by performing the substitution hn 7→ hn en+1 hn+1 in σn . Further,  2 2shown that by applying the identities {(5.1), σn+1 } to Qn it is easily the word (e h ) x y on the left side of σn , a word of the form i i i=1  Y n ′ (ei hi ) abc i=1 is obtained, where ∈ {x}+ , e′2 , e′4 , . . . , b ∈ {y}+ , and c ∈ {x, y}∗ . It follows that σn is not deducible from {(5.1), σn+1 }, whence E1 {σn } = 6 E1 {σn+1 }. e′1 , e′3 , . . . , a Case 2. E1 {σn } ⊂ E1 {σ∞ } for any finite n. In view of part (i), it suffices to assume that n = 2r is even. Since (5.1) (5.1) σn x2 y 2 hx2 y 2 ≈ (x2 xy 2 y)r hx2 y 2 ≈ (x2 xy 2 y)r hy 2 x2 ≈ x2 y 2 hy 2 x2 , the inclusion E1 {σn } ⊆ E1 {σ∞ } holds. The nonequality E1 {σn } 6= E1 {σ∞ } follows from an argument similar to part (i). Case 3. E1 {σ∞ } ⊂ E1 . The inclusion E1 {σ∞ } ⊆ E1 vacuously holds. But since b2 c2 ab2 c2 = 0 6= ac = b2 c2 ac2 b2 in E 1 , the identity σ∞ does not hold in E 1 . Hence E1 {σ∞ } 6= E1 .  It remains to verify that the varieties in the interval [L12 ∨ Q1 , E1 ] are precisely those in (5.5). The remainder of this subsection is devoted to this task. A word of the form x21 x22 · · · x2n , where n ≥ 0 and x1 , x2 , . . . , xn are distinct variables, is called a product of distinct squares. Note that by definition, the empty word is also a product of distinct squares. A word u is in canonical form if u = u0 n Y (hi ui ) i=1 for some n ≥ 0, where the variables h1 , h2 , . . . , hn are simple in u and the possibly empty words u0 , u1 , . . . , un are products of distinct squares. It is convenient to call ui the ith block of u. Note that if n = 0, then u = u0 does not contain any simple variable. Lemma 5.8 (Lee and Li [28, Lemma 14.2]). Given any word u, there exists a word u′ in canonical form such that the identity u ≈ u′ is deducible from (5.1). Lemma 5.9. (i) Suppose that u = u0 n Y i=1 ′ (hi ui ) and n Y (h′i vi ) v = v0 i=1 1 are words in canonical form. Then Q |= u ≈ v if and only if n = n′ , hi = h′i for all i, and con(ui ) = con(vi ) for all i. (ii) The variety L12 satisfies an identity u ≈ v if and only if ini(u) = ini(v). Proof. Part (i) can be extracted from Lee and Li [28, Proof of Proposition 4.3], while Part (ii) is well known and easily verified.  20 M. JACKSON AND E. W. H. LEE Lemma 5.10. Suppose that u and v are any distinct words in canonical form such that L12 ∨ Q1 |= u ≈ v. Then E1 {u ≈ v} = E1 Λ for some finite set Λ of identities of the form   Y Y m m (pi hi ) y 2 x2 , (pi hi ) x2 y 2 ≈ (5.6) i=1 i=1 where pi ∈ {1, x2 , y 2 , x2 y 2 , y 2 x2 } for all i with (p1 , p2 , . . . , pm ) 6= (1, 1, . . . , 1) and m ≥ 1. Proof. Since Q1 |= u ≈ v where the words u and v are in canonical form, it follows from Lemma 5.9(i) that u = u0 n Y (hi ui ) and v = v0 n Y (hi vi ) i=1 i=1 for some n ≥ 0, where h1 , h2 , . . . , hn are simple variables and (a) u0 , u1 , . . . , un , v0 , v1 , . . . , vn are products of distinct squares such that (b) con(ui ) = con(vi ) for all i. Further, the assumption L12 |= u ≈ v and Lemma 5.9(ii) imply that (c) ini(u) = ini(v). In particular, u0 = v0 by (a)–(c). Since u 6= v by assumption, it follows that n ≥ 1, and there exists a least ℓ ∈ {1, 2, . . . , n} such that u and v do not share the same ℓth block, that is, ui = vi for all i < ℓ while uℓ 6= vℓ . For the remainder of this proof, it is shown that (†) there exist some word v′ in canonical form sharing the same ith block with u for all i ≤ ℓ and some finite set Λ of identities from (5.6) such that E1 {u ≈ v} = E1 ({u ≈ v′ } ∪ Λ). The procedure used to establish (†) can be repeated to complete the proof of the present lemma. Let q be the longest suffix shared by uℓ and vℓ . Then u and v are of the form u = a · hℓ · · · x2 q · b | {z } uℓ where a = u0 ℓ−1 Y (hi ui ) = v0 i=1 and v = a · hℓ · · · x2 y12 y22 · · · yk2 q · c, {z } | ℓ−1 Y (hi vi ), i=1 vℓ b= n Y (hi ui ), i=ℓ+1 and c = n Y (hi vi ). i=ℓ+1 Since vℓ = · · · x2 y12 y22 · · · yk2 q is a product of distinct squares, y1 ∈ / con(q). Further, since con(uℓ ) = con(vℓ ) by (b), it follows that u[x, y1 ] = a[x, y1 ] · y12 x2 · b[x, y1 ] and v[x, y1 ] = a[x, y1 ] · x2 y12 · c[x, y1 ]. Now if a[x, y1 ] = 1, then u[x, y1 ] = y12 x2 · · · and v[x, y1 ] = x2 y12 · · ·; but this contradicts (c). Therefore a[x, y1 ] 6= 1, whence (e) the words ui [x, y1 ] = vi [x, y1 ], where i ∈ {0, 1, . . . , ℓ − 1}, are not all empty. MONOID VARIETIES WITH EXTREME PROPERTIES 21 Since u[x, y1 , h1 , h2 , . . . , hℓ ] = v0 [x, y1 ]  ℓ−1 Y i=1 (5.1) ≈ v0 [x, y1 ]  ℓ−1 Y i=1 and v[x, y1 , h1 , h2 , . . . , hℓ ] = v0 [x, y1 ]  ℓ−1 Y   hi vi [x, y1 ] hℓ y12 x2 b[x, y1 ]   hi vi [x, y1 ] hℓ y12 x2 hi vi [x, y1 ] i=1 (5.1) ≈ v0 [x, y1 ]  ℓ−1 Y i=1   hℓ x2 y12 c[x, y1 ]   hi vi [x, y1 ] hℓ x2 y12 , the identities {(5.1), u ≈ v} imply the identity    ℓ−1  ℓ−1 Y Y   2 2 hi v0 [x, y1 ] hℓ y12 x2 , λ1 : v0 [x, y1 ] hi vi [x, y1 ] hℓ x y1 ≈ v0 [x, y1 ] i=1 i=1 1 1 which, by (e), is from (5.6). Hence E {u ≈ v} = E {u ≈ v, λ1 }. Now since vi is a product of distinct squares, vi [x, y1 ] ∈ {1, x2 , y12 , x2 y12 , y12 x2 }. It is thus routinely checked that (5.1) ⊢ vi ≈ vi · (vi [x, y1 ]). Since vℓ  z  ℓ−1 }| { Y 2 2 2 (hi vi ) hℓ · · · x y1 y2 · · · yk2 q · c v = v0 i=1   ℓ−1 Y  hi vi · (vi [x, y1 ]) hℓ · · · x2 y12 y22 · · · yk2 q · c ≈ v0 · (v0 [x, y1 ]) (5.1) i=1   ℓ−1 Y  λ1 ≈ v0 · (v0 [x, y1 ]) hi vi · (vi [x, y1 ]) hℓ · · · y12 x2 y22 · · · yk2 q · c i=1   ℓ−1 Y (5.1) (hi vi ) hℓ · · · y12 x2 y22 · · · yk2 q · c = v(1) , ≈ v0 i=1 it follows that E1 {u ≈ v} = E1 {u ≈ v(1) , λ1 }, where v(1) is a word in canonical form that is obtained from v by interchanging the factors x2 and y12 . The same argument can be repeated on the identity u ≈ v(1) , resulting in E1 {u ≈ v(1) } = E1 {u ≈ v(2) , λ2 }, where λ2 is the identity    ℓ−1  ℓ−1 Y Y   2 2 hi v0 [x, y2 ] hℓ y22 x2 v0 [x, y2 ] hi vi [x, y2 ] hℓ x y2 ≈ v0 [x, y2 ] i=1 i=1 from (5.6) and v (2)   ℓ−1 Y = v0 (hi vi ) hℓ · · · y12 y22 x2 y32 · · · yk2 q · c i=1 22 M. JACKSON AND E. W. H. LEE is a word in canonical form that is obtained from v(1) by interchanging the factors x2 and y22 . Continuing in this manner, E1 {u ≈ v(k−1) } = E1 {u ≈ v(k) , λk }, where λk is the identity    ℓ−1  ℓ−1 Y Y   2 2 hi v0 [x, yk ] hℓ yk2 x2 hi vi [x, yk ] hℓ x yk ≈ v0 [x, yk ] v0 [x, yk ] i=1 i=1 from (5.6) and v(k) = v0   ℓ−1 Y (hi vi ) hℓ · · · y12 y22 · · · yk2 x2 q · c i=1 is a word in canonical form that is obtained from v(k−1) by interchanging the factors x2 and yk2 . Consequently, E1 {u ≈ v} = E1 {u ≈ v(1) , λ1 } = E1 {u ≈ v(2) , λ1 , λ2 } .. . = E1 {u ≈ v(k) , λ1 , λ2 , . . . , λk }, where the ℓth block of u and the ℓth block of v(k) share the longer suffix x2 q. The preceding procedure can be repeated until (†) is established.  Proof of Proposition 5.6. Let V be any variety in the interval [L12 ∨ Q1 , E1 ]. Then by Lemma 5.8, there exists some set Λ of identities formed by words in canonical form such that V = E1 Λ. By Lemma 5.10, the identities in Λ can be chosen from (5.6). In the following, it is shown that if   Y Y m m 2 2 (pi hi ) y 2 x2 (pi hi ) x y ≈ λ: i=1 i=1 1 1 is any identity from (5.6), then E {λ} = E {σn } for some n. This is sufficient in view of Lemma 5.7. It is easily shown that if pj = 1, then the identity λ′ obtained from λ by removing the variable hj is an identity from (5.6) such that E1 {λ} = E1 {λ′ }. Hence generality is not lost by assuming that p1 , p2 , . . . , pm ∈ {x2 , y 2 , x2 y 2 , y 2 x2 }. Let u and v be the words on the left and right sides of the identity λ. Case 1. p1 , p2 , . . . , pm ∈ {x2 , y 2 }. Suppose that pj = pj+1 . By symmetry, it suffices to assume that pj = pj+1 = x2 . Let u′ and v′ be words obtained by removing the factor pj hj from u and v, respectively. Then λ′ : u′ ≈ v′ is an identity from (5.6). Since   Y   j−1 m Y (pi hi ) x2 y 2 (pi hi ) pj+1 hj+1 u′ = i=1 (5.1) ≈  j−1 Y i=1 i=j+2   Y  m (pi hi ) x2 y 2 (pi hi ) x2 x · x2 hj+1 i=j+2 MONOID VARIETIES WITH EXTREME PROPERTIES  j−1 Y λ ≈ i=1 (5.1) ≈  j−1 Y i=1 23    Y m (pi hi ) x2 x · x2 hj+1 (pi hi ) y 2 x2 i=j+2   Y  m (pi hi ) y 2 x2 = v′ , (pi hi ) pj+1 hj+1 i=j+2 the deduction (5.1) ∪ {λ} ⊢ λ′ holds. The deduction (5.1) ∪ {λ′ } ⊢ λ is easily established. Therefore E1 {λ} = E1 {λ′ }. Hence whenever the ith blocks and the (i + 1)st blocks of the words u and v are equal, then the ith blocks can be removed and the resulting identity will still define the same subvariety E1 {λ} of E1 . Consequently, it can be assumed that no two consecutive p1 , p2 , . . . , pm ∈ {x2 , y 2 } are equal. The identity λ is thus σn for some finite n. Case 2. pj ∈ {x2 y 2 , y 2 x2 } for some j. By symmetry, assume that pj = x2 y 2 . Since (5.1) x2 y 2 · u[hm , x, y] ≈ x2 y 2 hm x2 y 2 (5.1) and x2 y 2 · v[hm , x, y] ≈ x2 y 2 hm y 2 x2 , the deduction (5.1) ∪ {λ} ⊢ σ∞ holds. The deduction (5.1) ∪ {σ∞ } ⊢ λ is easily verified. Therefore E1 {λ} = E1 {σ∞ }.  5.4. The lattice L(E1 ). By Propositions 5.1, 5.5, and 5.6, the lattice L(E1 ) is given in Figure 4. E1 r r E1 {σ∞ } .. . r E1 {σ3 } r E1 {σ2 } L12 ∨ B10 L12 r E1 {σ1 } = L12 ∨ Q1 ❅ ❅r Q1 r ❅ 1 ∨ M{x} r ❅r B0 ❅ ❅ r ❅r J1 ❅ 1 I ❅ ❅r L12 r M{xy} ❅ ❅ r M{x} ❅ ❅r M∅ r 0 Figure 4. The lattice L(E1 ) Proposition 5.11. (i) The variety E1 is hereditarily finitely based. (ii) Every proper subvariety of E1 {σ∞ } is Cross. (iii) The variety E1 {σ∞ } is the only nonfinitely generated subvariety of E1 . 24 M. JACKSON AND E. W. H. LEE Proof. (i) This follows from Lemma 5.3(i) and Propositions 2.6 and 5.6. (ii) Let V be any proper subvariety of E1 {σ∞ }. Then the variety V is finitely based and small by part (i) and Figure 4, respectively. Further, V is locally finite because the variety E1 is finitely generated. Since all locally finite, small varieties are finitely generated by W Lemma 2.1, the variety V is also finitely generated. (iii) Since E1 {σ∞ } = i≥1 E1 {σi }, the variety E1 {σ∞ } is nonfinitely generated by Lemma 2.1. The result then follows from part (ii).  6. Other extreme properties and open questions 6.1. Minimal examples. Recall that the monoids A12 and B21 generate monoid varieties of type 2ℵ0 and the monoid E 1 generates a monoid variety of type ℵ0 . Since these monoids are of order six, it is natural to question if there exists a monoid of order less than six that generates a monoid variety of type 2ℵ0 or type ℵ0 . By Lemma 3.7, the monoid P21 of order five is the only example. Question 6.1. Is the monoid variety Vmon {P21 } of type 2ℵ0 or type ℵ0 ? Regardless of the answer to this question, P21 is the unique minimal monoid that generates a monoid variety of either type 2ℵ0 or type ℵ0 ; in the former case, E 1 is a minimal monoid that generates a monoid variety of type ℵ0 , while in the latter case, A12 and B21 are minimal monoids that generate monoid varieties of type 2ℵ0 . Kad’ourek [19] has exhibited an inverse semigroup of order 165 that generates an inverse semigroup variety of type 2ℵ0 . The smallest possible order of such an inverse semigroup is also of interest. 6.2. Finitely universal varieties. Following Shevrin et al. [44], a variety V is finitely universal if every finite lattice is order-embeddable into L(V). Vernikov and Volkov [48] proved that the semigroup variety H defined by the identity (6.1) x2 ≈ yxy is finitely universal. It is easily shown that any identity formed by a pair of nonsimple words is deducible from (6.1). Therefore a semigroup variety contains H, and so is finitely universal, if it possesses a basis of identities formed by nonsimple words. Due to this, many finite semigroups generate finitely universal varieties. For instance, the semigroups (6.2) A0 , A2 , B0 , B2 , E, I 1 , J 1 , P21 , and Q that appeared in this article generate finitely universal semigroup varieties; the semigroups A0 , B0 , I 1 , and J 1 of order four, in particular, are examples of minimal order [21]. A finitely universal variety is necessarily nonsmall, but it need not be of type 2ℵ0 either; for instance, the varieties generated by most of the semigroups in (6.2) are known to be hereditarily finitely based [25] and so of type ℵ0 . Similar to the extreme properties considered earlier in the present article, the situation changes drastically when monoid varieties are considered instead of semigroup varieties. Presently, no explicit example of finitely universal monoid variety, finitely generated or otherwise, is known. Since any monoid that satisfies the identity (6.1) is trivial, the variety H does not come close to providing an example. One might conjecture that the monoid variety H1 = Vmon {S 1 | S ∈ H} MONOID VARIETIES WITH EXTREME PROPERTIES 25 generated by monoids obtained from semigroups in H is finitely universal, but the following result demonstrates that it is also futile. Proposition 6.2. The monoid variety H1 contains four subvarieties. Proof. It is shown that H1 = M{xy}. The result then follows from Figure 1 since the monoid variety M{xy} contains four subvarieties. It is easily shown that the subsemigroup S = M{xy}\{1} of M{xy} satisfies the identity (6.1) so that S ∈ H. It follows that M{xy} = Vmon {S 1 } ⊆ H1 . Conversely, the identities in Γ = {x3 ≈ x2 , xyx ≈ x2 y, xyx ≈ yx2 } constitute a basis for the each identity in Γ is variety Vsem M{xy} ; see Jackson [13, Lemma 4.5(ii)]. Since  formed by a pair of nonsimple words, the inclusion H ⊆ Vsem M{xy} holds. By Lemma 2.2, the inclusion H1 ⊆ M{xy} also holds.  Question 6.3. Do finitely universal monoid varieties exist? 6.3. Cardinalities and independent systems. To show that a variety V has continuum many subvarieties, the following method is employed: a system Σ of identities extending the equational theory of V is identified and shown to be independent in the sense that each subset of Σ defines a distinct subvariety of V. As far as the authors are aware, all known examples of varieties with uncountably many subvarieties have independent identity systems in this manner; see, for example, Dolinka [4], Jackson [10, 12], Jackson and McKenzie [15], Ježek [17], Kad’ourek [18], Oates-Williams [37], Skokov and Vernikov [45], Trahtman [46], Vaughan-Lee [47], and Zhang and Luo [50]. The following questions seem to be of interest for general varieties, but also under imposed restrictions such as “semigroup”, “locally finite” or “finitely generated”. Question 6.4. (i) Does every variety with uncountably many subvarieties have an independent system extending its equational theory? (ii) Does the subvariety lattice of every variety have cardinality either 2ℵ0 or at most ℵ0 ? (This is trivial unless 2ℵ0 6= ℵ1 is assumed.) Note that the dual of any algebraic lattice with countably many compact elements arises as an interval in some subvariety lattice [17, Theorem 3]. Acknowledgment The authors thank the reviewer for a number of suggestions and for bringing Question 4.2 to their attention. References 1. J. Almeida, Finite Semigroups and Universal Algebra, World Scientific, Singapore, 1994. MR1331143 2. A. P. Birjukov, Varieties of idempotent semigroups, Algebra and Logic 9 (1970), no. 3, 153– 164, DOI 10.1007/BF02218673. Translation of Algebra i Logika 9 (1970), no. 3, 255–273. MR0297897 3. S. Burris and H. P. Sankappanavar, A Course in Universal Algebra, Springer Verlag, New York, 1981. MR0648287 4. I. Dolinka, An uncountable interval in the lattice of semiring varieties, Acta Sci. Math. (Szeged) 74 (2008), no. 1–2, 85–93. MR2431092 5. T. Evans, The lattice of semigroup varieties, Semigroup Forum 2 (1971), no. 1, 1–43, DOI 10.1007/BF02572269. MR0284528 26 M. JACKSON AND E. W. H. LEE 6. C. C. Edmunds, E. W. H. Lee, and K. W. K. Lee, Small semigroups generating varieties with continuum many subvarieties, Order 27 (2010), no. 1, 83–100, DOI 10.1007/s11083-010-91428. MR2601157 7. C. F. Fennemore, All varieties of bands. I, II, Math. Nachr. 48 (1971), no. 1–6, 237–252; ibid., 253–262, DOI 10.1002/mana.19710480118. MR0294535 8. J. A. Gerhard, The lattice of equational classes of idempotent semigroups, J. Algebra 15 (1970), no. 2, 195–224, DOI 10.1016/0021-8693(70)90073-6. MR0263953 9. T. J. Head, The varieties of commutative monoids, Nieuw Arch. Wisk. (3) 16 (1968), 203–206. MR0237696 10. M. Jackson, Finite semigroups whose varieties have uncountably many subvarieties, J. Algebra 228 (2000), no. 2, 512–535, DOI 10.1006/jabr.1999.8280. MR1764577 11. M. Jackson, On the finite basis problem for finite Rees quotients of free monoids, Acta Sci. Math. (Szeged) 67 (2001), no. 1–2, 121–159. MR1830137 12. M. Jackson, Finite semigroups with infinite irredundant identity bases, Internat. J. Algebra Comput. 15 (2005), no. 3, 405–422, DOI 10.1142/S0218196705002335. MR2151419 13. M. Jackson, Finiteness properties of varieties and the restriction to finite algebras, Semigroup Forum 70 (2005), no. 2, 159–187, DOI 10.1007/s00233-004-0161-x. MR2129773 14. M. Jackson, Syntactic semigroups and the finite basis problem, in: Structural Theory of Automata, Semigroups, and Universal Algebra, NATO Sci. Ser. II Math. Phys. Chem., vol. 207, Springer, Dordrecht, 2005, pp. 159–167, DOI 10.1007/1-4020-3817-8 6. MR2210129 15. M. Jackson and R. McKenzie, Interpreting graph colorability in finite semigroups, Internat. J. Algebra Comput. 16 (2006), no. 1, 119–140, DOI 10.1142/S0218196706002846. MR2217645 16. M. Jackson and O. Sapir, Finitely based, finite sets of words, Internat. J. Algebra Comput. 10 (2000), no. 6, 683–708, DOI 10.1142/S0218196700000327. MR1809378 17. J. Ježek, Intervals in the lattice of varieties, Algebra Universalis 6 (1976), no. 2, 147–158, DOI 10.1007/BF02485826. MR0419332 18. J. Kad’ourek, Uncountably many varieties of semigroups satisfying x2 y ≏ xy, Semigroup Forum 60 (2000), no. 1, 135–152, DOI 10.1007/s002330010007. MR1829935 19. J. Kad’ourek, A finitely generated variety of combinatorial inverse semigroups having uncountably many subvarieties, Proc. Roy. Soc. Edinburgh Sect. A 132 (2002), no. 6, 1373–1394, DOI 10.1017/S0308210500002158. MR1950812 20. E. W. H. Lee, Subvarieties of the variety generated by the five-element Brandt semigroup, Internat. J. Algebra Comput. 16 (2006), no. 2, 417–441, DOI 10.1142/S0218196706002998. MR2228521 21. E. W. H. Lee, Minimal semigroups generating varieties with complex subvariety lattices, Internat. J. Algebra Comput. 17 (2007), no. 8, 1553–1572, DOI 10.1142/S0218196707004189. MR2378051 22. E. W. H. Lee, Combinatorial Rees–Sushkevich varieties that are Cross, finitely generated, or small, Bull. Aust. Math. Soc. 81 (2010), no. 1, 64–84, DOI 10.1017/S0004972709000616. MR2584924 23. E. W. H. Lee, Cross varieties of aperiodic monoids with central idempotents, Port. Math. 68 (2011), no. 4, 425–429, DOI 10.4171/PM/1900. MR2854133 24. E. W. H. Lee, Varieties generated by 2-testable monoids, Studia Sci. Math. Hungar. 49 (2012), no. 3, 366–389, DOI 10.1556/SScMath.49.2012.3.1211. MR3099233 25. E. W. H. Lee, Finite basis problem for semigroups of order five or less: generalization and revisitation, Studia Logica 101 (2013), no. 1, 95–115, DOI 10.1007/s11225-012-9369-z. MR3019333 26. E. W. H. Lee, Inherently non-finitely generated varieties of aperiodic monoids with central idempotents, J. Math. Sci. (N. Y.) 209 (2015), no. 4, 588–599; reprint of Zap. Nauchn. Sem. S.-Peterburg. Otdel. Mat. Inst. Steklov. (POMI) 423 (2014), Voprosy Teorii Predstavlenii Algebr i Grupp. 26, 166–182, DOI 10.1007/s10958-015-2515-1. MR3480696 27. E. W. H. Lee, On certain Cross varieties of aperiodic monoids with commuting idempotents, Results Math. 66 (2014), no. 3–4, 491–510, DOI 10.1007/s00025-014-0390-6. MR3272641 28. E. W. H. Lee and J. R. Li, Minimal non-finitely based monoids, Dissertationes Math. (Rozprawy Mat.) 475 (2011), 65 pp, DOI 10.4064/dm475-0-1. MR2663812 29. E. W. H. Lee and J. R. Li, The variety generated by all monoids of order four is finitely based, Glas. Mat. Ser. III 50 (2015), no. 2, 373–396, DOI 10.3336/gm.50.2.08. MR3437496 MONOID VARIETIES WITH EXTREME PROPERTIES 27 30. E. W. H. Lee, J. R. Li and W. T. Zhang, Minimal non-finitely based semigroups, Semigroup Forum 85 (2012), no. 3, 577–580, DOI 10.1007/s00233-012-9434-y. MR3001603 31. E. W. H. Lee and M. V. Volkov, Limit varieties generated by completely 0-simple semigroups, Internat. J. Algebra. Comput. 21 (2011), no. 1–2, 257–294, DOI 10.1142/S0218196711006169. MR2787461 32. E. W. H. Lee and W. T. Zhang, The smallest monoid that generates a non-Cross variety, Xiamen Daxue Xuebao Ziran Kexue Ban 53 (2014), no. 1, 1–4 (in Chinese). MR3222278 33. Y. F. Luo and W. T. Zhang, On the variety generated by all semigroups of order three, J. Algebra 334 (2011), 1–30, DOI 10.1016/j.jalgebra.2011.02.037. MR2787650 34. A. I. Mal’cev, Algebraic Systems, Springer-Verlag, New York, 1973. Translation of Algebraicheskie Sistemy, Nauka, Moscow, 1970. MR0282908 35. S. Oates and M. B. Powell, Identical relations in finite groups, J. Algebra 1 (1964), no. 1, 11–39, DOI 10.1016/0021-8693(64)90004-3. MR0161904 36. S. Oates-MacDonald and M. R. Vaughan-Lee, Varieties that make one Cross, J. Austral. Math. Soc. Ser. A 26 (1978), 368–382, DOI 10.1017/S1446788700011897. MR0515754 37. S. Oates-Williams, On the variety generated by Murskiı̆’s algebra, Algebra Universalis 18 (1984), no. 2, 175–177, DOI 10.1007/BF01198526. MR0743465 38. P. Perkins, Bases for equational theories of semigroups, J. Algebra 11 (1969), no. 2, 298–314, DOI 10.1016/0021-8693(69)90058-1. MR0233911 39. M. V. Sapir, Inherently non-finitely based finite semigroups, Math. USSR-Sb. 61 (1988), no. 1, 155–166, DOI 10.1070/SM1988v061n01ABEH003199. Translation of Mat. Sb. (N.S.) 133 (1987), no. 2, 154–166. MR0905002 40. M. V. Sapir, Problems of Burnside type and the finite basis property in varieties of semigroups, Math. USSR-Izv. 30 (1988), no. 2, 295–314, DOI 10.1070/IM1988v030n02ABEH001012. Translation of Izv. Akad. Nauk SSSR Ser. Mat. 51 (1987), no. 2, 319–340. MR0897000 41. M. V. Sapir, Combinatorial Algebra: Syntax and Semantics, Springer Monographs in Mathematics, Springer, Cham, 2014, DOI 10.1007/978-3-319-08031-4. MR3243545 42. O. Sapir, Finitely based words, Internat. J. Algebra Comput. 10 (2000), no. 4, 457–480, DOI 10.1142/S0218196700000224. MR1776051 43. O. Sapir, Non-finitely based monoids, Semigroup Forum 90 (2015), no. 3, 557–586, DOI 10.1007/s00233-015-9708-2. MR3345943 44. L. N. Shevrin, B. M. Vernikov, and M. V. Volkov, Lattices of semigroup varieties, Russian Math. (Iz. VUZ) 53 (2009), no. 3, 1–28, DOI 10.3103/S1066369X09030013. Translation of Izv. Vyssh. Uchebn. Zaved. Mat. 2009, no. 3, 3–37. MR2581451 45. D. V. Skokov and B. M. Vernikov, Chains and anti-chains in the lattice of epigroup varieties, Semigroup Forum 80 (2010), no. 2, 341–345, DOI 10.1007/s00233-009-9196-3. MR2601769 46. A. N. Trahtman, A six-element semigroup that generates a variety with a continuum of subvarieties, Ural. Gos. Univ. Mat. Zap. 14 (1988), no. 3, Algebr. Sistemy i ikh Mnogoobr., 138–143 (in Russian). MR0958333 47. M. R. Vaughan-Lee, Uncountably many varieties of groups, Bull. London Math. Soc. 2 (1970), no. 3, 280–286, DOI 10.1112/blms/2.3.280. MR0276307 48. B. M. Vernikov and M. V. Volkov, Lattices of nilpotent varieties of semigroups. II, Izv. Ural. Gos. Univ. Mat. Mekh. 1(10) (1998), 13–33 (in Russian). MR1784293 49. M. V. Volkov, Reflexive relations, extensive transformations and piecewise testable languages of a given height, Internat. J. Algebra Comput. 14 (2004), no. 5–6, 817–827, DOI 10.1142/S0218196704002018. MR2104784 50. W. T. Zhang and Y. F. Luo, The variety generated by a certain transformation monoid, Internat. J. Algebra Comput. 18 (2008), no. 7, 1193–1201, DOI 10.1142/S0218196708004810. MR2468743 Department of Mathematics and Statistics, La Trobe University, Victoria 3086, Australia E-mail address: [email protected] Department of Mathematics, Nova Southeastern University, Florida 33314, USA E-mail address: [email protected]
4math.GR
arXiv:1609.03146v1 [cs.PL] 11 Sep 2016 Honey: A dataflow programming language for the processing, featurization and analysis of multivariate, asynchronous and non-uniformly sampled scalar symbolic time sequences Mathieu Guillame-Bert School of Computer Science Pittsburgh, United States [email protected] September 13, 2016 Abstract We introduce HONEY; a new specialized programming language designed to facilitate the processing of multivariate, asynchronous and non-uniformly sampled symbolic and scalar time sequences. When compiled, a Honey program is transformed into a static process flow diagram, which is then executed by a virtual machine. Honey’s most notable features are: (1) Honey introduces a new, efficient and non-prone to error paradigm for defining recursive process flow diagrams from text input with the mindset of imperative programming. Honey’s specialized, high level and concise syntax allows fast and easy writing, reading and maintenance of complex processing of large scalar symbolic time sequence datasets. (2) Honey guarantees programs will be executed similarly on static or real-time streaming datasets. (3) Honey’s IDE includes an interactive visualization tool which allows for an interactive exploration of the intermediate and final outputs. This combination enables fast incremental prototyping, debugging, monitoring and maintenance of complex programs. (4) In case of large datasets (larger than the available memory), Honey programs can be executed to process input greedily. (5) The graphical structure of a compiled program provides several desirable properties, including distributed and/or paralleled execution, memory optimization, and program structure visualization. (6) Honey contains a large library of both common and novel operators developed through various research projects. An open source C++ implementation of Honey as well as the Honey IDE and the interactive data visualizer are publicly available. 1 1 Introduction Time series (TS; sequence of uniformly sampled numerical measurements) is a popular representation for storing and processing series of observations acquired from dynamical systems (e.g. weather forecasting, economic analysis, financial forecasting, quality control, signal processing, control, monitoring). TS are constructed by periodically recording the output of a sensor. Time series from real world applications are often too large to be processed or analyzed manually by users, and each research and engineering community using time series have developed specialized algorithms, methods and software to process, analyze and interpret their time series.While some methods have been found to be useful on multiple domains, most of time series processing remains largely done with specialized domain specific (and often expensive) tools with domain specific formats, embedded expert knowledge and domain specific interpretation frameworks. Despite being popular, time series are not universally suited for the study of dynamical systems. For example, times series cannot represent directly time-point events, intervals, non-uniform sampling, or asynchronous multi-variate records. In this paper, we use a normalized extension of times series called Symbolic and Scalar Time Sequences (SSTS). SSTS allows the representation of multivariate, asynchronous and non-uniformly sampled symbolic and scalar records (see definition in section 2). As an example, an SSTS can represents multiple non-synchronized non-uniformly sampled times series with gaps, specific change points, time segmentation information, continuous recording and time-point events. All time series operators (e.g. moving average) can be extended, and sometimes augmented into the SSTS framework: For example, the moving average of a time series T is a new time series T 0 with Ti0 defined Pi as the mean of the last n observations i.e. Ti0 = j=i−n+1 Tj /n. Instead, the moving average of an SSTS can be either defined as the average of the last n observations (similarly as for time series), or as the average of all the observations in the tailing window of length m temporal units. Because of its freedom of expression, processing SSTS is often more complex than processing time series: While many operations on time series can be done with a single “for loop” or common matrix operations; the same operations on SSTS require more complex implementations, mostly because of the non-uniform sampling and non-synchronicity of the channels. In this paper, we introduce a specialized programming language for the purpose of processing SSTS (and therefore time series). This language, called Honey, relies on a new paradigm designed to create process flow diagrams from imperative programming like input. Honey aims to provide a powerful tool for data analysts, researchers and engineers on the tasks of temporal data exploration, data cleaning, data feature extraction, retrospective data analysis, real-time monitoring, process prototyping and development. Honey’s high level, specialized and concise syntax allows for efficient writing, reading and maintenance of complex programs. In addition, Honey is associated with a continuously growing library of operators developed over several years of work on various applied research projects. The library of operators includes various moving statistics (e.g. moving average, moving standard deviation, moving range), control charts, frequency analysis, filtering, correlation operators, temporal landmark testing, forecasting analysis, feature selections, feature reductions, pattern matching and machine learning algorithms. Honey aims to be both easy to use and efficient to 2 execute (execution time and memory consumption wise). Honey can be used in a standalone fashion, or it can be integrated into larger projects though its API. Finally, a Honey program can seamlessly be executed on a static dataset or a real-time stream of data. This feature allows Honey user to develop and test programs on static records, and then, to easily execute them directly on real-time applications. Since its first version in 2011, Honey has been used to support research in wide variety of domains (including various medical domains, banking activity analysis, crowd behavioral analysis, human activity forecasting, social interaction analysis, vehicle maintenance monitoring, market trading, market monitoring, and various robotic projects) both for post-hoc and real-time analyses. This manuscript contains an introduction to the Honey’s paradigm, syntax and semantic. It also features four complete and illustrated real-world data analytic exercises solved with Honey. This manuscript does not aim to be exhaustive, and many important aspects of the language are not covered, including batch processing, file formats, available operators, and interactive output visualization and exploration. Instead, this document is complementary with the Honey documentation and tutorial available online [2]. This paper is structured as follows: Section 2 describes the Symbolic and Scalar Time Sequences representation. The section 3 discusses related works. Section 4 presents and explains a small “Hello world” Honey program. Section 5 introduces the Honey programming language syntax and semantics. Section 6 shows and discusses four examples of Honey programs. These examples aim to illustrate typical usage of Honey. In section 7, we discuss the reason for Honey’s development, the way it has been used over the last years, the reason of its current shape, and its relation to alternative analytic solutions. Section 8 concludes this manuscript. 2 Symbolic and Scalar Time Sequences A Symbolic and Scalar Time Sequence (SSTS) is representation that extents Time Series. A SSTS is composed of a set of channels. Each channel is composed of a symbol (i.e. a name) and a set of records. A record is composed of a time-stamp and (optionally) a value. A time-stamp is a representation of time encoded as a double precision floating-point number. Honey does not make assumptions on the unit of the time representation (it can be days, years, seconds, microseconds, indexes, etc.). The value is a floating-point number representing a measurement (e.g. a temperature). The figure 1 shows an illustration of an SSTS. In this figure, while being plotted differently, channels “channel 1” and “channel 3” are both SSTS channels (channel 1 is plotted with “bars”, and channel 3 is plotted with “stairs”). Honey does not make assumptions about the continuity of the sampling or the nature of the channels: A channel can be a continuous recording, a time segmentation, time-point events, etc. Scalar channels contain continuous (or repetitive) measurements. By convention, the value of a scalar channel at time t is the value of the latest record non-strictly anterior to t. Event channels contain event or change-point records. SSTS represents scalar and event channels indistinctly, but the documentation of several Honey operators rely on this scalar/event conversion. A same channel can be treated as scalar by an operator 3 an SSTS a channel a record channel 1 channel 2 channel 3 time Figure 1: Illustration of an SSTS. and as an event by another one. By definition, a time series is a single scalar channel with uniform sampling. Honey main input format is the .evt file. Each line of an .evt file defines a single record. Honey also supports .csv files where each line defines a record for all channels at a given time. This implies that .csv files can only define synchronized scalar channels (unless if using “NA” (non-available) values). Both .evt and .csv files can be streamed over telnet-like connections to and from Honey. Honey supports several other formats including an optimized binary version of .evt files. 3 Related work Programming languages are used to define computation processes (also called programs) while avoiding or abstracting low level hardware interaction (e.g. assembly, electronic design). Except for very specific problems, today, most program writing is done by the intermediate of a programming language. The popularity of programming languages can be explained by the increase of the power and capacities of computer hardware’s, the increase of complexity of programs, and the improvement of compilers and programming languages. Programming languages provide many desirable features for users, including paradigm abstractions, reduction of the propensity of errors, compact representation, inter-systems portability, code analysis and error checking. The majority of programming languages are Turing Complete, and all have the ability to solve the same class of problems. However, each programming language exhibits different features which make it adapted for more or less specific classes of problems. Therefore, the choice of a programming language is generally defined by the task to be solved as well as by the industry domain standard: For example, C is adapted for high performance low level system programming, R is good for small scale data analysis, Prolog is suited for combinatory exploration tasks, and Ada is designed for critical systems. The “specialization” of a programming language refers to the range of problems that can be solved easily. As an example, C, C++, Java, Python and FORTRAN are considered to be “general” programming languages, while Html+Css, Latex, Sql, UnrealScript, MT4, ChucK and Verilog are considered to be specialized programming languages. Specialized program4 ming languages are generally significantly easier to use and more efficient to solve their target task than would be a more general programming language. In this paper, we are presenting a specialized programming language designed to process SSTSs and other equivalent temporal records. And while, any other Turing complete languages could be used instead, we demonstrate the efficiency and simplicity of use of our language for this task. The following paragraph lists software solutions for processing and analyzing temporal databases: When handling high volume of data, users often use general high efficiency programming languages (e.g. C, C++, and FORTRAN), adapted architectures and hardware, and specialized libraries (also written with high efficiency programming languages). In the case of smaller problems and for fast prototyping, specialized numerical scientific programming languages are generally more suited (e.g. R, MatLab, SciLab, Octave, Mathematica and Maple). Many such languages have large active communities that develop and maintain specialized scientific libraries. Database programming languages (e.g. Sql, Clarion and DBase) are specialized programming language for querying and modifying databases. They are often used conjointly with another more general programming language. While most programming languages are text based, various other representations have been explored. For example, visual programming relies on the drawing or arrangement of graphical elements to define programs. Graph programming refers to the family of graphical languages relying on the definition of a graph (i.e. a set of nodes connected by edges). Graph programming is generally considered easier to learn than text base programming language. However, graph programs can be slow to execute (in case of fine grain programming), hard to maintain on large programs, and specialized for certain tasks. Graph programming language is mainly divided into two families: Logic Flow and Data Flow programming languages. In a logic flow programming language, nodes represent states of the program, and edges represent the transitions between states. Logic flow programming languages are used for logic controller (Sequential function chart, Function block diagram), game development (Unreal Engine, Gamemaker) and general sequential control (DRAKON, Scratch and Flowgorithm). Instead, in a Data Flow programming languages, nodes represent individual processes (called agents), and edges represent the connection between the outputs of a process to the inputs of the next ones. Pieces of information called tokens travel trough the network and are processed by each node they encounter. Data Flow programming languages are popular in media processing (Pure Data, Max, 3ds Max Material, Blender Shading Composer), machine learning (Weka, Orange, RapidMiner), signal processing (System Studio, SPW, Simulink) and architecture definition (VHDL). Data flow computation modeling refers to the study of hardwares or softwares implementation of Data Flow programming languages. Several models have been studied with different constraints, guarantees, speed, robustness and ease of use in the industry. A popular version has been studied by Kahn [5]. [7] and [8] provide introductions and a state-of-the-art review of the Data flow research. Data Flow models are particularly adapted for parallel or distributed computing: Each node (or agent) works independently from the rest of the network except from its parents and children (in some models). However, this property has a cost: Programs need to be adapted to flow processing, and the synchronicity between nodes can be a significant part of the com5 echo #.* sma 0.5 save Figure 2: Flow graph of the Hello World program. putation work. Various text base programming languages have been studied to define data flows (Lustre [3], Signal [6]). 4 “Hello World” Before presenting the Honey syntax and semantics, we show a simple example of a Honey program. This program takes as input a SSTS, and computes a 0.1 time unit tailing moving average (sometime called simple tailing moving average) independently on all the channels. The program outputs both the input records and the results of the moving average. We suppose the input dataset to be provided in the file dataset.evt, and the resulting SSTS is written in the file result.evt. The following listing shows the source code of the program. 1 2 3 4 5 @data input:”dataset.evt” output:”result.evt” $all = echo #.∗ $res = sma $all 0.1 $res += echo $all save $res file:%output Each line is explained in the following listing: 1. Specify the input and output of the program. Several input/outputs can be specified. The input and output of a program can also be specified outside of the program. 2. Set the channel variable $all to contain all the currently available channels (i.e. the input channels). Most Honey programs start with this statement. 3. Apply a simple tailing moving average independently on all the channels contained in the variable $all. The resulting channels are put into the $res variable. The name of the resulting channels are automatically generated: The names of the result on input channel “channel1” will be “channel1 sma[0.1]”. Input channels are not assumed to be synchronized. 4. Append all the input channels to the $res variable: The output dataset will also contain the original data. 5. Export all the channels from the variable $res into the specified output file. This output file contains both the raw data and the result of the moving average. Figure 2 shows the process flow diagram obtained from this program after having been compiled. In this example, the “channel variable” $all and $res behave similarly as variables in imperative programming languages (e.g. C, Python, Fortran). For example, the channel variable $res refers to two different objects at lines 3 and 4. $res defines two different edges between operations in the final process flow diagram. It is important to notice that while pipes in the final process flow diagram are not ordered (by definition), the order of the statements with channels variables is important: 6 Art Art_sma[0.1] CVP CVP_sma[0.1] EKG EKG_sma[0.1] time Figure 3: Output of the hello world program on a small medical dataset containing high frequency records of various vital signs. The input channels are drawn with solid plots. The resulting channels (simple moving average) are drawn with dashed plots. Reversing lines 3 and 4 in the listing would define a different program. When a Honey program is executed on a dataset (in streaming execution mode – see section 5.4), operations are all executed in parallel, continuously processing inputs and generating outputs for the next ones. Each operator manages its own internal state and stored data. In our example, because the moving average operator requires keeping a record of all the elements in the current window, this ensures that when executed, the program keeps at most 0.1 time units of the each channel records’ in memory at any time, independently of the size of the input dataset. This example illustrates Honey’s paradigm: Using imperative programming mindset to define process flow diagrams. The figure 3 shows the result of this program on a medical dataset. This dataset is a 1.5 second snap-shot of various physiologic vital sign (CVP, ECG and Arterial pressure) recorded at a frequency of 250Hz. 5 The Honey language In this section, we introduce the Honey programming language. The next sub-section presents the syntax and semantic of the Honey programming language. The reader is assumed to be familiar with imperative programming. The following sub-sections presents specific aspects of the language (operators, equations, execution, user defined operator and recursions). 5.1 Syntax and semantics The source code of a Honey program is a plain text file. Each line of this file is one of the following items. For each item, we provide one or several examples. 7 • A comment line if the first non-white-space character of the line is #. Comment lines are ignored by the compiler. # This is a commentary • A configuration statement if the first character of the line is @. Configuration statements define how a program should be executed. The order and the location of the configuration statements has no importance in the source code. Configuration statements are optional and can be replaced with options on the Honey command line call when running a program. @data input:”dataset.evt” output:”result.evt • An operator statement defines a single operator. A operator statement is composed of a operator name followed by arguments. sma $b 5 trigger:$c Each operator requires specific arguments as defined in the documentation. Arguments can be anonymous or named, optional or required. In the previous example, the first two arguments of sma are two anonymous and required arguments, while the trigger argument is an optional and named argument. Some operators do not require any arguments (e.g. a regular ticking generator operator) while some others do not have any outputs (e.g. an file exporter operator). Optionally, a statement can specify a variable to receive the output (set of channels) with “=”. $a = sma $b 5 trigger:$c The output of an operator can also be merged with the content of an already existing variable with “+=”. $a += sma $b 5 trigger:$c echo is a special operator that simply repeats signals. echo is generally used to organize flows. When used with non-recursive signal variables, echo can be “removed”: The two following lines are generally equivalent: $b += echo $a $b += $a • The beginning or the end of a user defined operator/function. function doSomething $a %b ... endfunction • A call to a user defined operator. call doSomething $all 5 • An inclusion of another Honey program. include ”library.hny” • A definition of a non-channel variable. A non-channel variable can contains a number or a string. set %a ”Hello World” set %b 1024 • A “if” statement on non-channel condition. if statements are evaluated during the compilation, and they are use to control the structure of the resulting flow 8 diagram. if =%i,0,$>$ ... endif A if statement cannot apply a condition on the contents of a channel. Instead, specialized operators should be used for any conditional processing of records according to their value or according to other channel values. • The beginning and the end of a group. Groups provides a visual enhancement when plotting the process flow diagram or when analyzing program execution. They have no impact on the result values. group ”Computation of XYZ” ... endgroup ”Computation of XYZ” • The specification for a channel variable to be recursive (see section 5.6). Recursive channel variables behave differently than non-recursive channel variables. Recursive variables are powerful but prone to coding error. For this reason, variables are by default non-recursive. recursive $a • The specification for a variable inside of a user defined operator to be global. Global variables have a full scope over the entire program. global $a When compiled, a Honey program is converted into a process flow diagram. Operators in the Honey source code will define operators in the flow diagram, and channel variables in the Honey source code will define edges/pipes in the process flow diagram. A single channel variable can define multiple pipes, and a single operator in the source code can define multiple operators in the process flow diagram. For this reason, the source code of a Honey is often more compact and easier to understand that the resulting process flow diagram. 5.2 Convention on operators Honey aims for programs to work similarly on static and real-time streaming datasets. For this reason, and for most of Honey operators, an operator’s output value at time t can only be derived from input records anterior to time t. For example, the sma operator (simple moving average) computes a tailing moving average: The output at time t is the average of the record values between times t − w and t (with w the window length parameter of the sma operator). In case of analysis were posterior data are necessary (e.g. retrospective analysis), users can use the special echoPast operator. This operator does not follow the tailing rule: EchoPast “sends” records into the past i.e. a records at time t will be sent at time t − w with w the echoPast parameter. EchoPast can be used conjointly with other operators to defined non-tailing behaviors. The following example shows a centered moving average using the echoPast operator. 1 2 @data input:”dataset.evt” output:”result.evt” $all = echo #.∗ 9 3 4 5 $all = echoPast $all 5 $res = sma $all 10 save $res file:%output Launching a Honey program with an echoPast operator on an real-time dataset will raise an error. 5.3 Equations Honey supports three types of equations: Equations on records (e.g. the eq operator), equations on non-signal numerical values (starting with =), and equations on non-signal textual values (starting with &). Honey equation statement should be written in Reverse Polish notation (RPN) (e.g. “=2,3,+,2,*” = (2 + 3) × 2 = 10 ). The following statement shows an example of equation on records. This statement takes the channels in $a, and multiplies their values by 3 (i.e. if an input record at time t has the value v, an output record will be create at time t and with value 3 × v): $b = eq $a ”value,3,∗” The following statement is an example of equation on numerical non-channel variables. It computes a 10 time units moving average: $b = sma $a =2,3,+,2,∗ The following statement is an example of equation on string non-channel variables. It renames a channel to “The little cat”: $b = rename $a ”&The ,little ,+,cat,+” 5.4 Execution modes Honey supports three modes of executions: • The real-time execution mode processes real-time stream of records from realtime input Honey connectors (e.g. telnet+evt, keyboard, calendar). Time is assumed to be the double precision floating-point Unix epoch time (i.e. the number of seconds since Thu, 01 Jan 1970 00:00:00 GMT). Input and intermediate records are kept in memory until the program knows they won’t be used anymore. For example, if a program computes of a moving average with a window length of 10 seconds, only the records in the last 10s will be kept in the dedicated memory of the moving average operator. • The streaming execution mode processes a static dataset (e.g. a dataset contained in a file on your hard-drive) in the same way as the real-time execution mode. The input dataset is parsed record by record (e.g. line by line in the case of .csv or .evt files). This mode generally ensures for the program execution to have a small memory footprint with the consequence that it is slower than the static section mode (see below). • The static execution mode computes the results of each operator, one at a time in a topological order. Because operator’s computation can often be significantly optimized when all the data is available at once, and because the communication between operators can be a significant overhead, this mode is significantly faster than the streaming execution mode. However, since entire datasets (or segments 10 of datasets in case of batched processing) need to be loaded in memory, this mode requires more memory than the streaming execution mode. In our current Honey implementation, static execution mode does not support recursive programs because a recursive loop in a data flow program requires all the operators of the loop to be executed simultaneously. However, future Honey version will be able to execute recursive programs in hybrid static execution mode by processing individual recursive components in streaming mode while processing the overage program in static execution mode. In practice, since the process flow diagram is static (i.e. a process flow diagram does not change during the execution), Honey can improve the global memory consumption of a program: Operator results are released from memory as soon as Honey detects they will not be used anymore by any other operators. In case of batching execution (processing of several independent datasets), the static mode will ensure that only one batch of data is loaded in memory at any time. The next two paragraphs illustrate the step by step execution of a program in streaming and static execution modes. 1 2 3 4 5 6 @data input:”dataset.csv” output:”result.evt” $a = echo #.∗ $b = tma $a 2 $c = sma $b 2 $a += ema $b 2 save $a file:%output The content of dataset.csv is shown below. This dataset contains a single channel “toto” with three records at times 1, 2 and 5. time;toto 1;1.0 2;1.1 5;1.2 Static mode 1. Load the data from dataset.csv into memory. 2. Apply the tma operator for all the records for each of the input channels. 3. Apply the sma operator for all the records generated by tma. 4. Release the results of tma from memory. 5. Apply the ema operator for all the records generated by sma. 6. Release the results of sma from memory. 7. Save the result as well as the input dataset to the output file. 8. Release the results of ema from memory. Streaming mode 1. Read the first record (toto,1,1.0) from the file dataset.csv, and “send” it to the operator tma. The tma operator keeps a copy of this record. Send the input record to the save operator. The save operator writes this record in the output file. Send the output record of tma to sma. The sma operator keeps a copy of this record. Send the output record of sma to ema. The ema operator keeps a copy of 11 this record. Send the output record of ema to save. The save operator writes the record to the output file. 2. Read the second record (toto,2,1.1), and send it to the operator tma. Send the record to the save operator. The tma operator keeps a copy of this record. Send the output record of tma to sma. The sma operator keeps a copy of this record. Send the output record of sma to ema. The ema operator keeps a copy of this record. Send the output record of ema to save. The save operator writes the record to the output file. 3. Read the third record (toto,5,1.2), and send it to the operator tma. Send the record to the save operator. The tma operator keeps a copy of this record. The tma operator releases the two first records because they are out of the current time window [3,5]. Send the output record of tma to sma. The sma operator keeps a copy of this record. The sma operator releases the two first records. Send the output record of sma to ema. The ema operator keeps a copy of this record. The ema operator releases the two first records. Send the output record of ema to save. The save writes the record to the output file. 5.5 User defined operators As in most programming languages, users can define new operators either with the function keyword, or by extending a new C++ class in the Honey implementation. This sub-section presents the first solution. The definition of a new operator is done with the keywords function and endfunction. When compiling a program, new operators’ code is unrolled into the flow diagram. For example, if a user defined function is called twice, the flow diagram corresponding to the function will be repeated twice in the final process flow diagram. The memory footprint of this solution is often negligible, and ensures the result of the compilation to be a flat (i.e. non hierarchical) flow diagram. User can define the result of an operator with the return keyword. Unlike most other programming languages, return does not stop the “execution” of an operator, and an operator can contain several active return statements. The following example shows the definition of a user defined operator as well as the resulting flow diagram shown in figure 4. In this listing, the work of functions f and f bis are exactly equivalent (even if f bis contains two return statements). However, since f bis is never called, it does not appear in the final flow diagram. 1 2 3 4 5 6 7 8 9 10 11 12 function f $a %w $r = sd $a %w $r += sma $r =%w,10,∗ return $r endfunction function f bis $a %w $r = sd $a %w return $r $r = sma $r =%w,10,∗ return $r endfunction 12 echo channel1 sd 5 sma 50 save echo channel2 sd 5 sma 50 Figure 4: Flow diagram of the function example. 13 14 15 16 17 18 5.6 $c1 = echo ”channel1” $c2 = echo ”channel2” $res = call f $c1 5 $res += call f $c2 5 save $res file:”result.evt” Recursion Honey supports two types of recursion: operator recursion and record recursion. Operator recursion happens when a user defined operator call itself recursively (directly or indirectly). As explained in the previous section, the flow diagram of the user defined operator is unrolled during compilation, and infinite recursions can be detected at compilation time. The final flow diagram does not contain cycles. Record recursion is a directed cycle in the final flow diagram. Through this cycle, records are re-injected “upstream” in the flow diagram. Unlike operator recursion, record recursion does not involve unrolling of an operator, and infinite recursion cannot be detected during the compilation. Honey syntax aims to protect the user against unwanted and erroneous recursions, and record recursion is only done with variables specified as recursive by the user (with the recursive keyword). The following example shows two programs that repeat three times all input event records with an interval of 0.5 time units. The first program solves this exercise with operator recursion. The second program solves this exercise with record recursion. The flow diagrams of both programs are shown in figure 5. Operator recursion solution: 1 2 3 4 5 6 7 8 9 10 11 12 $a = echo #.∗ function f $b %i global $result $b = delay $b 0.5 $result += $b set %i =%i,1,− if =%i,0,> call f $b %i endif endfunction call f $a 3 save $result file:”result.evt” Record recursion solution: 13 echo #.* delay 0.5 delay 0.5 delay 0.5 save (a) Operator recursion echo #.* eq 3 delay 0.5 eq val,1,- passIf val,0,> eq 1 save (b) Record recursion Figure 5: Flow diagrams for the operator recursive and record recursive solutions. 1 2 3 4 5 6 7 8 9 10 6 $a = echo #.∗ recursive $x $a = eq $a 3 $x += $a $b = delay $x 0.5 $b = eq $b ”value,1,−” $b = passIf $b ”value,0,>=” $x += $b $result += echo $b save $result file:”result.evt” Examples of Honey programs In this section, we present four non-trivial tasks (i.e. tasks that cannot be solved by a single Honey operator), and their solutions using Honey. All these tasks come from real problems and data analyses. For each task, a dataset is presented, a task is described, a solution Honey program is detailed, and the results are plotted. These examples aim to show the power of the SSTS representation and the simplicity and power of Honey to solve complex real world problems. The datasets, the Honey programs and the interactive plots of each task are available online [2] in the section “Honey paper examples”. It is recommended for the reader to run and experiment with these examples. The tasks are: Feature generation: Given a non-synchronized and non-continuous record of vital signs of a patient in a hospital bed (i.e. heart rate, respiratory rate, oxygenation level) sampled approximately every 20s, and a set of timestamped physician annotations of cardio-respiratory health instability (e.g. abnormally high or low heart rate). a) Compute various tailing moving statistical features with different window lengths. b) Study the individual predictive power of each feature to the task of forecasting the physician labeled instabilities periods. c) Align the channels to the heart rate channel, and export the results into a .csv file. 14 Heartbeat segmentation: Given a record containing raw continuous EKG and Central Venus Pressure (CVP) records sampled at 250Hz. The CVP is the instantaneous blood pressure at the entry of the heart. a) Detect heartbeats. b) Compute heart rate. c) In a separate .csv file for each intra-heartbeat interval, extract and export a snapshot of the raw channel readings. d) Compute the average CVP for each intra-heartbeat interval, and export it to a .csv file. Abnormality detection and calendar correlation: Given a three year record of several proximity sensor readings located in an office. a) Study the distribution of the activity with the hour of the day and day of the week. b) Build an incremental model of normality of the activities and use this model to detect abnormalities. c) Study the distribution of abnormalities according to the hour of the day and day of the week. Pattern recognition: Given a record containing raw continuous CVP, EKG and airway pressure sampled at 250Hz. a) Look for up-down-up-down patterns in a CVP record. This pattern is equivalent to the “ACV” pattern convention used to study CVP waveform in the medical literature. b) Detect beginning of expiration from the airway pressure (pressure in the lungs). c) In a .csv file, one row for each heartbeat, export the increase of atrial pressure (computed from the CVP tracking) and the duration since the last beginning expiration (computed from the respiration tracking). Use R to create a 2d squatter plot of these two components. 6.1 Feature generation As input, we consider a file vital.evt containing several days of various vital sign readings (heart rate, respiratory rate, and oxygenation level) from a patient on a hospital bed. Vital signs are recorded independently approximately every 20s. Channels have “gaps” (periods without records, e.g. when the patient went to the bathroom). A second file annotation.evt contains annotations of the beginning of instability periods that we want to understand. The task is to compute the moving average and moving standard deviation of each channel with windows of length of 5min and 1h, and to evaluate the forecasting power of each of the new computed features on and the instability annotations using AMOC (Activity Monitor Operator Characteristic) and a T-ROC (Temporal Receiver Operating Characteristic) plots. Additionally, we want to synchronize the three channels according to the heart rate records, compute new channels indicating (continuously) the presence or absence of a reading in the input channels in the previous 5 minutes (also called activity detection), and export the synchronized result into a .csv file. The program solving this task is given below. Line wrapping is represented by the ,→ symbol. 1 2 3 4 5 # Specify the two input files. @data input:”vital.evt;annotation.evt” # Select all available input channels. $all = echo #.∗ # Selects channels RR, HR and SPO2. 15 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 $vitals = filter $all ”(RR|HR|SPO2)” # Selects channel event.real alert. $annot = filter $all ”event.real alert” # Define two numerical variables containing the number of seconds in 5min and 1h. set %5Minutes =60,5,∗ set %1Hour =60,60,∗ # Compute moving averages and moving standard deviations in the last 5min and 1h. $feat = sma $vitals %5Minutes $feat += sma $vitals %1Hour $feat += sd $vitals %5Minutes $feat += sd $vitals %1Hour # Compute AMOC and T−ROC between the computed features and the annotations. Save ,→ the results (plots, reports, statistical test results, etc.) in the given directory. report amoc trigger:$feat target:$annot file:”results/amoc” # Select the heart rate channel. $HR = filter $vitals ”HR” # Sample the input channels at the time of the heart rate records. $export = sample $vitals trigger:$HR # Compute the activity of each channel. $active = active $vitals %5Minutes margin:%5Minutes $export += sample $active trigger:$HR # Export the sampled channels into a .csv file. saveBufferedCsv $export file:”results/data.csv” The figure 6 shows a small sample of the raw data, computed features and synchronized vital signs. This figure has been computed using Honey environment. The configuration of this plot is available at [2]. 6.2 Heartbeat segmentation As input, we consider a dataset containing continuous high frequency (250Hz) reading of CVP and EKG. The task is to detect heartbeats from the EKG readings, compute the heart rate, export a snapshot of the raw input for each heartbeat interval, and compute the average CVP heartbeat by heartbeat. The program solving this task is given below. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 @data input:”vital.csv” $vitals = echo #.∗ # Selects the channels $ekg = filter $vitals ”EKG” $cvp = filter $vitals ”CVP” # = Detect heartbeats # Range of the ekg in the last 0.05s $a = range $ekg 0.05 # Normalization from the mean and standard deviation estimated in the last 2s. $b = normalize $a 2 type:meansd # Generate an event when the value of the channel from $b crosses−up the value 2. $c = layer $b thresholds:2 output:up # Rename the channel to ”heartbeat” $heartbeat = rename $c ”heartbeat” # = Compute heart rate 16 Raw input HR RR SPO2 Synchronized input HR_sampled RR_sampled SPO2_sampled Activity HR_active[300] RR_active[300] SPO2_active[300] Features HR_sd[300] HR_sd[3600] HR_sma[300] HR_sma[3600] RR_sd[300] RR_sd[3600] RR_sma[300] RR_sma[3600] SPO2_sd[300] SPO2_sd[3600] SPO2_sma[300] SPO2_sma[3600] time Figure 6: Results from the task 1. 16 17 18 19 20 21 22 23 24 25 26 27 28 29 # Compute the time interval since last record $a = sinceLast $heartbeat 5 # Convert the interval into frequency by minutes. $a = eq $a ”60,value,/” # Rename the channel to ”heartrate” $a = rename $a ”heartrate” # Remove records with values smaller than 1 or larger than 180 $heartrate = passIfFast $a minValue:1 maxValue:180 # Export the raw records of each heartbeat in a separate file. saveBufferedCsv $vitals file:”snapshots/sh <index>.csv” trigger:$heartbeat # Save heartbeats events and heat rates channels. $tosave = $heartbeat $tosave += $heartrate save $tosave file:”result.evt” The figure 7 shows a small sample of the raw data, detected heartbeats and computed heart rate. 6.3 Abnormality detection and calendar correlation As input, we consider an .evt file containing activation of proximity sensors installed in the hallway of an office building. A single record is generated whenever a person 17 4.52 CVP 1.72 1.04 EKG -0.04 heartbeat 107 heartrate 104 time Figure 7: Results from the task 2. passes near a sensor. Each sensor is attached to one channel. This dataset is called the Merl dataset (Mitsubishi Electric Research Labs dataset) and it is available online [9]. The first task is, every 10 minutes, to compute the 1 hour tailing moving count of activity of each sensor. Next, every 10 minutes, we estimate a student’s T distribution from the anterior moving counts conditioned on the day of the week and time of the day. The current moving count of each sensor is compared to its model and a set of p-values are estimated. Such p-values can be interpreted as abnormality detection scores – a low value is indicative of an abnormal observation. The p-values from all sensors are aggregated using the Holm Bonferroni correction. The resulting value is the normalized number of rejected p-values. This number can be interpreted as the global abnormality of activity in the building. A threshold is used to define a boolean abnormality status. The daily and hourly distribution of abnormalities is finally studied. The program solving this task is the following: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 @data input:”sensor.bin” output:”abnormality.bin” # Load the sensor readings $all = echo #.∗ # Select six of the sensors $sensors = filter $all ”s(386|330|406|265|375)” # Generate a record every 10 minutes. $every10mn = tick 600 # Compute a 1h moving count for each sensor. $mcount = count $sensors 3600 trigger:$every10mn # Generating calendar change points and status i.e. generate specific events for change of ,→ hour, day and month. $cal = calendar produce:days,hours,months # Select the event channel specifying the beginning of a new week. $newWeek = filter $cal ”event\.day is Monday” # Every 10 minutes and for each sensor, estimate a student distribution parameters from ,→ past observations with same relative time difference to the beginning of the week. ,→ Compute and return the −log p−value between current observations and the 18 Table 1: Distribution of abnormalities according to the day of the week (report day.txt). 1 2 3 4 5 6 7 8 9 10 11 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 Number of types of events : 1 Number of types of states : 7 Event ”multitest 0.01 HBON 0.01 skip last[3600]” Number of event instances: 2253 state.day is Sunday : 409 (18%) state.day is Monday : 305 (13%) state.day is Tuesday : 303 (13%) state.day is Wednesday : 306 (13%) state.day is Thursday : 318 (14%) state.day is Friday : 305 (13%) state.day is Saturday : 307 (13%) ,→ estimated distribution. For example, an observation at 8:30am on Tuesday will be ,→ compared to all past observations at 8:30am on past Tuesdays. The operator ,→ also computes the confidence bounds. $tests += test $mcount landmark:$newWeek trigger:$every10mn method:STUDENT # Only keep the minus log p−values. $indiv abnormalities = filter $tests ”.∗mlogPValue” # Aggregate all the −log p−values of abnormality using the Holm Bonferroni correction. $abnormality = multiTests $indiv abnormalities correction:HOLM BONFERRONI alpha ,→ :0.01 # Threshold for abnormality alerts set %threshold 0.2 $abnormality t = passIfFast $abnormality minValue:%threshold # Only keep one abnormality every 1h $abnormality t = skip $abnormality t 3600 # Estimate the distribution of abnormality according to the hour of the day. $cal hour = filter $cal ”state\.hour is .∗” report histIntersectEventState event:$abnormality t state:$cal hour file:”report hour.txt” # Estimate the distribution of abnormality according to the day of the week. $cal day = filter $cal ”state\.day is .∗” report histIntersectEventState event:$abnormality t state:$cal day file:”report day.txt” # Save the results $result = $cal $result += $mcount $result += $indiv abnormalities $result += $abnormality saveBufferedBin $result file:%output The figure 8 shows the sensor readings, moving counts, tests, confidence bounds and aggregated tests. The table 1 shows the distribution of abnormalities according to the day of the week (i.e. the file report day.txt). 6.4 Pattern recognition As input, we consider a dataset containing continuous high frequency (250Hz) measurements of CVP, EKG and arterial pressure vital signs. The task is to track the CVP 19 Sensors Moving count of s386 Tests Aggregated tests time Figure 8: Snapshot of sensor readings, moving counts, tests, confidence bounds and aggregated tests from the task 3. “ACV” patterns in the CVP waveform, to track the respiration cycle from the airway pressure waveform, and to create two dimensional scatter plot that shows, for each heartbeat, the relation between the Atrial pressure increase and the time since the last beginning of expiration. This comparison is important because during the breathing cycle, the change of pressure in the lungs impacts the blood pressure in the heart. The program solving this task is the following: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 @data input:”vital.csv” $vitals = echo #.∗ # Selects the channels $ekg = filter $vitals ”EKG” $cvp = filter $vitals ”CVP” $airway = filter $vitals ”Airway pressure” # User defined operator to detect heartbeats (same as task 2) function computeHB $ekg $a = range $ekg 0.05 $b = normalize $a 2 type:meansd $c = layer $b thresholds:2 output:up $hb = rename $c ”heartbeat” return $hb endfunction # Detect heartbeats. $hb = call computeHB $ekg # Track the CVP waveform for each heartbeat: Track up−down−up−down patterns. The ,→ atrial pressure increase is the amplitude of the first up−down peak. $d hb = delay $hb 0.05 20 CVP EKG Airway pressure Heartbeat Start of expiration CVP tracking Time since start of expiration Atrial pressure increase time Figure 9: Snapshot of CVP, EKG and airway pressure, CVP tracking, respiration tracking, time since start of expiration and increase of atrial pressure. 19 20 21 22 23 24 25 26 27 28 29 30 31 $cvp seg = segment $cvp bound:$d hb pattern:”U:X,D:A,U:Y,D:V” # Select the increase of amplitude to A (Atrial). $AV r = filter $cvp seg ”.∗ Dv A” # Track begening of expiration $a = tma $airway 0.1 $b = derivative $a $c = layer $b thresholds:0 output:down $d = passIf $c arg1,7,> arg1:$a $begin expir = rename $d ”begin expiration” # For each heartbeat, export the Atrial pressure increase and time since expiration. $tosave = $AV r $tosave += sinceLast $begin expir 10 trigger:$AV r saveBufferedCsv $tosave file:”result.csv” Figure 7 shows a snapshot of CVP, EKG and airway pressure, CVP tracking, respiration tracking, time since start of expiration and increase of atrial pressure. Figure 10 shows for each heartbeat, the relation between time since start of expiration and increase of atrial pressure. 21 5 4 3 2 1 Atrial pressure increase (mmHg) + ++ +++ + + + + + + + + + + + + + + ++ +++ ++++++++++ + ++++++++++ ++++++ +++++++++++ +++ +++ + + ++ ++ + +++++ ++ + + ++++++ ++ ++++ ++ ++ + + +++ + + ++++ + + +++++ + ++ + + ++ + + + + ++ + +++ + ++ + ++ 0 1 2 3 4 5 + Time to last expiration (s) 6 Figure 10: Time since beginning of the last expiration and increase of atrial pressure of each heartbeat. The interpolation is based on a spline. 7 Discussion History of Honey The first version of Honey (initially called Event Processor) was created to handle seemingly real-time streams and static records of Forex (Foreign exchange market) pair values. Honey programs were initially written in xml, each operator was executed in a separate operating system process, and only a small number of operators were available. Honey outputs were primarily used as the input of the Titarl algorithm [1] to solve forecasting problems. Honey was next used to work with “smart houses” datasets (records of human activity in a house equipped with sensors). Next, Honey was use to process records of human robot interaction. Honey was next used to process vital sign records of patient in hospitals. During these various exercises, it appeared that many operators could be re-used across several domains. In addition, the direct availability of these operators, the ease with which they could be combined, and the structure of the framework made such experimentation fast (and flexible). Since that time, Honey has been improved through successive project applications, new operators were created, the syntax and semantics were improved, and the IDE environment was developed and refined. Why Honey is simply not a library? Readers might wonder why Honey was designed as a programming language instead of a simple library. The reason is simple: To be executed a program in real-time or in static streaming execution mode, the Honey virtual machine needs to be fully aware of the entire flow diagram at the beginning of the execution. Therefore, a library that would allow calling each operator sequentially would not allow real-time or in static streaming execution mode. At best, the library would require specifying the entire process before the beginning of the execution, but this solution would be equivalent and less practical than writing a program/configuration file. In addition, having to “hard 22 code” the process definition would impeach its flexibility, and require recompilation the calling program every-time the process definition was changed. Instead, knowing the entire processing chain allows Honey to optimize the memory footprint of the execution. And, having an integrated standalone environment contributes to having a quick-to-use tool. API and integration However, Honey can still be used as a library from inside of another program through its API. Through the API, a user can load, compile and execute Honey programs. This feature is especially useful for tight integration and for avoid easily to duplicate records in memory. Such collaboration between two languages is generally used for large projects that require flexible user inputs, and it has been found to be a powerful solution for fast prototyping and experimentation. The most famous example of such osmosis is certainly the Lua programming language [4] which is used in many industrial applications and many commercialized video games (more than 50% of published video games in 2009). Temporal and non-temporal hybrid analyses In many exercises, inputs are represented as large temporal datasets (e.g. time series), the first layers of the analysis require the processing of a large amount of data in the temporal domain, while the last layers are non-temporal and require the processing much smaller amount of data. Honey is routinely used in such exercises to quickly do the work of the first temporal layers of the analysis. Honey’s results are then exported to a general numerical analysis environment were the remaining of the analysis is done (e.g. R, Matlab, Scilab, Pandas). 8 Conclusion This paper presents Honey; a data flow programming language for the processing of multivariate, asynchronous and non-uniformly sampled scalar and symbolic time sequences. It was developed both for specific research and out of a desire for normalization and re-usability of data analytic workflows. Honey has been designed with a number of novel features which makes it a unique and powerful data analytic tool for its area of specialty. Honey novel features are: 1. A compact and specialized syntax for fast and efficient code writing, reading and maintenance. As an illustration, one of our past analyses involved a problem similar to task 4. The task was initially solved with a 872 lines Python program. As it appeared, because of the exploratory nature of the exercise, because the code was modified continuously, and because our experimentation did not require production quality code, the program became hard to maintain, understand, modify and experiment with. Additionally, the program was also slow. Rewritting it in C would have certainly made it faster but also more complex and less flexible. 23 Instead, the program was re-written using a forty lines in Honey. This conversion solved many of the existing bugs, it required a very small amount of time to write and test, and it allowed us to quickly perform many new experiments in a very short time. 2. Honey programs are guaranteed to run similarly on static and read-time streaming datasets. This feature protects the developers from bugs that would only appear if and when an experimental code designed on static data was converted for work on online streaming data. Additionally, data analysts can more easily try their work on “real world scenarios”. 3. Honey includes an IDE that contains a data visualization and an exploration environment. While writing a Honey program, the intermediate and final results can be directly and interactively explored. This feature allows fast design, debugging and experimentation. It also provides a solution to the problem of “blind analytics”: Data analysts building invalid analysis due to incorrect assumptions on the data. Instead, and using Honey, users get a better understanding of the dataset without extra effort. They can also collaborate more efficiently with colleagues and domain experts. Such “aware” development often leads to better designed analysis, and reduces the risk of hidden errors. 4. Honey is efficient. Honey is implemented in C++ which make it significantly faster than interpreted (Matlab, R, etc.) or virtualized languages (Java, Python). While most scientific environment languages (Matlab, R, etc.) have high efficient C implementations of algebraic functions, the high branching nature of operators required to process non-synchronous and non-uniformly sampled records only marginally benefits from these implementations. In addition, unlike scientific environments, Honey program execution optimizes the memory footprint. Comparisons have shown large gain both in memory and speed. Finally, Honey can be executed in seamlessly in greedy execution mode for datasets larger that the available memory. 5. Once compiled, a Honey program is converted into a process flow diagram. This graphical structure can be used to visualize and understand a program. 6. Finally, over the last seven years, we made a significant effort to normalize and integrate new operations. Today, Honey contains a large library of diverse operators that would be sufficient to solve most analytic tasks. Honey started as a simple tool developed for an experiment. Since then, it has grow and proved to be useful in many research tasks. Today Honey has allowed us, our colleagues, our students and our collaborators to quickly perform high quality complex and understandable analysis of a large variety of domains. Extrapolating from our experience, we hope and believe that Honey might change and improve the way we approach SSTS and other time series like data representations. We also believe that Honey’s core paradigm could be re-used in other domains and provide the same benefits (e.g. text processing, video processing, control, process definition). 24 References [1] Mathieu Guillame-Bert. Learning Temporal Association Rules on Symbolic Time Sequences. PhD thesis, University of Grenoble, 2012. [2] Mathieu Guillame-Bert. Official home of the honey programming language. http://framework.mathieu.guillame-bert.com/, 2016. Last accessed 06 June 2016. [3] N. Halbwachs, P. Caspi, P. Raymond, and D. Pilaud. The synchronous dataflow programming language lustre. In Proceedings of the IEEE, pages 1305–1320, 1991. [4] Roberto Ierusalimschy, Waldemar Celes, and Luiz Henrique de Figueiredo. The programming language lua. http://www.lua.org/. Last accessed 06 June 2016. [5] G. Kahn. The semantics of a simple language for parallel programming. In J. L. Rosenfeld, editor, Information processing, pages 471–475, Stockholm, Sweden, Aug 1974. North Holland, Amsterdam. [6] P. LeGuernic, T. Gautier, M. Le Borgne, and C. Le Maire. Programming real-time applications with signal. Proceedings of the IEEE, 79(9):1321–1336, Sep 1991. [7] Orlando Moreira and Henk Corporaal. Data Flow Computation Models, pages 39–52. Springer International Publishing, Cham, 2014. [8] Walid A. Najjar, Edward A. Lee, and Guang R. Gao. Advances in the dataflow computational model. Parallel Comput., 25(13-14):1907–1929, December 1999. [9] Christopher R. Wren, Yuri A. Ivanov, Darren Leigh, and Jonathan Westhues. The merl motion detector dataset. In Proceedings of the 2007 Workshop on Massive Datasets, pages 10–14. ACM, 2007. 25
2cs.AI
arXiv:cs/0606023v3 [cs.MS] 17 Oct 2008 Parallel Evaluation of Mathematica Programs in Remote Computers Available in Network Santanu K. Maiti E-mail: [email protected] Theoretical Condensed Matter Physics Division Saha Institute of Nuclear Physics 1/AF, Bidhannagar, Kolkata-700 064, India 1 Contents Preface 3 1 Introduction 4 2 How to Open Slaves in Local Computer ? 4 3 How to Open Slaves in Remote Computers Available in Network ? 6 4 Parallelizing of Mathematica Programs by using Remote Computers Available in Network 7 Concluding Remarks 10 Acknowledgment 10 References 10 2 Preface Mathematica is a powerful application package for doing mathematics and is used almost in all branches of science. It has widespread applications ranging from quantum computation, statistical analysis, number theory, zoology, astronomy, and many more. Mathematica gives a rich set of programming extensions to its end-user language, and it permits us to write programs in procedural, functional, or logic (rule-based) style, or a mixture of all three. For tasks requiring interfaces to the external environment, mathematica provides mathlink, which allows us to communicate mathematica programs with external programs written in C, C++, F77, F90, F95, Java, or other languages. It has also extensive capabilities for editing graphics, equations, text, etc. In this article, we explore the basic mechanisms of parallelization of a mathematica program by sharing different parts of the program into all other computers available in the network. Doing the parallelization, we can perform large computational operations within a very short period of time, and therefore, the efficiency of the numerical works can be achieved. Parallel computation supports any version of mathematica and it also works as well even if different versions of mathematica are installed in different computers. The whole operation can run under any supported operating system like Unix, Windows, Macintosh, etc. Here we focus our study only for the Unix based operating system, but this method works as well for all other cases. 3 1 Introduction Mathematica, a system of computer programs, is a high-level computing environment including computer algebra, graphics and programming. Mathematica is specially suitable for mathematics, since it incorporates symbolic manipulation and automates many mathematical operations. The key intellectual aspect of Mathematica is the invention of a new kind of symbolic computation language that can manipulate the very wide range of objects needed to achieve the generality required for technical computing by using a very small number of basic primitives. Mathematica is now emerging as an important tool in many branches of computing, and today it stands as the world’s best system for general computation. Parallelization is a form of computation in which one can perform many operations simultaneously. Parallel computation uses multiple processing elements simultaneously to finish a particular job. This is accomplished by breaking the job into independent parts so that each processing element can execute its part of the algorithm simultaneously with the others. The processing elements can be diverse and include resources such as a single computer with multiple processors, several networked computers, specialized hardware, or any combination of the above. In this article, we narrate the basic mechanisms for parallelizing a mathematica program by running its independent parts in several computers available in the network. Since all the basic mathematical operations are performed quite nicely in any version of mathematica, it does not matter even if different versions of mathematica are installed in different computers those are required for the parallel computing. For our illustrative purposes, here we describe the parallelization technique for the Unix based operating system only. 2 How to Open Slaves in Local Computer ? In parallel computation, different segments of a job are computed simultaneously. These operations can be performed either in a local computer or in remote computers available in the network. Separate operations are exhibited in separate mathematica slaves. In order to emphasize the basic mechanisms, let us now describe the way of starting a mathematica slave in a local computer. To do this, first we load the following package in a mathematica notebook. 4 Needs[“Parallel`Parallel`”] To enable optional features, then we load the package, Needs[“Parallel`Commands`”] Now we can open a mathematica slave in the local computer by using the command, LaunchSlave[“localhost”, “math -noinit -mathlink”] Using this command, several mathematica slaves can be started from the master slave. Now it becomes much more significant if we specify the names of different slaves so that independent parts of a job can be shared into different slaves appropriately. For our illustrations, below we give some examples how different slaves can be started with specific names. link1=LaunchSlave[“localhost”, “math -noinit -mathlink”] link2=LaunchSlave[“localhost”, “math -noinit -mathlink”] link3=LaunchSlave[“localhost”, “math -noinit -mathlink”] Here link1, link2 and link3 correspond to the three different slaves. The details of these slaves can be available by using the following command, TableForm[RemoteEvaluate[{$ProcessorID, $MachineName, $SystemID, $ProcessID, $Version}], TableHeadings→{None,{“ID”, “host”, “OS”, “process”, “Mathematica Version”}}] The output of the above command becomes (as an example), ID host 1 tcmpibm OS AIX-Power64 process 463002 2 tcmpibm AIX-Power64 299056 3 tcmpibm AIX-Power64 385182 Version 5.0 for IBM AIX Power (64 bit) (November 26, 2003) 5.0 for IBM AIX Power (64 bit) (November 26, 2003) 5.0 for IBM AIX Power (64 bit) (November 26, 2003) The results shown in this table are for the above three slaves named as link1, link2 and link3 respectively, where all these slaves are opened from the local computer named as ‘tcmpibm’ (say). To get the information about the total number of slaves those are opened, we use the command, 5 Length[$Slaves] For this case, the total number of slaves becomes 3. 3 How to Open Slaves in Remote Computers Available in Network ? To start a slave in remote computer, the command ‘ssh’ is used which offers secure cryptographic authentication and encryption of the communication between the local and remote computer. Before starting a slave in a remote computer, it is necessary to check whether ‘ssh’ is properly configured or not, and this can be done by using the prescription, ssh remotehost math For example, if we want to connect a remote computer named as ‘tcmpxeon’, we should follow the command as, ssh tcmpxeon math Since ‘ssh’ connection for a remote computer is password protected, it is needed to insert proper password, and if ‘ssh’ is configured correctly, the above operation shows the command ‘In[1]:=’. Once ‘ssh’ works correctly, a mathematica slave can be opened in a remote computer through this command, LaunchSlave[“remotehost”, “ssh -e none `1` math -mathlink”] For our illustrative purposes, below we describe how different slaves with proper names can be started in different remote computers. link1=LaunchSlave[“tcmpxeon.saha.ac.in”, link2=LaunchSlave[“tcmp441d.saha.ac.in”, link3=LaunchSlave[“tcmpxeon.saha.ac.in”, link4=LaunchSlave[“tcmp441d.saha.ac.in”, “ssh “ssh “ssh “ssh -e none `1` math -e none `1` math -e none `1` math -e none `1` math -mathlink”] -mathlink”] -mathlink”] -mathlink”] Here link1, link2, link3 and link4 are the four different slaves, where the link1 and link3 are opened in a remote computer named as ‘tcmpxeon’ (say), while the other two slaves are started in another one remote computer named as ‘tcmp441d’ (say). Using this 6 prescription, several mathematica slaves can be started in different remote computers available in the network. The details of the above four slaves can be expressed in the tabular form as, ID host 1 tcmpxeon 2 tcmp441d 3 tcmpxeon 4 tcmp441d OS Linux Linux Linux Linux process 5137 11323 5221 11368 5.0 5.0 5.0 5.0 for for for for Linux Linux Linux Linux Version (November (November (November (November 18, 18, 18, 18, 2003) 2003) 2003) 2003) Thus we are now able to start mathematica slaves in local computer as well as in remote computers available in the network, and with this above background, we can describe the mechanisms for parallelizing a mathematica program. 4 Parallelizing of Mathematica Programs by using Remote Computers Available in Network In order to understand the basic mechanisms of parallelizing a mathematica program, let us begin with a very simple problem. We set the problem as follows: Problem: Construct a square matrix of any order in a local computer and two other square matrices of the same order with the previous one in two different remote computers. From the local computer, read these two matrices those are constructed in the two remote computers. Finally, take the product of these three matrices and calculate the eigenvalues of the product matrix in the local computer. To solve this problem we proceed through these steps in a mathematica notebook. Step-1 : For the sake of simplicity, let us first define the names of the three different computers those are needed to solve this problem. The local computer is named as ‘tcmpibm’, while the names of the other two remote computers are as ‘tcmpxeon’ and ‘tcmp441d’ respectively. Opening a mathematica notebook in the local computer, let us first load the package for parallelization, and to get the optional features, we load another one package as mentioned earlier in Section 2. Then we start two mathematica slaves named as ‘link1’ and ‘link2’ in the two remote computers ‘tcmpxeon’ and ‘tcmp441d’ respectively by using the proper commands as discussed in Section 3. Step-2 : Next we make ready three programs for the three separate square matrices of same order in the local computer. Out of which one program will run in the local 7 computer, while the rest two will run in the two remote computers. These three programs are as follows. I. sample1[ns− ]:=Block[{esi= 0, t = 1.2, p = 2.1,vacuum1={}}, Do[Do[a1=If[i==j,esi,0]; a2=If[i < j && Abs[i − j]== 1, t, 0]; a3=If[i > j && Abs[i − j]== 1, p, 0]; a4=a1+a2+a3; a5 = AppendTo[vacuum1,a4], {j, 1, ns}], {i, 1, ns}]; a6 = Partition[a5, ns]] II. sample2[ns− ]:=Block[{esi= 0, q = 2.6, r = 1.8,vacuum2={}}, Do[Do[a1=If[i==j,esi,0]; a2=If[i < j && Abs[i − j]== 1, q, 0]; a3=If[i > j && Abs[i − j]== 1, r, 0]; a4=a1+a2+a3; a5 = AppendTo[vacuum2,a4], {j, 1, ns}], {i, 1, ns}]; a6 = Partition[a5, ns]] III. sample3[ns− ]:=Block[{esi= 0, u = 2, v = 3,vacuum3={}}, Do[Do[a1=If[i==j,esi,0]; a2=If[i < j && Abs[i − j]== 1, u, 0]; a3=If[i > j && Abs[i − j]== 1, v, 0]; a4=a1+a2+a3; a5 = AppendTo[vacuum3,a4], {j, 1, ns}], {i, 1, ns}]; a6 = Partition[a5, ns]] Since we are quite familiar about the way of writing mathematica programs [1, 3], we do not describe here the meaning of the different symbols used in the above three programs further. Thus by using these programs, we can construct three separate square matrices of order ‘ns’. Step-3 : We are quite at the end of our complete operation. For the sake of simplicity, we assume that, the program-I is evaluated in the local computer, while the programII and program-III are evaluated in the two remote computers respectively. All these three programs run simultaneously in three different computers. To understand the basic mechanisms, let us follow the program. 8 sample4[ns− ]:=Block[{}, ExportEnvironment[“Global`”]; mat1 = sample1[ns]; RemoteEvaluate[Export[“data1.dat”, sample2[ns]], link1]; RemoteEvaluate[Export[“data2.dat”, sample3[ns]], link2]; mat2 = RemoteEvaluate[ReadList[“data1.dat”, Number, RecordLists→ True], link1]; mat3 = RemoteEvaluate[ReadList[“data2.dat”, Number, RecordLists→ True], link2]; mat4 = mat1.mat2.mat3; Chop[Eigenvalues[mat4]]] This is the final program. When it runs in the local computer, one matrix called as ‘mat1’ is evaluated in the local computer (3rd line of the program), and the other two matrices are determined in the remote computers by using the operations given in the 4th and 5th lines of the program respectively. The 2nd line of the program gives the command for the transformations of all the symbols and definitions to the remote computers. After the completion of the operations in remote computers, we call back these two matrices in the local computer by using the command ‘ReadList’, and store them in ‘mat2’ and ‘mat3’ respectively. Finally, we take the product of these three matrices and calculate the eigenvalues of the product matrix in the local computer by using the rest operations of the above program. The whole operations can be pictorially represented as, Daughter slave in remote computer tcmpxeon Daughter slave in remote computer tcmp441d Master slave in local computer tcmpibm Figure 1: Schematic representation of parallelization. 9 At the end of all the operations, we close all the mathematica slaves by using the following command. CloseSlaves[ ] Concluding Remarks In conclusion, we have explored the basic mechanisms for parallelizing a mathematica program by running its independent parts in remote computers available in the network. By using this parallelization technique, one can enhance the efficiency of the numerical works, and it helps us to perform all the mathematical operations within a very short period of time. In this present discussion, we have focused the parallelization technique for the Unix based operating system only. But all these operations also work very well in any other supported operating system like Windows, Macintosh, etc. Not only that, all these operations can also be done quite significantly even if different versions of mathematica are installed in different remote computers those are used for parallel computation. Acknowledgment I acknowledge with deep sense of gratitude the illuminating comments and suggestions I have received from Prof. Sachindra Nath Karmakar during the preparation of this article. References [1] Stephen Wolfram. Mathematica-5.0. [2] Roman E. Maeder. About Parallel Computing Toolkit. A Wolfram Research Application Package. [3] Santanu K. Maiti. A Basic Introduction on Math-Link in Mathematica, Ref.: arXiv:cs/0603005v3 [cs.MS] 17th October, 2008. [4] Santanu K. Maiti. How to Run Mathematica Batch-files in Background ?, Ref.: arXiv:cs/0604088v3 [cs.MS] 17th October, 2008. 10
6cs.PL
Pore-scale lattice Boltzmann simulation of laminar and turbulent flow through a sphere pack Ehsan Fattahia,b , Christian Waluga, Barbara Wohlmutha , Ulrich Rüdeb , Michael Manhartc , Rainer Helmigd a M2 - Zentrum Mathematik, Technische Universität München, Garching of Computer Science 10 (System Simulation), Universität Erlangen-Nürnberg, Erlangen c Fachgebiet Hydromechanik, Technische Universität München, Munich d Institut für Wasser- und Umweltsystemmodellierung, Universität Stuttgart, Stuttgart arXiv:1508.02960v1 [cs.CE] 12 Aug 2015 b Department Abstract The lattice Boltzmann method can be used to simulate flow through porous media with full geometrical resolution. With such a direct numerical simulation, it becomes possible to study fundamental effects which are difficult to assess either by developing macroscopic mathematical models or experiments. We first evaluate the lattice Boltzmann method with various boundary handling of the solid-wall and various collision operators to assess their suitability for large scale direct numerical simulation of porous media flow. A periodic pressure drop boundary condition is used to mimic the pressure driven flow through the simple sphere pack in a periodic domain. The evaluation of the method is done in the Darcy regime and the results are compared to a semi-analytic solution. Taking into account computational cost and accuracy, we choose the most efficient combination of the solid boundary condition and collision operator. We apply this method to perform simulations for a wide range of Reynolds numbers from Stokes flow over seven orders of magnitude to turbulent flow. Contours and streamlines of the flow field are presented to show the flow behavior in different flow regimes. Moreover, unknown parameters of the Forchheimer, the Barree–Conway and friction factor models are evaluated numerically for the considered flow regimes. Keywords: Lattice Boltzmann method, porous media, Forchheimer force, pore scale simulation, turbulence, Darcy, periodic pressure boundary 1. Introduction The simulation of fluid flow and transport processes through porous media is an important field that contributes to a number of scientific and engineering applications, e.g., oil extraction, groundwater pollution, nuclear waste storage, and chemical reactors. The application of pore-scale simulations is challenging in most practical situations since the system under study is often by orders of magnitude larger than the characteristic size of the pores. Thus for practical purposes, many computational techniques are based on macroscopic models that average over many pores and consider average flow rates. For steady state flow at low Reynolds numbers a generally accepted and experimentally confirmed macroscopic relation between the pressure gradient and flow rate is given by Darcy’s Preprint submitted to Elsevier August 13, 2015 law ∇P = −µKD−1 U, (1) where µ is the fluid dynamic viscosity, KD is a permeability tensor associated with the geometry of the porous medium under consideration, and U and P are the volume averaged velocity and pressure, respectively. This model, which was first found by Darcy [1] in experimental investigations, is valid in the regime Re p  1, where Re p := ρd p U/µ is the Reynolds number based on a characteristic pore-diameter d p , ρ denotes the density of the fluid, and U := |U · i| is the scalar velocity in streamwise direction i. At larger pore Reynolds numbers, Forchheimer [2] observed a non-linear deviation from this relation, for which he proposed the addition of a quadratic term, namely ∇P = −µKD−1 U − βρ|U|U, (2) where β is the constant inertial factor proposed by Forchheimer, which mainly depends on the flow path and is usually found experimentally. Replacing the β factor by a dimensionless Forchheimer constant as β = C F KD−1/2 , equation (2) is known as Hazen–Dupuit–Darcy equation [3]. Although the Forchheimer equation is widely used in porous media simulations, recent studies suggest that the correction (2) has also a limited range of applicability [4, 5]. A recent experimental study of Bağcı et al. [5] showed that the β factor which is measured in the laminar regime is not generally valid for the whole range of the fluid flow. In Bağcı et al. [5] the use of two different values for permeability is proposed, together with distinct values β for laminar and turbulent flow through the spherical particles. In particular, in the range Re p > 300, the flow becomes turbulent and significant deviations from the Forchheimer model with the laminar β can be observed. Based on a series of experiments, Barree and Conway [4] proposed another model that has the same structure as the Darcy model (1) but which replaces the absolute permeability KD by an apparent permeability Kapp . The apparent permeability can be measured in the same way as the Darcy permeability, but it depends on the flow in a non-linear fashion and is approximated as Kapp = Kmin + (KD − Kmin ) . (1 + ReT F )E (3) Here, E and F are exponential coefficients that describe the heterogeneity of the porous medium, and ReT = ρlT U/µ is the Reynolds number based on a transition length scale lT , and Kmin is a minimum permeability that is attained at high Reynolds numbers. This model is proposed based on the conjecture of two plateau areas for permeability at low and high Reynolds number. While the plateau areas at low Reynolds numbers corresponds to the Darcy regime, and the prediction of the Barree–Conway model in the transition region shows good agreement to experiments [4, 6, 7], the plateau at higher Reynolds numbers is largely hypothesized. To the best knowledge of the authors, no experimental setup or numerical simulation was published that exhibits the plateau behavior at high Reynolds numbers. While the rigorous, analytic up-scaling of the pore-scale problem at lower Reynolds numbers has received much attention in the literature [8, 9], similar approaches for higher Reynolds numbers have not been demonstrated to date. This is mainly due to the immense mathematical difficulties that arise in the flow models if a moderate Reynolds number cannot be assumed. However, with the rise of extremely capable supercomputers, the direct numerical simulation (DNS) has been established as a third possibility for the analysis of homogenized models that can complement the classical experimental and the rigorous mathematical averaging approaches. In 2 the past two decades, the class of lattice Boltzmann methods (LBM) has attracted the interest of researchers in CFD-related areas. In contrast to traditional CFD approaches based on the conservation of macroscopic quantities like mass, momentum, and energy, the LBM models the fluid by the kinetics of discrete particles that propagate (streaming step) and collide (relaxation step) on a discrete lattice mesh. Due to this kinetic nature, microscopic interactions in the fluid flow can be handled even in complex geometries, such as in micro-fluidic devices or in porous media [10, 11, 12]. Moreover, due to the inherently local dynamics, an efficient implementation and parallelization of both fundamental algorithmic stages of the LBM is possible which allows to harness the computational power of currently available and emerging supercomputing architectures [13, 14, 15]. In this study, we use the waLBerla framework (widely applicable Lattice-Boltzmann from Erlangen) [15] that is aimed at massively parallel fluid flow simulations, enabling us to compute problems with resolutions of more than one trillion (1012 ) cells and with up to 1.93 trillion cell updates per second using 1.8 million threads [16]. waLBerla has already been used to study the flow through moderately dense fluid-particle systems in [17] and to simulate large scale particulate flows [18]. It is based on four main software concepts, namely blocks, sweeps, communication and boundary handling [19]. The modular structure of this framework allows the implementation of new LBM schemes and models. However, having immense computational power at hand is not enough to solve relevant problems: due to the explicitness of classical LBM methods the spatial and temporal discretization characteristics are strongly coupled. Hence, special care has to be taken for pore-scale simulations to properly incorporate the physics at the boundaries and inside the domain without over-resolving the problem. As already pointed out in the evaluation of Pan et al. [20], this requires a suitable combination of collision and boundary operators. A common way to simulate pressure driven flow is to replace the pressure gradient with an equivalent body force and applying stream-wise periodic boundary conditions. However, previous studies [21, 22, 23, 24] show that using this approach does not lead to correct flow fields for the flow through complex geometries, e.g., in general porous media. In this article we drive the flow by imposing the pressure gradient while applying the periodic boundary condition in stream-wise direction and allow the flow to develop based on the geometry. In this study, we employ a simple periodic pressure scheme for incompressible flow and investigate it in combination with different types of collision operators and a number of first to third order bounce back schemes for the treatment of the boundaries. To model porous media, we simulate the flow through simple sphere packs by a number of different LBM approaches which we briefly outline in Section 2. Their accuracy, convergence and the associated computational costs are investigated in Section 3 for flow in the Darcy regime, where semi-analytic solutions exist to compare with. Also the scalability of different boundary schemes is investigated to choose the best combination for the high resolution simulation in high Reynolds numbers flow. Having found a suitable configuration, we then simulate the flow through a simple sphere pack in Section 4. By sampling over the regime Re p ∈ [10−4 , 5.812 · 103 ], we numerically investigate the plateau hypothesis of the Barree and Conway model in the turbulent regime. Additionally, we measure the Forchheimer constant C F for laminar and turbulent regimes. To highlight the ability of the proposed LBM to deal with complex geometries, in Section 5 we also present an illustration of turbulent flow over a permeable wall which is constructed by rigid-body interaction of the spheres. 3 2. LBM approaches for porous media flow The lattice Boltzmann equation (LBE) is a simplification of the Boltzmann kinetic equation where we assume that particle velocities are restricted to a discrete set of values ei , i = 0, 1, . . . , i.e., the particles can only move along a finite number of directions, connecting the nodes of a regular lattice [25, 26]. In the following, we consider a three dimensional 19-direction lattice, the so-called D3Q19 model, which provides a good compromise between computational accuracy and parallel efficiency. Discretizing in time using a time-step size of ∆t = tn+1 − tn , the semi-discrete LBE then reads as ∆t−1 ( fk (x + ek ∆t, tn+1 ) − fk (x, tn )) = gk (x, tn ), k = 0, . . . , 18, (4) where fk (x, tn ) represents the probability of finding a particle at some position x and time tn with velocity ek . The left hand side of (4) corresponds to a discrete representation of the Boltzmann streaming operator, while the right hand side g := [gk ]18 k=0 is responsible for controlling the relaxation to a local equilibrium. It is generally split into g := ∆t−1 Ω(x, tn ) + F(x, tn ), where Ω(x, tn ) is a collision term function of f := [ fi ]18 i=0 , and F is a forcing term that drives the flow. Provided that the modeled fluid is close to its equilibrium state, Bhatnagar, Gross and Krook (BGK, [27]) proposed that the discrete local equilibria in collision processes can be modeled by a second-order expansion of a local Maxwellian. The collision operator takes the general form Ω(x, tn ) = −R(f(x, tn ) − f eq (x, tn )), (5) where R is a relaxation operator and f eq (x, tn ) is an equilibrium distribution function of f(x, tn ) which, for incompressible flow, is given by [28] n io h eq 2 1 −2 1 −4 (6) fk (x, tn ) = wk ρ + ρ0 c−2 s ek · u + 2 c s (ek · u) − 2 c s u · u , where wk is a set of weights normalized to unity, ρ = ρ0 + δρ√while δρ is the density fluctuation and ρ0 is the mean density which we set to ρ0 = 1, c s = ∆x/( 3∆t) is the lattice speed of sound, while ∆x is the lattice cell width. The macroscopic values of density ρ and velocity u can be calculated from f as zeroth and first order moments with respect to the particle velocity, i.e., ρ= X18 k=0 fk , u = ρ−1 0 X18 k=0 ek fk . (7) In a lattice Boltzmann scheme, we typically split the computation into a collision and streaming step, which are given as f˜k (x, tn ) − fk (x, tn ) = ∆t gk (x, tn ), fk (x + ek ∆t, tn+1 ) = f˜k (x, tn ), (collision) (streaming) respectively, for k = 0, . . . , 18. The execution order of these two steps is arbitrary and may vary from code to code for implementation reasons. For instance, in waLBerla, the order is first streaming and then collision. This has the benefit that the stream and collision steps can be fused and that the macroscopic values need not be stored and later retrieved from memory. Two important components must be investigated whenever one aims to study the numerical properties (i.e., stability, convergence and accuracy) as well as the computational cost-efficiency of an LBM based approach: Firstly, we have to consider the treatment of the collision term Ω(x, t) 4 in the relaxation step. Secondly, since the nodes of the lattice in the LBM approach are only distinguished into fluid and solid nodes, the choice of the bounce-back operator for the fluid-wall interaction is important for the numerical accuracy. Unfortunately, the relaxation and the bounce-back cannot be treated as two independent ingredients, since their interplay is essential for finding a sweet spot between computational effort and physical accuracy. For instance, in the context of porous media flow, using the BGK collision operator in an approach with a single relaxation time (SRT) ω, i.e., RSRT := ωI is reported to suffer from numerical instabilities and moreover exhibits unwanted boundary effects [20, 29]. More precisely, the effective modeled pore-size by the numerical scheme becomes viscosity-dependent. On a macroscopic level this has the effect that the calculated permeability in the Stokes flow is slightly viscosity-dependent while physically it should be independent of the fluid properties [20]. The limitations of this simple and computationally appealing approach outlined above are the motivation for the investigation of more sophisticated schemes. Similar as in Pan et al. [20], our aim is to investigate different LBM approaches with the application of porous media flow in mind. However, we put our focus on boundary conditions which are suitable for flow driven by pressure-gradients instead of lumping these boundary conditions into a body-force. Before we present a detailed evaluation of suitable combinations for pore-scale simulations, let us briefly summarize the different approaches. 2.1. Collision operators In the evaluation of Pan et al. [20] it is reported that by using multiple relaxation time [30, 31] (MRT) schemes one can overcome the deficiencies of the SRT approach when applied to porous media flow. In the MRT model, the relaxation times for different kinetic modes can be treated separately, which allows fine-tuning of the free relaxation-times to improve numerical stability and accuracy. This is done by the ansatz RMRT := MT S M, (MRT) where the components of the collision matrix in the MRT are developed to reflect the underlying physics of collision as a relaxation process. The rows of the orthogonal matrix M are obtained by the Gram-Schmidt orthogonalization procedure applied to polynomials of the Cartesian components of the particle velocities ek , and S := diag[s0 , s1 , ..., s18 ] is the diagonal matrix holding the relaxation rates sk ; cf., e.g., d’Humières [31] for details. Clearly, within this class of relaxation schemes, SRT approaches are contained as a special case. The parameters s0 , s3 , s5 and s7 are the relaxation parameters corresponding to the collision invariant ρ, and j := ρu, respectively, which are conserved quantities during a collision. They are set to zero in the absence of a forcing term, i.e., if Fk = 0. Pan et al. [20] proposed to choose the remaining modes as follows: (i) viscous stress vectors s9 , s11 , s13 , s14 and s15 equal to sν , which is related to the kinematic viscosity ν = µ/ρ as sν = (3ν + 0.5)−1 , and (ii), set the kinetic modes s1 , s2 , s4 , s6 , s8 , s10 , s12 , s16 , s17 , and s18 to sζ = 8(2 − sν )(8 − sν )−1 , which is also related to the kinematic viscosity. However, as their evaluation showed, it does not lead to viscosity-independent results of the macroscopic quantities, except for the multi-reflection boundary scheme. As Khirevich et al. [32] recently stated, this problem can be solved if one modifies the aforementioned model in a way that the symmetric energy modes, i.e., s1 and s2 , keep the ratio (1/sν − 0.5)/(1/si − 0.5) constant while sν varies. In this study, we set this ratio to 4.6 which provides better accuracy. Based on a symmetry argument, Ginzburg [29] proposes a model based on two relaxation times (TRT), which can be seen as the minimal configuration that provides just enough free 5 relaxation parameters to avoid non-linear dependencies of the truncation errors on the viscosity in the context of porous media simulations [33, 34, 35]. The scheme is derived from the MRT approach by splitting the probability density functions fk into the symmetric and anti-symmetric components fk+ := 12 ( fk + fk̄ ) and fk− := 12 ( fk − fk̄ ), where k̄ is the diametrically opposite direction to k [33, 34, 35]. Performing a separate relaxation by the two corresponding relaxation rates ω+ and ω− yields the operator RTRT := ω+ R+ + ω− R− , (TRT) where R+ and R− are the tensorial representations of the operators extracting the symmetric and antisymmetric components, respectively. The eigenvalue of the symmetric components is again related to the kinematic viscosity as ω+ = (3ν + 0.5)−1 , and the second eigenvalue ω− ∈ (0, 2) is a free parameter. For steady non-linear flow situations, it has been demonstrated that most of the macroscopic errors depend on the so-called “magic” parameter ! ! 1 1 1 1 − Λ= + − ω 2 ω− 2 which has to be determined for the specific flow setup. The choice Λ = 14 is given as a suitable 3 value for porous media simulations . Another choice, namely Λ = 16 , yields the exact location of bounce-back walls in case of Poiseuille flow in a straight channel [34, 32]. In our studies, we choose different values in the range Λ ∈ (0, 43 ]. The exact numbers are listed in section 4. 2.2. Boundary conditions In pore-scale simulations, we typically encounter two types of boundary conditions. The first one is a solid-wall interaction of fluid particles that come into contact with the porous matrix (corresponding to a no-slip condition in continuum-mechanics terminology). The second one is a periodic pressure forcing that is applied to drive the flow by a pressure gradient in order to compute fluid or matrix properties such as the Forchheimer coefficient or the (apparent) permeability. We shall next outline the different schemes under consideration for this study. 2.2.1. Solid-wall interaction In a simple bounce-back (SBB) scheme, the wall location is represented through a zeroth order interpolation (staircase approximation), and the collision of particles with a wall is incorporated by mimicking the bounce-back phenomenon of a particle reflecting its momentum upon collision with a wall, which is supposed to happen half-way between a solid and fluid node. Hence, the unknown distribution function is calculated as: fk̄ (x f1 , tn+1 ) = f˜k (x f1 , tn ). (8) fk after where we recall that k̄ is the diametrically opposite direction to k, and we take the values e collision but before streaming on the right hand side. However, in complex geometries, the wall position is not always located half-way on a regular lattice. Hence, especially at coarse resolutions, this boundary treatment introduces severe geometric errors, which in turn lead to boundary layer effects that can be particularly problematic in porous media of low porosity, where large part of the domain is occupied by solid nodes. Here, a discretization that adequately resolve the solid boundaries are often computationally prohibitive since the meshes would get too large. Thus, several advanced schemes have been proposed to more accurately represent boundaries that are not mesh aligned using spatial interpolations [36, 37, 38, 39, 40, 41]. 6 𝑥𝑓3 𝑥𝑓3 𝑥𝑓2 𝑒𝑘 𝑥𝑓2 𝑒𝑘 𝑥𝑓1 𝑥𝑓1 𝑞 < 0.5 𝑞 > 0.5 𝑞 = 0.5 𝑥𝑓3 𝑥𝑓2 𝑥𝑓1 𝑥𝑤 𝑥𝑤 𝑥𝑤 𝑥𝑏 Figure 1: Example of the different position of wall with different value of the q. For simplicity, we only display a two-dimensional illustration. In our numerical study, we compare five different interpolating boundary condition schemes to deal with curved boundaries, namely, the linear interpolation bounce-back (LIBB, [36]), the quadratic extension (QIBB, [40]), the interpolation/extrapolation bounce back (IEBB, [37]), the multi-reflection (MR, [34]) scheme and the central linear interpolation (CLI, [34]) scheme. For the sake of completeness, let us briefly recall these different approaches. Let x fi denote a lattice node which is at a distance of at most i > 0 cells from the boundary and let q = |x f1 − xw |/|x f1 − xb | define a normalized wall distance; cf. Fig. 1. Bounce-back schemes based on higher order interpolations require more than one fluid node between nearby solid surfaces. For instance, the LIBB condition proposed by Bouzidi et al. [36] is given by    − 2q) f˜k (x f2 , tn ) + 2q f˜k (x f1 , tn ), q < 1/2, (1   (9) fk̄ (x f1 , tn+1 ) =  1 ˜ 1   1 − 2q f˜k̄ (x f1 , tn ) + 2q fk (x f1 , tn ), q ≥ 1/2. One can also use quadratic interpolation to obtain the QIBB scheme [36, 40], where the unknown distribution function would be calculated as:    + 2q) f˜k (x f1 , tn ) + (1 − 4q2 ) f˜k (x f2 , tn ) − q(1 − 2q) f˜k (x f3 , tn ), q < 1/2, q(1  2q−1  fk̄ (x f1 , tn+1 ) =  (10)   f˜ (x , t ) + 1 f˜ (x , t ) + 1−2q f˜ (x , t ), q ≥ 1/2. q k̄ f1 n q(2q+1) k f1 n 2q+1 k̄ f2 n While the use of extrapolation is also possible to obtain better accuracy. However, care must be taken to preserve numerical stability[37]. An interpolation/extrapolation bounce-back (IEBB) model was proposed by Mei et al. [37] as an improvement to the scheme of Filippova and Hänel [42], where a velocity at the wall is computed via    q < 1/2, u x f2 ,  ubf =  3   1 − 2q u x f1 , q ≥ 1/2. to determine an auxiliary distribution function n h fk∗ (xb , tn ) = wk ∆ρ + ρ0 c32 ek · ubf + 9 (e 2c4 k · u x f1 ) 2 − 3 u 2c2 x f1 · u x f1 io , (11) which is then used to linearly interpolate the unknown as: fk̄ (x f1 , tn+1 ) = (1 − X) f˜k (x f1 , tn ) + X fk∗ (xb , tn ). 7 (12) Above we let X = (2q − 1)/(1/ω − 2) for q < 12 , while for q ≥ 12 we let X = (2q − 1)/(1/ω + 1/2), where we set ω = ω+ in case of the TRT scheme and ω = sν in case of the MRT scheme. Another alternative approach to obtain highly accurate bounce-back conditions is the multireflection (MR) scheme [38, 34], which reads as fk̄ (x f1 , tn+1 ) = 1−2q−2q2 ˜ f (x , t ) (1+2q)2 k f2 n − + 1−2q−2q2 ˜ f (x , t ) (1+2q)2 k̄ f1 n q2 f˜ (x , t ) (1+q)2 k f3 n − q2 f˜ (x , t ) (1+q)2 k̄ f2 n + f˜k (x f1 , tn ). (13) Note that this scheme needs to access five distribution values at three fluid nodes for the update. A computationally cheaper variant is given by the central linear interpolation scheme (CLI) that only needs three values at two fluid nodes, i.e., fk̄ (x f1 , tn+1 ) = 1−2q ˜ 1+2q fk (x f2 , tn ) − 1−2q ˜ 1+2q fk̄ (x f1 , tn ) + f˜k (x f1 , tn ). (14) It should be noted that two latter schemes do not involve a distinction of cases for different values of q which allows for an efficient implementation. The CLI and MR schemes can be modified with a post collision correction fkpc to remove the second order error for steady flows. The correction term is constructed based on anti-symmetric non-equilibrium of the TRT and MRT collision operators. However, since the correction is not suitable for unsteady flow, we do not consider it in this study. Interested readers are referred to the work of [34, 32, 20]. 2.2.2. Periodic pressure boundary condition In many applications, fluid flow is driven by a pressure difference. For incompressible flow, the corresponding periodicity boundary conditions can be written as u(x + L i, t) = u(x, t), p(x + L i, t) = p(x, t) + ∆p, (15) where L is the length of the domain in the periodic direction i, and ∆p/L is the pressure gradient applied between the inlet and outlet boundaries of the domain. In LBM-based approaches, applying this type of boundary condition is not straightforward. Simply adjusting the corresponding pressures at the inlet and outlet boundaries produces nonphysical mass defects at the periodic boundary, as was reported e.g. for Poisseulle flow in Dupuis [43]. The most commonly employed approaches replace the pressure gradient by incorporating an equivalent body force; see e.g. [44, 45, 46, 47, 48]. However, these approaches suffer from the inability to predict the pressure gradient accurately for flow situations in general geometries [21, 22, 23, 24]. For porous media applications, where we face complex pore geometries it is therefore desirable to have a boundary condition that is not lumped into a volume forcing and hence does not rely on rough predictions of the pressure field. In this work, we employ a pressure boundary condition which can be applied for incompressible periodic flows. Here we specify the equilibrium eq neq eq distribution function fi and the non-equilibrium distribution fi = fi − fi separately, as we shall describe below. As the extension to multiple periodic boundaries is straightforward, we consider in our description an essentially one-dimensional setting in which flow propagates from the left (L) to the right (R) boundary: Since the pressure is related to the density via the equation of state p = ρc2s , we consider a density difference instead of pressure difference in the following. The density at the left boundary is obtained by ρL = ρR + ∆ρ. (16) 8 Figure 2: 3D view of simple sphere array with equal radius. Regarding to the relaxation dynamics of the non-equilibrium distribution, in presence of the periodic boundaries, it can be approximated as neq neq fi,L = fi,R . (17) Now by using the above formulations, the unknown distribution functions can be computed as neq eq fi,L = fi,R + fi,R (ρL , uR ), fi,R = neq fi,L + eq fi,L (ρR , uL ). (18) (19) Since the momentum in a periodic channel does not change, the implementation of this approach is simple. For instance, by considering (6), the update (18) and (19) can be performed as: fi,L = fi,R + wk ∆ρ, (20) fi,R = fi,L − wk ∆ρ. (21) 3. Pore-scale simulation at Re  1 To verify the implementation and to assess the quality of the different schemes before tackling more complex flow problems, we shall in the following first evaluate different combinations of the LBM strategies discussed in section 2 in the Darcy regime, and compare the results with a semi-analytic solution. We consider flow through a periodic array of spheres arranged on a regular lattice as depicted in Fig. 2. To quantify the errors, we compute the dimensionless drag coefficient CD = FD , 6πµUr (22) where r is the sphere radius, and F D is the drag force acting on the sphere. A semi-analytical reference solution C D,ref can be derived as a function of the porosity by a series expansion; for details on the calculation, we refer to [49]. To save on computational cost we compute the wall-distances required for the higher order boundary conditions only once before the time-stepping loop starts and reuse it in each boundary handling step. This can be done since we consider a non-deformable porous medium. Moreover, 9 |CD/CDref -1| 10 -3 10 -4 10-5 N -3 SBB LIBB QIBB IEBB MR CLI 4 5 6 7 8 9 101112 Radius 10-2 10 -3 10 -4 10-5 (a) SRT 100 N-1 N 10-1 |CD/CDref -1| N 10-1 10-2 100 N-1 -2 N -2 -3 N-1 N-2 10-1 |CD/CDref -1| 100 10-2 10 N -3 -3 10-4 4 5 6 7 8 9 101112 Radius (b) TRT 10-5 4 5 6 7 8 9 101112 Radius (c) MRT Figure 3: Logarithmic relative error of the dimensionless drag, |C D /C D,ref − 1| as a function of the sphere radius (in lattice units) for different boundary schemes and collision operators. we exploit the periodicity in the domain and consider only one cubic representative elementary volume (REV) containing a single sphere. For details on the boundary handling, we refer to the previous section 2.2. In the following, we shall summarize our results related to the undesired effect of viscositydependence of the schemes. However, to make sure that the measured errors are not resulting from other approximation issues, and to compare the accuracy in terms of resolution which can be obtained by the different schemes, we shall first conduct a grid-convergence study. 3.1. Evaluation of the grid-dependence In this test, we change the size of the sphere and increase the computational domain accordingly, such that the relative solid volume fraction is fixed to χ = 0.6. We compute the dimensionless drag force C D and consider the relative error |C D /C Dre f − 1|. At the resolution where this quantity drops below 1% and stays below this limit on finer lattices, we call the result grid-independent. Our results are plotted in Fig. 3. It can be seen that using higher order boundary conditions generally increases the accuracy of the computed drag force. As Fig. 3(a) indicates, all of the interpolation boundary schemes have second-order accuracy when combined with the SRT model. Moreover, for this example, we observe that the linear interpolation models, i.e., LIBB and CLI, show higher accuracy than the other schemes. For the CLI scheme for instance, we reach a grid-independent solution at r = 8.7 in lattice unit. In Figures 3(b) and 3(c), we list the results for the TRT and MRT models, respectively. Here we observe a difference between the CLI and the MR schemes, i.e., the CLI scheme converges with second-order while the MR scheme converges with third-order. The results also exhibit that the IEBB scheme converges with at least second order. For the TRT model, the results for the IEBB scheme becomes grid-independent for r = 4.5, the MR with r = 5.1 and the CLI with r = 5.7. The MRT scheme also shows better accuracy than the SRT collision model but it is found to converge slower than the TRT model, which is additionally considerably less expensive in terms of computational effort. It is worth to mention here that the simulation results using the TRT and MRT collision can be different by changing the magic number. This is why the SBB scheme in the SRT collision gives better results than the TRT and MRT collision in this specific test for which the magic number is set to 1/4 in which the interpolation boundary schemes results in better accuracy. 10 |CD/CDref-1| 0.05 0 -0.05 0.1 0.1 0.05 0.05 |CD/CDref-1| SBB LIBB QIBB IEBB MR CLI |CD/CDref-1| 0.1 0 -0.05 -0.1 0 -0.05 -0.1 -0.1 -0.15 0 0.1 0.2 0.3 0.4 0.5 Displacement of the sphere center -0.15 0 0.1 0.2 0.3 0.4 0.5 Displacement of the sphere center -0.15 0 0.1 0.2 0.3 0.4 0.5 Displacement of the sphere center (a) SRT (b) TRT (c) MRT Figure 4: Relative error of the drag force C D /C D,ref − 1 as a function of the sphere displacement (in lattice units) for different boundary schemes and collision operators for r = 4.5. In these experiments we also observe that the errors for most models do not smoothly decrease with respect to the resolution. Comparing for instance the linear LIBB model with the quadratic QIBB model reveals that the higher order scheme is less affected by this phenomenon. To investigate the source of these fluctuations, we conduct a second series of tests where the center of the sphere is shifted streamwise inside the cell. In all cases, the radius of the sphere is kept fixed at 4.5 lattice units and the relative volume fraction is again set to χ = 0.6. In Fig. 4, we show the results for a displacement of 0.0 − 0.5 times a cell width. Although the results obtained by the SRT-SBB are relatively good for this setup, we observe that the SBB scheme is for all considered collision schemes more sensitive with respect to the positioning of the center. Since this behavior stems only from the geometry representation, the use of interpolation models significantly increases the reliability of the results. 3.2. Effect of the viscosity on the computed permeability As a number of authors previously reported, the choice of boundary conditions and collision models may have a strong impact on the simulation accuracy [20, 29, 17, 50]. To exclude preasymptotic discretization error modes from our observations and only concentrate on the physical inconsistencies introduced by a specific combination of collision and boundary treatment, we use a sufficient resolution of 16.5 (in lattice units) for the sphere radius. Since the permeability in the Darcy regime is only a geometrical characteristic, it is used for comparison in this study. As proposed by Adler [51], we compute the average pressure gradient in the flow direction as ∇P · i = −F D L−3 , where L is again the length of the domain in flow direction. By combining this and (22) with (1), we find the reference permeability Kref which we use as a reference. The plots of Fig. 5 display the ratio K/Kref of the computed permeability by the reference permeability for a simple sphere pack with a relative solid volume fraction of χ = 0.6. We consider viscosities in the range [0.029, 0.45] and compare different collision models and boundary conditions. In Fig. 5(a) we show that for all boundary schemes, the SRT collision results in a permeability that is strongly depending on the viscosity. While the IEBB scheme is less sensitive than the other schemes, the errors we can expect from an SRT collision model are still unacceptable for our purposes. The results of Figures 5(b) and 5(c) depict the same set of experiments conducted with the TRT and MRT models, respectively. In these plots, we observe that the SBB, the IEBB, as well as the MR, and the CLI schemes are nearly viscosity independent. However, the SBB severely under-predicts the permeability due to its staircase representation of the geometry. These 11 1.04 1.04 1.02 1.02 1.02 K/Kref K/Kref 0.98 0.98 K/Kref 1.04 1 SBB LIBB QIBB IEBB MR CLI 0.98 0.96 0.1 0.2 0.3 Viscosity 0.4 1 1 0.96 0.96 0.1 (a) SRT 0.2 0.3 Viscosity (b) TRT 0.4 0.1 0.2 0.3 Viscosity 0.4 (c) MRT Figure 5: Viscosity dependence of the permeability for the solid volume fraction of 0.6. The results represents the normalized permeability as K/Kre f for different boundary conditions. results are in line with those found in the related work of Pan et al. [20]. When comparing only the two linear boundary schemes, namely, the CLI and the LIBB, we observe that the LIBB fails to produce viscosity-independent results with all collision models under consideration, while the CLI has much better properties in this respect. 3.3. Evaluation of the computational cost Our results obtained in section 3.2 and 3.1 indicate that the TRT and MRT collision operators in combination with the MR boundary scheme results in the most accurate solutions. Given that the highly optimized split kernel of the TRT implementation in waLBerla is about as fast as the SRT model, there is no justification to use the MRT scheme, which is around a factor of two more expensive. While the question about the favorable collision operator is rather easy to answer, the choice of the right boundary treatment is less obvious. Note, that especially for a DNS of turbulent flow, where we have to scale the number of unknowns as Re9/4 to resolve the smallest dissipative scales, we cannot avoid massive parallelism. Unfortunately, the more accurate boundary handling methods must access LBM nodes from up to three cells away from the fluid particle boundary, see Sect. 2.2. In a massively parallel setting, such physical boundary points may be near a logical processor boundary that has been created by the domain partitioning for a distributed memory machine. In waLBerla this situation is handled by extra ghost-layer exchanges, i.e. by communicating an extended set of distribution functions to neighboring processors along the subdomain boundaries. The data dependencies also cause additional synchronization overhead in the parallel execution. In a weak scaling scenario with few spheres embedded in the flow and where large subdomains can be handled on each processor, we have measured that the more advanced boundary schemes may already cause a slowdown of by 10% to 50% compared to the SBB method. However, for our computational objectives, more complex geometric configurations must be considered. Then the communication of data quickly becomes the critical bottleneck. For our application, it is particularly important to save on communication since for production runs many timesteps are necessary until the desired solution is found. Thus, to keep the compute times acceptable, only moderately large blocks of LBM nodes can be assigned to each processor. Consequently, the ratio between computation and communication is already a bottleneck despite 12 the highly optimized waLBerla program and even when just one layer of ghost nodes is exchanged in every time step. This means that our typical simulation runs are already close to the strong scaling limit of the parallel execution, as analyzed in [16]. As a good compromise between the cost (including communication on parallel computers) and numerical accuracy, we choose here the TRT-CLI scheme for large pore-scale problems. It leads to a reasonably good accuracy, has no viscosity-dependence, and needs less communication than the MR scheme. Hence, using the slightly less accurate but significantly better parallelizable method results in a considerable reduction of run-time. A more concise quantitative analysis of the performance trade offs, will require the development of sophisticated parallel performance models following the techniques of Godenschwager et al. [16], but this is beyond the scope of the current paper. Godenschwager et al. [16] already presents program optimization for LBM simulations in the case of simple boundary conditions, as they are being used in the waLBerla software framework. 4. Pore-scale simulation at Re > 1 In this section, we present a series of pore-scale simulations for a Reynolds number ranging over more than seven orders of magnitude, i.e., Re p ∈ [10−4 , 5.812 · 103 ]. We conduct a direct numerical simulation through the simple sphere pack using the periodic-pressure boundary treatment combined with the TRT-CLI scheme. To avoid grid-dependencies as well as instabilities resulting from under-resolved turbulence, we conduct a grid-independence study for six different Reynolds number ranges. We investigate the dependency of the drag coefficient, i.e. F D /ρAU 2 while A represents the cross sectional area, on the resolution. To keep the Re number of the flow the same, we adjust the pressure drop, as well as the viscosity while changing the resolution. In Table 1, we list the resulting resolutions which were identified as sufficiently resolved for our purposes. Also, the magic Λ value is shown for different flow regimes. We consider a solution as converged if the computed time-averaged drag coefficient stops changing. The averaging will be started when the flow is developed, which usually takes around 400–600 flow-through times to happen. Table 1: The resolution and Λ value which are chosen for different range of the Re p numbers range Re p ≤ 0.01 0.01 < Re p ≤ 198 198 < Re p ≤ 509 509 < Re p ≤ 1008 1008 < Re p ≤ 1617 1617 < Re p ≤ 5813 D/∆x 23.4 37.8 59.4 70.2 102.6 145.8 Λ 1/4 3/16 1/12 10−5 10−5 6 × 10−6 Fig. 6 depicts the streamlines that are plotted in two perpendicular planes based on an instantaneous velocity field at a dimensionless time t∗ = t × ν/D2 = 8.88 . The plots are presented in three views of side, top and stream-wise views, respectively. Fig. 6(a) presents side view of the streamlines of the simulation in Re < 1. We can observe the development of steady boundary layers near the solid boundaries and symmetric streamlines before and after the sphere. This behavior can be observed from the other views as well. Fig. 6(c) shows that the streamlines that are plotted on the XY and XZ planes stick to the plane. 13 As the Reynolds number increases, we can see the onset of inertial effects caused by the acceleration and deceleration of the fluid passing through the pores. In Fig. 6(d), we see that small vortices start to form in front of the sphere and some larger ones behind the sphere. In this regime, the form drag is added to the viscous drag which increases the head loss. A further increase of the flow rate yields that these two types of vortices join to an even larger vortex occupying the distance between two spheres, which results in a lower flow capacity; cf. Fig. 6(g). The flow regime is still laminar and steady. (a) Re p = 0.01, XY (b) Re p = 0.01, XZ (c) Re p = 0.01, YZ (d) Re p = 46, XY (e) Re p = 46, XZ (f) Re p = 46, YZ (g) Re p = 79, XY (h) Re p = 79, XZ (i) Re p = 79, YZ Figure 6: Streamlines of the time-averaged flow through the simple sphere pack for linear and nonlinear steady flow at X = 0.6 with Re p = 0.01, 46, 79. The acceleration/deceleration effects described above are the dominant phenomenona until the flow starts to fluctuate. As we can see in Fig. 7(a), at around Re p = 180 the flow is still laminar, but the symmetry breaks and the flow becomes unsteady. We can see the flow separation behind the sphere and the boundary layer interaction that causes energy dissipation in the unsteady 14 (a) Re p = 183 (b) Re p = 509 (c) Re p = 762 (d) Re p = 1008 (e) Re p = 3880 (f) Re p = 5812 Figure 7: Velocity field of the flow through the simple sphere pack for non-linear flow at X = 0.6 with Re p = 183, 509, 762, 1008, 3880, 5812,. laminar flow regime. This is in line with the observations of previous studies, where the onset of fluctuations is reported between Re p = 110 and Re p = 250 for different porous media [6]. However, the starting Reynolds number of the fluctuation strongly depends on the porosity, the 15 arrangement of the packing and the size of the spheres. By further increasing the Reynolds number of the flow, we observe the onset of turbulent chaotic behavior; cf. Fig. 7(b) and 7(c). The flow is in the transition regime from the laminar unsteady flow to turbulent flow. We can also observe smaller vortices that can pass through the pores and thereby increase the non-linear effects. Increasing the Reynolds number of the flow even further, we can see turbulent flow behavior. Fig. 7(e) and 7(f) are showing a strongly chaotic flow field and random behavior. Based on the above mentioned results of the pore scale simulation, we compute the Forchheimer constant C F , using equation (2) and also the normalized apparent permeability by the Darcy permeability as defined by Barree–Conway model (3), i.e., Kapp , (23) KD where Kapp is determined using the one-dimensional equivalent of Darcy’s law (1) by means of a spatially and temporally averaged velocity. The temporal averaging starts after the drag force acting on the sphere is converged. Once converged, we average the volume averaged velocity for a period of 100–150 flow through times. Our results are presented in Fig. 8 for the whole range of Reynolds numbers considered in this study. In the left figure, we compare our results to a best fit with respect to the Barree–Conway model, obtained for Reynolds numbers up to Re p = 1 000. We see that the results can be fitted well to the model equations which agrees with the experimental validations reported in [4, 6, 7]. However, for higher Reynolds numbers, we observe a significant deviation from the plateau region that is predicted by the model. It indicates that, while the model of Barree–Conway can be adjusted well to flow simulations in the range up to Re p = 1 000, it lacks enough degrees of freedom to model flow beyond that range. Including the additional data for high Reynolds numbers increases the fitting error in the low Reynolds regime, where the model has been validated by previous studies of various authors. Based on our observations, we moreover conclude that Kmin in the model does not have the physical meaning of a minimal permeability that is attained in the high Reynolds limit. It should rather be referred to as a free model parameter that can be chosen to fit the curves for a porous medium at hand in the regime Re p < 1 000. The right plot of Fig. 8 depicts that the value of C F strongly depends on the Reynolds number, which is in line with the experimental results of Bağcı et al. [5] who stated that the β factors have to be chosen differently for different flow regimes. However, it can be seen that two approximately constant values can be considered for laminar and turbulent flow. In our setup these are 0.0078 for 8 < Re < 79 and 0.023 for 762 < Re < 5812, respectively. The former is the non-linear laminar, the latter is for the turbulent regime. A non-dimensional form of equation (2) can be provided in form of a friction factor, i.e., K ∗ := 1 + F, (24) ReK √ √ where F K = (∆p/L) KD /ρU 2 , and ReK = ρU KD /µ. Fig. 9 presents the results of the friction factor for different Reynolds numbers. As it can be seen, for ReK < 1 the results are inversely proportional to ReK which is the typical behavior of the friction factor. The deviation starts at ReK = 5 (Re p = 20) which is the inertial regime of the flow. The transition regime from unsteady flow to chaotic flow is 70 < ReK < 110 (180 < Re p < 300). By further increasing the Reynolds number, we can see the turbulent flow regime in which the friction factor converges to nearly a constant value which depends on the porous geometry, and in our simulation is 0.026. 16 FK = 100 10-1 10 Present study Barree&Conway model Laminar -1 CF K*=Kapp/KD Turbulent 10 CF = 0.023 -2 CF = 0.0078 k*=0.044+(1-0.044)/(1+(ReP/512)1.521)2.157) 10-2 -2 -1 0 1 2 3 10 10 10 10 10 10 ReP 10-3 0 10 101 102 ReP 103 104 Figure 8: Normalized permeability (K ∗ , left) and Forchheimer constant (C F , right) for pressure-driven flow with different Reynolds numbers through the simple sphere pack. Rep FK 10-2 10-1 100 101 102 103 10 2 10 1 Present study 1/ReK 0.026 100 10-1 10-2 10-3 10-2 10-1 100 101 102 103 ReK Figure 9: Permeability-based friction factor versus permeability-based Reynolds numbers and particle diameter-based Reynolds numbers. 17 5. Turbulent flow over a porous bed By using the results of the evaluation which is presented in the previous sections, we provide a pore-scale simulation for semi-realistic porous structure consisting several spherical particles. To construct a semi-real porous structure, our in-house physics engine framework [52, 53] is used to simulate the rigid body interaction between spherical bodies. In this simulation, several spherical particles with different size are configured such that they fall down due to the gravity and onto the bed. After the particles come to rest, the geometry is imported as a permeable bed in the waLBerla framework for fluid flow simulation. To resolve all scales, the porous media part of the domain is refined using three different levels of refinement. Periodic boundary conditions have been used in the stream-wise and span-wise direction while the top boundary is free surface. We apply the TRT model of collision and the CLI scheme for wall boundary condition. The simulation is executed on the LIMA supercomputer, with 64 nodes and 24 cores on each node. With this configuration it roughly takes 24 hours of computation for the whole simulation for a spatial resolution of 9 × 107 cells. Fig. 10 shows the contours of the flow velocity of the simulation after 5 × 106 timesteps. The block structure used in waLBerla is shown on the left hand side of the figure to indicate the static refinement of the meshes. The grids are also displayed on the right hand side of the contour to show the grid resolution. We point out that the results are stored after coarsening the grids throughout the domain by a factor of 8 to keep the size of the resulting outputs reasonable for post-processing and visualization. 6. Conclusion In this article, the Lattice Boltzmann method is used to realize methods to simulate the flow through periodic and random sphere packs for a large range of Reynolds numbers. The article studies different collision operators and different types of boundary conditions. A new periodic pressure boundary condition has been developed to drive the flow. While the SRT collision operator produces a viscosity dependent permeability that affects the accuracy of porous flow simulations, the MRT model reduces the viscosity dependency of the results significantly. However, the TRT collision model in combination with the MR or CLI boundary model can also lead to accurate viscosity-independent results and is computationally cheaper as the MRT scheme. The grid independence for low Reynolds numbers is verified by computing the drag force and permeability as compared to the analytic solution for different sizes of the spheres. The results indicate that using the CLI combined with the TRT leads to good accuracy in both evaluation criteria. Since the TRT in its optimized version results in a run-time similar the SRT collision model, and since using the MRT for low Reynolds number flow does not improve the accuracy significantly, the TRT collision model is used in the remainder of the article. Considering the accuracy versus computational cost in a massively parallel setting indicates that the CLI boundary scheme is a favorable compromise choice. The results for the permeability shows that, contrary to the Barree–Conway model, no plateau area for the permeability can be observed at high Reynolds number. Although these results show a change from concave downward to convex upward in the transition between the laminar unsteady flow and the turbulent flow, it decreases by increasing the Reynolds number which is in line with the theory derived from the Navier-Stokes equation. Considering the Forchheimer model for high Reynolds number flow, it is shown that two different values can be considered for laminar and turbulent regimes of the flow. Also the results show good agreement with the friction factor 18 Figure 10: Turbulent flow over a porous bed, left to right, the block structure, velocity contour and the grids, respectively. 19 models. Different flow regimes can be found for different Reynolds numbers when the square root of the permeability is considered as the characteristic length scale. The results demonstrate that the flow regimes can be defined as, creeping flow, laminar steady, laminar unsteady, chaotic flow and turbulent flow. Acknowledgement Financial support from the German Research Foundation (DFG, Project WO 671/11-1) and also the International Graduate School of Science and Engineering (IGSSE) of the Technische Universität München for research training group 6.03 are gratefully acknowledged. Our special thank goes to Simon Bogner and Dominik Bartuschat for many fruitful discussions and the waLBerla primary authors Florian Schornbaum, Christian Godenschwager and Martin Bauer for their essential help with implementing the code. Ulrich Rüde wishes to thank the Institute of Mathematical Sciences at National University of Singapore where part of this work was conducted. References [1] H. Darcy, Recherches expérimentales relatives au mouvement de l’eau dans les tuyaux, Mallet-Bachelier, Paris (1857). [2] P. Forchheimer, Wasserbewegung durch Boden, Z. Ver. Deutsch. Ing 45 (1901) 1782–1788. [3] J. Lage, The fundamental theory of flow through permeable niedia from darcy to turbulence, Transport phenomena in porous media (1998) 1. [4] R. Barree, M. Conway, Beyond beta factors: a complete model for Darcy, Forchheimer and Trans-Forchheimer flow in porous media, in: SPE Annual Technical Conference and Exhibition held in Houston Texas, September 2004, Society of Petroleum Engineers, 2004, pp. 1–8. SPE paper no. 89325. [5] O. Bağcı, N. Dukhan, M. Özdemir, Flow regimes in packed beds of spheres from pre-Darcy to turbulent, Transport in Porous Media 104 (2014) 501–520. [6] H. Lopez-Hernandez, Experimental Analysis and Macroscopic and Pore-level Flow Simulations to Compare NonDarcy Flow Models in Porous Media, Ph.D. thesis, Colorado School of Mines. Department of Petroleum Engineering, 2007. [7] B. Lai, J. L. Miskimins, Y.-S. Wu, Non-Darcy porous-media flow according to the Barree and Conway model: Laboratory and numerical-modeling studies, in: Society of Petroleum Engineers, pp. 70 –79. [8] S. Whitaker, Flow in porous media I: A theoretical derivation of Darcy’s law, Transport in porous media 1 (1986) 3–25. [9] S. Whitaker, The Forchheimer equation: a theoretical development, Transport in Porous media 25 (1996) 27–61. [10] M. Singh, K. Mohanty, Permeability of spatially correlated porous media, Chemical Engineering Science 55 (2000) 5393 – 5403. [11] J. Bernsdorf, G. Brenner, F. Durst, Numerical analysis of the pressure drop in porous media flow with lattice Boltzmann (BGK) automata, Computer Physics Communications 129 (2000) 247 – 255. [12] J. Kim, J. Lee, K.-C. Lee, Nonlinear correction to Darcy’s law for a flow through periodic arrays of elliptic cylinders, Physica A: Statistical Mechanics and its Applications 293 (2001) 13 – 20. [13] A. Peters, S. Melchionna, E. Kaxiras, J. Lätt, J. Sircar, M. Bernaschi, M. Bison, S. Succi, Multiscale simulation of cardiovascular flows on the IBM Bluegene/P: Full heart-circulation system at red-blood cell resolution, in: Proceedings of the 2010 ACM/IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, IEEE Computer Society, Washington DC, USA, 2010, pp. 1–10. [14] M. Schönherr, K. Kucher, M. Geier, M. Stiebler, S. Freudiger, M. Krafczyk, Multi-thread implementations of the lattice Boltzmann method on non-uniform grids for CPUs and GPUs, Computers and Mathematics with Applications 61 (2011) 3730–3743. [15] C. Feichtinger, S. Donath, H. Köstler, J. Götz, U. Rüde, WaLBerla: HPC software design for computational engineering simulations, Journal of Computational Science 2 (2011) 105 – 112. Simulation Software for Supercomputers. [16] C. Godenschwager, F. Schornbaum, M. Bauer, H. Köstler, U. Rüde, A framework for hybrid parallel flow simulations with a trillion cells in complex geometries, in: Proceedings of SC13: International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’13, ACM, New York, NY, USA, 2013, pp. 35:1–35:12. 20 [17] S. Bogner, S. Mohanty, U. Rüde, Drag correlation for dilute and moderately dense fluid-particle systems using the lattice Boltzmann method, International Journal of Multiphase Flow 68 (2015) 71 – 79. [18] J. Götz, K. Iglberger, M. Stürmer, U. Rüde, Direct numerical simulation of particulate flows on 294912 processor cores, in: Proceedings of the 2010 ACM/IEEE International Conference for High Performance Computing, Networking, Storage and Analysis, SC ’10, IEEE Computer Society, Washington, DC, USA, 2010, pp. 1–11. [19] D. Bartuschat, D. Ritter, U. Rüde, Parallel multigrid for electrokinetic simulation in particle-fluid flows, in: High Performance Computing and Simulation (HPCS), 2012 International Conference on, pp. 374 –380. [20] C. Pan, L.-S. Luo, C. T. Miller, An evaluation of lattice Boltzmann schemes for porous medium flow simulation, Computers and Fluids 35 (2006) 898 – 909. [21] S. Chen, G. D. Doolen, Lattice Boltzmann method for fluid flows, Annual Review of Fluid Mechanics 30 (1998) 329–364. [22] J. Zhang, D. Y. Kwok, Pressure boundary condition of the lattice Boltzmann method for fully developed periodic flows, Phys. Rev. E 73 (2006) 047702. [23] S. H. Kim, H. Pitsch, A generalized periodic boundary condition for lattice Boltzmann method simulation of a pressure driven flow in a periodic geometry, Physics of Fluids 19 (2007) –. [24] O. Gräser, A. Grimm, Adaptive generalized periodic boundary conditions for lattice Boltzmann simulations of pressure-driven flows through confined repetitive geometries, Phys. Rev. E 82 (2010) 016702. [25] R. Benzi, S. Succi, M. Vergassola, The lattice Boltzmann equation: theory and applications, Physics Reports 222 (1992) 145–197. [26] S. Succi, The Lattice-Boltzmann Equation, Oxford university press, Oxford, 2001. [27] P. L. Bhatnagar, E. P. Gross, M. Krook, A model for collision processes in gases. i. small amplitude processes in charged and neutral one-component systems, Phys. Rev. 94 (1954) 511–525. [28] X. He, L.-S. Luo, Lattice Boltzmann model for the incompressible Navier–Stokes equation, Journal of Statistical Physics 88 (1997) 927–944. [29] I. Ginzburg, Consistent lattice Boltzmann schemes for the Brinkman model of porous flow and infinite ChapmanEnskog expansion, Phys. Rev. E 77 (2008) 066704. [30] I. Ginzburg, P. M. Adler, Boundary flow condition analysis for the three-dimensional lattice Boltzmann model, J. Phys. II France 4 (1994) 191–214. [31] D. d’Humières, Multiple–relaxation–time lattice Boltzmann models in three dimensions, Philosophical Transactions of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences 360 (2002) 437–451. [32] S. Khirevich, I. Ginzburg, U. Tallarek, Coarse-and fine-grid numerical behavior of MRT/TRT lattice Boltzmann schemes in regular and random sphere packings, Journal of Computational Physics 281 (2015) 708–742. [33] I. Ginzburg, Lattice Boltzmann modeling with discontinuous collision components: Hydrodynamic and advectiondiffusion equations, Journal of Statistical Physics 126 (2007) 157–206. [34] I. Ginzburg, F. Verhaeghe, D. d’Humières, Two-Relaxation-Time lattice Boltzmann Scheme: About Parametrization, Velocity, Pressure and Mixed Boundary Conditions, Commun. Comput. Phys. 3 (2008) 427+. [35] I. Ginzburg, F. Verhaeghe, D. d’Humières, Study of simple hydrodynamic solutions with the two-relaxation-times lattice-Boltzmann scheme, Communications in Computational Physics 3 (2008) 519+. [36] M. Bouzidi, M. Firdaouss, P. Lallemand, Momentum transfer of a Boltzmann-lattice fluid with boundaries, Physics of Fluids (1994-present) 13 (2001) 3452–3459. [37] R. Mei, W. Shyy, D. Yu, L.-S. Luo, Lattice Boltzmann method for 3-D flows with curved boundary, Journal of Computational Physics 161 (2000) 680 – 699. [38] I. Ginzburg, D. d’Humières, Multireflection boundary conditions for lattice Boltzmann models, Physical Review E 12 (2003) 666–614. [39] D. Yu, R. Mei, L.-S. Luo, W. Shyy, Viscous flow computations with the method of lattice Boltzmann equation, Progress in Aerospace Sciences 39 (2003) 329 – 367. [40] P. Lallemand, L.-S. Luo, Lattice Boltzmann method for moving boundaries, Journal of Computational Physics 184 (2003) 406 – 421. [41] B. Chun, A. J. C. Ladd, Interpolated boundary condition for lattice Boltzmann simulations of flows in narrow gaps, Phys. Rev. E 75 (2007) 066705. [42] O. Filippova, D. Hänel, Grid refinement for lattice-BGK models, J. Comput. Phys. 147 (1998) 219–228. [43] A. Dupuis, From a Lattice Boltzmann model to a parallel and reusable implementation of a virtual river, Ph.D. thesis, University of Geneva, 2002. [44] N. Martys, X. Shan, H. Chen, Evaluation of the external force term in the discrete Boltzmann equation, Phys. Rev. E 58 (1998) 6855–6857. [45] J. M. Buick, C. A. Greated, Gravity in a lattice Boltzmann model, Phys. Rev. E 61 (2000) 5307–5320. [46] Z. Guo, C. Zheng, B. Shi, Discrete lattice effects on the forcing term in the lattice Boltzmann method, Phys. Rev. E 65 (2002) 046308. [47] A. Mohamad, A. Kuzmin, A critical evaluation of force term in lattice Boltzmann method, natural convection 21 problem, International Journal of Heat and Mass Transfer 53 (2010) 990 – 996. [48] H. Huang, M. Krafczyk, X. Lu, Forcing term in single-phase and shan-chen-type multiphase lattice Boltzmann models, Phys. Rev. E 84 (2011) 046710. [49] A. Sangani, A. Acrivos, Slow flow through a periodic array of spheres, International Journal of Multiphase Flow 8 (1982) 343 – 360. [50] D. Bartuschat, U. Rüde, Parallel multiphysics simulations of charged particles in microfluidic flows, Journal of Computational Science 8 (2015) 1 – 19. [51] P. M. Adler, Porous media : geometry and transports, Butterworth-Heinemann Limited, 1992. [52] K. Iglberger, U. Rüde, Massively parallel rigid body dynamics simulations, Computer Science-Research and Development 23 (2009) 159–167. [53] T. Preclik, U. Rüde, Ultrascale simulations of non-smooth granular dynamics, Computational Particle Mechanics (2015) 1–24. 22
5cs.CE
FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP arXiv:1609.04077v2 [math.GR] 29 Sep 2016 YUNXIANG REN Abstract. Jones introduced unitary representations of Thompson group F constructed from a given subfactor planar algebra, and all unoriented links arise as matrix coefficients of these ~ which is representations. Moreover, all oriented links arise as matrix coefficients of a subgroup F ~ and showed the stabilizer of a certain vector. Later Golan and Sapir determined the subgroup F many interesting properties. In this paper, we investigate into a large class of groups which arises as subgroups of Thompson group F and reveal the relation between the skein theory of the subfactor planar algebra and the presentation of subgroup related to the corresponding unitary representation. Specifically, we answer a question by Jones about the 3-colorable subgroup. 1. introduction Jones initiated the modern theory of subfactors to study quantum symmetry [Jon83]. The standard invariant of a subfactor is the lattice of higher relative commutants of the Jones tower. A deep theorem of Popa says the standard invariants completely classify strongly amenable subfactors [Pop94]. In particular, the A, D, E classification of subfactors up to index 4 is a quantum analog of Mckay correspondence. Moreover, Popa introduced standard λ-lattices as an axiomatization of the standard invariant [Pop95], which completes Ocneanu’s axiomatization for finite depth subfactors [Ocn88]. Jones introduced (subfactor) planar algebras as an axiomatization of the standard invariant of subfactors, which capture its ulterior topological properties. He suggested studying planar algebras by skein theory, a presentation theory which allows one to completely describe the entire planar algebra in terms of generators and relations, both algebraic and topological. An m-box generator for a planar algebra is usually represented by a 2m-valent labeled vertex in a disc, with a choice of alternating shading of the planar regions. A planar algebra is a representation of fully labeled planar tangles on vector spaces in the flavor of TQFT [Ati88], in the sense that the representation is well defined up to isotopy, and the target vector space only depends on the boundary conditions of diagrams. In particular, diagrams without boundary are mapped to the ground field, yielding a map called the partition function. A planar algebra is called a subfactor planar algebra if its partition function is positive definite. In this case, the vector spaces become Hilbert spaces. A skein theory for a planar algebra is a presentation given in terms of generators and relations, such that the partition function of a closed diagram labeled by the generators can be evaluated using only the prescribed relations. This type of description of a planar algebra is analogous to presentations in combinatorial group theory. With an evaluation algorithm in hand, a skein theory uniquely determines a planar algebra, and therefore one can ask for a skein theoretic classification of planar algebras as suggested by Bisch and Jones [BJ97, BJ03]. Bisch and Jones initiated the classification of planar algebras generated by a single 2-box [BJ97]. Based on the subsequent work of Bisch, Jones and Liu [BJ03, BJL], a classification of singly generated Yang-Baxter relation planar algebra was achieved in [Liub], where a new family of planar algebras was constructed. Planar 1 2 YUNXIANG REN algebras with multiple 2-box generators were discussed in [Liua]. Planar algebras generated by a single 3-box are discussed by C.Jones, Liu, and the author [JLR]. We summarize the conditions of a skein theory for a subfactor planar algebra as follows: • (Evaluation) There exists an evaluation algorithm for diagrams in P0,± and dim Pn,± < ∞. • (Consistency) The evaluation is consistent. • (Positivity) There exists a positive semidefinite trace on P• . In this paper, the main skein theory we use in this paper is the vertical isotopy which is encoded in the definition of isotopy: Definition 1.1 (Vertical isotopy). Suppose X is an (m, n)−tangle and Y is an (k, l)−tangle, then we have X Y Y = X Jones introduced unitary representations for Thompson groups [Jon14] motivated by the idea of constructing a conformal field theory for every finite index subfactor in such a way that the standard invariant of the subfactor, or at least the quantum double, can be recovered from the CFT. Following the idea of block spin renormalization, one can construct a Hilbert space from the initial data of a subfactor planar algebra on which Thompson groups F and T have an action. Due to the intrinsic structure of a subfactor planar algebra, one can obtain unitary representations of F and T . A significant result is that every unoriented link arises as matrix coefficients of these representations of F . Furthermore, all oriented links arise as matrix coefficients of a subgroup F , denoted by F~ , defined as a stabilizer of a certain vector from these representations, which we call the vacuum vector. Golan and Sapir completely determined this subgroup and revealed many interesting properties [GS15]. In particular, they showed that F~ is isomorphic F3 , where the Thompson group FN for N ∈ N with N ≥ 2 is defined as FN ∼ = hx1 , x2 , · · · |x−1 k xn xk = xn+N −1 i. In this paper, we study subgroups of Thompson group F as the stabilizer of the vacuum vector of the unitary representations constructing from subfactor planar algebras. We show that the presentation of these subgroups is encoded with the skein theory of the subfactor planar algebras. In particular, we study a family of subgroups of Thompson group F called singly generated subgroups as an analogy of singly generated planar algebra. Theorem 1.2. The singly generated subgroup with an (1, N )-tangle is isomorphic to FN . In particular, we apply the techniques to answer the question by Jones about the 3-colorable subgroup and have the following theorem: Theorem 1.3. The 3-colorable subgroup is isomorphic to F4 . The paper is organized as follows. In §2 we recall the definition of unitary representation for Thompson group F [Jon14]. In §3 we give the definition of singly generated groups. In §4 we introduce a classical presentation of singly generated groups and prove Theorem 1.2. In §5 we provide examples of singly generated groups: in §5.1 we provide a proof of that F~ ∼ = F3 from the topological viewpoint; in §5.2 we show that the 3-colorable subgroup is isomorphic to F4 . FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 3 2. preliminary We refer readers to [Jon] for details in planar algebras. In this section we recall the construction of unitary representations for Thompson group F [Jon14]. Definition 2.1 (Standard dyadic partition). We say I is  a standard dyadic partition of [0, 1] if for a a+1 each I ∈ I there exists a, p ∈ N such that I = p , p . We denote the set of all standard dyadic 2 2 partitions by D and define I . J for I, J ∈ D if J is a refinement of I. Proposition 2.2. For each g ∈ F , there exists I ∈ D such that g(I) ∈ D and on each I ∈ I the slope of g is a constant. We say such an I is ”good” for g. There is a well known diagrammatic description of Thompson group F [BS14]. For I . J ∈ D, one can use binary a binary forest to represent the inclusion of I in J and I is ”good” for some 1 1 1 1 3 3 g ∈ F . For instance, I = {[0, ], [ , 1]}, J = {[0, ], [ , ], [ , 1]} and g is the function 2 2 2 2 4 4  1   x/2, 0≤x≤   2  1 3 1 g(x) = x − , <x≤  4 2 4    2x − 1, 3 < x ≤ 1 4 J I FJI = gJ = J g(J ) We construct a Hilbert space given a subfactor planar algebra P• [Jon14] [Jon16]. In particular we introduce the following two approaches. Approach 2.3. We start with P• a positive-definite planar algebra with a normalised trivalent vertex S, i.e, S = S∗ For each I ∈ D, we set H(I) = PM (I) , where M (I) is the number of midpoints of the intervals of I and define the inclusion and action as J I TJI = gJ = S J g(J ) 4 YUNXIANG REN Approach 2.4. We start with P• a positive planar algebra with a normalised 2-box R, i.e, R = R∗ For each I ∈ D, we set H(I) = PE(I) , where E(I) is the number of the midpoints and endpoints of intervals of I except 0, 1 and define the inclusion and action as J I TJI = gJ = R J g(J ) In both cases, TJI is an isometry from H(I) to H(J ). Therefore the direct limit of H(I) for I ∈ D is a prehilbert space. We complete the direct limit to obtain a Hilbert space, denoted by HS (or HR ). For each v ∈ H(I) and g ∈ F , let J ∈ D such that I . J and J ”good” for g. We define π : F → B(HS ) (or B(HR )) as π(g)v = gJ TJI (v). From the theory of subfactors, one can show that (π, HR ) or (π, HR ) is a unitary representation for the Thompson group F . Naturally we obtain a subgroup as the stabilizer of the vacuum vector ξ= . Definition 2.5. The subgroup Fξ is defined as Fξ = {g ∈ F |π(g)ξ = ξ} With specific choices of R and S, we obtain the Jones subgroup F~ in §5.1 and the 3-colorable subgroup in §5.2. 3. Singly generated subgroups In this section, we introduce a group motivated by the braid group Bn , n ∈ N. The braid group Bn is the group formed by appropriate isotopy classes of braids with obvious concatenation operation. A preferred set of generators σ1 , σ2 , · · · , σn−1 given by the following pictures: 1 2 i i+1 n One can easily to verify the following relations: σi σi+1 σi = σi+1 σi σi+1 , i = 1, 2, · · · , n − 1 σi σj = σj σi , |i − j| ≥ 2 (1) (2) Relation (1) and (2) give a presentation of Bn was proved by E.Artin. It follows that Bn can be embedded into Bn+1 by restricting the (n + 1)-th string to be a through string. Therefore, one can FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 5 consider the braid group by taking the inductive limit of Bn , n ∈ N. In this case, every element can be interpreted as a diagram in Bn for some n ∈ N with infinitely many through strings on its right side. Definition 3.1. The braid group B∞ is defined as the following B∞ ∼ = hσ1 , σ2 , · · · |σi σi+1 σi = σi+1 σi σi+1 , i = 1, 2, · · · ; σi σj = σj σi , |i − j| ≥ 2i One can think of B∞ as a group generated by a (2, 2)-tangle of . In this section, we consider X groups in this form for an arbitrary (1, N )-tangle group F . which arise as subgroups of Thompson Definition 3.2 (Shifts of X). Let Xk , called the k-shift of X, be an (k + 1, k + N )-tangle defined as follows: Xk = k X where k stands for k through strings on the left. Remark . For each Xk , we identify it as the same diagram with infinitely many strings on the right. Therefore, we define multiplication · of Xm and Xn as stacking the tangle from bottom to top as the multiplication in P• . We denote this set as Alg(X) singly generated by X. Let Alg(X)n to be set of all (1, n)-tangles in Alg(X). Proposition 3.3. For k, n ∈ N with k < n, we have Xn · Xk = Xk · Xn+N −1 (3) Proof. Relation (3) follows from X X n X = k X n+N −1 k  Motivated by the pair of binary trees representation of Thompson group F , we consider the group consisting of the pairs of elements of a certain type from Alg(X). d d Definition 3.4. Let G X = {(T+ , T− ) : T± ∈ Alg(X)n ∀n ∈ N}. We define a relation on GX by (T+ , T− ) ∼ (S+ , S− ) ⇔ ∃R ∈ Alg(X) such that T± = S± · R or S± = T± · R. Proposition 3.5. Suppose T ∈ Alg(X)n , S ∈ Alg(X)m for some n, m ∈ N. There exists P, Q ∈ Alg(X) such that T · P = S · Q. 6 YUNXIANG REN Qk Qn Proof. Set Rk = j=0 XjN an (k + 1, (k + 1)N )-tangle. We consider the elements Cn = j=0 Rj ∈ Alg(X)(n+1)N illustrated as follows: X Cn = X X X X X X X Suppose T ∈ Alg(X)n , there exists k1 ∈ N such that T is a sub diagram of Ck1 , i.e, there exists P1 ∈ Alg(X) such that T · P1 = Ck1 . Similarly we obtain such k2 ∈ N and Q1 ∈ Alg(X) for S ∈ Alg(X)m . Set k = max(k1 , k2 ). If k1 = K2 , then T · P1 = S · Q1 . If k1 6= k2 , then WLOG we assume k1 > k2 . Qk1 Set Q2 = j=k Rj , then 2 +1 T · P1 = Ck1 S · Q1 · Q2 = Ck2 · k1 Y Rj = Ck1 j=k2 +1 Therefore, P = P1 and Q = Q1 · Q2 satisfies the requirement of the proposition.  d f f f f d Corollary 3.6. Suppose (T+ , T− ), (S+ , S− ) ∈ G X , there exists (T+ , T− ), (S+ , S− ) ∈ GX such that f (Tf + , T− ) ∼ (T+ , T− ) (4) f (Sf + , S− ) ∼ (S+ , S− ) (5) f Tf − = S+ (6) Proof. By Proposition 3.5, there exists P, Q ∈ Alg(X) such that T− · P = S+ · Q. We define f f f f f d Tf ± = T± · P and S± = S± · Q. It follows from definitions that (T+ , T− ), (S+ , S− ) ∈ GX satisfy Relations (4), (5) and (6).  Let GX = {(T+ , T− ) : T± ∈ Alg(X)n ∀n ∈ N}/ ∼, where ∼ is the equivalence relation in Definition d 3.4. Suppose g, h ∈ GX , then there exists (T, S), (S, R) ∈ G X such that g = [(T, S)], h = [(S, R)] by Corollary 3.6. Thus we define a binary operation ◦ as g ◦ h = [(T, R)] Theorem 3.7. The binary operation ◦ is well defined on GX and GX is a group with the binary operation ◦. FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 7 e and (S, R) ∼ (S, e R), e then there exists P ∈ Alg(X) such that Proof. Suppose (T, S) ∼ (Te, S) Te = T · P Se = S · P e =R·P R e i.e, ◦ is well defined on GX . Therefore (T, R) ∼ (Te, R), Suppose T, S ∈ Alg(X)n for some n ∈ N. It follows that [(T, T )] is the identity element with respect to ◦. For the element [(T, S)], [(S, T )] is the inverse element. By definition, GX is closed under the binary operation ◦. Therefore GX is a group with ◦.  Remark . We omit the ◦ when there is no confusion. Since the algebra Alg(X) is singly generated by X, therefore we denote such groups GX by singly generated groups. Furthermore, [(T, R)] equals to the identity if and only if T is isotopically equivalent of R for T, R ∈ Alg(X)n with n ∈ N. Notation 3.8. In the following sections, we denote (T, R) for T, R ∈ Alg(X)n for the equivalence class of [(T, R)] for elements in GX . 4. The Classical presentation In this section we discuss the structure of GX and its classical presentation derived from the vertical isotopy. Definition 4.1. Suppose X is an (1, N )-tangle. Set Sn = X0 · XN −1 · X2(N −1) · · · Xn(N −1) . We call these Sn ’s basic forms and illustrate them as following: X X X Proposition 4.2. Suppose T ∈ Alg(X)n , there exists α(T ) ∈ N and XT ∈ Alg(X) which is (α(T )(N − 1) + 1, n)-tangle such that Sα(T ) T = XT Proof. Since T ∈ Alg(X)n , the first word in T is X0 . If there exists an X such that it is attached the rightmost string on the bottom of X0 , then apply the vertical isotopy to obtain a diagram starting with X0 · XN −1 . Repeating this procedure and let α(T ) be the number of the steps. Therefore T = Sα(T ) · XT , where XT the rest of the word.  8 YUNXIANG REN Lemma 4.3. Let PX = {(T, Sn ) : T ∈ Alg(X)n , ∀n ∈ N}. Then PX is a semigroup under ◦. Furthermore, it generates the group GX . Proof. Suppose g, h ∈ PX and g = (T, Sn ), h = (R, Sm ). gh =(Sα(T ) · XT , Sn ) ◦ (Sα(R) · XR , Sm ) =(Sα(T )+max(n,α(R))−n · XT , Smax(n,α(R)) )◦ (Smax(n,α(R)) · XR , Sm+max(n,α(R))−α(R) ) =(Sα(T )+max(n,α(R))−n · XT · XR , Sm+max(n,α(R))−α(R) ) ∈ PX Therefore PX is a semigroup under the binary operation ◦. Note that for (T, R) ∈ GX , (T, R) = (T, Sn )(R, Sn )−1 for some n ∈ N. Hence PX is a generating set for PX .  Now we give a description of classical generators for the group GX . Definition 4.4. Suppose n ∈ N, there exists a(n), b(n) ∈ N such that a(n) is the largest integer satisfying (N − 1)a(n) + b(n) = n with 0 ≤ b(n) < N . We define xn = (Sa(n) · Xn , Sa(n)+1 ) Lemma 4.5. The set {xn : n ∈ N} is a generating set for GX and satisfies the relation x−1 k xn xk = xn+N −1 (7) Proof. By Lemma 4.3, we only need to show every element g ∈ PX belongs to the subgroup generated by {xn : n ∈ N}. Suppose g = (T, Sn ) ∈ PX . By Proposition 4.2, XT = XT 0 · Xk for some k ∈ N. Sα(T ) g=( XT 0 Sα(T ) , Sn ) = ( k X Sn−1 , XT 0 k X Sα(T ) k )◦( k X Sn−1 , = ( XT 0 Sn−1 , Sn ) k X Sn−1 )◦( , Sn ) k X k By Definition 4.1, Sn = X0 · XN −1 · X2(N −1) · · · Xn(N −1) . Let R = X(m+1)(N −1) · Xn(N −1) . By Definition 4.4, a(k) is the smallest integer such that (N − 1)a(k) + b(k) = k with 0 ≤ b(k) < N . Sα(k) Sn−1 = k X Sα(k) R k X = X k R FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 9 Sα(k) Sn = X k R Therefore, by Definition 3.4, Sα(k) ( Sα(k) R , Sn ) = ( k X Sα(k) , X k R ) = xk X k R Hence g is written as the product of a word in PX with less length and xk for some k ∈ N. Then by a induction on the length, GX is generated by {xn : n ∈ N}. Now we prove Relation (7). Suppose k, n ∈ N with k < n. xn xk = (Sa(n) · Xn , Sa(n)+1 ) ◦ (Sa(k) · Xk , Sa(k)+1 ) = (Sa(n) · Xn , Sa(n)+1 ) ◦ (Sa(n)+1 · Xk , Sa(n)+2 ) = (Sa(n) · Xn · Xk , Sa(n)+1 · Xk ) ◦ (Sa(n+N ) · Xk , Sa(n)+2 ) = ((Sa(n) · Xn · Xk , Sa(n)+2 ) By Definition 4.4, we know that a(n + N − 1) = a(n) + 1. Therefore, xk xn+N −1 = (Sa(k) · Xk , Sa(k)+1 ) ◦ (Sa(n+N −1) · Xn+N −1 , Sa(n+N −1)+1 ) = (Sa(n) · Xk , Sa(n)+1 ) ◦ (Sa(n)+1 · Xn+N −1 , Sa(n)+2 ) = (Sa(n) · Xk · Xn+N −1 , Sa(n)+1 · Xn+N −1 ) ◦ (Sa(n)+1 · Xn , Sa(n)+2 ) = (Sa(n) · Xk · Xn+N −1 , S(a(n)+2) ) Hence xn xk = xk xn+N −1 by Proposition 3.3.  From the proof of Lemma 4.5, we have the following proposition, Corollary 4.6. Suppose g ∈ PX , then there exists n ∈ N; i1 , i2 , · · · , in ∈ N; k1 , k2 , · · · , kn ∈ N such that g = xki11 xki22 · · · xkinn . Furthermore, g = 1 ⇔ k1 = k2 · · · = kn = 0. Theorem 4.7. The group GX has a classical presentation GX ∼ = htn , n ∈ N|t−1 k tn tk = tn+N −1 , ∀k < N i. i.e, the group GX is isomorphic to FN . (8) 10 YUNXIANG REN −1 Proof. We fist denote R, the normal subgroup generated by {t−1 k tn tk tn+N −1 , ∀k < n}. Define the map Φ by sending tk to xk . It follows that Φ extends to a surjective group homomorphism from htn , n ∈ N|t−1 k tn tk = tn+N −1 , ∀k < N i to GX . Thus we only need to show Φ is injective. Note that for k, n ∈ N, k < n, −1 t−1 k tn = tn+N −1 tk −1 t−1 n tk = tk tn+N −1 Therefore, every element g ∈ htn , n ∈ N|t−1 k tn tk = tn+N −1 , ∀k < N i, there exists g+ , g− such that −1 g+ g− where g± is a word on {t1 , t2 , · · · } with positive powers. These are called positive elements of Thompson group FN . Thus to show Φ is injective, we only need to show that for every two positive elements g, h ∈ FN , Φ(g) = Φ(h) ⇔ g = h Since g, h are positive elements and Φ is a group homomorphism, Φ(g), Φ(h) ∈ PX . Hence there exists Tg , Th ∈ Alg(X)n(N −1)+1 such that Φ(g) = (Tg , Sn ) and Φ(h) = (Th , Sn ) where Tg and Th are isotopically equivalent. Assume Tg = Tg0 · Xk , i.e, Tg0 Tg = k X Since Tg and Th are isotopically equivalent, Th must be of the form: X k where the red string is the (k + 1)th string from the left. Therefore, Th = Th1 · Xn · Th2 , where Xn corresponds to the red layer. Following from the proof of Lemma 4.5, we have h = h1 tn h2 . Suppose h2 = 1, then n = k and g = g 0 tk , h = h0 tk for some g 0 , h0 positive elements. Note that g = h ⇔ g 0 = h0 . Suppose h2 6= 1, let tm be the first word in h2 , i.e, h = h1 tn tm h3 . By the structure of Th , we know that either m < n or m > n + N − 1. If m < n, then tn tm = tm tn+N −1 ; if m > n + N − 1, then tn tm = tm−N +1 tn by Relation (7). By symmetry we just FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 11 discuss the first case. Let e h = h1 tm tn+N −1 h3 . X X = Th = X X k = Teh k −1 −1 h−1 3 tm tn tm tn+N −1 h3 Note that h−1 e h= ∈ R. Therefore to show g −1 h ∈ R, we only need to −1 e e show g h ∈ R, i.e, to show that Φ(g) = Φ(h) ⇔ g = e h. By repeating this procedure, we obtain a positive element b h with b h=b h0 tk . We only need to show Φ(g) = Φ(b h) ⇔ g = b h ⇔ g0 = b h0 In both cases, we reduce to the case that comparing positive elements of fewer lengths. Eventually it reduces to the case that for i1 , ·, im ; n1 , ·, nm ∈ N tni11 tni22 · · · tnimm = 1 ⇒ xni11 xni22 · · · xnimm = 1 Therefore n1 = n2 = · · · nm = 1, i.e, Φ is injective.  5. Examples In this section, we will mainly introduce two examples defined by Jones. 5.1. The Jones subgroup F~ . Jones introduced the Jones subgroup F~ [Jon14], and it is showed that F~ ∼ = F3 by Golan and Sapir [GS15]. We first recall the definition of F~ . Let P• be the subfactor planar algebra, T L(2). We construct a unitary representation π with 1 Approach 1 in §2 by taking the 2-box R to be 21/4 ( −√ ), a multiple of the 2nd Jones-Wenzl 2 idempotent. For every element g ∈ F , the matrix coefficient hπ(g)ξ, ξi has a specific chromatic meaning: Suppose g has a pair of binary tree representation as (T+ , T− ). We arrange the pair of trees in R2 such that the leaves of T± are the points (1/2, 0), (3/2, 0), · · · ((2n − 1)/2, 0) with all the edges being the straight line segments sloping either up from left to right or down from left to right. T+ is in the upper half plane and T− is in the lower half plane. We construct a simply-laced planar graph Γ(T+ , T− ) from the given trees. Let the vertices be {(0, 0), (1, 0), ..., (n, 0)} contained in each region between the edges of each tree. The vertices (k, 0) and (j, 0) is connected by an edge if and only if the corresponding regions are separated by an edge sloping up in T+ or down in T− from left to right. $ $ Proposition 5.1 (Jones, [Jon14]). Γ(T+ , T− ) defined above is consisting of a pair of trees, Γ(T+ ) in the upper half plane and Γ(T− ) in the lower half plane having following properties: • The vertices are 0, 1, 2, · · · , n. 12 YUNXIANG REN • Each vertex other than 0 is connected to exactly one vertex to its left • Each edge can be parameterised as (x(t), y(t)) for 0 ≤ t ≤ 1 such that x0 (t) > 0 and y(t) > 0 on (0, 1) or y(t) < 0 on (0, 1). Proposition 5.2 (Jones, [Jon14]). We have the following for the matrix coefficient, 1 hπ(g)ξ, ξi = ChrΓ(T+ ,T− ) (2), 2 where ChrΓ(T+ ,T− ) (2) is the value of the chromatic polynomial for Γ(T+ , T− ) at 2, i.e, the number of 2-coloring of Γ(T+ , T− ). Remark . By definition of the chromatic polynomial, we have ( 2, if Γ(T+ , T− ) is bipartite ChrΓ(T+ ,T− ) (2) = 0, if Γ(T+ , T− ) is not bipartite Definition 5.3 (the Jones subgroup). We denote the Jones subgroup F~ as the stabilizer of the vacuum vector, i.e, F~ = {g ∈ F |π(g)ξ = ξ} Remark . Suppose g has a pair of trees representation as (T+ , T− ). By the remark of Proposition 5.2, we have that g ∈ F~ if and only if Γ(T+ , T− ) is a bipartite planar graph. Now we show that F~ is isomorphic to F3 . Lemma 5.4. Suppose g ∈ F~ , then g has a pair of trees representation as (T+ , T− ) such that the coloring of the vertices of Γ(T+ , T− ) is ± ∓ ± ∓ · · · ± from the left to right. Proof. Suppose (T+ , T− ) is a pair of trees representation of g ∈ F~ . Since g ∈ F~ , Γ(T+ , T− ) is a bipartite graph, i.e, there exists a coloring of the vertices. Suppose there exists a vertex (i, 0) with i ∈ N and the coloring of (i, 0) and (i + 1, 0) are different, i.e, Γ(T+ , T− ) : + + (i,0) (i+1,0) ←→ (T+ , T− ) : + + (i,0) (i+1,0) We consider the pair of trees with by putting a caret on both T± on the edge with endpoints (i + 1/2, 0). Therefore, we have Γ(T+ , T− ) : + (i,0) - + (i+1,0) ←→ (T+ , T− ) : + (i,0) - + (i+1,0) Repeating this procedure, we reach a pair of trees representation of g required by the lemma.  Theorem 5.5. The Jones subgroup F~ is isomorphic to F3 . Proof. Let X = . Suppose non-trivial g ∈ F~ with a pair of trees representation (T+ , T− ) as in Lemma 5.4. Assume T+ has 2n − 1 leaves. FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP 13 Claim. There exists i ∈ N such that in T+ (i,0) (i+1,0) (i+2,0) Proof of the claim. By Proposition 5.1, we consider the upper half part of Γ(T+ , T− ), denoted by Γ(T+ ). The claim is equivalent to that there exists i ∈ N such that (i + 2, 0) is connected to (i + 1, 0) and (i + 1, 0) is connected to (i, 0) by edges in Γ(T+ ). We prove this statement by induction on the number of vertices. The basic step is trivially true since the coloring is ± ∓ ±. Now suppose the statement holds for 2n − 1 vertices. Consider Γ(T+ ) has 2n + 1 vertices. Since Γ(T+ ), there exist m ∈ N such that (m, 0) is connected to (m − 1, 0) by induction. Let (k, 0) be the only vertex that (m − 1, 0) is connected to on its left. If k = m − 2, then we find such vertex required by the claim. If k < m − 2, we apply the induction on the induced sub graph of Γ(T+ ) on vertices {(k, 0), (k + 1, 0), · · · , (m.0)}. Therefore we concludes the claim.  With proving the claim, we obtain that T+ ∈ Alg(X)2n−1 . Therefore F~ ∼ = F3 by Theorem 4.7.  Remark . Jones defined a family of subgroups of F which start with F~ using the R-matrix in spin models [Jon14]. These subgroups have been redefined by Golan and Sapir denoted by F~n , n ≥ 2 and showed to be isomorphic to Fn+1 [GS15]. These results can be obtained by using the same idea in the proof of Theorem 5.5. 5.2. The 3-colorable subgroup. Jones introduce the 3-colorable subgroup F and we now recall the definition. 1 Let P• is the subfactor planar algebra T L(2). we set S to be 3 4 $ , where = f2 . $ f2 $ f2 we construct a unitary representation π with the trivalent vertex in Approach 2 in §2. Similar to the case in §5.1, the matrix coefficient with respect to the vacuum vector has a specific chromatic meaning: Suppose g ∈ F with (T+ , T− ) a pair of trees representation. We arrange the pair of trees as in §5.1 to obtain a cubic planar graph. Let Γ(T+ , T− ) be the dual graph of the cubic graph with vertices 14 YUNXIANG REN {(0, 0), (1, 0), · · · , (n, 0)}. For instance, (9) Proposition 5.6. The matrix coefficient satisfies the following: ( 1, Γ(T+ , T− ) is 3-colorable hπ(g)ξ, ξi = 0, Γ(T+ , T− ) is not 3-colorable Remark . We use {a, b, c} as the coloring of Γ(T+ , T− ) for g having (T+ , T− ) as a pair of representation with hπ(g)ξ, ξi = 1. Definition 5.7 (Jones). We define the 3-colorable subgroup F as the stabilizer of the vacuum vector F = {g ∈ F |π(g)ξ = ξ} Lemma 5.8. Suppose g ∈ F, then g has a pair of trees representation (T+ , T− ) such that the coloring of the vertices of Γ(T+ , T− ) is acbacb · · · ac. Proof. First note that this lemma should hold for the coloring after applying any permutation on {a, b, c} to acbacb · · · ac. We will prove the lemma by induction. Suppose (T+ , T− ) is a pair of trees representation of g ∈ F. Consider there exists i ∈ N with coloring of the vertex (i, 0) is a and the vertex (i + 1, 0) is b. Then we apply the same technique in Lemma 5.4 Γ(T+ , T− ) : a c b (i+1,0) (i,0) ←→ (T+ , T− ) : a c b (i+1,0) (i,0) We consider the pair of trees with by putting a caret on both T± on the edge with endpoints (i + 1/2, 0). Therefore, we have Γ(T+ , T− ) : a (i,0) c b (i+1,0) ←→ (T+ , T− ) : a (i,0) c b (i+1,0)  Theorem 5.9. The 3-colorable subgroup F is isomorphic to F4 . FROM SKEIN THEORY TO PRESENTATIONS FOR THOMPSON GROUP Proof. Let X = 15 . Suppose g ∈ F having (T+ , T− ) as a pair of trees representation satisfying Lemma 5.8 where T± has 3n + 1 leaves. Claim. There exits i ∈ N such that in T+ , (i, 0) Proof of Claim. We will prove the claim by induction. The basic step is trivially true since it corresponds to the coloring acbac. Suppose this claim holds for binary trees with 3n − 2 leaves. T+ must start with the form v0 a c v00 v01 b c a If there are no more other vertices connected to v00 or v01 , then the claim holds. If there are more vertices on the left edge of v00 , then the dotted circle part is a tree with acbacb · · · ac. By induction, we know that the claim holds. v0 a v00 c b c v01 a The same argument holds for the cases that there are more vertices on the right edge of v00 or the left (or right) edge of v01 .  With proving the claim, we obtain that T+ ∈ Alg(X)3n+1 . Therefore, F ∼ = F4 by Theorem 4.7  References [Ati88] Michael F Atiyah, Topological quantum field theory, Publications Mathématiques de l’IHÉS 68 (1988), 175–186. [BJ97] D. Bisch and V. F. R. Jones, Singly generated planar algebras of small dimension, Duke Math. J. 128 (1997), 89–157. [BJ03] , Singly generated planar algebras of small dimension, part II, Advances in Mathematics 175 (2003), 297–318. [BJL] D. Bisch, V. Jones, and Z. Liu, Singly generated planar algebras of small dimension, part III, arXiv:1410.2876. [BS14] Robert Bieri and Ralph Strebel, On groups of pl-homeomorphisms of the real line, arXiv preprint arXiv:1411.2868 (2014). [GS15] Gili Golan and Mark Sapir, On jones’ subgroup of r. thompson group f , arXiv preprint arXiv:1501.00724 (2015). [JLR] C. Jones, Z. Liu, and Y. Ren, Planar algebras generated by a 3-box, In preparation. [Jon] V. F. R. Jones, Planar algebras, I, arXiv:math.QA/9909027. 16 YUNXIANG REN , Index for subfactors, Invent. Math. 72 (1983), 1–25. [Jon83] [Jon14] , Some unitary representation of thompson’s groups f and t, I, arXiv:1412.7740 [math.GR] (2014). [Jon16] , A no-go theorem for the continuum limit of a periodic quantum spin chain. [Liua] Z. Liu, Exchange relation planar algebras of small rank, To appear Trans. AMS. arXiv:1308.5656v2. [Liub] , Yang-baxter relation planar algebras, In preparation. [Ocn88] A. Ocneanu, Quantized groups, string algebras and Galois theory for algebras, Operator algebras and applications, Vol. 2, London Math. Soc. Lecture Note Ser., vol. 136, Cambridge Univ. Press, Cambridge, 1988, pp. 119–172. [Pop94] S. Popa, Classification of amenable subfactors of type II, Acta Math. 172 (1994), 352–445. [Pop95] , An axiomatization of the lattice of higher relative commutants, Invent. Math. 120 (1995), 237–252.
4math.GR
A Parametric MPC Approach to Balancing the Cost of Abstraction for Differential-Drive Mobile Robots arXiv:1802.07199v1 [cs.RO] 20 Feb 2018 Paul Glotfelter and Magnus Egerstedt Abstract— When designing control strategies for differentialdrive mobile robots, one standard tool is the consideration of a point at a fixed distance along a line orthogonal to the wheel axis instead of the full pose of the vehicle. This abstraction supports replacing the non-holonomic, three-state unicycle model with a much simpler two-state single-integrator model (i.e., a velocitycontrolled point). Yet this transformation comes at a performance cost, through the robot’s precision and maneuverability. This work contains derivations for expressions of these precision and maneuverability costs in terms of the transformation’s parameters. Furthermore, these costs show that only selecting the parameter once over the course of an application may cause an undue loss of precision. Model Predictive Control (MPC) represents one such method to ameliorate this condition. However, MPC typically realizes a control signal, rather than a parameter, so this work also proposes a Parametric Model Predictive Control (PMPC) method for parameter and sampling horizon optimization. Experimental results are presented that demonstrate the effects of the parameterization on the deployment of algorithms developed for the single-integrator model on actual differential-drive mobile robots. I. I NTRODUCTION Models are always abstractions in that they capture some pertinent aspects of the system under consideration whereas they neglect others. But models only have value inasmuch as they allow for valid predictions or as generators of design strategies. For example, in a significant portion of the many recent, multi-agent robotics algorithms for achieving coordinated objectives, single-integrator models are employed (e.g., [1], [2], [3], [4]). Arguably, such simple models have enabled complex control strategies to be developed, yet, at the end of the day, they have to be deployed on actual physical robots. This paper formally investigates how to strike a balance between performance and maneuverability when mapping single-integrator controllers onto differentialdrive mobile robots. Due to the single-integrator model’s prevalence as a design tool, a number of methods have been developed for mapping from single-integrator models to more complex, non-holonomic models. For example, the authors of [5] achieve a map from single integrator to unicycle by leveraging a control structure introduced in [6]. However, this map does not come with formal guarantees about the degree to which the unicycle system approximates the singleintegrator system. One effective solution to this problem is to utilize a so-called Near-Identity Diffeomorphism (NID) This research was sponsored by Grants No. 1531195 from the U.S. National Science Foundation. The authors are with the Institute for Robotics and Intelligent Machines, Georgia Institute of Technology, Atlanta, GA 30332, USA, {paul.glotfelter,magnus}@gatech.edu. between single-integrator and unicycle systems, as in [7], [8], where the basic idea is to perturb the original system ever-so-slightly (the near-identity part) and then show that there exists a diffeomorphism between a lower-dimensional version of the perturbed system’s dynamics and the singleintegrator dynamics. As the size of the perturbation is given as a design parameter, a bound on how far the original system may deviate from the single-integrator system follows automatically. A concept similar to NIDs from single-integrator to unicycle dynamics appears in the literature in different formats. For example, [9] utilizes this technique from a kinematics viewpoint to stabilize a differential-drive-like system. This "look-ahead" technique also arises in feedback linearization methods as a mathematical tool to ensure that the differentialdrive system is feedback linearizable (e.g., [10], [11]). This paper utilizes the ideas in [7], [8] to show that the NID incurs an abstraction cost, in terms of precision and maneuverability, that is based on the physical geometry of the differential-drive robots; in particular, the precision cost focuses on increasing the degree to which the singleintegrator system matches the unicycle-modeled system, and the maneuverability cost utilizes physical properties of the differential-drive systems to limit the maneuverability requirements imposed by the transformation. By striking a balance between these two costs, a one-parameter family of abstractions arises. However, the maneuverability cost shows that only selecting the parameter once over the course of an experiment may cause a loss of precision. A potential solution to this issue is to repeatedly optimize the parameter based on the system’s model and a suitable cost metric. Model Predictive Control (MPC) represents one such method. In particular, MPC approaches solve an optimal control problem over a time interval, utilize a portion of the controller, and re-solve the problem over the next time interval, effectively producing a state- and time-based controller. The authors of [12], [13] produce such a Parametric Model Predictive Control (PMPC) formulation. However, this formulation does not permit the cost metric to influence the time interval, which has practical performance implications. Using the formulated precision and maneuverability costs, this work formulates an appropriate PMPC cost metric and extends the work in [12], [13] to integrate a sampling horizon cost directly into the PMPC program. This paper is organized as follows: Sec. II presents the system of interest and introduces the inherent trade-off contained in the NID. Sec. III discusses the PMPC formulation. Sec. IV formulates the cost functions that allow a balanced selection of the NID’s parameters, with respect to the generated cost functions. To demonstrate and verify the main results of this work, Sec. V shows data from simulations and physical experiments, with Sec. VI concluding the paper. II. F ROM U NICYCLES TO S INGLE I NTEGRATORS This article uses the following mathematical notation. The expression k · k is the usual Euclidean norm. The symbol ∂x f (x) represents the partial derivative of the function f : Rn → Rm with respect to the variable x, assuming the convention that ∂x f (x) ∈ Rm×n . The symbol R≥0 refers to the real numbers that are greater than or equal to zero. As the focus of the paper is effective abstractions for controlling differential-drive robots, this section establishes the Near-Identity Diffeomorphism (NID) that provides a relationship between single-integrator and unicycle models. That is, systems whose pose is given by planar positions T x̄ = [x1 x2 ] and orientations θ, with the full state given  T T T = [x1 x2 θ] . The associated unicycle by x = x̄ θ dynamics are given by (dropping the dependence on time t)    R(θ)e1 0 v ẋ = , (1) 0 1 ω where the control inputs v, ω ∈ R are the linear and rotational velocities, respectively, 0 is a zero-vector of the appropriate dimension, and    T cos(θ) − sin(θ) e1 = 1 0 , R(θ) = . sin(θ) cos(θ) Letting  ux = v ω T be the collective control input to the unicycle-modeled agent, the objective becomes to turn this model into a singleintegrator model. To this end, we here recall the developments in [7]. Let xsi ∈ R2 be given by xsi = Φ(x, l) = x̄ + lR(θ)e1 , (2) where l ∈ (0, ∞) is a constant. The map Φ(x, l) is, in fact, the NID, as defined in [7]. Geometrically, the point xsi is simply given by a point at a distance l directly in front of the unicycle with pose x. Now, assume that the dynamics of xsi are given by a controller ẋsi = usi , where usi ∈ R2 is continuously differentiable, and compare this system to the time-derivative of (2), which yields   cos(θ) −l sin(θ) ẋsi = usi = ux = Rl (θ)ux . (3) sin(θ) l cos(θ) Note that the NID maps from three degrees of freedom to two degrees of freedom. As a consequence, the resulting unicycle controller cannot explicitly affect the orientation θ of the unicycle model. By [7], Rl (θ) is invertible, yielding a relationship between usi and ux . Consequently, (3) allows the transformation of linear, single-integrator algorithms into algorithms in terms of the non-linear, unicycle dynamics. Note that in this paper, which is different from [7], we let l˙ = 0 over the PMPC time intervals (i.e., l is a constant value). The unicycle model in (1) is not directly realizable on a differential-drive mobile robot. However, the relationship between the control inputs to the unicycle model and the differential-drive model is given by rw rw (ωr + ωl ), ω = (ωr − ωl ), (4) v= 2 lw where ωr and ωl are the right and left wheel velocities, respectively. The wheel radius rw and base length lw encode the geometric properties of the robot. In the discussion above, the parameter l (i.e., the distance off the wheel axis to the new point) is not canonical. Moreover, it plays an important role since kx̄ − xsi k = l. (5) The above equation seems to indicate that one should simply choose l ∈ (0, ∞) to be as small as possible. However, the following sections show that small values of l induce high maneuverability costs. In order to strike a balance between precision and maneuverability, we will, for the remainder of this paper, assume that the control input to the unicycle model is given by ux = Rl (θ)−1 usi , where usi is the control input supplied by a single-integrator algorithm. Sec. IV contains the further investigation of the effects of the parameter l on the precision and maneuverability implications of the transformation in (2). III. A PARAMETRIC MPC F ORMULATION Having introduced the system of interest, this section contains a derivation of a Parametric Model Predictive Control (PMPC) method with a variable sampling interval for general, nonlinear systems. Later, Sec. V utilizes a specific case of these results. In general, MPC methods solve an optimal control problem over a time interval and use only a portion of the obtained controller (for a small amount of time) before resolving the problem, producing a timeand state-based controller. In this case, PMPC optimizes the parameters of a system. That is, this method finds the optimal, constant parameters of a system, rather than a timevarying control input, over a time interval. For clarity, this section specifies dependencies on time t. Let ẋ(t) = f (x(t), p, t), xt0 = x(t0 ), where x(t) ∈ Rn , p ∈ Rm , and f (·) is continuously differentiable in x, measurable in t. The program t0Z+∆t arg min J(p, ∆t) = p∈Rm ,∆t∈R≥0 s.t. ẋ(t) = f (x(t), p, t) x(t0 ) = xt0 , L(x(s), p, s)ds + C(∆t) t0 expresses the PMPC problem of interest, where L(·) is continuously differentiable in x and p. Note that, in this case, both ∆t and p are decision variables determined by the PMPC program. A. Optimality Conditions This section contains the derivation of the necessary, first-order optimality conditions for the PMPC formulation, realizing gradients for the proposed cost. In particular, the derivation proceeds by calculus of variations. ˜ ∆t), Proposition 1. The augmented cost derivatives ∂p J(p, ˜ ∂∆t J(p, ∆t) are ∆t) = 0. Applying the mean value theorem and taking the limit as  → 0 shows that ˜ ˜ ∆t) J(p+γ, ∆t+τ ) − J(p, = lim →0    t +∆t 0Z  ∂p L(x(s), p, s)+λ(s)T ∂p f (x(s), p, s)ds γ t0 +[∂∆t C(∆t)+L(x(t0 +∆t), p, t0 +∆t)] τ, which is linear in τ and γ, and provides the final expressions t0Z+∆t ˜ ∆t) = ∂p J(p, t0Z+∆t ˜ ∆t) = ∂p J(p, ∂p L(x(s), p, s) + λ(s)T ∂p f (x(s), p, s)ds t0 ˜ ∆t) = L(x(t0 + ∆t), p, t0 + ∆t) + ∂∆t C(∆t), ∂∆t J(p, ˜ ∆t) (i.e., J(p, ∆t) augmented where the augmented cost J(p, with the dynamics constraint) is given by ˜ ∆t) = J(p, t0Z+∆t L(x(s), p, s)+λ(s)T (f (x(s), p, s)− ẋ(s))ds+C(∆t). t0 Proof. The proof proceeds by calculus of variations. Perturb p and ∆t as p 7→ p + γ and ∆t 7→ ∆t + τ , where γ ∈ Rm , τ ∈ R. The perturbed augmented cost is ˜ J(p+γ, ∆t+τ ) = t0 +∆t+τ Z L(x(s)+η(s), p+γ, s) t0 T λ(s) (f (x(s)+η(s), p+γ, s)− ẋ(s)−η̇(s))ds+ C(∆t+τ )+o(). Performing a Taylor expansion yields that ˜ J(p+γ, ∆t+τ ) = t0 +∆t+τ Z L(x(s), p, s)+∂x L(x(s), p, s)η(s)+∂p L(x(s), p, s)γ t0 +λT (f (x(s), p, s)+∂x f (x(s), p, s)η(s) +∂p f (x(s), p, s)γ − ẋ(s)−η̇(s))ds +C(∆t) + ∂∆t C(∆t)τ +o(). The proof now proceeds with multiple steps. First, the application of integration by parts to the quantity λ(t)T η̇(t). ˜ + γ, ∆t + τ ) − Second, the subtraction of the costs J(p ˜ ∆t). Note that, to subtract the costs properly, the inteJ(p, ˜ gral in J(p+γ, t+τ ) must be broken up into two intervals: [t, t + ∆t] and [t + ∆t, t + ∆t + τ ]. Furthermore, the costate assumes the usual definition: λ̇(t) = −∂x L(x(t), p, t)T − ∂x f (x(t), p, t)T λ(t) with the boundary condition λ(t0 + ∂p L(x(s), p, s)+λ(t)T ∂p f (x(s), p, s)ds t0 ˜ ∆t) = ∂∆t C(∆t)+L(x(t0 + ∆t), p, t0 +∆t), ∂∆t J(p, completing the proof. Interestingly, both of the usual conditions for free parameters and final time still hold, and the first-order, necessary optimality conditions for candidate solutions p∗ and ∆t∗ are that ˜ ∗ , ∆t∗ ) = 0, ∂∆t J(p ˜ ∗ , ∆t∗ ) = 0. ∂p J(p Furthermore, this formulation becomes amenable to solution by numerical methods for the optimal parameters p∗ and ˜ ∆t) can also ∆t∗ . In such cases, the expression for ∂p J(p, be expressed as a costate-like variable ξ : [t0 , t0 +∆t] → Rm with dynamics ˙ = −∂p L(x(t), p, t)T − ∂p f (x(t), p, t)T λ(t) ξ(t) ξ(t0 + ∆t) = 0, where ξ(·) is defined as t0Z+∆t ∂p L(x(s), p, s)T +∂p f (x(s), p, s)T λ(s)ds. ξ(t) = t In this case, the necessary optimality condition is that ξ(t0 ) = 0. B. Numerical Methods The above expressions allow for applications of typical gradient descent methods. Many such methods could apply, and this article presents one simple method in Alg. 1. Note that this algorithm procures the decision variables over one sampling interval [t0 , t0 + ∆t]. In practice, one typically applies this algorithm repeatedly. For example, the experiments in Sec. V-C consecutively apply this algorithm to solve the PMPC problem. IV. P RECISION VS . M ANEUVERABILITY As already noted in Sec. II, the parameter l is a design parameter. This section discusses the importance and effects of selecting l and proposes precision and maneuverability costs that elucidate the selection of this parameter and its impact on the differential-drive system. These derivations influence the PMPC cost metric in Sec. V and, for comparison, an optimal, static parameterization. Algorithm 1 Gradient Descent Algorithm for PMPC 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: k←0 pk ← initial guess ∆tk ← initial guess ˜ k , ∆t) >  do ˜ k , ∆t) + ∂∆t J(p while ∂p J(p Solve forward for x(·) from xt using pk and ∆tk Solve backward for λ(·), ξ(·) using x(·) ˜ k , ∆t) and ∂∆t J(p ˜ k , ∆t) Compute gradients ∂p J(p ˜ k , ∆t)T pk+1 ← pk − γ1 ∂p J(p ˜ k , ∆t) ∆tk+1 ← ∆tk − γ2 ∂∆t J(p k ←k+1 and let θsi be the angle of the vector usi . From (3),(4) we can retrieve the magnitude of the difference in angular velocities, |ωr − ωl |, as |ωr − ωl | = = = = = A. Precision Cost Seeking to select l, we initially present a cost that incorporates the degree to which the transformed system in (2) represents the original system xsi over an arbitrary time duration T ≥ 0. As such, we model the precision cost by the averaged tracking error Z 1 T D1 (x̄, xsi ) = kx̄ − xsi k dt. (6) T 0 = = ≤ lw ω rw l T e Rl (θ)−1 usi r 2 lw T −1 e T R(−θ)R(θsi )ūsi rw 2 lw T −1 e T R(θsi − θ)ūsi rw 2     lw 1 cos(θsi − θ) − sin(θsi − θ) kusi k 0 sin(θsi − θ) cos(θsi − θ) 0 rw l    lw sin(θsi − θ) cos(θsi − θ) kusi k 0 rw l l lw kusi k sin(θsi − θ) rw l lw v̄ . rw l It immediately follows from (5) that D1 (x̄, p) can be directly written as a function of l, given by Z 1 T D1 (x̄, xsi ) = kx̄ − xsi k dt T 0 Z 1 T = l dt = l. (7) T 0 Thus, Prop. 2 yields an upper bound on the magnitude of the wheel-velocity difference This immediate result states that the smaller l is, the better the unicycle model tracks the single-integrator model. Proposition 3. Given that the control-input magnitude kusi k is upper-bounded by v̄, the magnitude of the forward velocity, |ωr + ωl |, is upper bounded by B. Maneuverability Cost In this section, we derive a geometrically-influenced maneuverability cost that models the degree to which the selection of l influences the maneuverability requirements of the unicycle-modeled system, with respect to the map defined in (2). That is, we wish to elucidate how the parameter l affects the expressions for the differential-drive agent’s forward velocity, wheel difference, and exerted control effort. To this end, we utilize the differential-drive model in (4). Initially, note that the magnitude of the wheel-velocity difference |ωr − ωl | represents a measure of the complexity of a maneuver that the differential-drive system performs. Using this definition as guidance, we state the following proposition. Proposition 2. Given that the control-input magnitude kusi k is upper-bounded by v̄, the magnitude of the wheel-velocity difference, |ωr − ωl |, is upper bounded by |ωr − ωl | ≤ |ωr + ωl | ≤ Proof. Let  e1 = 1 " 1 T −1 1 , T = 0 # 0  1 , ūsi = kusi k l T 0 2v̄ . rw T 0 and T −1 , ūsi , θsi be defined as in the proof of Prop. 2. Then, we have, through (4), that |ωr + ωl | = = = Proof. Let  e2 = 0 Prop. 3 shows a similar result for the forward velocity of the differential-drive agent. = lw v̄ . rw λ lw v̄ . rw l |ωr − ωl | ≤ = 2 v rw 2 T e Rl (θ)−1 usi rw 1 2 T −1 e T R(−θ)R(θsi )ūsi rw 1 2 [1 0] R(θsi − θ)ūsi rw   2 kusi k [cos(θsi − θ) − sin(θsi − θ)] 0 rw 2 kusi k cos(θsi − θ) rw 2v̄ ≤ . rw where α ∈ (0, 1). Now, we seek the optimal l such that (10) is minimized. That is, = l∗ = arg min D(l). (11) l So Prop. 3 reveals that the forward velocity of the differential-drive system remains independent of the selection of the parameter l. To elucidate an appropriate maneuverability cost in terms of l, define the average control effort exerted by the differential-drive system over an arbitrary time duration T >= 0 as Z 1 T |ωr − ωl | + |ωr + ωl | dt. T 0 Directly applying Props. 2,3 reveals that the above expression is bounded above by lw v̄ 2v̄ + . (8) rw l r The expression in (8) demonstrates an interesting quality of the system. As l grows large, the forward velocity dominates the control effort exerted by the differential-drive system. However, if l becomes small, then the choice of l affects the potentially exerted control effort. Thus, (8) reveals how l affects the maneuverability requirements imposed by the abstraction. The fact that we always pay the forward-velocity price, regardless of the selection of l, naturally excludes the forward velocity from the soon-to-be-formulated cost, because any selection of l results in the same cost bound; but the choice of l directly affects the cost associated with the wheel difference. Accordingly, the wheel difference must play a role in the final PMPC cost metric. With this conclusion in mind, we define the static maneuverability cost as lw v̄ D2 (l) = , (9) rw l which the static parameterization in the following section utilizes. C. An Optimal, One-Time Selection Sec. V utilizes the results in Sec. IV to formulate an appropriate cost metric for a PMPC program. To have a baseline comparison, this section formulates an optimal, one-time selection for the parameter l. That is, the selection occurs once over the experiment’s duration. This selection should strike a balance between precision and maneuverability. Eqns. (7) and (9) represent each of these facets, respectively, and introduce an inherent trade-off in selecting l. Making l smaller directly reduces the cost in (7). However, consider the relationship in (9); as l decreases, the differential-drive system accumulates a higher maneuverability cost. As such, the convex combination of (6) and (9) yields a precision and maneuverability cost in terms of l as D(l) = αD1 (l) + (1 − α)D2 (l) lw v̄ , = αl + (1 − α) rw l (10) (11) leads to Prop. 4. Proposition 4. The optimal l∗ is given by r 1 − α lw v̄ . l∗ = α rw Proof. We have that ∂ lw v̄ D(l) = α − (1 − α) ∂l rw l2 lw v̄ = α − (1 − α) . rw l2 Setting this equation equal to zero directly yields the minimizer r 1 − α lw v̄ ∗ l = . (12) α rw Note that the above result utilizes (9), which is an upper bound on the wheel velocity difference. Thus, the PMPC method should outperform this static selection, a suspicion that Sec. V investigates. D. PMPC Cost This section formulates a PMPC cost based on the analysis in Sec. IV. To increase precision, the parameter l must be minimized. However, (9) in Sec. IV-B indicates that the wheel velocity difference must be managed. Thus, precision and maneuverability are balanced with the cost L(x, l, t) = (1 − β)(ωr − ωl )2 + βl2 = (1 − β)((lw /rw )e2 Rl (θ)−1 (usi ))2 + βl2 , where β ∈ (0, 1). With this cost metric, the PMPC program becomes t0Z+∆t (1 − β)((lw /rw )e2 Rl (θ)−1 (usi ))2 + βl2 arg min l∈R,∆t∈R≥0 t0 + C(∆t)   R(θ)e1 0 s.t. ẋ = R (θ)−1 usi 0 1 l (13) x(t0 ) = xt0 , Note that the sampling cost C(∆t) and single-integrator control input usi have yet to be specified. Angular Velocity ( ) 0.1 0 -0.1 -0.2 Static PMPC -0.3 0 20 40 60 80 100 Time (s) Fig. 3: Angular velocity (ω) during the simulation. The simulation shows that the static selection (solid line) and PMPC method (dashed line) both generate similar angular velocity values. Fig. 1: The GRITSbot, which is a small, differential-drive mobile robot used in the Robotarium. This figure displays the base length and wheel radius of the GRITSbots. V. N UMERICAL R ESULTS To demonstrate the findings in Sec. IV, we conduct two separate tests: in simulation and on real hardware. The simulation portion shows the effects of a one-time parameter selection on the angular velocity versus the PMPC method. The experimental section contains the same implementation on a real, physical system: the Robotarium (www. robotarium.org). In particular, the experimental results highlight the practical differences between using a PMPC approach and a one-time selection. A. Experiment Setup This section proposes cost functions based on the results in Sec. IV and expresses the PMPC problem to be solved in simulation and on the Robotarium. Furthermore, this section also statically parameterizes the NID to provide a baseline comparison to the PMPC strategy. In this case, the particular setup involves a mobile robot tracking an ellipsoidal reference signal Parameter (l) 0.06 0.04 r(t) =   0.4 cos((1/10)t) . 0.2 sin((1/10)t) (14) For a single-integrator system, the controller usi = xsi − r + ṙ drives the single-integrator system to the reference exponentially quickly. Utilizing the transformation in Sec. IV yields the controller ux = Rl (θ)−1 (r − xsi + ṙ) = Rl (θ)−1 (r − (x̄ + lR(θ)e1 ) + ṙ). The GRITSbots of the Robotarium (shown in Fig. 1) have a wheel radius and base length of rw = 0.005 m, lw = 0.03 m. Furthermore, their maximum forward velocity is v̄ = 0.1 m/s. For this problem, we also consider the sampling cost 1 , ∆t which prevents the time horizon from becoming too small (i.e., the cost penalizes small time horizons). Substituting these values into (13), the particular PMPC problem to be solved is C(∆t) = 0.02 0 20 40 60 80 t0Z+∆t 100 Time (s) Fig. 2: Parameter (left) and sampling horizon (right) from PMPC simulation, which oscillate because of the ellipsoidal reference trajectory in (14). Due to the sharp maneuvers required, the time horizon shortens and the parameter increases on the left and right sides of the ellipse. On flatter regions, the PMPC reduces the parameter and increases the sampling time. The zoomed portion displays the discrete nature of the PMPC solution. (β − 1)((lw /rw )e2 Rl (θ)−1 (r − xsi +ṙ))2 arg min l∈R,∆t∈R≥0 t0 + βl2 ds + (1/∆t)  R(θ)e1 0 s.t. ẋ = R (θ)−1 (r − xsi + ṙ) 0 1 l  x(t0 ) = xt0 , where l and ∆t are the decision variables and β = 0.01. Both simulation and experimental results utilize Alg. 1 to l =0.030937 t =3.3119 l =0.027048 t =3.4262 l =0.043572 t =3.2757 Angular Velocity ( ) Fig. 4: Robot during the PMPC experiment. This figure shows that the parameter grows and sampling horizon shrinks when the robot must perform more complex maneuvers (i.e., on the left and right sides of the ellipse). Over the flatter portions of the ellipse, the parameter increases and sampling horizon (solid line) reduces, allowing the robot to track the reference (solid circle) more closely. with α = 0.99. This assignment to α in (12) implies that 1 l∗ = 0.078. 0.5 Note that this value of l∗ is only for the one-time selection. The PMPC method induces different parameter values every 0.033 s. 0 -0.5 Static PMPC -1 0 20 40 60 80 100 Time (s) Fig. 5: Angular velocity of robots for PMPC method (dashed line) versus static parameterization (solid line). In this case, both methods generate similar angular velocities, but the PMPC method produces better tracking. solve for the optimal parameters and time horizon online with the step-size values γ1 = 0.001, γ2 = 0.01. Each experiment initially executes Alg. 1 to termination; then, steps are performed each iteration to ensure that the current values stays close to the locally optimal solution realized by Alg. 1. In particular, each iteration takes 0.033 s, which is the Robotarium’s sampling interval. For comparison, the one-time selection method stems directly from the abstraction cost formulated in Sec. IV-C Parameter (l) 0.06 0.05 0.04 0.03 0.02 0 20 40 60 80 100 Time (s) Fig. 6: Parameter (left) and sampling horizon (right) from PMPC experiment on the Robotarium. The PMPC program reduces the sampling horizon and increases the parameter to cope with the sharp maneuvers required at the left and right sides of the ellipse. On flatter regions, the PMPC decreases the parameter and increases the time horizon, providing better reference tracking. The zoomed portion illustrates the discrete nature of the PMPC solution. B. Simulation Results This section contains the simulation results for the method described in Sec. V-A. In particular, the simulation compares the proposed PMPC method to the one-time selection process in Sec. IV-C, showing that the PMPC method can outperform the one-time selection. Fig. 3 shows the simulated angular velocities, and Fig. 2 shows the parameter and sampling horizon evolution. Both methods generate similar control inputs. However, Fig. 2 demonstrates that the PMPC method selects smaller parameter values, implying that this method provides better reference tracking. Additionally, Fig. 2 also shows that the sampling horizon shortens and the parameter increases around the left and right portions of the ellipse, because these regions require sharper maneuvers and incur a higher maneuverability cost. Furthermore, the ellipsoidal reference trajectory induces the oscillations in Fig. 2. Overall, these simulated results show that the PMPC method can outperform a static parameterization. C. Experimental Comparison This section contains the experimental results of the implementation described in Sec. V-A. The physical experiments for this paper were deployed on the Robotarium and serve to highlight the efficacy and validity of applying the PMPC approach on a real system. Additionally, the experiments display the propriety of the maneuverability cost outlined in Sec. IV-B. Figs. 5-6 display the angular velocity of the mobile robot, the sampling horizon, and the parameter selection, respectively. As in the simulated results, Fig. 5 shows that the static parameterization and PMPC method produce similar angular velocities, and Fig. 6 shows that the PMPC method is able to adaptively adjust the parameter and sampling horizon to handle variations in the reference signal. Moreover, on a physical system, the PMPC method still adjusts the time horizon and parameter to account for maneuverability requirements. For example, on the left and right sides of the ellipse, the maneuverability cost rises, because the reference turns sharply. Thus, the parameter increases and the sampling horizon decreases. Over flat portions of the ellipse, the maneuverability cost decreases, permitting the extension of the time horizon and reduction of the parameter (i.e., better tracking). That is, reductions of the maneuverability cost permit decreasing the parameter l, allowing the PMPC strategy to outperform the static parameterization. Furthermore, the decrease of the sampling horizon during high-maneuverability regions accelerates the execution of Alg. 1, which is useful in a practical sense. VI. C ONCLUSION This work presented a variable-sampling-horizon Parametric Model Predictive Control (PMPC) method that allows for optimal parameter and sampling horizon selection with the application of controlling differential-drive mobile robots. To formulate an appropriate cost for the PMPC strategy, this article discussed a class of Near-Identity Diffeomorphisms (NIDs) that allow the transformation of single-integrator algorithms to unicycle-modeled systems. Additionally, this work showed an inherent trade-off induced by the NID and formulated precision and maneuverability costs that allow for the optimal parameterization of the NID via a PMPC program. Furthermore, simulation and experimental results were produced that illustrated the validity of the proposed costs and the efficacy of the PMPC method. R EFERENCES [1] M. Ji and M. Egerstedt, “Distributed formation control while preserving connectedness,” in Proceedings of the IEEE CDC, pp. 5962–5967, Dec 2006. [2] A. Y. Yazicioğlu and M. Egerstedt, “Leader selection and network assembly for controllability of leader-follower networks,” in 2013 ACC, pp. 3802–3807, June 2013. [3] Y. Hong, J. Hu, and L. Gao, “Tracking control for multi-agent consensus with an active leader and variable topology,” Automatica, vol. 42, no. 7, pp. 1177 – 1182, 2006. [4] W. Ni and D. Cheng, “Leader-following consensus of multi-agent systems under fixed and switching topologies,” Systems & Control Letters, vol. 59, no. 3–4, pp. 209 – 217, 2010. [5] J. Cortes et al., “Coverage control for mobile sensing networks: Variations on a theme,” in Proceedings of the MCCA, July 2002. [6] A. Astolfi, “Exponential stabilization of a wheeled mobile robot via discontinuous control.,” Journal of dynamic systems, measurement, and control, vol. 121, no. 1, pp. 121–126, 1999. [7] R. Olfati-Saber, “Near-identity diffeomorphisms and exponential tracking and -stabilization of first-order nonholonomic se(2) vehicles,” in Proceeding of the 2002 ACC, May 2002. [8] R. Olfati-Saber, “Exponential -tracking and -stabilization of secondorder nonholonomic se(2) vehicles using dynamic state feedback,” in Proceedings of the 2002 ACC (IEEE Cat. No.CH37301), vol. 5, pp. 3961–3967 vol.5, May 2002. [9] P. Ogren, M. Egerstedt, and X. Hu, “A control Lyapunov function approach to multi-agent coordination,” in Decision and Control, 2001. Proceedings of the IEEE Conference on, vol. 2, 2001. [10] G. Oriolo, A. D. Luca, and M. Vendittelli, “Wmr control via dynamic feedback linearization: design, implementation, and experimental validation,” IEEE Transactions on Control Systems Technology, vol. 10, Nov 2002. [11] E. Yang, D. Gu, and H. Hu, “Nonsingular formation control of cooperative mobile robots via feedback linearization,” in 2005 IEEE/RSJ IROS, pp. 826–831, Aug 2005. [12] G. Droge and M. Egerstedt, “Adaptive look-ahead for robotic navigation in unknown environments,” in 2011 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 1134–1139, Sept 2011. [13] G. Droge and M. Egerstedt, “Adaptive time horizon optimization in model predictive control,” in Proceedings of the 2011 American Control Conference, pp. 1843–1848, June 2011.
3cs.SY
On Design Mining: Coevolution and Surrogate Models arXiv:1506.08781v6 [cs.NE] 23 Nov 2016 Richard J. Preen∗ and Larry Bull Department of Computer Science and Creative Technologies University of the West of England, Bristol, UK November 24, 2016 Abstract Design mining is the use of computational intelligence techniques to iteratively search and model the attribute space of physical objects evaluated directly through rapid prototyping to meet given objectives. It enables the exploitation of novel materials and processes without formal models or complex simulation. In this paper, we focus upon the coevolutionary nature of the design process when it is decomposed into concurrent sub-design threads due to the overall complexity of the task. Using an abstract, tuneable model of coevolution we consider strategies to sample sub-thread designs for whole system testing and how best to construct and use surrogate models within the coevolutionary scenario. Drawing on our findings, the paper then describes the effective design of an array of six heterogeneous vertical-axis wind turbines. Keywords— 3D printing, coevolution, shape optimisation, surrogate models, turbine, wind energy ∗ Contact author. E-mail: [email protected] 1 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 1 Introduction Design mining [54, 55, 56] is the use of computational intelligence techniques to iteratively search and model the attribute space of physical objects evaluated directly through rapid prototyping to meet given objectives. It enables the exploitation of novel materials and processes without formal models or complex simulation, whilst harnessing the creativity of both computational and human design methods. A sample-model-search-sample loop creates an agile/flexible approach, i.e., primarily test-driven, enabling a continuing process of prototype design consideration and criteria refinement by both producers and users. Computational intelligence techniques have long been used in design, particularly for optimisation within simulations/models. Recent developments in additive-layer manufacturing (3D printing) means that it is now possible to work with over a hundred different materials, from ceramics to cells. In the simplest case, design mining assumes no prior knowledge and builds an initial model of the design space through the testing of 3D printed designs, whether specified by human and/or machine. Optimisation techniques, such as evolutionary algorithms (EAs), are then used to find the optima within the data mining model of the collected data; the model which maps design specifications to performance is inverted and suggested good solutions identified. These are then 3D printed and tested. The resulting data are added to the existing data and the process repeated. Over time the model—built solely from physical prototypes tested appropriately for the task requirements—captures the salient features of the design space, thereby enabling the discovery of high-quality (novel) solutions. Such so-called surrogate models have also long been used in optimisation for cases when simulations are computationally expensive. Their use with 3D printing opens new ways to exploit optimisation in the design of physical objects directly, whilst raising a number of new issues over the simulation case. This approach of constantly producing working prototypes from the beginning of the design process shares resemblance to agile software engineering [43]: requirements are identified at the start, even if only partially, and then corresponding tests created, which are then used to drive the design process via rapid iterations of solution creation and evaluation. The constant supply of (tangible) prototypes enables informed sharing with, and hence feedback from, those involved in other stages of the process, such as those in manufacture or the end user. This feedback enables constant refinement of the requirements/testing and also means that aspects of the conceptual and detailed design stages become blended. Moreover, due to the constant production of better (physical) prototypes, aspects of the traditional manufacturing stage become merged with the design phase. The data mining models created provide new sources of knowledge, enabling designers, manufacturers, or users, to do what-if tests during the design process to suggest solutions, the sharing of timely/accurate information when concurrent sub-design threads are being exploited, etc. Thereafter, they serve as sources of information for further adaptive designs, the construction of simulators/models, etc. In contrast to human designers, who typically arrive at solutions by refining building blocks that have been identified in highly constrained ways, computational intelligence offers a much more unconstrained and unbiased approach to exploring potential solutions. Thus, by creating the designs directly in hardware there is the potential that complex and subtle physical interactions can be utilised in unexpected ways where the operational principles were previously unknown. These physical effects may simply be insufficiently understood or absent from a simulator and thus otherwise unable to be exploited. Design mining is therefore ideally suited to applications involving highly complex environments 2 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models and/or materials. The design of modern wind farms typically begin with the blade profile optimisation of a single isolated wind turbine through the use of computational fluid dynamics (CFD) simulations [68], followed by optimising the site positioning of multiple copies of the same design to minimise the negative effects of inter-turbine wake interactions [25]. Whilst CFD simulations have been successfully applied, they are extremely computationally expensive; consequently most numerical studies perform only 2D analysis, e.g., [21], and it is currently infeasible to perform accurate 3D simulations of a large array. Moreover, various assumptions must be made, and accurately modelling the complex inter-turbine wake interactions is an extremely challenging task where different turbulence models can have a dramatic effect on turbine performance [33]. CFD studies have also presented significant differences between results even with identical geometric and flow conditions due to the complexity of performing accurate numerical analysis [1]. In our initial pilot study we used the design mining approach to discover a pair of novel, heterogeneous vertical-axis wind turbine (VAWT) designs through cooperative coevolution [55]. Accurate and computationally efficient modelling of the inter-turbine interactions is extremely difficult and therefore the area is ideally suited to the design mining approach. More recently, we have begun to explore the performance of relevant techniques from the literature within the context of design mining. Following [10], the pilot study used multi-layered perceptrons (MLPs) [59] for the surrogate modelling. Using the data from that study, we have subsequently shown that MLPs appear a robust approach in comparison to a number of well-known techniques [56]. That is, MLPs appear efficient at capturing the underlying structure of a design space from the relatively small amount of data points a physical sampling process can be expected to generate. In this paper we begin by continuing the line of enquiry, here focusing upon the coevolutionary nature of the design process when it is decomposed into concurrent sub-design threads due to the overall complexity of the task. Using an abstract, tuneable model of coevolution we consider strategies to sample sub-thread designs for whole system testing and how best to construct and use surrogate models within the coevolutionary scenario. Drawing on our findings, the paper then describes the effective design of a more complex array of VAWT than our pilot study. 2 2.1 Background Evolving Physical Systems As we have reviewed elsewhere [55], there is a small amount of work considering the evolutionary design of physical systems directly, stretching back to the origins of the discipline [8, 51, 19, 57]. Well-known examples include robot controller design [45]; the evolution of vertebrate tail stiffness in swimming robots [42]; adaptive antenna arrays [4]; electronic circuit design using programmable hardware [66]; product design via human provided fitness values [28]; chemical systems [65]; unconventional computers [27]; robot embodied evolution [22]; drug discovery [64]; functional genomics [39]; adaptive optics [63]; quantum control [36]; fermentation optimisation [18]; and the optimisation of analytical instrumentation [46]. A selection of multiobjective case studies can be found in [40]. Examples of EAs incorporating the physical aerodynamic testing of candidate solutions include the optimisation of jet nozzles [57, 62], as well as flapping [2, 31, 48] and morphing [7] wings. More recent fluid dynamics examples include [50, 23, 5]. 3 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Lipson and Pollack [41] were the first to exploit the use of 3D printing in conjunction with an EA, printing mobile robots with embodied neural controllers that were evolved using a simulation of the mechanics and control. Rieffel and Sayles’ [58] use of an interactive EA to 3D print simple shapes is particularly relevant to the work presented here. As noted above, in this paper we adopt an approach where relatively simple and tuneable simulations of the basic evolutionary design scenario are used to explore the general performance of different algorithmic approaches before moving to the physical system. This can be seen as somewhat akin to the minimalist approach proposed by Jakobi [34] for addressing the so-called reality gap in evolutionary robotics, although further removed from the full details of the physical system. Surrogate models are then used to capture the underlying characteristics of the system to guide design. 2.2 Cooperative Coevolution and Surrogates Cooperative coevolution decomposes a global task into multiple interacting sub-component populations and optimises each in parallel. In the context of a design process, this can be seen as directly analogous to the use of concurrent sub-threads. The first known use of cooperative coevolution considered a job-shop scheduling task [32]. Here solutions for individual machines were first evaluated using a local fitness function before being partnered with solutions of equal rank in the other populations to create a global solution for evaluation. Bull and Fogarty [11] subsequently presented a more general approach wherein the corresponding newly created offspring solutions from each population are partnered and evaluated. Later, Potter and De Jong [53] introduced a round-robin approach with each population evolved in turn, which has been adopted widely. They explored using the current best individual from each of the other populations to create a global solution, before extending it to using the best and a random individual from the other population(s). These two partnering strategies, along with others, were compared under their round-robin approach and found to be robust across function/problem types [9]. We used the round-robin approach and partnering with the best individual in our pilot study and return to it here with the focus on learning speed, i.e., how to minimise the number of (timely/costly) fitness evaluations whilst learning effectively. As EAs have been applied to ever more complex tasks, surrogate models (also known as meta-models) have been used to reduce the optimisation time. A surrogate model, y = f (~x), can be formed using a sample D of evaluated designs N , where ~x is the genotype describing the design morphology and y is the fitness/performance. The model is then used to compute the fitness of unseen data points ~x ∈ / D, thereby providing a cheap approximation of the real fitness function for the EA to use. Evaluations with the real fitness function must continue to be performed periodically otherwise the model may lead to premature convergence on local optima (see Jin [35] for an overview). There has been very little prior work on the use of surrogates in a coevolutionary context: they have been shown capable of solving computationally expensive optimisation problems with varying degrees of epistasis more efficiently than conventional coevolutionary EAs (CEAs) through the use of radial basis functions [49] and memetic algorithms [24]. Remarkably, in 1963 Dunham et al. [19], in describing the evolutionary design of physical logic circuits/devices, briefly note (without giving details): “It seemed better to run through many ‘generations’ with only approximate scores indicating progress than to manage a very few ‘evolutions’ with rather exact statements of position.” Our aforementioned pilot study is the first known use of coevolutionary design without 4 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models simulation. As noted above, we have recently compared different modelling techniques by which to construct surrogates for coevolution. In this paper we further consider how best to train and use such models. 2.3 The NKCS Model Kauffman and Johnsen [38] introduced the abstract NKCS model to enable the study of various aspects of coevolution. In their model, an individual is represented by a genome of N (binary) genes, each of which depends epistatically upon K other randomly chosen genes in its genome. Thus increasing K, with respect to N , increases the epistatic linkage, increasing the ruggedness of the fitness landscapes by increasing the number of fitness peaks, which increases the steepness of the sides of fitness peaks and decreases their typical heights. Each gene is also said to depend upon C randomly chosen traits in each of the other X species with which it interacts, where there are S number of species in total. The adaptive moves by one species may deform the fitness landscape(s) of its partner(s). Altering C, with respect to N , changes how dramatically adaptive moves by each species deform the landscape(s) of its partner(s). The model assumes all inter- and intragenome interactions are so complex that it is appropriate to assign random values to their effects on fitness. Therefore, for each of the possible K + (X × C) interactions, a table of 2K+(X×C)+1 fitnesses is created for each gene, with all entries in the range 0.0 to 1.0, such that there is one fitness for each combination of traits. The fitness contribution of each gene is found from its table; these fitnesses are then summed and normalised by N to give the selective fitness of the total genome for that species. Such tables are created for each species (see example in Figure 1; the reader is referred to Kauffman [37] for full details). This tuneable model has previously been used to explore coevolutionary optimisation, particularly in the aforementioned comparison of partnering strategies [9]. We similarly use it here to systematically compare various techniques for the design mining approach. That is, each species is cast as a sub-thread of an overall design task, thereby enabling examination of the effects from varying their number (S), their individual complexity (K), and the degree of interdependence between them (C). The fitness calculations of each species are combined to give a global system performance. 2.4 Evolving Wind Farms As we have reviewed elsewhere [56], techniques such as EAs have been used to design wind turbine blades using CFD simulations, some in conjunction with surrogate models, e.g., Chen et al. [14]. EAs have also been extensively used to optimise the turbine positioning within wind farms, e.g., Mosetti et al. [44]. Most work has focused on arrays of homogeneous turbines, however wind farms of heterogeneous height have recently gained attention as a means to improve the overall power output for a given number of turbines [15, 20, 13]. Chamorro et al. [12] explored horizontal-axis wind turbine (HAWT) farms with large and small turbines positioned alternately. They found that size heterogeneity has positive effects on turbulent loading as a result of the larger turbines facing a more uniform turbulence distribution and the smaller turbines operating under lower turbulence levels. Craig et al. [17] have demonstrated a similar potential for heterogeneous height VAWT wind farms. Chowdhury et al. [16] optimised layouts of HAWT with heterogeneous rotor diameters using particle swarm optimisation and found that the optimal combination of turbines with differing rotor diameters significantly improved the wind 5 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models N =3 K=1 Species s1 1 n1 C=1 S=2 0 1 n2 n1 X=1 Species s2 1 n2 1 0 n3 n3 Species s1 gene n1 s1n1 s1n3 s2n1 fitness 0 0 0 0.57 0 0 1 0.12 0.09 0 1 0 0.16 0 1 1 0.44 1 0 0 0.66 1 0 1 1 1 0 0.33 0.44 1 1 1 Species s1 gene n2 s1n2 s1n1 s2n3 fitness 0 0 0 0.11 0 0 1 0.32 0.68 0 1 0 0.30 0 1 1 0.19 1 0 0 0.77 1 0 1 1 1 0 0.21 0.23 1 1 1 Species s1 gene n3 s1n3 s1n2 s2n3 fitness 0 0 0 0.75 0 0 1 0.42 0.25 0 1 0 0.28 0 1 1 0.13 1 0 0 0.58 1 0 1 1 1 0 0.66 0.91 1 1 1 Figure 1: The NKCS model: Each gene is connected to K randomly chosen local genes (solid lines) and to C randomly chosen genes in each of the X other species (dashed lines). A random fitness is assigned to each possible set of combinations of genes. The fitness of each gene is summed and normalised by N to give the fitness of the genome. An example NKCS model is shown above and example fitness tables are provided for species s1, where the s1 genome fitness is 0.416 when s1 = [101] and s2 = [110]. farm efficiency. Recently, Xie et al. [67] have performed simulations of wind farms with collocated VAWT and HAWT, showing the potential to increase the efficiency of existing HAWT wind farms by adding VAWTs. Conventional offshore wind farms require support structures fixed rigidly to the seabed, which currently limits their deployment to depths below 50 m. However, floating wind farms can be deployed in deep seas where the wind resources are strongest, away from shipping lanes and wind obstructions [52]. See Borg et al. [6] for a recent review of floating wind farms. They note that floating VAWT have many advantages over HAWT, e.g., lower centre of gravity, increased stability, and increased tolerance of extreme conditions. The design of floating wind farms is especially challenging since platform oscillations also need to be considered. EAs are beginning to be used to explore the design of floating support structures, e.g., Hall et al. [26] optimised HAWT platforms using a simple computational model to provide fitness scores. Significantly, all of these works have involved the use of CFD simulations with varying degrees of fidelity. Our pilot study found that asymmetrical pairs of VAWTs can be more efficient than similar symmetrical designs. In this paper, we extend our initial work to the heterogeneous design of an array of 6 closely positioned VAWT, which is currently effectively beyond the capabilities of accurate 3D CFD simulation; the approach performs optimisation in the presence of non-uniform wind velocity, complex inter-turbine wake effects, and multidirectional wind flow from nearby obstacles, which is extremely difficult to achieve accurately under high fidelity CFD simulation. In addition, previously the combined rotational 6 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Algorithm 1: Coevolutionary genetic algorithm 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 for each species do initialise population; select a random representative for each other species; for each individual in population do evaluate; end end while evaluation budget not exhausted do for each species do create an offspring using genetic operators; select a representative for each other species; evaluate the offspring; add offspring to species population; end end speed was simply used as the objective measure, whereas here we use the total angular kinetic energy of the array, which includes both mass and speed of rotation, and we use a more flexible spline representation that enables the potential exploitation of both drag and lift forces in conjunction with inter-turbine flow and turbulence from nearby obstacles. 3 Surrogate-assisted Coevolution The basic coevolutionary genetic algorithm (CGA) is outlined in Algorithm 1. Initially all individuals in each of the species/populations must be evaluated. Since no initial fitness values are known, a random individual is chosen in each of the other populations to form a global solution, however if there is a known good individual then that individual can be used instead. The CGA subsequently cycles between populations, selecting parents via tournament and creating offspring with mutation and/or crossover. The offspring are then evaluated using representative members from each of the other populations. At any point during evolution, each individual is assigned the maximum team fitness achieved by any team in which it has been evaluated, where the team fitness is the sum of the fitness scores of each collaborating member. For the basic surrogate-assisted CGA (SCGA) used in this paper, the CGA runs as normal except that each time a parent is chosen, λm number of offspring are created and then evaluated with an artificial neural network surrogate model; the single offspring with the highest approximated fitness is then evaluated on the real fitness function in collaboration with the fittest solution (best partner) in each other populations. See outline in Algorithm 2. The model is trained using backpropagation for T epochs; where an epoch consists of randomly selecting, without replacement, all individuals from a species population archive and updating the model weights at a learning rate β. The model weights are (randomly) reinitialised each time before training due to the temporal nature of the collaborating scheme. For both CGA and SCGA, a tournament size of 3 takes place for both selection and replacement. A limited form of elitism is used whereby the current fittest member of the 7 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Algorithm 2: Surrogate-assisted coevolutionary genetic algorithm 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 for each species do initialise population; select a random representative for each other species; for each individual in population do evaluate; archive; end end while evaluation budget not exhausted do for each species do initialise model; train model on species archive; select parent(s) using tournament selection; for λm number of times do create an offspring using genetic operators; predict offspring fitness using the model; end select the offspring with the highest model predicted fitness; select a representative for each other species; evaluate the offspring; add offspring to species population; archive offspring; end end population is given immunity from deletion. 4 NKCS Experimentation For the physical experiments performed in this paper, 6 VAWT are positioned in a row. Therefore, to simulate this interacting system, we explore the case where S = 6 and each species is affected by its proximate neighbours, i.e., X = 1 for the first and sixth species, and X = 2 for all others. Figure 2 illustrates the simulated topology. For all NKCS simulations performed, P = 20, N = 20, per allele mutation probability µ = 5%, and crossover probability is 0%. Where a surrogate model is used, the model parameters are: N input neurons, H = 10 hidden neurons, 1 output neuron, λm = 1000, T = 50, β = 0.1. All results presented are an average of 100 experiments consisting of 10 coevolutionary runs on 10 randomly generated NKCS functions. The performance of all algorithms are shown on four different K and C values, each representing a different point in the range of interand intra-population dependence. s1 s2 s3 s4 s5 s6 Figure 2: NKCS topology. Arrows indicate inter-species connectivity (X). 8 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 4.1 Coevolution We begin by comparing the traditional approach of partnering with the elite member in each other species (CGA-b) with performing additional evaluations (CGA-br), and explore any benefits to overall learning speed from refreshing the population fitness values as the fitness landscapes potentially shift; that is, all individuals in the other species populations are re-evaluated in collaboration with the current elite members each time a new fittest individual is found (CGA-re). As noted above, after Potter and De Jong [53], traditionally CEAs consider each population in turn. Thus, if S = 10 and each species population creates one offspring per turn, then 10 evaluations are required for the whole system. However, at the other end of this scale each population simultaneously generates a new individual each turn, and evaluates all offspring at once [11], therefore requiring only one evaluation for the whole system. Varying the number of offspring collaborators in this way is much like varying the systemlevel mutation rate. Therefore, we explore the case where all species offspring are created and tested simultaneously (CGA-o). In summary, the NKCS model is used to examine the following four different collaboration schemes: • CGA-b: each offspring is evaluated in collaboration with the current best individual in each of the other species populations. • CGA-br: each offspring is evaluated as in CGA-b, and additionally with a random member in each of the other populations. • CGA-re: each offspring is evaluated as in CGA-b, and all populations are re-evaluated when one makes a progress. • CGA-o: offspring are created in each species simultaneously and evaluated together. Figure 3 and Table 1 present the performance of the collaboration schemes. As can be seen, during the early stages of evolution, the mean best fitness of CGA-b is significantly greater than CGA-br and CGA-re for all tested K, C values, showing that performing additional evaluations results in a lower fitness compared with the approach of only collaborating with the elite members. At the end of the experiments, the three approaches generally reach approximately similar performance, suggesting that there is no penalty for this increase in early learning speed. For the case of both lower inter- and intra-population epistasis CGA-br performs better, which supports findings reported elsewhere [53, 9]. The approach of evaluating all offspring simultaneously (CGA-o) appears to be detrimental to performance under the simulated conditions. 4.2 Surrogate-assisted Coevolution In this section we compare the performance of CGA-b with the standard surrogate-assisted version (SCGA-b). In addition, we compare the performance of the standard surrogate approach where the models are presented only the N genes from their own species (SCGAb) with the case where the models are presented all N × S partner genes (SCGA-a). We also compare the standard approach of evaluating the most promising of λm offspring stemming from a single parent (SCGA-b) with searching the same number of offspring 9 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models N=20 K=6 C=2 S=6 4.2 4.0 4.0 3.8 3.8 Fitness Fitness N=20 K=2 C=2 S=6 4.2 3.6 CGA-b CGA-br CGA-re CGA-o 3.4 3.6 CGA-b CGA-br CGA-re CGA-o 3.4 3.2 3.2 0 500 1000 1500 2000 2500 3000 3500 4000 Evaluations 0 N=20 K=6 C=8 S=6 4.2 4.2 4.0 4.0 3.8 3.8 Fitness Fitness N=20 K=2 C=8 S=6 3.6 CGA-b CGA-br CGA-re CGA-o 3.4 500 1000 1500 2000 2500 3000 3500 4000 Evaluations 3.6 CGA-b CGA-br CGA-re CGA-o 3.4 3.2 3.2 0 500 1000 1500 2000 2500 3000 3500 4000 Evaluations 0 500 1000 1500 2000 2500 3000 3500 4000 Evaluations Figure 3: CGA mean best fitness. Results are an average of 100 experiments consisting of 10 coevolutionary runs of 10 random NKCS functions. CGA-b (triangle), CGA-br (circle), CGA-re (square), and CGA-o (diamond). where λm tournaments are performed to select parents that each create a single offspring (SCGA-p). Furthermore, due to the highly temporal nature of the individuals undergoing evaluation needing to partner with the elite members in each of the other species, it is possible that the surrogate model performance may degrade by using the entire data set for training. For example, individuals from the initial population may perform very differently when partnered with the elite individuals from later generations. A windowed approach of using only the most recent P evaluated individuals in each species for training seemed promising in a prior experiment coevolving a pair of VAWT, however was not statistically significant in practice [56]. Here we explore the effect for larger numbers of species where the temporal variance is potentially much higher (SCGA-bw). In summary, the algorithms tested: • SCGA-b: standard SCGA. • SCGA-a: global surrogate model construction. • SCGA-p: λm parents are selected via tournaments, each creating a single offspring and the most promising as suggested by the model is evaluated. • SCGA-bw: most recent P evaluated individuals used for training. 10 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Table 1: CGA best fitnesses after 480 and 3600 evaluations (averages of 100). The mean is highlighted in boldface where it is significantly different from CGA-b using a Mann-Whitney U test at the 95% confidence interval. CGA-b CGA-br After 480 evaluations: K2C2 3.8449 3.7141 K2C8 3.7767 3.6937 K6C2 3.8338 3.7359 K6C8 3.7626 3.6765 After 3600 evaluations: K2C2 4.1464 4.1536 K2C8 4.0700 4.0949 K6C2 4.1395 4.1321 K6C8 4.0390 4.0403 CGA-re CGA-o 3.6066 3.6387 3.6423 3.6105 3.8163 3.6424 3.7617 3.5761 3.9757 4.0469 4.0254 3.9926 4.1417 4.0269 4.1320 3.9279 Table 2: SCGA best fitnesses after 480 and 3600 evaluations (averages of 100). The mean is highlighted in boldface where it is significantly different from SCGA-b using a Mann-Whitney U test at the 95% confidence interval. SCGA-b CGA-b After 480 evaluations: K2C2 3.9094 3.8449 K2C8 3.8214 3.7767 K6C2 3.9160 3.8338 K6C8 3.7847 3.7626 After 3600 evaluations: K2C2 4.1392 4.1464 K2C8 4.0974 4.0700 K6C2 4.1733 4.1395 K6C8 4.0596 4.0390 SCGA-a SCGA-p SCGA-bw 3.8633 3.7537 3.8175 3.7750 3.9070 3.8477 3.8987 3.7851 3.9071 3.7778 3.8794 3.7252 4.1521 4.0558 4.1254 4.0571 4.1578 4.0970 4.1657 4.0630 4.2027 4.1383 4.2244 4.0849 The results are presented in Figure 4 and Table 2. As can be seen, the use of the surrogate model to identify more promising offspring clearly increases learning early in the search. For example, the mean best fitness of SCGA-b is significantly greater for all tested K, C values with the exception of very high inter- and intra-population epistasis. At the end of the experiments, similar optima are reached, showing that there is no penalty for this increase in early learning speed. The benefit of the divide-and-conquer strategy to model building can be seen by comparing SCGA-b with SCGA-a. The mean best fitness of SCGAb is significantly greater than SCGA-a for all four K, C values after 480 evaluations, with the exception of very high K and C; showing that purely local models are both efficient and scalable. Comparing SCGA-b with SCGA-p shows that the simple method of using the model we presented in our pilot study is quite robust as there is no significant difference. Finally, the windowed training scheme (SCGA-bw) was found to be significantly worse than using all data (SCGA-b) during the early stages of evolution, however later in the experiments reached a higher optima. 11 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models N=20 K=2 C=2 S=6 4.2 4.0 4.0 3.8 SCGA-b SCGA-a SCGA-p SCGA-bw CGA-b 3.4 3.2 0 3.8 3.4 3.2 500 1000 1500 2000 2500 3000 3500 4000 Evaluations 4.2 4.0 4.0 3.8 SCGA-b SCGA-a SCGA-p SCGA-bw CGA-b 3.4 3.2 0 0 3.8 SCGA-b SCGA-a SCGA-p SCGA-bw CGA-b 3.6 3.4 3.2 500 1000 1500 2000 2500 3000 3500 4000 Evaluations 500 1000 1500 2000 2500 3000 3500 4000 Evaluations N=20 K=6 C=8 S=6 4.4 4.2 3.6 SCGA-b SCGA-a SCGA-p SCGA-bw CGA-b 3.6 N=20 K=2 C=8 S=6 4.4 Fitness Fitness 4.2 3.6 N=20 K=6 C=2 S=6 4.4 Fitness Fitness 4.4 0 500 1000 1500 2000 2500 3000 3500 4000 Evaluations Figure 4: SCGA mean best fitness. Results are an average of 100 experiments consisting of 10 coevolutionary runs of 10 random NKCS functions. SCGA-b (triangle), SCGA-a (circle), SCGA-p (square), SCGA-bw (star), and CGA-b (diamond). 5 5.1 VAWT Wind Farm Design Methodology A single 2-stage 2-blade VAWT candidate with end plates is here created as follows. End plates are drawn in the centre of a Cartesian grid with a diameter of 35 mm and thickness of 1 mm. A central shaft 70 mm tall, 1 mm thick, and with a 1 mm hollow diameter is also drawn in the centre of the grid in order to mount the VAWT for testing. The 2D profile of a single blade on 1 stage is represented using 5 (x, y) co-ordinates on the Cartesian grid, i.e., 10 genes, x1 , y1 , ..., x5 , y5 . A spline is drawn from (x1 , y1 ) to (x3 , y3 ) as a quadratic Bézier curve, with (x2 , y2 ) acting as the control point. The process is then repeated from (x3 , y3 ) to (x5 , y5 ) using (x4 , y4 ) as control. The thickness of the spline is a fixed size of 1 mm. The co-ordinates of the 2D blade profile are only restricted by the plate diameter; that is, the start and end position of the spline can be located anywhere on the plate. To enable z-axis variation, 3 additional co-ordinates (i.e., 6 genes) are used to compute cubic Bézier curves in the xz and yz planes that offset the 2D profile. The xz-plane offset curve is formed from an x offset=0 on the bottom plate to an x offset=0 on the top plate using control points (zx1 , z1 ) and (zx2 , z2 ). The yz-plane offset curve is formed in the same way with zy1 and zy2 control points, however reusing z1 and z2 to reduce the number of parameters to optimise. Furthermore, an extra gene, r1 , specifies the degree of rotation whereby the blades of 12 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models (a) Seed design; genome: x1 = 15.1, y1 = 15.1, x2 = 22.1, y2 = 15.1, x3 = 25.7, y3 = 15.9, x4 = 32.1, y4 = 16.1, x5 = 32.1, y5 = 27.1, zx1 = 0, zx2 = 0, zy1 = 0, zy2 = 0, z1 = 20, z2 = 27.2, r1 = 0. (b) Seed design printed by a 3D printer; 35 mm diameter; 70 mm tall; 7 g; 45-min printing time at 0.3 mm resolution. Figure 5: Example VAWT. 1-stage are rotated from one end plate to the next through the z-axis to ultimately 0 − 180°. Thus, a total of 17 genes specify the design of a candidate VAWT. The blade is then duplicated and rotated 180° to form a 2-bladed design. The entire stage is then duplicated and rotated 90° to form the second stage of the VAWT; see example design in Figure 5(a). When physical instantiation is required, the design is fabricated by a 3D printer (Replicator 2; MakerBot Industries LLC, USA) using a polylactic acid (PLA) bioplastic at 0.3 mm resolution. Figure 5(b) shows the VAWT after fabrication. In order to provide sufficient training data for the surrogate model, initially CGA-b proceeds for 3 generations before the model is used, i.e., a total of 360 physical array evaluations with 60 evaluated individuals in each species. S = 6 species are explored, each with P = 20 individuals, a per allele mutation probability, µ = 25% with a mutation step size, σ1 = 3.6 (mm) for co-ordinates and σ2 = 18° for r1 , and a crossover probability of 0%. Each species population is initialised with the example design in Figure 5(a) and 19 variants mutated with µ = 100%. The individuals in each species population are initially evaluated in collaboration with the seed individuals in the other species populations. Thereafter, CGA-b runs as normal by alternating between species after a single offspring is formed and evaluated with the elite members from the other species. After 3 generations, SCGA-b is used for an additional generation. To explore whether there is any benefit in windowing the training data, the SCGA is subsequently rerun for 1 generation starting with the same previous CGA-b populations, however using only the current species population for model training (SCGA-bw). The model parameters: 17 input neurons, H = 10 hidden neurons, 1 output neuron, λm = 1000, T = 1000, β = 0.1. Each VAWT is treated separately by evolution and approximation techniques, i.e., heterogeneous designs could therefore emerge. The fitness, f , of each individual is the total angular kinetic energy of the collaborating array, S X f= KEi (1) i=1 13 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Figure 6: Experimental setup with 6 VAWT. Frame width 275 mm, height 235 mm. Vertical support pillars 10 × 15 × 235 mm. Upper and lower cross bars each with height 40 mm, thickness 1 mm, and protruding 8 mm. VAWT freely rotate on rigid metal pins 1 mm in diameter and positioned 42.5 mm adjacently. where the angular kinetic energy (J), KE, of an individual VAWT, KE = 1 2 Iω 2 (2) 1 2 2 with angular velocity (rad/s), ω = rpm 60 2π, and moment of inertia (kg·m ), I = 2 mr with m mass (kg), and r radius (m). The rotational speed (rpm) is here measured using a digital photo laser tachometer (PCE-DT62; PCE Instruments UK Ltd) by placing a 10 × 2 mm strip of reflecting tape on the outer tip of each VAWT and recording the maximum achieved over the period of ∼ 30 s during the application of wind generated by a propeller fan. Figure 6 shows the test environment with the 30 W, 3500 rpm, 304.8 mm propeller fan, which generates 4.4 m/s wind velocity, and 6 turbines mounted on rigid metal pins 1 mm in diameter and positioned 42.5 mm adjacently and 30 mm from the propeller fan. That is, there is an end plate separation distance of 0.2 diameters between turbines. It is important to note that the wind generated by the fan is highly turbulent with non-uniform velocity and direction across the test platform, i.e., each turbine position receives a different amount of wind energy from different predominant directions and wind reflecting from the test frame may cause multi-directional wind flow. Thus, the designs evolved under such conditions will adapt to these exact environmental circumstances. 14 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 5.2 Results Each generation consisted of 120 fabrications and array evaluations. After evaluating all individuals in the initial species populations, no mutants were found to produce a greater total kinetic energy than the seed array. After 1 evolved CGA-b generation, the fittest array combination generated a greater total kinetic energy of 7.6 mJ compared with the initial seed array, which produced 5.9 mJ. A small increase in total mass of 42 g to 44.8 g was also observed. After 2 evolved CGA-b generations, the fittest array generated a total kinetic energy of 10 mJ with a further small increase in total mass to 45.6 g. SCGA-b was then used for 1 additional generation and produced a total kinetic energy of 12.2 mJ with a further increase in mass to 49.3 g. The fittest SCGA-bw array produced a greater total kinetic energy of 14.8 mJ than SCGA-b. Furthermore, the SCGA-bw mean kinetic energy (M = 12.27, SD = 1.29, N = 120) was significantly greater than SCGA-b (M = 10.56, SD = 0.93, N = 120) using a two-tailed Mann-Whitney test (U = 2076, p ≤ 0.001), showing that windowing the model training data was found to be beneficial in this experiment. SCGA-b and SCGA-bw appear to have predominantly exploited different components of the fitness measure, with SCGAb finding heavier turbine designs (+8%) that maintain approximately the same rpm (+3%), whereas SCGA-bw discovered designs that were approximately the same mass (+0.6%) with significantly increased rpm (+22%). Figure 7(a) shows the total angular kinetic energy of the fittest arrays each generation; Figure 7(b) shows the total mass, and Figure 7(c) the total rpm. The cross sections of the fittest array designs can be seen in Figures 8–12. When the position of the final evolved SCGA-b array was inverted, i.e., the first species design being swapped with the sixth, second swapped with fifth, etc., a decrease in total rpm of 17.8% was observed, causing a reduction in total KE of 36.7%. A similar test was performed for the final evolved SCGAbw array and the total rpm decreased by 14% with a consequential decrease in total KE of 22%, showing that evolution has exploited position-specific characteristics. It is interesting to note the similarity of some of the evolved VAWTs with human engineered designs. Bach [3] performed one of the earliest morphological studies of Savonius VAWT and found increased aerodynamic performance with a blade profile consisting of a 2/3 flattened trailing section and a larger blade overlap to reduce the effect of the central shaft, which is similar to the fourth species designs in Figures 10(d) and 12(d). The evolved VAWT in the second species, e.g., Figures 10(b) and 12(b), overall appear more rounded and similar to the classic S-shape Savonius design [60]. There appears to be little twist rotation along the z-axis of the evolved designs, which may be a consequence of the initial seeding or due to the test conditions having strong and persistent wind velocity from a single direction; that is, starting torque in low wind conditions is not a component of fitness in these experiments where twisted designs may be more beneficial. 6 Conclusions Design mining represents a methodology through which the capabilities of computational intelligence can be exploited directly in the physical world through 3D printing. Our previous pilot study [55] considered the parallel design of two interacting objects. In this paper we have used a well-known abstract model of coevolution to explore and extend various techniques from the literature, with an emphasis on reducing the number of fitness function evaluations. Our results suggest the round-robin evaluation process using the best 15 20 50 15 Total mass (g) Total angular kinetic energy (mJ) R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 10 5 0 100 SCGA-bw SCGA-b CGA-b 150 200 250 300 350 Fabrications 400 450 48 46 44 SCGA-bw SCGA-b CGA-b 42 40 100 500 150 200 Total rotation speed (rpm) (a) Array angular kinetic energy. 250 300 350 Fabrications 400 450 500 (b) Array mass. 4000 3500 3000 SCGA-bw SCGA-b CGA-b 2500 2000 100 150 200 250 300 350 400 450 500 Fabrications (c) Array rotation speed. Figure 7: Performance of the fittest evolved VAWT arrays. CGA-b (circle), SCGA-b (triangle), SCGAbw (square). The SCGAs are used only after 360 evaluations (i.e., 3 generations) of the CGA since sufficient training data is required. solution in each other population is robust [53], as is our previously presented sampling method of surrogate models built using strictly population specific data. It has also been shown that the same techniques remain effective when scaling to 6 interacting species. These findings were than applied to a more complex version of the wind turbine design task considered in our pilot study, primarily moving from designing a pair of heterogeneous VAWT to a system of 6 turbines. As noted above, the SCGA remains robust to an increasing number of turbines since the number of inputs to the models remains constant. Indeed, we are unaware of a real-world coevolutionary optimisation task of this scale with or without surrogate models. The VAWT spline representation used here is also much more flexible than the simple integer approach used previously, enabling the exploration of designs where the blades are not attached to the central shaft. This has enabled designs to emerge that not only exploit or compensate for the wind interaction with the central shaft, but also the effect of mass and vibrational forces as the turbines freely rotate around the mounted pins at high speed. That is, it has been shown possible to exploit the fan-generated wind conditions in the environment, including the complex inter-turbine turbulent flow conditions, and position-specific wind velocity, to design an array of 6 different turbines that work together collaboratively to produce the maximum angular kinetic energy. Note that the starting design for the turbines was based upon a standard commercial design and performance in 16 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models the array was seen to double over the time allowed. 3D printing provides a very flexible way to rapid-prototype designs for testing. One of the most significant benefits of the technology is a ‘complexity paradox’ wherein the complexity of the printed shape is highly uncorrelated with production time/cost. With conventional manufacturing, the more complex an object is, the more it costs to fabricate (especially when sub-components require complex assembly processes.) However, with 3D printing, the time and cost to fabricate an object mostly depends on the amount of material used. Moreover, the more complex a shape is, the more numerous the spaces (voids) that exist between components, and thus the smaller the quantity of material required. There is thus a synergy between computational intelligence techniques that can search a wide variety of complex shapes in a complex environment whilst also exploring the effects of novel materials. Here only PLA plastic was used to fabricate designs, however there are now over a hundred different materials that 3D printers can use, ranging from cells to titanium. Future work may explore the use of flexible materials and multi-material designs, which may result in very different designs of future wind farms. In addition, 3D printing can produce designs at different fidelity, such as slower more accurate prints for subtle optimisation or rapid coarse designs for quick evaluation. Fabrication can also be parallelised with multiple printers, e.g., a different printer for each species. Future work may also use the power generated as the objective under different wind conditions specific to the target environment, e.g., low cut-in speed; the design of larger wind farms, including turbine location, multiple rows of turbines, and collocation of VAWT and HAWT; the exploration of alternative surrogate models to reduce the number of fabrications required; alternative shape representations that can enable increased morphological freedom, including varying the number of blades, e.g., supershapes [54]; and the use of novel fabrication materials. In addition, future avenues of research may include arrays of collaborating variable-speed wind turbines, turbines located on roof tops, and floating wind turbines. The use of adaptive design representations, allowing the number of shape parameters to increase as necessary (e.g., [47]), which will involve adaptive/coevolved surrogate models (e.g., [61]) will also be of interest. The issue of scalability remains an important area of future research. Changes in dimensionality may greatly affect performance, however it remains to be seen how the performance will change in the presence of other significant factors such as turbine wake interactions. Larger 3D printing and testing capabilities could be used to design larger turbines using the same method, although with longer fabrication and testing times. However, 3D printing is a rapidly developing technology capable of fabricating increasingly bigger parts with decreasing production times; for example, the EBAM 300 (Sciaky Ltd., USA) can produce a 10 ft long titanium aircraft structure in 48 hrs. On the micro-scale, turbines with a rotor diameter smaller than 2 mm can be used to generate power, e.g., for wireless sensors [29], and in this case high precision 3D printers would be required. Recently, 3D printing capabilities have been added to aerial robots to create flying 3D printers [30], which may eventually enable swarms of robots to rapidly create, test, and optimise designs in areas that are difficult to access. The design mining approach outlined here provides a general and flexible framework for engineering design with applications that cannot be simulated due to the complexity of materials or environment. We anticipate that in the future, such approaches will be used to create highly unintuitive yet efficient bespoke solutions for a wide range of complex engineering design applications. 17 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models (a) s1 (b) s2 (c) s3 (d) s4 (e) s5 (f) s6 Figure 8: Cross sections of the fittest VAWT array after 1 CGA-b generation, i.e., initial population. No mutants resulted in greater total KE than the seed array. Total KE = 5.9 mJ, m = 42 g, 2332 rpm. (a) s1 (b) s2 (c) s3 (d) s4 (e) s5 (f) s6 Figure 9: Cross sections of the fittest evolved VAWT array after 2 CGA-b generations. Total KE = 7.6 mJ, m = 44.8 g, 2677 rpm. (a) s1 (b) s2 (c) s3 (d) s4 (e) s5 (f) s6 Figure 10: Cross sections of the fittest evolved VAWT array after 3 CGA-b generations. Total KE = 10 mJ, m = 45.6 g, 3004 rpm. (a) s1 (b) s2 (c) s3 (d) s4 (e) s5 (f) s6 Figure 11: Cross sections of the fittest evolved VAWT array after 3 CGA-b generations plus 1 SCGA-b generation. Total KE = 12.2 mJ, m = 49.3 g, 3094 rpm. (a) s1 (b) s2 (c) s3 (d) s4 (e) s5 (f) s6 Figure 12: Cross sections of the fittest evolved VAWT array after 3 CGA-b generations plus 1 SCGAbw generation. Total KE = 14.8 mJ, m = 45.9 g, 3668 rpm. 18 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models Acknowledgements This work was supported by the Engineering and Physical Sciences Research Council under Grant EP/N005740/1, and the Leverhulme Trust under Grant RPG-2013-344. The data used to generate the graphs are available at: http://researchdata.uwe.ac.uk/166. References 1. Akwa, J. V., Vielmo, H. A., & Petry, A. P. (2012). A review on the performance of Savonius wind turbines. Renewable and Sustainable Energy Reviews, 16(5), 3054–3064. 2. Augustsson, P., Wolff, K., & Nordin, P. (2002). Creation of a learning, flying robot by means of evolution. In Proceedings of the Genetic and Evolutionary Computation Conference, (pp. 1279–1285). San Francisco, CA, USA: Morgan Kaufmann. 3. Bach, G. (1931). Untersuchungen über Savonius-rotoren und verwandte strömungsmaschinen. Forschung auf dem Gebiet des Ingenieurwesens A, 2(6), 218–231. 4. Becker, J. M., Lohn, J. D., & Linden, D. (2014). In-situ evolution of an antenna array with hardware fault recovery. In Proceedings of the IEEE International Conference on Evolvable Systems, (pp. 69–76). Piscataway, NJ, USA: IEEE Press. 5. Benard, N., Pons-Prats, J., Periaux, J., Bugeda, G., Braud, P., Bonnet, J. P., & Moreau, E. (2016). Turbulent separated shear flow control by surface plasma actuator: Experimental optimization by genetic algorithm approach. Experiments in Fluids, 57(2), 22. 6. Borg, M., Shires, A., & Collu, M. (2014). Offshore floating vertical axis wind turbines, dynamics modelling state of the art. Part I: Aerodynamics. Renewable and Sustainable Energy Reviews, 39, 1214–1225. 7. Boria, F., Stanford, B., Bowman, S., & Ifju, P. (2009). Evolutionary optimization of a morphing wing with wind-tunnel hardware in the loop. AIAA Journal, 47(2), 399–409. 8. Box, G. E. P. (1957). Evolutionary operation: A method for increasing industrial productivity. Journal of the Royal Statistical Society: Series C (Statistical Methodology), 6(2), 81–101. 9. Bull, L. (1997a). Evolutionary computing in multi-agent environments: Partners. In T. Bäck (Ed.) Proceedings of the 7th International Conference on Genetic Algorithms, (pp. 370–377). San Francisco, CA, USA: Morgan Kaufmann. 10. Bull, L. (1997b). Model-based evolutionary computing: A neural network and genetic algorithm architecture. In Proceedings of the IEEE International Conference on Evolutionary Computation, (pp. 611–616). Piscataway, NJ, USA: IEEE Press. 11. Bull, L., & Fogarty, T. (1993). Coevolving communicating classifier systems for tracking. In R. F. Albrecht, C. R. Reeves, & N. C. Steele (Eds.) Artificial Neural Networks and Genetic Algorithms, (pp. 522–527). Berlin, Germany: Springer. 12. Chamorro, L. P., Tobin, N., Arndt, R. E. A., & Sotiropoulos, F. (2014). Variable-sized wind turbines are a possibility for wind farm optimization. Wind Energy, 17(10), 1483–1494. 13. Chen, K., Song, M. X., Zhang, X., & Wang, S. F. (2016). Wind turbine layout optimization with multiple hub height wind turbines using greedy algorithm. Renewable Energy, 96(A), 676–686. 14. Chen, Y., Hord, K., Prater, R., Lian, Y., & Bai, L. (2012). Design optimization of a vertical axis wind turbine using a genetic algorithm and surrogate models. In 12th AIAA Aviation Technology, Integration, and Operations (ATIO) Conference and 14th AIAA/ISSMO Multidisciplinary Analysis and Optimization Conference. Reston, VA, USA: AIAA. 15. Chen, Y., Li, H., Jin, K., & Song, Q. (2013). Wind farm layout optimization using genetic algorithm with different hub height wind turbines. Energy Conversion and Management, 70, 56–65. 19 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 16. Chowdhury, S., Zhang, J., Messac, A., & Castillo, L. (2012). Unrestricted wind farm layout optimization (UWFLO): Investigating key factors influencing the maximum power generation. Renewable Energy, 38(1), 16–30. 17. Craig, A. E., Dabiri, J. O., & Koseff, J. R. (2016). Flow kinematics in variable-height rotating cylinder arrays. Journal of Fluids Engineering, 138(11), 111203. 18. Davies, Z. S., Gilbert, R. J., Merry, R. J., Kell, D. B., Theodorou, M. K., & Griffith, G. W. (2000). Efficient improvement of silage additives by using genetic algorithms. Applied and Environmental Microbiology, 66(4), 1435–1443. 19. Dunham, B., Fridshal, R., & North, J. H. (1963). Design by natural selection. Synthese, 15(2), 254–259. 20. DuPont, B., Cagan, J., & Moriarty, P. (2016). An advanced modeling system for optimization of wind farm layout and wind turbine sizing using a multi-level extended pattern search algorithm. Energy, 106, 802–814. 21. Ferreira, C. S., & Geurts, B. (2015). Aerofoil optimization for vertical-axis wind turbines. Wind Energy, 18(8), 1371–1385. 22. Ficici, S. G., Watson, R. A., & Pollack, J. B. (1999). Embodied evolution: A response to challenges in evolutionary robotics. In J. L. Wyatt, & J. Demiris (Eds.) Proceedings of the European Workshop on Learning Robots, vol. 1812 of LNCS, (pp. 14–22). Berlin, Germany: Springer. 23. Gautier, N., Aider, J.-L., Duriez, T., Noack, B. R., Segond, M., & Abel, M. (2015). Closed-loop separation control using machine learning. Journal of Fluid Mechanics, 770, 442–457. 24. Goh, C. K., Lim, D., Ma, L., Ong, Y. S., & Dutta, P. S. (2011). A surrogate-assisted memetic coevolutionary algorithm for expensive constrained optimization problems. In Proceedings of the IEEE Congress on Evolutionary Computation, (pp. 744–749). Piscataway, NJ, USA: IEEE Press. 25. González, J. S., Payán, M. B., Santos, J. M. R., & González-Longatt, F. (2014). A review and recent developments in the optimal wind-turbine micro-siting problem. Renewable and Sustainable Energy Reviews, 30, 133–144. 26. Hall, M., Buckham, B., & Crawford, C. (2013). Evolving offshore wind: A genetic algorithmbased support structure optimization framework for floating wind turbines. In OCEANS - Bergen, 2013 MTS/IEEE, (pp. 1–10). Piscataway, NJ, USA: IEEE Press. 27. Harding, S. L., & Miller, J. F. (2004). Evolution in materio: Initial experiments with liquid crystal. In Proceedings of the NASA/DoD Workshop on Evolvable Hardware, (pp. 289–299). Washington DC, USA. 28. Herdy, M. (1996). Evolution strategies with subjective selection. In Proceedings of the 4th Conference on Parallel Problem Solving from Nature, (pp. 22–26). Berlin, Germany: Springer. 29. Howey, D. A., Bansal, A., & Holmes, A. S. (2011). Design and performance of a centimetre-scale shrouded wind turbine for energy harvesting. Smart Materials and Structures, 20(8), 085021. 30. Hunt, G., Mitzalis, F., Alhinai, T., Hooper, P. A., & Kovac, M. (2014). 3D printing with flying robots. In Proceedings of the IEEE International Conference on Robotics and Automation, (pp. 4493– 4499). Piscataway, NJ, USA: IEEE Press. 31. Hunt, R., Hornby, G. S., & Lohn, J. D. (2005). Toward evolved flight. In Proceedings of the Genetic and Evolutionary Computation Conference, (pp. 957–964). New York, NY, USA: ACM. 32. Husbands, P., & Mill, F. (1991). Simulated coevolution as the mechanism for emergent planning and scheduling. In R. K. Belew, & L. B. Booker (Eds.) Proceedings of the 4th International Conference on Genetic Algorithms, (pp. 264–270). San Francisco, CA, USA: Morgan Kaufmann. 33. Islam, M. R., Ting, D. S.-K., & Fartaj, A. (2008). Aerodynamic models for Darrieus-type straightbladed vertical axis wind turbines. Renewable and Sustainable Energy Reviews, 12(4), 1087–1109. 20 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 34. Jakobi, N. (1997). Half-baked, ad-hoc and noisy: Minimal simulations for evolutionary robotics. In Proceedings of the 4th European Conference on Artificial Life, (pp. 348–357). Cambridge, MA, USA: MIT Press. 35. Jin, Y. (2011). Surrogate-assisted evolutionary computation: Recent advances and future challenges. Swarm and Evolutionary Computation, 1(2), 61–70. 36. Judson, R. S., & Rabitz, H. (1992). Teaching lasers to control molecules. Physical Review Letters, 68(10), 1500–1503. 37. Kauffman, S. A. (1993). The origins of order: Self-organisation and selection in evolution. New York, NY, USA: Oxford University Press. 38. Kauffman, S. A., & Johnsen, S. (1991). Coevolution to the edge of chaos: Coupled fitness landscapes, poised states and coevolutionary avalanches. Journal of Theoretical Biology, 149(4), 467–505. 39. King, R. D., Whelan, K. E., Jones, F. M., Reiser, P. G. K., Bryant, C. H., Muggleton, S. H., Kell, D. B., & Olive, S. G. (2004). Functional genomic hypothesis generation and experimentation by a robot scientist. Nature, 427(6971), 247–252. 40. Knowles, J. (2009). Closed-loop evolutionary multiobjective optimization. IEEE Computational Intelligence Magazine, 4(3), 77–91. 41. Lipson, H., & Pollack, J. (2000). Automatic design and manufacture of robotic lifeforms. Nature, 406(6799), 974–978. 42. Long, J. H., Koob, T. J., Irving, K., Combie, K., Engel, V., Livingston, N., Lammert, A., & Schumacher, J. (2006). Biomimetic evolutionary analysis: Testing the adaptive value of vertebrate tail stiffness in autonomous swimming robots. Journal of Experimental Biology, 209, 4732–4746. 43. Martin, J. (1991). Rapid Application Development. New York, NY, USA: Macmillan. 44. Mosetti, G., Poloni, C., & Diviacco, B. (1994). Optimization of wind turbine positioning in large windfarms by means of a genetic algorithm. Journal of Wind Engineering and Industrial Aerodynamics, 51(1), 105–116. 45. Nolfi, S. (1992). Evolving non-trivial behaviours on real-robots: A garbage collecting robot. Robotics and Autonomous Systems, 22, 187–198. 46. O’Hagan, S., Dunn, W. B., Brown, M., Knowles, J. D., & Kell, D. B. (2005). Closed-loop, multiobjective optimization of analytical instrumentation: Gas chromatography/time-of-flight mass spectrometry of the metabolomes of human serum and of yeast fermentations. Analytical Chemistry, 77(1), 290–303. 47. Olhofer, M., Jin, Y., & Sendhoff, B. (2001). Adaptive encoding for aerodynamic shape optimization using evolution strategies. In Proceedings of the IEEE Congress on Evolutionary Computation, (pp. 576–583). Piscataway, NJ, USA: IEEE Press. 48. Olhofer, M., Yankulova, D., & Sendhoff, B. (2011). Autonomous experimental design optimization of a flapping wing. Genetic Programming and Evolvable Machines, 12(1), 23–47. 49. Ong, Y. S., Keane, A. J., & Nair, P. B. (2002). Surrogate-assisted coevolutionary search. In Proceedings of the 9th International Conference on Neural Information Processing, vol. 3, (pp. 1140–1145). Piscataway, NJ, USA: IEEE Press. 50. Parezanović, V., Laurentie, J.-C., Fourment, C., Delville, J., Bonnet, J.-P., Spohn, T., A. Duriez, Cordier, L., Noack, M., B. R. andd Abel, Segond, M., Shaqarin, T., & Brunton, S. L. (2015). Mixing layer manipulation experiment—From open-loop forcing to closed-loop machine learning control. Flow, Turbulence and Combustion, 94(1), 155–173. 51. Pask, G. (1958). Physical analogues to the growth of a concept. In Mechanisation of Thought Processes, no. 10 in National Physical Laboratory Symposium. London, UK: Her Majesty’s Stationery Office. 21 R. J. Preen and L. Bull: On Design Mining: Coevolution and Surrogate Models 52. Paulsen, U. S., Vita, L., Madsen, H. A., Hattel, J., Ritchie, E., Leban, K. M., Berthelsen, P. A., & Carstensen, S. (2012). 1st DeepWind 5 MW baseline design. Energy Procedia, 24, 27–35. 53. Potter, M. A., & De Jong, K. A. (1994). A cooperative coevolutionary approach to function optimization. In Y. Davidor, H.-P. Schwefel, & R. Männer (Eds.) Proceedings of the 3rd Conference on Parallel Problem Solving from Nature, (pp. 249–257). Berlin, Germany: Springer. 54. Preen, R. J., & Bull, L. (2014). Towards the evolution of vertical-axis wind turbines using supershapes. Evolutionary Intelligence, 7(3), 155–187. 55. Preen, R. J., & Bull, L. (2015). Toward the coevolution of novel vertical-axis wind turbines. IEEE Transactions on Evolutionary Computation, 19(2), 284–294. 56. Preen, R. J., & Bull, L. (2016). Design mining interacting wind turbines. Evolutionary Computation, 24(1), 89–111. 57. Rechenberg, I. (1971). Evolutionsstrategie—Optimierung technischer systeme nach prinzipien der biologischen evolution. Ph.D. thesis, Department of Process Engineering, Technical University of Berlin, Berlin, Germany. 58. Rieffel, J., & Sayles, D. (2010). EvoFAB: A fully embodied evolutionary fabricator. In G. Tempesti, A. M. Tyrrell, & J. F. Miller (Eds.) Proceedings of the 9th International Conference on Evolvable Systems, (pp. 372–380). Berlin, Germany: Springer. 59. Rosenblatt, F. (1962). Principles of Neurodynamics: Perceptrons and the Theory of Brain Mechanisms. Washington DC, USA: Spartan Books. 60. Savonius, S. J. (1930). Wind rotor. US Patent 1 766 765, June 24. 61. Schmidt, M. D., & Lipson, H. (2008). Coevolution of fitness predictors. IEEE Transactions on Evolutionary Computation, 12(6), 736–749. 62. Schwefel, H.-P. (1975). Evolutionsstrategie und numerische Optimierung. Ph.D. thesis, Department of Process Engineering, Technical University of Berlin, Berlin, Germany. 63. Sherman, L., Ye, J. Y., Albert, O., & Norris, T. B. (2002). Adaptive correction of depth-induced aberrations in multiphoton scanning microscopy using a deformable mirror. Journal of Microscopy, 206(1), 65–71. 64. Singh, J., Ator, M. A., Jaeger, E. P., Allen, M. P., Whipple, D. A., Soloweij, J. E., Chowdhary, S., & Treasurywala, A. M. (1996). Application of genetic algorithms to combinatorial synthesis: A computational approach to lead identification and lead optimization. Journal of the American Chemical Society, 118(7), 1669–1676. 65. Theis, M., Gazzola, G., Forlin, M., Poli, I., Hanczyc, M., & Bedau, M. (2006). Optimal formulation of complex chemical systems with a genetic algorithm. In Proceedings of the European Conference on Complex Systems, (p. 50). Saïd Business School, University of Oxford, Oxford, UK. 66. Thompson, A. (1998). Hardware Evolution: Automatic design of electronic circuits in reconfigurable hardware by artificial evolution. Berlin, Germany: Springer. 67. Xie, S., Archer, C. L., Ghaisas, N., & Meneveau, C. (in press). Benefits of collocating vertical-axis and horizontal-axis wind turbines in large wind farms. Wind Energy. doi:10.1002/we.1990. 68. Xudong, W., Shen, W. Z., Zhu, W. J., Sørensen, J. N., & Jin, C. (2009). Shape optimization of wind turbine blades. Wind Energy, 12(8), 781–803. 22
5cs.CE
Band depths based on multiple time instances arXiv:1703.09269v1 [math.ST] 27 Mar 2017 Ignacio Cascos1 and Ilya Molchanov2 Abstract Bands of vector-valued functions f : T 7→ Rd are defined by considering convex hulls generated by their values concatenated at m different values of the argument. The obtained m-bands are families of functions, ranging from the conventional band in case the time points are individually considered (for m = 1) to the convex hull in the functional space if the number m of simultaneously considered time points becomes large enough to fill the whole time domain. These bands give rise to a depth concept that is new both for real-valued and vector-valued functions. 1 Introduction The statistical concept of depth is well known for random vectors in the Euclidean space. It describes the relative position of x from Rd with respect to a probability distribution on Rd or with respect to a sample x1 , . . . , xn ∈ Rd from it. Given a centrally symmetric distribution (for an appropriate notion of symmetry), the point of central symmetry is the deepest point (center of the distribution), while the depth of outward points is low. The concept of depth has been used in the context of trimming multivariate data, to derive depth-based estimators (e.g. depth-weighted L-estimators or ranks based on the center-outward ordering induced by the depth), to assess robustness of statistical procedures, and for classification purposes, to name a few areas, see [2, 9, 17] for extensive surveys and further references. Often, the relative position of a point x with respect to a sample is defined with respect to the convex hull of the sample or a part of the sample. For Department of Statistics, Universidad Carlos III de Madrid, Av. Universidad 30, E-28911 Leganés (Madrid), Spain [email protected] · Department of Mathematical Statistics and Actuarial Science, University of Berne, Sidlerstr. 5, CH-3012 Berne, Switzerland [email protected] 1 2 Ignacio Cascos and Ilya Molchanov instance, the classical concept of the simplicial depth appears as the fraction of (d + 1)-tuples of sampled points whose convex hull contains x, see [10]. Its population version is given by the probability that x is contained in the convex hull of (d + 1) i.i.d. copies of the random vector. In high-dimensional spaces the curse of dimensionality comes into play and the convex hull of a finite set of sampled points forms a rather “thin” set and so it is very unlikely to expect that many points belong to it. Even the convex hull of the whole sample becomes rather small if the space dimension d is much larger than the sample size n. The situation is even worse for infinite-dimensional spaces that are typical in functional data analysis. In view of this, a direct generalisation of the simplicial depth and convex hull depth concepts leads to the situation where most points in the space have depth zero, see also [8], who discuss problems inherent with the half-space depth in infinite-dimensional spaces, most importantly zero depth and the lack of consistency, see also [15]. One possible way to overcome such difficulties is to consider the depth for the collection of function values at any given time argument value t and then integrate (maybe weightedly) over the argument space. This idea goes back to [6] and has been further studied in [4, 14]. Another approach is based on considering the position of a function relative to the band generated by functions from the sample. The band generated by real-valued functions is defined as the interval-valued function determined by the pointwise minimum and maximum of the functions from the sample. The corresponding band depth has been studied in [11, 12]. In the multivariate case the band becomes a set-valued function that at each point equals the convex hull of the values of functions from the sample, see [13]. Another multivariate generalisation of the band depth in [7] is based on taking convex combinations of band depths associated to each component. Yet another multivariate functional depth concept was studied in [4] by integrating the half-space depth over the time domain, see also [3]. It is argued in [7] that the multivariate setting makes it possible to incorporate other functional data parameters, such as derivatives, into the sample. It is also possible to combine a function with its smoothed version, possibly with different bandwidths. In this paper we suggest a new concept of multivariate functional depth based on taking convex hulls of the functions’ values at m ≥ 1 time points combined to build a new higher-dimensional vector. In a sense, this concept pulls together values of the function at different points and so naturally incorporates the time dependency effects, and so better reflects the shape of curves. Two examples at which these m-band depths are used are presented. The constructions described in Section 3 remind very much the conventional simplicial band depth, where the main point is to check if a point belongs to the convex hull of a subsample. The underlying convex hull in the functional space is replaced by the band, as in [11]. It is shown that the introduced band depth satisfies the main properties described in [4, 13]. The theoretical computation of the m-band depth is usually unfeasible, since it Band depths based on multiple time instances 3 requires computing the probabilities that a point belongs to a convex hull of random points. Still, its empirical variant is consistent and rather easy to compute. 2 Regions formed by samples in functional spaces m-bands Let E be a linear space of functions f : T 7→ Rd whose argument t belongs to a rather general topological space T . For example, E may be the family of continuous functions on an interval T or a collection of d-vectors if T is a finite set. Consider functions f1 , . . . , fj ∈ E. The convex hull conv(f1 , . . . , fj ) of these functions is the family of functions f ∈ E that can be represented as f (t) = j X λi fi (t) , t∈T, i=1 for some non-negative constants λ1 , . . . , λj that sum up to one. If the coefficients λ1 , . . . , λj are allowed to be arbitrary functions of t, we arrive at the family of functions f ∈ E such that, for all t ∈ T , the value f (t) belongs to the convex hull of f1 (t), . . . , fj (t). Following [11, 13] for univariate (resp. multivariate) functions, the set of such functions is called the band generated by f1 , . . . , fj and is denoted by band(f1 , . . . , fj ). It is obvious that conv(f1 , . . . , fj ) ⊂ band(f1 , . . . , fj ). If d = 1 (as in [11]), then band(f1 , . . . , fj ) consists of all functions f such that min fi (t) ≤ f (t) ≤ max fi (t) , t ∈ T . (1) i=1,...,j i=1,...,j In order to obtain a set of functions with interior points, one should avoid the case when the convex hull of f1 (t), . . . , fj (t) is of a lower dimension than d at some t. In particular, for this j should be greater than d. We define nested families of functions that lie between the band and the convex hull generated by the sample. Definition 1. The m-band, bandm (f1 , . . . , fj ), generated by f1 , . . . , fj ∈ E is the family of functions f ∈ E such that, for all t1 , . . . , tm ∈ T , the vector (f (t1 ), . . . , f (tm )) belongs to the convex hull of {(fi (t1 ), . . . , fi (tm )), i = 1, . . . , j}, i.e. (f (t1 ), . . . , f (tm )) = j X i=1 λi (fi (t1 ), . . . , fi (tm )) (2) 4 Ignacio Cascos and Ilya Molchanov for non-negative real numbers λ1 , . . . , λj that sum up to one and may depend on (t1 , . . . , tm ). Example 1 (Special cases). If T = {t} is a singleton, the functions become vectors in Rd and the m-band is their convex hull for all m ≥ 1. If T is a finite set of cardinality k and d = 1, then the functions f1 , . . . , fj of t ∈ T can be viewed as vectors xi = (xi1 , . . . , xik ) ∈ Rk , i = 1, . . . , j. The 1-band is the smallest hyperrectangle that contains x1 , . . . , xj , which is given by ×[al , bl ] for al = min(xil , i = 1, . . . , j) and bl = max(xil , i = 1, . . . , j) for l = 1, . . . , k. The 2-band is obtained as the largest set such that its projections on each 2-dimensional coordinate plane equals the projection of the convex hull of x1 , . . . , xk . The k-band coincides with the convex hull of x1 , . . . , xj . If m = 1 and d = 1, then we recover the band introduced in [11] and given by (1), so that band(f1 , . . . , fj ) = band1 (f1 , . . . , fj ). If f ∈ bandm (f1 , . . . , fj ), then each convex combination of the values for f1 , . . . , fj and f can be written as a convex combination of the values of f1 , . . . , fj and so bandm (f1 , . . . , fj ) = bandm (f1 , . . . , fj , f ) . The m-band is additive with respect to the Minkowski (elementwise) addition. In particular, bandm (g + f1 , . . . , g + fj ) = g + bandm (f1 , . . . , fj ) (3) for all g ∈ E. The m-band is equivariant with respect to linear transformations, that is, bandm (Af1 , . . . , Afj ) = {Af : f ∈ bandm (f1 , . . . , fj )} (4) for all A : T 7→ Rd×d with A(t) nonsingular for all t ∈ T . If all functions generating an m-band are affected by the same phase variation, the phase of the m-band is affected as shown below, bandm (f1 ◦ h, . . . , fj ◦ h) = {f ◦ h : f ∈ bandm (f1 , . . . , fj )} (5) for any bijection h : T 7→ T . If d = 1 and E consists of continuously differentiable functions on T = R, then f ∈ bandm (f1 , . . . , fj ) yields that f ′ belongs to bandm−1 (f1′ , . . . , fj′ ). This can be extended for higher derivatives. It is obvious that bandm (f1 , . . . , fj ) is a convex subset of E; since the points t1 , . . . , tm in Definition 1 are not necessarily distinct, it decreases if m grows. The following result shows that the m-band turns into the convex hull for large m. Proposition 1. Assume that all functions from E are jointly separable, that is there exists a countable set Q ⊂ T such that, for all f ∈ E and t ∈ T , f (t) is the limit of f (tn ) for tn ∈ Q and tn → t. Then, for each f1 , . . . , fj ∈ E, Band depths based on multiple time instances bandm (f1 , . . . , fj ) ↓ conv(f1 , . . . , fj ) 5 as m → ∞. Proof. Consider an increasing family Tn of finite subsets of T such that Tn ↑ Q and a certain function f ∈ E. If mn is the cardinality of Tn , and f belongs to the mn -band of f1 , . . . , fj , then the values (f (t), t ∈ Tn ) equal a convex combination of (fi (t), t ∈ Tn ), i = 1, . . . , j, with coefficients λni . By passing to a subsequence, assume that λni → λi as n → ∞ for all i = 1, . . . , j. Using the nesting property of Tn , we obtain that X f (t) = λi fi (t) , t ∈ Tn . Now it suffices to let n → ∞ and appeal to the separability of f . Moreover, under a rather weak assumption, the m-band coincides with the convex hull for sufficiently large m. A set of points in the d-dimensional Euclidean space is said to be in general position if no (d − 1)-dimensional hyperplane contains more than d points. In particular, if the set contains at most d + 1 points, they will be in general position if and only if they are all extreme points of their convex hull, equivalently, any point from their convex hull is obtained as their unique convex combination. Proposition 2. If j ≤ d(m − 1) + 1 and there exists t1 , . . . , tm−1 ∈ T such that the vectors (fi (t1 ), . . . , fi (tm−1 )) ∈ Rd(m−1) , i = 1, . . . , j, are in general position, then bandm (f1 , . . . , fj ) = conv(f1 , . . . , fj ) . Proof. Let f ∈ bandm (f1 , . . . , fj ). In view of (2), (f (t1 ), . . . , f (tm−1 )) equals a convex combination of (fi (t1 ), . . . , fi (tm−1 )), i = 1, . . . , j, which is unique by the general position condition. By considering an arbitrary tm ∈ T , we see that f (tm ) is obtained by the same convex combination, so that f is a convex combination of functions f1 , . . . , fj . In particular, if d = 1, then the 2-band of two functions coincides with their convex hull. It suffices to note that if f1 and f2 are not equal, then f1 (t1 ) and f2 (t1 ) are different for some t1 and so are in general position. The same holds for any dimension d ≥ 2. Example 2 (Linear and affine functions). Let f1 , . . . , fj be constant functions. Then their 1-band is the collection of functions lying between the maximum and minimum values of f1 , . . . , fj . The 2-band consists of constant functions only and coincides with the convex hull. Together with (3), this implies that the 2-band generated by functions fi (t) = a(t) + bi , i = 1, . . . , j, is the set of functions a(t) + b for b from the convex hull of b1 , . . . , bj . If fi (t) = ai t + bi , i = 1, . . . , j, are affine functions of t ∈ R, then their 3band consists of affine functions only and also equals the convex hull. Indeed, X (f (t1 ), f (t2 ), f (t3 )) = λi (ai (t1 , t2 , t3 ) + bi (1, 1, 1)) 6 Ignacio Cascos and Ilya Molchanov yields that f (t3 ) − f (t1 ) t3 − t1 . = f (t2 ) − f (t1 ) t2 − t1 Therefore each f from band3 (f1 , . . . , fj ) is an affine function. Example 3 (Monotone functions). Let d = 1 and let f1 , . . . , fj be nondecreasing (respectively non-increasing) functions. Then their 2-band is a collection of non-decreasing (resp. non-increasing) functions. If all functions f1 , . . . , fj are convex (resp. concave), then their 3-band is a collection of convex (resp. concave) functions. Remark 1. The definition of the m-band can be easily extended for subsets F of a general topological linear space E. Consider a certain family of continuous linear functionals ut , t ∈ T . An element x ∈ E is said to belong to the m-band of F if for each t1 , . . . , tm ∈ T , the vector (ut1 (x), . . . , utm (x)) belongs to the convex hull of {(ut1 (y), . . . , utm (y)) : y ∈ F }. Then Definition 1 corresponds to the case of E being a functional space and ut (f ) = f (t) for t ∈ T . While the conventional closed convex hull arises as the intersection of all closed half-spaces that contain a given set, its m-band variant arises from the intersection of half spaces determined by the the chosen functionals ut for t ∈ T. Space reduction and time share The m-band reduces to a 1-band by defining functions on the product space T m. Proposition 3. For each j, the m-band bandm (f1 , . . . , fj ) coincides with (m) (m) (m) band(f1 , . . . , fj ), where fi : T m 7→ (Rd )m is defined as f (m) (t1 , . . . , tm ) = (f (t1 ), . . . , f (tm )) . Proof. It suffices to note that f (m) (t1 , . . . , tm ) belongs to the convex hull of (m) fi (t1 , . . . , tm ), i = 1, . . . , j, if and only if (f (t1 ), . . . , f (tm )) belongs to the convex hull of (fi (t1 ), . . . , fi (tm )), i = 1, . . . , j. In the framework of Proposition 3, it is possible to introduce further bands (m) to a subset S of T m . (called space-reduced ) by restricting the functions fi (2) (2) For instance, the 1-band generated by functions f1 , . . . , fj for the arguments (t1 , t2 ) ∈ R2 such that |t1 − t2 | = h describes the joint behaviour of the values of functions separated by the lag h. If m = 1, then the space reduction is equivalent to restricting the parameter space, which can be useful, e.g. for discretisation purposes. Band depths based on multiple time instances 7 It is possible to quantify the closedness of f to the band by determining the proportion of the m-tuple of time values from T m when the values of f belong to the band. Define the m-band time-share as TSm (f ; f1 , . . . , fj ) (m) = {(t1 , . . . , tm ) ∈ T m : f (m) (t1 , . . . , tm ) ∈ conv({fi (t1 , . . . , tm )}ji=1 ) . If the functions take values in R, then TS1 (f ; f1 , . . . , fj ) turns into the modified band depth defined in [11, Sec. 5]. If f belongs to the m-band of f1 , . . . , fj , then TSm (f ; f1 , . . . , fj ) = T m , while if f belongs to the 1-band of f1 , . . . , fj , then {(t, . . . , t) : t ∈ T } ⊂ TSm (f ; f1 , . . . , fj ). It is also straightforward to incorporate the space reduction by replacing T m with a subset S. 3 Simplicial-type band depths Band depth In the following, we consider the event that a function f belongs to a band generated by i.i.d. random functions ξ1 , . . . , ξj with the common distribution P . The m-band depth of the function f with respect to P is defined by bd(j) m (f ; P ) = P{f ∈ bandm (ξ1 , . . . , ξj )} = P{(f (t1 ), . . . , f (tm )) ∈ conv({(ξi (t1 ), . . . , ξi (tm ))}ji=1 ) , ∀t1 , . . . , tm ∈ T } . (6) If m increases, then the m-band narrows, and so the m-band depth decreases. We recall that when d = 1 the 1-band coincides with the band introduced in [11]. Nevertheless the band depth defined in [11] is the sum of bd(j) m (f ; P ) with j ranging from 2 to a fixed value J. The same construction can be applied to our m-bands. The m-band depth of f is influenced by the choice of j, and it increases with j. Unlike to the finite-dimensional setting, where j is typically chosen as the dimension of the space plus one [10], there is no canonical choice of j for the functional spaces. In order to ensure that the m-band generated by ξ1 , . . . , ξj differs from the convex hull, it is essential to choose j sufficiently large, and in any case at least d(m − 1) + 2, see Proposition 2. Furthermore, we must impose stronger conditions on j to avoid the zero-depth problem. Proposition 4. If j ≤ dm and the joint distribution of the marginals of P at some fixed m time points is absolutely continuous, then bd(j) m (·; P ) = 0 . Proof. If j ≤ dm and {(ξi (t1 ), . . . , ξi (tm ))}ji=1 are independent and absolutely continuous in Rdm , the probability that any fixed x ∈ Rdm lies in their convex hull is zero. 8 Ignacio Cascos and Ilya Molchanov A theoretical calculation of the m-band depth given by (6) is not feasible in most cases. In applications, it can be replaced by its empirical variant defined in exactly the same way as in [11] for the 1-band case. Let f1 , . . . , fn be a sample from P . Fix any j ∈ {dm + 1, . . . , n} and define bd(j) m (f ; f1 , . . . , fn ) =  −1 n j X 1f ∈bandm (fi1 ,...,fij ) , 1≤i1 <···<ij ≤n so that bd(j) m (f ; f1 , . . . , fn ) is the proportion of j-tuples from f1 , . . . , fn such that f lies in the m-band generated by the j-tuple. The choice of j affects the results. It is computationally advantageous to keep j small, while it is also possible to sum up the depths over a range of the values for j, as in [11]. Time-share depth Assume now that T is equipped with a probability measure µ, for example, the normalised Lebesgue measure in case T is a bounded subset of the Euclidean space or the normalised counting measure if T is discrete. Extend µ to the product measure µ(m) on T m . Define the time-share depth by (m) td(j) (TSm (f ; ξ1 , . . . , ξj )) . m (f ; P ) = Eµ If T is a subset of the Euclidean space, Fubini’s Theorem yields that the time-share depth is the average of the probability that (f (t1 ), . . . , f (tm )) lies in the convex hull of j points in Rdm , td(j) m (f ; P ) = Z P{(f (t1 ), . . . , f (tm )) ∈ conv({(ξi (t1 ), . . . , ξi (tm ))}ji=1 )} dµ(m) (t1 , . . . , tm ) . (7) For any j ∈ {dm + 1, . . . , n}, the empirical time-share depth is given by td(j) m (f ; f1 , . . . , fn )  −1 n = j X µ(m) (TSm (f ; fi1 , . . . , fij )) , 1≤i1 <···<ij ≤n Example 4 (Univariate case). Assume that T is a singleton. Then necessarily m = 1, the function f is represented by a point x in Rd , and the band depth of x for j = d + 1 coincides with the simplicial depth, see [10]. Example 5. Let ξ(t) = a(t) + X, t ∈ T , where X is a random variable. Then band(ξ1 , . . . , ξj ) for i.i.d. ξi (t) = a(t) + Xi , i = 1, . . . , j, is the set of functions bounded above by a(t) + max Xi and below by a(t) + min Xi . Then (j) bd1 (a; P ) = 1 − P{X > 0}j − P{X < 0}j . Band depths based on multiple time instances 9 By Example 2, band2 (ξ1 , . . . , ξj ) consists of functions a(t)+b for the constant b ∈ [min Xi , max Xi ]. Only such functions may have a positive 2-band depth. Example 6. Let now ξ(t) = a(t)+X, where a : T → Rd and X is an absolutely continuous random vector in Rd which is angularly symmetric about the origin. Then d−1 X j − 1 (j) (8) bd1 (a; P ) = 1 − 21−j i i=0 being the probability that the origin belongs to the convex hull of X1 , . . . , Xj , see [16]. Properties of the band depths Theorem 1. For any j ≥ dm + 1 we have: (j) (j) 1. affine invariance. bdm (Af +g; PA,g ) = bd(j) m (f ; P ) and tdm (Af +g; PA,g ) = d×d td(j) with A(t) nonsingular for m (f ; P ) for all g ∈ E and A : T 7→ R t ∈ T. (j) 2. phase invariance. bdm (f ◦ h; P h ) = bd(j) m (f ; P ) for any one-to-one transformation h : T 7→ T , where P h (F ) = P (F ◦ h−1 ) for any measurable subset F of E when h−1 is the inverse mapping of h. (j) 3. vanishing at infinity. bdm (f ; P ) → 0 if the supremum of kf k over T converges to infinity, and td(j) m (f ; P ) → 0 if the infimum of kf k over T converges to infinity. The affine invariance of both depths follows from the affine invariance of the m-bands, see (3), (4), while the phase-invariance of the band depth follows from (5). In practice, the functions are going to be evaluated over a finite set of time points, thus T = {t1 , . . . , tk } and probability P is a distribution on (Rd )k . Furthermore, the sample of functions f1 , . . . , fn to be used to determine an empirical m-band depth should have size at least n ≥ j ≥ dm + 1 . Theorem 2. If P is absolutely continuous, for any n ≥ j ≥ dm + 1 we have: 4. maximality at the center. if P is angularly symmetric about the point (f (t1 ), . . . , f (tk )), function f will be the deepest with regard to the timePdm−1 j−1 1−j share depth, and td(j) m (f ; P ) = 1 − 2 i=0 i . (j) 5. consistency. band depth supf ∈E | bd(j) (f ; f , . . . , f 1 n )−bdm (f ; P )| → 0 a.s. m (j) and time-share depth supf ∈E | td(j) m (f ; f1 , . . . , fn ) − tdm (f ; P )| → 0 a.s. The properties of the time-share depth rely on formula (7) that makes is possible to write it as an average of the probability that a point lies in the convex hull of independent copies of a random vector. The maximality at center follows from the main result in [16] which determines the probability 10 Ignacio Cascos and Ilya Molchanov inside the integral in (7), see (8), while the consistency can be proved in a similar way to [13, Th.3] extending the uniform consistency of the empirical simplicial depth [5, Th.1] to the one of the probability that a point lies in the convex hull of a fixed number of independent copies of a random vector. Such an extension, which relies on probabilities of intersections of open half-spaces, can be adapted to prove the consistency of the empirical m-band depth. 4 Data examples Simulated data 0.5 1.0 Fig. 1 shows 17 curves which are evaluated at T = {1, 2, . . . , 9}. Among the 17 curves, there is a clear shape outlier (marked as d) that lies deep within the bunch of curves. Such an outlier will not be detected by the outliergram from [1] due to its high depth value with regard to both of the 1-band depth and half-region depth (see [12]). Nevertheless, its anomalous shape is detected by any m-band depth with m ≥ 2. 0.0 a b c d e f g −1.0 −0.5 h 2 4 6 8 t Fig. 1 17 curves evaluated at {1, 2, . . . , 9}. The eight deepest curves are thicker than the (4) others and each of them is assigned a letter from a to h. Five deepest curves for bd1 (in (4) (4) (4) order): d,c,f,g,a, for td1 : d,c,g,a,f, for bd2 : g,b,f,e,a, and for td2 : g,f,c,d,h. Band depths based on multiple time instances 11 It is remarkable that curve d, which is the deepest curve with respect to (4) (4) the usual band depth and modified band depth (bd1 and td1 ) is among the (4) less deep curves for the 2-band depth (bd2 ) and is only the fourth deepest (4) curve for its time-share depth (td2 ). The reason for this last fact is that if we restrict to either of the sets of time points {1, 3, 5, 7, 9} or {2, 4, 6, 8}, curve d is not a shape outlier with respect to them. Real data 60 40 Finland France Italy 20 Spain Cyprus Slovenia Greece Croatia 0 Nominal GDP per capita in thousand euros 80 The nominal Gross Domestic Product per capita of the 28 countries of the European Union (2004–2013) was obtained from the EUROSTAT web-site and is represented in Fig. 2. The missing observation that corresponds to Greece, 2013 was replaced by the value obtained from the FOCUSECONOMICS website. 2004 2006 2008 2010 2012 t Fig. 2 Evolution of the nominal GDP per capita between 2004 and 2013 at the EU coun(5) tries. Five deepest curves for bd1 (in order): Cyprus, Spain, Italy, Greece, and Slovenia, (5) (5) for bd2 : Spain, Slovenia, France, Croatia, and Finland, and for bd2 space-reduced with S = {(t1 , t2 ) : |t1 − t2 | = 1}: Croatia, Slovenia, Spain, Finland, and France. (5) The deepest curve with regard to the band depth (bd1 ) is the one of Cyprus. Interestingly, Cyprus suffered the 2012-13 Cypriot financial crisis at the end of the considered period and its GDP per capita experienced a decay in 2013 in comparison with its 2012 figure much greater than the one of any 12 Ignacio Cascos and Ilya Molchanov other of the EU countries. Also the Greek curve is among the five deepest (5) ones for bd1 despite being the only country with a constant decrement in the second half of the considered time period. If we consider 2-bands, that take into account the shape of the curves, these two curves are not any more considered representative of the evolution of the GDP per capita in the EU. Acknowledgements The authors would like to thank Marı́a Ángeles Gil for the opportunity to contribute in this tribute to Pedro Gil, to whom we do sincerely appreciate. Most of this work was carried over while IM was supported by the Chair of Excellence Programme of the University Carlos III and the Santander Bank. At that time both authors benefited from discussions with Professor Juan Romo. IM is grateful to the Department of Statistics of the University Carlos III in Madrid for the hospitality. References 1. A. Arribas-Gil and J. Romo. Shape outlier detection and visualization for functional data: the outliergram. Biostatistics, 15:603–619, 2014. 2. I. Cascos. Data depth: multivariate statistics and geometry. In W. S. Kendall and I. Molchanov, editors, New Perspectives in Stochastic Geometry, pages 398–426. Oxford University Press, Oxford, 2010. 3. A. Chakraborty and P. Chaudhuri. On data depth in infinite dimensional spaces. Ann. Inst. Statist. Math., 66(2):303–324, 2014. 4. G. Claeskens, M. Hubert, L. Slaets, and K. Vakili. Multivariate functional halfspace depth. J. Amer. Statist. Assoc., 109(505):411–423, 2014. 5. L. Dümbgen. Limit theorems for the simplicial depth. Statist. Probab. Lett., 14:119– 128, 1992. 6. R. Fraiman and G. Muniz. Trimmed means for functional data. Test, 10:419–414, 2001. 7. F. Ieva and A. M. Paganoni. Depth measures for multivariate functional data. Comm. Stat. Theory and Methods, 42:1265–1276, 2013. 8. J. Kuelbs and J. Zinn. Concerns with functional depth. ALEA Lat. Am. J. Probab. Math. Stat., 10(2):831–855, 2013. 9. R. Liu, J. M. Parelis, and K. Singh. Multivariate analysis by data depth: Descriptive statistics, graphs and inference (with duiscussion). Ann. Statist., 27:783–858, 1999. 10. R. Y. Liu. On a notion of data depth based on random simplices. Ann. Statist., 18:405–414, 1990. 11. S. López-Pintado and J. Romo. On the concept of depth for functional data. J. Amer. Statist. Assoc., 104:718–734, 2009. 12. S. López-Pintado and J. Romo. A half-region depth for functional data. Comp. Statist. Data Anal., 55:1679–1695, 2011. 13. S. López-Pintado, Y. Sun, J. K. Lin, and M. G. Genton. Simplicial band depth for multivariate functional data. Adv. Data Anal. Classif., 8:321–338, 2014. 14. S. Nagy. Integrated depth for measurable functions and sets. Statist. Probab. Lett., 123:165–170, 2017. 15. A. Nieto-Reyes and H. Battey. A topologically valid definition of depth for functional data. Statist. Sci., 31(1):61–79, 2016. 16. J. G. Wendel. A problem in geometric probability. Math. Scand., 11:109–111, 1962. 17. Y. Zuo and R. Serfling. General notions of statistical depth function. Ann. Statist., 28:461–482, 2000.
10math.ST
Adaptive test for ergodic diffusions plus noise Shogo H. Nakakita1 and Masayuki Uchida1,2 1 2 Graduate School of Engineering Science, Osaka University Center for Mathematical Modeling and Data Science, Osaka University arXiv:1804.01864v1 [math.ST] 5 Apr 2018 6th April 2018 Abstract We propose some parametric tests for ergodic diffusion-plus-noise model, which is a version of state-space modelling in statistics for stochastic diffusion equations. The test statistics are classified into three types: likelihood-ratio-type test statistic; Wald-type one; and Rao-type one. All the test statistics are constructed with quasi-likelihood-functions for local mean sequence of noised observation. We also simulate the behaviour of them for several practical hypothesis tests and check the convergence in law of test statistics under null hypotheses and consistency of the test under alternative ones. We apply the method for real data analysis of wind data, and examine some sets of the hypotheses mainly with respect to the structure of diffusion coefficient. 1 Introduction Our research deals with the d-dimensional diffusion process being a solution for the following stochastic differential equation: dXt = b(Xt , β)dt + a(Xt , α)dwt , X0 = x0 , where {wt }t≥0 is the r-dimensional Wiener process, x0 is a Rd -valued random variable, α ∈ Θ1 ⊂ Rm1 , β ∈ Θ2 ⊂ Rm2 , θ := (α, β), Θ := Θ1 × Θ2 being the compact and convex parameter space, a : Rd × Θ1 → Rd ⊗ Rr and b : Rd × Θ2 → Rd are known functions. We assume that the true value of parameter θ? belongs to Int (Θ). We set the observational scheme same as [16] such that for i = 0, . . . , n, Yihn = Xihn + Λ1/2 εihn , where hn is the discretised step satisfying hn → 0 and Tn := nhn → ∞, Λ ∈ Rd ⊗ Rd is a positive semi-definite matrix, and {εihn }i is an i.i.d. sequence of random variables such that E [εihn ] = 0, Var (εihn ) = Id , and each component is independent of other components as well as {wt } and x0 . Let us define Θε the compact and convex parameter space of vechΛ, ϑ := (θ, θε ), and Ξ := Θ × Θε . The statistical framework for the analysis of time series data has been mainly based on discretetime stochastic processes such as ARMA model (see [2]). Those discrete-time models confront with some difficulties to express complex phenomena such that innovation term whose variance is dependent on state Xt itself. One of the solutions for those difficulties is the modelling with stochastic differential equations, which flexibly describe the probabilistic perturbation dependent on Xt . The parametric inference for diffusion processes modelled with stochastic differential equations has been researched enthusiastically (e.g., see [7], [21], [1], [12], [13], [22], [19], and [20]). As is well known, parametric estimation for one model is not sufficient in the context of real data analysis; we need methodology to compare multiple parametric models in terms of goodness of fit (e.g., for i.i.d. case, see [6] and [15]). [14] proposes likelihood-ratio-type test statistic for discretely observed ergodic diffusions to examine parametric hypotheses such as [6] and shows the convergence in law of test statistics and the consistency of the test. As another approach, [18] researches contrast-based information criterion for ergodic diffusion processes with discretised observation scheme (see also [8] and [3]). These instruments to examine goodness-of-fit are important to see whether we are motivated to use the flexible modelling with stochastic differential equations. 1 The classical time series analysis itself also has instruments of complex modelling such as statespace model (see [2]). One simple version of state-space modelling decomposes the randomness of observation into endogenous perturbation of the system of interest and exogenous noise which contaminates only observation and does not influence the system itself. The importance of this decomposition has attracted attention not only in the research of time series analysis but also that of statistics for stochastic differential equations. For instance, the existence of observation noise in high-frequency financial data called microstructure noise is one of the major research topics in financial econometrics. [9], [10] and [11] researched the diffusion with noise contaminating observation in the observation framework such that nhn is fixed. The statistics for diffusion-plusnoise with the setting nhn → ∞ has been also researched, e.g., by [4], [5], and [16]. [4] proposes the consistent estimator for the variance of noise and parameter of the diffusion process, and [5] construct the estimator for the parameter of the diffusion with asymptotic normality when the variance of noise is known. [16] provides the estimator for both the parameter of the diffusion process and the variance of noise with asymptotic normality when the variance of noise is unknown. However, as discussed above, it is necessary to construct the way to compare the goodness-of-fit of candidate models in practice, and this research tries to achieve it with likelihood-ratio-type test statistics with quasi-likelihood-functions proposed by [16] in the manner of [14] discussing the same problem under the assumption that exogenous noise in observation does not exist. We also analyse some real data with our methods besides theoretical construction of test statistics. Our data of interest is MetData ([17]) which represents wind velocity with high frequency observation. [16] examines existence of noise in some partial data (the plot is shown in Figure 1) in MetData and shows statistical significance of the existence, which indicates the motivation to use diffusion-plus-noise modelling rather than diffusion modelling without observation noise. We also use the same data and see if the diffusion coefficient a (x, α) is dependent on x or not and check if we are motivated to utilise the flexible modelling of stochastic diffusion equations. Figure 1: plot of wind velocity labelled Sonic x (left) and y (right) (119M) at the M5 tower from 00:00:00 on 1st July, 2017 to 20:00:00 on 5th July, 2017 with 0.05-second resolution [17] The paper composes of four parts: firstly, in Section 2, we show our assumption and notation before discussing concrete statements for parametric tests. In the second place, we state some theorems in Section 3 which show the asymptotic behaviour of adaptive likelihood-ratio-type test statistics, whose proofs are shown later. Section 4 examines the behaviour of statistics proposed in the previous section with computational simulation for 1-dimensional diffusion processes and 2-dimensional ones. Finally, in Section 5, MetData, a real data for wind with high-frequency observation, is used to see what our method concludes regarding the property of wind observed in data. 2 Notation and assumption We set the following notations as [16]. ⊗2 T 1. For a matrix A, AT denotes  the transpose of A and A := AA . For same size matrices A T and B, A JBK := tr AB . 2. For any vector v, v (i) denotes the i-th component of v. Similarly, M (i,j) , M (i,·) and M (·,j) denote the (i, j)-th component, the i-th row vector and j-th column vector of a matrix M 2 respectively. 3. c(x, α) := (a(x, α)) ⊗2 . 4. C is a positive generic constant independent of all other variables. If it depends on fixed other variables, e.g. an integer k, we will express as C(k). 5. a(x) := a(x, α? ) and b(x) := b(x, β ? ). 6. Let us define ϑ := (θ, θε ) ∈ Ξ. 7. A R-valued function f on Rd is a polynomial growth function if there exists a constant C > 0 such that for all x ∈ Rd , C |f (x)| ≤ C (1 + kxk) . g : Rd × Θ → R is a polynomial growth function uniformly in θ ∈ Θ if there exists a constant C > 0 such that for all x ∈ Rd , C sup |g(x, θ)| ≤ C (1 + kxk) . θ∈Θ Similarly we say h : Rd × Ξ → R is a polynomial growth function uniformly in ϑ ∈ Ξ if there exists a constant C > 0 such that for all x ∈ Rd , C sup |h(x, ϑ)| ≤ C (1 + kxk) . ϑ∈Ξ 8. For any R-valued sequence un , R : Θ × R × Rd → R denotes a function with a constant C such that C |R(θ, un , x)| ≤ Cun (1 + kxk) for all x ∈ Rd and θ ∈ Θ. 9. Let us denote for any µ-integrable function f on Rd , µ(f (·)) := R f (x)µ(dx). 10. We set     det c(·, α) 1 −1 ? Y1 (α) := − ν0 tr (c(·, α)) c(·, α ) − Id + log , 2 det c(·, α? ) r z  1 −1 ⊗2 (b(·, β) − b(·, β ? )) Y2 (β) := − ν0 (c(·, α? )) 2 where ν0 is the invariant measure of X. P L 11. → and → indicate convergence in probability and convergence in law respectively. 2 d d 12. For f (x), g(x, θ) and h(x, ϑ), f 0 (x) := dx f (x), f 00 (x) := dx 2 f (x), ∂x g(x, θ) := ∂ ∂ ∂ ∂θ g(x, θ) := ∂θ g(x, θ), ∂x h(x, ϑ) := ∂x h(x, ϑ) and ∂ϑ h(x, ϑ) := ∂ϑ h(x, ϑ). ∂ ∂x g(x, θ), 13. We define o  1  n −1 −1 J (α|ϑ ) := ν0 tr (c) (∂α(i1 ) c) (c) (∂α(i2 ) c) (·, α) , 2 i1 ,i2 h  r i  T z −1 J (3,3) (β|ϑ? ) := ν0 (c) ∂β (j1 ) b ∂β (j2 ) b (·, α? , β) , (2,2) ?  j1 ,j2 J (2,2) (ϑ? ) := J (2,2) (α? |ϑ? ), and J (3,3) (ϑ? ) := J (3,3) (β ? |ϑ? ). 14. λmin (A) and λmax (A) denote the minimum eigenvalue of a symmetric matrix A and the maximum one respectively. We make the following assumptions. 3 (A1) b and a are continuously differentiable for 4 times, and the components of themselves as well as their derivatives are polynomial growth functions uniformly in θ ∈ Θ. Furthermore, there exists C > 0 such that for all x ∈ Rd , kb(x)k + kb0 (x)k + kb00 (x)k ≤ C(1 + kxk), ka(x)k + ka0 (x)k + ka00 (x)k ≤ C(1 + kxk). (A2) X is ergodic and the invariant measure ν0 has k-th moment for all k > 0. h i k (A3) For all k > 0, supt≥0 E kXt k < ∞. (A4) For any k > 0, εihn has k-th moment and the component of εihn are independent of the other components for all i, {wt } and x0 . In addition, the marginal distribution of each component is symmetric. (A5) inf x,α det c(x, α) > 0. 2 (A6) There exist positive constants χ and χ̃ such that Y1 (α) ≤ −χ kα − α? k and Y2 (β) ≤ 2 −χ̃ kβ − β ? k . (A7) The components of b, a, ∂x b, ∂β b, ∂x a, ∂α a, ∂x2 b, ∂β2 b, ∂x ∂β b, ∂x2 a, ∂α2 a and ∂x ∂α a are polynomial growth functions uniformly in θ ∈ Θ. (AT) hn = p−τ n , τ ∈ (1, 2) and hn → 0, pn → ∞, kn → ∞, ∆n = pn hn → 0, nhn → ∞ as n → ∞. (R1) It holds   inf λmin J (2,2) (α|ϑ? ) > 0, α∈Θ1   inf λmin J (3,3) (β|ϑ? ) > 0. β∈Θ1 Remark. The assumption (AT) is a restriction of the assumption (AH) discussed in [16] in terms of the space of the tuning parameter τ ; (AH) sets it to be (1, 2]. This assumption (AT) is necessary to match the asymptotic variance of the first derivatives of quasi-likelihood functions regarding parameters with the matrices to which the second derivatives of quasi-likelihoods with respect to parameter converge in probability. 3 Theorems and composition of parametric tests We consider the following statistical hypothesis testing problem, for r ∈ {1, . . . , m1 + m2 }, H0 : θ(λ1 ) = · · · = θ(λr1 ) = 0, H1 : not H0 , where λi ∈ {1, . . . , m1 + m2 } for all i ∈ {1, . . . , r}, and λi < λj if i 6= j. Let us denote r1 to be the number of elements λi in {1, . . . , m1 } and r2 to be that of elements λi in {m1 + 1, . . . , m2 }. For simplicity, we also assume if r1 > 0, then λ1 = 1, . . . , λr1 = r1 and if r2 > 0, then λm1 +1 = 1, . . . , λm1 +r2 = r2 . That is, if r1 > 0 and H0 hold, then α(1) = · · · = α(r1 ) = 0, and if r2 > 0 and H0 hold, then β (1) = · · · = β (r2 ) = 0. We let Θ0,1 and Θ0,2 denote the parameter space of diffusion parameter and drift one under H0 . To compose the test statistic, let us define the following quasi-likelihood functions, ! −1 r kn −2  ⊗2 z  1 X 2 τ τ L1,n (α|Λ) := − ∆n cn (Ȳj−1 , α, Λ) Ȳj+1 − Ȳj + log det cn (Ȳj−1 , α, Λ) , 2 j=1 3 L2,n (β|Λ, α) := − kn −2 −1 r ⊗2 z 1 X ∆n cτn (Ȳj−1 , α, Λ) Ȳj+1 − Ȳj − ∆n b(Ȳj−1 , β) , 2 j=1 4 2−τ where cτn (x, α, Λ) = c (x, α) + 3∆nτ −1 Λ. Moreover, Λ̂n , α̂n , α̃n , β̂n , and β̃n denote the estimators ⊗2 Pn−1 1 satisfying Λ̂n = 2n , i=0 Y(i+1)hn − Yihn     L1,n α̂n |Λ̂n = sup L1,n α|Λ̂n , α∈Θ1     L1,n α̃n |Λ̂n = sup L1,n α|Λ̂n , α∈Θ0,1     L2,n β̂n |Λ̂n , α̂n = sup L2,n β|Λ̂n , α̂n ,   β∈Θ2   L2,n β̃n |Λ̂n , α̂n = sup L2,n β|Λ̂n , α̂n . β∈Θ0,2 Remark. λi can take values only in {1, . . . , m1 }, or {m1 + 1, . . . , m1 + m2 }. It indicates that we are able to test the diffusion parameter without drift one and vice versa. 3.1 Likelihood-ratio-type test We set the following likelihood-ratio-type test statistics:     16  L1,n α̂n |Λ̂n − L1,n α̃n |Λ̂n 9 ! supα∈Θ0,1 exp (L1,n ) (α|Λ̂n ) 16 =− log , 9 supα∈Θ1 exp (L1,n ) (α|Λ̂n )      := 2 L2,n β̂n |Λ̂n , α̂n − L2,n β̃n |Λ̂n , α̂n ! supβ∈Θ0,2 exp (L2,n ) (β|Λ̂n , α̂n ) = −2 log . supβ∈Θ2 exp (L2,n ) (β|Λ̂n , α̂n ) T1,n := T2,n Note that if ri = 0, then Ti,n = 0 automatically for both of i = 1, 2. Theorem 1. Assume (A1)-(A7), (AT), H0 and kn ∆2n → 0 hold. Then we have L T1,n + T2,n → χ2r . The consistency of the likelihood-ratio-type test holds because of the following theorem. Theorem 2. Assume (A1)-(A7), (AT) and H1 hold. Then for all M > 0, P (T1,n + T2,n ≤ M ) → 0. 3.2 Other types of parametric test In addition, we also consider Rao-type test statistics:    9  −1  1   T 1 √ ∂α L1,n α̃n |Λ̂n √ ∂α L1,n α̃n |Λ̂n − ∂α2 L1,n α̂n |Λ̂n , 8kn kn kn     1  −1  1   T 1 2 √ ∂β L2,n β̃|Λ̂n , α̂n := √ ∂β L2,n β̃|Λ̂n , α̂n − ∂β L2,n β̂n |Λ̂n , α̂n . Tn Tn Tn  R1,n := R2,n Theorem 3. Assume (A1)-(A7), (AT), H0 and kn ∆2n → 0 hold. Then we have L R1,n + R2,n → χ2r . Theorem 4. Assume (A1)-(A7), (AT), (R1) and H1 hold. Then for all M > 0, P (R1,n + R2,n ≤ M ) → 0. 5 Furthermore, let us define the following Wald-type statistics:    9 2 T W1,n = kn (α̂n − α̃n ) − ∂ L1,n α̂n |Λ̂n (α̂n − α̃n ) 8kn α   T     1 2 W2,n = Tn β̂n − β̃n β̂n − β̃n . − ∂β L2,n β̂n |Λ̂n , α̂n Tn Theorem 5. Assume (A1)-(A7), (AT), H0 and kn ∆2n → 0 hold. Then we have L W1,n + W2,n → χ2r . Theorem 6. Assume (A1)-(A7), (AT) and H1 hold. Then for all M > 0, P (W1,n + W2,n ≤ M ) → 0. 4 4.1 Simulation study 1-dimensional diffusion We consider the diffusion process with the following SDE:  dXt = β (1) Xt + β (2)  2 dt + α (1) + α(2) (Xt ) 1 + (Xt ) 2 ! dwt , X0 = 0 and the simulation setting throughout this subsection is shown in the next table; and that for noise parameter value n 106 hn 6.31 × 10−5 Tn 63.1 τ 1.9 pn 162 kn 6172 iteration 10000 Table 1: Simulation setting in section 4.1 i.i.d. is fixed as εihn ∼ N (0, 1), and Λ? = 10−3 whose size is so large that test for noise detection in [16] detect with high probability. 4.1.1 Test for diffusion parameters We propose the following test: H0 : α(2) = 0, H1 : not H0 . When H0 holds, we can interpret that an Ornstein-Uhlenbeck processes describe data enough and our full model is no more useful. To the contrary, rejection of H0 indicates that OU processes are not enough to fit the data and our full model with diffusion coefficient dependent on state, which is difficult for traditional time series model to express, is more appropriate to express the observation. We do the two simulations with different true value of parameters: one is with true value α? = [1, 0] , β ? = [−1, 1] , where H0 holds; and the other is with α? = [1, 1] , β ? = [−1, 1] , where H1 is true. Then the test statistic T1,n behaves as shown in table 2. Note that χ2r (p) indicates p is the upper p-point of χ2 distribution with degree of freedom r. The figure 2 depicts the empirical distribution function of test statistics and the theoretical one of χ21 . We can see that our likelihood-ratio-type statistic has asymptotic distribution as we have shown from these results, at least with respect to diffusion parameters. Hence we can conclude that our test has consistency in this simulation. 6 H0 is true: H1 is true: empirical ratio of T1,n larger than... χ21 (0.10) χ21 (0.05) χ21 (0.01) χ21 (0.001) 0.0987 0.0516 0.0099 0.0015 1 1 1 1 Table 2: Simulation result under H0 and H1 in section 4.1.1 4.1.2 Test for drift parameters We also consider the parametric test for drift parameters: let us consider the next hypotheses and the statistical test: H0 : β (2) = 0, H1 : not H0 . and again we see the behaviour of likelihood-ratio-type statistic T2,n . As seen, the setting questions whether our model is symmetric with respect to 0 and it can be of interest when state with 0 value is interpreted as the neutral one (e.g., wind velocity). In the first place, we experiment our statistic with the true value α? = [1, 1] , β ? = [−1, 0] , where H0 is true; in the second place, we do with α? = [1, 1] , β ? = [−1, 1] , where H1 holds. The simulation result is summarised in the table 3. The empirical distribution function of T2,n is shown in Figure 3 combined with the theoretical distribution of χ21 . These results show that our test statistic T2,n has asymptotic distribution as we have shown theoretically. H0 is true: H1 is true: empirical ratio of T2,n larger than... χ21 (0.10) χ21 (0.05) χ21 (0.01) χ21 (0.001) 0.1086 0.0545 0.0113 0.001 1 1 0.9998 0.9881 Table 3: Simulation result under H0 and H1 in section 4.1.2 4.2 2-dimensional diffusion We also deal with a multidimensional example of diffusion process such that " #" # " #!  " (1) # (1)  Xt β (1) β (2) Xt β (3)   d + (6) dt  (2) =   β (4) β (5) Xt(2) β Xt         2  (2) 2 (1)  1/2 (7) α(3) Xt α(2) Xt  (1) (4) (1)   α α α α + 1+X (1) 2 + 1+X (2) 2     t t  2  2  dwt , + (1) (2) (5) (6)  α X α X    1/2 t t     +   α(1) α(4) α(4) + α(7)  (1) 2 (2) 2  1+ X 1+ X  t t  # " # "   (1)  0 X  0    (2) = 0 . X0 parameter value n 106 hn 6.31 × 10−5 Tn 63.1 τ 1.9 pn 162 kn 6172 Table 4: Simulation setting in section 4.2 i.i.d. With respect to the noise, we set εihn ∼ N (0, I2 ) and Λ? = 10−3 I2 . 7 iteration 2000 Figure 2: empirical distribution function of T1,n (blue point) under H0 and distribution function of χ21 (red line), section 4.1.1 Figure 3: empirical distribution function of T2,n (blue point) under H0 and distribution function of χ21 (red line), section 4.1.2 8 4.2.1 Ornstein-Uhlenbeck test The hypotheses of interest in this section are H0 :α(2) = α(3) = α(5) = α(6) = 0, H1 : not H0 . This set of the hypotheses is for seeing whether the latent process X is an Ornstein-Uhlenbeck process or not. If H0 is rejected, it indicates that the ’innovation’ in traditional time series analysis is dependent on the state X and it is the situation where statistics for diffusion process prepares stronger tools for analysis. Hence the test with these hypothesis can test to use high-frequency observation framework and diffusion modelling for the target latent process. We implement the two sorts of simulation: the first one is with the true parameter α? = [4, 0, 0, 4, 0, 0, −0.2] , β ? = [−1, −0.1, 0, −0.1, −1, 0] where H0 holds; and the second one is with α? = [4, 1, 1, 4, 1, 1, −0.2] , β ? = [−1, −0.1, 1, −0.1, −1, 1] , where H1 is true. The summary of empirical ratio of T1,n exceeding some critical values is shown in table 5 and the plot of empirical distribution is drawn in figure 4 with theoretical one. H0 is true: H1 is true: empirical ratio of T2,n larger than... χ24 (0.10) χ24 (0.05) χ24 (0.01) χ24 (0.001) 0.1085 0.0525 0.01 0.001 1 1 1 1 Table 5: Simulation result under H0 and H1 in section 4.2.1 Figure 4: empirical distribution function of T2,n (blue point) under H0 and distribution function of χ22 (red line), section 4.2.1 9 4.2.2 Centricity test We consider the following hypotheses: H0 : β (3) = β (6) = 0, H1 : not H0 . This set of the hypotheses is a multivariate version of that discussed in section 4.1.2. Firstly We set the true parameter α? = [1, 1, 1, 1, 1, 1, 0.1] , β ? = [−1, −0.1, 0, −0.1, −1, 0] where H0 holds. In the second place, we consider the simulation with the true value α? = [1, 1, 1, 1, 1, 1, 0.1] , β ? = [−1, −0.1, 1, −0.1, −1, 1] , where H1 is true. The result is summarised in table 6 and the empirical distribution is plotted in figure 5 with theoretical one. H0 is true: H1 is true: empirical ratio of T2,n larger than... χ22 (0.10) χ22 (0.05) χ22 (0.01) χ22 (0.001) 0.1105 0.0505 0.015 0.002 1 0.9995 0.999 0.979 Table 6: Simulation result under H0 and H1 in section 4.2.2 4.2.3 Independence test We consider the following hypotheses: H0 : α(3) = α(5) = α(7) = β (2) = β (4) = 0, H1 : not H0 . Firstly we set the true parameter α? = [4, 1, 0, 4, 0, 1, 0] , β ? = [−1, 0, 1, 0, −1, 1] , where H0 holds. In the second place, we consider the simulation with the true value α? = [4, 1, 1, 4, 1, 1, −0.2] , β ? = [−1, −0.1, 1, −0.1, −1, 1] , where H1 is true. The results are shown in table 7 and figure 6. H0 is true: H1 is true: empirical ratio of T1,n + T2,n larger than... χ25 (0.10) χ25 (0.05) χ25 (0.01) χ25 (0.001) 0.1045 0.0505 0.0095 0.0015 1 1 1 1 Table 7: Simulation result under H0 and H1 in section 4.2.3 5 Real data analysis As [16], we do the statistical analysis for wind data named MetData provided by National Wind Technology Center in US [17]. We focus on the 2-dimensional data with 0.05-second resolution representing wind velocity labelled Sonic x and Sonic y (119M) at the M5 tower, and analyse two dataset with different observation term: the first one is from 00:00:00 on 1st July, 2017 to 20:00:00 on 5th July, 2017 as [16]; and the second one is from 00:00:00 on 1st April, 2016 to 00:00:00 on 21th April, 2016. With respect to the time unit, we set 2 hours for both datasets. 10 Figure 5: empirical distribution function of T2,n (blue point) under H0 and distribution function of χ22 (red line), section 4.2.2 Figure 6: empirical distribution function of T1,n + T2,n (blue point) under H0 and distribution function of χ25 (red line), section 4.2.3 11 Our full model for both data is as follows: #! # " " #"  " (1) # (1)  β (3) β (1) β (2) Xt Xt   + (6) dt d  (2) =   β β (4) β (5) Xt(2) Xt        2  (2) 2 (1)  α(3) Xt α(2) Xt  (1)    α + 1+X (1) 2 + 1+X (2) 2  t t +    1/2   α(1) α(4) α(7)     " # " #   (1) (1)  X0 x0     (2) = (2) X0 x0 α  (1) (4) 1/2 α  α(4) + (1) α   2 α(5) Xt   (1) 2 1+ Xt  (7) +   dwt , (2) 2  α(6) Xt   2 (2) 1+ Xt The some settings such that n, hn and τ are shown in the following table. July, 2017 April, 2016 n 8352000 34560000 hn 6.94 × 10−6 6.94 × 10−6 Tn 58 240 τ 1.9 1.9 pn 518 518 kn 16123 66718 Table 8: Simulation setting in section 4.2 5.1 Data analysis for MetData in July, 2017 The fitting of this full model with the local mean method is #! # " #" "  " (1) # (1)  −0.625 X −2.59 −0.758 X d t t  dt =  (2) +   Xt(2) −0.763 −0.280 −3.12 Xt          (1) 2 (2) 2  Xt Xt  1/2 1/2   (3.13) (3.17) (−0.0763) 3.13 + 9.07 1+X (1) 2 + 4.10 1+X (2) 2     t t     + dwt , (1) 2 (2) 2  X X    t t 1/2 1/2   (3.13) (3.17) (−0.0763) 3.17 + 8.54  (1) 2 + 3.59  (2) 2   1+ Xt 1+ Xt   # # " "   (1) (1)  x X  0 0    (2) = (2) x0 X0 We already have the result that the dataset is contaminated by noise with significance level α ≥ 10−16 (see [16]). Hence it is reasonable to adopt the parameter estimation using local mean methods. Firstly, we do the statistical test for the set of the hypotheses H0 :α(2) = α(3) = α(5) = α(6) = 0, H1 : not H0 . which examines that the wind velocity can be expressed by Ornstein-Uhlenbeck process sufficiently. In the second place, we examine H0 : β (3) = β (6) = 0, H1 : not H0 . the test for centrality discussed in Section 4.1.2 and 4.2.1. Finally, we consider the test for independence, that is, H0 : α(3) = α(5) = α(7) = β (2) = β (4) = 0, H1 : not H0 . which is the topic in Section 4.2.2. The results of the likelihood-ratio-type tests are shown in table 10. We can conclude that the wind velocity cannot be fitted by OU process enough compared to our full model with common significance level. With respect to the centricity, we cannot reject H0 even with the significance level 0.10 and hence there is no validity to regard the wind velocity is symmetric with respect to the zero vector. What is more, the result of the test for independence indicates that it is meaningful to model velocity jointly with commonly used significance level. 12 test OU centricity independence test statistic T1,n = 6603.819 T2,n = 0.745618 T1,n + T2,n = 3395.082 p-value p < 10−16 p = 0.3112 p < 10−16 Table 9: Summary of the tests in Section 5 5.2 Data analysis for MetData in April, 2016 The fitting for the second dataset results in " #" # " #!  " (1) # (1)  Xt −2.40 −0.657 Xt 4.57  d dt  (2) = (2) +   −0.677 −3.84 1.97 Xt  Xt         (2) 2 (1) 2  Xt Xt  1/2 1/2   (6.18) (5.81) (−0.0665)   6.18 + 12.28 1+X (1) 2 + 0.78 1+X (2) 2   t t     dwt , + (2) 2  (1) 2 X X    t t 1/2 1/2    2 + 0.98  2 (6.18) (5.81) (−0.0665) 5.81 + 10.63  (1) (2)  1+ Xt 1+ Xt   " # " #   (1) (1)  X0 x0     (2) = (2) . x0 X0 Firstly, we check the existence of noise in observation. The z-value of test for noise detection in [16] is 1244.375 and it is so large value that we can reject the null hypothesis stating Λ = O with ordinary significance level. Hence we are motivated to use local mean method for fitting rather than the local Gaussian approximation as [13]. The results of hypothesis testing are identical to those in the previous section except for centricity. The random perturbation is dependent on the state X and it leads to the motivation for SDE modelling. Moreover, both of the processes with respect to x-axis and y-axis are dependent to each other; therefore, it is necessary to model this phenomenon with a 2-dimensional diffusion process. In comparison to the data in July 2017, this dataset is characterised with its non-centricity. We can observe the constant tendency of wind velocity throughout the observed term. test OU centricity independence test statistic T1,n = 20154.56 T2,n = 28.9719 T1,n + T2,n = 3395.082 p-value p < 10−16 p = 5.11 × 10−7 p < 10−16 Table 10: Summary of the tests in Section 5 6 Conclusion We suggested some types of test statistics for parametric hypotheses in the use of some results for quasi-likelihood proposed in [16]. In section for simulation and real data analysis, we examined the asymptotics of those statistics with practical hypotheses settings such that test for OrnsteinUhlenbeck processes which can check the motivation to use diffusion modelling rather than classical time series modelling, and independence test which enables us to see whether we should model observed phenomena with multi-dimensional settings. In addition, centricity test which corresponds to the classical i.i.d. setting was used to see the process is centred along with zero vector or not. With these tools for statistical analysis, we will obtain statistically-supported conclusion from high-frequency data even with the existence of observation noise. 7 Proof In the following discussion, we denote I (2,2) (ϑ? ) = 9 (2,2) ? J (ϑ ) 8 13 I (3,3) (ϑ? ) = J (3,3) (ϑ? ). Proof of Theorem 1. We only consider the asymptotics of L1,n with r1 > 0 since the case of L2,n with r2 > 0 is quite analogous. For Taylor’s theorem, we obtain       L1,n α̃n |Λ̂n = L1,n α̂n |Λ̂n + ∂α L1,n α̂n |Λ̂n (α̃n − α̂n ) Z 1    shp i⊗2 { (1 − u) 2 ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du kn (α̃n − α̂n ) + kn 0 We use the notation (2,2) J˜i,n (α̃n , α̂n ) := −2 1 Z   (1 − u) 2 ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du, kn 0 and then under H0 , the consistency of α̂n and α̃n , and the discussion in the proof of Theorem 3.1.3 in [16] lead to P (2,2) J˜i,n (α̃n , α̂n ) → J (2,2) (ϑ? ).   We can evaluate ∂α L1,n α̂n |Λ̂n = 0T and hence T1,n = shp i⊗2 { 8 ˜(2,2) Ji,n (α̃n , α̂n ) kn (α̃n − α̂n ) . 9 Then the result for the simplest case where r1 = m1 , i.e., α? = 0, can be led since we have −1 (2,2) 1/2 ? √ L kn (α̂n − α? ) → J (2,2) I (ϑ )Z, where Z ∼ N (0, Im1 ) because of Theorem 3.1.3 in [16] and then shp i⊗2 { 8 ˜(2,2) J (α̃n , α̂n ) kn (α̃n − α̂n ) 9 i,n t ⊗2 |    −1  1/2 L 8 (2,2) (2,2) ? (2,2) ? J → J (ϑ ) I (ϑ )Z 9   1/2  −1  1/2 8 J (2,2) I (2,2) (ϑ? ) Z = Z T I (2,2) 9 " # −1   1/2 8 T  (2,2) 1/2 8 (2,2) (2,2) ? = Z I I I (ϑ ) Z 9 9 ∼ χ2m1 . In general, it is necessary to examine the asymptotic behaviour of the expansion √ kn (α̃n − α̂n ). Let us consider     1 1 √ (∂α L1,n )T α̃n |Λ̂n = √ (∂α L1,n )T α̂n |Λ̂n kn kn Z 1   p 1 2 + ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du kn (α̃n − α̂n ) 0 kn p (2,2) = −J˜ii,n (α̃n , α̂n ) kn (α̃n − α̂n ) , where (2,2) J˜ii,n (α̃n , α̂n ) := − Z 0 1   1 2 ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du kn with the property P (2,2) J˜ii,n (α̃n , α̂n ) → J (2,2) (ϑ? ). 14 Hence  −1 1   p (2,2) √ (∂α L1,n )T α̃n |Λ̂n = kn (α̃n − α̂n ) . − J˜ii,n (α̃n , α̂n ) kn It leads to T1,n 8 = 9  (2,2) J˜ii,n −1  (2,2) J˜i,n |  t  ⊗2  −1  1 (2,2) T √ (∂α L1,n ) α̃n |Λ̂n . J˜ii,n (α̃n , α̂n ) kn Moreover, we check the expansion     1 1 √ (∂α L1,n )T α̃n |Λ̂n = √ (∂α L1,n )T α? |Λ̂n kn kn Z 1   p 1 2 kn (α̃n − α? ) . + ∂α L1,n α? + u (α̃n − α? ) |Λ̂n du k n 0 Let us partition J (2,2) into  J (2,2) =  (2,2) where G1 (2,2) ∈ Rr1 ⊗ Rr1 , G2 (2,2) G1 (2,2) G2 T (2,2)  (2,2) , G2 G3 (2,2) ∈ Rr1 ⊗ Rm1 −r1 , and G3 ∈ Rm1 −r1 ⊗ Rm1 −r1 and define # " O O (2,2)   −1 . H := (2,2) O G3   Since the last m1 − r1 components of ∂α L1,n α̃n |Λ̂n are equal to zero for sufficiently large n, we   T obtain H (2,2) (∂α L1,n ) α̃n |Λ̂n = 0 and hence   1 T 0 = H (2,2) √ (∂α L1,n ) α? |Λ̂n kn Z 1   p 1 2 (2,2) ? ? +H kn (α̃n − α? ) , ∂α L1,n α + u (α̃n − α ) |Λ̂n du 0 kn and then   1 T J (2,2) H (2,2) √ (∂α L1,n ) α? |Λ̂n kn Z 1   p 1 2 (2,2) (2,2) ? ? ∂α L1,n α + u (α̃n − α ) |Λ̂n du kn (α̃n − α? ) . = −J H 0 kn Note that the first r1 components of α̃n and α? are equal to zero, and it leads to Z 1   p 1 2 (2,2) (2,2) ? ? J H ∂α L1,n α + u (α̃n − α ) |Λ̂n du kn (α̃n − α? ) 0 kn Z 1   p 1 2 ? ? = ∂α L1,n α + u (α̃n − α ) |Λ̂n du kn (α̃n − α? ) . 0 kn Then we have     1   1 √ (∂α L1,n )T α̃n |Λ̂n = I − J (2,2) H (2,2) √ (∂α L1,n )T α? |Λ̂n . kn kn Theorem 7.5.1 in [16] leads to    1/2 1 L √ (∂α L1,n )T α? |Λ̂n → I (2,2) Z, kn 15 where Z ∼ N (0, Im1 ), and hence 1/2     1 L √ (∂α L1,n )T α̃n |Λ̂n → I − J (2,2) H (2,2) I (2,2) Z. kn Because H (2,2) J (2,2) H (2,2) = H (2,2) , we obtain T  −1   1/2 8 T  (2,2) 1/2  I − J (2,2) H (2,2) J (2,2) I − J (2,2) H (2,2) I (2,2) Z Z I 9       1/2 −1 1/2 8 J (2,2) − H (2,2) I (2,2) Z = Z T I (2,2) 9   1/2  −1 1/2   J (2,2) − H (2,2) J (2,2) Z. = Z T J (2,2) L T1,n → Note that    1/2  −1 1/2  1/2  −1 1/2 (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) (2,2) J −H J J −H J J J (2,2)  1/2  −1 1/2  (2,2) (2,2) (2,2) = J J −H J (2,2)   and tr I − J (2,2) H (2,2) = r1 . Hence we obtain L T1,n → χ2r1 (see [6]). If r2 = 0, it completes the proof. Otherwise, with the identical discussion, we obtain t |  ⊗2 8  (2,2) ? −1 1 T √ (∂α L1,n ) α̃n |Λ̂n T1,n + T2,n = J (ϑ ) 9 kn t |  −1  ⊗2 1 T (3,3) ? √ (∂β L2,n ) β̃n |Λ̂n , α̂n + J (ϑ ) + oP (1) Tn t |  1  ⊗2 8  (2,2) ? −1  T (2,2) (2,2) ? √ (∂α L1,n ) α |Λ̂n = J (ϑ ) I −J H 9 kn t |   −1  ⊗2  1 T ? (3,3) ? (3,3) (3,3) √ (∂β L2,n ) β |Λ̂n , α̂n + J (ϑ ) I −J H + oP (1) , Tn where  J (3,3) G1 (3,3) ∈ R r2 ⊗ R r2 , G 2 (3,3) =  (3,3) G1 (3,3) G2 T (3,3)  (3,3) , G2 G3 (3,3) ∈ Rr2 ⊗ Rm2 −r2 , G3 " O (3,3) H := O ∈ Rm2 −r2 ⊗ Rm2 −r2 , and # O  −1 . (3,3) G3 Therefore, the convergence in law       (2,2) T ? √1 (∂α L1,n ) α | Λ̂ n I L kn    → N 0, T ? O √1 (∂β L2,n ) β | Λ̂ , α̂ n n T n (see [16]) and continuous mapping theorem lead to L T1,n + T2,n → χ2r1 +r2 . Hence we obtain the result. 16 O I (3,3)  (ϑ? )  Proof of Theorem 2. Firstly we consider the case where r1 > 0 and ∃ `1 ∈ {1, · · · , r1 } such that (` ) (α? ) 1 6= 0. Note that sup α∈Θ1     1  P L1,n α̂n |Λ̂n − L1,n α|Λ̂n + Y1 (α) → 0, kn because of [16], and (A6) leads to for all n, 9 9 2 (` ) T1,n + T1,n + Y(α̃n ) ≥ −Y(α̃n ) ≥ χ kα̃n − α? k ≥ χ (α? ) 1 16kn 16kn 2 > 0. since Y(α) ≤ 0 for all α. Therefore, for all M > 0,   9 9 9M 9 P (T1,n ≤ M ) = P T1,n + T1,n + Y(α̃n ) ≤ + T1,n + Y(α̃n ) 16kn 16kn 16kn 16kn   2 9M 9 (` ) ≤ P χ (α? ) 1 ≤ + T1,n + Y(α̃n ) 16kn 16kn       2 9M 1  ? (`1 ) − ≤ P χ (α ) ≤ sup L1,n α̂n |Λ̂n − L1,n α|Λ̂n + Y1 (α) , 16kn α∈Θ1 kn (` ) 2 (` ) 2 9M and since for any M there exists sufficiently large n such that χ (α? ) 1 − 16k ≥ 12 χ (α? ) 1 , n we have       2 1  1 (` ) χ (α? ) 1 ≤ sup P (T1,n ≤ M ) ≤ P L1,n α̂n |Λ̂n − L1,n α|Λ̂n + Y1 (α) + o(1) 2 α∈Θ1 kn →0 as n → ∞ because of the uniform convergence in probability shown above. This result and the (` ) analogous discussion for T2,n for the case where r2 > 0 and ∃ `2 ∈ {1, · · · , r2 } such that (β ? ) 2 6= 0 complete the proof. Proof of Theorem 3. We only proof for the convergence of R1,n with r1 > 0 and use the sets of notation same as Theorem 1. Then it holds    9  −1   1 ? (2,2) 2 R1,n = √ ∂α L1,n α |Λ̂n I − J H − ∂α L1,n α̂n |Λ̂n I − J (2,2) H 8kn kn   1 T × √ (∂α L1,n ) α? |Λ̂n kn −1   1/2  1/2   9 L (2,2) T (2,2) (2,2) J I − J (2,2) H I (2,2) Z →Z I I −J H 8 ∼ χ2r1 . Proof of Theorem 4. We proof for the case where r1 > 0 and there exists `1 ∈ {1, · · · , r1 } such (` ) that (α? ) 1 6= 0. Note the Taylor’s expansion     1 1 T T (∂α L1,n ) α̃n |Λ̂n = (∂α L1,n ) α̂n |Λ̂n kn kn Z 1    1 2 + ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du (α̃n − α̂n ) 0 kn Z 1    1 2 = ∂α L1,n α̂n + u (α̃n − α̂n ) |Λ̂n du (α̃n − α̂n ) 0 kn Z 1  = J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du (α̃n − α̂n ) + oP (1) 0 17 for compactness of Θ1 . Then     9  −1  1  T 1 1 2 R1,n = ∂α L1,n α̃n |Λ̂n − ∂ L1,n α̂n |Λ̂n ∂α L1,n α̃n |Λ̂n kn kn 8kn α kn  Z 1 T J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du = (α̃n − α̂n ) 0    −1 Z 1 9 2 J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du (α̂n − α̃n ) × − ∂α L1,n α̂n |Λ̂n 8kn 0 + oP (1) = (α̃n − α̂n ) T Z 1 J (2,2) ?  (α̂n + u (α̃n − α̂n ) |ϑ ) du 0  × 9 (2,2) J (α̂n |ϑ? ) 8 −1 Z 1  J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du (α̂n − α̃n ) 0 + oP (1) for compactness of Θ1 again. When we set Z 1  T R1,n = kn (α̃n − α̂n ) J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du 0  × −1 Z 1  9 (2,2) ? (2,2) ? J (α̂n |ϑ ) J (α̂n + u (α̃n − α̂n ) |ϑ ) du (α̂n − α̃n ) , 8 0 it holds Z 1  1 T (2,2) ? R1,n = (α̃n − α̂n ) J (α̂n + u (α̃n − α̂n ) |ϑ ) du kn 0 −1 Z 1   9 (2,2) J (α̂n |ϑ? ) J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du (α̂n − α̃n ) × 8 0 Z 1 2   −1 8 T ≥ λmax J (2,2) (α̃n − α̂n ) J (2,2) (α̂n + u (α̃n − α̂n ) |ϑ? ) du (α̃n − α̂n ) 9 0  −1  2 8 2 ≥ λmax J (2,2) inf λmin J (2,2) (α|ϑ? ) kα̃n − α̂n k α∈Θ1 9  2  −1 2 8 α̂n(`1 ) inf λmin J (2,2) (α|ϑ? ) ≥ λmax J (2,2) α∈Θ1 9  −1  2 2 8 (` ) = λmax J (2,2) inf λmin J (2,2) (α|ϑ? ) (α? ) 1 + oP (1) α∈Θ 9 1 (`1 ) = Q (α? ) 2 + oP (1), −1 2 where Q := 89 λmax J (2,2) inf α∈Θ1 λmin J (2,2) (α|ϑ? ) . Hence we obtain for all M > 0, δ > 0,   M 1 R1,n ≤ P (R1,n ≤ M ) = P kn kn     1 M 1 1 δ =P R1,n ≤ ∩ R1,n − R1,n > kn kn kn kn 3     1 M 1 1 δ +P R1,n ≤ ∩ R1,n − R1,n ≤ kn kn kn kn 3     1 1 δ 1 M δ ≤P R1,n − R1,n > +P R1,n ≤ + kn kn 3 kn kn 3   2 M δ ≤ P Q α̂n(`1 ) ≤ + + o(1) kn 3     2 2 2 M 2δ δ (` ) (` ) ≤ P Q (α? ) 1 ≤ + +P α̂n(`1 ) − (α? ) 1 ≥ + o(1) kn 3 3Q   2 M 2δ (` ) ≤ P Q (α? ) 1 ≤ + + o(1). kn 3 18 We can choose δ to suffice δ < Q (α? ) (`1 ) 2 . For any M > 0, there exists sufficiently large n such that M/kn ≤ δ/3. Hence  P (R1,n ≤ M ) ≤ P (`1 ) Q (α? ) 2  ≤ δ + o(1) = o(1), and then we obtain the result. Proof of Theorem 5. We also proof for the convergence of W1,n with r1 > 0 and use the sets of notation same as Theorem 1. It holds   −1  9   1 (2,2) 2 ˜ W1,n = √ ∂α L1,n α̃n |Λ̂n Jii,n (α̃n , α̂n ) − ∂ L1,n α̂n |Λ̂n 8kn α kn  −1 1   (2,2) √ (∂α L1,n )T α̃n |Λ̂n × J˜ii,n (α̃n , α̂n ) kn  1/2  −1  L I − J (2,2) H J (2,2) → Z T I (2,2)   1/2  9 (2,2)  (2,2) −1  × I − J (2,2) H I (2,2) Z J J 8 −1   1/2   9  1/2 = Z T I (2,2) I − J (2,2) H J (2,2) I − J (2,2) H I (2,2) Z 8 ∼ χ2r1 . Proof of Theorem 6. We proof for the case where r1 > 0 and there exists `1 ∈ {1, · · · , r1 } such (` ) that (α? ) 1 6= 0. For compactness of Θ1 and consistency of α̂n    1 9 2 T W1,n = (α̂n − α̃n ) − ∂α L1,n α̂n |Λ̂n (α̂n − α̃n ) kn 8kn   T = (α? − α̃n ) I (2,2) (α? − α̃n ) + oP (1). and T An := (α? − α̃n ) ≥ (α? ) (`1 ) 2   I (2,2) (α? − α̃n )     inf xT I (2,2) x . kxk=1 Note the assumption (A6) and (A7); then Y1 (α) = kα − α? k −2 T (α − α? ) J (2,2) (α − α? ) + o (1) , when we consider α → α? . Therefore, I (2,2) is positive definite, and for all M > 0 and δ > 0,   M 1 W1,n ≤ P (W1,n ≤ M ) = P kn kn   1 M =P W1,n − An − ≤ −An kn kn    1 M ≤P W1,n − An − ≤ −An ∩ {An > δ} + P (An ≤ δ) kn kn    1 M =P W1,n − An − ≤ −An ∩ {−An < −δ} + P (An ≤ δ) kn kn   1 M ≤P W1,n − An − ≤ −δ + P (An ≤ δ) kn kn   1 M ≤P W1,n − An ≤ − δ + P (An ≤ δ) . kn kn 19 For any M > 0 and δ > 0, we have sufficiently large n such that M/kn < δ/2, and then     1 M 1 δ P W1,n − An ≤ −δ ≤P W1,n − An ≤ − + o(1) kn kn kn 2   1 δ = P An − W1,n ≥ + o(1) kn 2   1 δ ≤ P An − W1,n ≥ + o(1) kn 2 = o(1). Hence P (W1,n ≤ M ) ≤ P (An ≤ δ) + o(1)       2 (` ) inf xT I (2,2) x ≤ δ + o(1) ≤ P (α? ) 1 kxk=1 Since δ is arbitrary, we obtain the proof. Acknowledgement This work was partially supported by JST CREST, JSPS KAKENHI Grant Number JP17H01100 and Cooperative Research Program of the Institute of Statistical Mathematics. References [1] Bibby, B. M. and Sørensen, M. (1995). Martingale estimating functions for discretely observed diffusion processes. Bernoulli, 1:17–39. [2] Brockwell, P. J. and Davis, R. A. (1991). Time series: theory and methods. Springer, New York. [3] Eguchi, S. and Masuda, H. (2018). Schwarz type model comparison for LAQ models. Bernoulli, 24(3):2278–2327. [4] Favetto, B. (2014). Parameter estimation by contrast minimization for noisy observations of a diffusion process. Statistics, 48(6):1344–1370. [5] Favetto, B. (2016). Estimating functions for noisy observations of ergodic diffusions. Statistical Inference for Stochastic Processes, 19:1–28. [6] Ferguson, T. S. (1996). A Course in Large Sample Theory. Chapman & Hall, London. [7] Florens-Zmirou, D. (1989). Approximate discrete time schemes for statistics of diffusion processes. Statistics, 20(4):547–557. [8] Fujii, T. and Uchida, M. (2014). AIC type statistics for discretely observed ergodic diffusion processes. Statistical Inference for Stochastic Processes, 17(3):267–282. [9] Gloter, A. and Jacod, J. (2001a). Diffusions with measurement errors. I. local asymptotic normality. ESAIM: Probability and Statistics, 5:225–242. [10] Gloter, A. and Jacod, J. (2001b). Diffusions with measurement errors. II. optimal estimators. ESAIM: Probability and Statistics, 5:243–260. [11] Jacod, J., Li, Y., Mykland, P. A., Podolskij, M., and Vetter, M. (2009). Microstructure noise in the continuous case: the pre-averaging approach. Stochastic Processes and their Applications, 119(7):2249–2276. [12] Kessler, M. (1995). Estimation des parametres d’une diffusion par des contrastes corriges. Comptes rendus de l’Académie des sciences. Série 1, Mathématique, 320(3):359–362. 20 [13] Kessler, M. (1997). Estimation of an ergodic diffusion from discrete observations. Scandinavian Journal of Statistics, 24:211–229. [14] Kitagawa, H. and Uchida, M. (2014). Adaptive test statistics for ergodic diffusion processes sampled at discrete times. Journal of Statistical Planning and Inference, 150:84–110. [15] Lehmann, E. L. and Romano, J. P. (2005). Testing Statistical Hypotheses. Springer Verlag, New York. [16] Nakakita, S. H. and Uchida, M. (2017). Adaptive estimation and noise detection for an ergodic diffusion with observation noises. arxiv: 1711.04462. [17] NWTC Information Portal (2018). NWTC 135-m meteorological towers data repository. https://nwtc.nrel.gov/135mdata. [18] Uchida, M. (2010). Contrast-based information criterion for ergodic diffusion processes from discrete observations. Annals of the Institute of Statistical Mathematics, 62(1):161–187. [19] Uchida, M. and Yoshida, N. (2012). Adaptive estimation of an ergodic diffusion process based on sampled data. Stochastic Processes and their Applications, 122(8):2885–2924. [20] Uchida, M. and Yoshida, N. (2014). Adaptive bayes type estimators of ergodic diffusion processes from discrete observations. Statistical Inference for Stochastic Processes, 17(2):181– 219. [21] Yoshida, N. (1992). Estimation for diffusion processes from discrete observation. Journal of Multivariate Analysis, 41(2):220–242. [22] Yoshida, N. (2011). Polynomial type large deviation inequalities and quasi-likelihood analysis for stochastic differential equations. Annals of the Institute of Statistical Mathematics, 63:431– 479. 21
10math.ST
Simulation studies on the design of optimum PID controllers to suppress chaotic oscillations in a family of Lorenz-like multi-wing attractors Saptarshi Dasa,b, Anish Acharyac,d, and Indranil Pana a) Department of Power Engineering, Jadavpur University, Salt Lake Campus, LB-8, Sector 3, Kolkata-700098, India. b) Communications, Signal Processing and Control (CSPC) Group, School of Electronics and Computer Science, University of Southampton, Southampton SO17 1BJ, United Kingdom. c) Department of Instrumentation and Electronics Engineering, Jadavpur University, Salt Lake Campus, LB-8, Sector 3, Kolkata-700098, India. d) Department of Electrical and Computer Science Engineering, University of California Irvine, CA 92697-2620, USA. Authors’ Emails: [email protected], [email protected] (S. Das) [email protected] (A. Acharya) [email protected], [email protected] (I. Pan) Abstract: Multi-wing chaotic attractors are highly complex nonlinear dynamical systems with higher number of index-2 equilibrium points. Due to the presence of several equilibrium points, randomness and hence the complexity of the state time series for these multi-wing chaotic systems is much higher than that of the conventional double-wing chaotic attractors. A real-coded Genetic Algorithm (GA) based global optimization framework has been adopted in this paper as a common template for designing optimum Proportional-Integral-Derivative (PID) controllers in order to control the state trajectories of four different multi-wing chaotic systems among the Lorenz family viz. Lu system, Chen system, Rucklidge (or Shimizu Morioka) system and Sprott-1 system. Robustness of the control scheme for different initial conditions of the multi-wing chaotic systems has also been shown. Keywords - chaos control; chaotic nonlinear dynamical systems; Lorenz family; multiwing attractor; optimum PID controller 1. Introduction Chaos is a field in mathematical physics which has found wide applications, ranging from weather prediction to geology, mathematics, biology, computer science, economics, philosophy, sociology, population dynamics, psychology, robotics etc. [29]. Chaos theory studies the behavior of dynamical systems which are nonlinear, highly sensitive to changes in initial conditions, and have deterministic (rather than probabilistic) underlying rules which dictates the evolution of the future states of a 1 system. Such systems exhibit aperiodic oscillations in the time series of the state variables and long term prediction of such systems is not possible due to the sensitive dependence on initial conditions. Theoretical investigations of chaotic time series have percolated into real world applications like those in computer networks, data encryption, information processing systems, pattern recognition, economic forecasting, stock market prediction etc. [29]. Historically, chaos was first observed in natural convection [16], weather prediction and subsequently in several other fluid mechanics related problems [2]. Survey of a wide variety of physical systems exhibiting chaos and pattern formation in nature ranging from convection, mixing of fluids, chemical reaction, electrohydrodynamics to solidification and nonlinear optics have been summarized in [10]. An interesting ramification of chaos theory is the investigation of synchronization and control of such systems [19]. Even with their unpredictable dynamics, proper control laws can be designed to suppress the undesirable excursions of the state variables or make the state variables follow a definite trajectory [35]. These chaos control schemes have a variety of engineering applications and hence control of chaotic systems has received increased attention in last few years [5]. In chaos control, the prime objective is to suppress the chaotic oscillations completely or reduce them to regular oscillations. Recent chaos control techniques include open loop control methods, adaptive control methods, traditional linear and nonlinear control methods, fuzzy control techniques etc. among many others [5]. Most chaos control techniques exploit the fact that any chaotic attractor containing infinite number of unstable periodic orbits can be modified using an external control action to produce a stable periodic orbit. The chaotic system’s states never remains in any of these unstable orbits for a long time but rather it continuously switches from one orbit to the other which gives rise to this unpredictable, random wandering of the state variables over a longer period of time. The control scheme basically tries to achieve stabilization, by means of small system perturbations, of one of these unstable periodic orbits. The result is to render an otherwise chaotic motion more stable and predictable. The perturbation must be tiny, to avoid significant modification of the system’s natural dynamics. Several techniques have been used to control chaos, but most of them are developments of two basic approaches: the OGY (Ott, Grebogi and Yorke) method [20], and Pyragas continuous control method [22]. Both methods require a prior determination of the unstable periodic orbits of the chaotic system before the control algorithm can be designed. The basic difference between the OGY and Pyragas methods of chaos control is that the former relies on the linearization of the Poincare map and the latter is based on time delay feedback. PID controller based designs are popular in the control engineering community for several decades, due to its design simplicity, ease of use, and implementation feasibility. PID type controller design can be found in recent literatures for synchronization of chaotic systems with different initial guess [1, 3, 7-9, 14, 15]. However, except few attempts like [4], optimum PID controller design for chaos control is not well investigated yet, especially for the control of highly complex chaotic systems like multi-wing attractors, as attempted in this paper. The rationale behind particularly choosing PID controllers is due to its simplicity, ease of implementation and tuning methods compared to unavailability of Lypunov based stabilization and sliding mode techniques [19, 35] for multi-wing chaotic attractors. The classical approach of dealing with chaos control and synchronization is to formally eliminate the nonlinear terms for 2 designing a suitable nonlinear control scheme, in order to make the error dynamical system linear and then find a suitable Lypunov based stabilization scheme [19]. The present approach needs no additional requirement of canceling complex multi-segment nonlinear terms by a nonlinear control scheme for each chaotic system. The success of the present approach lies in the fact that a generalized linear PID control framework can stabilize a family of complex multi-wing chaotic system when only the second state variable needs to be sensed and manipulated using an external PID control action. The controller gains are optimized to damp the oscillations as early as possible and the control scheme is also tested for required robustness against system’s initial condition variation. Previously, design of PID type controllers equipped with fractional order integrodifferential operators and fuzzy logic have been researched for chaos synchronization [11] and chaos control [21], within a common global optimization framework without paying much attention to the specific nonlinear structure and complexity of the chaotic system. This idea has been extended here for the control of highly complex nonlinear dynamical systems i.e. multi-wing chaotic attractors in the Lorenz family. Many researches have focused on theoretical and experimental studies on the synchronization and control of classical double-wing chaotic and hyper-chaotic systems from the Lorenz family like the Lorenz, Chen and Lu attractors [19, 35, 5, 12]. However, there is almost no significant result for relatively complex chaotic systems like the multiscroll and multi-wing attractors which is addressed in the present paper. Multi-scroll attractors first emerged as an extension of the Chua’s circuit [31] and it has been found to be more suitable than the classical double-wing chaotic attractors in applications like secure communication and data encryption. The multi-scroll attractors are produced by suitably modifying the nonlinear terms of the governing differential equations of the chaotic system which has been successfully applied to produce 1D, 2D and 3D scroll grid attractors in [17]. The reason behind obtaining highly complex time-series out of multiscroll and multi-wing attractors is that they have more number of equilibrium points than the classical double-wing attractors. Recent research has shown that such highly complex time-series and phase space behavior can also be obtained from typical chaotic and hyper-chaotic systems with no equilibrium point [27] and infinite number of equilibrium points [36]. Theoretical studies on the complexity analysis of such multi-wing attractors have been reported in He et al. [13] using spectral entropy and statistical complexity measure. Among the two major families of complex chaotic systems, the control and synchronization of multi-scroll attractors are proposed in [30] but there is almost no result for the multi-wing attractors. The purpose of the present study is to develop a common template to suppress highly complex chaotic oscillations in the Lorenz family of multi-wing attractors using a simple controller structure like the PID and a global optimization based gain tuning mechanism. An objective function for the controller design problem is framed in terms of the state variables of the chaotic system and the desired state trajectories of the system. The real coded GA based optimization is then employed to find out the values of the PID controller gains. 2. Basics of the Lorenz family of multi-wing chaotic systems Four classical examples of symmetric double-wing chaotic attractors are chosen as the base cases here among the Lorenz family to study the control of multi-wing attractors [32]. In spite of having several literatures on the generation of multi-scroll attractors as an extension of Chua’s circuit, the first extension of the Lorenz family of 3 attractors from double-wing to multi-wing was proposed by Yu et al. [32]. It is also observed that in the Lorenz family of chaotic systems, similar attractors could be generated by replacing the cross-products with quadratic terms. The common characteristics of the source of nonlinearity in the state equations of the original doublewing Lorenz family of chaotic systems are due to having either a square and/or crossterms of the state variables. These particular terms can be replaced by a multi-segment parameter adjustable quadratic function (1) to generate multi-wing attractor with additional flexibility of modifying the numbers and locations of index-2 equilibrium points. As reported in the pioneering works of multi-wing chaos [32]-[33], the segment characteristics like the slope and width can be adjusted using the parameters { F0 , Fi , Ei } of equation (1). This typical function increases the number of index-2 equilibrium points along a particular axis for Lorenz family of chaotic systems from two to ( 2 N + 2 ) , thereby increasing the randomness or complexity of the state trajectories of the nominal (double-wing) chaotic system which is difficult to control by analytical methods. N f ( x ) = F0 x 2 − ∑ Fi 1 + 0.5sgn ( x − Ei ) − 0.5sgn ( x + Ei )  (1)  1 for x > 0  sgn ( x ) =  0 for x = 0 −1 for x < 0  (2) i =1 where, and N being a positive integer responsible for the number of wings of the chaotic attractor. In this paper, two multi-wing chaotic systems among the Lorenz family are obtained by replacing the cross-product terms (in Lu and Chen system) by the above mentioned multi-segment function. In the other two systems among the Lorenz family, the quadratic terms (in Rucklidge and Sprott-1 system) are replaced by the multi-segment function (1). 2.1. Chaotic multi-wing Lu system The double-wing chaotic Lu system [18] is represented by (3). xɺ = − ax + ay yɺ = cy − xz (3) zɺ = xy − bz The typical parameter settings for chaotic double-wing Lu attractor is given as a = 36, b = 3, c = 20 . The equilibrium points of the Lu system are located at ( 0, 0, 0 ) ; ( ± ) bc , ± bc , c . The state equations of the multi-wing chaotic Lu attractor whose states are to be controlled using a PID controller are given by (4). xɺ = − ax + ay yɺ = cy − (1 P ) xz + u zɺ = f ( x ) − bz 4 (4) Here, P reduces the dynamic range of the attractors so as to facilitate hardware realization. The suggested parameters for N = 4 are given in (5) [32] for which the chaotic Lu system exhibits multi-wing attractors in the phase portraits. P = 0.05, F0 = 100, F1 = 10, F2 = 12, F3 = 16.67, F4 = 18.18, (5) E1 = 0.3, E2 = 0.45, E3 = 0.6, E4 = 0.75 Here, the original cross product ( xy ) is replaced by the multi-segment quadratic function f ( x ) . Fig. 1 shows the projections of the 3-dimensional (x-y-z) phase space dynamics (Fig. 1d) of the multi-wing Lu system on the x-y (Fig. 1a), y-z (Fig. 1b), x-z (Fig. 1c) planes. Also, in (4) the PID control action is added to the second state variable to suppress the chaotic oscillations and the control action is given by (6). de u = K p e + K i ∫ e.dt + K d , e = (r − y) (6) dt Here, { K p , Ki , K d } are the PID controller gains which are to be found out by a suitable optimization technique for the reference signal ( r ) as a unit step. Fig. 1. Uncontrolled phase plane portraits for multi-wing Lu system [32]. 2.2. Chaotic multi-wing Chen system The double-wing Chen system [6] is represented by (7). xɺ = − ax + ay yɺ = ( c − a ) x + cy − xz (7) zɺ = xy − bz The typical parameter settings for chaotic double-wing Chen attractor is given as a = 35, b = 3, c = 28 . The equilibrium points of the Chen system are located at ( 0, 0, 0 ) ; ( ± b ( 2c − a ) , ± b ( 2c − a ) , ( 2c − a ) ) . The state equations of the multi-wing chaotic Chen attractor whose states are to be controlled are given by (8). 5 xɺ = −ax + ay yɺ = ( c − a ) x + cy − (1 P ) xz + u (8) zɺ = f ( x ) − bz The suggested parameters for N = 4 are given in (9) for which the chaotic Chen system exhibits multi-wing attractors in phase portraits. P = 0.05, F0 = 100, F1 = 12, F2 = 12, F3 = 16.67, F4 = 18.75, (9) E1 = 0.3, E2 = 0.45, E3 = 0.6, E4 = 0.75 The multi-wing Chen system in Fig. 2 shows similar phase space behavior to that of the multi-wing Lu system in Fig. 1, except the fact that more number of trajectories are observed away from the equilibrium points. Similar to the previous case of multi-wing Lu system, the nonlinear cross-product ( xy ) in the third state variable is replaced by f ( x ) . Fig. 2. Uncontrolled phase plane portraits for multi-wing Chen system [32]. 2.3. Chaotic Multi-wing Rucklidge system The double-wing Shimizu-Morioka system [24] is given by (10). xɺ = −ax + by − yz yɺ = x (10) zɺ = y 2 − z The typical parameter settings for chaotic double-wing Shimizu-Morioka attractor is given as a = 2, b = 7.7 . The equilibrium points of the Shimizu-Morioka system are located ( ) at ( 0, 0, 0 ) ; 0, ± b , b . The state equations of the multi-wing chaotic Shimizu-Morioka attractor whose states are to be controlled are given by (11). xɺ = − ax + by − (1 P ) yz yɺ = x + u (11) zɺ = f ( y ) − z 6 The above mentioned multi-wing chaotic Shimizu-Morioka system [34] is also known as modified Rucklidge system [23]. The suggested parameters for N = 3 are given in (12) [32] for which the chaotic Rucklidge system exhibits multi-wing attractors in the phase portraits (Fig. 3). (12) P = 0.5, F0 = 4, F1 = 9.23, F2 = 12, F3 = 18.18, E1 = 1.5, E2 = 2.25, E3 = 3.0 Here in the case of Rucklidge system, the quadratic term ( y 2 ) (unlike the cross-product of states in previous cases of Lu and Chen system) is replaced by the multi-segment function f ( y ) in the third state equation. Fig. 3. Uncontrolled phase plane portraits for multi-wing Rucklidge (Shimizu-Morioka) system [32]. 2.4. Chaotic Multi-wing Sprott-1 system The double-wing Sprott-1 system [25]-[26] is given by (13). xɺ = yz yɺ = x − y (13) zɺ = 1 − x 2 The equilibrium points of the Sprott-1 system are located at ( ±1, ±1, 0 ) . State equations of the multi-wing chaotic Sprott-1 attractor whose states are to be controlled are given by (14). xɺ = yz (14) yɺ = x − y + u zɺ = 1 − f ( x ) The suggested parameters for N = 4 are given by (15) [32] for which the chaotic Sprott-1 system exhibits multi-wing attractors in phase portraits (Fig. 4). (15) F0 = 1, F1 = 5, F2 = 5, F3 = 6.67, F4 = 8.89, E1 = 2, E2 = 3, E3 = 4, E4 = 5 7 Here, the quadratic term ( x 2 ) is replaced by the multi-segment function f ( x ) similar to the previous case of Rucklidge system. It is evident from the phase portraits of all the four multi-wing chaotic systems that the wandering of the states in phase space are highly complex, thus indicating the corresponding state time series being highly jittery which is hard to regularize using analytically derived external control action. Here, we have shown that a simple PID type linear controller structure which is widely used in industrial process control is capable of suppressing chaotic oscillations in such complex dynamical systems. Fig. 4. Uncontrolled phase plane portraits for multi-wing Sprott-1 system [32]. 3. Optimum PID control to suppress chaotic oscillations in multi-wing attractors Each of the above four classes of multi-wing chaotic systems are to be controlled using a PID controller (6) which will enforce the second state variable ( y ) to track a unit reference step input ( r ). Instead of simple error minimization criteria for PID controller tuning, the well-known Integral of Time multiplied Absolute Error (ITAE) criterion has been used as the performance index J (16) in order to ensure fast tracking of the second state variable with lesser oscillations. T J = ∫ t ⋅ e ( t ) dt , e ( t ) = r ( t ) − y ( t ) (16) 0 For time domain simulations, the upper time limit of the above integral ( T ) is restricted to realistic values depending on the speed of the chaotic time series to ensure that all oscillations in the state variables have died down due to introduction of the PID control action in the second state. It has also been shown through simulation examples that controlling the second state variable with PID automatically damps chaotic oscillations in the other two state variables for the Lorenz family of multi-wing attractors. Tuning of the PID controller gains have been done in this study using the widely used population based global optimizer known as the real coded genetic algorithm [28]. The GA is a stochastic optimization process which can be used to minimize a chosen 8 objective function. A solution vector is initially randomly chosen from the search space and undergoes reproduction, crossover and mutation, in each generation, to give rise to a better population of solution vectors in the next generation. Reproduction implies that solution vectors with higher fitness values can produce more copies of themselves in the next generation. Crossover refers to information exchange based on probabilistic decisions between solution vectors. In mutation a small randomly selected part of a solution vector is occasionally altered, with a very small probability. This way the solution is refined iteratively until the objective function is minimized below a certain tolerance level or the maximum number of generations are exceeded. In this study, the population size in GA is chosen to be 20. The crossover and mutation fraction are chosen to be 0.8 and 0.2 respectively for the present minimization problem using (16). Due to the randomness of the chaotic time series of the multi-wing attractors, the error signal with respect to step command input also becomes highly jittery and will contain several minima which justifies the application of GA in such controller tuning problems as compared to other gradient based optimization algorithms. GA being a global optimization algorithm is able to get out of the local minima, whereas the other gradient based optimization algorithms often get stuck in the local minima and cannot give good solutions. For the control and synchronization of chaotic systems, an evolutionary and swarm based PID controller design with other time domain performance index optimization have been used previously as reported in [11], [21]. But for the sake of simplicity, we have restricted the study for ITAE based PID design only to handle multi-wing attractors in chaotic nonlinear dynamical systems. The GA based optimization results for the PID controller parameters (gains) are given in Table 1 for the four respective multi-wing attractors among the Lorenz family. Also, in order to ensure that the best possible solution is found in the global optimization process, the algorithm has been run several times and only the controller gains, resulting in the fastest tracking performance (and hence the lowest value of Jmin) for respective systems are reported here. Table 1: GA Based Optimum PID Controller Settings for Chaos Suppression in Multiwing Attractors Multi-wing Chaotic systems Jmin Kp Ki Kd Lu system 244.986 3.156 27.562 1.449 Chen system 307.709 3.305 21.274 1.591 Rucklidge system 1.161 19.435 30.097 0.237 Sprott-1 system 1468.193 0.272 0.433 0.393 In all cases except the Sprott-1 system, the integral gains ( K i ) take high value signifying that the controller gives extra effort to reduce the steady state error using the integral action. Also, due the sluggish nature of the uncontrolled dynamics of Rucklidge system, the proportional gain ( K p ) also takes high value to make the overall closed loop system faster. It is obvious that such controller gains justifies the final objective of ITAE (16) that puts extra penalty for sluggish controlled response and pushes the system to reduce oscillations as soon as possible. A simpler Integral of Absolute Error (IAE) error criterion without the temporal effect in the objective function, unlike ITAE, would have yielded different controller parameters since it only enforces tracking of the set-point but not the fastest possible set-point tracking. 9 3.1. PID Control of Multi-wing Lu System Fig. 5. Uncontrolled and PID controlled response of the state variable for multi-wing Lu system (a) state-x (b) state-y (c) state-z. Simulation results for the uncontrolled and PID controlled state variables of the multi-wing Lu system (4) has been shown in Fig. 5 with the corresponding control signal and error of the second state depicted in Fig. 6. In Fig. 5(a)-(c), it can be observed that the chaotic evolution of the state variables in the uncontrolled state disappears when the PID controller is applied to the system. All the controlled states evolve to a steady state value. It is evident that the second state variable of the multi-wing Lu system not only tracks the unit step reference but the randomness in the other two state variables is also stabilized. As can be observed from Fig. 5, the controller achieves its design objective of suppressing the oscillations in the second state and making it track the desired trajectory of a unit step. Although the oscillations in the other states x and z are suppressed, the final value at which they settle is dependent on the controller parameters and cannot be obtained a-priori. A more customized control action could have been incorporated like that in [11] utilizing the sum of error for all the three state variables with the intention of getting set-point tracking in all the three state variables. But it would unnecessarily increase the control action which will create difficulty in implementing the control scheme in an analog circuit. A closer look on the set-point tracking error in Fig. 6 shows that the error asymptotically goes to zero and correspondingly the PID control action stabilizes to its final value. This essentially implies that in the steady state, the controller has to continuously give a constant signal to the second state of the chaotic system so that the error remains zero and the oscillations are suppressed. 10 Fig. 6. Control signal and the second state error for the PID controlled multi-wing Lu system. Also, the time series of the controlled states in Fig. 5(a)-(c) show initial oscillations which get damped quite fast even with a simple GA based optimum PID controller having a linear structure, though better performance can be expected at the cost of implementation of complex nonlinear controller structures and associated computational complexity like that used in [21]. 3.2. PID control of multi-wing Chen system Fig. 8. Uncontrolled and PID controlled response of the state variables for multi-wing Chen system (a) state-x (b) state-y (c) state-z. 11 Fig. 8 shows the controlled three state trajectories of the multi-wing Chen system (8). The associated error signal and control signal (Fig. 9) are quite similar to that of the Lu system. Damping of the chaotic oscillations in the PID controlled phase space is shown in Fig. 10 for this particular system among the Lorenz family. Similar to the case of Lu system, control of Chen system also shows initial jerk in the state trajectories which finally settles down asymptotically. A comparison can be made between the control efforts of Fig. 6 and Fig. 9. It can be observed that the area under the curve is less for Fig. 9 (a) than Fig. 6 (a). This implies that the overall control effort required for controlling the multi-wing Chen system is less than that required for controlling the multi-wing Lu system. Fig. 9. Control signal and the second state error for the PID controlled multi-wing Chen system. 3.3. PID control of multi-wing Rucklidge system Similar nature of chaos control can be obtained in the multi-wing Rucklidge system (11) also with the GA based optimum PID controller which enforces fast tracking of the second state variable. Also the irregular oscillations of this system are found to be more sluggish compared to the Lu system which is controlled by the PID to track a reference input using ITAE criterion. Also, controlled state trajectories are smoother at initial stages unlike that for the Lu and Chen system. Here, Fig. 11 shows the respective uncontrolled and controlled three state trajectories. The control and error signals are shown in Fig. 12. A comparison can be made between Fig. 11 and Figs. 5 and 8. It can be seen that the oscillations in the multi-wing Rucklidge system is suppressed within a few seconds of applying the control signal, unlike that in the two former cases. A comparison of the control and error signals in this case (Fig. 12) as compared to the previous cases (Figs. 6 and 9) show that the steady state control signal required in this case is much smaller than the former two. The error goes to zero within the first 10 seconds while it takes almost 200 seconds in the former two cases. Therefore it can be concluded that the 12 Rucklidge system is comparatively easier to control using a simple linear PID controller structure than the previously studied chaotic systems i.e. Lu and Chen system. Fig. 11. Uncontrolled and PID controlled response of the state variables for multi-wing Rucklidge system (a) state-x (b) state-y (c) state-z. Fig. 12. Control signal and the second state error for the PID controlled multi-wing Rucklidge system. 3.4. PID control of multi-wing Sprott-1 system For the multi-wing Sprott-1 system (14), the ITAE based GA tuned PID enforces fast reference tracking and simultaneously damps chaotic oscillations (Fig. 14) in an efficient way. It can be noted that in this case, although the original objective of making 13 the second state (y) follow a step function is achieved, there are small oscillations in the x and the z states. This is unlike the previous three cases where controlling one of the states resulted in controlling all the other states automatically. If the oscillations in the other two states are desired to be minimized then they have to be explicitly taken into account in the objective function itself. It is also evident from the control and error signals in Fig. 15 (which shows the settling of the error signal to zero and control action approaching to its final value) that this system is easier to control than the multi-wing Chen and Lu system. But it is more difficult to control than the multi-wing Rucklidge system, in the sense that it takes more control effort than the former and also takes much more time to settle than the former. Fig. 14. Uncontrolled and PID controlled response of the state variables for multi-wing Sprott-1 system (a) state-x (b) state-y (c) state-z. It is well known that chaotic systems are highly sensitive to the initial conditions of the states. Since in the presented approach only a single initial condition of the state variables are assumed to tuned the GA based PID controllers with minimum ITAE for the second state, hence under different initial conditions, effective damping of chaotic oscillations need to be investigated. Therefore, study of the robustness of the present PID control scheme for effective control is shown in next section for each of the four classes of multi-wing chaotic systems. 14 Fig. 15. Control signal and the second state error for the PID controlled multi-wing Sprott-1 system. 4. Test of robustness for the PID control scheme with different initial conditions of state variables Fig. 17. Robustness of the PID controller for chaos suppression in multi-wing Lu system for different initial conditions. In this section, the proposed GA based PID control scheme has also been tested for its robustness with variation in the initial conditions of multi-wing chaotic systems. Question may arise whether the optimum PID control scheme would be able to stabilize the system for other initial values of the state variables, since the controller is tuned with 15 any one initial guess of the states. This is particularly important to investigate since the proposed approach does not rely on classical Lyapunov criterion based analytical stabilization which has been extensively studied for double wing attractors [19], [35], [5]. Fig. 18. Robustness of the PID controller for chaos suppression in multi-wing Chen system for different initial conditions. Fig. 17-20 shows that in the phase portraits the chaotic oscillations get suppressed along different trajectories for the four complex nonlinear dynamical systems, even if the initial conditions for the first two states are gradually decreased from unity to zero. In spite of high sensitivity to the initial conditions for the states in all chaotic systems, the proposed PID control scheme is capable of suppressing the wandering of the states in phase space for the Lu and Chen system which are quite similar and shown in Fig. 17-18. For the Rucklidge system as shown in Fig. 19, the controlled phase space trajectories converges towards a particular direction even with variation in initial condition of the system’s states. The controlled phase portraits for different initial conditions are much more complex for the Sprott-1 system as portrayed in Fig. 20 but finally converge to a stable equilibrium point, similar to the other multi-wing systems. A comparison of Figs 17 and 18 can be made with that of Fig. 19. It can be seen that in case of the Rucklidge system in Fig. 19, the state trajectories from the different initial conditions to the final equilibrium solution are much smaller than those of the Lu or the Chen systems (in Figs. 17 and 18 respectively). This also provides an insight into the amount of controller effort and settling time required to suppress the chaotic oscillations in these systems. As discussed previously, the Lu and the Chen systems are more difficult to control and this can also be understood from the phase portraits of the trajectories in Figs. 17 and 18. In these figures the trajectories evolve through multiple small scrolls and hence take more time than that of the Rucklidge system in Fig. 19. The trajectories of the controlled systems in Fig. 20 show that they take larger excursions than the Rucklidge system but do not get trapped in small scrolls, therefore making them 16 easier to control than the Lu and the Chen systems, but more difficult than the Rucklidge system. Fig. 19. Robustness of the PID controller for chaos suppression in multi-wing Rucklidge system for different initial conditions. Fig. 20. Robustness of the PID controller for chaos suppression in multi-wing Sprott-1 system for different initial conditions. 5. Discussion: It is well known that it is difficult to find a quadratic Lyapunov function in such complicated nonlinear dynamical systems like multi-wing chaotic attractors except few attempts like that in [30]. The present approach has been shown to work reliably well, even though analytical stabilization has not yet been addressed for such systems due to 17 high system complexity. The proposed optimum PID control scheme has another advantage over the conventional Lyapunov function based stabilization approach i.e. the optimum tracking of the desired state variable which is difficult to achieve with the classical Lyapunov approach. With slight modification of the objective function different states or even more than one state variable can easily be enforced to track different reference inputs [11], unlike the Lyapunov based approach. The Lyapunov and sliding mode approaches enforce guaranteed stabilization but not optimum set-point tracking and also the nonlinear control law needs to be changed every time, depending on the structure of the chaotic system which restricts the designer to have a common controller structure (like a simple PID here) to control all the multi-wing systems in the Lorenz family. Thus to the best of authors’ knowledge, this is the first approach to suppress chaotic oscillations in the family of multi-wing Lorenz family of chaotic systems with a simple control scheme augmented with a global optimization framework. Another important part of the present control scheme is the course of control action to derive the control law i.e. the effect of the upper limit of the integral objective function (16). Also, the trajectory of control for different chaotic systems plays an important role here with respect to the quality of the control. Depending on the number of equilibrium points and speed of oscillations for a particular chaotic system, the control action and the associated controller gains would vary widely within the same common PID structure. Also, the upper limit of the time domain performance index needs to be chosen suitably keeping in mind the number of oscillations within a same window. For example, the multi-wing Rucklidge system has got less number of irregular oscillations with a chosen 100 sec of simulation time window thus it gets settled down very quickly. Whereas both the multi-wing Lu and multi-wing Chen system produces more number irregular oscillation (in the uncontrolled mode) within that chosen window which takes much higher time get damped in the controlled mode. The multi-wing Sprott-1 system has the slowest dynamics compared to the other three chaotic systems thus it also settles down fast. The particular improvements of the present paper over state-of-the-art techniques are highlighted below. • • • Due to the structure specific Lyapunov stabilization scheme for a particular chaotic system, the proposed PID control scheme is more suited where the control scheme does not need to be changed every time except the PID controller gains. Deriving an analytical control action to suppress chaotic oscillation is based on the choice of the quadratic Lyapunov candidate which guarantees stabilization but not the fastest possible stabilization. The optimum PID controller not only suppresses the oscillations but enforces optimum tracking of one or multiple state variables (with suitable choice of the objective function as in [11]). Most of the popular analytical control schemes for a particular chaotic system rely on manipulating all the state variables [19], [35], [5]. The present PID control scheme only senses the second state variables and manipulates it to perform the same stabilization task. This is practical from the hardware implementation point of view as less number of sensors is required. Also not all the states of the chaotic system may be measurable. In such cases, this scheme scores over the others. 18 • The control scheme is particularly useful even in the presence of noise in the measured variable as previously studied in [21] which is difficult tackle with using analytical methods of nonlinear state feedback law design [19], [35], [5]. The PID control scheme, due to not being dependent on the system structure and directly working on the sensed state time series instead of the system model, is capable of stabilization of such nonlinear dynamical systems [12]. This is difficult to achieve with the classical state feedback controller. In spite of having several advantages, it is well known that stabilization of chaotic systems cannot be guaranteed by simulation due to their sensitive dependence on initial conditions. Although the simulations presented in section 4 in order to prove the robustness of PID control for multi-wing chaotic systems show promising results, still after testing with thousands of different initial conditions, the stabilization is not theoretically guaranteed unlike the Lyapunov based approach. Except the unavailability of guaranteed stabilization for all possible initial condition of the states, the proposed control scheme enjoys more flexibility of the controller design in a common template and can easily be tweaked by modifying the objective function (16) and the global optimizer used in this context. 6. Conclusion A real coded Genetic Algorithm based optimum PID controller design has been proposed in this paper to suppress chaotic oscillations in a family of highly complex multi-wing Lorenz family of chaotic systems. The PID controller enforces fast tracking of the second state due to presence of the ITAE criterion in the controller design phase which also removes chaotic oscillations in other state variables. The present approach is based on a heuristic optimization framework which can be easily modified to enforce optimum tracking performance in the other state variables and also with a combination of them. Using credible numerical examples, the optimum PID control scheme has been shown to be robust enough with different initial conditions, even for such highly complex nonlinear dynamical systems known as the multi-wing Lorenz family of chaotic systems. As mentioned earlier, obtaining analytical guaranteed stabilization scheme is quite challenging for such complex dynamical systems and has been left as a scope for future research. References [1] R. Aguilar-Lopez and R. Martinez-Guerra, Partial synchronization of different chaotic oscillators using robust PID feedback, Chaos, Solit. & Fract. 33 (2) (2007) 572-581. [2] A. Brandstäter, J. Swift, H.L. Swinney, A. Wolf, J.D. Farmer, E. Jen, and P.J. Crutchfield, Low-dimensional chaos in a hydrodynamic system, Phys. Rev. Let. 51 (16) (1983) 1442-1445. [3] W.-D. Chang, PID control for chaotic synchronization using particle swarm optimization, Chaos, Solit. & Fract. 39 (2) (2009) 910-917. [4] W.-D. Chang and J.-J. Yan, Adaptive robust PID controller design based on a sliding mode for uncertain chaotic systems, Chaos, Solit. & Fract. 26 (1) (2005) 167-175. [5] G. Chen and X. Yu, Chaos Control: Theory and Applications, Springer, Berlin, 2003. 19 [6] G. Chen and T. Ueta, Yet another chaotic attractor, Intern. J. of Bifurc. and Chaos 9 (7) (1999) 1465-1466. [7] H.-C. Chen, J.-F. Chang, J.-J. Yan and T.-L. Liao, EP-based PID control design for chaotic synchronization with application in secure communication, Expert Syst. with Appl. 34 (2) (2008) 1169-1177. [8] L.S. Coelho and R.B. Grebogi, Chaotic synchronization using PID control combined with population based incremental learning algorithm, Expert Syst. with Appl. 37 (7) (2010) 5347-5352. [9] L.S. Coelho and D.L.A. Bernert, PID control design for chaotic synchronization using a tribes optimization approach, Chaos, Solit. & Fract. 42 (1) (2009) 634-640. [10] M.C. Cross and P.C. Hohenberg, Pattern formation outside of equilibrium, Rev. of Mod. Phys. 65 (3) (1993) 851-1112. [11] S. Das, I. Pan, S. Das, and A. Gupta, Master-slave chaos synchronization via optimal fractional order PIλDµ controller with bacterial foraging algorithm, Nonlin. Dynam. 69 (4) (2012) 2193-2206. [12] A.L. Fradkov and R.J. Evans, Control of chaos: methods and applications in engineering, Ann. Rev. in Cont. 29 (1) (2005) 33-56. [13] S.-B. He, K.-H. Sun, and C.-X. Zhu, Complexity analyses of multi-wing chaotic systems, Chinese Phys. B 22 (5) (2013) 050506. [14] M.-L. Hung, J.-S. Lin, J.-J. Yan and T.-L. Liao, Optimal PID control design for synchronization of delayed discrete chaotic systems, Chaos, Solit. & Fract. 35 (4) (2008) 781-785. [15] C.L. Kuo, H.T. Yau and Y.C. Pu, Design and implementation of a digital PID controller for a chaos synchronization system by evolutionary programming, J. of Appl. Scien. 8 (13) (2008) 2420-2427. [16] E.N. Lorenz, Deterministic nonperiodic flow, J. of the Atmospher. Sci. 20 (2) (1963) 130-141. [17] J. Lü, F. Han, X. Yu, and G. Chen, Generating 3-D multi-scroll chaotic attractors: A hysteresis series switching method, Automatica 40 (10) (2004) 1677-1687. [18] J. Lu and G. Chen, A new chaotic attractor coined, Intern. J. of Bifurc. and Chaos 12 (3) (2002) 659-661. [19] J.M.G. Miranda, Synchronization and Control of Chaos: an Introduction for Scientists and Engineers, Imperial College Press, London, 2004. [20] E. Ott, C. Grebogi, and J.A. Yorke, Controlling chaos, Phys. Rev. Lett. 64 (11) (1990) 1196-1199. [21] I. Pan, A. Korre, S. Das, and S. Durucan, Chaos suppression in a fractional order financial system using intelligent regrouping PSO based fractional fuzzy control policy in the presence of fractional Gaussian noise, Nonlin. Dynam. 70 (4) (2012) 2445-2461. [22] K. Pyragas, Continuous control of chaos by self-controlling feedback, Phys. Lett. A 170 (6) (1992) 421-428. [23] A.M. Rucklidge, Chaos in models of double convection, J. of Fluid Mech. 237 (1992) 209-229. [24] T. Shimizu and N. Morioka, On the bifurcation of a symmetric limit cycle to an asymmetric one in a simple model, Phys. Lett. 76 (3-4) (1980) 201-204. [25] J.C. Sprott, Some simple chaotic flows, Phys. Rev. E 50 (2) (1994) R647-R650. 20 [26] J.C. Sprott, Simple chaotic systems and circuits, Americ. J. of Phys. 68 (8) (2000) 758-763. [27] Z. Wang, S. Cang, E.O. Ochola, and Y. Sun, A hyperchaotic system without equilibrium, Nonlin. Dynam. 69 (1-2) (2012) 531-537. [28] P. Wang and D.P. Kwok, Optimal design of PID process controllers based on genetic algorithms, Contr. Eng. Pract. 2 (4) (1994) 641-648. [29] S. Wiggins, Introduction to Applied Nonlinear Dynamical Systems and Chaos, Springer, New-York, 2003. [30] F. Xu and P. Yu, Chaos control and chaos synchronization for multi-scroll chaotic attractors generated using hyperbolic functions, J. of Math. Anal. and Appl. 362 (1) (2010) 252-274. [31] S. Yu, J. Lu, W.K.S. Tang, and G. Chen, A general multiscroll Lorenz system family and its realization via digital signal processors, Chaos 16 (3) (2006) 033126. [32] S. Yu, W.K.S. Tang, J. Lu, and G. Chen, Generating 2n-wing attractors from Lorenz-like systems, Intern. J. of Circuit Theory and Appl. 38 (2010) 243-258. [33] S. Yu, W.K.S. Tang, J. Lu, and G. Chen, Multi-wing butterfly attractors from the modified Lorenz systems, IEEE Intern. Symp. on Circuits and Syst., ISCAS 2008 (2008) 768-771, Seattle. [34] S. Yu, W.K.S. Tang, J. Lu, and G. Chen, Generation of n×m-wing Lorenz-like attractors from a modified Shimizu–Morioka model, IEEE Trans. on Circuits and Syst. II: Expr. Briefs 55 (11) (2008) 1168-1172. [35] H. Zhang, D. Liu, and Z. Wang, Controlling Chaos: Suppression, Synchronization and Chaotification, Springer-Verlag, London, 2009. [36] P. Zhou and F. Yang, Hyperchaos, chaos, and horseshoe in a 4D nonlinear system with an infinite number of equilibrium points, Nonlin. Dynam. (2013) (In Press). 21
3cs.SY
1 Fast Xor-based Erasure Coding based on Polynomial Ring Transforms arXiv:1701.07731v2 [cs.IT] 13 Jun 2017 Jonathan Detchart, Jérôme Lacan ISAE-Supaéro, Université de Toulouse, France Abstract—The complexity of software implementations of MDS erasure codes mainly depends on the efficiency of the finite field operations implementation. In this paper, we propose a method to reduce the complexity of the finite field multiplication by using simple transforms between a field and a ring to perform the multiplication in a ring. We show that moving to a ring reduces the complexity of the operations. Then, we show that this construction allows the use of simple scheduling to reduce the number of operations. I. I NTRODUCTION Most of practical Maximum Distance Separable (MDS) packet erasure codes are implemented in software. In the various applications like packet erasure channels [1] or distributed storage systems [2], the coding/decoding process performs operations over finite fields. The efficiency of the implementation of these finite field operations is thus critical for these applications. To speedup this operation, [1] described an implementation of finite field multiplications which only uses simple xor operations, contrarily to classic software multiplications which are based on lookup tables (LUT). The complexity of multiplying by an element, i.e. the number of xor operations, depends on the size of the finite field and also on the element itself. This kind of complexity is studied for Maximum-Distance Separable (MDS) codes in [3]. Other work has been done to reduce redundant xor operations by applying scheduling [4]. Independently, in the context of large finite field for cryptographic applications, [5] proposed a xor-based method to perform fast hardware implementations of multiplications by transforming each element of a field into an element of a larger ring. In this polynomial ring, where the operations on polynomials are done modulo xn + 1, the multiplication by a monomial is much simpler as the modulo is just a cyclic shift. The authors identified two classes of fields based on irreducible polynomials with binary coefficients allowing to transform each field element into a ring element by adding additional ”ghost bits”. In this paper, we extend their approach to define fast software implementations of xor-based erasure codes. We propose an original method called PYRIT (PolYnomial RIng Transform) to perform operations between elements of a finite field into a bigger ring by using fast transforms between these two structures. Working in such a ring is much easier than working in a finite field. Firstly, it reduces the coding complexity by design. And secondly, it allows the use of simple scheduling to reduce the number of operations thanks to the properties of the ring structure. The next section presents the algebraic framework allowing to define the various transforms between the finite field and some subsets of the ring. Then we discuss about the choice of these transforms and their properties. We also detail the complexity analysis before introducing some scheduling results. II. A LGEBRAIC CONTEXT The algebraic context of this paper is finite fields and ring theory. More detailed presentation of this context including the proofs of the following propositions can be found in [6] or [7]. Definition 1. Let Fqw be the finite field with q w elements. Definition 2. Let Rq,n = Fq [x]/(xn − 1) denote the quotient ring of polynomials of the polynomial ring F2 [x] quotiented by the ideal generated by the polynomial xn − 1. Definition 3. Let pu1 1 (x)pu2 2 (x) . . . pur r (x) = xn − 1 be the decomposition of xn − 1 into irreducible polynomials over Fq . When n and q are relatively prime, it can be shown that u1 = u2 = . . . = un = 1 (see [7]). In other words, if q = 2, and n is odd, we simply have p1 (x)p2 (x) . . . pr (x) = xn − 1. In the rest of this document, we assume that n and q are relatively prime. Proposition 1. The ring Rq,n is equal to the direct sum of its r minimal ideals of Ai = ((xn − 1)/pi (x)) for i = 1, . . . , r. Moreover, each minimal ideal contains a unique primitive idempotent θi (x). A construction of this idempotent is given in [6], Chap. 8, Theorem 6. Since Fq [x]/(pi (x)) is isomorphic to the finite field Bi = Fqiw , where pi (x) is of degree wi , we have: Proposition 2. Rq,n is isomorphic to the following Cartesian product: Rq,n ≃ B1 ⊗ B2 ⊗ . . . Br For each i = 1, . . . , r, Ai is isomorphic to Bi . The isomorphism is: Bi → Ai (1) φi : b(x) → b(x)θi (x) and the inverse isomorphism is: φi−1 : Ai a(x) → Bi → a(αi ) (2) where αi is a root of pi (x). Let us now assume that q = 2. Let us introduce a special class of polynomials: Definition 4. The All One Polynomial (AOP) of degree w is defined as p(x) = xw + xw−1 + xw−2 + . . . + x + 1 2 The AOP of degree w is irreducible over F2 if and only if w + 1 is a prime and w generates F∗w+1 , where F∗w+1 is the multiplicative group in Fw+1 [8]. The values w + 1, such that the AOP of degree w is irreducible is the sequence A001122 in [9]. The first values of this sequence are: 3, 5, 11, 13, 19, 29, . . .. In this paper, we only consider irreducible AOP. According to Proposition 2, R2,w+1 is equal to the direct sum of its principal ideals A1 = ((xw+1 + 1)/p(x)) = (x + 1) and A2 = ((xw+1 + 1)/x + 1) = (p(x)) and R2,w+1 is isomorphic to the direct product of B1 = F2 [x]/(p(x)) = F2w and B1 = F2 [x]/(x + 1) = F2 . It can be shown that the primitive idempotent of A1 is θ1 = p(x) + 1. This idempotents is used to build the isomorphism φ1 between A1 and B1 . III. T RANSFORMS BETWEEN THE FIELD AND THE RING This section presents different transforms between the field B1 = F2w = F2 [x]/(p(x)) and the ring R2,w+1 = F2 [x]/(xw+1 + 1). A. Isomorphism transform The first transform is simply the application of the basic isomorphism between B1 and the ideal A1 of R2,w+1 (see Prop. 2). By definition of the isomorphism, we have: φ−1 1 (φ1 (u(x)).φ1 (v(x))) = u(x).v(x) So, φ1 can be used to send the elements of the field in the ring, then, to perform the multiplication, and then, to come back in the field. We show in the following Proposition that the isomorphism admits a simplified version. Let W (b(x)), the weight of b(x), defined as the number of monomials in the polynomial representation of b(x). Let us denote by φE the embedding function which simply consists in considering the element of the field as an element of the ring without any transformation. This function was initially proposed in [5]. Note that the images of the elements of B1 doesn’t necessarily belong to A1 . However, let us define the function φ̄−1 1 from R2,w+1 to A1 by φ̄−1 1 (bA (x)) = bA (α), where α is a root of p(x). This function can be seen as an extension of the function φ−1 1 to the whole ring. Proposition 4. [5] For any u(x) and v(x) in B1 , we have: φ̄−1 1 (φE (u(x)).φE (v(x))) = u(x).v(x) Proof. The embedding function corresponds to a multiplication by 1 in the ring. In fact, 1 is equal to the sum of the idempotents θi (x) of the ideals Ai , for Pil = 1, . . . , l [6, chapter 8, thm. 7]. Thus, φE (u(x)) = u(x). i=0 θi (x). Then, Pl φE (u(x)).φE (v(x)) is equal to u(x).v(x).( i=0 θi (x))2 . Thanks to the properties of idempotents, θi (x).θj (x) is equal to θi (x) if i = j andP0 else. Thus, φE (u(x)).φE (v(x)) is equal to u(x).v(x).( li=0 θi (x)). The function φ̄−1 is i the computation of the remainder modulo pi (x). The irreducible polynomial pi (x) corresponds to the ideal Ai . Thus θi (x) mod p(x) is equal to 1 if i = 1 and 0 else. This proposition proves that the Embedding function can be used to perform a multiplication in the ring instead of doing it in the field. The isomorphism also has this property, but the complexities of the transforms between the field and the ring are more complex. C. Sparse transform Let us define the transform φS from B1 to R2,w+1 : Proposition 3. φ1 (bB (x)) = bA (x) = B. Embedding transform  bB (x) bB (x) + p(x) φ−1 i (bA (x)) = bB (x) =  if W (bB (x)) is even else bA (x) bA (x) + p(x) if bw = 0 else φS (bB (x)) = bA (x) = φ1 (bB (x)) + δ.p(x) where δ = 1 if W (φ1 (bB (x)) + p(x)) < W (φ1 (bB (x))) and 0 else. Proposition 5. For any u(x) and v(x) in B1 , we have: where bw is the coefficient of the monomial of degree w of bA (x). φ̄−1 1 (φS (u(x)).φS (v(x))) = u(x).v(x) Proof: For the first point, we have φ1 (b(x)) = b(x)θ1 (x) = b(x)(p(x) + 1) = b(x)p(x) + b(x). We can observe that b(x)p(x) = 0 when W (b(x)) is even and b(x)p(x) = p(x) when W (b(x)) is odd. The first point is thus obvious. For the second point, it can be observed that, from the first point of this proposition, if an element of A1 has a coefficient bw 6= 0, then it was necessarily obtained from the second rule, i.e. by adding p(x). Then, its image into B1 can be obtained by subtracting (adding in binary) p(x). If bw = 0, then nothing has to be done to obtain bB (x). Proof. As observed in the proof of Prop. 4, φ̄−1 is just i the computation of the remainder modulo p(x). Moreover, according to the definition of φS , φS (u(x)).φS (v(x)) is equal to u(x).v(x) plus a multiple of p(x) (possibly equal to 0). Thus, the remainder of φS (u(x)).φS (v(x)) modulo p(x) is equal to u(x).v(x). This proposition shows that φS can be used to perform the multiplication in the ring. The main interest of this transform is that the weight of the image of φS is small, which reduce the complexity of the multiplication in the ring. 3 D. Parity transform Proposition 6. The ideal A1 is composed of the set of elements of R2,w+1 with even weight. Proof: We can observe from Proposition 3 that all the image of φ1 have even weight. Since the number of evenweight element of R2,w+1 is equal to the number of elements of A1 , A1 is composed of the set of elements of R2,w+1 with even weight. Let us consider the function φP , from B1 to R2,w+1 , which adds a single parity bit to the vector corresponding to the finite field element. The obtained element has an even weight (by construction), and thus, according to the previous Proposition, it belongs to A1 . Since the images by φP of two distinct elements are distinct, φP is a bijection between B1 and A1 . The inverse function, φ−1 P , consists just in removing the last coefficient of the ring element. It should be noted that φP is not an isomorphism, but just a bijection between B1 and A1 . However it will be shown in next Section that this function can be used in the context of erasure codes. IV. A PPLICATION OF TRANSFORMS In typical xor-based erasure coding systems [1], the encoding process consists in multiplying an information vector by the generator matrix. Since in software, xor are performed using machine words of l bits, l interleaved codewords are encoded in parallel. We consider a system with k input data blocks and m output parity blocks. The total number of xor of the encoding is thus defined by the generator matrix which must be as sparse as possible. First, we use a k × (k + m)-systematic generator matrix built from a k × k-identity matrix concatenated to a k × m Generalized Cauchy (GC) matrix [10]. A GC matrix generates a systematic MDS code and it contains only 1 on its first row and on its first column. Then, to improve the sparsity of the generator matrix in the ring, we use the Sparse transform φS . This has to be done only once since the ring matrix is the same for all the codewords. For the information vectors, it is not efficient to use φS since the xors of machine words do not take into account the sparsity of the xor-ed vectors. We thus use Embedding or Parity transforms, which are less complex than φ1 . When Embedding is used for information vectors and Sparse is used for the generator matrix, the obtained result in the ring can be sent into the field by using φ−1 (proof 1 similar to the proofs of Propositions 4 or 5). When Parity is used for the information vector, the image of the vector in the ring only contains elements of the ideal A1 . Since these elements are multiplied by the generator matrix (in the ring), the obtained result only contains elements of the ideal A1 . These elements have even weight, so it is not necessary to keep the parity bit before sending them on the ”erasure channel”. Since Parity transform is not an isomorphism, these data can not be decoded by another method. Indeed, to decode, it is necessary to apply φP (add the parity bit), then to decode by multiplying by the inverse matrix, and then to to apply φ−1 P (remove the parity bit on the correct information vector). V. C OMPLEXITY ANALYSIS In this section, we determine the total number of xor operations done in the coding and the decoding processes. A. Coding complexity The coding process is composed of three phases: the field to ring transform, the matrix vector multiplication and the ring to field transform. We assume that the information vector is a vector of k elements of the field F2w . For the first and the third phases, Table I gives the complexities of Embedding and Parity transforms obtained from their definition in Section III. Embedding Parity bits field to ring 0 k.w TABLE I ring to field m.w 0 N UMBER OF XOR FOR E MBEDDING AND PARITY TRANSFORMS The choice between the two methods thus depends on the values of the parameters: if k > m, Parity transform has lower complexity. Else, ”Embedding” complexity is better. For the matrix vector operation, let us first consider the multiplication of two ring elements. As explained in the previous section, the first element (which corresponds to an information symbol) is managed by the software implementation by machine words. So the complexity of the multiplication only depends on the weight of the second element, denoted by w2 ∈ {0, 1, . . . , w + 1}. The complexity of this multiplication is thus (w + 1).w2 . Now, we can consider the specificities of the various transforms. In the Parity transform, the last bit of the parity blocks is not used ( i.e. it is not transmitted on the erasure channel). So it is not necessary to compute it. It follows that the complexity of the multiplication is only w.w2 . Similarly, for the Embedding transform, the last bit of the input vector is always equal to 0. So, we also have a complexity equal to w.w2 . To have an average number of operations done in the multiplication of the generator matrix by the input data blocks, we have to evaluate the average weight of the entries of the generator matrix in the ring. The generator matrix is a k × m-GC matrix with the first column and the first row are filled by 1. The other elements can be considered as random non zero elements. They are generated by φS which chooses the lowest ring element among the two ones corresponding to the field element. Let us denote their average weight by wφS . For this case, the average number of xors is thus: (k + m − 1).w + (k − 1).(m − 1).w.wφS This leads to the following general expression of the coding complexity: (min(k, m) + k + m − 1).w + (k − 1).(m − 1).w.wφS 4 To estimate the complexity on a practical example, we fix the value of w to 4. Classic combinatorial evaluation (not presented here) gives the average weight for nonzeros images of φS :   w+1  w w  . 2 − wφS = w+1 2 −2 w/2 So, wφS = 1.66. We plot in Figure 1 the evolution of the factor over optimal (used e.g. in [2], table III) which is the density of the matrix normalized by the minimal density, k.m.w. We vary the value of k for three values of m: 3, 5 and 7. For each pair (k, m), we generate 10000 random GC matrices and keep the best we found. factor over optimal 1.8 VI. S CHEDULING factor 1.6 1.4 1.2 1 multiplication. We first invert the sub-matrix in the field, then we transform each entry of this matrix into ring elements. Then, we perform the ring multiplication. The complexity of the decoding thus depends on the complexity of the matrix inversion and on the complexity of the matrix vector multiplication. The complexity of the matrix vector multiplication was studied in the previous paragraph. The complexity of the a r × r-matrix inversion is generally in O(r3 ) operations in the field. But if the matrix has a Cauchy structure, this complexity can be reduced to O(r2 ) [1]. Note that, contrarily to the matrix vector multiplication, the matrix inversion complexity does not depend on the size of the source and parity blocks. And thus, it becomes negligible when the size of the blocks increase. 2 4 m=3 best m=3 6 8 k m=5 best m=5 10 12 14 m=7 best m=7 Fig. 1. Factor over optimal depending on m We can observe that the values are very low. For example, [2] gives the lowest density of Cauchy matrices for the field F24 and we can observe that our values are always lower than these ones. To reduce the complexity in specific cases, we can observe that the ring contains w elements whose the corresponding matrix is optimal (one diagonal). By using these elements, we can search by brute force MDS matrices built only with these optimal elements. For example, let us consider the elements of the field F24 sent into the ring R2,5 . The Vandermonde matrix defined by:  V = xi.j i=0,...,4;j=0,...,4 where x is a monomial in R2,5 has the minimal number of 1. It can be verified that this matrix can be used to build a systematic a MDS code. For this matrix, the total number of xors done in the generation of the parity packets (including the field-to-ring and ring-to-field transforms) is (min(k, m)+k+m−1).w+(k−1).(m−1).w = k.w+k.m.w Its factor over optimal is equal to 1.2 which is lower than the values given in Figure 1 and which is close to the lowest bound given in [3]. B. Decoding complexity As the decoding is a matrix inversion and a matrix vector multiplication, we can use the same approach to perform the An interesting optimization on MDS erasure codes under xor-based representation is the scheduling of xor operations. Such techniques are proposed in [11], [12], [2] and [13]. The general principle consists in ”factorizing” some xor operations which are done several times to generate the parity blocks. We show in the two next paragraphs that these techniques can be used very efficiently on the ring elements. However, it can be observed that the matrices defined over rings have two main advantages. A. Complexity reduction Over finite fields, the scheduling consists in searching common patterns on the binary representation of the generator matrices. The w × w-matrices representing the multiplication by the field elements does not have particular structure and thus, they must be entirely considered in the scheduling algorithm. This is not the case for the (w + 1) × (w + 1)-matrices corresponding to a ring element because, thanks to the form of the polynomial xw+1 + 1, they are composed of diagonals either full of 0 or 1. This means that they can be represented in the scheduling algorithm just by their first column or, equivalently, by the ring polynomial. This allows to drastically reduce the algorithm complexity and thus to handle bigger matrices. From a polynomial point of view, the search of scheduling just consist in finding some common patterns in the equations generating the parity blocks. Example . Let us assume that n = 5 and that three data polynomials a0 (x), a1 (x) and a2 (x) are combined to generate the three parities p0 (x) = (1 + x4 )a0 (x) + x2 a1 (x) + x3 a2 (x), p1 (x) = a0 (x) + x3 a1 (x) + (1 + x3 )a2 (x) and p2 (x) = a0 (x) + a1 (x) + x3 a2 (x). In this case, the scheduling just consists in computing p′ (x) = a0 (x) + x3 a2 (x) and then p0 (x) = p′ (x) + x4 a0 (x) + x2 a1 (x), p1 (x) = p′ (x) + x3 a1 (x) + a2 (x) and p2 = p′ (x) + a2 (x). To estimate the complexity, we can consider the number of sums of polynomials. Without scheduling, we need 11 sums 5 (4 for p0 (x), 4 for p1 (x), and 3 for p2 (x)) instead of with scheduling, we only need 10 sums (2 for p′ (x), 3 for p0 (x), 3 for p1 (x) and 2 for p2 (x)).  B. Additional patterns Ring-based matrices allow to find more common patterns than field-based matrices. The main idea is to observe that, in the ring, we can ”factorize” not only common operations, but also operations which are multiple by a monomial (i. e. cyclic-shift) of operations done in some other equations. This is possible only because the multiplications are done modulo xw+1 + 1. Example . Let us assume that n = 5 and that three data polynomials a0 (x), a1 (x) and a2 (x) are combined to generate the parities p0 (x) = a0 (x) + x2 a1 (x) + (1 + x2 )a2 (x), p1 (x) = x2 a0 (x) + x3 a1 (x) + (x + x4 )a2 (x) and p2 (x) = x2 a0 (x) + a1 (x) + (x2 + x3 )a2 (x). We can observe that, with a ”simple” scheduling, it is not possible to factorize some operations. However, by rewriting the polynomials, we can reveal factorizations: p1 (x) = x2 a0 (x) + x(x2 a1 (x) + a2 (x)) + x4 a2 (x) and p2 (x) = x2 a0 (x) + x3 (x2 a1 (x) + a2 (x)) + x2 a2 (x). So, if p′ (x) = x2 a1 (x) + a2 (x), we have p0 (x) = p′ (x) + a0 (x) + x2 a2 (x), p1 (x) = xp′ (x) + x2 a0 (x) + x2 a2 (x) and p2 (x) = x3 p′ (x) + x2 a0 (x) + x2 a2 (x). To estimate the complexity by the same method than in the previous example, we need 11 polynomial additions with scheduling compared to 12 additions necessary without scheduling.  C. Scheduling results To evaluate the potential gain of the scheduling, we have implemented an exhaustive search of the best patterns on generator matrices. This algorithm was applied on several codes for the field F24 . Table II presents the results in term of ”factor over optimal” which is defined as the total number of 1 in the matrix over the number of 1 for the optimal MDS matrix , i.e k.m.w. When working in a ring, we include to the complexity the operations needed to apply the transforms. In this case, Embedding transform has a lower complexity. So we added m.w to the number of 1 in the matrix resulting from the scheduling algorithm. For each case, we have generated 100 random Generalized Cauchy matrices. The measured parameters are: • average field matrix: average number of 1 in the GC matrices divided by k.m.w • best field matrix: lowest number of 1 among the GC matrices divided by k.m.w • average ring matrix: average number of 1 in the ring matrices (without scheduling) + ring-field correspondence divided by k.m.w • best ring matrix: best number of 1 among the ring matrices (without scheduling) + ring-field correspondence divided by k.m.w • • average with scheduling: average number of xors with scheduling + ring-field correspondence divided by k.m.w best with scheduling: best number of xors with scheduling + ring-field correspondence divided by k.m.w k+m,k average field matrix best field matrix average ring matrix best ring matrix average with scheduling best with scheduling TABLE II 12,8 1.79 1.73 1.59 1.5 1.32 1.19 FACTOR OVER OPTIMAL FOR 16,10 1.90 1.85 1.63 1.58 1.26 1.20 w=4 This table confirms that, even without scheduling, ring matrices have a lower density than field matrices, thanks to the Sparse transform. Applying scheduling to these matrices allows a significant gain of complexity. Indeed, it reduces the complexity by more than 20% on the best matrices. The final results are similar to the results obtained (without scheduling) on the optimal matrix in Section V-A. To the best of our knowledge, other scheduling approaches do not reach this level of sparsity for these parameters. VII. C ONCLUSION In this paper, we have presented a new method to build MDS erasure codes with low complexity. By using transforms between a finite field and a polynomial ring, sparse generator matrices can be obtained. This allows to significantly reduce the complexity of the matrix vector multiplication. It also allows simple schedulers that drastically improve the complexity by reducing the number of operations. Similar results can be obtained with Equally-Spaced Polynomials (ESP) [5], but they are not presented here due to lack of space. R EFERENCES [1] J. Bloemer, M. Kalfane, M. Karpinski, R. Karp, M. Luby, and D. Zuckerman, “An XOR-Based Erasure-Resilient Coding Scheme,” in Technical Report ICSI TR-95-048, August 1995. [2] J. S. Plank, “Xor’s, lower bounds and mds codes for storage,” in 2011 IEEE Information Theory Workshop, Oct 2011, pp. 503–507. [3] M. Blaum and R. M. Roth, “On lowest density MDS codes,” IEEE Trans. Information Theory, vol. 45, no. 1, pp. 46–59, 1999. [4] J. Luo, M. Shrestha, L. Xu, and J. S. Plank, “Efficient encoding schedules for xor-based erasure codes,” IEEE Transactions on Computers, vol. 63, no. 9, pp. 2259–2272, Sept 2014. [5] T. Itoh and S. Tsujii, “Structure of parallel multipliers for a class of fields gf (2m ),” Information and Computation, vol. 83, no. 1, pp. 21 – 40, 1989. [6] F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes. North-Holland, 1977. [7] A. Poli and L. Huguet, Error correcting codes: theory and applications. Prentice Hall, 1992. [Online]. Available: https://books.google.fr/books?id=cuxQAAAAMAAJ [8] P. Wah and M. Wang, “Realization and application of the massey-omura lock,” in Proceedings, International Zurich Seminar, 1984, pp. 175–185. [9] N. J. A. Sloane, “A001122 sequence,” in https://oeis.org/A001122. [10] R. M. Roth and G. Seroussi, “On generator matrices of mds codes (corresp.),” IEEE Transactions on Information Theory, vol. 31, no. 6, pp. 826–830, November 1985. [11] J. L. Hafner, V. Deenadhayalan, K. K. Rao, and J. A. Tomlin, “Matrix methods for lost data reconstruction in erasure codes,” in Proceedings of the 4th USENIX Conf. on File and Storage Technologies - Volume 4, ser. FAST’05. 6 [12] C. Huang, J. Li, and M. Chen, “On optimizing xor-based codes for faulttolerant storage applications,” in Information Theory Workshop, 2007. ITW ’07. IEEE, Sept 2007, pp. 218–223. [13] J. S. Plank, C. D. Schuman, and B. D. Robison, “Heuristics for optimizing matrix-based erasure codes for fault-tolerant storage systems,” 2012, pp. 1–12.
7cs.IT
NON-NUDGABLE SUBGROUPS OF PERMUTATIONS arXiv:1706.06929v2 [math.CO] 17 Jul 2017 TIM NETZER Abstract. Motivated by a problem from behavioral economics, we study subgroups of permutation groups that have a certain strong symmetry. Given a fixed permutation, consider the set of all permutations with disjoint inversion sets. The group is called non-nudgable, if the cardinality of this set always remains the same when replacing the initial permutation with its inverse. It is called nudgable otherwise. We show that all full permutation groups, standard dihedral groups, half of the alternating groups, and any abelian subgroup are non-nudgable. In the right probabilistic sense, it is thus quite likely that a randomly generated subgroup is non-nudgable. However, the other half of the alternating groups are nudgable. We also construct a smallest possible nudgable group, a 6-element subgroup of the permutation group on 4 elements. 1. Introduction Let X be a finite set, whose elements represent certain alternatives that an individual may choose from. A total linear order on X then represents the preferences of an individual as to the given alternatives. Let O(X ) be the set of all total orders on X . Certain decisions processes from behavioral economics are modeled in this setup, see for example [3, 5]. Assume the real preferences of an individual are not known, only a subset G ⊆ O(X ) of possible preferences is revealed. Certain mechanisms may prompt the individual to behave like it has a certain preference from this set (although it is maybe not the real preference). Such methods are often subsumed under the notion of nudging [6]. When designing such a mechanism, it might be interesting to see how far from the real preference it makes the individual deviate. Or, when deciding between two possible mechanisms, one would like to see which one will make the individual deviate less from his real preference. So we would like to compare certain orders to each other, and in particular ask whether one order is closer to a first than to a second one. For this let π1 , π2 , π ∈ G and say that π is closer to π1 than to π2 , if whenever π1 and π2 order two alternatives differently, then π orders them just as π1 does. As a formula, where orders are understood as binary relations on X , this means π1 \ π2 ⊆ π. In this way we obtain two sets, namely the set C1 of orders from G that are closer to π1 than to π2 , and the set C2 of those orders that are closer to π2 than to π1 . Note that not every order necessarily belongs to either C1 or C2 . The size of C1 compared to the size of The author thanks Nick Netzer for bringing up the main question of this article, and both Steffen Kionke and Nick Netzer for inspiring discussions on the topic. 1 2 TIM NETZER C2 shows the probability that π1 will inforce less deviations from the real preference than π2 . It has been observed in [3] that in many cases the two sets C1 and C2 are of the same cardinality, meaning that no mechanism is predominant in pairwise comparison. This happens for many of the relevant models from the literature, see for example [3] and the references therein. Since the question is well-motivated from the economical applications, it clearly asks for a systematic mathematical treatment. It can be formulated in terms of permutation groups and inversions, which we will explain in the following. Our main section then proves several results on whether subgroups of permutation groups fulfill this property of non-nudgability. Among them are all full permutation groups, half of the alternating groups, all standard dihedral groups and all abelian subgroups. But there are also groups which are nudgable, for example the other half of all alternating groups. The smallest example of a nudgable group is a 6-element subgroup of S4 . In a suitable formulation, a randomly generated subgroup of Sn is more likely to be non-nudgable than nudgable, if n is large. 2. Preliminaries Let us first translate the initial problem from the introduction into a question about subgroups of permutations groups. For a general background on permutation groups we recommend [2, 4] or any other introductory text to algebra. Assume without loss of generality X = {1, . . . , n}. Then the set O(X ) of total orders on X can be identified with the permutation group Sn ; we will identify the total order i1 < i2 < . . . < in with the permutation   1 2 ··· n π= , i1 i2 · · · in i.e. π maps j to ij . Any subset G ⊆ O(X ) then becomes a subset G ⊆ Sn . In most of the applications, the set G will even be a subgroup (see for example [3] and the references therein). Since this assumption is natural from a mathematical point of view as well, we will restrict to subgroups from now in. Now let π1 , π2 , π ∈ O(X ) and consider the condition π1 \ π2 ⊆ π. It means i <π 1 j ∧ j <π 2 i ⇒ i <π j or, in the language of permutations, π1−1 (i) < π1−1 (j) ∧ π2−1 (j) < π2−1 (i) ⇒ π −1 (i) < π −1 (j). By setting k = π1−1 (i) and l := π1−1 (j) this becomes (1) k<l ∧ π2−1 (π1 (l)) < π2−1 (π1 (k)) ⇒ π −1 (π1 (k)) < π −1 (π1 (l)). Now recall the notion of an inversion of a permutation σ. It is a pair whose order is reversed by σ: inv(σ) := {(i, j) | 1 ≤ i < j ≤ n, σ(j) < σ(i)} . Now equation (1) becomes inv(π2−1 π1 ) ∩ inv(π −1 π1 ) = ∅. NON-NUDGABLE SUBGROUPS OF PERMUTATIONS 3 With this formulation we define the sets C1 , C2 from above as follows:  C1 = π ∈ G | inv(π2−1 π1 ) ∩ inv(π −1 π1 ) = ∅ and  C2 = π ∈ G | inv(π1−1 π2 ) ∩ inv(π −1 π2 ) = ∅ . Now finally note that π1−1 π2 is the inverse of π2−1 π1 , and with π running through the full subgroup G, so do π −1 π1 and π −1 π2 . So we set DG (π) := {σ ∈ G | inv(σ) ∩ inv(π) = ∅} and define: Definition 2.1. A subgroup G ⊆ Sn is called non-nudgable if for all π ∈ G we have |DG (π)| = |DG (π −1 )|. Otherwise G is called nudgable. 3. Main Results Our first result is a straightforward observation, but will already cover a large class of groups. For this let   1 2 ··· n ω0 = ∈ Sn n n − 1 ··· 1 denote the permutation that has all ordered pairs as inversions. Theorem 3.1. If G ⊆ Sn is a subgroup that contains ω0 , then G is non-nudgable. Proof. We prove that for σ ∈ DG (π) we have ω0 σπ −1 ∈ DG (π −1 ). Then clearly the mapping DG (π) → DG (π −1 ) σ 7→ ω0 σπ −1 is a bijection. Since multiplying with ω0 from the left just exchanges inversions and noninversions, it remains to prove that inv(π −1 ) ⊆ inv(σπ −1 ). But this is clear, since (i, j) ∈ inv(π −1 ) just means (π −1 (j), π −1 (i)) ∈ inv(π), and thus (π −1 (j), π −1 (i)) ∈ / inv(σ).  Corollary 3.2. The following subgroups of Sn are non-nudgable: (i) The full group Sn . (ii) The alternating group An if ⌊ n2 ⌋ is even. (iii) The dihedral group Dn , generated by ω0 and the cycle (12 · · · n). Proposition 3.3. If n ≥ 6 and ⌊ n2 ⌋ is odd, then An is nudgable. 4 TIM NETZER Proof. Consider the permutation  1 2 3 ··· π= n n − 1 n − 2 ··· n−5 n−4 n−3 n−2 n−1 n 6 5 3 1 4 2  . The only ordered pairs that are not inversions of π are (n − 3, n − 1), (n − 2, n − 1), (n − 2, n). From this we see that π belongs to An precisely in the cases considered here. It is now also not hard to explicitly compute DAn (π) = {id, (n − 2, n, n − 1), (n − 3, n − 2, n − 1)} . On the other hand, the only ordered pairs that are not inversions of π −1 are (1, 2), (1, 4), (3, 4). From this we compute DAn (π −1 ) = {id, (12)(34)} . So |DAn (π)| = 3 > 2 = |DAn (π −1 )|.  For our next result we will need the following straightforward observations: inv(π −1 ) = π inv(π) inv(σπ) = inv(π) △ π −1 inv(σ) where △ denotes the symmetric difference. Here we use the notation σ inv(π) for the set we obtain by applying σ to both entries of each (i, j) from inv(π), and permute (if necessary) to make the first entry smaller than the second one. Theorem 3.4. Any abelian subgroup G ⊆ Sn is non-nudgable. Proof. We claim that σ ∈ DG (π) implies σ −1 ∈ DG (π −1 ), which will prove the claim. By definition, σ ∈ DG (π) means inv(σ) ∩ inv(π) = ∅, which implies ∅ = σ inv(σ) ∩ σ inv(π) = inv(σ −1 ) ∩ σ inv(π). From this we obtain inv(πσ −1 ) = inv(σ −1 ) △ σ inv(π) = inv(σ −1 ) ∪˙ σ inv(π). On the other hand, by commutativity, we obtain inv(πσ −1 ) = inv(σ −1 π) = inv(π) △ π −1 inv(σ −1 ). Now note that inv(π) and σ inv(π) have the same cardinality, and similar with π −1 inv(σ −1 ) and inv(σ −1 ). We conclude inv(π) ∩ π −1 inv(σ −1 ) = ∅, and so ∅ = π inv(π) ∩ inv(σ −1 ) = inv(π −1 ) ∩ inv(σ −1 ), which means σ −1 ∈ DG (π −1 ).  Example 3.5. The groups A2 , A3 are non-nudgable, since they are abelian. Thus we have fully classified nudgability of alternating groups. NON-NUDGABLE SUBGROUPS OF PERMUTATIONS 5 Before we give a list of more examples, we note how new non-nudgable subgroups can be constructed from known ones. The case of a product Sn1 × · · · × Snr is one of the important cases in [3]. Proposition 3.6. For n = n1 + · · · + nr decompose {1, . . . , n} = {1, . . . , n1 } ∪ {n1 + 1, . . . , n1 + n2 } ∪ · · · and embed Sn1 × · · · × Snr into Sn by letting Sni permute the numbers in the i-th subset. If Gi ⊆ Sni are non-nudgable subgroups, then so is G1 × · · · × Gr ⊆ Sn . Proof. This is clear, since for π = (π1 , . . . , πr ) ∈ G := G1 × · · · × Gr we have π −1 = (π1−1 , . . . , πr−1 ) and DG (π) = DG1 (π1 ) × · · · × DGr (πr ).  Remark 3.7. In Theorem 3.1, the condition ω0 ∈ G can clearly be weakened to the existence of some permutation τ ∈ G, whose inversion set contains all other inversions sets of group elements. However, we where not able to produce an example of such a group, which does not arise as a product (as in Proposition 3.6) of groups to which Theorem 3.1 applies directly. However, one can even weaken the condition to the following one: (2) ∀π ∈ G ∃τ ∈ G ∀σ ∈ DG (π) : In this case, a bijection from DG (π) to DG (π −1 ) σ inv(π) ⊆ inv(τ ). is given by σ 7→ τ σπ −1 , as is proven similar to the proof of Theorem 3.1. One example of such a group, which is not covered by any of the other results, is given in Example 3.8 (iv) below. Now let us give more explicit examples: Example 3.8. (i) Any subgroup of S1 , S2 and S3 is non-nudgable. In fact all nontrivial subgroups are abelian, so Corollary 3.2 and Theorem 3.4 apply. (ii) Proposition 3.6 does not hold for ”non-diagonal” embeddings. For n ≥ 4 we embedd Sn−1 into Sn by fixing 2. This leads to a nudgable subgroup G. For the element   1 2 3 4 ··· n − 3 n − 2 n − 1 n π= n 2 n − 1 n − 2 ··· 5 4 1 3 one computes, in a similar fashion as in Proposition 3.3: |DG (π)| = 2 > 1 = |DG (π −1 )|. For n = 4 we obtain a 6-element subgroup of S4 that is nudgable. Since all smaller subgroups are abelian, this is the smallest possible example of a nudgable subgroup. (iii) The group G ⊆ S5 generated by (12)(34) and (15)(23) hat 10 elements, is non-abelian, and does not contain an element with largest inversion set. So none of the above main results apply. However, condition (2) from Remark 3.7 is fulfilled, and G is thus nonnudgable. This can easily be verifed. 6 TIM NETZER Remark 3.9. If a subgroup G ⊆ Sn is generated by one permutation, it is abelian and thus non-nudgable by Theorem 3.4. If two permutations are chosen independently uniformly at random, the probability that they generate Sn goes to 3/4 for n → ∞. The probability that either Sn or An is generated even goes to 1. These are the main results of [1]. So the probability that a randomly generated subgroup of Sn is non-nudgable goes to at least 3/4 for n → ∞. References [1] [2] [3] [4] [5] J.D. Dixon, The Probability of Generating the Symmetric Group. Math. Z. 110, 199–205 (1969). J. D. Dixon and B. Mortimer, Permutation Groups, Springer Graduate Texts in Mathematics 163 (1996). N. Netzer and J.-M. Benkert, Informational Requirements of Nudging, Preprint. J. J. Rotman, A First Course in Abstract Algebra, Prentice Hall, Inc., Upper Saddle River, NJ (1996). A. Rubinstein and Y. Salant, Eliciting Welfare Preferences from Behavioural Data Sets, Review of Economic Studies 79, 375–387 (2012). [6] R. Thaler and C. Sunstein, Nudge: Improving Decisions About Health, Wealth and Happiness. Yale University Press (2008).
4math.GR
EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY ILYA SMIRNOV arXiv:1608.07600v2 [math.AC] 16 Apr 2017 Dedicated to Craig Huneke on the Occasion of his 65th Birthday. Abstract. This paper develops a theory of equimultiplicity for Hilbert-Kunz multiplicity and applies it to study the behavior of Hilbert-Kunz multiplicity on the Brenner-Monsky hypersurface. A number of applications follows, in particular we show that Hilbert-Kunz multiplicity attains infinitely many values and that equimultiple strata may not be locally closed. 1. Introduction Hilbert-Samuel multiplicity is a classical invariant of a local ring that generalizes the notion of the multiplicity of a curve at a point. The multiplicity may be regarded as a measure of singularity, where the lowest possible value, 1, corresponds to a smooth point. In study of singularities, we are naturally led to study equimultiple points, i.e., a point such that the Hilbert-Samuel multiplicity is constant on the subvariety defined as the closure of the point. For example, it can be considered as the weakest form of equisingularity, where we would say that two points are equally singular if the multiplicities are equal. This notion has been studied extensively, partially due to its appearance in Hironaka’s work on the resolution of singularities in characteristic zero. In 1983 Monsky defined a new version of multiplicity, specific for positive characteristic. It was called Hilbert-Kunz multiplicity, in honor of Ernst Kunz who in 1969 initiated the study of positive characteristic numerical invariants ([14, 15]). If we use λ to denote the length of an artinian module, the Hilbert-Kunz multiplicity of a local ring (R, m) of characteristic p can be defined by the limit 1 n eHK (R) = lim n dim R λ(R/m[p ] ), n→∞ p n n n where we denoted the ideal of p -powers, (xp | x ∈ m), by m[p ] . This is invariant is still largely mysterious, and there is a lot to understand. The purpose of this work is to build an equimultiplicity theory for Hilbert-Kunz multiplicity and to see what properties of the usual multiplicity are preserved. As a tool to study singularities, Hilbert-Kunz multiplicity shares some properties with the classical multiplicity, but often has a more complicated behavior. While the Hilbert-Samuel multiplicity of a local ring is always an integer, the Hilbert-Kunz multiplicity is not. However, this also allows us to think about Hilbert-Kunz multiplicity as a finer invariant. Just like the usual multiplicity, it detects regular rings (Watanabe and Yoshida, [30]); but it is also meaningful to consider rings of Hilbert-Kunz multiplicity sufficiently close to 1, and expect that their singularities should get better. Blickle and Enescu ([6] and its improvement [1] by Aberbach and Enescu) showed that rings with sufficiently small Hilbert-Kunz multiplicity are Gorenstein and F-regular. These results show that Hilbert-Kunz multiplicity is a measure of singularity, and the next natural step is to study is geometric properties, with a view towards a possible use for the resolution of singularities. For a possible list of desired properties let me quote Lipman’s featured review Date: March 28, 2018. 2010 Mathematics Subject Classification. 13D40, 13A35, 13H15, 14B05. Key words and phrases. Hilbert-Kunz multiplicity, tight closure, equimultiplicity. 1 2 ILYA SMIRNOV (([4, pp. B28-B33]) of the celebrated paper of Bierstone and Milman ([5]): “In the early 1980’s, Abhyankar announced a “canonical desingularization” procedure ([3]). His fundamental idea was, very roughly, to construct a desingularization as a succession of blowups, specifying at every point of each variety appearing in the process a function, the “resolution invariant,” which is locally invariant in the sense of compatibility with open immersions, which depends on the preceding history of the process, which takes a finite number of values in a totally ordered set, and whose maximum value locus is a smooth subvariety, upon blowing up which one lowers the said maximum value, thereby “improving the worst singularities”. Eventually, by finiteness, the resolution invariant can no longer decrease – so it is constant everywhere and then the original variety has been transformed into a smooth one.” Previously, the author showed that Hilbert-Kunz multiplicity is upper semi-continuous ([27]); essentially this ensures that the maximum value locus is a subvariety. Following the aforementioned review of Lipman and the resolution of Bierstone and Milman ([5]), we may ask whether Hilbert-Kunz multiplicity satisfies the stronger condition of Zariski-semicontinuity: thus HilbertKunz multiplicity on a fixed variety should attain only finitely many values. As observed in [5, Lemma 3.10], Zariski-semicontinuity can be restated as openness for all a of the sets X≤a = {p ∈ Spec(R) | eHK (p) ≤ a}. After using Nagata’s criterion for openness, this will require us to prove that for some s ∈ / p we can make the Hilbert-Kunz multiplicity to be constant on V (p) ∩ D(s), or, as it fits to say, make p equimultiple by inverting an element. In order to do so, we first need to understand what ideals will satisfy this version of equimultiplicity and the goal of this paper is to build such understanding. 1.1. Overview of the results. Before proceeding to our results, let us quickly review the classical picture. The analytic spread of an ideal I, ℓ(I), is defined as the Krull dimension of the fiber cone F (I) = R/m ⊕ I/mI ⊕ I 2 /mI 2 ⊕ · · · . The analytic spread plays an important role in the classical Hilbert-Samuel theory, because it determines the size of a minimal reduction, i.e., the number of general elements in I needed to generate I up to integral closure. Let us denote the set of all prime ideals P ⊇ I such that dim R/P = dim R/I by Minh(I), and recall the classical characterization of equimultiple ideals ([24, 17]). Theorem 1.1. Let (R, m, k) be a formally equidimensional local ring. For an ideal I in R the following conditions are equivalent: (a) ℓ(I) = ht(I), (b) for every (equivalently, some) parameter ideal J modulo I X e(I + J) = e(J, R/P ) e(I, RP ), P ∈Minh(I) (c) if k is infinite, there is a system of parameter J = (x1 , . . . , xr ) modulo I which is a part of a system of parametersP in R, and such that • if r < dim R then P ∈Minh(I) e(J, R/P ) e(IRP ) = e(IR/J) P • if r = dim R then P ∈Minh(I) e(J, R/P ) e(IRP ) = e(J), (d) for every (equivalently, some) system of parameters (x1 , . . . , xr ) modulo I, all 0 ≤ i < r, and all n xi+1 is regular modulo (I, x1 , . . . , xi )n . An ideal that satisfies any of these equivalent condition is called equimultiple. This name originates from the special case when I = p is a prime ideal such that R/p is regular. In this case the condition (b) shows that e(m) = e(p). EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 3 In this paper we develop a theory of Hilbert-Kunz equimultiple ideals. Again, if I = p is prime and R/p is regular, then p is Hilbert-Kunz equimultiple if and only if eHK (m) = eHK (p). The obtained characterization is very similar: we replace powers and integral closure with Frobenius powers and tight closure. The most important difference is that an analogue of part (a) is missing because we are not able to find a satisfactory replacement for analytic spread. Our findings are collected in the following theorem (Theorem 5.17, Corollaries 5.26 and 5.34). Theorem 1.2. Let (R, m) be a local ring of positive characteristic p > 0. Furthermore suppose that R is either formally unmixed with a locally stable test element c or is a excellent and equidimensional (e.g., a complete domain). For an ideal I the following conditions are equivalent: (b) for every (equivalently, some) parameter ideal J modulo I X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ), P ∈Minh(I) (c) there is a system of parameter J = (x1 , . . . , xr ) modulo I which is a part of a system of parameters in R, and such P that • if r < dim R then P ∈Minh(I) eHK (J, R/P ) eHK (IRP ) = eHK (IR/J) P • if r = dim R then P ∈Minh(I) eHK (J, R/P ) eHK (IRP ) = eHK (J), (d) for every (equivalently, some) system of parameters (x1 , . . . , xr ) modulo I, all 0 ≤ i < r, and all n xi+1 is regular modulo ((I, x1 , . . . , xi )[q] )∗ . The main consequence of this characterization is a surprising negative answer (Corollary 6.10): Hilbert-Kunz multiplicity is not Zariski-semicontinuous in sense of [5]. Corollary 1.3. Let R = F [x, y, z, t]/(z 4 + xyz 2 + (x3 + y 3)z + tx2 y 2), where F is the algebraic closure of Z/2Z. Then the set X≤3 = {p ∈ Spec(R) | eHK (p) ≤ 3} is not open. This readily implies that Hilbert-Kunz multiplicity attains infinitely many values (Corollary 6.11) on the Brenner-Monsky hypersurface z 4 + xyz 2 + (x3 + y 3 )z + tx2 y 2 = 0. This hypersurface was previously used by Brenner and Monsky to provide a counter-example to the notorious localization problem in tight closure theory ([8]). In order to understand the Brenner-Monsky counter-example better and compare it to the results of [12], Dinh have studied the associated primes of the Frobenius powers of the prime ideal P = (x, y, z) defining the singular locus of the aforementioned hypersurface. Using the calculations S [q] that Monsky made to obtain Theorem 6.8, Dinh ([9]) proved that q Ass(P ) is infinite. However, he was only able to show that the maximal ideals corresponding to the irreducible factors of 1 + t + t2 + . . . + tq appear as associated primes, while our methods immediately give all associated primes of the Frobenius powers and their tight closures. Proposition 1.4. In the Brenner-Monsky example, [ [ Ass(P [q] )∗ = Ass(P [q] ) = Spec(R/P) . q q In particular, the set is infinite. Our applications demonstrate that in Hilbert-Kunz theory equimultiplicity is a far more restrictive condition than equimultiplicity in Hilbert-Samuel theory. This fits well with our understanding 4 ILYA SMIRNOV of Hilbert-Kunz multiplicity as a finer invariant; when there are many more possible values it is less likely for the values at two points to coincide. The presented applications were obtained in the Brenner-Monsky hypersurface because we used on Monsky’s computations in [22]. Potentially the theory can applied to any other example where the Hilbert-Kunz multiplicity was computed in a family (e.g., [21]); we chose the simplest and the most understood family. It is also worth to highlight a very surprising corollary (Corollary 5.19) obtained by combining Theorem 1.2 with Proposition 3.1 that gives a criterion for equality of the entire Hilbert-Kunz functions of p and m. Corollary 1.5. Let (R, m) be a weakly F-regular excellent local domain and let p be a prime ideal such that R/p is regular. Then eHK (m) = eHK (p) if and only if the entire Hilbert-Kunz functions (not just the limits!) of R and Rp coincide. Last, I want to remark that the presented theory has recently found an application in Linquan Ma’s breakthrough on Lech’s conjecture ([18]). As a key ingredient of his proof, Ma showed that perfect ideals are Hilbert-Kunz equimultiple. 1.2. The structure of the paper. The absence of reductions and analytic spread required us to develop new tools. The uniform convergence methods provide a crucial tool for our proof, Corollary 4.11, and we use Tucker’s ideas from [29] to develop Section 4. Corollary 4.11 is interesting on its own right and will be useful in a variety of situations (such as Ma’s recent work in [18]). We use this tool in Section 5, where we build the bulk of the Hilbert-Kunz equimultiplicity theory, resulting in Theorem 5.17 and its corollaries. Perhaps the most challenging part of the proof is an analogue of the equivalence between (b) to (d) of Theorem 1.1, which we achieve in Theorems 5.9, 5.11. Later in the section we study the general behavior of Hilbert-Kunz equimultiplicity under ring operations in order to relax some of the assumptions of the aforementioned theorems. We also investigate the equivalence between “some” and “every” in that analogue of part (d) under milder assumptions (Corollary 5.27). In the end of the section, we study the behavior of Hilbert-Kunz equimultiplicity under localization and specialization: Proposition 5.28 shows that the property is preserved under localization, and Corollary 5.29 provides a Bertini-type result. These results are used to establish, in Corollary 5.34, the condition (c) of Theorem 1.2. In Section 6, we will use the machinery we have constructed to study the Brenner-Monsky hypersurface and obtain a number of interesting results. This hypersurface was previously used by Brenner and Monsky to provide a counter-example to the notorious localization problem in tight closure theory ([8]). As the first step, in Corollary 6.6 we will establish equivalence between equimultiplicity of prime ideal p of dimension one and p-primary property of the tight closures (p[q] )∗ . Then we use the previously mentioned results on specialization (Corollaries 5.31, 5.32) in Proposition 6.9, where we derive from Monsky’s computations in [22] that any point on the curve defining the singular locus has Hilbert-Kunz multiplicity greater than the generic point. This implies that the Hilbert-Kunz multiplicity attains infinitely many values on the curve. Hence, the stratification by Hilbert-Kunz equimultiple strata need not be finite (Corollary 6.11). Also, in Corollary 6.10, we will show that an individual stratum need not be locally closed and the set X≤a need not be open. As a second application of our methods, in Proposition 6.12 we easily compute the set of all associated primes of the Frobenius powers (or tight closures of the Frobenius powers) for the defining ideal of the previously mentioned curve. This improves a result of Dinh ([9]) who showed that the set is infinite. In the end of the paper, we give a list of open problems further in the direction of completed work. EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 5 2. Preliminaries In this paper we study commutative Noetherian rings, typically of characteristic p > 0. For convenience, we use notation q = pe where e ∈ Z may vary. For an ideal I of R let I [q] be the ideal generated by qth powers of the elements of I. 2.1. Tight closure. Let us briefly review some results from tight closure theory that will be needed for our work. For proofs and a more detailed exposition we refer a curious reader to [10]. Definition 2.1. Let R be a ring and let I be an ideal of R. The tight closure I ∗ of I consists of all elements x of R such that there exists a fixed element c such that c is not contained in any minimal prime of R) and cxq ∈ I [q] for all sufficiently large q. The following properties can be found in [10, Proposition (4.1)]. Proposition 2.2. Let R be a ring and let I, J be ideals of R. (1) I ∗ is an ideal. (2) (I ∗ )∗ = I ∗ , (3) If I ⊆ J then I ∗ ⊆ J ∗ . (4) For all q (I ∗ )[q] ⊆ (I [q] )∗ . (5) x ∈ I ∗ if and only if the image of x is in (IR/P )∗ for all minimal primes P . (6) I ∗ is the preimage of (IRred )∗ in R. Definition 2.3. Let R be a Noetherian ring of characteristic p > 0. We say that an element c is a test element if c is not contained in any minimal prime and for every ideal I and element x ∈ R x ∈ I ∗ if and only if cxq ∈ I [q] for all q. Test elements make tight closure a very powerful tool and have had a great use. After a tremendous amount of work in [11, Theorem 6.1], Hochster and Huneke obtained the following existence theorem. Theorem 2.4. Let R be reduced and either F-finite or of essentially finite type over an excellent local ring. Then R has a test element. Test elements provide us with a very useful lemma. Lemma 2.5. Let (R, m) be a local ring of positive characteristic with a test element c. If I and J are two proper ideals then I ∗ = ∩q (I, J [q] )∗ . Proof. This easily follows from the definition: if x belongs to the intersection, then ′ ′ ′ cxq ∈ ∩n (I, J n )[q ] (or ∩q (I, J [q])[q ] ) and we are done by Krull’s intersection theorem.  2.2. Tight closure and Hilbert-Kunz multiplicities. For our work we will need to extend the definition given in Introduction. Its existence was still proved by Monsky ([20]). Definition 2.6. Let (R, m) be a local ring of characteristic p > 0, I be an m-primary ideal, and M be a finite R-module. The limit 1 eHK (I, M) := lim dim R λ(M/I [q] M), q→∞ q is called the Hilbert-Kunz multiplicity of M with respect to I. 6 ILYA SMIRNOV If I = m, we will call it the Hilbert-Kunz multiplicity of M and denote eHK (M). For a prime ideal p, it is convenient to denote eHK (pRp ) by eHK (p). This naturally makes Hilbert-Kunz multiplicity to be a function on the spectrum and the goal of this paper is to understand when eHK (m) = eHK (p). Now we discuss a very useful connection between Hilbert-Kunz multiplicity and tight closure. For two ideals I ⊂ J, it is easy to see that eHK (I) ≥ eHK (J), but an equality may hold despite that the two ideals are distinct. The following theorem, due to Hochster and Huneke ([10, Theorem 8.17]), describes when does it happen. b = Minh(0R), b or, in other words, Recall that a local ring is formally unmixed if Ass(0R) b b For example, a complete domain is formally dim R/P = dim R for every associated prime of R. unmixed. Theorem 2.7. Let (R, m) be a formally unmixed local ring and I ⊆ J are ideals. Then J ⊆ I ∗ if and only if eHK (I) = eHK (J). The following lemma shows that the Hilbert-Kunz multiplicity of I can be computed using the filtration (I [q] )∗ ; it can be thought of as a generalization of the “only if” direction. We are interested in this filtration, since it is often more useful then the usual filtration I [q] . √ Remark 2.8. If R has a test element c, then, by definition, c 0 = c0∗ = 0. Since c does not belong to any minimal prime, it follows that RP is reduced for any minimal prime P of R. Therefore the dimension of the nilradical of R is less than dim R. Thus eHK (I, M) = eHK (I, Rred ⊗R M) for any m-primary ideal I and module M. Lemma 2.9. Let (R, m) be a local ring of characteristic p > 0, I be an m-primary ideal, and M a finitely generated R-module. If R has a test element c, then 1 λ(M/(I [q] )∗ M) = eHK (I, Rred ⊗R M) = eHK (I, M). lim q→∞ q d Proof. First, by its definition and (6) of Proposition 2.2, c is still a test element in Rred . Also Proposition 2.2 shows that R/(I [q] )∗ ∼ = Rred /(I [q]Rred )∗ , and, using the previous remark, we assume that R is reduced. Now, consider an exact sequence c R− → R → R/(c) → 0. Since c(I [q] )∗ ⊆ I [q] , we obtain that the sequence c R/(I [q] )∗ ⊗R M − → R/I [q] ⊗R M → R/(c, I [q]) ⊗R M → 0. is still exact. Together with inclusion I [q] ⊆ (I [q] )∗ this shows that λ(M/(I [q] )∗ M) ≤ λ(M/I [q] M) ≤ λ(M/(I [q] )∗ M) + λ(M/(c, I [q])M). Since c is not contained in any minimal prime, dim M/cM ≤ dim R/(c) < dim R. Therefore eHK (I, M) = lim q1d λ(M/(I [q] )∗ M).  q→∞ We will need the following corollary to deal with localization of tight closure. Unfortunately, tight closure does not commute with localization, but there is still an inclusion I ∗ Rp ⊆ (IRp )∗ , where the first closure is taken in R and the second is in Rp . Thus, the corollary allows us to compute the Hilbert-Kunz multiplicity of Rp by taking the filtration (p[q] )∗ Rp . Corollary 2.10. Let (R, m) be a local ring of characteristic p > 0 with a test element c. Let I be an m-primary ideal and Iq be a sequence of ideals such that I [q] ⊆ Iq ⊆ (I [q] )∗ . Then 1 λ(R/Iq ) = eHK (I). lim q→∞ q d EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 7 Proof. The claim follows from Lemma 2.9, since the inclusions I [q] ⊆ Iq ⊆ (I [q] )∗ give that 1 1 eHK (I) ≥ lim d λ(R/Iq ) ≥ lim d λ(R/(I [q] )∗ ) = eHK (I). q→∞ q q→∞ q  More importantly, there is a partial converse to this inequality improving further Theorem 2.7. It will very useful later, as it provides us a way to detect when a filtration is in tight closure. Lemma 2.11. Let (R, m) be an formally unmixed local ring of characteristic p > 0 and I be an [q ′ ] m-primary ideal. If Iq is a sequence of ideals such that I [q] ⊆ Iq , Iq ⊆ Iqq′ for all q, q ′, and λ (R/Iq ) = eHK (I), q→∞ qd lim then Iq ⊆ (I [q] )∗ for all q. Proof. By the assumptions on Iq , ′ Therefore, ′ I [qq ] ⊆ Iq[q ] ⊆ Iqq′ . λ (R/Iqq′ ) = q d eHK (I), ′ d (q ) [q] [q] ∗ so eHK (I ) = eHK (Iq ). Hence by Theorem 2.7, Iq ⊆ (I ) . q d eHK (I) = eHK (I [q] ) ≥ eHK (Iq ) ≥ lim q→∞  The following lemma helps us to understand what it means for an element to be regular modulo tight closures / I we denote S of consecutive powers. Recall that for an ideal I and element x ∈ I : x∞ = n I : xn . Lemma 2.12. Let (R, m) be a local ring of characteristic p > 0, I an ideal, and x an element. Suppose that R has a test element c, then the following are equivalent: (a) x is not a zero divisor modulo (I [q] )∗ for any q, (b) I [q] : x∞ ⊆ (I [q] )∗ for all q, (c) for all q there are ideals Iq such that x is not a zero divisor modulo Iq and I [q] ⊆ Iq ⊆ (I [q] )∗ . Proof. (a) ⇒ (b) since I [q] : x∞ ⊆ (I [q] )∗ : x∞ . (b) ⇒ (c) trivially. For the last implication, we ′ ′ ′ ′ observe that if ax ∈ (I [q] )∗ for some q, then caq xq ∈ I [qq ] for all q ′ >> 0. But, since xq is not a zero divisor modulo Iqq′ , ′ ′ caq ∈ Iqq′ ⊆ (I [qq ] )∗ . Since R has a test element, these equations imply that a ∈ (I [q] )∗ .  Corollary 2.13. Let (R, m) be a local ring of positive characteristic and p be a prime ideal. If R has a test element c, the following are equivalent: (a) (p[q] )∗ is p-primary for any q, (b) p[q] Rp ∩ R ⊆ (p[q] )∗ for all q, (c) for all q there exist p-primary ideals Iq such that p[q] ⊆ Iq ⊆ (p[q] )∗ . Proof. Clearly, Iq = p[q] Rp ∩√R yields (b) ⇒ (c). For an ideal I such that I = p, we can characterize its p-primary part as the smallest among the ideals containing I and such that any element x ∈ / p is not a zero divisor modulo that ideal. Thus, for (c) ⇒ (a), we note that p[q] : x∞ ⊆ Iq and use the lemma above. For the last implication, we just note that p[q] Rp ∩ R ⊆ (p[q] )∗ Rp ∩ R.  8 ILYA SMIRNOV 2.3. Basic properties of multiplicities. Let us overview some properties of multiplicities and Hilbert-Kunz multiplicities that will be used through the text. First, both multiplicities satisfy the associativity formula. Lemma 2.14 (Associativity formula). Let (R, m) be a local ring of dimension d and I an arbitrary m-primary ideal. Then X e(I) = e(IR/P ) λRP (RP ), P ∈Minh R where the sum is taken over all primes P , such that dim R/P = dim R. Similarly, if R has positive characteristic, X eHK (IR/P ) λRP (RP ), eHK (I) = P ∈Minh R It is well-known that the multiplicity of a regular sequence can be computed as a colength. Proposition 2.15. Let (R, m) be a local ring of dimension d, x1 , . . . , xr a system of parameters, and I an arbitrary m-primary ideal. Then λ (R/(x1 , . . . , xr )) ≥ e((x1 , . . . , xr )). Moreover, λ (R/(x1 , . . . , xr )) = e((x1 , . . . , xr )) if and only if x1 , . . . , xr form a regular sequence. It was shown by Lech ([16]) that for a parameter ideal (x1 , . . . , xd ), its multiplicity can be computed by a formula λ(R/(xn1 1 , . . . , xnd d )) e ((x1 , . . . , xr )) = lim . min(ni )→∞ n1 · · · nd This easily implies two very useful corollaries. Corollary 2.16. Let (R, m) be a local ring of characteristic p > 0 and let x1 , . . . , xd be a system of parameters. Then eHK ((x1 , . . . , xd )) = e((x1 , . . . , xd )). Corollary 2.17. Let (R, m) be a local ring and let x1 , . . . , xd be a system of parameters. Then for any vector (n1 , . . . , nd ) ∈ Nd e((xn1 1 , . . . , xnd d )) = n1 · · · nd e((x1 , . . . , xd )). Lech also used this observation to obtain the following variation of the associativity formula for parameter ideals ([16, Theorem 1], [23, Theorem 24.7]). Proposition 2.18. Let (R, m) be a local ring and let x1 , . . . , xd be a system of parameters. Then for any 0 ≤ i ≤ d X e((x1 , . . . , xd )) = e((xi+1 , . . . , xd ), R/P ) e((x1 , . . . , xi )RP ). P ∈Minh((x1 ,...,xi )) 3. Equimultiplicity for Hilbert-Kunz functions First recall that the sequence q → λq (m) := 1 q dim R λ(R/m[q] R), is called the (normalized) Hilbert-Kunz function of a local ring (R, m). As a first step, let us characterize for what prime ideals p the entire Hilbert-Kunz functions of Rp and R coincide. The presented argument is based on the proof of [13, Theorem 3.3]. EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 9 Proposition 3.1. Let (R, m) be a local ring of characteristic p > 0 and p be a prime ideal of R such that R/p is regular and ht p + dim R/p = dim R. Then, for a fixed q, λq (m) = λq (p) if and only if R/p[q] is Cohen-Macaulay. Therefore the (normalized) Hilbert-Kunz functions of m and p coincide for all q if and only if R/p[q] are Cohen-Macaulay for all q. Proof. Let x1 , . . . , xm be a minimal system of generators of m modulo p. By the associativity formula and Corollary 2.17, e((x1 , . . . , xm )[q] , R/p[q]) = e((x1 , . . . , xm )[q] , R/p) λRp (Rp /p[q] Rp ) = q m λRp (Rp /p[q]Rp ). Since q m λRp (Rp /p[q] Rp ) = q dim R λq (p), we obtain by Proposition 2.15 that q dim R λq (m) = λ(R/(p[q], xq1 , . . . , xqm )) ≥ e((x1 , . . . , xm )[q] , R/p[q] ) = q dim R λq (p). Thus, λq (m) = λq (p) if and only if λ(R/(p[q] , xq1 , . . . , xqm )) = e((x1 , . . . , xm )[q] , R/p[q]). However, by Proposition 2.15, the latter holds if and only if R/p[q] is Cohen-Macaulay.  While the characterization is simple and natural, it is not clear whether we could force this condition by inverting an element. For a fixed q this condition holds on an open set D(sq ) because the Cohen-Macaulay locus is open in an excellent ring. However, we will need to intersect infinitely many open sets D(sq ) to force it for all q. This is why we need to go further and try to characterize equality of Hilbert-Kunz multiplicities. It will be much harder to achieve, but having a better control over Hilbert-Kunz multiplicity, we will learn in Proposition 6.9 that, in fact, the conditions of Proposition 3.1 cannot be forced for all q by inverting a single element. Last, we remark that this characterization can be used to give a different proof of the following classical theorem that was first proved by Kunz in [15, Corollary 3.4] (and another simple proof is due to Shepherd-Barron in [25]). Theorem 3.2. If R is an excellent locally equidimensional ring, then for any fixed q the qth Hilbert-Kunz function λq is locally constant on Spec(R). 4. A uniform convergence result Before proceeding to technicalities, let us sketch the ideas of the proof. Over a local ring (R, m) we are going to prove uniform convergence (with respect to q) of the bisequence ′ λ(M/(I [q] + J [qq ] )M) q dim R q ′ dim R/I where I is an ideal, M is a finitely generated module, and J is an m-primary ideal. This allows us to interchange the limits (with respect to q and q ′ ) of the bisequence. 1 Uniform convergence will be established by showing that the sequence is Cauchy with an appropriate estimate; to do the bookkeeping of estimates we follow Tucker’s treatment in [29]. Tucker’s proof can be viewed as a careful adaptation of the original proof by Monsky ([20]). We start with an upper bound for a function that we study. Lemma 4.1. Let (R, m) be a local ring and I be an ideal. Then there exists a constant C such that ′ λ(R/(I [q] + m[qq ] )) ≤ Cq ′ dim R/I q dim R for all q, q ′. 1Neil Epstein informed me that a more general change of limits formula was independently obtained in his joint work with Yongwei Yao. 10 ILYA SMIRNOV Proof. Let x1 , . . . , xh be elements of R such that their images form a system of parameters in R/I. Then ′ ′ qq λ(R/(I [q] + m[qq ] )) ≤ λ(R/(I [q] + (x1 , . . . , xh )[qq ] )) = λ(R/(I [q] + (xqq 1 , . . . , xh ))). ′ ′ Filtering by the powers of xqi , we get that ′ ′ [q] qq ′ h λ(R/(I [q] + (xqq 1 , . . . , xh ))) ≤ (q ) λ(R/(I, x1 , . . . , xh ) ). Since (I, x1 , . . . , xh ) is an m-primary ideal, it contains a system of parameters, say, y1 , . . . , yd. Then, filtering by the powers of yi , we obtain that λ(R/(I, x1 , . . . , xh )[q] ) ≤ λ(R/(y1, . . . , yd )[q] ) ≤ q d λ(R/(y1, . . . , yd )). Last, let C = λ(R/(y1 , . . . , yd)) and observe that d = dim R and h = dim R/I.  Corollary 4.2. Let (R, m) be a local ring, let J be an m-primary ideal, and I be an arbitrary ideal. If M is a finitely generated R-module, then there exists a constant D (independent of q ′ ) such that for all q, q ′ ′ λ(M/(I [q] + J [qq ] )M) ≤ Dq ′ dim R/I q dim M . Proof. Since J is m-primary, m[q0 ] ⊆ m for some q0 , thus if the result holds for J = m ′ ′ λ(M/(I [q] + J [qq ] )M) ≤ λ(M/(I [q] + m[qq q0 ] )M) ≤ (Dq0dim M )q ′ dim R/I q dim M . Therefore we assume that J = m. Let K be the annihilator of M and let n be the minimal number of generators of M. Then there ′ exists a surjection (R/K)n → M → 0, so, after tensoring with R/(I [q] + m[qq ] ), we obtain from Lemma 4.1 the estimate ′ ′ λ(M/(I [q] + m[qq ] )M) ≤ n λ(R/(K + I [q] + m[qq ] )) ≤ nCq ′ dim R/(I+K) q dim(R/K) ≤ nCq ′ dim R/I q dim M .  Remark 4.3. Suppose for two R-modules, M and N, MP ∼ = NP for any prime P ∈ Minh(R), i.e. any P such that dim R/P = dim R. If R is reduced, we want to observe that S −1 M ∼ = S −1 N where S is the complement to the union of all primes in Minh(R). This follows from the isomorphism Q −1 ∼ S R= RP . P ∈Minh(R) Lemma 4.4. Let (R, m) be a local ring, let J be an m-primary ideal, and I be an arbitrary ideal. Let M, N be finitely generated R-modules. Moreover, suppose MP ∼ = NP for any minimal prime P such that dim R/P = dim R. Then there exists a constant C independent of q ′ and such that for all q, q ′ ′ ′ | λ(M/(I [q] + J [qq ] )M) − λ(N/(I [q] + J [qq ] )N)| < Cq ′ dim R/I q dim R−1 . Proof. Let S = R\∪Minh(R) P . By the previous remark, S −1 M = S −1 N, so, since S −1 HomR (M, N) = HomS −1 R (S −1 M, S −1 N), there exist homomorphisms M → N and N → M that become isomorphisms after localization by S. Thus we have exact sequences M → N → K1 → 0, N → M → K2 → 0 where dim K1 , dim K2 < dim R, since S −1 K1 = S −1 K2 = 0. ′ Tensoring the first exact sequence with R/(I [q] + J [qq ] ) and taking length, we obtain that ′ ′ ′ λ(N/(I [q] + J [qq ] )N) ≤ λ(M/(I [q] + J [qq ] )M) + λ(K1 /(I [q] + J [qq ] )K1 ), EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 11 while the second sequence yields ′ ′ ′ λ(M/(I [q] + J [qq ] )M) ≤ λ(N/(I [q] + J [qq ] )N) + λ(K2 /(I [q] + J [qq ] )K2 ). ′ By Corollary 4.2, there are constants C1 and C2 such that λ(K1 /(I [q] +J [qq ] )K1 ) ≤ C1 q ′ dim R/I q dim R−1 ′ and λ(K2 /(I [q] + J [qq ] )K2 ) ≤ C2 q ′ dim R/I q dim R−1 . Combining the estimates together, we derive that ′ ′ | λ(N/(I [q] + J [qq ] )N) − λ(M/(I [q] + J [qq ] )M)| ≤ max(C1 , C2)q ′ dim R/I q dim R−1 .  For the next result, we need a bit of notation. For an R-module M and an integer e, we use to denote an R-module obtained from M via the extension of scalars through the eth iterate of the Frobenius endomorphism F e : R → R. Thus F∗e M is isomorphic to M as an abelian group, but elements of R act as pe -powers. So, for any ideal I, IF∗e M ∼ = F∗e I [q] M. If R is reduced, F∗ R 1/p can be identified with the ring of p-roots R . F∗e M Definition 4.5. Let R be a ring of characteristic p > 0. For a prime ideal p of R, we denote α(p) = logp [k(p) : k(p)p ], where k(p) = Rp /pRp is the residue field of p. This number controls the change of length under Frobenius, λR (F∗e M) = peα(R) λR (M) for a finite length R-module M. Kunz ([15, Proposition 2.3]) observed how these numbers change under localization. Proposition 4.6. Let R be F-finite and let p ⊆ q be prime ideals. Then α(p) = α(q)+dim Rq /pRq . Corollary 4.7. Let (R, m) be a reduced F-finite local ring of dimension d and M be a finitely α(R)+d and generated R-module. Then for any minimal prime p ∈ Minh(R) of R the modules Mp⊕p (F∗ M)p are isomorphic. In particular, if R is equidimensional and M has rank r, then the rank of F∗ M is rpα(R)+d . Proof. By Proposition 4.6, α(p) = α(R) + d for any p ∈ Minh(R). Hence λRp (F∗ (Mp )) = pα(p) λRp (Mp ). Since R is reduced, Rp is a field, hence the vector spaces F∗ (Mp ) and ⊕p Last, recall that F∗ (Mp ) ∼ = (F∗ M)p since F∗ commutes with localization. α(P ) Mp are isomorphic.  Theorem 4.8. Let (R, m) be a reduced F-finite local ring of dimension d, J an m-primary ideal, and I be an ideal. Then for any finitely generated R-module M there exists a constant C such that ′ ′ | λ(M/(I [q] + J [qq ] )M) − q d eHK (I + J [q ] , M)| < Cq d−1 q ′ dim R/I for all q, q ′. In particular, the bisequence ′ λ(M/(I [q] + J [qq ] )M) q dim R q ′ dim R/I converges uniformly with respect to q. α(R)+d Proof. By Corollary 4.7, (F∗ M)P and MP⊕p are isomorphic for any minimal prime P ∈ ⊕pα(R)+d Minh(R). Thus, we can apply Lemma 4.4 to M and F∗ M and get that ′ ′ |pα(R)+d λ(M/(I [q] + J [qq ] )M) − λ(F∗ M/(I [q] + J [qq ] )F∗ M)| < Cq ′ dim R/I q d−1 for any q, q ′ and a constant C depending only on M and I. We have ′ ′ λ(F∗ M/(I [q] + J [qq ] )F∗ M) = pα(R) λ(M/(I [qp] + J [qpq ] )M). 12 ILYA SMIRNOV Therefore, using that p−α(R) C ≤ C, (4.1) ′ ′ |pd λ(M/(I [q] + J [qq ] )M) − λ(M/(I [qp] + J [qpq ] )M)| < Cq ′ dim R/I q d−1 . Now, we prove by induction on q1 that for all q, q ′ (4.2) ′ ′ |(q1 )d λ(M/(I [q] + J [qq ] )M) − λ(M/(I [qq1] + J [qq1 q ] )M)| < Cq ′ dim R/I (qq1 /p)d−1 q1 − 1 . p−1 The induction base of q1 = p is (4.1). Now, assume that the claim holds for q1 and we want to prove it for q1 p. First, (4.1) applied to qq1 gives (4.3) ′ ′ |pd λ(M/(I [qq1 ] + J [qq1q ] )M) − λ(M/(I [qq1p] + J [qq1pq ] )M)| < Cq ′ dim R/I (qq1 )d−1 , and, multiplying the induction hypothesis by pd , we get (4.4) ′ ′ |(q1 p)d λ(M/(I [q] + J [qq ] )M) − pd λ(M/(I [qq1] + J [qq1 q ] )M)| < Cq ′ dim R/I (qq1 )d−1 ′ Using that pd λ(M/(I [qq1] + J [qq1 q ] )M) appears in both (4.3) and (4.4), one obtains ′ q1 p − p . p−1 ′ |(q1 p)d λ(M/(I [q] + J [qq ] )M) − λ(M/(I [qq1p] + J [qq1 pq ] )M)| <     q1 p − p q1 p − 1 ′ dim R/I d−1 ′ dim R/I d−1 , < Cq (qq1 ) + 1 = Cq (qq1 ) p−1 p−1 and the induction step follows. Now, dividing (4.2) by q1d , we obtain ′ | λ(M/(I [q] + J [qq ] )M) − 1 1 q1 − 1 ′ · ≤ Cq d−1 . λ(M/(I [qq1 ] + J [qq1q ] )M)| < Cq d−1 · d p − 1 q1 pd−1 q1 ′ ′ Thus, if we let q1 → ∞ and note that eHK (I [q] + J [qq ] , M) = q d eHK (I + J [q ] ), we get that ′ ′ | λ(M/(I [q] + J [qq ] )M) − q d eHK (I + J [q ] , M)| < Cq d−1 , and the claim follows.  Even if R is not F-finite we can often pass to an F-finite ring via the following recipe. Remark 4.9. Let (R, m) be a local ring of characteristic p > 0. b has a coefficient field k. So, if x1 , . . . , xn are By Cohen’s structure theorem ([19, page 265]), R b then there is a surjection k[[T1 , . . . , Tn ]] → R b where T1 are indeterminates the generators of mR, and the map acts by Ti 7→ xi . b ⊗k[[T ,...,Tn ]] k ∞ [[T1 , . . . , Tn ]], where k ∞ is the perfect closure of k. Then R → S is Let S = R 1 b → S. Moreover, S is complete with faithfully flat as a composition of faithfully flat maps R → R a perfect residue field, so, it is F-finite as a homomorphic image of the power series ring over a perfect field. Also, note that mS is the maximal ideal of S. Thus ⊗R S preserves length, and therefore eHK (I, M) = eHK (I, S ⊗R M) for any m-primary ideal I and finitely generated module M. Corollary 4.10. Let (R, m) be a local ring of dimension d, J an m-primary ideal, and I be an aribtrary ideal. Then there is a q0 such that for any finitely generated R-module M there exists a constant C such that ′ ′ | λ(M/(I [q] + J [qq ] )M) − q d eHK (I + J [q ] , M)| < Cq d−1 q ′ dim R/I EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY for all q ′ and all q ≥ q0 . In particular, the bisequence 13 ′ λ(M/(I [q] + J [qq ] )M) q dim R q ′ dim R/I converges uniformly with respect to q. Proof. First, we reduce to the case where R is F-finite. Using the recipe in Remark 4.9, we can find a faithfully flat F-finite extension S of R such that mS is the maximal ideal of S. Hence, for any Artinian R-module A, λS (A ⊗R √ S) = λR (A). e0 0S)q0 = 0. Naturally, N = F∗e0 (S ⊗R M) is a Sred -module, Now, there is q√ = p such that ( 0 where Sred = S/ 0S. Since Sred is reduced and F-finite, we can apply Theorem 4.8 and find a constant C such that ′ ′ | λS (Sred /(I [q] + J [qq ] )Sred ⊗Sred N) − q d eHK ((I + J [q ] )Sred , N)| < Cq d−1 (4.5) for all q, q ′ . Now, observe that  S ⊗R M (I [qq0] + J [qq0 q′ ] )(S ⊗R M)   M e ∼ ⊗R S . = F∗ 0 (I [qq0] + J [qq′ q0 ] )M S Sred ∼ ⊗ N ⊗S N ∼ = = F∗e0 S ′ red (I [q] + J [qq ] )Sred (I [q] + J [qq′ ] )S So, λS  N [q] (I + J [qq′ ] )N Therefore, by definition,  = λS  M ⊗R S [qq ] 0 (I + J [qq′ q0 ] )M ′   ′ = λR (M/(I [qq0 ] + J [qq q0 ] )M). ′ ′ eHK ((I + J [q ] )Sred , N) = eHK ((I + J [q ] )[q0 ] , M) = q0d eHK (I + J [q ] , M) and we can rewrite (4.5) as ′ ′ | λR (M/(I [qq0] + J [qq0 q ] )M) − (qq0 )d eHK (I + J [q ] , M)| < Cq d−1 ≤ C(qq0 )d−1 . By setting q = qq0 , we get that for all q ≥ q0 and all q ′ ′ ′ | λR (M/(I [q] + J [qq ] )M) − q d eHK (I + J [q ] , M)| < Cq d−1 .  Now, we can establish the main result of this section, which will be the basic tool of our theory of equimultiplicity. Corollary 4.11. Let (R, m) be a local ring, and J be an m-primary ideal. If I is an ideal such that dim R/I + ht I = dim R, then X [q ′ ] lim e (I + J , M) = eHK (JR/P, R/P ) eHK(IRP , MP ). HK ′ q →∞ P ∈Minh(I) Proof. We have proved that the double sequence ′ λ(M/(I [q] + J [qq ] )M) q dim R q ′ dim R/I converges uniformly with respect to q. Moreover, the limit with respect to q ′ exists for any q since ′ eHK (J [q] R/I [q] , M/I [q] M) λ(M/(I [q] + J [qq ] )M) = , lim q ′ →∞ q dim M q ′ dim R/I q dim R 14 ILYA SMIRNOV where eHK (J [q] R/I [q], M/I [q] M) is taken over the ring R/I [q] . Thus, the iterated limits of the double sequence are equal: ′ ′ eHK (I + J [q ] , M) λ(M/(I [q] + J [qq ] )M) lim = lim lim q ′ →∞ q ′ →∞ q→∞ q ′ dim R/I q dim R q ′ dim R/I ′ λ(M/(I [q] + J [qq ] )M) eHK (J [q] R/I [q] , M/I [q] M) = lim lim = lim . q→∞ q ′ →∞ q→∞ q dim R q ′ dim R/I q dim R √ √ Note that I = I [q] , so dim R/I = dim R/I [q] and Minh(I) = Minh(I [q] ). Moreover, by the associativity formula, X eHK (JR/I [q] , M/I [q] M) = eHK (JR/P, R/P ) λRP (MP /I [q]MP ). P ∈Minh(I) Hence, we may use that eHK (J [q] R/I [q] , M/I [q] M) = q dim R/I eHK (JR/I [q] , M/I [q] M) and obtain that eHK (J [q] R/I [q] , M/I [q] M) eHK (JR/I [q] , M/I [q] M) lim = lim q→∞ q→∞ q dim R q ht I X λRP (MP /I [q] MP ) . = eHK (JR/P, R/P ) lim q→∞ q ht I P ∈Minh(I) The claim follows, since ht I = ht P .  Corollary 4.12. Let (R, m) be a local ring, J an m-primary ideal, and p be a prime ideal such that dim R/p + ht p = dim R. Then eHK (p + J [q] ) = eHK (JR/p, R/p) eHK (Rp ). q→∞ q dim R/p lim When R/p is regular, this corollary will help us to connect eHK (m) to eHK (p). 5. Equimultiplicity theory In this section, we study equimultiple ideals for Hilbert-Kunz multiplicity. We will find that these should be ideals I such that for any (or, as we will show, some) system of parameters J = (x1 , . . . , xm ) modulo I X (5.1) eHK (I + J) = eHK (J, R/P ) eHK (I, RP ). P ∈Minh(I) This could be seen as a direct analogue of condition (b) of Theorem 1.1. Before proceeding further let us record the following lemma that shows that Equation 5.1 is an extremal condition. Equimultiplicity is also an extremal condition as it is given by the following result of Kunz ([15, Proposition 3.3]). Proposition 5.1. Let (R, m) be an equidimensional catenary ring. Then any prime ideal p eHK (p) ≤ eHK (m). Lemma 5.2. Let (R, m) to be a local ring of characteristic p > 0 and let I be an ideal such that ht I + dim R/I = dim R. Then for any parameter ideal J modulo I X eHK (I + J) ≥ eHK (J, R/P ) eHK (IRP ). P ∈Minh(I) EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 15 Proof. First, by Proposition 2.15 and Corollary 2.17, λ(R/(I + J)[q] ) ≥ e(J [q] , R/I [q] ) = q dim R/I e(J, R/I [q] ). So, by the associativity formula, eHK (I + J) ≥ lim q→∞ X P ∈Minh(I) 1 q ht I e(J, R/P ) λ(RP /I [q]RP ) and the claim follows.  5.1. Preliminaries. Let x1 , . . . , xm ∈ R be a system of parameters modulo I, i.e., the images of x1 , . . . , xm form system of parameters in R/I. To make our notation less cumbersome, in the following we are going to write eHK (I, x1 , . . . , xm ) instead of eHK ((I, x1 , . . . , xm )). The main ingredient of our proof is the multi-sequence 1 lim eHK (I, xn1 1 , . . . , xnmm ) min(ni )→∞ n1 · · · nm that will allow us to connect the two sides of Equation 5.1. First, let us record two useful result in the case when dim R/I = 1. Lemma 5.3. Let (R, m) be a local ring, I be an ideal, and x be a parameter modulo I. Suppose dim R/I = dim R − 1. Then 1 1 λ(R/(I, xn )) ≥ λ(R/(I, xn+1 )). n n+1 Proof. Observe that Thus we get the formula λ I + (xk ) ∼ (xk ) R ∼ . = = I + (xk+1 ) (xk ) ∩ I + (xk+1 ) I : xk + (x)  R (I, xk+1 )  =λ  R (I, xk )  +λ  R k I : x + (x)  . First of all, setting n = k in the formula, we see that it is enough to show that λ(R/(I, xn )) ≥ n λ (R/(I : xn + (x))). Second, using the formula above for consecutive values of k, we obtain that λ (R/(I, xn )) = λ (R/(I, x)) + n−1 X k=1  λ R/(I : xk + (x)) ≥ n λ (R/(I : xn + (x))) , where the last inequality holds since I : xk ⊆ I : xn for all 0 ≤ k ≤ n.  Corollary 5.4. In the setting of the lemma, we have 1 1 eHK (I, xn ) ≥ eHK (I, xn+1 ). n n+1 Proof. Apply the lemma to I [q] and xq and take the limit as q → ∞.  Now, we can show that our multi-sequence converges to the right-hand side of Equation 5.1. Proposition 5.5. Let (R, m) to be a local ring of characteristic p > 0 and let I be an ideal in R such that ht I = dim R − dim R/I. If x1 , . . . , xm are a system of parameters modulo I then X 1 eHK (I, xn1 1 , . . . , xnmm ) = eHK ((x1 , . . . , xm ), R/P ) eHK (IRP ). lim min(ni )→∞ n1 · · · nm P ∈Minh(I) 16 ILYA SMIRNOV Proof. Let (n1 , . . . , nm ) ∈ Nm be an arbitrary vector and let n = min(n1 , . . . , nm ) and N = max(n1 , . . . , nm ). Corollary 5.4 shows that 1 1 1 N eHK (I, xn1 1 , . . . , xnmm ) ≤ m eHK (I, xn1 , . . . , xnm ). eHK (I, xN 1 , . . . , xm ) ≤ m N n1 · · · nm n Therefore, 1 1 lim eHK (I, xn1 1 , . . . , xnmm ) = lim m eHK (I, xn1 , . . . , xnm ). n→∞ n min(ni )→∞ n1 · · · nm Moreover, by Corollary 5.4, the sequence n1m eHK (I, xn1 , . . . , xnm ) is monotonically decreasing, so its limit exists and can be computed by looking at a subsequence. But, by Corollary 4.11, X 1 q′ q′ lim , . . . , x e (I, x ) = eHK ((x1 , . . . , xm ), R/P ) eHK (IRP ). 1 m m HK q ′ →∞ q ′ P ∈Minh(I)  Corollary 5.6. In the assumptions of Proposition 5.5, if X eHK (I, x1 , . . . , xm ) = eHK ((x1 , . . . , xm ), R/P ) eHK (IRP ), P ∈Minh(I) then for any vector (n1 , . . . , nm ) ∈ N m eHK (I, xn1 1 , . . . , xnmm ) = X eHK ((xn1 1 , . . . , xnmm ), R/P ) eHK (IRP ). P ∈Minh(I) Proof. By Corollary 5.4, eHK (I, x1 , . . . , xm ) ≥ eHK (I, xn1 1 , . . . , xnmm ) . n1 · · · nm Moreover, by Lemma 5.2 and Corollary 2.17, X eHK ((xn1 , . . . , xnm ), R/P ) eHK (I, xn1 1 , . . . , xnmm ) 1 m ≥ eHK (IRP ) n1 · · · nm n1 · · · nm P ∈Minh(I) X = eHK ((x1 , . . . , xm ), R/P ) eHK (IRP ) = eHK (I, x1 , . . . , xm ). P ∈Minh(I)  For the next corollary recall the following observation ([30, Lemma 4.2]). Lemma 5.7. Let (R, m) be a local ring of characteristic p > 0 and I an m-primary ideal. Then eHK (I) ≤ λ(R/I) eHK (m). Corollary 5.8. Let (R, m) to be a local ring of characteristic p > 0 and p be a prime ideal in R such that R/p is a regular local ring and ht p = dim R−dim R/p. Then the following are equivalent: (i) eHK (m) = eHK (p), (ii) eHK (p, xn1 1 , . . . , xnmm ) = n1 · · · nm eHK (m) for all vectors (n1 , . . . , nm ) and any system of minimal generators x1 , . . . , xn of m modulo p, (iii) eHK (p + I) = λ(R/(p + I)) eHK (m) for any system of parameters I modulo p. Proof. Clearly, (iii) ⇒ (ii) ⇒ (i). For (i) ⇒ (iii), we observe by Lemma 5.2 that eHK (p + I) ≥ λ(R/(p + I)) eHK (p). On the other hand, the preceding remark gives that eHK (p + I) ≤ λ(R/(p + I)) eHK (m) = λ(R/(p + I)) eHK (p).  EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 17 After building some machinery, we are going to show (Corollary 5.18) that the equality eHK (p + I) = λ(R/(p + I)) eHK (p) for some system of parameters I forces that eHK (m) = eHK (p). 5.2. Main results. The next fundamental theorem can be seen as an analogue of implication (b) ⇒ (d) of Theorem 1.1. Theorem 5.9. Let (R, m) be a formally unmixed local ring of characteristic p > 0 with a test element c. Let I be an ideal and suppose for some system of parameters J = (x1 , . . . , xm ) modulo I, X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ). P ∈Minh(I)  ∗ [q] Then (I, x1 , . . . , xi−1 )[q] : x∞ ⊆ (I, x , . . . , x ) for all q and 1 ≤ i ≤ m. 1 i−1 i  ∗ [q] In particular, xi is not a zero divisor modulo (I, x1 , . . . , xi−1 ) for all i and q. Proof. First, observe that the second claim follow from the first via Lemma 2.12. Let d be the dimension of R. For a fixed k, let L = (x1 , x2 , . . . , xi−1 , xki+1 , . . . , xkm ). For any n, q, q ′ we have inclusions  [q′ ]    ′ [qq′ ] ′ ′ [q] nq kqq ′ k [qq ] (5.2) I, L, xi ⊆ (I, x1 , . . . , xi−1 ) : xi + x . + L, xki ⊆ (I, L)[qq ] : xnqq i i Hence, after dividing by q ′d and taking the limit, we obtain that     [q] k [q] eHK (I, L, xki ) ≥ eHK (I, x1 , . . . , xi−1 )[q] : xnq + (L, x ) i i ! (5.3) R 1 . λ ≥ lim ′ ′ q ′ →∞ (q ′ )d ) + (xkqq (I, L)[qq′ ] : xnqq i i By Corollary 5.6 and Corollary 2.17, for all n X eHK (I, L, xni ) = n e((xi , L), R/P ) eHK (I, RP ). P ∈Minh(I) In particular, we obtain that    k [q] = q d eHK I, L, xki = kq d eHK (I, L, xi ) X e((xi , L), R/P ) eHK(I, RP ). P ∈Minh(I)   [q] [q] [q] nq kq ∼ Moreover, from the isomorphism R/ (I, L) : xi , xi = (I, L, xni ) /(I, L, xin+k ) , we get an exact sequence kq n+k 0 → R/((I, L)[q] : xnq ) i , xi ) → R/(I, L, xi [q] → R/(I, L, xni )[q] → 0. Together with the previous computation, the sequence gives that for all n and k ! X 1 R lim d λ = k e((xi , L), R/P ) eHK(I, RP ), kq q→∞ q (I, L)[q] : xnq i + (xi ) P ∈Minh(I) so, we may compute qd λ lim (qq ′ )→∞ (qq ′ )d R nqq ′ (I, L)[qq′] : xi kqq ′ + (xi ) ! = kq d X e((xi , L), R/P ) eHK (I, RP ). P ∈Minh(I) 18 ILYA SMIRNOV Thus, by (5.2) and (5.3)     k [q] k [q] . = e (I, L, x ) eHK (I, x1 , . . . , xi−1 )[q] : xnq , (L, x ) HK i i i ∗  k [q] Therefore, by Theorem 2.7, (I, x1 , . . . , xi−1 )[q] : xnq ⊆ (I, L, x ) . Now, since n is arbitrary, i i we have ∗ \ k k [q] (I, x , . . . , x , x , . . . , x ) (I, x1 , . . . , xi−1 )[q] : x∞ ⊆ 1 i−1 i m i k and the assertion follows from Lemmas 2.5 and 2.12.  Now, we will establish the converse to Theorem 5.9. But first we will need the following definition. Definition 5.10. Let R be a ring and c ∈ R◦ . We say that c is a locally stable test element if the image of c in RP is a test element for any prime P . While this condition is stronger than that of a test element, in fact, the known results on existence of tests elements provide us locally stable test elements. In particular, Theorem 2.4 asserts that locally stable test elements exists for F-finite domains and algebras of essentially finite type over an excellent local domain. Theorem 5.11. Let (R, m) be a formally unmixed local ring of characteristic p > 0 with a locally stable test element c. Let I be an ideal and J = (x1 , . . . , xm ) be a system of parameters modulo I. Then X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ) P ∈Minh(I) if and only if xi is not a zero divisor modulo ((I, x1 , . . . , xi−1 )[q] )∗ for all i and q. Proof. One direction follows from Theorem 5.9. For the converse, we use induction on m. If m = 1, then by Proposition 2.15 and by the associativity formula (Proposition 2.14) X  λ R/((I [q])∗ , xq1 ) = q e(x1 , R/(I [q])∗ ) = q e(x1 , R/P ) λ(RP /(I [q] )∗ RP ). P ∈Minh(I) P So, taking the limit via Lemma 2.9, eHK (I, x1 ) ≤ P ∈Minh(I) e(x1 , R/P ) eHK (I, RP ) and the converse holds by Lemma 5.2. Now, by the induction hypothesis, X eHK (I + J) = eHK ((I, x1 ) + (x2 , . . . , xm )) = eHK ((x2 , . . . , xm ), R/Q) eHK ((I, x1 ), RQ ). Q∈Minh((I,x1 )) Since c is locally stable, by Corollary 2.10 ((I [q] )∗ , xq1 )RQ still can be used to compute eHK ((I, x1 ), RQ ). Thus, same way as in the first step, we obtain X eHK ((I, x1 ), RQ ) = e(x1 , RQ /P RQ ) eHK (I, RP ). P ∈Minh(IRQ ) Combining these results, we get X eHK (I + J) = e((x2 , . . . , xm ), R/Q) Q∈Minh((I,x1 )) X e(x1 , RQ /P RQ ) eHK (I, RP ). P ∈Minh(IRQ ) Observe that Minh(IRQ ) = Min(IRQ ), since x1 is a parameter modulo I and RQ /IRQ has dimension 1. Hence, any prime P ∈ Minh(IRQ ) is just a minimal prime of I contained in Q. EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 19 Therefore, we can change the order of summations to get X X eHK (I + J) = eHK (I, RP ) e(x1 , RQ /P RQ ) e((x2 , . . . , xm ), R/Q), P ∈Min(I) P ⊂Q∈Minh((I,x1 )) where the second sum is taken over all primes Q ∈ Minh(I + (x1 )) that contain P . For such Q we must have dim R/P ≥ dim R/Q + 1 = dim R/I, because x1 is a parameter modulo I. So, in fact, the first sum could be taken over Minh(I). Furthermore, since x1 is a parameter modulo I and P ∈ Minh(I), x1 is a parameter modulo P and dim R/(I, x1 ) = dim R/(P, x1 ). Hence, the second sum is taken over Q ∈ Minh((P, x1 )), and we rewrite the formula as X X eHK (I + J) = eHK (I, RP ) e(x1 , RQ /P RQ ) e((x2 , . . . , xm ), R/Q). P ∈Minh(I) Q∈Minh((P,x1 )) Last, by the associativity formula for the multiplicity of a parameter ideal (Proposition 2.18), for any P X eHK (J, R/P ) = e((x2 , . . . , xm ), R/Q) e(x1 , RQ /P RQ ), Q∈Minh((P,x1 )) and the claim follows.  Corollary 5.12. Let (R, m) be a formally unmixed local ring of positive characteristic with a locally stable test element c. Let I be an ideal and J = (x1 , . . . , xm ) be a system of parameters modulo I. If X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ) P ∈Minh(I) then for any 0 ≤ k ≤ m eHK (I + J) = X eHK ((xk+1 , . . . , xm ), R/P ) eHK((I, x1 , . . . , xk ), RQ ). Q∈Minh((I,x1 ,...,xk )) Proof. First, by Theorem 5.9, xi is not a zero divisor modulo ((I, x1 , . . . , xi−1 )[q] )∗ for all i and q. Now, since this holds for all i ≥ k, Theorem 5.11 shows the assertion.  Corollary 5.13. Let (R, m) be a local ring and let x1 , . . . , xd and y1 , . . . , yd be two systems of parameters. Then there exists a linear combination x′ = xd + a1 x1 + . . . + ad−1 xd−1 with coefficients in R such that x1 , . . . , xd−1 , x′ and y1 , . . . , yd−1 , x′ are systems of parameters. Proof. First, it is easy to see that x1 , . . . , xd−1 , x′ is still a system of parameters for any choice of the coefficients ai . Second, we let P1 , . . . , Pn be the minimal primes of (y1 , . . . , yd−1 ) and apply the avoidance lemma for cosets to x = xd and I = (x1 , . . . , xd−1 ).  After all the hard work, we can establish that our definition of an equimultiple ideal is independent on the choice of a parameter ideal. Proposition 5.14. Let (R, m) be a formally unmixed local ring of characteristic p > 0 with a locally stable test element c and let I be an ideal. If for some system of parameters J = (x1 , . . . , xm ) modulo I X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ), P ∈Minh(I) then same is true for all systems of parameters. 20 ILYA SMIRNOV Proof. We use induction on m and Theorem 5.11. If dim R/I = 1, then, by Theorem 5.9, our assumption shows that R/(I [q] )∗ is Cohen-Macaulay for any q, so any parameter is regular. Let (y1 , . . . , ym) be an arbitrary system of parameters modulo I. Then using Corollary 5.13, we can find an element of the form x′ = xd + a1 x1 + . . . + am−1 xm−1 such that y1 , . . . , ym−1 , x′ is still a system of parameters modulo I. Note that (x1 , . . . , xm−1 , x′ ) = (x1 , . . . , xm ) = J, so the original formula still holds. By Corollary 5.12, we get that X eHK (I + J) = eHK (I, x′ , x1 , . . . , xm−1 ) = eHK ((x1 , . . . , xm−1 ), R/Q) eHK ((I, x′ ), RQ ), Q∈Minh((I,x′ )) so, by the induction hypothesis applied to (I, x′ ), X eHK (I, x′ , y1 , . . . , ym−1 ) = eHK ((y1, . . . , ym−1 ), R/Q) eHK ((I, x′ ), RQ ). Q∈Minh((I,x′ )) Using Theorem 5.9 on (I, x′ ), we get that yi is regular modulo ((I, x′ , y1, . . . , yi−1 )[q] )∗ for any i and q. But since x′ is also regular modulo (I [q] )∗ for all q, Theorem 5.11 implies that X eHK (I, x′ , y1 , . . . , ym−1 ) = eHK ((x′ , y1 , . . . , ym−1 ), R/P ) eHK (I, RP ). P ∈Minh(I) After permuting the sequence and using Theorem 5.9, we see that x′ is not a zero divisor modulo ((I, y2 , . . . , yn )[q] )∗ for all q. Now, again, both x′ and ym are parameters modulo ((I, y1, . . . , ym−1 )[q] )∗ , so ym is regular too.  Motivated by Proposition 5.14 and Theorem 5.11, we introduce the following definition. Definition 5.15. Let (R, m) be a local ring and let I be an ideal. We say that I satisfies colon capturing, if for every system of parameters x1 , . . . , xm in R/I, for every 0 ≤ i < m, and every q ((I, x1 , . . . , xi )[q] )∗ : xi+1 ⊆ ((I, x1 , . . . , xi )[q] )∗ . A well-known result of tight closure theory asserts that under mild conditions, (0) satisfies colon capturing. We note that the tight closure is taken in R, so this property is different from colon capturing in R/I. Remark 5.16. The colon capturing property asserts that any system of parameters in R/I is “regular up to tight closure” modulo I. So it is not very surprising that the condition can be checked for a single system of parameters. With this definition, we can summarize our findings in an analogue of equivalence (b) and (d) of Theorem 1.1. Theorem 5.17. Let (R, m) be a formally unmixed local ring of characteristic p > 0 with a locally stable test element c and let I be an ideal. Then the following are equivalent: (1) I satisfies colon capturing, (2) for some (equivalently, every) ideal J which is a system of parameters modulo I, X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ). P ∈Minh(I) Proof. This was proved in Theorem 5.11 and Proposition 5.14.  In the special case of prime ideals with regular quotients we obtain the following characterization. Corollary 5.18. Let (R, m) be an formally unmixed local ring of characteristic p > 0 with a locally stable test element c and let p be a prime ideal such that R/p is a regular local ring. Then the following are equivalent: EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 21 (a) eHK (m) = eHK (p), (b) For any (equivalently, some) system of parameters J modulo p eHK (p, J) = λ(R/(p, J)) eHK (m), (c) For any (equivalently, some) system of parameters J modulo p eHK (p, J) = λ(R/(p, J)) eHK (p), (d) p satisfies colon capturing. Proof. The first two conditions are equivalent by Corollary 5.8, (a), (c), (e) are equivalent by the previous theorem.  This theorem has a notable corollary. First, recall that a ring R of characteristic p > 0 is called weakly F-regular if I ∗ = I for every ideal I in R. For example, any regular ring is weakly F-regular and direct summands of weakly F-regular rings are weakly F-regular. Corollary 5.19. Let (R, m) be a weakly F-regular excellent local domain and let p be a prime ideal such that R/p is regular. Then eHK (m) = eHK (p) if and only if the Hilbert-Kunz functions of R and Rp coincide. Proof. Since all ideals in R are tightly closed, from the preceding theorem we obtain that R/p[q] is Cohen-Macaulay for all q. Hence the assertion follows from Proposition 3.1.  Remark 5.20. In [18, Lemma 4.2, Remark 4.7] Linquan Ma observed that perfect ideals are equimultiple and, thus, satisfy the colon capturing property. This observation is a crucial ingredient of his recent work on Lech’s conjecture ([18]). 5.3. Further improvements. We will develop some general reductions for the equimultiplicity condition and use them to generalize the obtained results. First, we show that equimultiplicity can be checked modulo minimal primes. Lemma 5.21. Let (R, m) be a local ring of characteristic p > 0 and p be a prime ideal such that ht p + dim R/p = dim R. Then eHK (m) = eHK (p) if and only if Minh(R) = Minh(Rp ) and eHK (mR/P ) = eHK (pR/P ) for any P ∈ Minh(R). In particular, if R is catenary, then eHK (m) = eHK (p) if and only if P ⊆ p and eHK (mR/P ) = eHK (pR/P ) for all P ∈ Minh(R). Proof. If Q ∈ Minh(Rp ), by definition, dim Rp /QRp = ht p, so Q ∈ Minh(R) by the assumption on p. Moreover, if R is catenary, it is easy to check that, in fact, Minh(Rp ) = {P ∈ Minh(R) | P ⊆ p}. By the associativity formula we have: X eHK (m) = eHK (m, R/P ) λ(RP ), P ∈Minh(R) and, also by Corollary 5.1, X eHK (p) = Q∈Minh(Rp ) eHK (p, Rp /QRp ) λ(RQ ) ≤ X eHK (m, R/Q) λ(RQ ). Q∈Minh(Rp ) Since the second sum is contained in the sum appearing in the expression for eHK (m), the claim follows.  The lemma can be easily generalized, but we decided to leave the special case for clarity. A more general lemma can be found right after the following easy corollary. Corollary 5.22. Let (R, m) be a local ring of characteristic p > 0 and p be a prime ideal such that ht p + dim R/p = dim R. Then eHK (m) = eHK (p) if and only if eHK (mRred ) = eHK (pRred ). 22 ILYA SMIRNOV Proof. Since Minh(R) = Minh(Rred ), this immediately follows from the previous lemma applied to R and Rred .  Lemma 5.23. Let (R, m) be a local ring of characteristic p > 0 and I be an ideal such that ht I + dim R/I = dim R. Let J be a system of parameters modulo I. Then X eHK (J, R/Q) eHK (IRQ ) eHK (I + J) = Q∈Minh(I) if and only if the following two conditions hold: (a) Minh(I + P ) ⊆ Minh(I) P for all P ∈ Minh(R), (b) eHK (I + J, R/P ) = Q∈Minh(IR/P ) eHK (J, R/Q) eHK (IRQ /P RQ ) for all P ∈ Minh(R). Proof. First, observe that if P ∈ Minh(R) and Q ∈ Minh(I) such that P ⊆ Q, then dim R/I ≥ dim R/(I + P ) ≥ dim R/Q = dim R/I, so Q ∈ Minh(I + P ) and the image of Q in R/P is in Minh(IR/P ). Moreover, in this case, dim R/(I + P ) = dim R/I, so Minh(I + P ) ⊆ Minh(I). And the converse is also true: if Minh(I + P ) ⊆ Minh(I) then P is contained in some Q ∈ Minh(I). By the associativity formula for eHK (IRQ ) X X X eHK (J, R/Q) eHK (IRQ ) = eHK (J, R/Q) eHK (IRQ /P RQ ) λ(RP ). Q∈Minh(I) Q∈Minh(I) P ∈Minh(RQ ) If P ∈ Minh(RQ ), by definition, dim RQ /P RQ = ht Q. So, since Q ∈ Minh(I) and dim R/I +ht I = dim R, P ∈ Minh(R). Let Λ = ∪ Minh(RQ ) ⊆ Minh(R) where the union is taken over all Q ∈ Minh(I). In the formula above, we change the order of summations to obtain X X X eHK (J, R/Q) eHK (IRQ ) = λ(RP ) eHK (J, R/Q) eHK (IRQ /P RQ ). P ∈Λ Q∈Minh(I) Q∈Minh(I) P ∈Minh(RQ ) By the observation in the beginning of the proof, X eHK (J, R/Q) eHK (IRQ /P RQ ) = Q∈Minh(I) P ∈Minh(RQ ) X ′ ′ eHK (J, R/Q′ ) eHK (IRQ /P RQ ). Q′ ∈Minh(IR/P ) If the first sum is not empty (i.e., when P ⊆ Q for some Q ∈ Minh(I)), then J is still a system of parameters modulo I + P because it is a system of parameters modulo Q. Thus, in this case, by Lemma 5.2, X eHK (J, R/Q) eHK (IRQ /P RQ ) ≤ eHK (I + J, R/P ). Q∈Minh(I) P ∈Minh(RQ ) But now, we can use the associativity formula for I + J, so X X X eHK (J, R/Q) eHK (IRQ ) = λ(RP ) P ∈Λ Q∈Minh(I) ≤ which finishes the proof. X eHK (J, R/Q) eHK (IRQ /P RQ ) Q∈Minh(I) P ∈Minh(RQ ) λ(RP ) eHK (I + J, R/P ) = eHK (I + J), P ∈Minh(R)  EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 23 Corollary 5.24. Let (R, m) be a local ring of characteristic p > 0 and I be an ideal such that ht I + dim R/I = dim R. Let J be a system of parameters modulo I. Then X eHK (I + J) = eHK (J, R/Q) eHK (IRQ ) Q∈Minh(I) if and only if eHK (I + J, Rred ) = X eHK (J, R/Q) eHK (I(Rred )Q ). Q∈Minh(I) Proof. This follows from Lemma 5.23, since both conditions are equivalent for R and Rred .  The next lemma shows that equimultiplicity is stable under completion. Before starting the proof, we want to recall that Hilbert-Kunz multiplicity is well-behaved with respect to completion, b M ⊗R R) b for any finite R-module M and m-primary ideal I in a namely eHK (I, M) = eHK Rb (I R, local ring (R, m). Lemma 5.25. Let (R, m) be a local ring of positive characteristic p > 0 and I be an ideal such that ht I + dim R/I = dim R. Let J be a system of parameters modulo I. Then X eHK (J, R/Q) eHK (IRQ ) eHK (I + J) = Q∈Minh(I) if and only if b = eHK ((I + J)R) X b P ∈Minh(I R) b b ) eHK (I R bP ). eHK (J R/P, R/P b so we need to show that the right-hand Proof. First, we observe that eHK (I + J) = eHK ((I + J)R) sides are equal. [ = R/Q b R, b eHK (J, R/Q) = eHK (J R/Q, b b Let Q ∈ Minh(I). Because R/Q R/Q). So, using the b b associativity formula for eHK (J R/Q, R/Q), X b b b b ) λ(R bP /QR bP ). eHK (J, R/Q) = eHK (J R/Q, R/Q) = eHK (J R/P, R/P b P ∈Minh(QR) bQ → R bP , it follows that eHK (IRQ ) λ(R bP /QR bP ) = eHK (I R bP ). Since there is a flat map RQ → R Therefore X X X b b ) eHK (I R bP ). eHK (J, R/Q) eHK (IRQ ) = eHK (J R/P, R/P Q∈Minh(I) b Q∈Minh(I) P ∈Minh(QR) b = Minh(I R), b because dim R/I = dim R/I b R b = dim R/Q b R. b Thus we Moreover, ∪Q Minh(QR) obtain that X X b b ) eHK (I R bP ). eHK (J, R/Q) eHK (IRQ ) = eHK (J R/P, R/P Q∈Minh(I) b P ∈Minh(I R)  Corollary 5.26. Let (R, m) be an excellent equidimensional local ring of characteristic p > 0 and let I be an ideal. Then the following are equivalent: (1) I satisfies colon capturing (as in Definition 5.15), (2) for some (equivalently, every) ideal J which is a system of parameters modulo I, X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ). P ∈Minh(I) 24 ILYA SMIRNOV Proof. By Proposition 2.2 and Corollary 5.24, both conditions are independent of the nilradical. Thus we can assume that R is reduced, so since R is excellent, by Theorem 2.4, it has a locally stable test element. Last, since R is an excellent equidimensional reduced ring, it is formally unmixed and we can apply Theorem 5.17.  Corollary 5.27. Let (R, m) be a local ring of positive characteristic p > 0 and I be an ideal such that ht I + dim R/I = dim R. If for some system of parameters J = (x1 , . . . , xm ) modulo I, X eHK (I + J) = eHK (J, R/P ) eHK (I, RP ), P ∈Minh(I) then same is true for all systems of parameters. b+ Proof. First, we use Lemma 5.25 to reduce the question to the completion of R, note that ht I R b R b = dim R. b Thus we assume that R is complete. dim R/I Now, condition (a) of Lemma 5.23 is independent of J. So, it is enough to show that the claim holds in a complete domain. But a complete domain has a locally stable test element by Theorem 2.4 and the claim follows from Proposition 5.14.  5.4. Localization and specialization. It is time study what happens to Hilbert-Kunz multiplicity after localization and specialization. We will show that localization works pretty generally and establish a Bertini-type theorem for specialization. As a corollary, we will recover condition (c) of Theorem 1.1. Localization of Hilbert-Kunz multiplicity is a direct consequence of the colon capturing property. Proposition 5.28. Let (R, m) be a formally unmixed local ring with a test a locally stable test element c or an excellent locally equidimensional local ring. Let I be a Hilbert-Kunz equimultiple ideal and Q be a prime ideal containing I. Then IRQ is still Hilbert-Kunz equimultiple. Proof. Let x1 , . . . , xn be a part of a system of parameters modulo I that descends to a system of parameters in RQ modulo IRQ . By the colon capturing property in R (Corollary 5.26, Theorem 5.17), for all i xi+1 is not a zerodivisor modulo ((I, x1 , . . . , xi )[q] )∗ RQ . Hence, by Lemma 2.12, xi+1 is a regular element modulo ((I, x1 , . . . , xi )[q] RQ )∗ . Thus IRQ is Hilbert-Kunz equimultiple.  Now we turn our attention to specialization. Let us recall a slight generalization of a result of Kunz ([15, Proposition 3.2],[30, Proposition 2.13]). Proposition 5.29. Let (R, m) be a local ring and let x be an element of a system of parameters. Then eHK (I) ≤ eHK (IR/(x)). Proposition 5.30. Let (R, m) be a formally unmixed local ring with a test a locally stable test element c. If I is a Hilbert-Kunz equimultiple ideal, then there exists x ∈ m, a parameter element modulo I, such that for every parameter ideal J modulo (I, x) X eHK (I + J, R/(x)) = eHK (IRP ) eHK ((J, x), R/P ). P ∈Minh(I) Proof. If dim R = 1, any P ∈ Minh(I) is a minimal prime. Take a parameter element x of R. Since I is Hilbert-Kunz equimultiple X X eHK (I, x) = eHK (I, RQ ) eHK (xR/Q) = λ(RQ ) eHK (xR/Q), Q∈Minh(I) Q∈Min(I) where we have used that RQ is Artinian. On the other hand, by the associativity formula X eHK (I, x) = λ(RP ) eHK ((I, x)R/P ). P ∈Minh(R) EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 25 If P contains I, then eHK ((I, x)R/P ) = eHK (x, R/P ), so after comparing the two formulas we see that Minh(I) = Minh(R). Since R is unmixed, x is not a zero divisor, so by the associativity formula and Proposition 2.15 X eHK (IR/(x)) = λ(R/(x)) = e(x) = λ(RP ) eHK (x, R/P ) = eHK (I, x). P ∈Minh(R) Now, suppose that dim R ≥ 2. As in Corollary 5.26, we may assume that R has a locally stable test element c. By prime avoidance, there exists a parameter element x modulo I that to any minimal prime of (c). Take an arbitrary parameter ideal J modulo (I, x). Since I is satisfies colon capturing, x is regular modulo ((I + J)[q] )∗ for all q. Then, by Proposition 2.15 and the associativity formula     X   λ R/(((I + J)[q] )∗ , x) = e x, R/((I + J)[q] )∗ = eHK (x, R/Q) λ RQ /((I + J)[q] )∗ RQ . Q∈Minh(I+J) Further consider an exact sequence c R− → R → R/(c) → 0 and tensor it with R/((I + J)[q] , x). Since c((I + J)[q] )∗ ⊆ (I + J)[q] , the sequence c R/(x, ((I + J)[q] )∗ ) − → R/(x, (I + J)[q] ) → R/(c, x, (I + J)[q] ) → 0 is also exact. Note that dim R/(x, c) = dim R/(x) − 1, so after passing to the limit we obtain that   [q] ∗ λ R/(((I + J) ) , x) eHK ((I + J)R/(x)) ≤ lim q→∞ q d−1 Thus the formula above gives us that X eHK ((I + J)R/(x)) ≤ eHK (x, R/Q) eHK ((I + J)RQ ). Q∈Minh(I+J) Proposition 5.29 gives us the opposite inequality, so X eHK ((I + J)R/(x)) = eHK (x, R/Q) eHK ((I + J)RQ ). Q∈Minh(I+J) This gives the statement if dim R/I = 1. Otherwise, we use that IRQ is still equimultiple, so X eHK ((I + J)RQ ) = eHK (IRP ) eHK (J, RQ /P RQ ). Q⊇P ∈Minh(I) Plugging this in the previous formula and changing the order of summation we get that X X eHK ((I + J)R/(x)) = eHK (IRP ) eHK (x, R/Q) eHK (JRQ /P RQ ) P ∈Minh(I) = X Q∈Minh(JR/P ) eHK (IRP ) eHK ((x, J), R/P ), P ∈Minh(I) where the last equality holds by Proposition 2.18.  As a first corollary we obtain a Bertini-type theorem for Hilbert-Kunz equimultiplicity. Corollary 5.31. Let (R, m) be a local ring which is either formally unmixed with a test a locally stable test element c or excellent and locally equidimensional. If I is a Hilbert-Kunz equimultiple ideal, then there exists x ∈ m, a parameter element modulo I, such that IR/(x) is Hilbert-Kunz equimultiple. 26 ILYA SMIRNOV Proof. Choose x as given by the proposition. Let (J, x) be a system of parameters modulo I. By Lemma 5.2 and Proposition 5.29 we always have inequalities X eHK ((I + J)R/(x)) ≥ eHK (I + (J, x)) ≥ eHK (IRP ) eHK ((J, x)R/P ) P ∈Minh(I) and eHK ((I + J)R/(x)) ≥ X eHK (IRQ /xRQ ) eHK (JR/Q). Q∈Minh(I,x) By the associativity formula in Proposition 2.18 X eHK ((J, x)R/P ) = eHK (JR/Q) eHK (xRQ /P RQ ), Q∈Minh(P,x) so combining this with Lemma 5.2 and changing the order of summation we obtain that X X eHK ((I + J)R/(x)) ≥ eHK (IRQ /xRQ ) eHK (JR/Q) ≥ eHK (IRP ) eHK ((J, x)R/P ) Q∈Minh(I,x) P ∈Minh(I) and the corollary follows.  In the most interesting case we obtain the following statement. Corollary 5.32. Let (R, m) be a formally unmixed local ring with a test element c. Let p be a prime ideal of R such that R/p is a regular ring. Then the following are equivalent (1) eHK (p) = eHK (R/(x)) for some minimal generator x of m modulo p, (2) eHK (p) = eHK (R/(y)) for some parameter y of m modulo p, (3) eHK (p) = eHK (m). Proof. (1) ⇒ (2) is obvious. By Proposition 5.29, eHK (R) ≤ eHK (R/(y)) for any parameter y in R. Thus, we always have inequalities eHK (p) ≤ eHK (m) ≤ eHK (R/(y)), and (2) ⇒ (3) follows. For the last implication we use Corollary 5.31 and observe that in the proof of Proposition 5.30 x can be taken to be a minimal generator of m: an element of m not contained in m2 and the minimal primes of c.  Remark 5.33. In many cases, we should be able to choose any minimal generator of m modulo p in the lemma above. Namely, this will hold if the ideal generated by test elements has height at least two; for example, if R is a an excellent normal domain. In this case we will be able to choose a test element c such that dim R/(c, x) ≤ dim R − 2. Finally, let us recover a Hilbert-Kunz analogue of condition (c) in Theorem 1.1. Corollary 5.34. Let (R, m) be a local ring which is either formally unmixed with a test a locally stable test element c or excellent and locally equidimensional. If I is an ideal then I is Hilbert-Kunz equimultiple if and only if there is a system of parameter J = (x1 , . . . , xr ) modulo I which is a part of a system of parameters in R, and such that P • if r < dim R then P ∈Minh(I) eHK (J, R/P ) eHK (IRP ) = eHK (IR/J) P • if r = dim R then P ∈Minh(I) eHK (J, R/P ) eHK (IRP ) = eHK (J), Proof. First suppose that I is Hilbert-Kunz equimultiple. If r = dim R, then we can use the argument in the first part of the proof of Proposition 5.30 and obtain that Minh(I) = Minh(R). Thus by the associativity formula for any system of parameters J X X eHK (J, R/P ) eHK (IRP ) = eHK (J, R/P ) λ(RP ) = eHK (J). P ∈Minh(R) P ∈Minh(R) EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 27 In general, we build J by repeatedly applying Proposition 5.30 in R/(x1 , . . . , xi ) until i = r. Namely, suppose that we have found a sequence of elements x1 , . . . , xi such that for any parameter ideal Ji in R/(I, x1 , . . . , xi ) X eHK ((I + Ji )R/(x1 , . . . , xi )) = eHK (IRP ) eHK ((Ji , x1 , . . . , xi )R/P ). P ∈Minh(I) By Proposition 5.31 and its proof we can find xi+1 such that for every parameter ideal Ji+1 in R/(I, x1 , . . . , xi , xi+1 ) eHK ((I + J ′ )R/(x1 , . . . , xi+1 )) = eHK ((I, J ′ , xi+1 )R/(x1 , . . . , xi )) X = eHK (IRP ) eHK ((Ji , x1 , . . . , xi )R/P ). P ∈Minh(I) For the converse, we note that a repeated use of Proposition 5.29 we yield the inequality X eHK (IR/J) ≥ eHK (I + J) ≥ eHK (IRP ) eHK (JR/P ). P ∈Minh(I)  6. Applications It is time to discuss the applications of the developed theory. First, we will show how equimultiplicity forces tight closure of Frobenius powers to be unmixed. It is important this happens to be an equivalent condition in dimension one, and, furthermore, we can make it global and apply to study Hilbert-Kunz multiplicity on the Brenner-Monsky hypersurface. 6.1. Equimultiplicity and unmixedness of tight closure. We start with the following consequence of our machinery. Proposition 6.1. Let (R, m) be a local ring of positive characteristic p > 0. Suppose that either R is formally unmixed with a locally stable test element c or is excellent and equidimensional. If I is an equimultiple ideal for Hilbert-Kunz multiplicity, that is if X eHK (I + J) = eHK (IRP ) eHK (JR/P ) P ∈Minh(I) for some (all) ideals J generated by a system of parameters modulo I, then Ass(I [q] )∗ = Minh(I) for all q. Proof. By Theorem 5.17 and Corollary 5.26, we know that I satisfies colon capturing. Any prime ideal q ⊃ I such that q ∈ / Minh(I) will contain a parameter element x. Then by the colon capturing property (I [q] )∗ : x = (I [q] )∗ , so q is not an associated prime.  Corollary 6.2. Let (R, m) be a local ring of positive characteristic p > 0 and further suppose that either R is formally unmixed with a locally stable test element c or is excellent and equidimensional. If p is a prime ideal such that R/p is regular and eHK (p) = eHK (m), then (p[q] )∗ is p-primary for all q. It is extremely useful that the converse holds if R/p has dimension one (Corollary 5.18). But before we will show this importance, we need to globalize our criterion. We start with the following well-known lemma ([2, Lemma 3.5]). 28 ILYA SMIRNOV Lemma 6.3. Let R be a ring of characteristic p > 0 with a test element c and ISbe an ideal of R. Then I ∗ S −1 R = (IS −1 R)∗ for any multiplicatively closed subset S disjoint from q Ass(R/(I [q])∗ ). Lemma 6.4. Let R be a ring of characteristic p > 0. Suppose R has a test element c. The following are equivalent: (a) (p[q] )∗ are p-primary for all q, (b) (p[q] Rq )∗ are p-primary for all q and all prime ideals q ⊇ p, (c) (p[q] Rm )∗ are p-primary for all q and all maximal ideals m that contain p. Proof. The previous lemma shows (a) ⇒ (b) and (b) clearly implies (c). So, we need to show (c) ⇒ (a). Suppose there exists an embedded prime ideal q. Then there is u such that qu ⊆ (p[q] )∗ , but u∈ / (p[q] )∗ . A result of Hochster and Huneke ([10, Proposition 6.1]) asserts that a tightly closed ideal is the intersection of the tightly closed ideals containing I that are primary to a maximal ideal. Therefore p[q] is contained in an ideal J primary to some maximal ideal m and such that u∈ / J ∗ . Now Lemma 6.3 shows that (J)∗ Rm = (JRm )∗ , so, since J ∗ is also m-primary, u ∈ / (JRm )∗ . On the other hand, up′Rm ⊆ (p[q] )∗ Rm ⊆ (p[q] Rm )∗ ⊆ (JRm )∗ . Thus u ∈ / (p[q] Rm )∗ and p′ Rm consists of zero divisors on (p[q] Rm )∗ .  Now, we can give a global version of Corollary 6.2. Corollary 6.5. Let R be a locally equidimensional ring and let p be a prime ideal such that R/p is regular. If eHK (m) = eHK (p) for all maximal (equivalently, all prime) ideals m containing p, then (p[q] )∗ are p-primary for all q. The following result is a global version of the equimultiplicity criterion. Corollary 6.6. Let R be an excellent domain and let p be a prime ideal such that R/p is a regular ring of dimension one. Then eHK (m) = eHK (p) for all maximal ideals m containing p if and only if (p[q] )∗ is p-primary for all q. Remark 6.7. It seems that equimultiplicity is a strong condition. For simplicity, suppose R is an excellent domain and p is a prime ideal of dimension 1. Then by the previous corollary, if there exists an open equimultiple subset of Max R/p, then we can find an element f ∈ / p such that (p[q] Rf )∗ is p-primary for all q. In view of Lemma 6.3, this forces tight closure of all p[q] Rf to commute with localization at any multiplicatively closed set. This suggests that equimultiplicity can be used to find further examples where tight closure does not commute with localization. We are also able to use the Brenner-Monsky counter-example to study Hilbert-Kunz multiplicity. 6.2. The Brenner-Monsky example. It is time to show that our methods can be used to establish some interesting results in well-known example. First, let us introduce the BrennerMonsky hypersurface R = F [x, y, z, t]/(z 4 + xyz 2 + (x3 + y 3 )z + tx2 y 2), where F is an algebraic closure of Z/2Z. This hypersurface parametrizes a family of quadrics studied by Monsky in [22]. Since R is a quotient of a polynomial ring over an algebraically closed field, it is F-finite. Also, R is a domain, so it has a locally stable test element. Let P = (x, y, z) then R/P ∼ = F [t] is a regular ring and P is prime. In [8], Brenner and Monsky showed that tight closure does not commute with localization at P . Namely, they showed that y 3 z 3 ∈ / (P [4] )∗ , but the image of y 3 z 3 is contained in [4] −1 ∗ (P S R) for S = F [t] \ {0}. EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 29 We want to understand the values of Hilbert-Kunz multiplicity on the maximal ideals containing P . First, we will need the following result of Monsky. Theorem 6.8. Let K be an algebraically closed field of characteristic 2. For α ∈ K let Rα = K[[x, y, z]]/(z 4 + xyz 2 + (x3 + y 3)z + αx2 y 2). Then (1) eHK (Rα ) = 3 + 21 , if α = 0, (2) eHK (Rα ) = 3 + 4−m , if α 6= 0 is algebraic over Z/2Z, where m = [Z/2Z(λ) : Z/2Z] for λ such that α = λ2 + λ (3) eHK (Rα ) = 3 if α is transcendental over Z/2Z. Proof. The last two cases are computed by Monsky in [22]. For the first case, we note that in characteristic 2 we can factor z 4 + xyz 2 + (x3 + y 3 )z = z(x + y + z)((x + y + z)2 + zy). Thus by the associativity formula, eHK (R0 ) = eHK (K[x, y]) + eHK (K[x, y, z]/(x + y + z)) + eHK (K[x, y, z]/((x + y + z)2 + zy)) and the claim follows.  Using the developed machinery we derive the following result from Monsky’s computations. Proposition 6.9. Let R = F [x, y, z, t]/(z 4 + xyz 2 + (x3 + y 3 )z + tx2 y 2), where F is the algebraic closure of Z/2Z. Then eHK (P ) = 3 for a prime ideal P = (x, y, z) in R, but eHK (m) > 3 for any maximal ideal m containing P . Proof. First of all, in the notation of the preceding theorem, Cohen’s structure theorem ([19, cP ∼ cP ) = 3. p.211]) shows that R = Rt for K = F (t), so eHK (RP ) = eHK (R Second, since F is algebraically closed, all maximal ideals containing P are of the form (P, t − α) for α ∈ F . By Monsky’s result, eHK (Rm /(t − α)) > 3 = eHK (P ), since α is algebraic. So, since R/(t − α) is reduced, eHK (m) > eHK (P ) by Corollary 5.32.  We list two easy consequences of this result. Corollary 6.10. The stratum {p | eHK (p) = 3} is not locally closed. In particular, the set {q | eHK (q) ≤ 3} is not open. Proof. If it was an intersection of a closed set V and open set U, then the intersection V (P ) ∩ U should be non-empty and open in V (P ). In particular, it would contain infinitely many maximal ideals m containing P .  Corollary 6.11. The set {eHK (m) | P ⊂ m} is infinite. Proof. In the notation of the proof of Proposition 6.9, we have that eHK (mR/(t − α)) ≥ eHK (m) > eHK (P ). Now the claim follows from Theorem 6.8, since eHK (m) tends to 3 when [Z/2Z(λ) : Z/2Z] grows.  Another application of our methods is a quick calculation of the associated primes ofSP [q] . Using the calculations that Monsky made to obtain Theorem 6.8, Dinh ([9]) proved that q Ass(P [q] ) is infinite. However, he was only able to show that the maximal ideals corresponding to the irreducible factors of 1 + t + t2 + . . . + tq appear as associated primes, while our methods give all associated primes of the Frobenius powers and their tight closures. Proposition 6.12. In the Brenner-Monsky example, [ [ Ass(P [q] )∗ = Ass(P [q] ) = Spec(R/P) . q In particular, the set is infinite. q 30 ILYA SMIRNOV Proof. Clearly, P is an associated prime, so we only need to check the maximal ideals. First, we prove that any prime m that contains P is associated to some (P [q])∗ . If not, then (P [q] )∗ Rm are P -primary for all q. Note that (P [q])∗ Rm ⊆ (P [q]Rm )∗ , thus by Corollary 2.13 (P [q] Rm )∗ is P -primary for any q. Therefore, by Corollary 5.18, eHK (m) = eHK (P ), a contradiction. For the second claim, let m be any maximal ideal containing P . Since eHK (P ) < eHK (m) and R/P is regular, m is an associated prime of (P [q] Rm )∗ for some q. Thus, there exists u ∈ / (P [q] Rm )∗ such that ′ ′ ′ cuq m[q ] ⊆ P [qq ] Rm . ′ Now, if m is not an associated prime of any P [qq ] , then we would have u ∈ (P [q] Rm )∗ , a contradiction.  Remark 6.13. The presented example shows that Hilbert-Kunz multiplicity need not be locally constant when tight closure does not commute with localization. However, it is not clear whether it should be locallySconstant if, in a particular example, tight closure commutes with localization. Even in this case q Ass(p[q] )∗ might be infinite ([26]), and it is not clear why the intersection of the embedded primes must be greater than p. 7. Open problems There is a number of question laying further in the direction and spirit of this work. Here is a small selection of the favorites. Question 7.1. What can be said about the maximum value locus of the Hilbert-Kunz multiplicity? Are the irreducible components regular? In the Brenner-Monsky example the locus consists of finitely many maximal ideals, so the irreducible components are indeed smooth. The author does not know any computation of HilbertKunz multiplicity in a two-parameter family, so there is no real example to test this question on. Question 7.2. What is the behavior of Hilbert-Kunz multiplicity under a blow-up? If the previous question has a positive answer, we may hope that one can always choose a component such that its blow-up will not increase the Hilbert-Kunz multiplicity. Question 7.3. This work suggests that Hilbert-Kunz multiplicity might be “too sensitive”. Is there a suitable coarsening? Perhaps, Hilbert-Kunz multiplicity should be paired with a less sensitive invariant, such as the Hilbert-Samuel function, and should be only used if that invariant does not provide much information. Another possible hope is to “round” Hilbert-Kunz multiplicity, perhaps the fact that Hilbert-Kunz multiplicity cannot be too close to 1 is a sign? It is widely believed that Hilbert-Kunz multiplicity can be defined in characteristic zero by taking the limit of the Hilbert-Kunz multiplicities of the reductions mod p (see [7, 28] for partial results). Question 7.4. What are the geometric properties of the characteristic zero Hilbert-Kunz multiplicity? Can it be used to give a new proof of Hironaka’s theorem on the resolution of singularities? Acknowledgements The results of this paper are a part of the author’s thesis written under Craig Huneke in the University of Virginia. I am indebted to Craig for his support and guidance. This project would not be possible without his constant encouragement. I also want to thank Mel Hochster who carefully read the manuscript and suggested very useful changes. EQUIMULTIPLICITY IN HILBERT-KUNZ THEORY 31 References [1] Ian M. Aberbach and Florian Enescu. Lower bounds for Hilbert-Kunz multiplicities in local rings of fixed dimension. Michigan Math. J., 57:1–16, 2008. Special volume in honor of Melvin Hochster. [2] Ian M. Aberbach, Melvin Hochster, and Craig Huneke. Localization of tight closure and modules of finite phantom projective dimension. J. Reine Angew. Math., 434:67–114, 1993. [3] Shreeram S. Abhyankar. Weighted expansions for canonical desingularization, volume 910 of Lecture Notes in Mathematics. Springer-Verlag, Berlin-New York, 1982. With a foreword by U. Orbanz. [4] Donald G. Babbitt and Jane E. Kister, editors. Featured reviews in Mathematical Reviews 1997–1999. Featured Reviews in Mathematical Reviews. American Mathematical Society, Providence, RI, 2000. With selected reviews of classic books and papers from 1940–1969. [5] Edward Bierstone and Pierre D. Milman. Canonical desingularization in characteristic zero by blowing up the maximum strata of a local invariant. Invent. Math., 128(2):207–302, 1997. [6] Manuel Blickle and Florian Enescu. On rings with small Hilbert-Kunz multiplicity. Proc. Amer. Math. Soc., 132(9):2505–2509 (electronic), 2004. [7] Holger Brenner, Jinjia Li, and Claudia Miller. A direct limit for limit Hilbert-Kunz multiplicity for smooth projective curves. J. Algebra, 372:488–504, 2012. [8] Holger Brenner and Paul Monsky. Tight closure does not commute with localization. Ann. of Math. (2), 171(1):571–588, 2010. [9] Trung T. Dinh. Associated primes of the example of Brenner and Monsky. Comm. Algebra, 41(1):109–123, 2013. [10] Melvin Hochster and Craig Huneke. Tight closure, invariant theory, and the Briançon-Skoda theorem. J. Amer. Math. Soc., 3(1):31–116, 1990. [11] Melvin Hochster and Craig Huneke. F -regularity, test elements, and smooth base change. Trans. Amer. Math. Soc., 346(1):1–62, 1994. [12] Melvin Hochster and Craig Huneke. Localization and test exponents for tight closure. Michigan Math. J., 48:305–329, 2000. Dedicated to William Fulton on the occasion of his 60th birthday. [13] Craig Huneke and Yongwei Yao. Unmixed local rings with minimal Hilbert-Kunz multiplicity are regular. Proc. Amer. Math. Soc., 130(3):661–665, 2002. [14] Ernst Kunz. Characterizations of regular local rings of characteristic p. Amer. J. Math., 91:772–784, 1969. [15] Ernst Kunz. On Noetherian rings of characteristic p. Amer. J. Math., 98(4):999–1013, 1976. [16] Christer Lech. On the associativity formula for multiplicities. Ark. Mat., 3:301–314, 1957. [17] Joseph Lipman. Equimultiplicity, reduction, and blowing up. In Commutative algebra (Fairfax, Va., 1979), volume 68 of Lecture Notes in Pure and Appl. Math., pages 111–147. Dekker, New York, 1982. [18] Linquan Ma. Lech’s conjecture in dimension three. Preprint, available at http://arxiv.org/abs/1609.00095. [19] Hideyuki Matsumura. Commutative algebra, volume 56 of Mathematics Lecture Note Series. Benjamin Cummings Publishing Co., Inc., Reading, Mass., second edition, 1980. [20] Paul Monsky. The Hilbert-Kunz function. Math. Ann., 263(1):43–49, 1983. [21] Paul Monsky. Hilbert-Kunz functions in a family: line-S4 quartics. J. Algebra, 208(1):359–371, 1998. [22] Paul Monsky. Hilbert-Kunz functions in a family: point-S4 quartics. J. Algebra, 208(1):343–358, 1998. [23] Masayoshi Nagata. The theory of multiplicity in general local rings. In Proceedings of the international symposium on algebraic number theory, Tokyo & Nikko, 1955, pages 191–226. Science Council of Japan, Tokyo, 1956. [24] David Rees. Rings associated with ideals and analytic spread. Math. Proc. Cambridge Philos. Soc., 89(3):423– 432, 1981. [25] Nicholas I. Shepherd-Barron. On a problem of Ernst Kunz concerning certain characteristic functions of local rings. Arch. Math. (Basel), 31(6):562–564, 1978/79. [26] Anurag K. Singh and Irena Swanson. Associated primes of local cohomology modules and of Frobenius powers. Int. Math. Res. Not., (33):1703–1733, 2004. [27] Ilya Smirnov. Upper semi-continuity of the Hilbert-Kunz multiplicity. Compos. Math., 152(3):477–488, 2016. [28] V. Trivedi. Hilbert-Kunz multiplicity and reduction mod p. Nagoya Math. J., 185:123–141, 2007. [29] Kevin Tucker. F -signature exists. Invent. Math., 190(3):743–765, 2012. [30] Kei-ichi Watanabe and Ken-ichi Yoshida. Hilbert-Kunz multiplicity and an inequality between multiplicity and colength. J. Algebra, 230(1):295–317, 2000. Department of Mathematics, University of Michigan, Ann Arbor, MI 48109, USA E-mail address: [email protected]
0math.AC
1 A Change-Sensitive Algorithm for Maintaining Maximal Bicliques in a Dynamic Bipartite Graph arXiv:1707.08272v1 [cs.DS] 26 Jul 2017 Apurba Das, Srikanta Tirthapura, Senior Member, IEEE, Abstract—We consider the maintenance of maximal bicliques from a dynamic bipartite graph that changes over time due to the addition or deletion of edges. When the set of edges in a graph changes, we are interested in knowing the change in the set of maximal bicliques (the “change”), rather than in knowing the set of maximal bicliques that remain unaffected. The challenge in an efficient algorithm is to enumerate the change without explicitly enumerating the set of all maximal bicliques. In this work, we present (1) near-tight bounds on the magnitude of change in the set of maximal bicliques of a graph, due to a change in the edge set (2) a “change-sensitive” algorithm for enumerating the change in the set of maximal bicliques, whose time complexity is proportional to the magnitude of change that actually occurred in the set of maximal bicliques in the graph. To our knowledge, these are the first algorithms for enumerating maximal bicliques in a dynamic graph, with such provable performance guarantees. Our algorithms are easy to implement, and experimental results show that their performance exceeds that of current baseline implementations by orders of magnitude. F 1 I NTRODUCTION Graphs are ubiquitous in representing linked data in many domains such as in social network analysis, computational biology, and web search. Often, these networks are dynamic, where new connections are being added and old connections are being removed. The area of dynamic graph mining focuses on efficient methods for finding and maintaining significant patterns in a dynamic graph. In this work we focus on the maintenance of dense subgraphs within a dynamic graph. Our work is motivated by many applications that require the maintenance of dense substructures from a dynamic graph. Angel et al. [6], propose an algorithm for identifying breaking news stories in real-time through dense subgraph mining from an evolving graph, defined on the co-occurrence of entities within messages in an online social network. [17] present methods for detecting communities among users in a microblogging platform through identifying dense structures in an evolving network representing connections among users. A sample of other applications of dense subgraph mining in networks include identification of communities in a social network [15], [23], identification of web communities [14], [28], [18], phylogenetic tree construction [11], [29], [34], communities in bipartite networks [19], genome analysis [26], and closed itemset mining [32], [20]. We consider the fundamental problem of maintaining maximal bicliques in a bipartite graph that is changing due to the addition or deletion of edges. Let G = (L, R, E) be a simple undirected bipartite graph with its vertex set partitioned into L, R, and edge set E ⊆ L × R. A biclique in G is a bipartition B = (X, Y ), X ⊆ L, Y ⊆ R such that each vertex in X is connected to each vertex in Y . A biclique B is called a maximal biclique if there is no other biclique B 0 • Das and Tirthapura are with the Department of Electrical and Computer Engineering, Iowa State University, Ames, IA 50011. E-mail: {adas,snt}@iastate.edu. The authors were partially supported through the NSF grant 1527541. such that B is a proper subgraph of B 0 . Let BC(G) denote the set of all maximal bicliques in G. Suppose that, starting from bipartite graph G1 = (L, R, E), the state of the graph changes to G2 = (L, R, E ∪ H) due to the addition of a set of new edges H . Let Υnew (G1 , G2 ) = BC(G2 ) \ BC(G1 ) denote the set of new maximal bicliques that arise in G2 that were not present in G1 and Υdel (G1 , G2 ) = BC(G1 ) \ BC(G2 ) denote the set of maximal bicliques in G1 that are no longer maximal bicliques in G2 (henceforth called as subsumed bicliques). See Fig. 1 for an example. Let Υ(G1 , G2 ) = Υnew (G1 , G2 ) ∪ Υdel (G1 , G2 ) denote the symmetric difference of BC(G1 ) and BC(G2 ). We ask the following questions: (1) How large can be the size of Υ(G1 , G2 )? In particular, can a small change in the set of edges cause a large change in the set of maximal bicliques in the graph? (2) How can we compute Υ(G1 , G2 ) efficiently? Can we quickly compute Υ(G1 , G2 ) when |Υ(G1 , G2 )| is small? In short, can we design change-sensitive algorithms for enumerating elements of Υ(G1 , G2 ), whose time complexity is proportional to the size of change, |Υ(G1 , G2 )|? 1.1 Contributions Magnitude of Change: Let g(n) denote the maximum number of maximal bicliques possible in an n vertex bipartite graph. A result due to Prisner [27] shows that g(n) ≤ 2n/2 , where equality occurs when n is even. We show that the change in the number of maximal bicliques when a single edge is added to the graph can be as large as 3g(n − 2) ≈ 1.5 × 2n/2 , which is exponential in the number of vertices in the graph. This shows that the addition of even a single edge to the graph can lead to a large change in the set of maximal bicliques in the graph. We further show that this bound is tight for the case of the addition of a single edge – the largest possible change in the set of maximal bicliques upon adding a single edge is 3g(n − 2). For the case when more edges can be added to the graph, 2 the addition of a batch of 100 edges, while the baseline algorithm took more than 30 minutes. 1.2 Fig. 1: Change in maximal bicliques when the graph changes from G1 to G2 due to the addition of edge set H = {{a, y}, {c, x}}. Note that each maximal biclique of G1 is subsumed by a larger maximal biclique in G2 , and there is one new maximal biclique in G2 . it is easy to see that the maximum possible change is no larger than 2g(n). Enumeration Algorithm: From our analysis, it is clear that the magnitude of change in the set of maximal bicliques in the graph can be as large as exponential in n in the worst case. On the flip side, the magnitude of change can be as small as 1 – for example, consider the case when a newly arriving edge connects two isolated vertices in the graph. Thus, there is a wide range of values the magnitude of change can take. When the magnitude of change is very large, an algorithm that enumerates the change must inevitably pay a large cost, if only to enumerate the change. On the other hand, when the magnitude of change is small, it will ideally pay a smaller cost. This motivates our search for a change-sensitive algorithm whose computational cost for enumerating the change is proportional to the magnitude of the change in the set of maximal bicliques. We present a change-sensitive algorithm, DynamicBC, for enumerating the new maximal bicliques and subsumed maximal bicliques, when a set of new edges H are added to the bipartite graph G. The algorithm DynamicBC has two parts, NewBC, for enumerating new maximal bicliques, and SubBC, for enumerating subsumed maximal bicliques. When a batch of new edges H of size ρ is added to the graph, the time complexity of NewBC for enumerating Υnew , the set of new maximal bicliques, is O(∆2 ρ|Υnew |) where ∆ is the maximum degree of the graph after update. The time complexity of SubBC for enumerating Υdel , the set of subsumed bicliques, is O(2ρ |Υnew |). To the best of our knowledge, these are the first provably change-sensitive algorithms for maintaining maximal bicliques in a dynamic graph. Experimental Evaluation: We present an empirical evaluation of our algorithms on real bipartite graphs with million of nodes. Our results shows that the performance of our algorithms are orders of magnitude faster than current approaches. For example, on the actor-movie-1 graph with 640K vertices and 1.4M edges, our algorithm took about 30 milliseconds for computing the change due to Related Work Maximal Biclique enumeration (MBE) on a static graph: There has been substantial prior work on enumerating maximal bicliques from a static graph. Alexe et al. [5] propose an algorithm for MBE from a static graph based on the consensus method, whose time complexity is proportional to the size of the output (number of maximal bicliques in the graph) - termed as output-sensitive algorithm. Liu et al. [22] propose an algorithm for MBE based on depthfirst-search (DFS). Damaschke [7] propose an algorithm for bipartite graphs with a skewed degree distribution. Gély et al. [13] propose an algorithm for MBE through a reduction to maximal clique enumeration (MCE). However, in their work, the number of edges in the graph used for enumeration increases significantly compared to the original graph. Makino & Uno [24] propose an algorithm for MBE based on matrix multiplication, which provides the current best time complexity for dense graphs. Eppstein [12] proposes a linear time algorithm for MBE when the input graph has bounded arboricity. Other works on sequential algorithm for MBE on a static graph include [9], [10]. [25], [33], [31] present parallel algorithms for MBE and MCE for the MapReduce framework. [20] show a correspondence between closed itemsets in a transactional database and maximal cliques in an appropriately defined graph. Dense Structures from Dynamic Graphs: There have been some prior works related to maintenance of dense structures similar to maximal bicliques in dynamic graphs. Kumar et al. [18] define (i, j)-core which is a biclique with i vertices in one partition and j vertices in another partition. In their work, the authors propose a dynamic algorithm for extracting non-overlapping maximal set of (i, j)-cores for interesting communities. [30], [21], [16] present methods for maintaining k -cores and k -trusses in a dynamic graph, and [8] present algorithms for maintaining maximal cliques in a dynamic graph. Roadmap: The remaining section are organized as follows. We present definitions and preliminaries in Section 2. Then we describe our algorithms in Section 3, results on the size of change in the set of maximal bicliques in Section 4, and experimental results in Section 5. 2 P RELIMINARIES Let V (G) denote the set of vertices of G and E(G) the set of edges in G. Let n and m denote the number of vertices and number of edges in G respectively. Let ΓG (u) denote the set of vertices adjacent to vertex u in G. If the graph G is clear from the context, we use Γ(u) to mean ΓG (u). For an edge e = (u, v) ∈ E(G), let G − e denote the graph after deleting e ∈ E(G) from G and G + e denote the graph after adding e ∈ / E(G) to G. For a set of edges H , let G + H (G − H ) denote the graph obtained after adding (deleting) H to (from) E(G). Similarly, for a vertex v ∈ / V (G), let G + v denote the graph after adding v to G and for a vertex v ∈ V (G), let G − v denote the graph after deleting v and all its adjacent edges from E(G). Let ∆(G) denote the maximum 3 For graph G and set of edges H , we use Υnew to mean Υnew (G, G + H), and Υdel to mean Υdel (G, G + H). Algorithm 1: DynamicBC(G, H, BC(G)) Input: G - Input bipartite graph, H - Edges being added to G, BC(G) Output: Υ : the union of set of new maximal bicliques and subsumed bicliques new 1 Υ ← NewBC(G, H) del 2 Υ ← SubBC(G, H, BC(G), Υnew ) new 3 Υ ← Υ ∪ Υdel Fig. 2: Cocktail-party graph on 6 vertices CP (3) degree of a vertex in G and δ(G) the minimum degree of a vertex in G. Definition 1 (Change-Sensitive Algorithm). An algorithm for a dynamic graph stream is called change-sensitive if its time complexity of enumerating the change in a graph property is proportional to the magnitude of change. Results for a static graph. In [27], Prisner presented the following result on the number of maximal bicliques in a bipartite graph with n vertices. We first present Algorithm NewBC for enumerating new cliques in Section 3.1, and Algorithm NewBC for enumerating subsumed cliques in Section 3.2. The main result on the time complexity of DynamicBC is summarized in the following theorem. Theorem 3. DynamicBC is a change-sensitive algorithm for enumerating the change in the set of maximal bicliques, with time complexity O(∆2 ρ|Υnew |+2ρ |Υnew |) where ∆ is the maximum degree of a vertex in G + H and ρ is the size of H . 3.1 Enumerating New Maximal Bicliques Theorem 1 (Theorem 2.1 [27]). Every bipartite graph with n n vertices contains at most 2 2 ≈ 1.41n maximal bicliques, and the only extremal (maximal) bipartite graphs are the graphs CP (k). Here, CP (k) denotes the cocktail-party graph which is a bipartite graph with k vertices in each partition where V (CP (k)) = {a1 , a2 , . . . , ak , b1 , b2 , . . . , bk } and E(CP (k)) = {(ai , bp ) : i 6= p} [27]. See Figure 2 for an example. As a subroutine, we use an algorithm for enumerating maximal bicliques from a static undirected graph, whose runtime is proportional to the number of maximal bicliques. There are a few algorithms of this kind [5], [22], [35]. We use the following result due to Liu et al. [22] as it provides best possible time and space complexity. Theorem 2 (Liu et al., [22]). For a graph G with n vertices, m edges, maximum degree ∆, and number of maximal bicliques µ, there is an algorithm MineLMBC for enumerating maximal bicliques in G with time complexity O(n∆µ) and space complexity O(m + ∆2 ). MineLMBC is depth-first-search (DFS) based algorithm for enumerating maximal bicliques of a static graph G = (V, E). It takes as input the graph G and the size threshold s. The algorithm enumerates all maximal bicliques of G with size of each partition at least s. Clearly, by setting s = 1, the algorithm enumerates all maximal bicliques of G. 3 C HANGE -S ENSITIVE A LGORITHM FOR M AXIMAL B ICLIQUES In this section, we present a change-sensitive algorithm DynamicBC for enumerating the change in the set of maximal bicliques. The algorithm has two parts : (1) Algorithm NewBC for enumerating new maximal bicliques, and (2) Algorithm SubBC for enumerating subsumed bicliques. Fig. 3: The original graph G has 4 maximal bicliques. When new edges in H (in dotted line) are added to G, all maximal bicliques in G remain maximal in G + H and only one maximal biclique is newly formed (< {a3 , a4 }, {b3 , b4 } >). Let G0 denote the graph G + H . A baseline algorithm for enumerating new maximal bicliques in G0 is to (1) enumerate all maximal bicliques in G, (2) enumerate all maximal bicliques in G0 both using an output-sensitive algorithm such as [22], and then (3) compute BC(G0 ) \ BC(G). However, this is not change-sensitive, since we need to compute all maximal bicliques of G0 each time, but it is possible that most of the maximal bicliques in G0 are not new. For example, see Fig. 3. We next present an approach that overcomes this difficulty. For each new edge e ∈ H , let BC 0 (e) denote the set of maximal bicliques in G0 containing edge e. Lemma 1. Υnew = ∪e∈H BC 0 (e). Proof. Each biclique in Υnew must contain at least one edge from H . To see this, consider a biclique b ∈ Υnew . If b did not contain an edge from H , then b is also a maximal biclique in G, and hence cannot belong to Υnew . Hence, b ∈ BC 0 (e) for some edge e ∈ H , and b ∈ ∪e∈H BC 0 (e). This shows that Υnew ⊆ ∪e∈H B 0 (e). 4 Fig. 4: Construction of G0e from G0 = G + H when a set of new edges H = {e, h} is added to G. A = ΓG0 (v) = {u, x} and B = ΓG0 (u) = {v, y}. Next consider a biclique b ∈ ∪e∈H BC 0 (e). It must be the case that b ∈ BC 0 (h) for some h in H . Thus b is a maximal biclique in G + H , and b contains edge h ∈ H and b cannot be a biclique in G. Thus b ∈ Υnew . This shows that ∪e∈H BC 0 (e) ⊆ Υnew . Next, for each edge e = (u, v) ∈ H , we present an efficient way to enumerate all bicliques in BC 0 (e) through enumerating maximal bicliques in a specific subgraph G0e of G0 , constructed as follows. Let A = ΓG0 (u) and B = ΓG0 (v). Then G0e = (A, B, E 0 ) is a subgraph of G0 induced by vertices in A and B . See Fig. 4 for an example of the construction of G0e . Lemma 2. For each e ∈ H , BC 0 (e) = BC(G0e ) Proof. First we show that BC 0 (e) ⊆ BC(G0e ). Consider a biclique b = (X, Y ) in BC 0 (e). Let e = (u, v). Here b contains both u and v . Suppose that u ∈ X and v ∈ Y . According to the construction G0e contains all the vertices adjacent to u and all the vertices adjacent to v . And in b, all the vertices in X are connected to all the vertices in Y . Hence, b is a biclique in G0e . Also, b is a maximal biclique in G0 , and G0e is an induced subgraph of G0 which contains all the vertices of b. Hence, b is a maximal biclique in G0e . Next we show that BC(G0e ) ⊆ BC 0 (e). Consider a biclique b0 = (X 0 , Y 0 ) in BC(G0e ). Clearly, b0 contains e as it contains both u and v and b0 is a maximal biclique in G0e . Hence, b0 is also a biclique in G0 that contains e. Now we prove that b0 is also maximal in G0 . Suppose not, that there is a vertex w ∈ V (G0 ) such that b0 can be extended with w. Then, as per the construction of G0e , w ∈ V (G0e ) since w must be adjacent to either u or v . Then, b0 is not maximal in G0e . This is a contradiction. Hence, b0 is also maximal in G0 . Therefore, b0 ∈ BC 0 (e). Based on the above observation, we present our changesensitive algorithm NewBC (Algorithm 2). We use an outputsensitive algorithm for a static graph MineLMBC for enumerating maximal bicliques from G0e . Note that typically, G0e is much smaller than G0 since it is localized to edge e, and hence enumerating all maximal bicliques from G0e should be relatively inexpensive. Theorem 4. NewBC enumerates the set of all new bicliques arising from the addition of H in time O(∆2 ρ|Υnew |) where ∆ is the maximum degree of a vertex in G0 and ρ is the size of H . The space complexity is O(|E(G0 )| + ∆2 ). Proof. First we consider correctness of the algorithm. From Lemma 1 and Lemma 2, we know that Υnew is enumerated by enumerating BC(G0e ) for every e ∈ H . Our algorithm Algorithm 2: NewBC(G, H) Input: G - Input bipartite graph, H - Edges being added to G Output: bicliques in Υnew , each biclique output once 1 Consider edges of H in an arbitrary order e1 , e2 , . . . , eρ 0 2 G ← G+H 3 for i = 1 . . . ρ do 4 e ← ei = (u, v) 5 G0e ← a subgraph of G0 induced by ΓG0 (u) ∪ ΓG0 (v) 6 Generate bicliques of G0e using MineLMBC. For each biclique thus generated, output b only if b does not contain an edge ej for j < i does this exactly, and use the MineLMBC algorithm for enumerating BC(G0e ). For the runtime, consider that the algorithm iterates over each edge e in H . In each iteration, it constructs a graph G0e and runs MineLMBC(G0e ). Note that the number of vertices in G0e is no more than 2∆, since it is the size of the union of the edge neighborhoods of ρ edges in G0 . The set of maximal bicliques generated in each iteration is a subset of Υnew , therefore the number of maximal bicliques generated from each iteration is no more than |Υnew |. From Theorem 2, we have that the runtime of each iteration is O(∆2 |Υnew |). Since there are ρ edges in H , the result on runtime follows. For the space complexity, we note that the algorithm does not store the set of new bicliques in memory at any point. The space required to construct G0e is linear in the size of G0 . From Theorem 2, the total space requirement is O(|E(G0 )| + ∆2 ). 3.2 Enumerating Subsumed Maximal Bicliques We now present a change-sensitive algorithm for enumerating BC(G) \ BC(G0 ) where G0 = G + H . Suppose a new maximal biclique b of G0 subsumed a maximal biclique b0 of G. Note that b0 is also a maximal biclique in b − H . So, one idea is to enumerate all maximal bicliques in b − H and then check which among them is maximal in G. However, checking maximality of a biclique is costly operation since we need to consider neighborhood of every vertex in the biclique. Another idea is to store the bicliques of the graph explicitly and see which among the generated bicliques are contained in the set of maximal bicliques of G. This is not desirable either since large amount of memory is required to store the set of all maximal bicliques of G. A more efficient approach is to store the signatures of the maximal bicliques instead of storing the bicliques themselves. Then, we enumerate all maximal bicliques in b − H and for each biclique generated, we compare the signature of the generated biclique with the signatures of the bicliques stored. An algorithm following this idea is presented in Algorithm 3. In this algorithm we reduce the cost of main memory by storing the signatures. We use a standard hash function (such as 64 bit murmur hash 1 ) for 1. https://sites.google.com/site/murmurhash/ 5 computing signatures of maximal bicliques. For computing the signature, first we represent a biclique in canonical form (vertices in first partition represented in lexicographic order followed by vertices in another partition represented in lexicographic order). Then we convert the string into bytes, and apply hash function on the computed bytes. The hash function returns signature as output. By storing the signatures instead of maximal bicliques, we are able to check whether a maximal biclique from b − H is contained in the set of maximal bicliques of G by comparing their hash values. Thus we pay much less cost in terms of memory by storing the signatures of bicliques. Now we prove that Algorithm 3 indeed enumerates all maximal bicliques of b − H . Lemma 3. In Algorithm 3, for each b ∈ Υnew , S after Line 14 contains all maximal bicliques in b − H . Proof. First observe that, removing H from b is equivalent to removing those edges in H which are present in b. Hence, computing maximal bicliques in b−H reduces to computing maximal bicliques in b − H1 where H1 is the set of all edges in H which are present in b. We use induction on the number of edges k in H1 . Consider the base case, when k = 1. H1 contains a single edge e1 = {u, v}. Clearly, b − H1 has two maximal bicliques b \ {u} and b \ {v}. Suppose, that the set H1 is of size k . Our inductive hypothesis is that all maximal bicliques in b − H1 are enumerated. Consider H10 = {e1 , e2 , ..., ek , ek+1 } with k + 1 edges. Now each maximal biclique b0 in b − H1 either remains maximal within b − H10 (if at least one endpoint of ek+1 is not in b0 ) or generates two maximal bicliques in b − H10 (if both endpoints of ek+1 are in b0 ). Thus, for each b ∈ Υnew , S after Line 14 contains all maximal bicliques within b − H . Now we show that the algorithm described above is a change-sensitive algorithm for enumerating all elements of Υdel when the number of edges ρ in H is constant. Theorem 5. Algorithm 3 enumerates all bicliques in Υdel = BC(G) − BC(G + H) using time O(2ρ |Υnew |) where ρ is the number of edges in H . The space complexity of the algorithm is O(|E(G0 )| + |V (G0 )| + ∆2 + |BC(G)|). Proof. We first show that every biclique b0 enumerated by the algorithm is indeed a biclique in Υdel . Note that b0 is a maximal biclique in G, due to explicitly checking the condition. Further, b0 is not a maximal biclique in G+H , since it is a proper subgraph of b, a maximal biclique in G + H . Next, we show that all bicliques in Λdel are enumerated. Consider any subsumed biclique b0 ∈ Λdel . It must be contained within b \ H , where b is a maximal biclique within Λnew . Moreover, b0 will be a maximal biclique within b \ H , and will be enumerated by the algorithm according to Lemma 3. For the time complexity we show that for any b ∈ Υnew , the maximum number of maximal bicliques in b − H is 2ρ using induction on ρ. Suppose ρ = 1 so that H contains a single edge, say e1 = (u, v). Then, b − H has two maximal bicliques, b \ {u} and b \ {v}, proving the base case. Suppose that for any set H of size k , it was true that b − H has no more than 2k maximal bicliques. Consider a set H 00 = {e1 , e2 , . . . , ek+1 } with k + 1 edges. Algorithm 3: SubBC(G, H, BC, Υnew ) Input: G - Input bipartite graph H - Edge set being added to G BC - Set of maximal bicliques in G Υnew - set of new maximal bicliques in G + H Output: All cliques in Υdel = BC(G) \ BC(G + H) del 1 Υ ←∅ new 2 for b ∈ Υ do 3 S ← {b} 4 for e = (u, v) ∈ E(b) ∩ H do 5 S0 ← φ 6 for b0 ∈ S do 7 if e ∈ E(b0 ) then 8 b1 = b0 \ {u} ; b2 = b0 \ {v} 9 S 0 ← S 0 ∪ b1 ; S 0 ← S 0 ∪ b2 10 11 12 else S 0 ← S 0 ∪ b0 /* S 0 contains all the maximal bicliques in b − {e1 , e2 , ..., ek } where {e1 , e2 , ..., ek } ⊆ E(b) ∩ H are considered so far. */ 13 14 15 16 17 S ← S0 for b0 ∈ S do if b0 ∈ BC then Υdel ← Υdel ∪ b0 Let H 0 = {e1 , e2 , . . . , ek }. Subgraph b − H 00 is obtained from b − H 0 by deleting a single edge ek+1 . By induction, we have that b − H 0 has no more than 2k maximal bicliques. Each maximal biclique b0 in b − H 0 either remains a maximal biclique within b − H 00 (if at least one endpoint of ek+1 is not in b0 ), or leads to two maximal bicliques in b − H 00 (if endpoints of ek+1 are in different bipartition of b0 ). Hence, the number of maximal bicliques in b − H 00 is no more than 2k+1 , completing the inductive step. Following this, for each biclique b ∈ Υnew , we need to check for maximality for no more than 2ρ bicliques in G. This checking can be performed by checking whether each such generated biclique in contained in the set BC(G) and for each biclique, this can be done in constant time. For the space bound, we first note that in Algorithm 3, enumerating maximal bicliques within b − H consumes space O(|E(G0 )| + ∆2 ), and checking for maximality can be done in space linear in size of G. However, for storing the maximal bicliques in G takes O(|BC(G)|) space. Hence, for these operations, the overall space-cost for each b ∈ Υnew is O(|E(G0 )| + |V (G0 )| + ∆2 + |BC(G)|). The only remaining space cost is the size of Υnew , which can be large. Note that, the algorithm only iterates through Υnew in a single pass. If elements of Υnew are provided as a stream from the output of an algorithm such as NewBC, then they do not need to be stored within a container, so that the memory cost of receiving Υnew is reduced to the cost of storing a single maximal biclique within Υnew at a time. 6 Algorithm 4: Decremental(G,H) Input: G - Input bipartite graph, H - Edges being deleted from G Output: Υnew (G, G − H) ∪ Υdel (G, G − H) new 1 Υ ← φ; Υdel ← φ; G00 ← G − H del 2 Υ ← NewBC(G00 , H) new 3 Υ ← SubBC(G00 , H, BC(G00 ), Υdel ) new 4 returnΥ ∪ Υdel 3.3 Decremental and Fully Dynamic Cases We now consider the maintenance of maximal bicliques in the decremental case, when edges are deleted from the graph. This case can be handled using a reduction to the incremental case. We show that the maintenance of maximal bicliques due to deletion of a set of edges H from a bipartite graph G is equivalent to the maintenance of maximal bicliques due to addition of H to the bipartite graph G − H . Lemma 4. Υnew (G, G − H) = Υdel (G − H, G) and Υdel (G, G − H) = Υnew (G − H, G) Proof. Note that Υnew (G, G − H) is the set of all bicliques that are maximal in G − H , but not in G. By definition, this is equal to Υdel (G − H, G). Similarly we can show that Υdel (G, G − H) = Υnew (G − H, G). Based on the above lemma, an algorithm for the decremental case is presented in Algorithm 4. For the fully dynamic case, where we need to consider both the addition and deletion of edges, we first compute the changes due to addition of edges, followed by changes due to deletion of edges. 4 M AGNITUDE OF CHANGE IN B ICLIQUES We consider the maximum change in the set of maximal bicliques when a set of edges is added to the bipartite graph. Let λ(n) denote the maximum size of Υ(G, G + H) taken over all n vertex bipartite graphs G and edge sets H . We derive the following upper bound on the maximum size of Υ(G, G + H) in the following Lemma: Lemma 5. λ(n) ≤ 2g(n). Proof. Note that, for any bipartite graph G with n vertices and for any new edge set H it must be true that |BC(G)| ≤ g(n) and |BC(G + H)| ≤ g(n). Since |Υnew (G, G + H)| ≤ |BC(G + H)| and |Υdel (G, G + H)| ≤ |BC(G)|, it follows that |Υ(G, G + H)| ≤ |BC(G + H)| + |BC(G)| ≤ 2g(n). Next we analyze the upper bound of |Υ(G, G + e)| in the following when an edge e ∈ / E(G) is added to G. Fig. 5: Construction showing the changes in the set of maximal bicliques when a new edge is added. G is in the left on n = 6 vertices. G00 consists of vertices in L0 and R0 and edges among them to make it a cocktail-party graph. G0 in the right is obtained by adding edge e = (u, v) to G. large as 3g(n − 2) in Lemma 9 we prove that the size of Υ(G, G + e) is at most 3g(n − 2). Lemma 6. For any even integer n > 2 there exists a bipartite graph G on n vertices and an edge e = (u, v) ∈ / E(G) such that |Υ(G, G + e)| = 3g(n − 2). Proof. We use proof by construction. Consider bipartite graph G = (L, R, E) constructed on vertex set U ∪ V with n vertices such that |L| = |R| = n/2. Let u ∈ L and v ∈ R be two vertices and let L0 = L \ {u} and R0 = R \ {v}. Let G00 denote the induced subgraph of G on vertex sets L0 and R0 . In our construction, G00 is CP ( n2 − 1). In graph G, in addition to the edges in G00 , we add an edge from each vertex in R0 to u and an edge from each vertex in L0 to v . We add edge e = (u, v) to G to get graph G0 = G + e (see Fig. 5 for construction). We claim that the size of Υ(G, G0 ) is 3g(n − 2). First, we note that the total number of maximal bicliques in G is 2g(n−2). Each maximal biclique in G contains either vertex u or v , but not both. The number of maximal bicliques that contain vertex u is g(n−2), since each maximal biclique in G00 leads to a maximal biclique in G by adding u. Similarly, the number of maximal bicliques in G that contains v is g(n − 2), leading to a total of 2g(n − 2) maximal bicliques in G. Next, we note that the total number of maximal bicliques in G0 is g(n − 2). To see this, note that each maximal biclique in G0 contains both vertices u and v . Further, for each maximal biclique in G00 , we get a corresponding maximal biclique in G0 by adding vertices u and v . Hence the number of maximal bicliques in G0 equals the number of maximal bicliques in G00 , which is g(n − 2). No maximal biclique in BC(G) contains both u and v , while every maximal biclique in G0 contains both u and v . Hence, BC(G) and BC(G0 ) are disjoint sets, and |Υ(G, G0 )| = |BC(G)| + |BC(G0 )| = 3g(n − 2). Theorem 6. For an integer n ≥ 2, a bipartite graph G = (L, R, E) with n vertices, and any edge e = (u, v) ∈ / E(G), u ∈ U, v ∈ V , the maximum size of Υ(G, G + e) is 3g(n − 2), and for each even n, there exists a bipartite graph that achieves this bound. Lemma 7. If e = (u, v) ∈ / E(G) is inserted to G where u ∈ L, v ∈ R, all new maximal bicliques in G + e must contain e. We prove this theorem in the following two lemmas. In Lemma 6 we prove that the size of Υ(G, G + e) can be as Proof. Proof by contradiction. Assume that there is a new maximal biclique b = (b1 , b2 ) in BC(G + e) − BC(G) that Now we will prove a few results that we will use in proving Lemma 9. 7 does not contain e. Then b must be present in G but is not maximal in G, and there must be another vertex w ∈ L (or R) that can be added to b while remaining a biclique. Clearly, w can be added to biclique b in G + e also, so that b is not maximal in G + e, contradicting our assumption. Lemma 8. If e = (u, v) is added to G, each biclique b ∈ BC(G) − BC(G + e) contains either u or v . Proof. Proof by contradiction. Suppose there is maximal biclique b = (b1 , b2 ) in BC(G) − BC(G + e) that contain neither u nor v . Then, b must be maximal biclique in G. Since b is not maximal biclique in G + e, b is contained in another maximal biclique b0 = (b01 , b02 ) in G + e. From Lemma 7, b0 must contain edge e = (u, v), and hence, both vertices u and v . Since b0 is a biclique, every vertex in b02 is connected to u in G0 . Hence, every vertex in b2 is connected to u even in G. Therefore, b ∪ {u} is a biclique in G, and b is not maximal in G, contradicting our assumption. Observation 1. For a bipartite graph G = (L, R, E) and a vertex u ∈ V (G), the number of maximal bicliques that contains v is at most g(n − 1). Proof. Suppose, u ∈ L. Then each maximal biclique b in G that contains u, corresponds to a unique maximal biclique in G − {u}. Such maximal bicliques can be derived from b by deleting u from b. As the maximum number of maximal bicliques in G − {u} is g(n − 1), maximum number of maximal bicliques in G can be no more than g(n − 1). Observation 2. The number of maximal bicliques containing a specific edge (u, v) is at most g(n − 2). Proof. Consider an edge (u, v) ∈ E(G). Let vertex set V 0 = (ΓG (u)∪ΓG (v))−{u, v}, and let G0 be the subgraph of G induced by V 0 . Each maximal biclique b in G that contains edge (u, v) corresponds to a unique maximal biclique in G0 by simply deleting vertices u and v from b. Also, each maximal biclique b0 in G0 corresponds to a unique maximal biclique in G that contains (u, v) by adding vertices u and v to b0 . Thus, there is a bijection between the maximal bicliques in G0 and the set of maximal bicliques in G that contains edge (u, v). The number of maximal bicliques in G0 can be at most g(n − 2) since G0 has no more than (n − 2) vertices, completing the proof. Lemma 9. For a bipartite graph G = (L, R, E) on n vertices and edge e = (u, v) ∈ / E(G), the size of Υ(G, G + e) can be no larger than 3g(n − 2). Proof. Proof by contradiction. Suppose there exists a bipartite graph G = (L, R, E) and edge e ∈ / E(G) such that |Υ(G, G+e)| ≥ 3g(n−2). Then either |BC(G+e)−BC(G)| ≥ g(n − 2) or |BC(G) − BC(G + e)| ≥ 2g(n − 2). Case 1: |BC(G + e) − BC(G)| ≥ g(n − 2): This means that total number of new maximal bicliques formed due to addition of edge e is larger than g(n − 2). From Lemma 7, each new maximal biclique formed due to addition of e must contain e. From Observation 2, the total number of maximal bicliques in an n vertex bipartite graph containing a specific edge can be at most g(n − 2). Thus, the number of new maximal bicliques after adding edge e is at most g(n − 2), contradicting our assumption. Case 2: |BC(G)−BC(G+e)| ≥ 2g(n−2): Using Lemma 8, each maximal biclique b ∈ BC(G) − BC(G + e) must contain either u or v , but not both. Suppose that b contains u but not v . Then, b must be a maximal biclique in G − v . Using Observation 1, we see that the number of maximal bicliques in G − v that contains a specific vertex u is no more than g(n − 2). In a similar way, the number of possible maximal bicliques that contain v is at most g(n − 2). Therefore, the total number of maximal bicliques in BC(G) − BC(G + e) is at most 2g(n − 2), contradicting our assumption. Combining Lemma 5, Theorem 6 and using the fact that 3g(n − 2) = 1.5g(n) for even n, we obtain the following when n is even: Theorem 7. 1.5g(n) ≤ λ(n) ≤ 2g(n) 5 E XPERIMENTAL E VALUATION In this section, we present results of an experimental evaluation of our algorithms. 5.1 Data We consider the following real-world bipartite graphs in our experiments. A summary of the datasets is presented in Table 1. In the actor-movie [1] graph, vertices consist of actors in one bipartition and movies in another bipartition. There is an edge between an actor and a movie if the actor played in that movie. In the dblp-author [2] graph, vertices consist of authors in one partition and the publications in another partition. Edges connect authors to their publications. In the epinions-rating [3] graph, vertices consist of users in one partition and products in another partition. There is an edge between a user and a product if the user rated the product. Also, the edges have timestamps of their creation. In the flickr-membership [4] graph, vertices consists of users and groups. There is an edge between a user and a group if that user is a member of that group. We converted the above graphs into dynamic graphs by creating edge streams as follows: For actor-movie, dblp-author, and flickr-membership we created initial graphs by retaining each edge in the original graph with probability 0.1 and deleting the rest. Then the deleted edges are added back as an edge stream, until the original graph is reached. We named the initial graphs as actor-movie-1, dblp-author-1, and flickr-membership-1. For the epinions-rating graph, we created the initial graph by retaining initial 10% edges of the original graph according to their timestamps, and considered rest of the edges for creating the edge stream in timestamp ordering. We named the initial graph as epinions-rating-init. In Table 1, the number of edges of the initial graph is in the column Edges(initial) and the number of edges when we end the experiment is in column Edges(final). 5.2 Experimental Setup and Implementation Details We implemented our algorithms using Java on a 64-bit Intel(R) Xeon(R) CPU clocked at 3.10 Ghz and 8G DDR3 RAM with 6G heap memory space. Unless otherwise specified, we considered batches of size 100. 8 TABLE 1: Summary of Graphs Used Dataset actor-movie-1 dblp-author-1 epinions-rating-init flickr-membership-1 Nodes Edges(initial) Edges(final) Edges(original graph) Avg. deg.(original graph) 639286 6851776 996744 895589 146917 864372 1366832 855179 1470404 8649016 1631832 1355179 1470404 8649016 13668320 8545307 6 3 31 35 0.04 Initial-graph DynamicBC BaselineBC actor-movie-1 dblp-author-1 epinion-rating-init flickr-membership-1 30 ms. 20 ms. 3.5 sec. 0.5 sec. > 30 min. > 20 hours > 10 hours 1 hour DynamicBC 0.035 0.03 0.025 0.02 0.015 0.01 0.005 0 1-1K 4K-5K 8K-9K 12K-13K Iteration range Avg. comp. time in range Avg. comp. time in range TABLE 2: Comparison with Baseline: computation time for adding a single batch of size 100 0.03 0.02 0.015 0.01 0.005 0 1-1K DynamicBC 18 16 14 12 10 8 6 4 1-.25K 1K-1.25K Iteration range 39K-40K Iteration range 77K-78K (b) dblp-author-1 2.5K-2.6K Avg. comp. time in range Avg. comp. time in range (a) actor-movie-1 20 DynamicBC 0.025 7 6 DynamicBC 5 4 3 2 1 0 1-1K 2K-3K Iteration range 4K-5K (d) flickr-membership-1 (c) epinions-rating-init Fig. 6: Computation time (in sec.) for enumerating the change in maximal bicliques, per batch of edges. Metrics: We evaluate our algorithms using the following metrics: (1) computation time for new maximal bicliques and subsumed bicliques when a set of edges are added, (2) change-sensitiveness, that is, the total computation time as a function of the size of change. We measure the size of change as the sum of the total number of edges in the new maximal bicliques and the subsumed bicliques, and (3) space cost, that is the memory used by the algorithm for storing the graph, and other data structures used by the algorithm, and (4) cumulative computation time for different batch sizes, that is the cumulative computation time from the initial graph to the final graph while using different batch size. 5.3 Discussion of Results Comparison with Baseline. We compared the performance of our algorithm, DynamicBC, with a baseline algorithm for maintaining maximal bicliques, we have implemented 0.04 0.035 0.03 0.025 0.02 0.015 0.01 0.005 0 NewBC SubBC K 0K 13 K -1 K1 3K 6K 9K 12 14K 7K Avg. comp. time in range Avg. comp. time in range 9 0.03 0.025 0.02 0.015 0.01 0.005 0 Iteration range K 5K -2K 2.6 K 1.2 K K5 5 .2 5 7 12. 1K 1. Iteration range (c) epinions-rating-init (b) dblp-author-1 Avg. comp. time in range Avg. comp. time in range NewBC SubBC 1K 1K 1K 1K 8K -3 -4 -6 -7 -7 K K K K K 30 40 60 70 77 Iteration range (a) actor-movie-1 20 18 16 14 12 10 8 6 4 2 0 NewBC SubBC 7 6 5 NewBC SubBC 4 3 2 1 0 2K -3K -4K -5K 1K K2K 3K 4K 11 Iteration range (d) flickr-membership-1 Fig. 7: Computation time (in sec.) broken down into time for new and subsumed bicliques algorithm that we call BaselineBC. The baseline algorithm computes Υ(G, G + H) by (1) Enumerating BC(G), (2) Enumerating BC(G + H), and (3) computing the difference of the two. We use MineLMBC [22] for enumerating bicliques from a static graph. Table 2 shows a comparison of the runtimes of DynamicBC and BaselineBC. From the table, it is clear that DynamicBC is faster than BaselineBC by two to three orders of magnitude. For instance, for adding a single batch of size 100 to actor-movie-1, BaselineBC takes more than 30 min., whereas DynamicBC takes around 30 ms. Computation Time per Batch of Edges: Let an “iteration” denote the addition of a single batch of edges. Fig. 6 shows the computation time per iteration versus iteration number. From the plots, we observe that the computation time increases as the iteration increases. This trend is consistent with predictions. Note that as computation progresses, the number of edges in the graph increases, and note that the the computation time is proportional to the size of graph as well as size of change (Theorem 3). In Fig. 6(c) we see that computation time decreases suddenly and then again increases. This may seem anomalous, but is explained by noting that in these cases, the magnitude of change decreases in those iterations, and then increases thereafter. In Fig. 7, we show the breakdown of the computation time of DynamicBC into time taken for enumerating new cliques (NewBC) and for enumerating subsumed cliques (SubBC). Observe that the computation time increases for both new maximal bicliques and subsumed bicliques as more batches are added. This is because the graph becomes denser when more batches are added and the time taken to compute the change increases, consistent with Theorem 3. Change-Sensitiveness: Fig. 8 shows the computation time as a function of the size of change. We observe that the computation time of DynamicBC is roughly proportional to the size of change. The computation time of both NewBC and SubBC increases as number of new maximal bicliques and subsumed bicliques increases. Clearly, this observation supports our theoretical analysis. In some plots (Fig. 8(c),8(d)) we see a rapid increase in the computation time with the size of change. This is because, when the graph grows, memory consumption increases considerably and this affects the computation time of the algorithm. Space Cost: Fig. 9 shows the space cost of DynamicBC for different graphs. As SubBC needs to maintain the maximal 0.08 0.07 0.06 0.05 0.04 0.03 0.02 0.01 0 1-10k DynamicBC 20K-30K Size range 40K-70K Avg. comp. time in range Avg. comp. time in range 10 100 DynamicBC 90 80 70 60 50 40 30 20 10 0 100K-1M Size range 0.02 0.015 0.01 0.005 0 1-5K DynamicBC 10K-15K Size range 25K-35K (b) dblp-author-1 100M-1B Avg. comp. time in range Avg. comp. time in range (a) actor-movie-1 0.025 500 DynamicBC 450 400 350 300 250 200 150 100 50 0 100K-1M Size range 100M-1B (d) flickr-membership-1 (c) epinions-rating-init Fig. 8: Computation time (in sec.) for total change vs. size of total change. bicliques in memory for computing subsumed bicliques, we report the space consumption in two cases: (1) when we store the maximal bicliques in memory, (2) when we store the signatures of bicliques in memory instead of storing the bicliques. Signatures consume less memory than the actual bicliques as the signatures have fixed size (64 bits in our case using the murmur hash function) for different sizes of bicliques. Therefore, memory consumption by the algorithm that uses signatures should be smaller than the algorithm that does not use signatures. The trend is also clear in the plots. The difference in memory consumption is not prominent during the initial iterations because, sizes of maximal bicliques are much smaller during initial iterations and therefore memory consumption is mainly due to the graph that we maintain in memory. We are not showing the space cost without hash for the third input graph because the algorithm could not execute on the third input graph without hashing, due to running out of memory. Computation Time for Different Batch Size: Table 3 shows the cumulative computation time for different graphs when we use different batch size. We observe that the total computation time increases when increasing the batch size. The reason for this trend is that the computation time for subsumed cliques increases with increasing batch size, while the computation time for the new maximal bicliques remains almost same across different batch sizes. Note that, the time complexity for SubBC has (in the worst case) an exponential dependence on the batch size. Therefore, the computation time for subsumed cliques tends to increase with an increase in the batch size. However, with a very small batch size (such as 1 or 10), the change in the maximal bicliques is very small, and the overhead can be large. Maintaining Large Maximal Bicliques: We also consider maintaining large maximal bicliques with predefined size threshold s, where it is required that each bipartition of the biclique has size at least s. For large subsumed bicliques, we provide s in addition to other inputs to SubBC as well. Table 4 shows the cumulative computation time by varying the threshold size s from 1 to 6. Clearly, s = 1 means that we maintain all maximal bicliques. As expected, the cumulative computation time decreases significantly in most of the cases as the size threshold s increases. 6 C ONCLUSION In this work, we presented a change-sensitive algorithm for enumerating changes in the set of maximal bicliques in 120 Avg. space cost in range Avg. space cost in range 11 Without hash with hash 100 80 60 40 20 0 1-1K 4K-5K 8K-9K Iteration range 12K-13K 700 Without hash with hash 600 500 400 300 200 100 1-1K 39K-40K Iteration range 350 (b) dblp-author-1 Avg. space cost in range Avg. space cost in range (a) actor-movie-1 With hash 300 250 200 150 100 50 1-.25K 77K-78K 1K-1.25K Iteration range 700 Without hash With hash 600 500 400 300 200 100 0 1-1K 2.5K-2.6K 2K-3K Iteration range 4K-5K (d) flickr-membership-1 (c) epinion-rating-init Fig. 9: Space cost (in MB) TABLE 3: Total computation time (from the initial graph to the final graph) for different batch sizes Initial-graph actor-movie-1 dblp-author-1 epinion-rating-init flickr-membership-1 batch-size-1 batch-size-10 batch-size-100 3.8 min. (3.3 + 0.5) 11.3 min. (9 + 2.3) 3.3 hours (3.1 + .2) 2.1 hours (1.9 + 0.2) 3.8 min. (2.8 + 1) 14.1 min. (8.8 + 5.3) 3.7 hours (3.1 + 0.6) 2.4 hours (1.9 + 0.5) 3.9 min. (2.9 + 1) 15.7 min. (8.3 + 7.4) 7 hours (3.2 + 3.8) 3 hours (2.1 + 0.9) TABLE 4: Total computation time (from initial to final graph) by varying the threshold size s Initial-graph actor-movie-1 dblp-author-1 epinion-rating-init flickr-membership-1 s=1 s=2 s=3 s=4 s=5 s=6 203 sec. 947 sec. 7 hours 3 hours 124 sec. 531 sec. 6.5 hours 2.5 hours 105 sec. 445 sec. 6.3 hours 2.3 hours 100 sec. 403 sec. 6 hours 2.1 hours 103 sec. 399 sec. 5.5 hours 1.9 hours 98 sec. 400 sec. 5 hours 1.6 hours dynamic graph. The performance of this algorithm is proportional to the magnitude of change in the set of maximal bicliques – when the change is small, the algorithm runs faster, and when the change is large, it takes a proportionally longer time. We present near-tight bounds on the maximum possible change in the set of maximal bicliques, due to a change in the set of edges in the graph. Our experimental evaluation shows that the algorithm is efficient in practice, and scales to graphs with millions of edges. This work leads to natural open questions (1) Can we design more efficient algorithms for enumerating the change, especially for enumerating subsumed cliques? (2) Can we parallelize the algorithm for enumerating the change in maximal bicliques? R EFERENCES [1] Actor movies network dataset – KONECT. http://konect. uni-koblenz.de/networks/actor-movie, Oct. 2016. 12 [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] Dblp network dataset – KONECT. http://konect.uni-koblenz.de/ networks/dblp-author, Oct. 2016. Epinions product ratings network dataset – KONECT. http:// konect.uni-koblenz.de/networks/epinions-rating, Oct. 2016. Flickr network dataset – KONECT. http://konect.uni-koblenz. de/networks/flickr-groupmemberships, Oct. 2016. G. Alexe, S. Alexe, Y. Crama, S. Foldes, P. L. Hammer, and B. Simeone. Consensus algorithms for the generation of all maximal bicliques. Discrete Applied Mathematics, 145(1):11–21, 2004. A. Angel, N. Koudas, N. Sarkas, D. Srivastava, M. Svendsen, and S. Tirthapura. Dense subgraph maintenance under streaming edge weight updates for real-time story identification. The VLDB Journal, pages 1–25, 2013. P. Damaschke. Enumerating maximal bicliques in bipartite graphs with favorable degree sequences. Information Processing Letters, 114(6):317–321, 2014. A. Das, M. Svendsen, and S. Tirthapura. Change-sensitive algorithms for maintaining maximal cliques in a dynamic graph. arXiv preprint arXiv:1601.06311, 2016. V. M. Dias, C. M. De Figueiredo, and J. L. Szwarcfiter. Generating bicliques of a graph in lexicographic order. Theoretical Computer Science, 337(1):240–248, 2005. V. M. Dias, C. M. de Figueiredo, and J. L. Szwarcfiter. On the generation of bicliques of a graph. Discrete Applied Mathematics, 155(14):1826–1832, 2007. A. C. Driskell, C. An, J. G. Burleigh, M. M. McMahon, B. C. O’Meara, and M. J. Sanderson. Prospects for building the tree of life from large sequence databases. Science, 306(5699):1172–1174, 2004. D. Eppstein. Arboricity and bipartite subgraph listing algorithms. Information processing letters, 51(4):207–211, 1994. A. Gély, L. Nourine, and B. Sadi. Enumeration aspects of maximal cliques and bicliques. Discrete applied mathematics, 157(7):1447– 1459, 2009. D. Gibson, R. Kumar, and A. Tomkins. Discovering large dense subgraphs in massive graphs. In VLDB, pages 721–732, 2005. R. A. Hanneman and M. Riddle. Introduction to social network methods. http://faculty.ucr.edu/∼hanneman/nettext/. Textbook on the web. X. Huang, H. Cheng, L. Qin, W. Tian, and J. X. Yu. Querying ktruss community in large and dynamic graphs. In SIGMOD, pages 1311–1322, 2014. A. Java, X. Song, T. Finin, and B. L. Tseng. Why we twitter: An analysis of a microblogging community. In WebKDD/SNA-KDD, pages 118–138, 2007. R. Kumar, P. Raghavan, S. Rajagopalan, and A. Tomkins. Trawling the Web for emerging cyber-communities. Computer networks, 31(11):1481–1493, 1999. S. Lehmann, M. Schwartz, and L. K. Hansen. Biclique communities. Physical Review E, 78(1):016108, 2008. J. Li, H. Li, D. Soh, and L. Wong. A correspondence between maximal complete bipartite subgraphs and closed patterns. In European Conference on Principles of Data Mining and Knowledge Discovery, pages 146–156. Springer, 2005. R. Li, J. X. Yu, and R. Mao. Efficient core maintenance in large dynamic graphs. TKDE, 26(10):2453–2465, 2014. G. Liu, K. Sim, and J. Li. Efficient mining of large maximal bicliques. In Data warehousing and knowledge discovery, pages 437– 448. Springer, 2006. D. Lo, D. Surian, K. Zhang, and E.-P. Lim. Mining direct antagonistic communities in explicit trust networks. In CIKM, pages 1013–1018, 2011. K. Makino and T. Uno. New algorithms for enumerating all maximal cliques. In SWAT, pages 260–272. 2004. A. P. Mukherjee and S. Tirthapura. Enumerating maximal bicliques from a large graph using mapreduce. In IEEE BigData Congress, pages 707–716, 2014. N. Nagarajan and C. Kingsford. Uncovering genomic reassortments among influenza strains by enumerating maximal bicliques. In Bioinformatics and Biomedicine, 2008. BIBM’08. IEEE International Conference on, pages 223–230. IEEE, 2008. E. Prisner. Bicliques in graphs i: Bounds on their number. Combinatorica, 20(1):109–117, 2000. J. E. Rome and R. M. Haralick. Towards a formal concept analysis approach to exploring communities on the world wide web. In Formal Concept Analysis, volume 3403 of LNCS, pages 33–48. 2005. [29] M. J. Sanderson, A. C. Driskell, R. H. Ree, O. Eulenstein, and S. Langley. Obtaining maximal concatenated phylogenetic data sets from large sequence databases. Mol. Biol. Evol., 20(7):1036– 1042, 2003. [30] A. E. Sariyüce, B. Gedik, G. Jacques-Silva, K. Wu, and Ü. V. Çatalyürek. Streaming algorithms for k-core decomposition. PVLDB, 6(6):433–444, 2013. [31] M. Svendsen, A. P. Mukherjee, and S. Tirthapura. Mining maximal cliques from a large graph using mapreduce: Tackling highly uneven subproblem sizes. J. Parallel Distrib. Comput., 79-80:104– 114, 2015. [32] P. Valtchev, R. Missaoui, and R. Godin. A framework for incremental generation of closed itemsets. Discrete Applied Mathematics, 156(6):924–949, 2008. [33] Y. Xu, J. Cheng, A. W.-C. Fu, and Y. Bu. Distributed maximal clique computation. In IEEE BigData Congress, pages 160–167, 2014. [34] C. Yan, J. G. Burleigh, and O. Eulenstein. Identifying optimal incomplete phylogenetic data sets from sequence databases. Mol. Phylogenet. Evol., 35(3):528–535, 2005. [35] Y. Zhang, C. A. Phillips, G. L. Rogers, E. J. Baker, E. J. Chesler, and M. A. Langston. On finding bicliques in bipartite graphs: a novel algorithm and its application to the integration of diverse biological data types. BMC bioinformatics, 15(1):1, 2014. Apurba Das is a 4th year Ph.D. student in the department of Computer Engineering at Iowa State University. He received his Masters in Computer Science from Indian Statistical Institute, Kolkata in 2011 and worked for 2 years after that as a software developer at Ixia. His research interests are in the area of graph mining, dynamic and streaming graph algorithms, and large scale data analysis. Dr. Srikanta Tirthapura received his Ph.D. in Computer Science from Brown University in 2002, and his B.Tech. in Computer Science and Engineering from IIT Madras in 1996. He is the Kingland Professor of Data Analytics in the department of Electrical and Computer Engineering at Iowa State University. He has worked at Oracle Corporation and is a recipient of the IBM Faculty Award, and the Warren Boast Award for excellence in Undergraduate Teaching. His research interests include algorithms for largescale data analysis, stream computing, and cybersecurity.
8cs.DS