  We define generalized Koszul modules and rings and develop a generalized
Koszul theory for $\mathbb{N}$-graded rings with the degree zero part
noetherian semiperfect. This theory specializes to the classical Koszul theory
for graded rings with degree zero part artinian semisimple developed by
Beilinson-Ginzburg-Soergel and the ungraded Koszul theory for noetherian
semiperfect rings developed by Green and Martin{\'e}z-Villa. Let $A$ be a left
finite $\mathbb{N}$-graded ring generated in degree $1$ with $A_0$ noetherian
semiperfect, $J$ be its graded Jacobson radical and $S=A/J$. By the Koszul dual
of $A$ we mean the Yoneda Ext ring $\underline{\text{Ext}}_A^\bullet(S,S)$. If
$A$ is a generalized Koszul ring and $M$ is a generalized Koszul module, then
it is proved that the Koszul dual of the Koszul dual of $A$ is $\text{Gr}_J A$
and the Koszul dual of the Koszul dual of $M$ is $\text{Gr}_J M$. If $A$ is a
locally finite algebra, then the following statements are proved to be
equivalent: $A$ is generalized Koszul; the Koszul dual
$\underline{\text{Ext}}_A^\bullet(S,S)$ of $A$ is (classically) Koszul;
$\text{Gr}_J A$ is (classically) Koszul; the opposite ring $A^{op}$ of $A$ is
generalized Koszul. It is also proved that if $A$ is generalized Koszul with
finite global dimension then $A$ is generalized AS regular if and only if the
Koszul dual of $A$ is self-injective.
