fig, (g, d) = plt.subplots(1, 2, figsize=(13.0, 5.4))
plan(g, "Le carre de naturalite")
plan(d, "La correspondance du lemme")
# ---------- Gauche : le carre qui doit commuter ----------
def boite(ax, x, y, w, h, txt, color, fs=11):
ax.add_patch(FancyBboxPatch((x - w / 2, y - h / 2), w, h,
boxstyle="round,pad=0.04,rounding_size=0.08",
facecolor=color, alpha=0.14,
edgecolor=color, linewidth=1.5, zorder=2))
ax.text(x, y, txt, ha="center", va="center", fontsize=fs, zorder=4)
# Ligne du haut : la categorie C vue par ses objets
boite(g, 2.6, 8.5, 2.5, 0.95, r"$X$", C_OBJ)
boite(g, 7.0, 8.5, 2.5, 0.95, r"$Y$", C_OBJ)
fleche(g, (3.85, 8.5), (5.75, 8.5), r"$f$", color=C_OBJ, lw=1.6, off=0.30)
# Ligne du milieu : les ensembles Hom(A, -)
boite(g, 2.6, 5.7, 3.0, 0.95, r"$\operatorname{Hom}(A, X)$", C_FUNC, fs=10)
boite(g, 7.0, 5.7, 3.0, 0.95, r"$\operatorname{Hom}(A, Y)$", C_FUNC, fs=10)
fleche(g, (4.10, 5.7), (5.50, 5.7), r"$-\circ f$", color=C_FUNC, lw=1.6,
off=0.30)
# Ligne du bas : les ensembles F(-)
boite(g, 2.6, 2.8, 2.5, 0.95, r"$F(X)$", "#8e44ad", fs=11)
boite(g, 7.0, 2.8, 2.5, 0.95, r"$F(Y)$", "#8e44ad", fs=11)
fleche(g, (3.85, 2.8), (5.75, 2.8), r"$F(f)$", color="#8e44ad", lw=1.6,
off=0.30)
# Les deux fleches verticales alpha
fleche(g, (2.6, 5.2), (2.6, 3.35), r"$\alpha_X$", color="#b8860b", lw=1.8,
off=-0.44)
fleche(g, (7.0, 5.2), (7.0, 3.35), r"$\alpha_Y$", color="#b8860b", lw=1.8,
off=0.44)
# L'element qui engendre tout : id_A dans Hom(A, A) -> F(A)
boite(g, 2.6, 0.9, 3.0, 0.8, r"$\mathrm{id}_A \in \operatorname{Hom}(A, A)$",
"#555555", fs=9.5)
fleche(g, (3.55, 1.30), (2.85, 2.35), color="#555555", lw=1.2,
ls=(0, (3, 2)))
g.text(5.0, 7.15, r"$\alpha_Y \circ (-\circ f) \;=\; F(f) \circ \alpha_X$",
ha="center", va="center", fontsize=11.5, color="#b00020",
bbox=dict(boxstyle="round,pad=0.34", facecolor="white",
edgecolor="#b00020", alpha=0.95), zorder=6)
# ---------- Droite : la bijection ----------
d.add_patch(FancyBboxPatch((0.5, 6.6), 9.0, 2.6,
boxstyle="round,pad=0.06,rounding_size=0.12",
facecolor=C_FUNC, alpha=0.10,
edgecolor=C_FUNC, linewidth=1.6))
d.text(5.0, 8.75, "cote foncteurs", ha="center", va="center", fontsize=11,
color=C_FUNC, fontweight="bold")
d.text(5.0, 7.75, r"$\alpha : \operatorname{Hom}(A, -) \Rightarrow F$"
"\nune famille d'applications, une par objet $X$,"
"\nqui commute avec toutes les fleches",
ha="center", va="center", fontsize=10, color="#1f6f50")
d.add_patch(FancyBboxPatch((0.5, 3.0), 9.0, 2.4,
boxstyle="round,pad=0.06,rounding_size=0.12",
facecolor="#8e44ad", alpha=0.10,
edgecolor="#8e44ad", linewidth=1.6))
d.text(5.0, 4.95, "cote ensembles", ha="center", va="center", fontsize=11,
color="#8e44ad", fontweight="bold")
d.text(5.0, 4.00, r"$\alpha_A(\mathrm{id}_A) \in F(A)$"
"\nun seul element -- pas une famille,"
"\npas une structure",
ha="center", va="center", fontsize=10, color="#6c3483")
fleche(d, (3.4, 6.45), (3.4, 5.55), color="#b00020", lw=2.4)
d.text(2.20, 6.00, "restreindre", ha="center", va="center", fontsize=9.5,
color="#b00020", fontweight="bold")
fleche(d, (6.6, 5.55), (6.6, 6.45), color="#b00020", lw=2.4)
d.text(7.90, 6.00, "reconstruire", ha="center", va="center", fontsize=9.5,
color="#b00020", fontweight="bold")
d.text(5.0, 1.9, r"$\operatorname{Nat}\left(\operatorname{Hom}(A, -), F\right)"
r"\;\cong\; F(A)$",
ha="center", va="center", fontsize=14, color="#b00020",
bbox=dict(boxstyle="round,pad=0.35", facecolor="white",
edgecolor="#b00020", linewidth=1.6))
d.text(5.0, 0.75, "la correspondance ne depend d'aucun choix :\n"
"elle est naturelle en $A$ et en $F$",
ha="center", va="center", fontsize=9.5, style="italic", color="#555555")
fig.suptitle("Yoneda : une transformation naturelle entiere, reconstituee "
"par un seul element", fontsize=12.5, fontweight="bold", y=1.00)
plt.tight_layout()
plt.show()