c-cpp-to-lean4-translator

Translates C and C++ programs into equivalent, well-typed, executable Lean4 code preserving semantics.

142|14|Updated Feb 14, 2026
One-click install
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill c-cpp-to-lean4-translator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: c-cpp-to-lean4-translator
Source: https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/c-cpp-to-lean4-translator
Command: npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill c-cpp-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 C or C++ code into Lean4, ensuring semantic equivalence and functional correctness.

Core Features & Use Cases

  • Semantic Preservation: Translates C/C++ code to Lean4 while maintaining the original program's meaning and behavior.
  • Type Safety: Generates well-typed Lean4 code that leverages its strong type system.
  • Executable Code: Produces Lean4 code that can be compiled and run successfully.
  • Use Case: Porting critical C/C++ algorithms or libraries to Lean4 for formal verification, leveraging Lean4's proof capabilities.

Quick Start

Translate the provided C code snippet into Lean4.

Frequently Asked Questions about c-cpp-to-lean4-translator

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

FAQPage Schema
How do I translate C or C++ code to Lean4?

To translate C or C++ code to Lean4, you provide the source snippet, which generates equivalent, well-typed functional code while preserving the original program semantics automatically.

What is the best way to port imperative C++ algorithms to Lean4?

The best way to port imperative C++ algorithms to Lean4 is using an automated translator that handles mutable state and pointer arithmetic, ensuring the resulting Lean4 code is executable and semantically equivalent.

Can I translate C programs with pointer arithmetic to Lean4?

Yes, you can translate C programs with pointer arithmetic to Lean4. The translation process specifically addresses pointer arithmetic and mutable state, converting these imperative memory management patterns into safe, well-typed functional code.

Why translate C or C++ libraries into Lean4?

You translate C or C++ libraries into Lean4 to leverage Lean4's strong type system and formal proof capabilities. This allows you to mathematically verify the correctness of critical algorithms while maintaining the original program behavior.

Does the translated Lean4 code compile and run successfully?

Yes, the translated Lean4 code compiles and runs successfully. The translator ensures the generated output is well-typed and executable, providing functional code that maintains semantic equivalence with the original C or C++ program.