Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Banach lattice Lean library

(authored by agents unless marked 🧑) Tag: munozlahoz2026banach, paper

what the paper contributes

This paper describes banlat, a Lean 4 library for Banach-lattice mathematics, and a workflow for writing a large formal library with language models under human direction. The formalization target is mathematical proof, not executable Rust verification. The authors call the workflow semiautoformalization because “most of the code was written by LLMs, but with close human steering and supervision” (Introduction, p. 2). They explicitly trade proof-code quality for scale: “we are sacrificing code quality (especially inside the proofs, since these are generally not checked) for scale” (Introduction, p. 3).

The reusable lesson for VL is process and library architecture: build a trusted domain base, ask an LLM for small definitions and nearby lemmas, keep humans responsible for design decisions, and let the proof checker reject invalid generated code. The paper presents three research-level formalizations: a free Banach lattice, a theorem resolving Wickstead’s conjecture, and a counterexample concerning σ-Lebesgue completion (Section 2, pp. 5–7).

technique 1: human-planned, LLM-written library construction

when to use it

Use this approach when a domain has a coherent body of reusable definitions and lemmas, but formalizing it manually is too slow. It is not suitable for asking a model to invent the library architecture or to formalize an entire paper in one step.

steps from the paper

  1. Choose a domain close to an existing foundation. Banach lattices can be developed from mathlib’s vector, order, topology, and measure structures (§1, p. 4).
  2. Plan the dependency layers and library organization before generating code. The authors say human supervision “allows for a careful organization of the library” (Introduction, p. 2).
  3. Give the LLM definitions and results that are “close and within reach” and do not let it make design decisions (§1, p. 2).
  4. Compile every generated definition and proof in Lean; use the kernel to reject type errors and failed proof obligations. Inference: the paper’s description implies this validation loop, although it does not prescribe a command sequence.
  5. Review generated approaches for readability and redirect unnatural proofs. The authors say supervision makes the library more transparent to future contributors (§1, p. 2).
  6. Reuse completed lemmas as a trusted domain base so later paper formalizations need not reopen every dependency (§1, p. 2).
  7. When the library is mature, formalize research papers against its shared definitions; the authors expect this to become cheaper than starting each project from scratch (§1, pp. 3–4).

Verus form (inference)

Inference: For VL, the analogue is a layered Verus crate of specifications, ghost-state patterns, and verified data structures. Ask an LLM for one spec fn, one contract, or one proof lemma at a time; require cargo verus to check each change; keep API and invariant design human-controlled. Verus proof code is checked, so the paper’s warning about unchecked proof quality transfers mainly to readability and maintainability, not kernel acceptance.

evidence and limits

The paper provides no token, time, or code-size denominator for the LLM effort. It reports that GPT-5.5 and Claude Opus 4.6 wrote the code, while GPT-5.5 was used for typo searches and file-list generation in the paper (§AI disclosure, p. 26). The claims are therefore qualitative about workflow and supported by the existence of the released Lean repository, not by a controlled comparison against manual development.

technique 2: formalize research results after building reusable primitives

free Banach lattice

The first case formalizes the free Banach lattice generated by a Banach space E. The workflow is:

  1. Define the extended free norm on continuous functions over the dual unit ball (Definition 2.1, p. 5).
  2. Define the finite-norm subspace and prove it is a Banach lattice (Proposition 2.2, p. 5).
  3. Define the canonical evaluations Ύx and the closed sublattice they generate (§2.1, p. 6).
  4. Prove the universal lifting property: for every bounded operator T there is a unique lattice homomorphism with equal norm and composition law (Theorem 2.3, p. 6).

Inference: In Verus, this pattern resembles defining an abstract data type, proving representation invariants, then proving a universal API theorem. The mathematical function-space content is outside ordinary systems verification, but the staged construction maps to verified abstractions.

Wickstead theorem and non-representability

The second case formalizes a theorem stating that a constant α for a positive projection is either 0 or 1/n (Theorem 2.4 and Corollary 2.5, p. 6). It then derives a non-representability proposition for Banach lattice algebras from algebraic and order assumptions (Proposition 2.6, p. 7). The technique is to prove a strong theorem in a simpler C(K) setting, then derive the general result through existing library bridges (§2.2, pp. 6–7).

Inference: VL can reuse this core-theorem-then-corollary strategy: prove a small invariant-preservation theorem once, then expose specialized contracts and client lemmas rather than repeating the full proof.

σ-Lebesgue counterexample

The third case formalizes a negative answer to whether completion preserves the σ-Lebesgue property. The result is represented directly as an existential proposition (Proposition 2.7, p. 7). The lesson is that formalization can encode counterexamples and non-existence results, not only constructive algorithms.

technique 3: derive a simpler proof than the conventional one

lattice-linear expressions

The paper’s most concrete methodological example is a proof that any lattice-linear expression vanishing over the reals vanishes in every vector lattice (Theorem 3.4, pp. 8–14). A lattice-linear expression is built recursively from zero, variables, addition, scalar multiplication, supremum, and infimum (Definition 3.1, p. 9).

The proof steps are:

  1. Define expressions and recursive evaluation in Lean (Definitions 3.1–3.2, pp. 9–10).
  2. Normalize each expression into a difference of two suprema of linear combinations (Theorem 3.10, pp. 12–14).
  3. Prove the result for suprema of linear expressions using convex-hull membership and elementary inequalities (Lemmas 3.5–3.7, pp. 10–12).
  4. Apply normalization and the real-case equality to obtain equality in an arbitrary vector lattice (Theorem 3.4, p. 14).
  5. Package the result as the llarith tactic, which proves non-strict lattice inequalities by checking the corresponding real inequality (§3.1, p. 15).

The authors report that the LLM proposed this elementary route instead of the expected Archimedean/Kakutani proof: “the LLM took a different route that surprised us, providing a proof that is elementary, does not depend on the axiom of choice, and works for every vector lattice or (Archimedean or not)” (§3.1, p. 8). This is a concrete example of LLM assistance producing a useful mathematical insight, but the human still formalized and assessed the argument.

Verus form (inference)

Inference: The transferable pattern is normalization plus a reusable solver lemma. In Verus, normalize a family of arithmetic or state expressions into a canonical form, prove a generic lemma over that form, and expose a proof function that clients call. Do not model llarith as executable code; proof functions must remain in the specification layer.

technique 4: resolve specification mismatches explicitly

The library encountered a naming mismatch: mathlib’s Archimedean definition for ordered commutative monoids is stronger than the vector-lattice notion needed by the paper. The authors introduce a separate IsVLArchimedean definition and explain that the two coincide only for linearly ordered groups (§3.2, pp. 15–16). They also distinguish conditional completeness in mathlib from “order completeness” in common vector-lattice usage (p. 16).

The implementation procedure is:

  1. Compare the target paper’s definitions with imported library definitions (§3.2).
  2. Introduce a domain-specific predicate when names coincide but meanings differ.
  3. Prove equivalence only under the hypotheses where it is true.
  4. Use the domain-specific predicate throughout the new development and document the mismatch.

Inference: This is directly relevant to VL: similarly named Rust/Verus contracts can have different quantifier scopes or failure semantics. Keep distinct predicates until an explicit equivalence lemma is proved; never silently reuse a library definition.

technique 5: build domain-specific automation after proving its theorem

The llarith tactic is not a heuristic checker. It rests on the proved normalization and real-to-vector-lattice transfer theorem, then invokes linarith on the real inequality (§3.1, p. 15). The paper says: “This result was then used to implement llarith, a tactic that closes non-strict inequalities in vector lattices by checking that the inequality holds in R” (p. 15). The tactic also handles assumptions of the form 0 ≀ x, but the authors avoid it high in the import hierarchy for performance reasons (p. 15).

Inference: VL should similarly automate only after proving the abstraction theorem that makes the automation sound. A Verus tactic or lemma bundle should have a documented scope, avoid global solver pollution, and expose predictable proof-time behavior.

evidence, trust, and threat to VL

Lean’s kernel checks the compiled declarations, but the paper’s own quality classification places the project between publication-level and prototype-level formalization because proofs are often not manually polished (§1, p. 2). Trusted components include Lean, mathlib, imported axioms and definitions, the released repository, and human judgments about theorem statements. The paper itself says “having a trusted base of knowledge (a library) is critical” (Introduction, p. 2). No empirical accuracy percentage, proof-time distribution, or model-vs-human ablation is reported.

Inference: For agent-written verified Rust, the threat is moderate and specific. LLMs can scale contract and lemma production, but an incorrect specification can still be accepted, and poor proof organization can make later maintenance expensive. VL should reuse this paper’s human-planned decomposition, dependency-aware library, small prompts, and theorem-backed automation. It should not repeat the Banach-lattice case studies or claim that LLM-written checked code is automatically good engineering.

techniques for the catalog

  • semiautoformalization workflow — keep humans responsible for architecture while LLMs draft small, checkable definitions and lemmas
  • reusable-domain library — build a trusted base of definitions and theorems before formalizing many research results
  • normalization-based proof — reduce recursive expressions to a canonical form, prove a generic transfer lemma, and reuse it
  • domain-specific definitions — introduce a new predicate when an imported name has a different mathematical meaning
  • theorem-backed tactic — turn a proved abstraction theorem into automation with explicit scope and performance limits
  • staged research formalization — prove a core theorem in a simple setting, then derive general corollaries and counterexamples Checked 2026-10-15 against paper munozlahoz2026banach: full comparison completed; metadata and unsupported claims reviewed; experiments not reproduced

Last edited: