lean-dependent-types

Resolve Lean 4 dependent type errors with recursion and visibility fixes.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers overcome common and complex errors encountered when working with Lean 4's dependent type system, including recursion limits, visibility issues, and subtle rewrite failures.

Core Features & Use Cases

  • Recursion Depth Errors: Provides solutions for congr and rw/ hitting max recursion depth on nested structures like Prod and List.ofFn.
  • Visibility and Namespacing: Clarifies how to correctly define and access definitions across different files using protected and proper namespace management.
  • Rewrite Strategy: Guides on using .trans for transitive equality and congrArg for large constant rewrites to avoid type mismatches and recursion issues.

Quick Start

Use the lean-dependent-types skill to resolve a "motive is not type correct" error in Lean 4.

Frequently Asked Questions about lean-dependent-types

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

FAQPage Schema
Why does Lean 4 throw a "motive is not type correct" error during dependent type rewriting?

A "motive is not type correct" error in Lean 4 occurs when the rewrite tactic fails to resolve dependent type dependencies properly. Using advanced tactics like `congrArg` or `subst` can manage complex type interactions and resolve this issue.

How do I fix max recursion depth errors on List.ofFn and Prod structures in Lean 4?

Max recursion depth errors on `List.ofFn` and `Prod` in Lean 4 occur when `congr` or `rw` loops on nested structures. You can resolve these compilation errors by adjusting rewrite strategies, such as using `.trans` for transitive equality.

How do I resolve cross-file visibility and namespace scoping errors for new definitions in Lean 4?

Cross-file visibility and namespace scoping errors in Lean 4 happen due to incorrect namespace management for new definitions. Applying `protected` visibility and ensuring proper namespace scoping allows correct definition access across different files.

What is the best way to rewrite large constants in Lean 4 without causing type mismatches?

The best way to rewrite large constants in Lean 4 without type mismatches is using `congrArg`. This tactic targets large constant rewrites specifically, avoiding the recursion issues and type mismatches that standard `rw` or `▸` might trigger.

When should I use the .trans strategy instead of standard rewrite tactics in Lean 4?

You should use the `.trans` strategy in Lean 4 instead of standard rewrite tactics when dealing with transitive equality. It prevents rewrite failures with `▸` and helps avoid hitting max recursion depth on complex nested structures.