# Time-Universal Data Compression +
## 3 The Time-Universal Code for the Finite Set of Data Compressors  
### Theoretical Consideration  
Suppose that there is a file \(x_{1}x_{2}...x_{n}\) and data compressors \(\varphi_{1},...,\varphi_{m}\), \(n\geq 1,m\geq 1\). Let, as before, \(v_{i}\) be the time spent on encoding one letter by the data compressor \(\varphi_{i}\),  
\[v_{max}=\max_{i=1,...,n}v_{i},\;\;T=n\,v, \tag{3}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**File** & **Length (bites)** & **Best Compressor** & **Chosen Compressor** & **Chosen/Best (Ratio of Length)** \\ \hline BIB & 111,261 & nanozip & lpaq8 & 1.06 \\ BOOK1 & 768,771 & nanozip & nanozip & 1 \\ BOOK 2 & 610,856 & nanozip & nanozip & 1 \\ GEO & 102,400 & nanozip & ccm & 1.07 \\ NEWS & 377,109 & nanozip & nanozip & 1 \\ OBJ1 & 21,504 & nanozip & tornado & 1.23 \\ OBJ2 & 246,814 & nanozip & lpaq8 & 1.08 \\ PAPER1 & 53,161 & nanozip & tornado & 1.54 \\ PIC & 513,216 & zpaq & bbb & 1.25 \\ PROGC & 39,611 & nanozip & tornado & 1.42 \\ PROGL & 71,646 & nanozip & tornado & 1.44 \\ PROGP & 49,379 & lpaq8 & tornado & 1.4 \\ TRANS & 93,695 & lpaq8 & lpaq8 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Three-step compression. Extra-time \(\delta\) = 0.37. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**File** & **Length (bites)** & **Best Compressor** & **Chosen Compressor** & **Chosen/Best (Ratio of Length)** \\ \hline BIB & 111,261 & nanozip & lpaq8 & 1.06 \\ BOOK1 & 768,771 & nanozip & nanozip & 1 \\ BOOK 2 & 610,856 & nanozip & nanozip & 1 \\ GEO & 102,400 & nanozip & ccm & 1.07 \\ NEWS & 377,109 & nanozip & nanozip & 1 \\ OBJ1 & 21,504 & nanozip & tornado & 1.23 \\ OBJ2 & 246,814 & nanozip & lpaq8 & 1.08 \\ PAPER1 & 53,161 & nanozip & tornado & 1.52 \\ PIC & 513,216 & zpaq & bbb & 1.25 \\ PROGC & 39,611 & nanozip & tornado & 1.42 \\ PROGL & 71,646 & nanozip & tornado & 1.44 \\ TRANS & 93,695 & lpaq8 & lpaq8 & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Three-step compression. Extra-time \(\delta\) = 0.74.  
and let  
\[\hat{T}=T(1+\delta)\,,\ \delta>0. \tag{4}\]  
The goal is to find the data compressor \(\varphi_{j}\), \(j=1,...,m\), that compresses the file \(x_{1}x_{2}...x_{n}\) in the best way in time \(\hat{T}\). Apparently, the following two-step method is the simplest. Step 1. Calculate \(r=\lfloor\delta T/(mv_{max})\rfloor\). Step 2. Compress the file \(x_{1}x_{2}...x_{r}\) by \(\varphi_{1}\) and find the length of compressed file \(|\varphi_{1}(x_{1}...x_{r})|\), then, likewise, find \(|\varphi_{2}(x_{1}...x_{r})|\), etc. Step 3. Calculate \(s=\arg\min_{i=1,...,m}|\varphi_{i}(x_{1}...x_{r})|\)  
Step 4. Compress the whole file \(x_{1}x_{2}...x_{n}\) by \(\varphi_{s}\) and compose the codeword \(\langle s\rangle\)\(\varphi_{s}(x_{1}...x_{n})\), where \(\langle s\rangle\) is \(\lceil\log m\rceil\)-bit word with the presentation of \(s\). It will be shown that even this simple method is time universal. On the other hand, there are a lot of quite reasonable approaches to build the time-adaptive codes. For example, it could be natural to try a three step procedure, which was considered in the previous part (see Tables 1 and 2), as well as many other versions. Probably, it could be useful to use multidimensional optimization approaches, such as machine learning, so-called deep learning, etc. That is why, we consider only some general conditions needed for time-universality. Let us give some needed definitions. Suppose, a time-adaptive data-compressor \(\hat{\Phi}\) is applied to \(x=x_{1}...x_{t}\). For any \(\varphi_{i}\) we define  
\[\tau_{i}(t)=\max\{r:\varphi_{i}(x_{1}...x_{r})\text{ was calculated, when extra time }\delta T\text{ was exhausted}\}.\]  
**Theorem 1**. : _Let there be an infinite word \(x_{1}x_{2}...\) and time-adaptive method \(\hat{\Phi}\) which is based on the finite set of data compressors \(\phi_{1},...,\phi_{m}\).