Fermat is a framework for automated mathematical discovery, designed to explore and discover mathematical concepts and theorems programmatically.
Fermat sports an environment for automated mathematical theory formation. The state space is captured by KnowledgeGraph, a directed graph which stores definitions, conjectures, and theorems. Construction actions in the environment are captured through our production rules in frame/productions which input definitions to create new definitions and conjectures. Our proving tool is currently implemented through Z3. Fermat currently supports exploration in elementary number theory & finite fields.
Clone the repository and install the required dependencies:
git clone https://github.com/yourusername/FRAME.git
cd FRAME
pip install -r requirements.txtFermat experiments use OpenAI's API for generating interestingness functions. You need to set up your API keys:
- Create a
secretsdirectory in the root of the project (at the same level as theframedirectory) - Create a file called
openai.keyin thesecretsdirectory - Add your OpenAI API key to the file (just the key, no quotes or other formatting)
-
Generated API Documentation: We used
sphinx-apidocto automatically generate RST files for all your Python modules. -
Built the Documentation: We built the HTML documentation using the
make htmlcommand. -
Created a Script: We created a
generate_docs.shscript to make it easy to regenerate the documentation in the future.
-
View the Documentation: Open
docs/build/html/index.htmlin your web browser to view the documentation. -
Regenerate the Documentation: When you make changes to the codebase, run
./generate_docs.shfrom thedocsdirectory to regenerate the documentation. -
Serving the Documentation: When you want to serve the documentation, run
./serve_docs.shfrom thedocsdirectory to serve the generated documentation.
- Module Documentation: Documentation for all your Python modules, including classes, functions, and variables.
- Class Hierarchy: Inheritance diagrams for your classes.
- Search Functionality: A search feature to find specific items in your documentation.
- Cross-References: Links between related items in your documentation.
Basic usage:
from src.theory_builder import TheoryBuilder
# Initialize the builder
builder = TheoryBuilder()
# Add some seed concepts
# ... add your initial concepts ...
# Start exploration
builder.explore()Fermat includes a REPL (Read-Eval-Print Loop) interface for interactive mathematical discovery. The REPL allows you to explore mathematical concepts, apply production rules, and discover new mathematical relationships.
To start the REPL, run:
python -m frame.replhelp: Display available commands and their descriptionslist concepts: Show all available mathematical conceptslist rules: Display available production ruleslist conjectures: Show discovered conjecturesinspect <entity>: Show detailed information about a concept or conjectureapply <rule> <inputs...>: Apply a production rule to create new concepts/conjecturesrename <old> <new>: Rename an entityvisualize: Create a visualization of the current knowledge graphclear: Clear the screenexit: Exit the REPL
math> list concepts
# Shows available concepts like zero, successor, etc.
math> inspect zero
# Displays detailed information about the zero concept
math> apply specialize successor zero
# Creates a new concept by specializing successor with zero
math> list conjectures
# Shows any conjectures that have been discovered