Repository navigation
test spliced instances in Nat and Int recursion - #1
Merged
frangio merged 2 commits intoSep 25, 2026
Merged
Conversation
The existing spliced instance tests only cover non-recursive code, so add staged power functions that get `*`, `1` and `/` from spliced `Mul`, `OfNat 1` and `Div` instances: - `npowCode`: structural recursion on `Nat` - `zpowRecCode`: well-founded recursion on `Int` The guards splice concrete instances (`Int.instMul`, `instOfNat`, `Int.instDiv`) rather than `inferInstance`, so the generated code has no `inferInstance` wrappers and can be checked with `=ₛ` instead of `=~`. `zpowRecCode` needs `@[semireducible]` because the coherence check compares generated code to its denotation at default transparency, which does not unfold well-founded definitions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Owner
|
Thanks! |
frangio
added a commit
that referenced
this pull request
Sep 25, 2026
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Francisco Giordano <fg@frang.io>
frangio
added a commit
that referenced
this pull request
Sep 25, 2026
Co-authored-by: Francisco Giordano <fg@frang.io>
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.
The existing spliced instance tests only cover non-recursive code, so add staged power functions that get
*,1and/from splicedMul,OfNat 1andDivinstances:npowCode: structural recursion onNatzpowRecCode: well-founded recursion onIntThe guards splice concrete instances (
Int.instMul,instOfNat,Int.instDiv) rather thaninferInstance, so the generated code has noinferInstancewrappers and can be checked with=ₛinstead of=~.zpowRecCodeneeds@[semireducible]because the coherence check compares generated code to its denotation at default transparency, which does not unfold well-founded definitions.