# How to see dependencies between theorems [duplicate]

I have a paper that uses \label for naming theorems, propositions and etc.

We say that a theorem, proposition and etc X depends on the theorem, proposition and etc Y if Y is mentioned in the closest proof environment that goes right after X.

I wonder if there exists a tool that takes my .tex source and builds a graph of dependencies between theorems, proposition and etc.

EDIT. Requested by Andrew

Here is a working example

\documentclass[12pt]{article}
\usepackage[left=2cm,right=2cm,
top=2cm,bottom=2cm,bindingoffset=0cm]{geometry}
\usepackage{amssymb,amsmath}
\usepackage[utf8]{inputenc}
\usepackage[matrix,arrow,curve]{xy}
\usepackage[russian]{babel}
\usepackage[final]{graphicx}
\usepackage{mathrsfs}

\newtheorem{theorem}{Theorem}[subsection]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}

\newenvironment{proof}{\par $\triangleleft$}{$\triangleright$}

\begin{document}
\begin{proposition}\label{Prop1}
bla bla follows from bla
\end{proposition}
\begin{proof}
Obvious.
\end{proof}

\begin{theorem}\label{Prop2}
bla bla bla follows from bla bla
\end{theorem}
\begin{proof} Apply \ref{Prop1}, the rest is clear
\end{proof}

\begin{remark}\label{Rem1} % remarks have no proofs, so they shouldn't be parsed
\ref{Prop2} is harder than \ref{Prop1}.
\end{remark}

\end{document}


The output should be in format of Graphviz (or anything else publicly avaliable).