formal-verification

Formalize specifications into Lean 4 theorems, prove them, and bridge proofs to test-first implementation.

Updated Jun 24, 2026
One-click install
npx skills add https://github.com/Hakkadaikon/hymme --skill formal-verification-hakkadaikon
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: formal-verification
Source: https://github.com/Hakkadaikon/hymme/tree/main/skills/formal-verification
Command: npx skills add https://github.com/Hakkadaikon/hymme --skill formal-verification-hakkadaikon

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Informal natural-language requirements leave correctness of critical algorithms, protocols, and security properties unverified. This Skill converts vague specifications into Lean 4 formal specifications, proves them with kernel-checked verification, and connects proven properties to test-first implementation so only proven claims are called guaranteed. ## Core Features & Use Cases - Property catalog extraction: Enumerates state machine invariants, MUST/MUST NOT clauses, temporal properties, and workflow-level guarantees from specs before formalization, following the principle that over-extraction is safe and omissions are dangerous. - Autoformalization and proof repair loop: Translates requirements into Lean def and theorem declarations, then iterates with lake build, tactics like simp/omega/decide/exact?, and lemma decomposition until proofs pass. - Proof authenticity checks: Verifies proofs with #print axioms to detect leftover sorry holes or native_decide trust-base expansion before claiming guarantees. - Bridge to test-first implementation: Maps each proven theorem to a property-based test that must fail first, exposing divergence between the proven model and the actual implementation. - Use Case: When implementing a protocol state machine, use this Skill to prove that error states always transition to closed and that chunked message reassembly is segmentation-independent, then generate failing property tests that catch implementation drift from the proven model. ## Quick Start Ask the AI to formalize and prove the correctness properties of your specification in Lean 4, for example: formalize this protocol spec and prove its state machine invariants with Lean.

Frequently Asked Questions about formal-verification

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

FAQPage Schema
How do I formally verify an algorithm with Lean 4?

Formalize the specification into Lean def and theorem declarations, then run lake build to observe proof errors and iterate with tactics like simp, omega, decide, and exact?. Break heavy proofs into lemmas and confirm authenticity with #print axioms before claiming the property is guaranteed.

How do I set up a Lean 4 project for formal verification?

Install elan as the toolchain manager, run elan default stable once, then create a project with lake new. Write proofs in the subdirectory Basic.lean file rather than the root library file, and avoid adding Mathlib unless genuinely needed since plain Init and Std suffice for many properties.

What is the difference between decide and native_decide in Lean?

decide is verified by the Lean kernel and keeps the trusted base to the standard three axioms, while native_decide trusts the compiler and adds the Lean.ofReduceBool axiom. Prefer decide when kernel verification is feasible, and check dependencies with #print axioms.

Why does my Lean proof pass but still contain sorry?

A build can succeed while sorry placeholders remain, which means the proof has holes. Run #print axioms on the theorem; if sorryAx appears in the output, the proof is incomplete and must not be reported as guaranteed.

When should I use formal verification instead of property-based testing?

Use formal verification for critical algorithms, protocols, and security properties where mathematical guarantees are required. For everything else, standard tests suffice; the workflow also bridges proven theorems into property-based tests to detect divergence between the proven model and the implementation.