How jazir555/math-proofs works
Project Type and Purpose
• This is an open-source formal-verification library/tool built on Lean 4 + Mathlib4.
• Its purpose is to encode, prove, and document the Transfer Matrix method and related theorems for 1D inhomogeneous lattice gases.
File Structure
• Top-level proof modules (.lean):
– “lean” files that define the model (Hamiltonian, partition functions):
• latticeGasH_K.lean, Z_ED_K.lean, T_local_full.lean, T_prod_full, Z_TM_full, etc.
– “foundation.lean” and “complete lean file” that pull together the core definitions and proofs.
– Theorems modules:
• Analyticity of Free Energy…, Exact Nearest-Neighbor…, Equivalence of Partition Function…, Formal Verification of the Transfer Matrix Method…, etc.
• Documentation (.md):
– README.md (project overview, “to-do”)
– paper drafts: Formal Verification…paper.md, Proof Creation Ruleset.md, Proofs simply explained.md
• There is no traditional “frontend/backend,” but rather:
– A Proof Engine component (Lean 4 compiler + Mathlib4)
– Source Modules (the .lean files organized by functionality)
– Documentation (the Markdown files)
– Tooling/CI (you may add a Lakefile, CI config later)
README for Insights
• Key external dependencies:
– Lean 4 proof assistant
– Mathlib4 library
– Gemini-generated proofs
• Workflow: “build these, you get machine-checked proofs → write paper → prepare for submission.”
Main Components & Their Interactions
a. Proof Engine
– Lean 4 compiler + Mathlib4 (external service)
– Inputs: .lean modules, Mathlib imports
– Outputs: compiled proof artifacts, error logs, documentation stubs
b. Core Definition Modules
– Parameter spaces (FullParamSpace, KSpace, MuSpace)
– Hamiltonian & partition functions (latticeGasH_local_K, Z_ED_K, Z_TM_full)
– Transfer Matrix definitions (T_local_full, T_prod_full)
c. Theorem Modules
– Equivalence of Partition Functions
– Analyticity of Free Energy
– Thermodynamic Derivative Relations (density, nearest-neighbor correlation)
d. Documentation & Paper Drafts
– README and Markdown drafts serve as external interface to users and paper authors
e. Tooling/CI (future)
– Lakefile.toml (Lean project configuration)
– GitHub Actions for building proofs, linting, generating HTML docs
Relationships & Data Flow
– Editors/Users → modify .lean and .md → invoke Lean 4 build → Proof Engine
– Proof Engine + Mathlib4 → validates definitions & theorems → produces success/failure
– On success → generate documentation pages (via Lean’s doc generator) → publish to GitHub Pages/arXiv supplement
– Documentation authors pull in theorem summaries from the verified code
Architectural Patterns & Design Principles
• Modular decomposition by mathematical concept:
– Definitions (model) vs. Methods (ED vs. TM) vs. Theorems (equivalence, analyticity, derivatives) vs. Tools (utils, conversion functions)
• Separation of concerns:
– Pure mathematics code (.lean) vs. human-readable papers (.md)
• Dependency injection via Lean’s import mechanism: each module only depends on the minimal upstream modules + Mathlib4
• Formal-verification pipeline:
– Source → Type-checking → Tactic evaluation → Fully-checked proof
Elements
– Proof Engine (Lean 4 + Mathlib4)
– Model Definitions (parameter spaces, Hamiltonian)
– Computational Methods (ED module, TM module)
– Theorem Provers (equivalence, analyticity, derivative theorems)
– Documentation Generation (Lean doc gen, Markdown drafts)
– CI/CD (future)
– Imports/dependencies (which module uses which)
– Build flow (source → compiler → docs)
– Data flow (parameters → proofs → theorems → papers)
– Documentation (.md) in another