Skip to content

πŸ“ Natural language explanations of Lean 4 theorems | MathJax 4.0 rendering β€’ Batch processing β€’ Mathematical notation | Formal verification accessibility

License

Notifications You must be signed in to change notification settings

brightlikethelight/proof-sketcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

35 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Proof Sketcher

Python Lean 4 License: MIT MathJax Status: MVP

Transform formal proofs into accessible explanations - Making Lean 4 theorems understandable through natural language and beautiful mathematical rendering.


🎯 What It Does

Proof Sketcher bridges the gap between formal verification and human understanding by automatically generating natural language explanations of Lean 4 theorems. Built for researchers, educators, and anyone working with formal mathematics.

✨ Key Features

πŸ” Smart Parsing - Extract theorems and lemmas from Lean 4 files with full AST analysis πŸ“ Natural Language Generation - Template-based explanations with AI integration roadmap πŸ“Š Modern Export Formats - HTML with MathJax 4.0, Markdown, and batch processing 🎨 Beautiful Rendering - Mathematical notation with professional typesetting πŸ“š Batch Processing - Handle entire Lean projects with auto-generated indices


πŸš€ Current Status: Functional MVP

βœ… Working Features

  • Lean 4 Parser: Complete AST extraction from theorem definitions
  • Template Generation: Structured explanations with mathematical context
  • Modern HTML Export: Professional output with MathJax 4.0 rendering
  • Batch Processing: Handle multiple files with organized output
  • Mathematical Notation: Beautiful rendering of Lean expressions
  • Auto-Indexing: Generated table of contents and navigation

🚧 Roadmap Features

  • AI-Powered Explanations: Claude integration for contextual insights
  • Interactive Animations: Dynamic proof visualization with Manim
  • PDF Export: LaTeX-quality typesetting for publications
  • Doc-gen4 Integration: Seamless mathlib4 documentation workflow

πŸ“¦ Quick Start

Installation

# Clone and install
git clone https://github.com/Bright-L01/proof-sketcher.git
cd proof-sketcher
pip install -e .

Verify Installation

# Test the complete pipeline
python test_mvp_pipeline.py

Basic Usage

from proof_sketcher.parser import LeanParser
from proof_sketcher.exporter import HTMLExporter

# Parse Lean file
parser = LeanParser()
theorems = parser.parse_file("my_theorems.lean")

# Generate explanations
exporter = HTMLExporter()
exporter.export_batch(theorems, output_dir="docs/")

CLI Interface

# Process single file
proof-sketcher explain my_file.lean --output html

# Batch process project
proof-sketcher batch src/ --format html --with-index

# Generate documentation site
proof-sketcher docs src/ --output docs/ --with-nav

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Lean 4 AST   │───▢│  Template-Based │───▢│  Modern HTML    β”‚
β”‚    Parser       β”‚    β”‚   Generator     β”‚    β”‚   with MathJax  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚
         β–Ό                       β–Ό                       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Theorem AST    β”‚    β”‚   Explanation   β”‚    β”‚  Professional   β”‚
β”‚   Extraction    β”‚    β”‚   Templates     β”‚    β”‚  Documentation  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

  • πŸ” Parser Module: Lean 4 file analysis and AST extraction
  • πŸ“ Generator Module: Template-based explanation synthesis
  • 🎨 Exporter Module: Multi-format output with professional styling
  • πŸ“š Documentation Engine: Batch processing with organized navigation

πŸŽ“ Use Cases

For Researchers

  • Publication Ready: Generate theorem explanations for academic papers
  • Documentation: Create accessible descriptions of formal proofs
  • Education: Bridge formal and informal mathematics

For Educators

  • Course Materials: Explain formal proofs to students
  • Interactive Learning: Convert Lean theorems to readable content
  • Assessment: Document proof understanding and verification

For Lean Community

  • Mathlib Documentation: Enhanced theorem explanations
  • Knowledge Sharing: Make formal proofs more accessible
  • Onboarding: Help newcomers understand existing proofs

πŸ”§ Development

Project Structure

proof-sketcher/
β”œβ”€β”€ src/proof_sketcher/
β”‚   β”œβ”€β”€ parser/          # Lean 4 AST extraction
β”‚   β”œβ”€β”€ generator/       # Explanation generation
β”‚   β”œβ”€β”€ exporter/        # Multi-format output
β”‚   └── cli.py          # Command-line interface
β”œβ”€β”€ tests/              # Comprehensive test suite
β”œβ”€β”€ examples/           # Sample Lean files and outputs
└── docs/              # Documentation and guides

Contributing

# Development setup
git clone https://github.com/Bright-L01/proof-sketcher.git
cd proof-sketcher
pip install -e ".[dev]"

# Run tests
pytest --cov=proof_sketcher

# Format code
black src/ tests/
ruff check src/ tests/

πŸ“Š Technical Specifications

Feature Status Technology
Lean 4 Parsing βœ… Complete Python subprocess, AST analysis
Template Generation βœ… Working Jinja2, structured templates
HTML Export βœ… Production MathJax 4.0, responsive CSS
Mathematical Rendering βœ… Professional LaTeX notation, symbol support
Batch Processing βœ… Efficient Parallel processing, progress tracking
AI Integration 🚧 Planned Claude API, contextual enhancement
Animation Support 🚧 Research Manim integration, dynamic visualization

🌟 Why Proof Sketcher?

Unique Position

  • First of its kind: Dedicated Lean 4 to natural language tool
  • Modern Technology: Built with latest web standards and rendering
  • Research Foundation: Grounded in formal verification best practices
  • Extensible Design: Modular architecture for future enhancements

Technical Innovation

  • AST-Level Analysis: Deep understanding of theorem structure
  • Template-Based Generation: Consistent, reliable explanations
  • Professional Output: Publication-quality mathematical rendering
  • Scalable Processing: Handle large Lean projects efficiently

πŸ“š Documentation


🀝 Community & Support

  • GitHub Issues: Bug reports and feature requests
  • Discussions: Community Q&A and ideas
  • Contributing: Welcome contributions from the Lean community
  • Academic Collaboration: Open to research partnerships

πŸ“œ License

MIT License - See LICENSE for details.


Making formal mathematics accessible, one proof at a time. πŸŽ“

Contact β€’ Issues β€’ Discussions

About

πŸ“ Natural language explanations of Lean 4 theorems | MathJax 4.0 rendering β€’ Batch processing β€’ Mathematical notation | Formal verification accessibility

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •