The characteristic analysis carried out above is now applied to specific solid mechanics problems.
Both linear and non-linear problems, whose solutions involve several types of waves, are considered.
As we shall see, the different characteristic structures involved within linear elastic, elastoplastic and hyperelastic solids require the use of different techniques in order to develop exact solutions. First a particular type of IVP, of particular interest in this manuscript, is introduced.
%% Then by specializing the results to problems involving a linear elastic bar and a hyperelastic Saint-Venant-Kirchhoff medium, we shall see that different types of waves may propagate within solids.
\subsection{The Riemann problem}
A Riemann problem is a Cauchy problem with piecewise constant initial data. In particular, the Riemann problem based on the conservative form \eqref{eq:general_conservative_HE} for hyperelastic solids, in the arbitrary direction $\vect{N}=N_\alpha \vect{E}_\alpha$, takes the form:
\begin{equation}
  \label{eq:Riemann_problem_HE}
  \begin{aligned}
    &\Ucb_t + \drond{\Fcb\cdot \vect{N}}{X_N} = \Scb, \\
    &\left\lbrace
      \begin{aligned}
        & \Ucb(X_N,t=0) = \Ucb^L \quad \text{if } X_N< 0\\
        & \Ucb(X_N,t=0) = \Ucb^R \quad \text{if } X_N> 0
      \end{aligned}
    \right.
  \end{aligned}
\end{equation}
Analogously, for small strains one writes the Riemann problem corresponding to conservative forms \eqref{eq:general_conservative} or \eqref{eq:general_conservative_EP} in the direction $\vect{n}=n_i \vect{e}_i$:
\begin{equation}
  \label{eq:Riemann_problem_HPP}
  \begin{aligned}
    &\Qcb_t + \drond{\Fcb\cdot \vect{n}}{x_n} = \Scb, \\
    &\left\lbrace
      \begin{aligned}
        & \Qcb(x_n,t=0) = \Qcb^L \quad \text{if } x_n< 0\\
        & \Qcb(x_n,t=0) = \Qcb^R \quad \text{if } x_n> 0
      \end{aligned}
    \right.
  \end{aligned}
\end{equation}
where $x_n=\vect{x}\cdot\vect{n}$.
Problems of the form \eqref{eq:Riemann_problem_HE} or \eqref{eq:Riemann_problem_HPP} are considered in the next section, in which exact solutions are recalled or derived.

\subsection{Linear elastodynamics problems}
\label{subsec:charac_Linear_problems}
A homogeneous hyperbolic system of dimension $m$ is considered in a linear elastic solid so that a Riemann problem of the form \eqref{eq:Riemann_problem_HPP} is written.% in the arbitrary direction $\vect{n}$ reads:
% \begin{equation}
%   \label{eq:Linear_Riemann_problem}
%   \begin{aligned}
%   &\Qcb_t + \drond{\Fcb\cdot \vect{n}}{x_n} = \vect{0}, \\
%   &\left\lbrace
%     \begin{aligned}
%       & \Qcb(x_n,t=0) = \Qcb^L \quad \text{if } x_n< 0\\
%       & \Qcb(x_n,t=0) = \Qcb^R \quad \text{if } x_n> 0
%     \end{aligned}
%     \right.
%   \end{aligned}
% \end{equation}

\subsubsection*{Characteristic variables -- Waves solution}
By introducing a set of \textit{characteristic variables} $\Pcb=\Rbsf^{-1}\Qcb$ ($\Rsf_{ij}=\Rc^j_i$), the quasi-linear form of system \eqref{eq:Riemann_problem_HPP} reads:
\begin{equation}
  \label{eq:RP_characteristic_variables}
  \begin{aligned}
    &\drond{\Pc_i}{t} + c_i\drond{\Pc_i}{x} = 0 \\
    &\left\lbrace
      \begin{aligned}
        & \Pc_i(x,t=0) = \Pc_i^L \quad \text{if } x< 0\\
        & \Pc_i(x,t=0) = \Pc_i^R \quad \text{if } x> 0
      \end{aligned}
    \right.
  \end{aligned}
\end{equation}
with $\Csf_{ij}=c_i\delta_{ij}$, the matrix of eigenvalues so that $\Jsf_{ij} \Rc^j_K = \Rc^K_i\Csf_{Kj}$. The solution of this problem is straightforward since it corresponds to a superposition of scalar linear advection equations, namely, the initial profile $\Pc_i(x,t=0)$ simply propagates with speed $c_i$ as depicted in figure \ref{fig:advection}.
\begin{figure}[h!]
  \centering
  \subcaptionbox*{}[0.45\linewidth]{\input{chapter2/pgfFigures/advection_solution}}
  \subcaptionbox*{}[0.45\linewidth]{\input{chapter2/pgfFigures/advection_P}}
  \caption{Solution to linear advection equation of the quantity $\Pc_i$ with characteristic speed $c_i$.}
  \label{fig:advection}
\end{figure}
Thus, the solution  $\Pc_i(x,t)$ at a given point is given by tracing backward the characteristic of slope $c_i$ passing through this point to the $x$-axis, that is: $\Pc_i(x,t)=\Pc_i(x-c_it,0)$  \cite[p.52]{Toro}. The vector $\Qcb$ is then determined by inverting the relation:
\begin{equation}
  \label{eq:Q_expansion}
  \Qcb(x,t) = \sum_{i=1}^m \Rcb^i \Pc_i(x-c_it,0) \quad \Rightarrow
  \left\lbrace
    \begin{aligned}
      & \Qcb(x<0,0)=\Qcb^L=\sum_{i=1}^{m}\Rcb^i \Pc_i^L\\
      & \Qcb(x>0,0)=\Qcb^R= \sum_{i=1}^{m}\Rcb^i \Pc_i^R
    \end{aligned}
    \right.
\end{equation}
Equation \eqref{eq:Q_expansion} is an eigenvector expansion with coefficients $\Pc_i^{R,L}$ from which we see that $\Qcb$ is a linear superposition of $m$ waves, each having the shape $\Rcb^i \Pc_i(x,0)$.
Noticing that for given values of $x$ and $t$, there exists one characteristic $I$ such that $x-c_i t >0$ for all $i\leq I$, and $x-c_{i} t <0$ for all $i \geq I+1$, equation \eqref{eq:Q_expansion} can be rewritten \cite[p.56]{Toro}:
\begin{equation}
  \label{eq:Q_expansion_sides}
  \Qcb = \sum_{i=1}^I \Rcb^i \Pc_i^R + \sum_{i=I+1}^m \Rcb^i \Pc_i^L
\end{equation}
or, by introducing the expansions of initial data \eqref{eq:Q_expansion_sides}:
\begin{align}
  &\Qcb = \sum_{i=1}^m \Rcb^i \Pc_i^R - \sum_{i=I+1}^m \Rcb^i \(\Pc_i^R - \Pc_i^L\)= \Qcb^R - \sum_{i=I+1}^m \Rcb^i \(\Pc_i^R - \Pc_i^L\) \\
  &\Qcb= \sum_{i=1}^{m}\Rcb^i \Pc_i^L + \sum_{i=1}^I \Rcb^i \(\Pc_i^R - \Pc_i^L\)= \Qcb^L + \sum_{i=1}^I \Rcb^i \(\Pc_i^R - \Pc_i^L\)
\end{align}
These equations are equivalent to jump conditions across multiple discontinuous waves:
\begin{align}
  \label{eq:jump_star_R}
  &  \Qcb-\Qcb^R = -\sum_{i=I+1}^{m} \Rcb^i\delta^i \\
  \label{eq:jump_star_L}
  &  \Qcb-\Qcb^L = \sum_{i=1}^{I} \Rcb^i\delta^i
\end{align}
where $\Qcb(x,t)$ is the state lying in the region of the ($x,t$) plane delimited by the characteristics $I$ and $I+1$, and $\Rcb^i\delta^i$ the jump carried by the $i$th wave.
The coefficients $\delta^i=\Pc_i^R - \Pc_i^L$ are weighting coefficients involved in \textit{wave strengths} $\Wcb^i=\Rcb^i \delta^i$, that can be computed from the expansions of initial conditions by solving:
\begin{equation}
  \label{eq:delta_system}
  \Qcb^R-\Qcb^L=\sum_{i=1}^{m}\Rcb^i \delta^i=\Rbsf \vect{\delta}
\end{equation}

We see that the solutions of Riemann problem  \eqref{eq:Riemann_problem_HPP} consist of discontinuous waves emanating from the origin of the $(x,t)$ plane.
Across such discontinuous waves, the following condition is satisfied \cite{Toro}:
\begin{definition}
  The \textbf{Rankine-Hugoniot condition} is satisfied across a discontinuous wave of speed $s_i$ associated with the $i$th characteristic field, which is a solution of the hyperbolic system $\Qcb_t + \Fcb(\Qcb)_x=\vect{0}$:
\begin{equation}
  \label{eq:rankine-hugoniot}
  \saut{ \Fcb} = s_i \saut{ \Qcb}
\end{equation}
where $\saut{\bullet}$ denotes the jump operator across the discontinuity.
More specifically, shock waves that will be met for non-linear problems in section \ref{sec:SVK_solution} also satisfy the Rankine-Hugoniot condition.
\end{definition}

\subsubsection*{Solution of the elastic bar problem}
The above discussion is now specified to a one-dimensional elastic medium, $x\in\[-l,l\]$, of density $\rho$ undergoing one-dimensional stress and strain states within the infinitesimal framework: $\tens{\eps}=\eps\: \vect{e}_1\otimes \vect{e}_1$ ; $\tens{\sigma}=\sigma \:\vect{e}_1\otimes \vect{e}_1$. As a consequence, the bar hypothesis holds with $\vect{v}=v \vect{e}_1$. Neglecting body forces and introducing \textit{Young's modulus E} such that $\sigma = E\eps$, the Riemann problem takes the form \eqref{eq:Riemann_problem_HPP} with conserved quantities and flux vector:
\begin{equation*}
  \Qcb = \matrice{v \\ \sigma} \quad ; \quad \Fcb = \matrice{-\frac{1}{\rho}\sigma \\ -Ev}
\end{equation*}
along with Riemann-type data on the horizontal velocity (\textit{i.e. }$v(x<0,0)=v_L\:;\:v(x>0,0)=v_R$) as initial conditions. In addition, the solid is assumed to be initially unstressed. The eigenvalues, left and right eigenvectors of the corresponding Jacobian matrix are:
\begin{equation*}
  c=\pm\sqrt{\frac{E}{\rho} }  \quad ; \quad \Lcb^p=\[\rho c_p \:,\: -1\] \quad ; \quad \Rcb^p=\matrice{1\\- \rho c_p }
\end{equation*}
The characteristic structure of the solution consisting of two elastic discontinuities emanating from the origin of the ($x,t$) plane is depicted in figure \ref{fig:elasticity_example}.
\begin{figure}[h]
  \centering
  \input{chapter2/pgfFigures/example_elasticity}
  \caption{Solution to Riemann problem  \eqref{eq:Riemann_problem_HPP} for an elastic bar.}
  \label{fig:elasticity_example}
\end{figure}
The solution $\Qcb^*$ lying in the region bounded by the two elastic waves is computed by means of equation \eqref{eq:jump_star_L} after solving \eqref{eq:delta_system} for the wave strength coefficients. For a system of dimension $2$ by writing $\Qcb^R-\Qcb^L=\Delta \Qcb$ those wave strengths read:
%For a system of dimension $2$, the solution in terms of wave strengths coefficients of system \eqref{eq:delta_system} is, by writing $\Qcb^R-\Qcb^L=\Delta \Qcb$:
%Writing $\Qcb^R-\Qcb^L=\Delta \Qcb$, linear systems of dimension $2$ lead to wave strengths coefficients:
\begin{equation}
  \label{eq:wave_strengths}
  \vect{\delta} = \frac{1}{\Rc^1_1\Rc^2_2 -\Rc_1^2\Rc^1_2}\matrice{\Rc^2_2\Delta \Qc_1 - \Rc^2_1\Delta \Qc_2 \\ \Rc^1_1\Delta \Qc_2 - \Rc_2^1\Delta \Qc_1}
\end{equation}
and more specifically for a bar:
\begin{equation}
  \label{eq:wave_strengths_bar}
  \vect{\delta} = \frac{1}{2\rho c}\matrice{\rho c \Delta v + \Delta \sigma \\  \rho c \Delta v -\Delta \sigma }
\end{equation}
Hence, equation \eqref{eq:jump_star_L} yields the solution:
\begin{equation}
  \label{eq:solution_charac_variables}
  \Qcb^* = \Qcb^L +\Rcb^1 \delta^1 = \matrice{\frac{\sigma_R - \sigma_L}{2\rho c} + \frac{v_R+v_L}{2} \\ \rho c\frac{v_R - v_L}{2} + \frac{\sigma_R+\sigma_L}{2}}
\end{equation}

\subsection{Elastic-plastic media in the geometrical linearized limit}
\label{subsec:elasto-plastic_problem}
The previous problem is now extended to elastoplastic media by considering the same bar made of a linear hardening material of tensile yield stress $\sigma^y$. For such a solid domain, a Riemann problem of the form \eqref{eq:Riemann_problem_HPP} can be written by means of the following conserved quantities and flux vectors \cite{Thomas_EP}:
\begin{equation*}
  \Qcb = \matrice{v \\ \sigma} \quad ; \quad \Fcb = \matrice{-\frac{1}{\rho}\sigma \\ -Hv}
\end{equation*}
where $H=E$ for elastic loadings while $H=d\sigma/d\eps$ is the tangent modulus for elastic-plastic evolutions. In addition, Riemann-type data on the horizontal velocity (\textit{i.e. }$v(x<0,0)=v_L\:;\:v(x>0,0)=v_R$) are used as initial conditions, so that plastic flow may occur.

%We now generalize the previous discussion to elastoplastic solids within the small strains framework. A plane wave problem in an infinite elastoplastic medium with linear hardening is then considered. Such a plane wave can be due for instance to Riemann-type data on the horizontal velocity (\textit{i.e. }$v(x<0,0)=v_L\:;\:v(x>0,0)=v_R$) so that plastic flow may occur.
% The exact solution of such a linear problem being known \cite{Wang} an exact Riemann solver, which however requires a particular procedure, may be used.
The discontinuity of $H$ across the plastic threshold prevents here the direct derivation of the solution by using the approach followed for linear elasticity. Indeed, two sets of characteristic speeds and associated eigenvectors must be considered, that is \cite{Thomas_EP,Wang}:
\begin{equation*}
  c=\pm\sqrt{\frac{H}{\rho} } \quad ; \quad \Lcb^p=\[\rho c_p \:,\: -1\] \quad ; \quad \Rcb^p=\matrice{1\\- \rho c_p }
\end{equation*}
so that waves are referred to as elastic or plastic waves. Whether a plastic wave appears or not hence depends on the tangent modulus and subsequently, on the yield function.
A predictor-corrector procedure must thus be followed by first solving an elastic Riemann problem whose resulting (trial) solution $\Qcb$ is tested against the yield criterion on both sides $x<0$ or $x>0$.
In general, possibly different yield stresses, plastic strains and hardening parameters in left and right regions lead to a yield criterion that may be violated or not, and hence to one, two or no plastic waves that must be added as a correction to the original problem.
If neither $f_L$ nor $f_R$ leads to a violation of the criterion, the problem is elastic and the trial state is the solution.
Otherwise, the plastic correction is performed by computing the stress in regions of the ($x,t$) plane bounded by elastic and plastic waves ($\tilde{\Qcb}^{L,R}$ in figure \ref{fig:EP_bar_solution}\subref{subfig:ep_bar_charac_4waves}) so that the yield function satisfies $f_{L,R}=0$.
\begin{figure}[h!]
  \centering
  \subcaptionbox{Characteristic structure\label{subfig:ep_bar_charac_4waves}}{\input{chapter2/pgfFigures/elastoplastic_bar}}
  \subcaptionbox{Stress profile in the bar\label{subfig:ep_bar_stress_4waves}}{\input{chapter2/pgfFigures/elastoplastic_stress}}
  % \\\subcaptionbox{3-waves solution ($\sigma_L^y>\sigma_R^y$)\label{subfig:ep_bar_charac_3waves}}{\input{chapter2/pgfFigures/elastoplastic_bar_1plast}}
  % \subcaptionbox{Stress for 3-waves($\sigma_L^y>\sigma_R^y$)\label{subfig:ep_bar_stress_3waves}}{\input{chapter2/pgfFigures/elastoplastic_stress_1plast}}
  \caption{Example of a solution of a Riemann problem in a homogeneous elastoplastic bar with linear hardening and initial plastic strain $\eps^p(x,0)= 0$.}
  \label{fig:EP_bar_solution}
\end{figure}
Then, the velocity and elastic wave strengths in yielding regions are given by solving:
\begin{align}
  & \tilde{\Qcb}^R = \Qcb^R - \delta^1_E \Rcb^1_E\\
  & \tilde{\Qcb}^L = \Qcb^L + \delta^2_E \Rcb^2_E
\end{align}
At last a plastic Riemann solver is used in order to compute the solution of the problem $\Qcb^*$ by solving successively the system \eqref{eq:delta_system} for plastic wave strengths, and either system \eqref{eq:jump_star_R} or \eqref{eq:jump_star_L}, that is:
\begin{equation}
  \label{eq:plastic_approx_RS}
  \vect{\delta}_P = \Rbsf^{-1}\(\tilde{\Qcb}^R- \tilde{\Qcb}^L\) \quad \Rightarrow \quad
  \Qcb^* = \left\lbrace
  \begin{aligned}
      &  \tilde{\Qcb}^R - \delta_P^2 \Rcb^2_P\\
      &  \tilde{\Qcb}^L + \delta_P^1 \Rcb^1_P
  \end{aligned}
  \right.
\end{equation}

 Figure \ref{fig:EP_bar_solution}\subref{subfig:ep_bar_charac_4waves} shows the characteristic structure of the solution of the Riemann problem in a homogeneous medium considered here, involving two plastic waves, and figure \ref{fig:EP_bar_solution}\subref{subfig:ep_bar_stress_4waves} the corresponding stress field in the bar.

\begin{remark}
  Note that the above solver also applies to plane wave problems characterized by one-dimensional strain and multi-dimensional stress states by considering different wave speeds.
\end{remark}

\subsection{Hyperelastic media: A Saint-Venant-Kirchhoff solution}
\label{sec:SVK_solution}
The approaches followed above are no longer possible for problems involving a non-linear Jacobian matrix. Indeed, the writing of the Riemann problem \eqref{eq:RP_characteristic_variables} in terms of characteristic variables is valid for right eigenvectors that are constant.
%since right eigenvectors cannot be taken out of the derivatives.
Moreover, as we shall see with an example, the characteristic structure of such problems can be more complex and depend on the initial data.
%%% Picard problem
Consider a hyperelastic medium made of a Saint-Venant-Kirchhoff material, infinite in directions $\vect{E}_2$ and $\vect{E}_3$, and semi-infinite in direction $\vect{E}_1$ (\textit{i.e. $X_1 \in [0,+\infty[$}) in the reference configuration. This medium suddenly undergoes a load at $(X_1=X=0,t=0)$ in direction $\vect{E}_1$ so that the deformation gradient and the PK1 tensors are respectively of the form:
\begin{align}
  \label{eq:SVK_plane_wave}
  &\tens{F}=F\vect{e}_1\otimes\vect{E}_1 + \vect{e}_2\otimes\vect{E}_2 + \vect{e}_3\otimes\vect{E}_3 \\
  & \tens{\Pi}=\Pi_{11}\vect{e}_1\otimes\vect{E}_1 + \Pi_{22}\(\vect{e}_2\otimes\vect{E}_2 + \vect{e}_3\otimes\vect{E}_3 \)
\end{align}
which corresponds to a plane wave solution. We assume that $F(0,t)=\bar{F}$ is given, leading to a \textit{Picard problem} \cite[p.20]{Wang} involving both initial and boundary conditions with neglected body forces:
\begin{equation}
  \label{eq:Picard_problem}
  \begin{aligned}
  &\Qcb_t + \drond{\Fcb\cdot \vect{N}}{X_N} = \vect{0}, \\
  &\left\lbrace
    \begin{aligned}
      & \Qcb(X_N,t=0) = \Qcb^R \quad \text{if } X_N> 0 \\
      & F(0,t) = \bar{F}
    \end{aligned}
    \right.
  \end{aligned}
\end{equation}
with $\vect{N}=\vect{E}_1$ and:
\begin{equation*}
 \Qcb = \matrice{v \\ F} \quad ; \quad \Fcb = \matrice{-\frac{1}{\rho_0}\Pi \\ -v}
\end{equation*}
where $\Pi=\Pi_{11}$.
%%%
%Since the tangent modulus and the acoustic tensor of Saint-Venant-Kirchhoff model \eqref{eq:SVK_tangent},\eqref{eq:SVK_acoustic} depend on the deformation gradient, the quasi-linear form: $\Qcb_t + \drond{\Fcb}{\Qcb}\drond{\Qcb}{X}=\vect{0}$ is more convenient. The Jacobian matrix is then:
The quasi-linear form is written by using the chain rule: $\Qcb_t + \drond{\Fcb}{\Qcb}\drond{\Qcb}{X}=\vect{0}$ so that the Jacobian matrix reads:
\begin{equation}
  \label{eq:quasi_SVK}
  \Jbsf=\drond{\Fcb}{\Qcb}=-\matrice{0 & \frac{H_{1111}}{\rho_0} \\ 1 & 0}
\end{equation}
The tangent modulus of the SVK model \eqref{eq:SVK_tangent} yields the following characteristic fields:
\begin{equation}
  \label{eq:SVK_charac_fields}
  \left\lbrace
    \begin{aligned}
      & c_1=- \sqrt{\frac{\lambda+2\mu}{2\rho_0}\(3F^2-1\) }\\
      &c_2= \sqrt{\frac{\lambda+2\mu}{2\rho_0}\(3F^2-1\) }
    \end{aligned}\right.
 \quad ; \quad \Lcb^p=\[1\:,\:- c_p \] \quad ; \quad \Rcb^p=\matrice{- c_p \\1}
\end{equation}

\begin{remark}
  \label{rq:hyperbolicity_limit_SVK}
  The non-linear flux function of the SVK model yields characteristic fields depending on the strain state and possibly complex celerities leading to a loss of hyperbolicity of the problem for $F<\sqrt{\frac{1}{3}}$.
\end{remark}

Suppose now that initial data are given so that $\bar{F} > F_R$. The resulting characteristic speeds then satisfy $c_2(\bar{F})>c_2(F_R)$ and the two families of characteristics collide in the right region of the ($x,t$) plane (figure \ref{fig:Picard_problem}\subref{subfig:2S}). On the other hand, $\bar{F} < F_R$ yields characteristics moving away from each other in the right region according to $c_2(\bar{F})<c_2(F_R)$ (figure \ref{fig:Picard_problem}\subref{subfig:2R}). These two situations respectively correspond to a shock and a simple wave. Note that this characteristic structure is similar to that resulting from the \textit{dam-break problem} with \textit{shallow water} equations, the following developments are hence very close to those of \cite[Ch.13]{Leveque}.
\begin{figure}[h!]
  \centering
  \subcaptionbox{Right-going shock wave\label{subfig:2S}}{\input{chapter2/pgfFigures/picard_2_shock}}
  \subcaptionbox{Right-going simple wave\label{subfig:2R}}{\input{chapter2/pgfFigures/picard_2_rarefaction}}
 \caption{Solutions of the Picard problem \eqref{eq:Picard_problem} depending on initial and boundary data.}
  \label{fig:Picard_problem}
\end{figure}

\subsubsection*{Shock waves}
% Applying the method of characteristics between the $x$-axis and an intersection point of two characteristic straight lines, one shows that a shock wave carry a jump discontinuity.
A shock wave is a discontinuous wave satisfying the Rankine-Hugoniot condition \eqref{eq:rankine-hugoniot}:
\begin{align}
  \label{eq:RH_velocity}
  & -\frac{1}{\rho_0}\(\bar{\Pi} - \Pi_i \) = s \( \bar{v} - v_i \)\\
  \label{eq:RH_F}
  & - \( \bar{v}-v_i\)=s\( \bar{F} - F_i\)
\end{align}
where the shock speed $s$ is to be defined and $i\in\{L,R\}$.
In what follows, $\bar{F}$ is considered as an unknown so that a relation connecting $\Qcb^i$ to a set of solutions $\Qcb$ through a shock wave can be developed.
Substitution of $s$ from equation \eqref{eq:RH_F} and introduction in equation \eqref{eq:RH_velocity} where $\Pi=\frac{\lambda+2\mu}{2}\(F^3-F\)$ yield:
\begin{align}
  \label{eq:shock_speed}
  & s=-\frac{\bar{v}-v_i}{\bar{F} - F_i}\\
  \label{eq:v_jump}
  & \bar{v}-v_i= \pm \sqrt{\frac{\lambda+2\mu}{2\rho_0}(\bar{F}-F_i)\[ \bar{F}^3-\bar{F} - (F_i^3-F_i)\]}
\end{align}
In addition to the Rankine-Hugoniot condition, one has to consider the \textit{Lax entropy conditions}, stating that characteristic curves collide in a shock wave \cite[p.268]{Leveque}:
\begin{equation}
  \label{eq:Lax_entropy}
  c(\bar{F})<s<c(F_i)
\end{equation}
The Lax entropy condition implies that the square root in equation \eqref{eq:v_jump} is real, leading to two families of curves in the phase plane ($F,v$). When considering an infinitesimal jump (\textit{i.e. $\bar{F}=F_i\pm\epsilon$ with $\epsilon \rightarrow 0$}), each of these curves is expected to identify with one of the jump conditions derived for the linear case \eqref{eq:jump_star_R} of \eqref{eq:jump_star_L}.
% One of those curve is expected to identify with the jump conditions derived for the linear case \eqref{eq:jump_star_R} when considering an infinitesimal jump (\textit{i.e. $\bar{F}=F_R+\epsilon$ with $\epsilon \rightarrow 0$}).
Thus, equation \eqref{eq:v_jump} reads:
\begin{equation}
  \label{eq:linearization}
  \bar{v}-v_i= \pm \sqrt{\frac{\lambda+2\mu}{2\rho_0}\epsilon\[ (F_i+\epsilon)^3-(F_i+\epsilon) - (F_i^3-F_i)\]}
\end{equation}
where, with $\epsilon \rightarrow 0$:
\begin{equation*}
  (F_i+\epsilon)^3\approx F_i^3(1+\frac{3\epsilon}{F_i})
\end{equation*}
so that:
\begin{equation*}
  \matrice{\bar{v} \\ \bar{F}}=\matrice{v_i \\ F_i} + \epsilon \matrice{\pm \sqrt{\frac{\lambda+2\mu}{2\rho_0}\[ 3F_i^2-1\]}\\1}
\end{equation*}
The minus sign yields equation \eqref{eq:jump_star_R} associated with the right-going wave and therefore corresponds to a right-going shock wave.
On the other hand, the plus sign stands for equation \eqref{eq:jump_star_L} and left-going shocks.
Finally, the Rankine-Hugoniot condition across a left-going shock and a right-going shock respectively lead to:
\begin{align}
  \label{eq:left-going_shock}
  &\bar{v}-v_L= \sqrt{\frac{\lambda+2\mu}{2\rho_0}(\bar{F}-F_L)\[ \bar{F}^3-\bar{F} - (F_L^3-F_L)\]} \\
  \label{eq:right-going_shock}
  &\bar{v}-v_R= -\sqrt{\frac{\lambda+2\mu}{2\rho_0}(\bar{F}-F_R)\[ \bar{F}^3-\bar{F} - (F_R^3-F_R)\]}
\end{align}

\subsubsection*{Simple waves}
In order to study the evolution of fields within the region bounded by characteristics that move away in figure \ref{fig:Picard_problem}\subref{subfig:2R}, let's write the left-going characteristic equation through it with $\Lcb^1=[1,-c_1]$:
\begin{equation}
  \label{eq:SVK_rarefaction}
  dv -c_1(F)  dF = 0
\end{equation}
The complete set of states $\Qcb$ connected to $\Qcb^R$ through a simple wave is obtained by integration of equation \eqref{eq:SVK_rarefaction}. Note that this integration results in a smooth evolution of fields inside a simple wave even for discontinuous initial conditions, unlike shocks. Moreover, the vanishing right-hand side of the conservative form of the Picard problem \eqref{eq:Picard_problem} yields a similarity solution. The particular case of a simple wave constant along each ray $\xi=x/t$ corresponds to a \textit{rarefaction wave} \cite{Leveque}.

Integration of equation \eqref{eq:SVK_rarefaction} is performed by using the change of variables: $F \mapsto ch(x)/\sqrt{3}$ so that one gets:
%The following change of variable is then introduced: $F \mapsto ch(x)/\sqrt{3}$, so that  becomes:
\begin{equation}
  \label{eq:charac_equation_sh}
  dv=-\sqrt{\frac{\lambda + 2\mu}{6\rho_0}}sh(x)^2 dx
\end{equation}
where, the hyperbolic cosine $ch(x)$ and sine $sh(x)$ satisfy: $ch(x)^2-sh(x)^2=1$. Equation \eqref{eq:charac_equation_sh} can be easily integrated with the exponential form of hyperbolic sine: $sh(x)=\frac{e^x - e^{-x}}{2}$, thus yielding:
\begin{equation*}
  v-v_R=-\frac{1}{4}\sqrt{\frac{\lambda + 2\mu}{6\rho_0}}\[sh(2x)-2x -(sh(2x_R)-2x_R)\]
\end{equation*}
At last, the inverse change of variables leads to the relation:
\begin{equation}
  \label{eq:integral_curve_right}
  v-v_R=-\sqrt{\frac{\lambda + 2\mu}{24\rho_0}}\[\sqrt{3}\(F\sqrt{3F^2-1} -F_R\sqrt{3F_R^2-1}\)-\ln\(\frac{\sqrt{3}F + \sqrt{3F^2-1}}{\sqrt{3}F_R + \sqrt{3F_R^2-1}}\) \]
\end{equation}
In a similar manner, $dv -c_2(F)  dF = 0$ must hold through a left-going rarefaction wave so that:
\begin{equation}
  \label{eq:integral_curve_left}
  v-v_L=\sqrt{\frac{\lambda + 2\mu}{24\rho_0}}\[\sqrt{3}\(F\sqrt{3F^2-1} -F_L\sqrt{3F_L^2-1}\)-\ln\(\frac{\sqrt{3}F + \sqrt{3F^2-1}}{\sqrt{3}F_L + \sqrt{3F_L^2-1}}\) \]
\end{equation}

Equations \eqref{eq:integral_curve_right} and \eqref{eq:integral_curve_left} correspond to \textit{integral curves} that connect initial conditions to a set of solutions through a right-going or a left-going rarefaction respectively.

\subsubsection*{Solution of the Riemann problem}
The above developments are now generalized by considering the Riemann problem in an infinite medium:
\begin{equation}
  \label{eq:HE_Riemann_problem}
  \begin{aligned}
    &\Qcb_t + \drond{\Fcb\cdot \vect{N}}{X_N} = \vect{0}, \\
    &\left\lbrace
      \begin{aligned}
        & \Qcb(X_N,t=0) = \Qcb^L = \matrice{v=0 \\ F_L} \quad \text{if } X_N< 0\\
        & \Qcb(X_N,t=0) = \Qcb^R = \matrice{v=0 \\ F_R}\quad \text{if } X_N> 0
      \end{aligned}
    \right.
  \end{aligned}
\end{equation}
such that the plane wave state \eqref{eq:SVK_plane_wave} holds.
As for the Picard problem, initial conditions influence the characteristic structure of the solution. Indeed, if initial conditions are given such that $F_L<F_R$, left-going characteristics will collide while right-going ones will move away from one another (see figure \ref{fig:RP_solution}\subref{subfig:1S2R}). In that case, the first and second characteristic fields are respectively referred to as a \textit{1-shock} and a \textit{2-rarefaction}. Conversely, if $F_L>F_R$ the solution corresponds to a \textit{1-rarefaction} and a \textit{2-shock} (figure \ref{fig:RP_solution}\subref{subfig:1R2S}).

\begin{figure}[h]
  \centering
  \subcaptionbox{$F_L < F_R$\label{subfig:1S2R}}{\input{chapter2/pgfFigures/1S2R}}
  \subcaptionbox{$F_L > F_R$\label{subfig:1R2S}}{\input{chapter2/pgfFigures/1R2S}}
  \caption{General wave patterns arising in the solution of the Riemann problem \eqref{eq:HE_Riemann_problem} depending on initial data. (a): 1-shock--2-rarefaction. (b): 1-rarefaction--2-shock.}
  \label{fig:RP_solution}
\end{figure}

For the 1-shock--2-rarefaction solution one then seeks a state $\Qcb$ that is connected to $\Qcb^L$ and $\Qcb^R$ through a shock wave and a rarefaction wave respectively. Hence, $\Qcb$ must satisfy equations \eqref{eq:left-going_shock} and \eqref{eq:integral_curve_right}, that is:
\begin{equation}
  \label{eq:1S2R_solution}
  \left\lbrace
  \begin{aligned}
    &v -v_L= \sqrt{\frac{\lambda+2\mu}{2\rho_0}(F -F_L)\[ F^3-F  - (F_L^3-F_L)\]} \\
    &v -v_R=-\sqrt{\frac{\lambda + 2\mu}{24\rho_0}}\[\sqrt{3}\(F \sqrt{3F^2-1} -F_R\sqrt{3F_R^2-1}\)-\ln\(\frac{\sqrt{3}F  + \sqrt{3F^2-1}}{\sqrt{3}F_R + \sqrt{3F_R^2-1}}\) \]
  \end{aligned}
  \right.
\end{equation}
Analogously, the 1-rarefaction--2-shock solution is given by the solution of equations \eqref{eq:integral_curve_left} and \eqref{eq:right-going_shock}:
\begin{equation}
  \label{eq:1R2S_solution}
  \left\lbrace
  \begin{aligned}
    &v -v_L=\sqrt{\frac{\lambda + 2\mu}{24\rho_0}}\[\sqrt{3}\(F \sqrt{3F^2-1} -F_L\sqrt{3F_L^2-1}\)-\ln\(\frac{\sqrt{3}F  + \sqrt{3F^2-1}}{\sqrt{3}F_L + \sqrt{3F_L^2-1}}\) \]\\
    &v -v_R= -\sqrt{\frac{\lambda+2\mu}{2\rho_0}(F -F_R)\[ F^3-F  - (F_R^3-F_R)\]}
  \end{aligned}
  \right.
\end{equation}
\begin{figure}[h!]
  \centering
  {\input{chapter2/pgfFigures/1S2R_solution}\phantomsubcaption \label{subfig:1S2R_curves}}
  {\input{chapter2/pgfFigures/1R2S_solution}\phantomsubcaption  \label{subfig:1R2S_curves}}
  \caption{Set of connected states $\Qcb$ to initial data through shock and rarefaction waves with $v_L=v_R=0$ in both cases: (a) 1-shock, 2-rarefaction solution ; (b) 1-rarefaction, 2-shock.}
  \label{fig:solutions_RP}
\end{figure}
Once one of these systems is solved, the solution $\Qcb$ is known everywhere except inside the rarefaction fan. Nevertheless, in this region $\Qcb$ only varies with the ray $\xi=c_i(F)$ and hence, the solution inside an $i$-rarefaction wave satisfies:
\begin{equation}
  \label{eq:rarefaction_fan}
  \xi = \pm \sqrt{\frac{\lambda + 2\mu}{2\rho_0}\(3F^2-1 \)} \quad \Rightarrow \quad F(\xi)= \sqrt{\frac{2\rho_0}{3(\lambda + 2\mu)}\xi^2-1}
\end{equation}

The curves corresponding to equations \eqref{eq:1S2R_solution} and \eqref{eq:1R2S_solution} are depicted in figures \ref{fig:solutions_RP}\subref{subfig:1S2R_curves} and \ref{fig:solutions_RP}\subref{subfig:1R2S_curves} for parameter values such that $\frac{\lambda+2\mu}{\rho_0}=1$. In both cases, the solution $\Qcb(x,t)$ in the region bounded by the shock and the rarefaction fan is given by the intersection of curves in the phase plane.

\begin{remark}
  \label{rq:charach_neoHook}
  Note that the above developments are based on a constitutive model that leads to a concave flux function $\Fcb^T=-\[\frac{1}{\rho_0}\Pi \: ;\: v\]$ (\textit{i.e. } $\ddrond{\Pi}{F}{F}>0$). As a consequence, the characteristic speeds are monotonically increasing functions of the deformation gradient (in absolute value). Since the dependence of characteristic speeds on the deformation gradient governs the wave pattern (\textit{i.e.: either a rarefaction or a shock wave}), the structure of the solution differs from other constitutive laws with convex flux function such as the neo-Hookean model.
  Comparisons of ($F,\Pi_{11}$) and ($F,\abs{c}$) are shown in figures \ref{fig:SVK-NH}\subref{subfig:SVK_NH_Pi} and \ref{fig:SVK-NH}\subref{subfig:SVK_NH_speeds} as an illustration of previous remarks.
  \begin{figure}[h!]
    \centering
    {\input{chapter2/pgfFigures/SVK_NH_Pi_F} \phantomsubcaption \label{subfig:SVK_NH_Pi}}
    {\input{chapter2/pgfFigures/SVK_NH_speeds} \phantomsubcaption \label{subfig:SVK_NH_speeds}}
    \caption{Comparison of neo-Hookean and Saint-Venant-Kirchhoff hyperelastic models.}
    \label{fig:SVK-NH}
  \end{figure}
  At last, figure \ref{fig:SVK-NH}\subref{subfig:SVK_NH_Pi} shows the non-physical behavior of Saint-Venant-Kirchhoff model for high-compression loads that lead to a stress tensor tending to zero.
\end{remark}

%%% Local Variables:
%%% mode: latex
%%% ispell-local-dictionary: "american"
%%% TeX-master: "../mainManuscript"
%%% End:


%	This is written by Zhiyang Ong as a template for typesetting mathematics in LaTeX.

%	The MIT License (MIT)

%	Copyright (c) <2014> <Zhiyang Ong>

%	Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

%	The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

%	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

%	Email address: echo "cukj -wb- 23wU4X5M589 TROJANS cqkH wiuz2y 0f Mw Stanford" | awk '{ sub("23wU4X5M589","F.d_c_b. ") sub("Stanford","d0mA1n"); print $5, $2, $8; for (i=1; i<=1; i++) print "6\b"; print $9, $7, $6 }' | sed y/kqcbuHwM62z/gnotrzadqmC/ | tr 'q' ' ' | tr -d [:cntrl:] | tr -d 'ir' | tr y "\n"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Mathematics}
\label{chp:Mathematics}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\section{Mathematics}
%\label{chp:Mathematics}

Math symbols that I use frequently: \vspace{-0.3cm}
\begin{enumerate} \itemsep -4pt
\item $\mathbb{N}$
\item $\displaystyle\sum^{i = 1}_{n}$
\item $f(x) = \displaystyle\lim_{n \rightarrow \infty} \frac{f(x)}{g(x)}$
\item $\varnothing$
\item $q$
\end{enumerate}

A $3 \times 3$ matrix:
$\left(
\begin{array}{ccc}
	11 & 12 & 13 \\
	21 & 22 & 23 \\
	31 & 32 & 33
\end{array}
\right)$
\ \\
\ \\

Here is an equation:
\begin{equation}
\label{eqn:myeqnexample}
\iint_{\Sigma} \nabla \times \mathbf{F} \cdot \mathrm{d}\mathbf{\Sigma} = \oint_{\partial\Sigma} \mathbf{F} \cdot \mathrm{d} \mathbf{r}.
\end{equation}
\ \\
\ \\

Here is an equation that is not numbered.
\begin{equation*}
\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}} {\partial t}
\end{equation*}

Here is the set of Maxwell's equations that is numbered.
\begin{gather}
	\nabla \cdot \mathbf{E} = \frac {\rho} {\varepsilon_0} \\
	\nabla \cdot \mathbf{B} = 0 \\
	\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}} {\partial t} \\
	\nabla \times \mathbf{B} = \mu_0\left(\mathbf{J} + \varepsilon_0 \frac{\partial \mathbf{E}} {\partial t} \right)
\end{gather}

\begin{gather*}
	{\rm minimize \displaystyle\sum^{c}_{i = 1} c_{i} \cdot x_{i}} \\	%	objective function defined mathematically	\\
	\underline{x} \in S \\
	{\rm subject\ to:} \\
	%	constraints	\\
	x_{1} + x_{4} = 0 \\
	x_{3} + 7 \cdot x_{4} + 2\cdot x_{9} = 0
\end{gather*}

\begin{equation}
\label{eqn:caseenv}
f(n) =
	\begin{cases}
	case-1 &: \mathrm{n\ is\ odd} \\
	case-2 &: \mathrm{n\ is\ even} \\
	\end{cases}
\end{equation}

\begin{proof}
This is a proof for BLAH \dots
\end{proof}

\begin{theorem}{TITLE of theorem.}
My theorem is\dots
\end{theorem}

\begin{axiom}{TITLE of axiom.}
Blah\dots
\end{axiom}

Cases of putting a bracket/parenthesis on the right side of the equation.
\begin{gather*}
	\left.\begin{aligned}
	B'&=-\partial \times E,\\
	E'&=\partial \times B - 4\pi j,
	\end{aligned}
	\right\}
	\quad\text{Maxwell's equations}
\end{gather*}

Cases of putting a bracket/parenthesis on the right side of the equation.\\
$\begin{rcases*}
	E = m c^2 & foo \\
	\int x-3\, dx & barbaz
\end{rcases*} y=f(x)$
\ \\
\ \\

Labeling an arrow: $\xrightarrow{ewq}$


%!TEX root = da2020-04.tex

\Chapter{4}{\tLOCAL{}~Model: Unique~Identifiers}

\noindent
In the previous chapter, we studied deterministic distributed algorithms in port-numbered networks. In this chapter we will study a stronger model: \emph{networks with unique identifiers}\mydash see Figure~\ref{fig:unique-ids}. Following the standard terminology of the field, we will use the term ``$\LOCAL$ model'' to refer to networks with unique identifiers.

\begin{figure}
    \centering
    \includegraphics[page=\PUniqueIds]{figs.pdf}
    \caption{A network with unique identifiers.}\label{fig:unique-ids}
\end{figure}

\section{Definitions}\label{sec:unique-id}

Throughout this chapter, fix a constant $c > 1$. An assignment of \emph{unique identifiers} for a port-numbered network $N = (V,P,p)$ is an injection
\[
    \Id \colon V \to \{1,2, \dotsc, |V|^c\}.
\]
That is, each node $v \in V$ is labeled with a unique integer, and the labels are assumed to be relatively small.

Formally, unique identifiers can be interpreted as a graph problem $\Pi'$, where each solution $\Id \in \Pi'(N)$ is an assignment of unique identifiers for network $N$. If a distributed algorithm $A$ solves a problem $\Pi$ on a family $\calF$ given $\Pi'$, we say that \emph{$A$ solves $\Pi$ on $\calF$ given unique identifiers}, or equivalently, \emph{$A$ solves $\Pi$ on $\calF$ in the $\LOCAL$ model}.

For the sake of convenience, when we discuss networks with unique identifiers, we will identify a node with its unique identifier, i.e., $v = \Id(v)$ for all $v \in V$.

\section{Gathering Everything}\label{sec:gather}

In the $\LOCAL$ model, if the underlying graph $G = (V,E)$ is connected, all nodes can learn everything about $G$ in time $O(\diam(G))$. In this section, we will present a gathering algorithm that accomplishes this.

In the gathering algorithm, each node $v \in V$ will construct sets $V(v,r)$ and $E(v,r)$, where $r = 1, 2, \dotsc$. For all $v \in V$ and $r \ge 1$, these sets will satisfy
\begin{align}
    V(v,r) &= \ball_G(v,r), \label{eq:gather1} \\
    E(v,r) &= \bigl\{ \{s,t\} : s \in \ball_G(v,r),\, t\in \ball_G(v,r{-}1) \bigr\}. \label{eq:gather2}
\intertext{Now define the graph}
    G(v,r) &= (V(v,r), E(v,r)).  \label{eq:gather3}
\end{align}
See Figure~\ref{fig:gather} for an illustration.

\begin{figure}
    \centering
    \includegraphics[page=\PGather]{figs.pdf}
    \caption{Subgraph $G(v,r)$ defined in \eqref{eq:gather3}, for $v = 14$ and $r = 2$.}\label{fig:gather}
\end{figure}

The following properties are straightforward corollaries of \eqref{eq:gather1}--\eqref{eq:gather3}.
\begin{enumerate}
    \item Graph $G(v,r)$ is a subgraph of $G(v,r+1)$, which is a subgraph of~$G$.
    \item If $G$ is a connected graph, and $r \ge \diam(G) + 1$, we have $G(v,r) = G$.
    \item If $G_v$ is the connected component of $G$ that contains $v$, and $r \ge \diam(G_v) + 1$, we have $G(v,r) = G_v$.
    \item For a sufficiently large $r$, we have $G(v,r) = G(v,r+1)$.
    \item If $G(v,r) = G(v,r+1)$, we will also have $G(v,r+1) = G(v,r+2)$.
    \item Graph $G(v,r)$ for $r > 1$ can be constructed recursively as follows:
    \begin{align}
        V(v,r) &= \bigcup_{u \in V(v,1)} V(u,r-1), \label{eq:Vvr} \\
        E(v,r) &= \bigcup_{u \in V(v,1)} E(u,r-1). \label{eq:Evr}
    \end{align}
\end{enumerate}

The gathering algorithm maintains the following invariant: after round $r \ge 1$, each node $v \in V$ has constructed graph $G(v,r)$. The execution of the algorithm proceeds as follows:
\begin{enumerate}
    \item In round $1$, each node $u \in V$ sends its identity $u$ to each of its ports. Hence after round $1$, each node $v \in V$ knows its own identity and the identities of its neighbors. Put otherwise, $v$ knows precisely $G(v,1)$.
    \item In round $r > 1$, each node $u \in V$ sends $G(u,r-1)$ to each of its ports. Hence after round $r$, each node $v \in V$ knows $G(u,r-1)$ for all $u \in V(v,1)$. Now $v$ can reconstruct $G(v,r)$ using \eqref{eq:Vvr} and \eqref{eq:Evr}.
    \item A node $v \in V$ can stop once it detects that the graph $G(v,r)$ no longer changes.
\end{enumerate}

It is easy to extend the gathering algorithm so that we can discover not only the underlying graph $G = (V,E)$ but also the original port-numbered network $N = (V,P,p)$.

\section{Solving Everything}

Let $\calF$ be a family of connected graphs, and let $\Pi$ be a distributed graph problem. Assume that there is a deterministic \emph{centralized} (non-distributed) algorithm $A'$ that solves $\Pi$ on $\calF$. For example, $A'$ can be a simple brute-force algorithm\mydash we are not interested in the running time of algorithm~$A'$.

Now there is a simple distributed algorithm $A$ that solves $\Pi$ on $\calF$ in the $\LOCAL$ model. Let $N = (V,P,p)$ be a port-numbered network with the underlying graph $G \in \calF$. Algorithm $A$ proceeds as follows.
\begin{enumerate}
    \item All nodes discover $N$ using the gathering algorithm from Section~\ref{sec:gather}.
    \item All nodes use the centralized algorithm $A'$ to find a solution $f \in \Pi(N)$. From the perspective of algorithm $A$, this is merely a state transition; it is a local step that requires no communication at all, and hence takes $0$ communication rounds.
    \item Finally, each node $v \in V$ switches to state $f(v)$ and stops.
\end{enumerate}
Clearly, the running time of the algorithm is $O(\diam(G))$.

It is essential that all nodes have the same canonical representation of network $N$ (for example, $V$, $P$, and $p$ are represented as lists that are ordered lexicographically by node identifiers and port numbers), and that all nodes use the same deterministic algorithm $A'$ to solve $\Pi$. This way we are guaranteed that all nodes have locally computed the \emph{same} solution $f$, and hence the outputs $f(v)$ are globally consistent.

\section{Focus on Computational Complexity}

So far we have learned the key difference between $\PN$ and $\LOCAL$ models: while there are plenty of graph problems that cannot be solved at all in the $\PN$ model, we know that all computable graph problems can be easily solved in the $\LOCAL$ model.

Hence our focus shifts from computability to computational complexity. While it is trivial to determine if a problem can be solved in the $\LOCAL$ model, we would like to know which problems can be solved quickly. In particular, we would like to learn which problems can be solved in time that is much smaller than $\diam(G)$. It turns out that graph coloring is an example of such a problem.

In the rest of this chapter, we will design an efficient distributed algorithm that finds a graph coloring in the $\LOCAL$ model. The algorithm will find a proper vertex coloring with $\Delta+1$ colors in $O(\Delta + \log^* n)$ communication rounds, for any graph with $n = |V|$ nodes and maximum degree $\Delta$. We will start with a simple greedy algorithm that we will later use as a subroutine.

\section{Greedy Color Reduction} \label{sec:bdgreedy}

Let $x \in \NN$. We present a greedy color reduction algorithm that reduces the number of colors from $x$ to
\[
    y = \max \{ x-1, \Delta+1 \},
\]
where $\Delta$ is the maximum degree of the graph. That is, given a proper vertex coloring with $x$ colors, the algorithm outputs a proper vertex coloring with $y$ colors. The running time of the algorithm is one communication round.

\subsection{Algorithm}

The algorithm proceeds as follows; here $f$ is the $x$-coloring that we are given as input and $g$ is the $y$-coloring that we produce as output. See Figure~\ref{fig:greedy} for an illustration.
\begin{enumerate}
    \item In the first communication round, each node $v \in V$ sends its color $f(v)$ to each of its neighbors.
    \item Now each node $v \in V$ knows the set
    \[
        C(v) = \{ i : \text{there is a neighbor $u$ of $v$ with $f(u) = i$} \}.
    \]
    We say that a node is \emph{active} if $f(v) > \max C(v)$; otherwise it is \emph{passive}. That is, the colors of the active nodes are local maxima. Let
    \[
        \bar{C}(v) = \{1,2,\dotsc\} \setminus C(v)
    \]
    be the set of \emph{free colors} in the neighborhood of $v$.
    \item A node $v \in V$ outputs
    \[
        g(v) = \begin{cases}
            f(v) & \text{if $v$ is passive}, \\
            \min \bar{C}(v) & \text{if $v$ is active}.
        \end{cases}
    \]
\end{enumerate}
Informally, a node whose color is a local maximum re-colors itself with the first available free color.

\begin{figure}
    \centering
    \includegraphics[page=\PGreedy]{figs.pdf}
    \caption{Greedy color reduction. The active nodes have been highlighted. Note that in the original coloring $f$, the largest color was $99$, while in the new coloring, the largest color is strictly smaller than $99$\mydash we have successfully reduced the number of colors in the graph.}\label{fig:greedy}
\end{figure}

\subsection{Analysis}

\begin{lemma}
    The greedy color reduction algorithm reduces the number of colors from $x$ to
    \[
        y = \max \{ x-1, \Delta+1 \},
    \]
    where $\Delta$ is the maximum degree of the graph.
\end{lemma}
\begin{proof}
    Let us first prove that $g(v) \in \{1,2,\dotsc,y\}$ for all $v \in V$. As $f$ is a proper coloring, we cannot have $f(v) = \max C(v)$. Hence there are only two possibilities.
    \begin{enumerate}
        \item $f(v) < \max C(v)$. Now $v$ is passive, and it is adjacent to a node $u$ such that $f(v) < f(u)$. We have
        \[
            g(v) = f(v) \le f(u) - 1 \le x - 1 \le y.
        \]
        \item $f(v) > \max C(v)$. Now $v$ is active, and we have
        \[
            g(v) = \min \bar{C}(v).
        \]
        There is at least one value $i \in \{1,2,\dotsc,|C(v)|+1\}$ with $i \notin C(v)$; hence
        \[
            \min \bar{C}(v) \le |C(v)| + 1 \le \deg_G(v) + 1 \le \Delta + 1 \le y.
        \]
    \end{enumerate}

    Next we will show that $g$ is a proper vertex coloring of $G$. Let $\{u,v\} \in E$. If both $u$ and $v$ are passive, we have
    \[
        g(u) = f(u) \ne f(v) = g(v).
    \]
    Otherwise, w.l.o.g., assume that $u$ is active. Then we must have $f(u) > f(v)$. It follows that $f(u) \in C(v)$ and $f(v) \le \max C(v)$; therefore $v$ is passive. Now
    $g(u) \notin C(u)$ while
    $g(v) = f(v) \in C(u)$; we have $g(u) \ne g(v)$.
\end{proof}

The key observation is that the set of active nodes forms an independent set. Therefore all active nodes can pick their new colors simultaneously in parallel, without any risk of choosing colors that might conflict with each other.

\subsection{Remarks}

The greedy color reduction algorithm does not need to know the number of colors $x$ or the maximum degree $\Delta$; we only used them in the analysis. We can take any graph, blindly apply greedy color reduction, and we are guaranteed to reduce the number of colors by one\mydash provided that the number of colors was larger than $\Delta + 1$. In particular, we can apply the greedy color reduction repeatedly until we get stuck, at which point we have a \Dpocol{} of~$G$\mydash we will formalize and generalize this idea in Exercise~\ref{ex:greedy-iterate}.

\section[{Efficient \texorpdfstring{$(\Delta+1)$}{(Δ+1)}-coloring}]{\boldmath Efficient $(\Delta+1)$-coloring}

In the remaining sections we will describe two coloring algorithms that, together with the greedy algorithm from the previous section, can be used to $(\Delta+1)$-color graphs of maximum degree $\Delta$.

On a high level, the $(\Delta+1)$-coloring algorithm is composed of the following subroutines:
\begin{enumerate}
  \item Algorithm from Section~\ref{sec:delta2-coloring}: Using unique identifiers as input, compute an $O(\Delta^2)$-coloring $x$ in $O(\log^* n)$ rounds.
  \item Algorithm from Section~\ref{sec:additive-group-col}: Given $x$ as input, compute an $O(\Delta)$-coloring $y$ in $O(\Delta)$ rounds.
  \item Algorithm from Section~\ref{sec:bdgreedy}: Given $y$ as input, compute a $(\Delta+1)$-coloring $z$ in $O(\Delta)$ rounds.
\end{enumerate}
We have already seen the greedy algorithm that we will use in the final step; we will proceed in the reverse order and present next the algorithm that turns an $O(\Delta^2)$-coloring into an $O(\Delta)$-coloring. In what follows, we will assume that the nodes are given the values of $\Delta$ and $n$ as input; these assumptions will simplify the algorithms significantly.

\section{Additive-Group Coloring} \label{sec:additive-group-col}

Consider two clocks with $q$ steps, for any prime $q$; see Figure~\ref{fig:clocks}. The first clock moves its hand $a$ steps in each time unit, and the second clock moves its hand $b \neq a$ steps in each time unit. Starting from the same position, when are the two hands in the same position again?

\begin{figure}
    \centering
    \includegraphics[scale=0.25,page=\PClocks]{figs.pdf}
    \caption{Two clocks for $q=7$. The blue hand moves 2 steps per time unit, and the orange hand 3 steps. Hands moving at different speeds meet again after $q$ moves, but not before.}\label{fig:clocks}
\end{figure}

It is a fundamental property of \emph{finite fields} that they are in the same position again after exactly $q$ steps. We recap definitions and facts about finite fields in Section~\ref{app:finite-fields}.

Building on this observation, we construct an algorithm where each node behaves like a clock with one hand, turning its hand with some constant speed. We will use the input coloring to ensure that \emph{clocks with the same starting position turn their hands at different speeds}. Then we will simply wait until a clock is in a position not shared by any of the neighbors, and this position becomes the final color of the node. If we do not have too many neighbors, each node will eventually find such a position, leading to a proper coloring.

\subsection{Algorithm}\label{sec:additive-group-col-alg}

Let $q$ be a prime number with $q > 2\Delta$. We assume that we are given a coloring with $q^2$ colors, and we will show how to construct a coloring with $q$ colors in $O(q)$ rounds. Put otherwise, we can turn a coloring with $O(\Delta^2)$ colors into a coloring with $O(\Delta)$ colors in $O(\Delta)$ rounds, as long as we choose our prime number $q$ in a suitable manner.

If we have an input coloring with $q^2$ colors, we can represent the color of node $v$ as a pair $f(v) = \langle f_1(v), f_2(v) \rangle$ where $f_1(v)$ and $f_2(v)$ are integers between $0$ and $q-1$.

Using the clock analogue, $v$ can be seen as a clock with the hand at position $f_2(v)$, turning at speed $f_1(v)$. In the algorithm we will stop clocks by setting $f_1(v) = 0$ whenever this is possible in a conflict-free manner. When all clocks have stopped, all nodes have colors of the form $\langle 0, f_2(v) \rangle$ where $f_2(v)$ is between $0$ and $q-1$, and hence we have got a proper coloring with $q$ colors.

We say that two colors $\langle a_1, a_2 \rangle$ and $\langle b_1, b_2 \rangle$ are in \emph{conflict} if $a_2 = b_2$. The algorithm repeatedly performs the following steps:
\begin{itemize}[noitemsep]
  \item Each node sends its current colors to each neighbor.
  \item For each node $v$, if $f(v)$ is in conflict with any neighbor, set
  \begin{align*}
    f(v) &\gets \bigl\langle f_1(v),\, (f_1(v) + f_2(v)) \bmod q \bigr\rangle.
  \intertext{Otherwise, set}
    f(v) &\gets \bigl\langle 0,\, f_2(v) \bigr\rangle.
  \end{align*}
\end{itemize}
In essence, we stop non-conflicting clocks and keep moving all other clocks at a constant rate. We say that a node $v$ is \emph{stopped} when $f_1(v) = 0$; otherwise it is \emph{running}; note a stopped node will not change its color any more.

We show that after $O(q)$ iterations of this loop, all nodes will be stopped, and they form a proper coloring\mydash assuming we started with a proper coloring.

\subsection{Correctness}

First, we show that in each iteration a proper coloring remains proper. In what follows, we use $f$ to denote the coloring before one iteration and $g$ to denote the coloring after the iteration. Consider a fixed node $v$ and an arbitrary neighbor $u$. We show by a case analysis that $f(v) \neq f(u)$ implies $g(v) \neq g(u)$.
\begin{enumerate}[label=(\arabic*)]
  \item Assume that $v$ is stopped after this round; then $g(v) = \langle 0, f_2(v) \rangle$.
  \begin{enumerate}
    \item If $f_1(u) = 0$, then $u$ has stopped and $g(u) = f(u)$. By assumption $f(v) \neq f(u)$ and therefore $g(v) \neq g(u)$.
    \item If $f_1(u) \neq 0$ and $f(u)$ is not in conflict with its neighbors, then $g(u) = \langle 0, f_2(u) \rangle$. As there are no conflicts with $v$, we must have $f_2(v) \neq f_2(u)$, and therefore $g(v) \neq g(u)$.
    \item Otherwise $f_1(u) \neq 0$ and $f(u)$ is in conflict with a neighboring color. Then $g_1(u) = f_1(u) \neq 0 = g_1(v)$, and therefore $g(v) \neq g(u)$.
  \end{enumerate}
  \item Otherwise we have $g(v) = \langle f_1(v), (f_1(v) + f_2(v)) \bmod q \rangle$, where $f_1(v) \ne 0$.
  \begin{enumerate}
    \item If $u$ has stopped, then $g_1(u) = 0$, and therefore $g(v) \neq g(u)$.
    \item Otherwise $u$ is running. Then \[g(u) = \langle f_1(u), (f_1(u)+f_2(u)) \bmod q \rangle.\] If $f_1(v) \ne f_1(u)$, we will have $g_1(v) \ne g_1(u)$ and therefore $g(v) \ne g(u)$. Otherwise $f_1(v) = f_1(u)$ but then by assumption we must have $f_2(v) \ne f_2(u)$, which implies $g_2(v) \ne g_2(u)$ and therefore $g(v) \ne g(u)$.
  \end{enumerate}
\end{enumerate}

\subsection{Running Time}

Next we analyze the running time. Assume that we start with a proper coloring $f$. We want to show that after a sufficient number of iterations of the additive-group algorithm, each node must have had an iteration in which its color did not conflict with color of its neighbors, and hence got an opportunity to stop.

Let $f^0$ denote the initial coloring before the first iteration and let $f^i$ denote the coloring after iteration $i = 1, 2, \dotsc$. The following lemma shows that two running nodes do not conflict too often during the execution.

\begin{lemma} \label{lem:agc-running-conflict}
  Consider $t$ consecutive iterations of the additive-group coloring algorithm, for $t \leq q$. Let $u$ and $v$ be adjacent nodes such that both of them are still running before iteration $t$. Then there is at most one iteration $i = 0, 1, \dotsc, t-1$ with a conflict $f_2^i(u) = f_2^i(v)$.
\end{lemma}

\begin{proof}
  Assume that for some $i$ we have $f^i(u) = \langle a, b \rangle$ and $f^i(v) = \langle a', b \rangle$ with $a \ne a'$. In the subsequent iterations $j=i+1,i+2,\dots$, we have
  \[
    f^j_2(u) - f^j_2(v) \equiv (a-a')(j-i) \mod q.
  \]
  Assume that for some $j$ we have another conflict $f^j_2(u) = f^j_2(v)$, implying that $(a-a')(j-i) \equiv 0 \mod q$. If a prime divides a product $xy$ of two integers $x$ and $y$, then it also divides $x$ or $y$ (Euclid's Lemma). But $a-a'$ cannot be a multiple of $q$, since $a \ne a'$ and $0 \le a, a' < q$, and $j-i$ cannot be a multiple of $q$, either, since $0 \le i < j < q$.
\end{proof}

We also need to show that a node is not in conflict with a stopped node too often.

\begin{lemma} \label{lem:agc-finished-conflict}
  Consider $t$ consecutive iterations of the additive-group coloring algorithm, for $t \leq q$. Let $u$ and $v$ be adjacent nodes such that $u$ is still running before iteration $t$ but $v$ was stopped before iteration $1$. Then there is at most one iteration $i = 0, 1, \dotsc, t-1$ with a conflict $f_2^i(u) = f_2^i(v)$.
\end{lemma}

\begin{proof}
  The same argument as in the proof of Lemma~\ref{lem:agc-running-conflict} works, this time with $a' = 0$.
\end{proof}

It remains to show that, based on Lemmas~\ref{lem:agc-running-conflict} and \ref{lem:agc-finished-conflict}, the algorithm finishes fast.

Consider a sequence of consecutive $q > 2\Delta$ iterations of the additive-group coloring algorithm starting with any initial coloring $f$. Consider an arbitrary node $u$ that does not stop during any of these rounds. Let $v$ be a neighbor of $u$. No matter if and when $v$ stops, the color of $v$ will conflict with color of $u$ at most twice during the $q$ rounds:
\begin{itemize}
    \item Consider the rounds (if any) in which $v$ is running. There are at most $q$ such rounds. By Lemma~\ref{lem:agc-running-conflict}, $u$ conflicts with $v$ at most once during these rounds.
    \item Consider the remaining rounds (if any) in which $v$ is stopped. There are at most $q$ such rounds. By Lemma~\ref{lem:agc-finished-conflict}, $u$ conflicts with $v$ at most once during these rounds.
\end{itemize}
So for each neighbor $v$ of $u$, there are at most $2$ rounds among $q$ rounds such that the color of $v$ conflicts with the color of $u$. As there are at most $\Delta$ neighbors, there are at most $2\Delta$ rounds among $q$ rounds such that the color of some neighbor of $u$ conflicts with the current color of $u$. But $q > 2\Delta$, so there has to be at least one round after which none of the neighbors are in conflict with $u$---and hence there will be an opportunity for $u$ to stop.

\section[Fast \texorpdfstring{$O(\Delta^2)$}{O(Δ²)}-coloring]{\boldmath Fast $O(\Delta^2)$-coloring} \label{sec:delta2-coloring}

The additive-group coloring algorithm assumes that we start with an $O(\Delta^2)$-coloring of the network. In this section we present an algorithm that computes an $O(\Delta^2)$-coloring in $O(\log^* n)$ communication rounds.

The algorithm proceeds in two phases. In the first phase, the coloring given by the unique identifiers is iteratively reduced to an $O(\Delta^2 \log^2 \Delta)$-coloring. In the second phase, a final color reduction step yields an $O(\Delta^2)$ coloring.

Both phases are based on the same combinatorial construction, called a cover-free set family. We begin by describing the construction for the first phase.

\subsection{Cover-Free Set Families}

The coloring algorithm is based on the existence of non-covering families of sets. Intuitively, these are families of sets such that any two sets do not have a large overlap: then no small collection of sets contains all elements in another set. Therefore, if each node is assigned such a set, it can find an element that is not in the sets of its neighbors, and pick that element as its new color.

\begin{figure}
  \centering
  \includegraphics[scale=0.4,page=\PCoverFreeSet]{figs.pdf}
  \caption{A 2-cover-free set family $J$ of 5 subsets of a base set $X$ on 7 elements. No two sets cover a third distinct set.}\label{fig:cover-free-sets}
\end{figure}

A family $J$ of $n$ subsets of $\{1, \dots, m \}$ is \emph{$k$-cover-free} if for every $S \in J$ and every collection of $k$ sets $S_1, \dots, S_k \in J$ distinct from $S$ we have that
\[
  S \nsubseteq \bigcup_{i=1}^{k} S_i.
\]
See Figure~\ref{fig:cover-free-sets} for an example.

\subsection{Constructing Cover-Free Set Families}

Cover-free set families can be constructed using \emph{polynomials over finite fields}. The example of finite fields we are interested in is $\GF(q)$ for a prime $q$, which is simply modular arithmetic of integers modulo $q$. We consider polynomials over such a field. A brief recap is given in Section~\ref{app:finite-fields}.

A basic result about polynomials states that two distinct polynomials evaluate to the same value at a bounded number of points

\begin{lemma} \label{lem:poly-roots}
  Let $f,g$ be two distinct polynomials of degree $d$ over a finite field $\GF(q)$, for some prime $q$. Then $f(x) = g(x)$ holds for at most $d$ elements $x \in \GF(q)$.
\end{lemma}
\begin{proof}
See Section~\ref{app:finite-fields}.
\end{proof}

Now fix a prime $q$. Our base set will be $X = \GF(q) \times \GF(q)$. Thus we have that $|X| = m = q^2$.

For a positive natural number $d$, consider $\Poly(d,q)$, the set of polynomials of degree $d$ over $\GF(q)$. For each polynomial $g \in \Poly(d,q)$, fix the set \[S_g = \bigl\{ (a, g(a)) \bigm| a \in \GF(q) \bigr\}\] that is associated with this polynomial. Note that each $S_g$ contains exactly $q$ elements: one for each element of $\GF(q)$. Then we can define the family \[J = J_{d,q} = \bigl\{ S_g \bigm| g \in \Poly(d,q) \bigr\}.\]

Consider any two distinct polynomials $f$ and $g$ in $\Poly(d,q)$: by Lemma~\ref{lem:poly-roots} there are at most $d$ elements $a$ such that $f(a) = g(a)$. Therefore $|S_f \cap S_g| \leq d$, and $J$ is a $\lfloor q/d \rfloor$-cover-free set family.

Any polynomial is uniquely defined by its coefficients. Therefore the set $J_{d,q}$ has size $q^{d+1}$, as it consists of a set of pairs for each polynomial of degree $d$.

By choosing parameters $q$ and $d$ we can construct a $\Delta$-cover free family that can be used to color efficiently.

\begin{lemma} \label{lem:delta-cover-free}
  For all integers $x$, $\Delta$ such that $x > \Delta \geq 2$, there exists a $\Delta$-cover-free family $J$ of $x$ subsets from a base set of $m \leq 4(\Delta+1)^2 \log^2 x$ elements.
\end{lemma}

\begin{proof}
  We begin by choosing a prime $q$ such that
  \[
    \bigl\lfloor (\Delta+1)\log x \bigr\rfloor \leq q \leq 2 \cdot \bigl\lfloor (\Delta+1)\log x \bigr\rfloor.
  \]
  By the Bertrand--Chebyshev theorem such a prime must always exist. Set $d = \lfloor \log x \rfloor$. By the previous observation, the family $J_{d,q}$, for the above parameter settings, is a $\lfloor q / d \rfloor$-cover-free family, where
  \[
    \lfloor q / d \rfloor \geq \biggl\lfloor \frac{\lfloor (\Delta+1)\log x \rfloor}{\lfloor \log x \rfloor} \biggr\rfloor \geq \biggl\lfloor \frac{(\Delta+1)\log x - 1}{\log x} \biggr\rfloor \geq \Delta.
  \]
  There are at least
  \[
  q^{d+1} \geq (\Delta \log x)^{\log x } > x
  \]
  sets in $J_{d,q}$, so we can choose $x$ of them. The base set has \[q^2 \leq 4(\Delta+1)^2 \log^2 x\] elements.
\end{proof}

\subsection{Efficient Color Reduction} \label{ssec:efficient-cr}

Using $\Delta$-cover-free sets we can construct an algorithm that reduces the number of colors from $x$ to $y \leq 4(\Delta+1)^2 \log^2 x$ in one communication round, as long as $x > \Delta$.

Let $f$ denote the input $x$-coloring and $g$ the output $y$-coloring. Assume that $J$ is a $\Delta$-cover-free family of $x$ sets on a base set of $y$ elements, as in Lemma~\ref{lem:delta-cover-free}, that is ordered as $S_1, S_2, \dots, S_x$. The algorithm functions as follows.
\begin{enumerate}
  \item Each node $v \in V$ sends its current color $f(v)$ to each of its neighbors.
  \item Each node receives the colors $f(u)$ of its neighbors $u \in N(v)$. Then it constructs the set $S_{f(v)}$, and the sets $S_{f(u)}$ for all $u \in N(v)$. Since $f(v) \neq f(u)$ for all $u\in N(v)$, and $J$ is a $\Delta$-cover-free family, we have that
  \[
    S_{f(v)} \nsubseteq \bigcup_{u \in N(v)} S_{f(u)}.
  \]
  In particular, there exists at least one $c \in S_{f(v)} \setminus \cup_{u \in N(v)} S_{f(u)}$. Node $v$ sets $g(v) = c$ for the smallest such $c$.
\end{enumerate}

Now assume that $f$ is a proper coloring, that is, $f(v) \neq f(u)$ for all neighbors $v$ and $u$. This implies that for each node $v$, each of its neighbors $u$ selects a set that is different from $S_{f(v)}$; overall, the neighbors will select at most $\Delta$ distinct sets. Since $J$ is a $\Delta$-cover-free family, each node $v$ can find an element $c \in S_{f(v)}$ that is not in the sets of its neighbors. Therefore setting $g(v) = c$ forms a proper coloring. Finally, since the sets $S \in J$ are subsets of $\{1,\dots,y\}$, for $y \leq 4(\Delta+1)^2 (\log x)^2$, we have that $g$ is a $y$-coloring.

\subsection{Iterated Color Reduction}

By a repeated application of the color reduction algorithm it is possible to reduce the number of colors down to $O(\Delta^2 \log^2 \Delta)$. Assuming we start with an input $x$-coloring, this will take $O(\log^* x)$ rounds.

We will now show that $O(\log^* x)$ iterations of the color reduction algorithm will reduce the number of colors from $x$ to $O(\Delta^2 \log^2 \Delta)$. We assume that in the beginning, both $x$ and $\Delta$ are known. Therefore after each iteration, all nodes know the total number of colors.

Assume that $x > 4(\Delta+1)^2 \log^2 \Delta$. Repeated iterations of the color reduction algorithm reduce the number of colors as follows:
\begin{align*}
  x_0 \mapsto x_1 &\leq 4(\Delta+1)^2 \log^2 x, \\
  x_1 \mapsto x_2 &\leq 4(\Delta+1)^2 \log^2 (4(\Delta+1)^2 \log^2 x) \\
  & {} = 4(\Delta+1)^2 \bigl(\log 4 + 2\log (\Delta+1) + 2\log \log x\bigr)^2.
\intertext{If $\log \log x \geq \log 4 + 2\log (\Delta+1)$, we have that}
  x_2 & \leq 4(\Delta+1)^2(3\log \log x)^2 \\
  &= \bigl(6 (\Delta+1) \log \log x\bigr)^2.
\intertext{In the next step, we reduce colors as follows:}
  x_2 \mapsto  x_3 &\leq 4(\Delta+1)^2 \log^2 \bigl(36(\Delta+1)^2 (\log \log x)^2\bigr) \\
  & = 4(\Delta+1)^2 \bigl(\log 36 + 2\log (\Delta+1) + 2\log \log \log x\bigr)^2.
\intertext{If $\log \log \log x \geq \log 36 + 2\log (\Delta+1) \}$, we have that}
  x_3 &\leq 4(\Delta+1)^2(3\log \log \log x)^2 \\
  &= \bigl(6(\Delta+1) \log \log \log x\bigr)^2.
\end{align*}
Now we can see the pattern: as long as
\[
\log^{(i)} x \geq \log 36 + 2\log (\Delta+1) \},
\]
where $\log^{(i)} x$ is the $i$ times iterated logarithm of $x$, we reduce colors from $(6(\Delta+1)\log^{(i-1)} x)^2$ to $(6(\Delta+1)\log^{(i)} x)^2$ in the $i$th step.

Once $\log^{(i)} x \geq \log 36 + 2\log (\Delta+1) \}$ no longer holds, we have a coloring with at most
\[
c_{\Delta} = 4(\Delta+1)^2 \bigl(3(\log 36 + 2\log (\Delta+1))\bigr)^2
\]
colors. We can numerically verify that for all $\Delta \geq 2$, we have that
\[
  4(\Delta+1)^2 \bigl(3(\log 36 + 2\log (\Delta+1))\bigr)^2 \leq (11(\Delta+1))^3.
\]
We will use this observation in the next step.

It remains to calculate how many color reduction steps are required. By definition, after $T = \log^* x$ iterations we have that $\log^{(T)} x \leq 1$. Thus, after at most $\log^* x$ iterations of the color reduction algorithm we have a coloring with at most $c_{\Delta}$ colors.

\subsection{Final Color Reduction Step} \label{ssec:final-step}

In the last step, we will reduce the coloring to an $O(\Delta^2)$-coloring. We will use another construction of $\Delta$-cover-free families based on polynomials.

\begin{lemma} \label{lem:delta3-to-delta2}
  For all $\Delta$, there exists a $\Delta$-cover-free family $J$ of $x$ subsets from a base set of $m \le (22(\Delta+1))^2$ elements for $x \leq (11(\Delta+1))^3$.
\end{lemma}

This immediately gives us the following color reduction algorithm.

\begin{corollary}
  There is a distributed algorithm that, given a $(11(\Delta+1))^3$-coloring as an input, in one round computes a $(22(\Delta+1))^2$-coloring.
\end{corollary}

\begin{proof}[Proof of Lemma~\ref{lem:delta3-to-delta2}]
  Our base set will be $X$ with $|X| = m = q^2$, for a prime $q$. Again it is useful to see $X = \GF(q) \times \GF(q)$ as pairs of elements from the finite field over $q$ elements.

  Now consider polynomials $\Poly(2,q)$ of degree 2 over $\GF(q)$. For each such polynomial $g \in \Poly(2,q)$, let
  \[
    S_g = \bigl\{ (a, g(a)) \bigm| a \in \GF(q) \bigr\}
  \]
  be the pairs defined by the valuations of the polynomial $g$ at each element of $\GF(q)$. We have that $|S_g| = q$ for all $g$.

  Now we can construct the family \[J = J_{2,q} = \bigl\{ S_g \bigm| g \in \Poly(2,q) \bigr\}\] as the collection of point sets defined by all polynomials of degree 2. We have that $|J| = q^3$ since a polynomial is uniquely determined by its coefficients.

  By Lemma~\ref{lem:poly-roots}, we have that $|S_f \cap S_g| \leq 2$ for any distinct polynomials $f,g \in P(2,q)$. Therefore covering any set $S_g$ requires at least $\lceil q/2 \rceil$ other sets (distinct from $S_g$) from $J$.

  We are now ready to prove that $J$ is a $\Delta$-cover-free family for suitable parameter settings. Since each set $S_g$ contains $q$ elements, and the intersection between the sets of distinct polynomials is at most $2$, we want to find $q$ such that $2\Delta \leq q - 1$ and $q^3$ is large enough. Using the Bertrand--Chebyshev theorem we know that there exists a prime $q$ such that
  \[
    11(\Delta + 1) \leq q \leq 22(\Delta + 1).
  \]
  Any value $q$ from this range is large enough. The base set $X$ has size
  \[
  m = q^2 \leq (22(\Delta + 1))^2.
  \]
  The family $J$ has size
  \[
    |J| \geq (11(\Delta + 1))^3.
  \]
  Finally, since we choose $q \geq 2\Delta + 1$, we have that no collection of $\Delta$ sets $\mathcal{S} = \{ S_1, S_2, \dots, S_{\Delta} \} \subseteq J$ can cover a set $S \notin \mathcal{S}$.
\end{proof}

\section{Putting Things Together}

It remains to show how to use the three algorithms we have seen so far together.

\begin{theorem}
  Assume that we know parameters $\Delta$ and $n$, and some polynomial bound $n^c$ on the size of the unique identifiers. Graphs on $n$ vertices with maximum degree $\Delta$ can be $(\Delta+1)$-colored in $O(\Delta + \log^* n)$ rounds in the $\LOCAL$ model.
\end{theorem}

\begin{proof}
  We begin with the unique identifiers, and treat them as an initial coloring with $n^c$ colors.
  \begin{enumerate}
    \item In the first phase we run the efficient color reduction algorithm from Section~\ref{ssec:efficient-cr} for $T_1 = \log^* (n^c) = O(\log^* n)$ rounds to produce a coloring $y_1$ with at most $(11(\Delta+1))^3$ colors.
    \item In the second phase, after $T_1$ rounds have passed, each vertex can apply the final color reduction step from Section~\ref{ssec:final-step} to compute a coloring $y_2$. This reduces colors from $(11(\Delta+1))^3$ to $(22(\Delta+1))^2$.
    \item After $T_1 + 1$ rounds, we have computed an $O(\Delta^2)$-coloring $y_2$. Now each vertex runs the additive-group coloring algorithm from Section~\ref{sec:additive-group-col}, applying it with $y_2$ as input. For a parameter $q \leq 2\sqrt{(22(\Delta+1))^2} = 44\Delta+44$, this algorithm runs for $T_2 = q$ steps and computes a $q$-coloring $y_3$.
    \item In the last phase, after $T_1 + 1 + T_2$ rounds, we apply the greedy color reduction algorithm from Section~\ref{sec:bdgreedy} iteratively $T_3 = 43\Delta+43$ times. Each iteration requires one round and reduces the maximum color by one.
  \end{enumerate}
  After a total of
  \begin{align*}
      T_1 + 1 + T_2 + T_3 &\leq \log^* (n^c) + 87\Delta + 88 \\
      &= O(\Delta + \log^* n)
  \end{align*}
  rounds, we have computed a $(\Delta+1)$-coloring.
\end{proof}

\section{Quiz}

Consider the algorithm from Section~\ref{sec:additive-group-col-alg} in the following setting:
\begin{itemize}[noitemsep]
    \item The network is a complete graph with $n = 4$ nodes; hence the maximum degree is $\Delta = 3$, and we can choose $q = 7 > 2\Delta$.
    \item We are given a coloring with $q^2 = 49$ colors; we can represent the possible input colors as pairs $(0,0),\allowbreak (0,1),\allowbreak \dotsc,\allowbreak (6,6)$.
\end{itemize}
Give an example of an input coloring such that we need to do exactly $6$ iterations of the algorithm until all nodes have reached their final colors, i.e., colors of the form $(0,x)$.

Please give the answer by listing the four original color pairs of the nodes in any order; for example, if we asked for a coloring in which you need exactly 3 iterations, this would be a correct answer: $(2, 3)$, $(3, 2)$, $(3, 6)$, $(4, 6)$.

\section{Exercises}

\begin{ex}[applications]
    Let $\Delta$ be a known constant, and let $\calF$ be the family of graphs of maximum degree at most $\Delta$. Design fast distributed algorithms that solve the following problems on $\calF$ in the $\LOCAL$ model.
    \begin{subex}
        \item Maximal independent set.
        \item Maximal matching.
        \item Edge coloring with $O(\Delta)$ colors.
    \end{subex}
    You can assume that all nodes get the value of $n$ (the number of nodes) as input; also the parameter $c$ in the identifier space is a known constant, so all nodes know the range of unique identifiers.
\end{ex}

\begin{ex}[vertex cover]
    Let $\calF$ consist of cycle graphs. Design a fast distributed algorithm that finds a \Apx{1.1} of a minimum vertex cover on $\calF$ in the $\LOCAL$ model.

    \hint{Solve small problem instances by brute force and focus on the case of long cycles. In a long cycle, use a graph coloring algorithm to find a $3$-coloring, and then use the $3$-coloring to construct a maximal independent set. Observe that a maximal independent set partitions the cycle into short fragments (with 2--3 nodes in each fragment).

    Apply the same approach recursively: interpret each fragment as a ``supernode'' and partition the cycle that is formed by the supernodes into short fragments, etc. Eventually, you have partitioned the original cycle into \emph{long} fragments, with dozens of nodes in each fragment.

    Find an optimal vertex cover within each fragment. Make sure that the solution is feasible near the boundaries, and prove that you are able to achieve the required approximation ratio.}
\end{ex}

\begin{ex}[iterated greedy]\label{ex:greedy-iterate}
    Design a color reduction algorithm $A$ with the following properties:
    given any graph $G = (V,E)$ and any proper vertex coloring~$f$,
    algorithm $A$ outputs a proper vertex coloring~$g$ such that
    for each node $v \in V$ we have $g(v) \le \deg_G(v) + 1$.

    Let $\Delta$ be the maximum degree of $G$, let $n = |V|$ be the number of nodes in $G$, and let $x$ be the number of colors in coloring $f$. The running time of $A$ should be at most
    \[
        \min \{ n, x \} + O(1).
    \]
    Note that the algorithm does not know $n$, $x$, or $\Delta$. Also note that we may have either $x \le n$ or $x \ge n$.

    \hint{Adapt the basic idea of the greedy color reduction algorithm\mydash find local maxima and choose appropriate colors for them\mydash but pay attention to the stopping conditions and low-degree nodes. One possible strategy is this: a node becomes active if its current color is a local maximum among those neighbors that have not yet stopped; once a node becomes active, it selects an appropriate color and stops.}
\end{ex}

\begin{ex}[distance-$2$ coloring]\label{ex:distance2col}
    Let $G = (V,E)$ be a graph. A \emph{distance-$2$ coloring with $k$ colors} is a function $f \colon V \to \{1,2,\dotsc,k\}$ with the following property:
    \[
        \dist_G(u,v) \le 2 \text{ implies } f(u) \ne f(v) \text{ for all nodes } u \ne v.
    \]

    Let $\Delta$ be a known constant, and let $\calF$ be the family of graphs of maximum degree at most $\Delta$. Design a fast distributed algorithm that finds a distance-$2$ coloring with $O(\Delta^2)$ colors for any graph $G \in \calF$ in the $\LOCAL$ model.

    You can assume that all nodes get the value of $n$ (the number of nodes) as input; also the parameter $c$ in the identifier space is a known constant, so all nodes know the range of unique identifiers.

    \hint{Given a graph $G \in \calF$, construct a virtual graph $G^2 = (V, E')$ as follows: $\{u,v\} \in E'$ if $u \ne v$ and $\dist_G(u,v) \le 2$. Prove that the maximum degree of $G^2$ is $O(\Delta^2)$. Simulate a fast graph coloring algorithm on $G^2$.}
\end{ex}

\begin{exs}[numeral systems]\label{ex:dpbit-base}
    The fast color reduction algorithm from Section~\longref{1.4}{sec:algo-p3cbit} is based on the idea of identifying a digit that differs in the \emph{binary} encodings of the colors. Generalize the idea: design an analogous algorithm that finds a digit that differs in the base-$k$ encodings of the colors, for an arbitrary $k$, and analyze the running time of the algorithm (cf.\ Exercise~\longref{1.6}{ex:logstar-tight}). Is the special case of $k = 2$ the best possible choice?
\end{exs}

\begin{exs}[from bits to sets]\label{ex:dpset}
    The fast color reduction algorithm from Section~\longref{1.4}{sec:algo-p3cbit} can reduce the number of colors from $2^x$ to $2x$ in one round in any directed pseudoforest, for any positive integer $x$. For example, we can reduce the number of colors as follows:
    \[
        2^{128} \to 256 \to 16 \to 8 \to 6.
    \]
    One of the problems is that an iterated application of the algorithm slows down and eventually ``gets stuck'' at $x = 3$, i.e., at six colors.

    In this exercise we will design a faster color reduction algorithm that reduces the number of colors from
    \[
        h(x) = \binom{2x}{x}
    \]
    to $2x$ in one round, for any positive integer $x$. For example, we can reduce the number of colors as follows:
    \[
        184756 \to 20 \to 6 \to 4.
    \]
    Here
    \begin{align*}
        184756 &= h(10), \\
        2 \cdot 10 = 20 &= h(3), \\
        2 \cdot 3 = 6 &= h(2).
    \end{align*}
    In particular, the algorithm does not get stuck at six colors; we can use the same algorithm to reduce the number of colors to four. Moreover, at least in this case the algorithm seems to be much more efficient\mydash it can reduce the number of colors from $184756$ to $6$ in two rounds, while the prior algorithm requires three rounds to achieve the same reduction.

    The basic structure of the new algorithm follows the fast color reduction algorithm\mydash in particular, we use one communication round to compute the values $s(v)$ for all nodes $v \in V$. However, the technique for choosing the new color is different: as the name suggests, we will not interpret colors as bit strings but as \emph{sets}.

    To this end, let $H(x)$ consist of all subsets
    \[
        X \subseteq \{1,2,\dotsc,2x\}
    \]
    with $|X| = x$. There are precisely $h(x)$ such subsets, and hence we can find a bijection
    \[
        L\colon \{1,2,\dotsc,h(x)\} \to H(x).
    \]

    We have $f(v) \ne s(v)$. Hence $L(f(v)) \ne L(s(v))$. As both $L(f(v))$ and $L(s(v))$ are subsets of size $x$, it follows that
    \[
        L(f(v)) \setminus L(s(v)) \ne \emptyset.
    \]
    We choose the new color $g(v)$ of a node $v \in V$ as follows:
    \[
        g(v) = \min \bigl( L(f(v)) \setminus L(s(v)) \bigr).
    \]

    Prove that this algorithm works correctly. In particular, show that $g\colon V \to \{1,2,\dotsc,2x\}$ is a proper graph coloring of the directed pseudoforest~$G$.

    Analyze the running time of the new algorithm and compare it with the old algorithm. Is the new algorithm always faster? Can you prove a general result analogous to the claim of Exercise~\longref{1.6}{ex:logstar-tight}?
\end{exs}

\begin{exs}[dominating set approximation]\label{ex:greedy-domset}
    Let $\Delta$ be a known constant, and let $\calF$ be the family of graphs of maximum degree at most $\Delta$. Design an algorithm that finds an \Apx{O(\log \Delta)} of a minimum dominating set on $\calF$ in the $\LOCAL$ model.

    \hint{First, design (or look up) a greedy \emph{centralized} algorithm achieves an approximation ratio of $O(\log \Delta)$ on $\calF$. The following idea will work: repeatedly pick a node that \emph{dominates} as many new nodes as possible\mydash here a node $v \in V$ is said to dominate all nodes in $\ball_G(v,1)$. For more details, see a textbook on approximation algorithms, e.g., Vazirani~\cite{vazirani01approximation}.

    Second, show that you can \emph{simulate} the centralized greedy algorithm in a distributed setting. Use the algorithm of Exercise~\ref{ex:distance2col} to construct a distance-$2$ coloring. Prove that the following strategy is a faithful simulation of the centralized greedy algorithm:
    \begin{itemize}[label=--,noitemsep]
        \item For each possible value $i = \Delta+1, \Delta, \dotsc, 2, 1$:
        \begin{itemize}[label=--,nolistsep,topsep=1ex]
            \item For each color $j = 1, 2, \dotsc, O(\Delta^2)$:
            \begin{itemize}[label=--,nolistsep,topsep=1ex]
                \item Pick all nodes $v \in V$ that are of color $j$ and that dominate $i$ new nodes.
            \end{itemize}
        \end{itemize}
    \end{itemize}
    The key observation is that if $u,v \in V$ are two distinct nodes of the same color, then the set of nodes dominated by $u$ and the set of nodes dominated by $v$ are disjoint. Hence it does not matter whether the greedy algorithm picks $u$ before $v$ or $v$ before $u$, provided that both of them are equally good from the perspective of the number of new nodes that they dominate. Indeed, we can equally well pick both $u$ and $v$ simultaneously in parallel.}
\end{exs}

\section{Bibliographic Notes}

The model of computing is from Linial's~\cite{linial92locality} seminal paper, and the name $\LOCAL$ is from Peleg's~\cite{peleg00distributed} book. The additive-group coloring algorithm is due to Barenboim et al.\ \cite{barenboim18iterative}. The effective color reduction algorithm is from Linial~\cite{linial92locality}, and the construction of cover-free families from Barenboim and Elkin~\cite{barenboim13distributed}.
The algorithm of Exercise~\ref{ex:greedy-domset} is from Friedman and Kogan~\cite{friedman11deterministic}. The Bertrand--Chebyshev theorem was first proven by Chebyshev~\cite{chebyshev1852primes}. The proof of Lemma~\ref{lem:poly-roots} follows the proofs of Abraham~\cite{abraham2020polynomials}.