A derivation and formulation of density functional theory, which eliminates the formal and practical inconsistencies and limitations of previous theories and allows its extension to stationary states other than the ground state, is given. The theory presented here can also be stated as a series of three theorems that define a family of its mathematical forms, as far as the physical content of the third theorem can either be implicitly incorporated in the density functional or explicitly in the procedure to find a solution to the equations. Examples of both cases are discussed, including the statement of configuration interaction procedure in density functional form.