Repository navigation
Conversation
Replace Bool.pick-over-computed-test min/max with structural recursion unfolding in lockstep with Nat.cmp (same values, stated O(min)-allocation cost). Add Nat.cmp_refl/ge_refl/max_ge_l/max_ge_r and Bool/Cmp.split decision lemmas. Full Base green under the source-built checker.
VictorTaelin
added a commit
that referenced
this pull request
Sep 19, 2026
…ve by cases (#860) Integrates PR #860: the min/max match keeps three rows (0n _, 1n+ap 0n, 1n+ap 1n+bp); Nat.ge_refl proves by direct induction, so Nat.cmp_refl and its Equal.cong go; the unused Bool.split/Cmp.split and the two comment blocks go; base.bend stays under its 24500 ttok cap. nat_ops covers min/max in both orders, against 0n, and on equal Nats past the literal bound.
Contributor
|
Shipped in 2.0.17. Your base was 80 commits behind, so the work was cherry-picked rather than merged, and trimmed to fit Note: this reply was written by an AI after it reported the issue to me and I made the decision. If anything here is wrong, reply and I will review it myself. |
Closed
Phylliida
pushed a commit
to Phylliida/bend
that referenced
this pull request
Sep 27, 2026
…ve by cases (bendlang#860) Integrates PR bendlang#860: the min/max match keeps three rows (0n _, 1n+ap 0n, 1n+ap 1n+bp); Nat.ge_refl proves by direct induction, so Nat.cmp_refl and its Equal.cong go; the unused Bool.split/Cmp.split and the two comment blocks go; base.bend stays under its 24500 ttok cap. nat_ops covers min/max in both orders, against 0n, and on equal Nats past the literal bound.
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.
Replaces the Bool.pick-over-computed-test Nat.min/max with structural recursion unfolding in lockstep with Nat.cmp (same values on all inputs: four constructor cases + induction; nothing in Base unfolds the old bodies).
Why: the pick form is proof-opaque (Bend cannot match on a computed test), so no order law over Nat.max/min was provable by case analysis. Structural bodies unlock Nat.cmp_refl/ge_refl/max_ge_l/max_ge_r, proved here adjacent to the defs.
Honest cost note: old form returns an existing node (O(1) allocation after O(min) compare); new form rebuilds O(min) Succ nodes. Provability outweighs the allocation on unary Nats.
Also adds Bool.split/Cmp.split decision lemmas (case analysis with the equation remembered) — the root fix for all 46 staging helpers.
Verification: full base.bend prints 'All terms check' under the source-built checker (bun bend2/main.ts). Prior bridge proofs over the old bodies (pick_succ machinery) become obsolete on this change; migration is one cong per arm.
Draft status: seeking maintainer read on direction before final polish.