Sage preamble definition catalogue
Source: ~/research/src/dzack_research/preamble — every non-checkpoint .sage file (~30,000 lines across 80 files) read completely, 2026-08-14.
This is the theory-ingestion inventory of the Sage research preamble: every category, functor, axiom, construction, and distinguished object it names, recorded as formalization targets for lean-categories. How the preamble constructs a notion in Sage is deliberately not recorded. The Sage formulation is sometimes loose or wrong; each such defect carries a ⚠ flag so the formalization fixes it rather than transcribing it, and the corrected definitions eventually flow back down to Sage. Flags marked (source) are admitted in the preamble’s own comments; (inferred) is extraction-time analysis.
A checkbox is a term to route through the reuse gate in AGENTS.md: close it when the notion has a principled owner in this repository, pinned Mathlib, or a registered external formalization. The active work queue is TODO.md; the corpus-wide foundation is governed by PLAN-FOUNDATIONAL-CORPUS-CATALOGUE-SWEEP, PLAN-FOUNDATIONAL-CORPUS-DEFINITION-SWEEP, and PLAN-FOUNDATIONAL-CORPUS-THEOREM-SWEEP. This Sage catalogue is supplementary source material unless admitted to the frozen foundational corpus.
Systemic defects the formalization must fix
Nine patterns recur across every subtree. They, not the individual notions, are the real distance between the preamble and the intended mathematics.
- Almost nothing is a functor. Dual, discriminant, twist, orthogonal sum,
O(L), invariants/coinvariants, forget-form/forget-action, and the 21Catconstructions are all object-level methods with no morphism action. Honest functors exist only incategories/functors/(module/algebra base change, free/forgetful with adjunction data, ring center on the core, trivial action) — and even there no functor law, naturality square, or triangle identity is ever checked. - Framings are baked into object identity. Chosen generating sets, relation tuples, generator orders, and Gram matrices participate in equality and hashing; symmetry, decomposability, and integrality are matrix conditions in the chosen framing while the docstrings claim the basis-free reading.
- Axioms are self-reports. The refine mechanism admits an object when it answers
Trueto a certifying predicate; predicates in the pure strata returnTrueby placement; no universal property is checked anywhere — products, kernels, cones, biproducts are declared by handing over structure morphisms. - Morphism structure is declared, not carried. Algebra maps are module maps, ring maps are set maps, Galois characters and restriction maps have no evaluation, inclusions live in
Sets(), and equivariance checking defaults off. - Isomorphism versus equality is handled cleanly in exactly one place —
Isomorphismas a property of an arrow, and cached functors makingF(dom f)be the domain ofF(f)— and conflated elsewhere (dual-frame identification, matrix-equals-morphism, Gram-equality specimen naming). - Sign and value conventions drift. Positive- and negative-definite ADE circulate under one name; signed and unsigned discriminant under one word;
q(x)is the bilinear self-pairing, not½⟨x,x⟩; Nikulin’sℚ/2ℤhalving is baked into value modules; “coinvariants” names two different objects. - ℤ-hard-wiring. Categories declared over a general base admit only ℤ or fields in practice: integral solving, torsion forms, group lattices, presented modules, fraction-field quotients.
- Finiteness leaks.
GroupActionrequires finiteGwhile group-lattice files promise infinite-order isometries; adjunction counits and forgetful morphism actions enumerate underlying sets; subgroup closure is capped by a constant. - Outright errors that must not be imported:
ℵ₁ := continuum(the continuum hypothesis baked into the cardinal vocabulary); restriction of scalars returning the free module on the same generators;involute(the symmetrization, not an involution);is_abelianfor absolute Galois groups (wrong in positive characteristic); Γ grouped as a free-algebra left adjoint; the genus branch ofis_isometricwithout Eichler’s hypotheses.
Organizing layers
catalogue.sage — registry of named integral lattices in the negative-definite root convention; two classification tables — Nikulin’s 75 even indefinite 2-elementary lattices of signature (1, r−1) keyed by (r, a, δ), and Alexeev–Engel Table 2 of even negative-definite 2-elementary lattices at 1-cusps (several isometry classes per key, some glued along totally isotropic discriminant subgroups); three named involutions of Λ_K3 = U³ ⊕ E8²; the embedding chain T_Co ↪ T_En ↪ T_dP ↪ Λ_K3 with T_En, T_dP as coinvariant lattices of two involutions.
refine.sage — the axiom mechanism: placement of an object in a category demands the declared abstract data (structure) and a True answer from each certifying predicate (axioms). An axiom is an object’s self-report; placement never grants a property. Nothing about morphisms, composition, or functoriality is enforced.
sterk.sage — transcription of Sterk’s classification of the five 0-cusps of the Baily–Borel compactification of degree-2 polarized Enriques moduli, as O-orbits of primitive isotropic vectors in T_En = U ⊕ U(2) ⊕ E8(2), each with a root configuration (norms −2/−4) whose Coxeter diagram is the cusp diagram. No orbit computation, no inequivalence proof.
Sets, cardinals, abstract categories, functors
Source files: catalogue.sage, refine.sage, sterk.sage, init.sage, abstract_categories/{cat,arrow_categories,slice_categories,products}.sage, sets/sets.sage, functors/*.sage.
Sets and cardinals
-
- Mathlib:
Set.Finite—Mathlib/Data/Set/Finite/Basic.lean - Mathlib:
Set.Infinite—Mathlib/Data/Set/Finite/Basic.lean - Mathlib:
Set.Countable—Mathlib/Data/Set/Countable.lean - Mathlib:
Uncountable—Mathlib/Data/Countable/Defs.lean - Mathlib:
IsTotal—Mathlib/Order/Defs/Unbundled.lean
- Mathlib:
-
- Mathlib:
SimplexCategory—Mathlib/AlgebraicTopology/SimplexCategory/Defs.lean
- Mathlib:
Abstract categories (Cat, arrows, slices, (co)limits)
-
- Mathlib:
Cat—Mathlib/CategoryTheory/Category/Cat.lean
- Mathlib:
-
- Mathlib:
Arrow—Mathlib/CategoryTheory/Comma/Arrow.lean
- Mathlib:
-
- Mathlib:
Core—Mathlib/CategoryTheory/Core.lean
- Mathlib:
-
- Mathlib:
Iso—Mathlib/CategoryTheory/Iso.lean
- Mathlib:
-
- Mathlib:
Over—Mathlib/CategoryTheory/Comma/Over/Basic.lean - Mathlib:
Under—Mathlib/CategoryTheory/Comma/Over/Basic.lean
- Mathlib:
-
- Mathlib:
HasKernel—Mathlib/CategoryTheory/Limits/Shapes/Kernels.lean - Mathlib:
kernel—Mathlib/CategoryTheory/Limits/Shapes/Kernels.lean - Mathlib:
cokernel—Mathlib/CategoryTheory/Limits/Shapes/Kernels.lean
- Mathlib:
-
- Mathlib:
Cone—Mathlib/CategoryTheory/Limits/Cones.lean - Mathlib:
Cocone—Mathlib/CategoryTheory/Limits/Cones.lean - Mathlib:
HasProduct—Mathlib/CategoryTheory/Limits/Shapes/Products.lean - Mathlib:
HasCoproduct—Mathlib/CategoryTheory/Limits/Shapes/Products.lean - Mathlib:
HasBiproduct—Mathlib/CategoryTheory/Limits/Shapes/Biproducts.lean - Mathlib:
DirectSum—Mathlib/Algebra/DirectSum/Basic.lean
- Mathlib:
-
- Mathlib:
TensorProduct—Mathlib/LinearAlgebra/TensorProduct/Defs.lean
- Mathlib:
Functors (the only honest ones in the preamble)
-
- Mathlib:
ModuleCat.extendScalars—Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean(line 400)
- Mathlib:
-
- Mathlib:
RestrictScalars—Mathlib/Algebra/Algebra/RestrictScalars.lean
- Mathlib:
-
- Mathlib:
ModuleCat.extendRestrictScalarsAdj—Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean(line 884)
- Mathlib:
-
- Mathlib:
GrpCat—Mathlib/Algebra/Category/Grp/Basic.lean
- Mathlib:
-
- Mathlib:
forget (ModuleCat.{u} R)—Mathlib/Algebra/Category/ModuleCat/Adjunctions.lean
- Mathlib:
-
- Mathlib:
TensorAlgebra—Mathlib/LinearAlgebra/TensorAlgebra/Basic.lean - Mathlib:
SymmetricAlgebra—Mathlib/LinearAlgebra/SymmetricAlgebra/Basic.lean - Mathlib:
ExteriorAlgebra—Mathlib/LinearAlgebra/ExteriorAlgebra/Basic.lean
- Mathlib:
-
- Mathlib:
MonoidAlgebra—Mathlib/Algebra/MonoidAlgebra/Defs.lean
- Mathlib:
Catalogue specimens and distinguished data
Rings, algebras, number fields
Source files: categories/algebras/{algebras,free_algebras,finitely_presented_algebras,framed_free_algebras,number_fields}.sage, categories/rings/{rings,predicate_subrings}.sage.
Categories
-
- Mathlib:
Semiring—Mathlib/Algebra/Ring/Defs.lean - Mathlib:
NonUnitalRing—Mathlib/Algebra/Ring/Defs.lean - Mathlib:
Ring—Mathlib/Algebra/Ring/Defs.lean - Mathlib:
DivisionRing—Mathlib/Algebra/Field/Defs.lean - Mathlib:
Field—Mathlib/Algebra/Field/Defs.lean
- Mathlib:
-
- Mathlib:
Algebra—Mathlib/Algebra/Algebra/Defs.lean
- Mathlib:
-
- Mathlib:
TensorAlgebra—Mathlib/LinearAlgebra/TensorAlgebra/Basic.lean - Mathlib:
SymmetricAlgebra—Mathlib/LinearAlgebra/SymmetricAlgebra/Basic.lean - Mathlib:
ExteriorAlgebra—Mathlib/LinearAlgebra/ExteriorAlgebra/Basic.lean - Mathlib:
DividedPowerAlgebra—Mathlib/RingTheory/DividedPowerAlgebra/Init.lean
- Mathlib:
-
- Mathlib:
NumberField—Mathlib/NumberTheory/NumberField/Basic.lean
- Mathlib:
Axioms / predicate flags
-
- Mathlib:
Algebra—Mathlib/Algebra/Algebra/Defs.lean
- Mathlib:
Monomial systems (the mathematical core)
Constructions
-
- Mathlib:
FreeAlgebra—Mathlib/Algebra/FreeAlgebra.lean
- Mathlib:
-
- Mathlib:
FreeAlgebra.lift—Mathlib/Algebra/FreeAlgebra.lean
- Mathlib:
-
- Mathlib:
dpow—Mathlib/RingTheory/DividedPowers/SubDPIdeal.lean
- Mathlib:
-
- Mathlib:
Polynomial—Mathlib/Algebra/Polynomial/Basic.lean
- Mathlib:
Number fields
-
- Mathlib:
IsGalois—Mathlib/FieldTheory/Galois/Basic.lean(line 58);Polynomial.Gal—Mathlib/FieldTheory/PolynomialGaloisGroup.lean(line 55)
- Mathlib:
-
- Mathlib:
integralBasis—Mathlib/NumberTheory/NumberField/Basic.lean(line 394)
- Mathlib:
Rings infrastructure
-
- Mathlib:
Algebra.IsCentral—Mathlib/Algebra/Central/Defs.lean(line 67)
- Mathlib:
-
- Mathlib:
Subring—Mathlib/Algebra/Ring/Subring/Defs.lean
- Mathlib:
Groups, profinite and Galois theory
Source files: categories/group/{groups,finitely_presented_groups,predicate_subgroups}.sage, categories/group/profinite/*.sage.
Categories
-
- Mathlib:
ProfiniteGrp—Mathlib/Topology/Algebra/Category/ProfiniteGrp/Basic.lean(line 44);ProfiniteGrp.of(line 82);ProfiniteGrp.Hom(line 102)
- Mathlib:
-
- Mathlib:
absoluteGaloisGroup—Mathlib/FieldTheory/AbsoluteGaloisGroup.lean(line 43);absoluteGaloisGroupAbelianization(line 59)
- Mathlib:
Constructions and predicates (discrete groups)
-
- Mathlib:
Subgroup—Mathlib/Algebra/Group/Subgroup/Defs.lean
- Mathlib:
Absolute Galois theory (the choice-management showcase)
-
- Mathlib:
absoluteGaloisGroup—Mathlib/FieldTheory/AbsoluteGaloisGroup.lean(line 43)
- Mathlib:
Schemes, varieties, divisors
Source files: categories/schemes/*.sage, categories/divisors/*.sage.
Categories and axioms
-
- Mathlib:
RingedSpace—Mathlib/Geometry/RingedSpace/Basic.lean(line 44);SheafedSpace—Mathlib/Geometry/RingedSpace/SheafedSpace.lean(line 40);LocallyRingedSpace—Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean(line 43)
- Mathlib:
Constructions
-
- Mathlib:
Spec.structureSheaf—Mathlib/AlgebraicGeometry/StructureSheaf.lean(line 890);stalk—Mathlib/Topology/Sheaves/Stalks.lean(line 82);LocallyRingedSpace.toTopCat—Mathlib/Geometry/RingedSpace/LocallyRingedSpace.lean(line 60)
- Mathlib:
Modules: the pure / framed / presented strata
Source files: categories/modules/pure/*.sage, categories/modules/framed/{framed_modules,framed_free_modules}.sage, categories/modules/framed/finitely_generated/*.sage, categories/modules/{direct_sum_objects,fractional_ideals,fraction_field_quotients,function_modules,graded_modules,scalar_actions}.sage.
The stratification: pure categories are property-only placements (predicates true by membership, no witness); a framing adds exactly one datum — a declared surjection φ : F_R(S) → M; free adds injectivity of S → U(F_R(S)); based adds a total order on S (generators become coordinates); presented adds a second morphism F₁ → F₀ with the object as cokernel. Structural facts: no forgetful functor framed → pure exists anywhere (the relation is object-level super_categories); FinitelyGeneratedModules sits in pure/ but declares FramedModules as super-category (finite generation is not presentation-free here); GradedModules reads the framing while claiming the pure tree.
Categories
-
- Mathlib:
Module—Mathlib/Algebra/Module/Defs.lean
- Mathlib:
-
- Mathlib:
DirectSum—Mathlib/Algebra/DirectSum/Basic.lean
- Mathlib:
-
- Mathlib:
Ideal—Mathlib/RingTheory/Ideal/Defs.lean
- Mathlib:
-
- Mathlib:
Gmodule—Mathlib/Algebra/Module/GradedModule.lean(line 45);GradedAlgebra—Mathlib/RingTheory/GradedAlgebra/Basic.lean(line 170)
- Mathlib:
Constructions
-
- Mathlib:
ProjectiveResolution—Mathlib/CategoryTheory/Preadditive/Projective/Resolution.lean
- Mathlib:
-
- Mathlib:
FractionalIdeal—Mathlib/RingTheory/FractionalIdeal/Basic.lean(line 83)
- Mathlib:
Morphism / tensor / group-module inventory (from inv-morphisms)
module_morphisms/module_morphisms.sage
Morphism representation convention (load-bearing). A morphism is not a matrix. The construction datum is a set morphism S → U(N) from the domain’s ordered module generating set S to the underlying set of the codomain; the morphism is its linear extension f(Σ cᵢeᵢ) = Σ cᵢf(eᵢ). Descent is enforced by _check_relations: every row r of the domain’s relation matrix must satisfy Σ rᵢ f(eᵢ) = 0 in N, i.e. the map on the free cover F_R(S) kills the relation submodule and so descends to the presented domain. The matrix is derived and cached, never primary: rows are the coordinate vectors of f(eᵢ), elements are row vectors, v ↦ vA.
-
- Mathlib:
orthogonal—Mathlib/LinearAlgebra/BilinearForm/Orthogonal.lean(line 146);orthogonalBilin—Mathlib/LinearAlgebra/SesquilinearForm/Orthogonal.lean(line 48)
- Mathlib:
- (gap) Induction / restriction / base change of morphisms — absent entirely. ⚠
tensors.sage
group_modules/group_modules.sage
- (gap) Induction / restriction / R[G] as ring — absent. ⚠
group_modules/group_lattices.sage
- (gap) O(L) as object, genus/discriminant interaction, induction/restriction — absent. ⚠
Cross-file contradictions (from inv-morphisms)
- Finiteness: GroupAction asserts G finite with full value table, while GroupLattices/Homset are written on the premise of infinite-group support; only the first is enforced.
- “Coinvariants”: module_coinvariants = M/⟨gv−v⟩ vs coinvariant_lattice = (LG)⊥; coincide only up to finite index under hypotheses stated nowhere.
Forms and formed modules
Source files: categories/forms/{forms,gram_matrices}.sage, categories/modules/framed/formed/{form_modules,lattice_axioms,lattices}.sage, categories/modules/framed/formed/torsionform/{torsion_modules_with_form,discriminant_bilinear_modules,discriminant_quadratic_modules}.sage.
Value-target regime: a bilinear form is a morphism M ⊗_R M → W for arbitrary W (used: R, ℚ, ℚ/ℤ); a quadratic form is a morphism Γ²M → W (used: ℚ/2ℤ, ℚ). Bilinear and quadratic are kept genuinely distinct (sibling categories, separate homsets); the one bridge is polarization, defined only for W = ℚ/nℤ by halving the modulus. Exactly one morphism notion: FormMorphism = module map whose pullback of the codomain form equals the domain form.
Categories
Axioms
Constructions — graded powers and classification of forms
Constructions — formed-module structure
Constructions — torsion forms and discriminants
Defects to fix in formalization (forms)
- ⚠ FormModules under FramedModules: every notion (symmetry, integrality, scale, radical, discriminant Gram, block decomposition) computed from a Gram matrix in a chosen framing while docstrings claim the basis-free reading; only
radical,correlation_morphism,_value_submodulehonor it - ⚠
_matrix_connected_component_cuts(gram_matrices.sage): orthogonal decomposition is framing-dependent and misses non-consecutive blocks - ⚠
Lattices.__classcall_private__is category and object constructor in one callable - ⚠ QuadraticFormMorphism’s
gram_matrixand stored symmetric lift: two matrices name one object;lift_formvalue module hard-coded to ℚ - ⚠ Unframed bilinear branch is a bare set map with bilinearity trusted; unframed quadratic forms cannot be stated at all
Integral lattices, root systems, Coxeter diagrams
Source files: categories/modules/framed/formed/integrallattice/{integral_lattices,lattice_homomorphisms,lattice_isometries,subobjects,root_lattices,definite_lattices,hyperbolic_lattices,coxeter_diagrams}.sage.
Named lattices in this tree: only U/H and the ADE root lattices from Cartan matrices; E8, K3, Enriques, Sterk-specific lattices live in catalogue.sage. Vinberg is delegated to a vendored vinal; no elliptic/parabolic/Lannér subdiagram classification exists.
Categories and axioms
Predicates and invariants
Constructions
Coxeter diagrams
Defects to fix in formalization (lattices)
- ⚠ No functor anywhere:
L ↦ L^∨,L ↦ A_L,L ↦ L(n), ⊕, ⊗,L ↦ O(L),L ↦ L^Gall lack morphism actions (only ⊗ carries a structure morphism) - ⚠ Isometry vs isomorphism conflated: unit-determinant admission, genus-based
is_isometric, and the isometry homset are never connected - ⚠ No single sign convention: Cartan names positive definite, catalogue negative; elliptic/parabolic on negated Gram; Vinberg twists; Coxeter colors assume −2/−4
- ⚠ Gram-matrix-relative where basis-free intended: decomposability, summand naming, block cuts, LLL precondition