Skip to content

Deriving Handler for Shrinkable#75

Merged
hargoniX merged 3 commits intoleanprover-community:mainfrom
mwhicks1:main
Apr 13, 2026
Merged

Deriving Handler for Shrinkable#75
hargoniX merged 3 commits intoleanprover-community:mainfrom
mwhicks1:main

Conversation

@mwhicks1
Copy link
Copy Markdown
Contributor

@mwhicks1 mwhicks1 commented Apr 3, 2026

Deriving Handler for Shrinkable

This file defines a handler which automatically derives Shrinkable instances for inductive types.

The derived shrinker for a value C x₁ ... xₙ produces:

  1. Subterm shrinks: any xᵢ whose type equals the inductive type itself (these are strictly smaller subterms).
  2. Argument shrinks: for each xᵢ, shrink it via its Shrinkable instance and reconstruct the constructor with the shrunk value, holding all other arguments fixed.

Several examples are given in the added tests.

Comment thread Plausible/DeriveShrinkable.lean Outdated
Comment thread Plausible/DeriveShrinkable.lean Outdated
Comment thread Plausible/DeriveShrinkable.lean Outdated
Comment thread Plausible/DeriveShrinkable.lean Outdated
Comment thread Plausible/DeriveShrinkable.lean
Comment thread Plausible/DeriveShrinkable.lean Outdated
Comment thread Plausible/DeriveShrinkable.lean Outdated
@hargoniX hargoniX merged commit b85613e into leanprover-community:main Apr 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants