proven-bounds

Community

Prove array bounds in Lean 4

Authorkim-em
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps developers safely convert runtime array bounds checks (xs[i]!) to statically proven accesses (xs[i]) in Lean 4, preventing runtime errors and improving code reliability.

Core Features & Use Cases

  • Safe Array Access: Learn to use if h : condition then to bind proof hypotheses for array bounds.
  • Loop Integration: Capture loop index bounds for safe access within for loops.
  • Recursion Refactoring: Replace opaque loops with proof-friendly well-founded recursion.
  • Use Case: When refactoring code that uses data[pos]!, apply the techniques in this Skill to ensure pos < data.size is proven, allowing the ! to be removed.

Quick Start

Use the proven-bounds skill to convert the data[pos]! access to data[pos] by adding an if h : pos < data.size guard.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: proven-bounds
Download link: https://github.com/kim-em/lean-zip/archive/main.zip#proven-bounds

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.