\documentclass[a4paper,12pt,twoside,openright]{book}

\usepackage[vmargin=3.5cm,left=3cm,right=4cm]{geometry}  
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{xepersian}

\theoremstyle{plain}
\newtheorem{thm}{قضیه}%[section]
\numberwithin{thm}{section}
\renewcommand{\thethm}{\arabic{thm}.\arabic{section}.\arabic{chapter}}
\theoremstyle{definition}
\newtheorem{defin}[thm]{تعریف}
\newcommand{\borhan}{\textbf{برهان. }}
% ----------------------------------------------------------------------------
\usepackage{xepersian}


\settextfont[Scale=1.07]{XB Niloofar}
\setlatintextfont[Scale=1.05]{Times New Roman} 
\setdigitfont[Scale=1.05]{XB Yas} 

\setcounter{secnumdepth}{3}
%to include subsubsection in the table of contents
\setcounter{tocdepth}{3}


\graphicspath{{chap1_images/}{chap2_images/}}                       

\begin{document}

\chapter{فصل اول}
\section{بخش اول}
\begin{defin}
تعریف اول
\end{defin}
\begin{thm}
متن قضیه
\end{thm}
\subsection{زیربخش اول}
\end{document}
