Skip to content

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

Merged
chenson2018 merged 9 commits into
leanprover: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 into
leanprover: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

@chenson2018 chenson2018 left a comment

Copy link
Copy Markdown
Collaborator

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.

Comment thread Cslib/Languages/CombinatoryLogic/Recursion.lean Outdated
Comment thread Cslib/Languages/CombinatoryLogic/Recursion.lean Outdated
Comment thread Cslib/Languages/CombinatoryLogic/Recursion.lean Outdated
Comment thread Cslib/Languages/CombinatoryLogic/Recursion.lean Outdated
Comment thread Cslib/Languages/CombinatoryLogic/Recursion.lean Outdated
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>

@chenson2018 chenson2018 left a comment

Copy link
Copy Markdown
Collaborator

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
thomaskwaring pushed a commit to thomaskwaring/cslib_SKI that referenced this pull request Apr 6, 2026
…air (leanprover#445)

Implement SKI combinator terms for Nat.sqrt, Nat.pair, and Nat.unpair
with correctness proofs against Mathlib definitions.

Split out from leanprover#403 to make review easier.

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
tannerduve pushed a commit to tannerduve/cslib that referenced this pull request Apr 22, 2026
…air (leanprover#445)

Implement SKI combinator terms for Nat.sqrt, Nat.pair, and Nat.unpair
with correctness proofs against Mathlib definitions.

Split out from leanprover#403 to make review easier.

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
benbrastmckie pushed a commit to benbrastmckie/cslib that referenced this pull request Jun 14, 2026
…air (leanprover#445)

Implement SKI combinator terms for Nat.sqrt, Nat.pair, and Nat.unpair
with correctness proofs against Mathlib definitions.

Split out from leanprover#403 to make review easier.

---------

Co-authored-by: Chris Henson <46805207+chenson2018@users.noreply.github.com>
benbrastmckie added a commit to benbrastmckie/cslib that referenced this pull request Jul 1, 2026
…icts

- Chain the three fix tasks to eliminate mutual file conflicts:
  445 (conservativity proof) -> 446 (citations/bib) -> 444 (uniformity sweep).
- Scope Temporal/Tableau/ OUT of 444 (owned by the active 301/426/439 tableau
  redesign line) to avoid collision.
- leanprover#445 now supersedes leanprover#275; abandon leanprover#275 (goal subsumed by the no-sorry
  conservativity proof).
- Repoint task leanprover#414 (Modal/Temporal/Bimodal proof simplification) off the
  abandoned leanprover#275 and onto 444/445/446 so it sequences after this cleanup.

Session: sess_1782882070_293303
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