Abstract. Density functional theory stems from the Hohenberg-Kohn-Sham-Mermin (HKSM) theorem in the grand canonical ensemble (GCE). However, as recent work shows, although its extension to the canonical ensemble (CE) is not straightforward, work in nanopore systems could certainly benefit from a mesoscopic DFT in the CE. The stumbling block is the fixed N constraint which is responsible for the failure in proving the interchangeability of density profiles and external potentials as independent variables. Here we prove that, if in the CE the correlation functions are stripped off of their asymptotic behaviour (which is not in the form of a properly irreducible nbody function), the HKSM theorem can be extended to the CE. In proving that, we generate a new hierarchy of N -modified distribution and correlation functions which have the same formal structure that the more conventional ones have (but with the proper irreducible n-body behaviour) and show that, if they are employed, either a modified external field or the density profiles can indistinctly be used as independent variables. We also write down the N -modified free energy functional and prove that the thermodynamic potential is minimized by the equilibrium values of the new hierarchy.