  Motivated by potential applications to theoretical computer science, in
particular those areas where the Curry-Howard correspondence plays an important
role, as well as by the ongoing search in pure mathematics for feasible
approaches to higher category theory, we undertake a detailed study of a new
mathematical abstraction, the generalized category. It is a partially defined
monoid equipped with endomorphism maps defining sources and targets on
arbitrary elements, possibly allowing a proximal behavior with respect to
composition.
  We first present a formal introduction to the theory of generalized
categories. We describe functors, equivalences, natural transformations,
adjoints, and limits in the generalized setting. Next we indicate how the
theory of monads extends to generalized categories. Next, we present a variant
of the calculus of deductive systems developed by Lambek, and give a
generalization of the Curry-Howard-Lambek theorem giving an equivalence between
the category of typed lambda-calculi and the category of cartesian closed
categories and exponential-preserving morphisms that leverages the theory of
generalized categories. Next, we develop elementary topos theory in the
generalized setting of ideal toposes, utilizing the formalism developed for the
Curry-Howard-Lambek theorem. In particular, we prove that ideal toposes possess
the same Heyting algebra structure and squares of adjoints that ordinary
toposes do. Finally, we develop generalized sheaves, and show that such
categories form ideal toposes. We extend Lawvere and Tierney's theorem relating
$j$-sheaves and sheaves in the sense of Grothendieck to the generalized
setting.
