Skip to content

API Reference: exporters ​

Module solver.exporters.graph_exporter ​

Interactive HTML visualizer for proof DAGs and theorem dependency networks.


Table of Contents ​


Classes ​

class GraphExporter ​

Exports ProofDAGs and DependencyGraphs into interactive standalone HTML files using vis.js.

Methods ​

def __init__(self, theme: str, embed_vis_js: bool) -> None ​

Initializes the graph exporter.

Parameters:

NameTypeDescription
themestrVisual theme ('light' or 'dark').
embed_vis_jsboolWhether to link vis-network via CDN.

Returns: None

def export_proof_to_html(self, proof: ProofDAG, output_path: str, title: Optional[str]) -> None ​

Renders a natural deduction ProofDAG into an interactive hierarchical HTML visualization.

Parameters:

NameTypeDescription
proofProofDAGTarget ProofDAG instance.
output_pathstrOutput disk path for the .html file.
titleOptional[str]Optional title header for the page.

Returns: None

def export_dependency_network_to_html(self, graph: DependencyGraph, output_path: str, title: Optional[str]) -> None ​

Renders a theorem dependency network (DependencyGraph) into an interactive HTML visualization.

Parameters:

NameTypeDescription
graphDependencyGraphTarget DependencyGraph instance.
output_pathstrOutput disk path for the .html file.
titleOptional[str]Optional title header for the page.

Returns: None


Module solver.exporters.lean_exporter ​

Lean 4 exporter for translating terms, formulas, and proof DAGs to formal Lean 4 code.


Table of Contents ​


Classes ​

class LeanExporter ​

Translates solver AST nodes, formulas, theorem declarations, and proof DAGs into LEAN 4 code.

Methods ​

def __init__(self, lean_project_name: str, universe_name: str, default_sort_var: str) -> None ​

Initializes the LEAN exporter.

Parameters:

NameTypeDescription
lean_project_namestrName of the project/namespace.
universe_namestrLEAN universe variable name (default "u").
default_sort_varstrDefault type variable name for Ind sort (default "α").

Returns: None

def export_preamble(self, imports: Optional[List[str]], open_namespaces: Optional[List[str]]) -> str ​

Generates LEAN 4 file header including module imports, universe variables, and namespace declarations.

Parameters:

NameTypeDescription
importsOptional[List[str]]Optional list of modules to import (defaults to ["Mathlib.Tactic"]).
open_namespacesOptional[List[str]]Optional list of LEAN namespaces to open.

Returns: str — Formatted LEAN 4 preamble string.

def export_sort(self, sort: Sort) -> str ​

Translates a Sort object into LEAN 4 type syntax.

Parameters:

NameTypeDescription
sortSortTarget Sort instance.

Returns: str — LEAN 4 sort representation string (e.g. "ℕ", "Set α", "α → α").

def export_term(self, term: Term) -> str ​

Translates a Term AST node into LEAN 4 term expression string.

Parameters:

NameTypeDescription
termTermTarget Term instance.

Returns: str — Formatted LEAN 4 term string.

def export_formula(self, formula: Formula) -> str ​

Translates a Formula AST node into LEAN 4 proposition string.

Parameters:

NameTypeDescription
formulaFormulaTarget Formula instance.

Returns: str — Formatted LEAN 4 proposition syntax string.

def export_theorem_statement(self, name: str, formula: Formula, hypotheses: Optional[List[Tuple[str, Formula]]]) -> str ​

Generates a LEAN 4 theorem signature statement with a sorry placeholder.

Parameters:

NameTypeDescription
namestrTheorem identifier name.
formulaFormulaTarget conclusion formula.
hypothesesOptional[List[Tuple[str, Formula]]]Optional list of named hypothesis premises [(h1_name, h1_formula), ...].

Returns: Formatted LEAN 4 theorem statement string ending in ' — = by sorry'.

def export_proof(self, proof: ProofDAG, theorem_name: str) -> str ​

Translates a ProofDAG into a structured LEAN 4 theorem declaration with tactic proof body.

Parameters:

NameTypeDescription
proofProofDAGValidated ProofDAG object.
theorem_namestrTarget theorem name.

Returns: str — Complete LEAN 4 theorem with tactic block using Mathlib tactics.

def export_file(self, file_path: str, theorems: List[Tuple[str, Formula, Optional[ProofDAG]]], stubs_only: bool, imports: Optional[List[str]]) -> None ​

Writes a complete standalone LEAN 4 source file containing preambles and theorem declarations.

Parameters:

NameTypeDescription
file_pathstrOutput disk path for .lean file.
theoremsList[Tuple[str, Formula, Optional[ProofDAG]]]List of tuples (theorem_name, formula, optional_proof_dag).
stubs_onlyboolIf True, exports all theorems as 'sorry' stubs regardless of proof availability.
importsOptional[List[str]]Optional custom import module list.

Returns: None


Released under the CC BY-NC 4.0 License.