Other any other versions of identity theorem. The classical identity theorem states that:

If $f(x)$ a real analytic function on a domain $D \subset \mathbb{R}$.
  Suppose $f(x)=0$ on  some $M \subset D$ such that $M$ has an
  accumulation point in $D$. Then, $f(x)=0$  on $D$.

My question: 
I  am wondering whether the identity theorem can be shown to hold under different assumptions on the function $f(x)$?
Here are two more specific questions: 


*

*Can we relax the analyticity assumption to something weaker? For example, infinitely differentiable on $D$. 

*Can the condition of analyticity be changed to an entirely new condition that is not necessarily weaker? 


Here we are interested only in real valued function.  I was thinking that for now, we can stay away from complex analysis, but of course, we don't have to.  
Any reference, if there are any, would be greatly appreciated. 
Thanks. 
 A: I only have an answer to the first part. 
Take
\begin{align}
f_1(x)=  \left \{\begin{array}{ll}e^{\frac{x^2}{1-x^2}},&  x \in (-1,1) \\
0, \text{ else }\end{array}  \right.
\end{align}
anf $f_2(x)=0$. 
Facts:


*

*$f_1(x)$ is infinitly differentiable

*$f_2(x)$ is infinitly differentiable

*$f_1(x)=f_2(x)$  on $x \in \mathbb{R} \setminus (-1,-1)$.


Clearly, infinity differentiability is not enough. 
A: Here is an idea, but I haven't checked the details.
Use a bump function to get smooth functions $f_n$ that are zero exactly outside $(\frac{1}{n+1},\frac{1}{n})$ for $n>0$ and outside $(\frac{1}{n},\frac{1}{n-1})$ for $n<0$.
Joint these into a smooth function $$f(x) = \sum_{n \in \mathbb Z \\n\ne 0} a_n f_n(x)$$ for some sequence $a_n$ such that $a_n \to 0 $ as $n \to \pm \infty$.
The key point is choosing $a_n$ such that $f$ is smooth. I guess that $a_n=\dfrac1n$ might work but I haven't checked. 
A: *

*No, the function $f(x)= \exp(-1/x^2)\sin (1/x), x\ne 0,$ $f(0)=0,$ is a counterexample. We have $f\in C^\infty(\mathbb R),$ and $f$ is real analytic on $\mathbb R\setminus \{0\}.$ Because $f(1/(n\pi)) = 0$ for $n=1,2,\dots,$ the zero set of $f$ has an acumulation point at $0.$

*Quasi-analytic functions are a class of functions that will do what you want here. See https://en.wikipedia.org/wiki/Quasi-analytic_function
A: *

*No. In fact, it's a somewhat classical exercise that for any closed set $F \subset \mathbb{R}$, there exists a $C^\infty$ function whose zero set is exactly $F$.
If it were continuous instead of $C^\infty$, you could take $f(x)=d(x,F)$. 
For smooth examples, use smooth bump functions (related question: Every closed subset $E\subseteq \mathbb{R}^n$ is the zero point set of a smooth function)

*The question as asked is way to vague. Of course, you could for example take the space of piecewise linear function and it would be true. Or cook up strange spaces of functions where this property holds. But that wouldn't be very interesting.
Edit: I can't think of a non-artificial class of functions where the identity principle holds except for analytic functions. There are however theorems in the same spirit but with much stronger hypotheses, such as "if 2 continuous functions have the same values on a dense set, then they are equal", but this is not quite what you're asking.
