What is the most general context in which the limit laws hold? By limit laws I mean properties like

*

*$\lim (f+g) = \lim f + \lim g$

*$\lim af = a \lim f$

*$\lim fg = (\lim f) (\lim g)$

*$\lim f/g = (\lim f)/(\lim g)$ if $\lim g \neq 0$.

What is most general setting for these to occur? For example, it seems true of $\mathbb{R}$ and $\mathbb{Q}$, among others. Is it true in any metric space? Or other spaces?
Also, what if we only require it true for sequences? Does that change anything? Or if we only require linearity (i.e. the first 2 properties) and not necessarily the product and quotient rules?
 A: Let $X$ and $Y$ be topological spaces and let $f:D\to Y$ be a (possibly discontinuous) function where $D\subseteq X$. If $a\in X$ is a limit point of $D$, then we will say $\lim_{x\to a}f(x)=L$ for $L\in Y$ if for any open set $V$ in $Y$ with $L\in V$, there exists an open set $U$ in $X$ with $a\in U$ such that if $x\in U\cap D$, then $f(x)\in V$. Note that the notation here is abusive since limits need not be unique if $Y$ is not Hausdorff, so I will instead opt for the notation $L\in\lim_{x\to a}f(x)$ where $\lim_{x\to a}f(x)$ is interpreted as the set of all points in $Y$ which satisfy the stated condition.
Now let $X$ and $R$ be topological spaces and suppose $R$ is equipped with two $\textit{continuous}$ binary operations $+:R\times R\to R$ and $\cdot:R\times R\to R$. Then it is true that

*

*If $f:D_1\to R$ and $g:D_2\to R$ are functions and $a$ is a limit point of $D_1\cap D_2$, then if $L_1\in\lim_{x\to a}f(x)$ and $L_2\in\lim_{x\to a}g(x)$, then $L_1+L_2\in\lim_{x\to a}(f+g)(x)$.

*If $f:D\to R$ is a function and $a$ is a limit point of $D$, then if $L\in\lim_{x\to a}f(x)$ and $r\in R$, then $r\cdot L\in\lim_{x\to a}(r\cdot f)(x)$.

*If $f:D_1\to R$ and $g:D_2\to R$ are functions and $a$ is a limit point of $D_1\cap D_2$, then if $L_1\in\lim_{x\to a}f(x)$ and $L_2\in\lim_{x\to a}g(x)$, then $L_1\cdot L_2\in\lim_{x\to a}(f\cdot g)(x)$.

No assumptions about the binary operations are needed other than continuity. However, the fourth condition you stated requires us to make sense of division which requires some assumptions about the algebraic properties of multiplication. Suppose multiplication is associative and has an identity $1$. Then (two-sided) multiplicative inverses are unique when they exist. Hence, if $x$ has a multiplicative inverse, we may denote it $x^{-1}$.
Let $Q$ be the set of points in $R$ which have multiplicative inverses. For the last condition to be true we must assume the function $inv:Q\to R$ which sends $x$ to $x^{-1}$ is continuous. If $f:D\to R$ is a function, then we can define a function $1/f:f^{-1}(Q)\to R$ by $(1/f)(x):=(f(x))^{-1}$. Now, it is true that

*

*If $g:D\to R$ is a function and $a$ is a limit point of $g^{-1}(Q)$, then if $L\in Q\cap\lim_{x\to a}g(x)$, then $L^{-1}\in\lim_{x\to a}(1/g)(x)$
If we also assume that multiplication is commutative, then we can define unambiguously $y/x:=yx^{-1}$ for any $x\in Q$, so we also have the property $\lim f/g=\lim f/\lim g$. I believe that this is the "most general" context in which these laws hold since this is, in some sense, the most general context in which the stated laws even make sense.
I should also note that limits of sequences are just a special case of the above properties since the limit of a sequence $(x_n)_{n\in\mathbb{N}}\subseteq R$ if just the limit $\lim_{n\to\infty} f(n)$ of a function $f:\mathbb{N}\to R$ where $\mathbb{N}$ is interpreted as a subspace of its one point compactification $\mathbb{N}\cup\{\infty\}$.
