feat(CombinatoryLogic): SKI terms for Nat.sqrt, Nat.pair, and Nat.unpair#445
Merged
chenson2018 merged 9 commits intoleanprover:mainfrom Mar 20, 2026
Merged
Conversation
Implement SKI combinator terms for three Mathlib numeric operations and prove they compute the correct values on Church numerals: - Sqrt / sqrt_correct: integer square root via root-finding - NatPair / natPair_correct: Nat.pair via case split on a < b - NatUnpairLeft / natUnpairLeft_correct: left projection of Nat.unpair - NatUnpairRight / natUnpairRight_correct: right projection of Nat.unpair
chenson2018
requested changes
Mar 20, 2026
Collaborator
chenson2018
left a comment
There was a problem hiding this comment.
Thanks for splitting this out! It did make it easier to look at.
Two general comments (probably for later PRs):
- We use the
SKInamespace explicitly a lot in this module, maybe more readable if we didn't - I think more generally a syntax for SKI might be nice for readability. The docstrings you have listing these out helps show precisely what we'd want.
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
chenson2018
approved these changes
Mar 20, 2026
Collaborator
chenson2018
left a comment
There was a problem hiding this comment.
LGTM. Is this ready to merge @jessealama? I wasn't sure since it's still marked as a draft.
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.
Implement SKI combinator terms for Nat.sqrt, Nat.pair, and Nat.unpair with correctness proofs against Mathlib definitions.
Split out from #403 to make review easier.