\documentclass[11pt, a4paper]{article}

% --- UNIVERSAL PREAMBLE BLOCK ---
\usepackage[a4paper, top=2.5cm, bottom=2.5cm, left=2cm, right=2cm]{geometry}
\usepackage{fontspec}
\usepackage[english, bidi=basic, provide=*]{babel}

% Set default font to Sans Serif (Noto Sans) for modern clarity
\babelfont{rm}{Noto Sans}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{booktabs}
\usepackage{enumitem}
\usepackage{tikz-cd} % Essential for categorical diagrams

% Standard theorem environments
\newtheorem{theorem}{Theorem}[section]
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}

% Hyperref should be the last package loaded
\usepackage[colorlinks=true, linkcolor=blue, urlcolor=blue]{hyperref}

\title{Category Theory: Foundations and Applications}
\author{Comprehensive Study Notebook}
\date{}

\begin{document}

\maketitle

\section{Introduction}
Category theory serves as the structural foundation of modern mathematics. By abstracting away the internal elements of objects and focusing on the \textit{morphisms} (arrows) between them, it reveals deep structural commonalities between disparate fields such as algebraic geometry, theoretical computer science, and mathematical logic. This document synthesizes core definitions, the fundamental Yoneda Lemma, and interdisciplinary applications.

\section{1. Fundamental Definitions}

\subsection{1.1 Categories}
A \textbf{category} $\mathcal{C}$ consists of:
\begin{itemize}
    \item A collection of \textbf{objects} $\text{ob}(\mathcal{C})$.
    \item For every pair of objects $A, B \in \text{ob}(\mathcal{C})$, a set of \textbf{morphisms} $\text{Hom}_{\mathcal{C}}(A, B)$.
    \item A \textbf{composition} law: for any $f: A \to B$ and $g: B \to C$, there exists a morphism $g \circ f: A \to C$.
    \item \textbf{Identity}: For every object $A$, an identity morphism $1_A: A \to A$.
    \item \textbf{Axioms}:
    \begin{itemize}
        \item Associativity: $h \circ (g \circ f) = (h \circ g) \circ f$.
        \item Unit Laws: $f \circ 1_A = f = 1_B \circ f$ for $f: A \to B$.
    \end{itemize}
\end{itemize}

\subsection{1.2 Functors}
A \textbf{functor} $F: \mathcal{C} \to \mathcal{D}$ is a mapping that preserves the categorical structure:
\begin{itemize}
    \item \textbf{Object assignment}: $X \mapsto F(X)$.
    \item \textbf{Morphism assignment}: $f: X \to Y \mapsto F(f): F(X) \to F(Y)$.
    \item \textbf{Functoriality}: $F(1_X) = 1_{F(X)}$ and $F(g \circ f) = F(g) \circ F(f)$.
\end{itemize}

\subsection{1.3 Natural Transformations}
A \textbf{natural transformation} $\alpha: F \Rightarrow G$ between functors $F, G: \mathcal{C} \to \mathcal{D}$ is a family of morphisms $\alpha_X: F(X) \to G(X)$ in $\mathcal{D}$ such that for any $f: X \to Y$ in $\mathcal{C}$, the following diagram commutes:
\begin{center}
\begin{tikzcd}
F(X) \arrow[r, "\alpha_X"] \arrow[d, "F(f)"'] & G(X) \arrow[d, "G(f)"] \\
F(Y) \arrow[r, "\alpha_Y"'] & G(Y)
\end{tikzcd}
\end{center}

\section{2. Core Theorems and Constructions}

\subsection{2.1 The Yoneda Lemma}
The Yoneda Lemma is the cornerstone of the representation theory of categories. It states that the structure of an object is completely determined by its relationship to all other objects in the category.

\begin{theorem}[Yoneda Lemma]
For any object $A \in \mathcal{C}$ and any functor $F: \mathcal{C}^{op} \to \text{Set}$, there is a natural isomorphism:
\[
\text{Nat}(\text{Hom}_{\mathcal{C}}(-, A), F) \cong F(A)
\]
given by the mapping $\alpha \mapsto \alpha_A(1_A)$.
\end{theorem}

The \textbf{Yoneda embedding} $\mathcal{Y}: \mathcal{C} \to \text{Set}^{\mathcal{C}^{op}}$ sends $A$ to the representable presheaf $h_A = \text{Hom}(-, A)$. This embedding is \textit{fully faithful}, meaning $\text{Hom}_{\mathcal{C}}(A, B) \cong \text{Nat}(h_A, h_B)$.

\subsection{2.2 Adjunctions}
An \textbf{adjunction} $L \dashv R$ between categories $\mathcal{C}$ and $\mathcal{D}$ consists of a pair of functors $L: \mathcal{C} \to \mathcal{D}$ and $R: \mathcal{D} \to \mathcal{C}$ and a natural isomorphism:
\[
\varphi_{X,Y}: \text{Hom}_{\mathcal{D}}(L(X), Y) \xrightarrow{\cong} \text{Hom}_{\mathcal{C}}(X, R(Y))
\]
The functor $L$ is the \textit{left adjoint} and $R$ is the \textit{right adjoint}. Adjunctions are ubiquitous as they characterize "optimal" or "free" constructions.

\subsection{2.3 Monads}
A \textbf{monad} on a category $\mathcal{C}$ is an endofunctor $T: \mathcal{C} \to \mathcal{C}$ equipped with two natural transformations:
\begin{itemize}
    \item \textbf{Unit} $\eta: 1_{\mathcal{C}} \Rightarrow T$
    \item \textbf{Multiplication} $\mu: T^2 \Rightarrow T$
\end{itemize}
These must satisfy the coherence conditions for associativity ($\mu \circ T\mu = \mu \circ \mu T$) and unit ($\mu \circ T\eta = 1_T = \mu \circ \eta T$). Every adjunction $L \dashv R$ defines a monad $T = R \circ L$.

\section{3. Interdisciplinary Applications}

\subsection{3.1 The Curry-Howard-Lambek Correspondence}
This correspondence establishes a deep isomorphism between three distinct fields:
\begin{table}[ht]
\centering
\begin{tabular}{@{}lll@{}}
\toprule
\textbf{Logic} & \textbf{Computer Science (Types)} & \textbf{Category Theory} \\ \midrule
Proposition $P$ & Type $T$ & Object $A$ \\
Proof/Entailment & Function/Program & Morphism $f: A \to B$ \\
Conjunction $P \wedge Q$ & Product Type $(T, U)$ & Product $A \times B$ \\
Implication $P \Rightarrow Q$ & Function Type $T \to U$ & Exponential $B^A$ \\ \bottomrule
\end{tabular}
\caption{The Categorical Triad}
\end{table}

\subsection{3.2 Topos Theory}
A \textbf{Topos} is a category that possesses enough structure to interpret higher-order logic. Specifically, an elementary topos has finite limits, exponentials, and a \textit{subobject classifier} $\Omega$. This allows for the "internalization" of set-theoretic operations within geometry.

\section{4. Historical Context}
Category theory was introduced by \textbf{Samuel Eilenberg} and \textbf{Saunders Mac Lane} in 1945 to provide a formal definition of "naturality" in algebraic topology. The field was revolutionized in the 1960s by \textbf{Alexander Grothendieck}, who applied categorical methods to algebraic geometry through the theory of schemes and sheaves.

\section*{Selected Bibliography}
\begin{itemize}
    \item Mac Lane, S. (1971). \textit{Categories for the Working Mathematician}. Graduate Texts in Mathematics.
    \item Fong, B., \& Spivak, D. I. (2019). \textit{Seven Sketches in Compositionality}. Cambridge University Press.
    \item Barr, M., \& Wells, C. (1990). \textit{Category Theory for Computing Science}. Prentice Hall.
\end{itemize}

\end{document}