A collaborative AI-powered mathematical proof system that uses multi-agent architecture to generate, verify, and prove mathematical conjectures in Number Theory and Algebraic Topology.
MathMind is an advanced research tool that combines semantic search, symbolic reasoning, and iterative proof verification to explore mathematical conjectures. The system employs specialized AI agents that work together to:
- Generate Conjectures: Analyze mathematical queries and propose precise conjectures
- Design Experiments: Create computational tests to validate conjectures
- Verify Proofs: Iteratively refine and verify mathematical proofs
- Synthesize Results: Produce comprehensive research reports
- Multi-Domain Support: Number Theory and Algebraic Topology agents
- Iterative Verification: Up to configurable iterations of proof refinement
- Real-time Visualization: Interactive Streamlit interface showing agent conversations
- Evidence Retrieval: Semantic and symbol-based search through mathematical papers
- Export Capabilities: Download results in JSON or Markdown format
- Comprehensive Reporting: Track theorems (proven) vs conjectures (unproven)
The system implements a workflow:
User Query → Domain Expert Agent → Conjectures →
Reduce to Lemmas → Experimenter → Verifier (iterative) → Results
- Number Theory Agent: Specializes in analytic number theory, modular forms, L-functions, and Ramanujan tau functions
- Algebraic Topology Agent: Focuses on homology, homotopy theory, spectral sequences, and K-theory
- Experimenter Agent: Designs computational experiments (SageMath, PARI/GP, Python)
- Verifier Agent: Rigorously checks proofs and identifies logical gaps
- Coordinator Agent: Orchestrates the workflow and synthesizes results
- Python >= 3.10, < 3.14
- Poetry (recommended) or pip
- OpenAI API key
# Clone the repository
git clone <repository-url>
cd MathMind
# Install dependencies
poetry install
# Run commands with poetry (recommended)
poetry run streamlit run streamlit_app.py
# Activate the virtual environment
poetry env activate# Clone the repository
git clone <repository-url>
cd MathMind
# Install dependencies
pip install -r requirements_streamlit.txtCreate a .env file in the project root:
# Required: OpenAI API for the proof system
OPENAI_API_KEY=your_openai_api_key_here
# Required: Disable telemetry and fix OpenMP conflicts
OTEL_SDK_DISABLED=true
KMP_DUPLICATE_LIB_OK=TRUE
# Optional: Google Gemini API for enhanced markdown report generation
# GOOGLE_API_KEY=your_google_api_key_hereNotes:
OPENAI_API_KEYis required for the proof system to workKMP_DUPLICATE_LIB_OK=TRUEis needed on macOS to prevent OpenMP library conflictsGOOGLE_API_KEYis optional - only needed if you want AI-generated markdown reports. Without it, you can still export results as JSON.
Important: You must complete both steps below to generate the index files required for the system to retrieve evidence from mathematical papers.
Step 1: Fetch Papers from arXiv
Download LaTeX source files for Number Theory and Algebraic Topology:
python fetch_arxiv.pyThis downloads 20 papers from each of the following math categories:
- Number Theory (math.NT)
- Algebraic Topology (math.AT)
- Algebraic Geometry (math.AG)
- Commutative Algebra (math.CA)
- General Mathematics (math.GM)
- General Topology (math.GT)
- Group Theory (math.GR)
- K-Theory & Homology (math.KT)
- Rings & Algebras (math.RA)
- Representation Theory (math.RT)
- Logic (math.LO)
LaTeX sources are automatically extracted and organized in category-specific directories under papers/
Metadata for each category is saved as CSV files.
Step 2: Build Indices (Required for Evidence Retrieval)
Process the LaTeX sources and build the FAISS index:
python ingest.pyThis will:
- Read all LaTeX
.texfiles from both categories - Extract mathematical content and symbols
- Generate vector embeddings (using sentence-transformers or OpenAI)
- Build a FAISS index for semantic search
- Create symbol-based index for LaTeX commands
Output (in index/ directory):
faiss.index- Vector similarity search index for semantic retrievalmeta.pkl- Document metadata (chunks, sources, arXiv IDs)symbol_index.json- LaTeX symbol to chunk mappings
Note: Without running ingest.py, the system will fail to load the retriever and cannot access paper evidence. The ingestion process may take several minutes depending on the number of papers.
Launch the interactive web application:
streamlit run streamlit_app.pyThe interface provides:
- Text input for mathematical queries
- Agent type selection (Number Theory or Algebraic Topology)
- Configurable verification iterations
- Real-time agent conversation display
- Expandable result sections for theorems and conjectures
- Export functionality (JSON/Markdown)
Run the proof system directly:
# Number Theory
python main.py number_theory
# Algebraic Topology
python main.py algebraic_topologyNumber Theory:
- "distribution of zeros of Ramanujan tau(n) modulo small primes"
- "density of primes p where tau(p) ≡ 0 (mod p)"
- "asymptotic behavior of sum of tau(n) for n up to X"
Algebraic Topology:
- "homology groups of product spaces"
- "homotopy groups of spheres"
- "characteristic classes of vector bundles"
- "K-theory of topological spaces"
MathMind/
├── main.py # Core proof system implementation
├── streamlit_app.py # Web interface
├── agents.py # Agent definitions and prompts
├── retriever.py # Evidence retrieval functions
├── ingest.py # Paper indexing system
├── requirements_streamlit.txt # Python dependencies
├── pyproject.toml # Poetry configuration
├── .env # Environment variables (create this)
├── papers/ # Mathematical papers directory
└── index/ # FAISS indices and metadata
The main orchestrator that processes queries:
from main import ProofSystem
# Initialize with agent type
proof_system = ProofSystem(
max_iterations=5,
agent_type="number_theory"
)
# Process a query
results = proof_system.process_query(
"distribution of zeros of Ramanujan tau(n) modulo small primes"
)Two retrieval methods for gathering evidence:
- Semantic Retrieve: Uses embeddings to find semantically similar content
- Symbol Retrieve: Extracts and searches for mathematical symbols
The IterativeProofVerifier class implements a conversation loop:
- Verifier checks the proof
- Returns verdict: VALID, INVALID, or INCOMPLETE
- Experimenter refines based on feedback
- Repeat until proven or max iterations reached
Results include:
{
"query": "user query",
"timestamp": "ISO timestamp",
"summary": {
"total_conjectures": 5,
"theorems_proven": 2,
"conjectures_remaining": 3
},
"theorems": [/* proven statements */],
"remaining_conjectures": [/* unproven statements */],
"final_output": "synthesis report"
}Adjust system parameters in the code:
- max_iterations: Number of verification iterations (default: 5)
- temperature: LLM creativity (default: 0.7)
- llm model: GPT-4 variants (gpt-4o, gpt-4o-mini)
- retrieval k: Number of evidence chunks to retrieve
- Create agent in
MathAgentsclass (main.py) - Add specialized backstory and tools
- Create corresponding experimenter agent
- Update
ProofSystem._create_agents()to include new type
Edit agent backstories and task descriptions in main.py to adjust agent behavior.
Modify retrieve_evidence tool in main.py to add new retrieval strategies.
- Framework: CrewAI for multi-agent orchestration
- LLM: OpenAI GPT-4 (configurable)
- Embeddings: OpenAI embeddings or sentence-transformers
- Vector Store: FAISS for efficient similarity search
- UI: Streamlit with real-time updates
- Visualization: Plotly for interactive charts
- Requires OpenAI API access (can be modified for other LLMs)
- Computational experiments are simulated (not executed)
- Formal verification requires external theorem provers (Lean/Coq/Isabelle)
- Limited to mathematical domains with pre-indexed papers
- Integration with symbolic math engines (SageMath, SymPy)
- Formal proof generation for theorem provers
- Automated execution of computational experiments
- Support for additional mathematical domains
- Real-time collaborative features
Contributions are welcome! Areas for improvement:
- Additional mathematical domains
- Better proof verification heuristics
- Integration with formal verification tools
- Enhanced visualization of proof structures
- Performance optimizations
[Specify your license here]
If you use MathMind in your research, please cite:
@software{mathind2025,
title={MathMind: Collaborative AI Mathematical Proof System},
author={[Your Name]},
year={2025},
url={https://github.com/[your-repo]/MathMind}
}- Built with CrewAI
- Powered by OpenAI GPT-4
- Uses FAISS for vector similarity search
For questions or issues:
- Open an issue on GitHub
- Contact: [your contact information]
MathMind: Advancing mathematical research through collaborative AI agents