Phase 12: links-defined Peano natural numbers (advances #97)#177
Merged
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #97
Advances #97 by implementing the inductive substrate the issue's Software Foundations reference points at: - `examples/nat-links.lino` declares the five proof-substrate rules `nat-zero-formation`, `nat-succ-formation`, `nat-add-zero`, `nat-add-succ`, and `nat-induction`; builds `zero`, `(succ zero)`, `(succ (succ zero))`; computes `0+0`, `1+0`, `0+1`, `1+1`; and discharges a universal claim via induction. All eight `(check-proof ...)` calls return `1` with no diagnostics. - `lib/self/foundations.lino` documents the nat-links foundation and its nine `(root-construct ...)` entries with `links-defined` status and `links-checked` semantics. - JS (`_registerDefaultFoundation`) and Rust (`register_default_foundation`) pre-seed the `nat-links` foundation with `extends default-rml` so `foundation-report` lists it without changing legacy semantics. - `examples/expected.lino` pins `(nat-links.lino: 1 1 1 1 1 1 1 1)` so the shared-examples harness catches any drift. - `js/tests/nat-links.test.mjs` and `rust/tests/nat_links_tests.rs` each add 10 tests (per-rule, foundation pre-registration, foundations.lino documentation, negative cases raising `E064`, end-to-end replay). - `docs/FOUNDATIONS.md` lists nat-links as a bundled foundation and adds the Phase 12 entry to §10. The issue-97 case study adds a timeline row, a phase-table row, and §9.9. Successor stays a literal constructor; there is no `succ → +1` host shortcut. The host's decimal numeric domain and every other operator are unaffected.
Member
Author
Working session summaryPhase 12 is complete and the PR is ready for review. What landed:
Verification:
Title uses "advances #97" (not "Fixes") per the acceptance criteria; default-RML semantics are unchanged. This summary was automatically extracted from the AI working session output. |
Member
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $8.667383📊 Context and tokens usage:Claude Opus 4.7: (3 sub-sessions)
Total: (11.7K new + 326.9K cache writes + 9.5M cache reads) input tokens, 73.3K output tokens, $8.667383 cost 🤖 Models used:
📎 Log file uploaded as Gist (4943KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Member
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit 89171d3.
This was referenced May 17, 2026
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.
Summary
Advances #97 by adding the inductive data layer the issue's
Software Foundations reference (
Logic.v,Basics.v,Induction.v)starts from:
Nat,zero,succ, addition, and inductionexpressed entirely as links-level proof-substrate rules.
Successor stays a literal constructor; there is no
succ → +1hostshortcut. The host's decimal numeric domain is unaffected — this PR
adds an inductive substrate, not a replacement numeric backend. The
default foundation
default-rmlcontinues to be active on every freshEnv, so every.linofile that ran before this PR runs identicallyafterwards.
Builds on the merged foundation + trust-report scaffolding from PR
#175 and the semantic-status / proof-checking-relation layer from PR
#176. Follows the acceptance criteria from
issue #97 follow-up comment.
What's in this PR
examples/nat-links.lino— declares the fiveproof-substrate rules
nat-zero-formation,nat-succ-formation,nat-add-zero,nat-add-succ,nat-induction; buildszero,(succ zero),(succ (succ zero))as inhabitants ofNat;computes
0+0,1+0,0+1,1+1step by step; and discharges auniversal claim via induction. All 8
(check-proof …)calls return1with no diagnostics.lib/self/foundations.lino— adds 9(root-construct …)entries (
Nat,zero,succ,add,nat-zero-formation,nat-succ-formation,nat-add-zero,nat-add-succ,nat-induction) withstatus: links-definedandsemantic-status: links-checked, plus the(foundation nat-links …)declaration that bundles the five rules._registerDefaultFoundation(js/src/rml-links.mjs) andregister_default_foundation(rust/src/lib.rs) pre-seed thenat-linksfoundation withextends default-rmlso a freshEnvlists it in
foundation-reportwithout changing legacy semantics.examples/expected.lino—(nat-links.lino: 1 1 1 1 1 1 1 1)pins the byte-identical replay between engines.
js/tests/nat-links.test.mjsandrust/tests/nat_links_tests.rseach add 10 tests coveringfoundation pre-registration,
foundations.linodocumentation,every individual rule, two negative cases that raise
E064, andthe end-to-end example replay.
docs/FOUNDATIONS.mdlistsnat-linksas a bundledfoundation in §5 and adds Phase 12 to §10; the issue-97 case study
(
docs/case-studies/issue-97/README.md) gains a timeline row, aphase-table row, and a new §9.9 explaining the construction.
Acceptance-criteria coverage (issue #97 comment §7)
nat-linksfoundation — ✅(foundation nat-links …)pre-registered in both engines.
Nat,zero,succas explicit root constructs — ✅lib/self/foundations.lino.zero : Nat,succ zero : Nat,succ (succ zero) : Nat—✅ proof-objects
zero-is-nat,one-is-nat,two-is-nat.add zero n = nandadd (succ m) n = succ (add m n)— ✅ rules
nat-add-zero,nat-add-succ.zero-plus-zero,one-plus-zero,zero-plus-one,one-plus-one.nat-equalityfrom host numeric equality — ✅equalsis a literal identifier consumed by the proof substrate's
structural matcher; the host numeric
=operator is never invokedfor Nat reasoning.
foundation-report— ✅ therules are
links-definedwithlinks-checkedsemantics;pattern-matching/structural substitution remain explicit
host-trustedboundaries unchanged.npm test(1237 pass) andcargo test(all targets pass) green.nat-links.lino+expected.linoentry.docs/FOUNDATIONS.mdanddocs/case-studies/issue-97/README.md.Fixes #97— ✅ uses "Advances Use similar idea, but everything should be built from links and references #97".Stretch goal — symbolic Nat induction rule + one proof object using it
— ✅
nat-inductionrule +every-nat-is-natproof object.Test plan
cd js && npm test— 1237 / 1237 pass (including 10 newnat-linkstests).cd rust && cargo test— all binaries pass (including 10 newnat_links_tests).examples/expected.linoentry(nat-links.lino: 1 1 1 1 1 1 1 1)pins the shared-examples replay between engines.
E064fires when a derivation violates arule (mistyped successor, contradictory
add-succ).(foundation-report)listsnat-linkswith sorteduses[nat-add-succ, nat-add-zero, nat-induction, nat-succ-formation, nat-zero-formation]andextends default-rmlin both engines.Backward compatibility
Additive only.
default-rmlis still active on every freshEnv; noexisting operator, query result, or diagnostic shape changes.