python-to-lean4-translator

python-to-lean4-translator is a skill for Claude Code, Codex from ArabelaTso/Skills-4-SE. It costs 87 tokens per session (2,225 once invoked), scanned A, original, Apache-2.0.

A code-conversion guide that translates Python programs into Lean 4, a strongly typed language used for programming and mathematical proofs.

In plain words
What is it for?
It is for porting Python functions, classes, data structures, control flow, and error handling into executable Lean 4 code.
Why use it?
It helps adapt Python algorithms to a stricter type system and prepare them for formal checking without losing their intended behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for porting Python functions, classes, data structures, control flow, and error handling into executable Lean 4 code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arabelatso/skills-4-se/python-to-lean4-translator
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ArabelaTso/Skills-4-SE --skill python-to-lean4-translator
Clone the repo
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-to-lean4-translator

README.md
[![agentmods](https://agentmods.dev/badge/skills/arabelatso/skills-4-se/python-to-lean4-translator/github.svg)](https://agentmods.dev/skills/arabelatso/skills-4-se/python-to-lean4-translator)
Your own site
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/python-to-lean4-translator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/python-to-lean4-translator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-to-lean4-translator

Your own site · 80×15
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/python-to-lean4-translator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/python-to-lean4-translator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,225 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00087 $0.02225
Opus 5 $0.00044 $0.01112
Sonnet 5 $0.00017 $0.00445
Haiku 4.5 $0.00009 $0.00222

Measured 8d ago against content hash 36c47dfec24a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

python-to-lean4-translator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/python-to-lean4-translator/SKILL.md · 326 lines

How it starts

The opening of the file, as written. The whole thing — 326 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python to Lean4 Translator

Translate Python programs into equivalent, executable Lean4 code while preserving program semantics and ensuring type safety.

Overview

This skill provides systematic guidance for translating Python code to Lean4, handling type inference, function translations, data structures, control flow, and ensuring well-typed, executable output.

Translation Workflow

Python Input → Analyze Structure → Map Types → Translate Constructs → Verify → Output Lean4
    ├─ Identify types and signatures
    ├─ Map Python constructs to Lean4 equivalents
    ├─ Handle type conversions
    ├─ Ensure totality and termination
    └─ Validate executability

Core Translation Principles

1. Type Safety First

Lean4 is strongly typed. Every translation must:

  • Infer or specify explicit types for all variables
  • Ensure type consistency across operations
  • Handle Python's dynamic typing by choosing appropriate Lean4 types
  • Use Option for nullable values, Except for error handling

2. Preserve Semantics

The translated code must maintain the same computational behavior, preserve function input-output relationships, keep the same algorithmic complexity, and handle edge cases equivalently.

3. Ensure Executability

Generated Lean4 code must compile without errors, be executable (use #eval to verify), terminate (prove termination for recursive functions), and follow Lean4 syntax and conventions.

Type Mapping Reference

Basic Types

Python Type Lean4 Type Notes
int Int or Nat Use Nat for non-negative integers
float Float Lean4's floating point type
bool Bool Direct mapping
str String Direct mapping
None Option α Use none for None, some x for values
list List α Homogeneous lists
tuple Product types α × β or custom structure
dict Std.HashMap or List (α × β) Requires import
set Std.HashSet or List α Requires import

Read the full file on GitHub · 326 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 326 lines · 87 tokens per session scan A 36c47dfec24a

Subscribe to this mod's changes

python-to-lean4-translator is a skill published in the GitHub repository ArabelaTso/Skills-4-SE (252 stars, last pushed 21d ago), licensed Apache-2.0. It adds 87 tokens to every session and 2,225 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

K-Dense-AI/scientific-agent-skills · 56 tokens

cobrapy

Constraint-based metabolic modeling (COBRA). FBA, FVA, gene knockouts, flux sampling, SBML models, for systems biology and metabolic engineering analysis.

K-Dense-AI/scientific-agent-skills · 38 tokens

matlab

Build, review, migrate, and safely plan MATLAB or GNU Octave numerical workflows, including arrays, tabular/time data, tests, projects, graphics, MAT files, and explicit Python interoperability.

K-Dense-AI/scientific-agent-skills · 42 tokens

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use…

K-Dense-AI/scientific-agent-skills · 73 tokens

pennylane

Hardware-agnostic quantum ML framework with automatic differentiation. Use when training quantum circuits via gradients, building hybrid quantum-classical models, or needing device portability across IBM/Google/Rigetti/IonQ. Best for variational algorithms (VQE, QAOA), quantum neural networks, and integration with…

K-Dense-AI/scientific-agent-skills · 98 tokens

scientific-visualization

Create publication figures with matplotlib/seaborn/plotly. Multi-panel layouts, error bars, significance markers, colorblind-safe, export PDF/EPS/TIFF, for journal-ready scientific plots.

Microck/ordinary-claude-skills · 45 tokens