feat: improve #print recursor rules - #14960
Merged
Merged
Conversation
This PR improves the way `#print` describes recursors. For example, `#print Nat.rec` now gives the following:
```
recursor Nat.rec.{u} {motive : Nat → Sort u} (zero : motive Nat.zero) (succ : (n : Nat) → motive n → motive n.succ)
(t : Nat) : motive t
number of parameters: 0
number of motives: 1 (position 1)
number of minor premises: 2 (positions 2–3)
number of indices: 0
major premise position: 4
rules:
Nat.rec zero succ Nat.zero
==> zero
Nat.rec zero succ n.succ
==> succ n (Nat.rec zero succ n)
```
This builds on #10543.
With @berberman
Collaborator
|
Reference manual CI status:
|
|
Mathlib CI status (docs):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the way
#printdescribes recursors. For example,#print Nat.recnow gives the following:For reference, the
Nat.recrules were formerly printed asThese are the raw lambda expressions that the kernel uses to evaluate the reductions. For the new output, we construct the logical reduction rules instead. This is especially helpful in understanding the reduction rules of auxiliary recursors for nested inductive types (i.e.
T.rec_1,T.rec_2, ...).The recursor's type signature is also now pretty printed using named binders like
#check, given the importance of the binder names.This builds on #10543.
With @berberman