Explain Application of Risch's Structure Theorem for Elementary Functions Could you please explain the application of Risch's structure theorem for elementary functions and give some detailed examples?
The Structure Theorem for Elementary Functions:
"Let $(\mathfrak{E},Y)$ be elementary over $(\mathfrak{D},X)$. kernel $Y= K$. $\mathfrak{D}_1=\mathfrak{D}(\theta_1,...,\theta_m)$, $\mathfrak{E}=\mathfrak{D}_1(\theta)$. Let $z_1=e^{y_1},...,z_q=e^{y_q},\log z_{q+1}=y_{q+1},...,\log z_r=y_r$ be the exponentials and logarithms occurring among $\theta_1,...,\theta_m$. (See remark following definition at beginning of this part.) Suppose either $\theta=z=e^y$ is algebraic over $\mathfrak{D}_1$, or $\theta=y=\log z$ is algebraic over $\mathfrak{D}_1$ (where $y$ or respectively $z$ is in $\mathfrak{D}_1$). Then
(1) there are $c_i\in K$, $f\in \tilde{\mathfrak{D}}$ (= alg. closure of $\mathfrak{D}$ in $\mathfrak{E}$) such that $y+\sum_1^rc_iy_i=f$, and (after a permutation of indices) $1,c_{s+1},...,c_r,0\le s\le r$ form a
maximal $\mathbb{Q}$ linearly independent set of the coefficients $1,c_1,...,c_r$;
(2) there are $n\neq 0$, $n_i\in\mathbb{Z}$, $g\in\mathfrak{D}$ such that $z^n\Pi_{i=1}^s z_i^{n_i}=g$.
Furthermore if $(\mathfrak{D},X)=(K(z),d/dz)$, then $f$ and $g$ can be chosen to be in $K$, $r=s$, and $c_i=n_i/n$, $i=1,...,r$."
[Risch 1979] Risch, R. H.: Algebraic Properties of the Elementary Functions of Analysis. Amer. J. Math 101 (1979) (4) 743-759
I know the mathematical terms field, differential field, field extension, elementary extension, elementary function, and all the mathematical terms in the theorem.
But how can the theorem help in detail to decide if a given $\theta$ is algebraic over $\mathfrak{D}_1$?
 A: I found further three different formulations of Risch's theorem.
$\ $
Bronstein, M.: Symbolic Integration I. Transcendental Functions. Springer, 1997, p. 278, 279:
"... we define the following index sets:
$E_{K/k}\ =\ \{i\in \{1,...,n\}$ such that $t_i$ transcendental over $k(t_1,...,t_{i-1})$ and $Dt_i/t_i=Da_i, a_i\in k(t_1,...,t_{i-1})\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $ (9.6)
and
$L_{K/k}\ =\ \{i\in \{1,...,n\}$ such that $t_i$ transcendental over $k(t_1,...,t_{i-1})$ and $Dt_i=Da_i/a_i, a_i\in k(t_1,...,t_{i-1})^*\}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $ (9.7)
Theorem 9.3.1 (Risch [62]). Let $C$ be a field, $x$ be trancendental over $C$, and $(K,D)$ be an elementary extension of $(C(x),d/dx)$ with $Const_D(K)=C$. Write $K=C(x)(t_1,...,t_n)$ with each $t_i$ elementary over $C(x)(t_1,...,t_{i-1})$, and let $E_{K/C(x)}$ and $L_{K/C(x)}$ be given by (9.6) and (9.7) respectively. If there are $v\in K$ and $u\in K^*$ such that $Dv=Du/u$, then there are $r_i\in\mathbb{Q}$ such that
$$v+\sum_{i\in L_{K/C(x)}}r_it_i+\sum_{i\in E_{K/C(x)}}r_ia_i\in C$$
where $t_i=\exp(a_i)$ for $i\in E_{K/C(x)}$."
This formulation shows explicitly that one actually has to use both index sets in the general case.
$\ $
Iványi, A. (Ed.): Algorithms of Informatics. Volume 1. Budapest:
"Theorem $\ $6.24 (Structue theorem). Let $K$ be the field of constants and $K_n=K(x,\theta_1,...,\theta_n)$ a differential extension field of $K(x)$, which has constant field $K$. Let us assume that for all $j$, either $\theta_j$ is algebraic over $K_{j-1}=K(x,\theta_1,...,\theta_{j-1})$, or $\theta_j=w_j$, with $w_j=\log(u_j)$ and $u_j\in K_{j-1}$, or $\theta_j=u_j$, with $u_j=\exp(w_j)$ and $w_j\in K_{j-1}$. Then

*

*$g=\log(f)$, where $f\in K_n/K$, is monomial over $K_n$ if and only if there is no product

$$f^k\cdot \prod u_j^{k_j},\ \ k,k_j\in\mathbb{Z},k\neq 0$$
which is an element of $K$;


*$g=\exp(f)$, where $f\in K_n/K$, is monomial over $K_n$ if and only if there is no linear combination

$$f+\sum c_jw_j,\ \ c_j\in\mathbb{Q}$$
which is an element of $K$."
$\ $
Smith, R.: Computer Algebra and Algebraic Programming. Quad’s Printing - St. Paul, 2010, p. 66:
"Theorem 12.1 (Risch Structure Theorem) Let $F=K(\theta_1,...,\theta_n)$ be a differential field and let $\eta\in F$. Let $E=\{n\ |\ \theta_n=e^{\eta_n}\}$ and $L=\{n\ |\ \theta_n=\ln\eta_n\}$. Assume that $|E|+|L|=n-1$ (because $\theta_1=x$). Then

*

*$e^\eta$ is algebraic over $F$ iff there exists a $c\in K$ and rationals $r_i$ such that

$\eta=c+\sum_{i\in E}r_i\eta_i+\sum_{i\in L}r_i\theta_i$, or $\ \ \ \ \ \ \ \ \ \ \ $(12.1)


*$\ln\eta$ is algebraic over $F$ iff there exists a $c\in K$ and rationals $r_i$ such that

$\eta=c\prod_{i\in E}\theta_i^{r_i}\cdot\prod_{i\in L}\eta_i^{r_i}\Leftrightarrow \frac{D\eta}{\eta}=\sum_{i\in E}r_i(D\eta_i)+\sum_{i\in L}r_i\frac{D\eta_i}{\eta_i}$. $\ \ \ \ \ \ \ \ $(12.2)"
$\ $
The last two equations (12.1, 12.2) show that one can apply the structure theorem to $\exp(\eta)$ and to $\log(\eta)$ and that both index sets are applied.
$\ $
Examples of application are given in [Epstein, Caviness 1979] for a similar structure theorem.
Risch's structure theorem is used in Manuel Bronstein's package EFSTRUX (Elementary Function Structure Package) which is contained in FriCAS. There is a command validExponential. Because logarithms need another treatment, there is no similar command for logartihms in FriCAS.
[Epstein, Caviness 1979] Epstein, H. I.; Caviness, B. F.: A structure theorem for the elementary functions and its application to the identity problem. Int. J.Comp. Inf. Sci. 8 (1979) 9-37
