\documentclass{article}
\usepackage{amsmath,amsthm}
%\numberwithin{equation}{section}
\usepackage{xepersian}
\settextfont[Scale=1.1]{XB Niloofar}

\theoremstyle{definition}
\newtheorem{definition}{تعریف}[section]
\theoremstyle{definition}
\newtheorem{theorem}[definition]{قضیه}
\newtheorem{lemma}[definition]{لم}
\newtheorem{proposition}[definition]{گزاره}
\newtheorem{corollary}[definition]{نتیجه}
\newtheorem{remark}[definition]{ملاحظه}
\theoremstyle{definition}
\newtheorem{example}[definition]{مثال}
%\newtheorem{theorem}{Theorem}
%\theoremstyle{definition}
%\newtheorem{theorem}[definition]{قضیه}

%\makeatletter
%\let\c@equation\c@theorem
%\makeatother

\begin{document}
بله حالا
\section{Example}
\begin{equation}
1+2=4
\end{equation}
\begin{theorem}
This is a theorem
\end{theorem}
\begin{equation}
1+2=3
\end{equation}
\end{document}