\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[makeroom]{cancel}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{array}
\usepackage{amsthm}
\usepackage{fancyhdr}
\usepackage{mathabx}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\usepackage[margin=1in]{geometry}
\usepackage{theoremref}
\newcommand{\RNum}[1]{\uppercase\expandafter{\romannumeral #1\relax}}
\newcounter{rowcount}
\newenvironment{listproof}
{\setcounter{rowcount}{0}%
\begin{proof}\mbox{}\\*
\begin{tabular}[b]{
@{%
\stepcounter{rowcount}%
%     \makebox[\dimexpr\leftmargini-\labelsep][r]{\arabic{rowcount} .}\hspace{\labelsep}}
\makebox[\leftmargini][r]{\arabic{rowcount} . \hspace{\labelsep}}}
ll@{}
}%
}
{\end{tabular}\end{proof}}

\newtheorem{thm}{Theorem}
\newcommand{\jbox}{\mathbin{\Box}}
\newcommand{\jdia}{\mathbin{\Diamond}}
\newcommand{\limpl}{\mathbin{\rightarrow}}
\newcommand{\theo}{\mathrel{\vdash}}

\begin{document}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\fancyhead[LO]{NOM ALUMNE NIUB: ---------}
\fancyhead[RO]{DATA}
\fancyhead[CO]{TITOL ENTREGA}
\fancyfoot[COE]{\thepage}
\section{First exercise}
\begin{thm}
$\theo\phi\limpl\psi \implies \theo\jbox\phi\limpl\jbox\psi$.
\end{thm}
\begin{listproof}
  $\phi\limpl\psi$ & given\\
  $\jbox(\phi\limpl\psi)$ & N, a\\
  $\jbox(\phi\limpl \psi)\limpl(\jbox \phi\limpl\jbox\psi)$ & $[\phi/p, \psi/q]\,$K\\
  $\jbox{\phi}\limpl\jbox{\psi}$ & MP, b, c\\
\end{listproof}
\begin{thm}
$\jdia\phi \limpl \jdia\phi$.
\end{thm}
\section{Second exercise}
\end{document}
