The logarithm is non-linear! Or isn't it? The logarithm is non-linear
Almost unexceptionally, I hear people say that the logarithm was a non-linear function. If asked to prove this, they often do something like this:

We have
  $$
\ln(x + y) \neq \ln(x) + \ln(y) \quad\text{and}\quad \ln(\lambda \cdot x) = \ln(\lambda) + \ln(x) \neq \lambda \cdot \ln(x),
$$
  and therefore $\ln$ is not linear.

And indeed, the literature is abundant with the claim that...

... a function $f : V \to W$ is linear, if and only if
  $$
f(x + y) = f(x) + f(y) \quad\text{and}\quad f(\lambda \cdot x) = \lambda \cdot f(x)
$$
  for all $x,y$ and all scalars $\lambda$.

Often, there is no hint that the symbols $+$ and $\cdot$ on the left belong to $V$, whereas the symbols $+$ and the $\cdot$ on the right belong to $W$.
The logarithm is linear
My proof that the logarithm is a linear function goes like this:

$$\ln(x \cdot y) = \ln(x) + \ln(y) \quad\text{and}\quad \ln(x^\lambda) = \lambda \cdot \ln(x).$$

The rationale for this is that $\ln : \mathbb{R}_{>0} \to \mathbb{R}$, i.e., the logarithm is a function from the $\mathbb{R}$-vector space $\mathbb{R}_{>0}$ (the positive-real numbers), to the $\mathbb{R}$-vector space $\mathbb{R}$ (the real numbers). Vector addition in $\mathbb{R}_{>0}$ is, however, not usual addition, but multiplication. Likewise, scalar multiplication in $\mathbb{R}_{>0}$ is not usual multiplication, but potentiation.
In fact, the linear-algebra definition of linearity is (e.g. Ricardo, 2009; Bowen and Wang, 1976):

A function $f : V \to W$ from a vectors space $(V,\oplus,\odot)$ over a field $F$ to a vector space $(W,\boxplus,\boxdot)$ over $F$ is linear if and only if it satisfies
  $$
f(x \oplus y) = f(x) \boxplus f(y) \quad\text{and}\quad f(\lambda \odot x) = \lambda \boxdot f(x)
$$
  for all $x,y \in V$ and $\lambda \in F$.

Another proof goes as follows:

The logarithm is an isomorphism between the vector space of positive-real numbers to the vector space of real numbers. And as every isomorphism is a linear function, so is the logarithm.

Question
We have two conflicting statements here:


*

*The logarithm is non-linear.

*The logarithm is linear.


Can both statements be correct simultaneously, depending on something I cannot imagine now? But wouldn't this also imply that two conflicting concepts of linearity exist?
Or is this a case of sloppy notation, e.g., abuse of the same symbol $+$ for vector addition or $\cdot$ for scalar multiplication even though two different vector spaces are involved?
Update
The solutions given to rescue the first statement haven't convinced me yet, because they are inconsistent:


*

*Using usual addition and multiplication on $\mathbb{R}_{>0}$ implies that $(\mathbb{R}_{>0},+,\cdot)$ is not a vector space anymore. But a precondition of the linearity proof is that the domain and the range of $f$ are vector spaces.

*Allowing the domain of $\ln$ to be $\mathbb{R}$ with usual addition and multiplication instead of $\mathbb{R}_{>0}$ doesn't work, because then the image of $\ln$ is the set of complex numbers.

*A mathematically consistent definition of "linearity" for subsets (but not subspaces) of a vector space was given in a comment by @Alex G. Let $S$ be an arbitrary subset of a real vector space $V$, and let $W$ be a real vector space. A function $f : S \to W$ is called "linear" if for all $x,y \in S$ such that $x+y \in S$, then $f(x+y) = f(x)+f(y)$, and for all $x \in S$, $k \in \mathbb{R}$ such that $kx \in S$, then $f(kx)=k⋅f(x)$. However, this definition is not what is meant by the concept of linearity coming from linear algebra. One would actually need to use another term for "linearity" here.

 A: You are correct if we endow $\Bbb R_{> 0}$  with the strange vector space structure in which "addition" is given by the usual multiplication, and "scalar multiplication" is given by exponentiation. When people say that logarithms are not linear, they are usually thinking of giving $\Bbb R$ the usual vector space structure, and with this being understood, then logarithms really are not linear.
The takeaway here is that the statement "the logarithm is linear" depends on what vector space structure you have in mind. With your strange vector space structure, this is true. With the usual one, this is false.
A: You are correct, $\ln$ is linear for this vector space structure on $\mathbb{R}_*^+$ (though not for the usual vector space structure on $\mathbb R$.
The thing is that this vector space structure you defined has no real interest, so people don't use it. In fact probably most functions could be made into something linear for a weird, custom-made vector space structure, but there would be no point.
A: it's worth noting that with your argument, any bijection is linear!
We have a set $X$ and a vector space $Y$. We have a bijection
$$
f: X \to Y.
$$
We simply define the operations
$$
x+y = f^{-1}(f(x) + f(y)), \;\;\; \lambda x = f^{-1}(\lambda(f(x)). 
$$
Now $f$ is linear.
The issue is that when we say $f: V \to W$ is linear, we generally already have linear structures on $V$ and $W$ that are not defined in terms of $f.$
A: The error in the question is to assume that people say "linear" only in the context of algebra (where log can be interpreted as linear in the way you explained) when in fact the usage almost everywhere else is incompatible with this alternative interpretation.  Examples include


*

*linear functions in geometry (and physics, science, economics, etc), as ones whose graph belongs to a straight line

*linear growth and linear estimates in analysis

*linear time and space in computational complexity theory

*sublinear, superlinear, quasilinear


Even in algebra there are


*

*linear algebraic groups, general linear group $GL_n$, special linear group $SL_n$.  There is no linear algebraic group representation using the logarithm.


In some of these uses there is no $\mathbb{R}$ or $\mathbb{R}^{\ast}$ involved.
It would be unbelievable to argue that in all these cases there is some hidden choice of "linearizing structure" that was not specified but can be consistent with log(x) being linear, so that LOGSPACE is really linear space for some other convention than the one actually in use in this universe.
Thus the resolution of this "paradox" is to recognize that logarithm is necessarily nonlinear in most situations, and in algebra having it be nonlinear is just the default option that one can over-ride locally (with suitable warning to the reader or listener) in a particular context.
A: The first statement you have is:

The logarithm is not the restriction of linear map $(\mathbb R,+)\rightarrow (\mathbb R,+)$ to $\mathbb R_{>0}$.

The second one you have is:

The logarithm is a linear map $(\mathbb R_{>0},\cdot)\rightarrow(\mathbb R,+)$.

I don't see any contradiction there. Certainly $f(xy)=f(x)+f(y)$ does not imply $f(x+y)=f(x)+f(y)$ and neither does the latter imply the former, so the statements are unrelated (and both true). It's not like we magically get a contradiction when we refer to both those two equations as a condition of linearity. We call the logarithm "non-linear" because the first statement refers to the canonical vector space structure on $\mathbb R$, which what we'd assume if nothing is specified.
It's also worthy of note that, if we're considering the logarithm, we're probably considering it as a map on a single structure with both addition and multiplication, rather than a map between two separate structures; the identity $\log(xy)=\log(x)+\log(y)$ relates multiplication to addition, which is only particularly remarkable when we've defined both in a sensible way (like in a ring or field).
A: I will work through this, trying to justify everything I do to the detail. What I'll end up with will probably be something like a summary of the other answers and the question statement, but it is done with the hope that nothing at all "sketchy" appears in arguments.


*

*The fundamental definition. A function $f:(V,+,\cdot)\to(W,\oplus,\odot)$ of vector spaces, both over a field $K$, is said to be linear if, for all $x,y\in V$ and $\lambda\in K$ we have $$f(x+y)=f(x)\oplus f(y)\qquad f(\lambda\cdot x)=\lambda\odot f(x).$$

*Our vector spaces. We will denote by $\mathbb R^+$ the vector space $(\mathbb R,+,\cdot)$ over the field $\mathbb R$, where $+,\cdot$ are assumed to be the usual operations on $\mathbb R$. This is a vector space. We will denote by $\mathbb R^\times$ the vector space $(\mathbb R_{>0},\oplus,\odot)$ over $\mathbb R$, where by definition $x\oplus y=x\cdot y$ and $\lambda\odot x=x^\lambda$ with the universal quantifiers of Point 1. This is also a vector space.

*Linearity on general subsets. The only canonical way to even potentially think about defining linearity of a function $f:S\to(W,\oplus,\odot)$ where $S$ is a subset of the underlying space of the vector space $(V,+,\cdot)$ (all over $K$) is simply to generalize and use AlexG's definition. To quote:  A function $f:S\to W$ is called linear if for all $x,y\in S$ such that $x+y\in S$, then $f(x+y)=f(x)\oplus f(y)$, and for all $x\in S$, $k\in\mathbb R$ such that $k\cdot x\in S$, then $f(k\cdot x)=k\odot f(x)$. However, this notion is unfortunately not very useful: indeed, as in another comment we can consider a horizontal translate of the $y$-axis in $\mathbb R^2$. It is easily verified that every function from this subset to any vector space is vacuously linear, which is quite undesirable. This is why we in general reserve the notion of linearity for linear domains. (Mathematicians knew what they were doing as linear algebra was developed!) The conclusion is that linearity is not naturally definable on non-subspace subsets of a vector space, and thus we discard the notion (as mathematically consistent, whatever that means, as it is.)

*The logarithm. The range of the logarithm is in general dependent on which domain we choose. We have essentially two options: either take our domain to be $\mathbb R_{>0}$ in which case the range is $\mathbb R$, or take our domain to be $\mathbb R$ in which case the range is $\mathbb C$. For the purposes of this discussion, we work entirely in real numbers (or subsets of the real numbers) and thus choose the logarithm to be the natural function $\ln:\mathbb R_{>0}\to\mathbb R$. For all elements $x,y\in\mathbb R_{>0}$ of the domain and $\lambda\in K=\mathbb R$, the logarithm satisfies the relations $$\ln(x\oplus y)=\ln(x)+\ln(y)\qquad\ln(\lambda\odot x)=\lambda\cdot\ln(x)$$ where $\oplus,\odot$ are defined in Point 2, and $+,\cdot$ are the natural operations on $\mathbb R$.

*"The logarithm is non-linear." The logarithm is not even a function $\mathbb R^+\to\mathbb R^+$ of vector spaces (by the last Point), so that it is trivially not a linear function. Further, even under subset linearity (a pathological and unnecessary definition), it is non-linear by the first proof in your post as a function $\mathbb R_{>0}\to\mathbb R^+$ for $\mathbb R_{>0}$ viewed as a subset of the vector space $\mathbb R^+$. This, formally or informally, is the truth behind "nonlinearity of the logarithm."

*"The logarithm is linear." By your second proof, the logarithm is a linear function of vector spaces $\ln:\mathbb R^\times\to\mathbb R^+$ over $\mathbb R$. This is a distinct notion of linearity, and there is neither sloppy notation nor a contradiction.
This answer, like those before it, is probably incomplete. However, I hope I've at least demonstrated to some extent that no contradictions are actually arising.
