lean-content-preservation

Formalize byte-level content preservation proofs for Lean 4 byte array functions.

112|9|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/kim-em/lean-zip --skill lean-content-preservation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lean-content-preservation
Source: https://github.com/kim-em/lean-zip/tree/main/.claude/skills/lean-content-preservation
Command: npx skills add https://github.com/kim-em/lean-zip --skill lean-content-preservation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides structured patterns and lemmas for rigorously proving that functions operating on byte arrays (like compression or decompression algorithms) correctly preserve existing data and accurately produce new data.

Core Features & Use Cases

  • Prefix Preservation Proofs: Demonstrate that a function does not alter the initial bytes of an input buffer.
  • Content Characterization: Prove what new bytes a function generates, whether as raw slices, repeated values (RLE), or element-wise mappings.
  • Compositional Proofs: Combine proofs for sequential operations, handling complex workflows like multi-block decompression.
  • Use Case: When developing a new compression algorithm in Lean 4, use these patterns to formally verify that your decompression function correctly reconstructs the original data without corruption.

Quick Start

Use the lean-content-preservation skill to prove that the copyBytes function preserves the prefix of the destination byte array.

Frequently Asked Questions about lean-content-preservation

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

FAQPage Schema
How do I prove byte-level content preservation for functions manipulating byte arrays in Lean 4?

Prefix preservation proofs in Lean 4 demonstrate that a function does not alter the initial bytes of an input buffer, ensuring existing data remains intact while new data is appended or processed.

How do I formally verify a decompression function to ensure it reconstructs original data without corruption?

You formally verify decompression functions by using compositional proof strategies for sequential and recursive operations, combining proofs to demonstrate accurate reconstruction of original data without corruption.

Can I use these formal verification patterns to prove correctness for run-length encoding algorithms?

Yes, you can use these formal verification patterns to prove correctness for run-length encoding algorithms by demonstrating content characterization through repeated values and raw data extraction.

What's the best way to prove content characterization for element-wise input mappings in Lean 4?

The best way to prove content characterization for element-wise input mappings in Lean 4 is to apply structured theorem patterns that verify generated bytes accurately map from the input elements.