proven-bounds

Convert runtime bounds checks to proven bounds in Lean 4 code.

1|Updated Apr 14, 2026
One-click install
npx skills add https://github.com/fmhall/lean-png --skill proven-bounds-fmhall
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: proven-bounds
Source: https://github.com/fmhall/lean-png/tree/main/.claude/skills/proven-bounds
Command: npx skills add https://github.com/fmhall/lean-png --skill proven-bounds-fmhall

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps Lean 4 users convert runtime bounds checks to proven bounds, ensuring safe access and improving code reliability.

Core Features & Use Cases

  • Bounds Conversion: Transform runtime checks like xs[i]! into static bounds like xs[i].
  • Guard Capture: Implement guard capture for conditional checks using if h :.
  • Loop Bound Capture: Capture loop index bounds using for h : i in.
  • Termination Proofs: Provide techniques for termination and bounds proofs.
  • Use Case: For Lean 4 developers who want to convert their code from runtime checks to proven bounds, ensuring safety and reliability.

Quick Start

Convert runtime bounds checks to proven bounds in your Lean 4 code using the proven-bounds skill.

Frequently Asked Questions about proven-bounds

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

FAQPage Schema
How do I convert runtime bounds checks to proven bounds in Lean 4?▼

To convert runtime bounds checks to proven bounds in Lean 4, you transform unsafe access patterns like `xs[i]!` into static bounds like `xs[i]` using guard capture, loop bound capture, and caller propagation techniques.

What is guard capture for conditional bounds checks in Lean 4?▼

Guard capture in Lean 4 is a technique that implements conditional bounds checks using `if h :` syntax, capturing the proof context needed to safely replace runtime checks with static, proven bounds.

How do I capture loop index bounds in Lean 4?▼

You capture loop index bounds in Lean 4 using the `for h : i in` syntax, which allows the loop structure to retain the index bounds proof needed for safe array access without runtime checks.

Do I need prior proof knowledge to use proven bounds conversion in Lean 4?▼

Yes, converting runtime bounds checks to proven bounds in Lean 4 requires existing knowledge of Lean 4 and its proof techniques, specifically for writing termination proofs and bounds justifications.

Why use proven bounds instead of runtime bounds checks in Lean 4?▼

Using proven bounds instead of runtime bounds checks in Lean 4 eliminates runtime overhead and ensures code safety and reliability by statically guaranteeing that array accesses are always within valid limits.