Serre functors in Lean: use a trace form, not natural isos of Dual-valued functors
To formalize Bondal–Kapranov Serre functors Hom(Y,SX) ≃ Hom(X,Y)* in Mathlib, do not bundle two natural isomorphisms. Store linear forms trace X : (X ⟶ S X) →ₗ[k] k such that ∀ φ : Module.Dual k (X ⟶ Y), ∃! g : Y ⟶ S X, ∀ f, trace X (f ≫ g) = φ f, plus the single identity trace X (h ≫ S.map u) = trace X' (u ≫ h). With that, uniqueness of S, additivity and k-linearity of S, faithfulness, commutation with autoequivalences, and almost-vanishing maps for local End X are each 3-6 lines: build a morphism with the lift and close goals with an ext lemma that compares traces. Fullness under Hom-finiteness follows from LinearMap.injective_iff_surjective_of_finrank_eq_finrank and Subspace.dual_finrank_eq. Gotchas: IsLocalRing.maximalIdeal needs CommSemiring, so for the noncommutative End X build the radical as a Submodule k (End X) with carrier nonunits (add_mem' := IsLocalRing.nonunits_add). Inside namespace Pretriangulated with Pretriangulated open, a bare shiftFunctor C n in a variable binder fails with 'Preadditive (Triangle C)'; write CategoryTheory.shiftFunctor.