python-to-lean4-translator

Translates Python programs into executable, well-typed Lean4 code.

142|14|Updated Feb 14, 2026
One-click install
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill python-to-lean4-translator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-to-lean4-translator
Source: https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/python-to-lean4-translator
Command: npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill python-to-lean4-translator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill automates the complex and error-prone process of translating Python code into Lean4, ensuring semantic equivalence and type safety.

Core Features & Use Cases

  • Automated Code Translation: Converts Python functions, classes, and control flow into equivalent Lean4 code.
  • Type Safety Enforcement: Infers and enforces Lean4's strict type system, preventing common errors.
  • Semantic Preservation: Guarantees that the translated Lean4 code behaves identically to the original Python code.
  • Use Case: You have a critical algorithm implemented in Python that needs to be formally verified using Lean4's theorem proving capabilities. This Skill handles the conversion, allowing you to focus on the verification process.

Quick Start

Translate the provided Python code snippet into Lean4.

Frequently Asked Questions about python-to-lean4-translator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I translate Python code to Lean4 for formal verification?

Automated Python to Lean4 translation handles functions, classes, and control flow while preserving program semantics and enforcing Lean4's strict type system to ensure the generated code is executable and well-typed.

How does Python to Lean4 conversion handle type safety?

Python to Lean4 conversion handles type safety by automatically inferring and enforcing Lean4's strict type system during the translation process, which prevents common typing errors and ensures the generated code is well-typed.

Can I convert Python classes and data structures into executable Lean4 code?

Yes, you can convert Python classes and data structures into executable Lean4 code. The translation process maps these object-oriented structures into equivalent Lean4 constructs while ensuring the resulting code is well-typed and can successfully run.

Does translating Python to Lean4 preserve the original program semantics?

Translating Python to Lean4 preserves the original program semantics by ensuring the generated Lean4 code behaves identically to the original Python algorithm, guaranteeing semantic equivalence throughout the conversion process.

What are the limitations of converting Python programs to Lean4?

A limitation of converting Python programs to Lean4 is that the dynamic typing of Python must strictly map to Lean4's strict type system, which requires rigorous type inference and may require refactoring untyped Python logic before successful translation.