Skip to content

feat(CombinatoryLogic): SKI terms for Nat.sqrt, Nat.pair, and Nat.unpair#445

Merged
chenson2018 merged 9 commits intoleanprover:mainfrom
jessealama:ski-nat-operations
Mar 20, 2026
Merged

feat(CombinatoryLogic): SKI terms for Nat.sqrt, Nat.pair, and Nat.unpair#445
chenson2018 merged 9 commits intoleanprover:mainfrom
jessealama:ski-nat-operations

Conversation

@jessealama
Copy link
Copy Markdown
Contributor

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.

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 chenson2018 self-assigned this Mar 20, 2026
Copy link
Copy Markdown
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for splitting this out! It did make it easier to look at.

Two general comments (probably for later PRs):

  • We use the SKI namespace 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.

jessealama and others added 5 commits March 20, 2026 06:33
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>
Copy link
Copy Markdown
Collaborator

@chenson2018 chenson2018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Is this ready to merge @jessealama? I wasn't sure since it's still marked as a draft.

@jessealama jessealama marked this pull request as ready for review March 20, 2026 05:51
@jessealama jessealama requested a review from fmontesi as a code owner March 20, 2026 05:51
@chenson2018 chenson2018 added this pull request to the merge queue Mar 20, 2026
Merged via the queue into leanprover:main with commit d2d33ff Mar 20, 2026
2 checks passed
@jessealama jessealama deleted the ski-nat-operations branch March 21, 2026 06:46
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.

2 participants