Skip to content

CE64 ISA: strict decoder, register methods, field contracts - #1407

Merged
AdaWorldAPI merged 7 commits into
mainfrom
ccr-b2e415d9-4jfvyk-ce64-isa
Oct 8, 2026
Merged

AdaWorldAPI merged 7 commits into
mainfrom
ccr-b2e415d9-4jfvyk-ce64-isa

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Reasoning chooses the operation. CausalEdge64 defines what that operation means.

Gadamer decides whether evidence is admitted; the register only computes.

Methods and signatures

method Compose kind
a.deduction(b, compose) -> Self yes total
a.induction(b, compose) -> Self yes total
a.abduction(b, compose) -> Self yes total
a.synthesis(b, compose) -> Self yes total
a.revision(b) -> Self no total, truth only: writes F and C, keeps every other field of a
a.counterfactual(b, compose) -> Result<Self, IsaFault> — partial, always refuses (no implementation yet)
a.intervention(b, compose) -> Result<Self, IsaFault> — partial, always refuses (no implementation yet)
a.execute(op, b, compose) -> Self yes the chain step that forward runs
a.forward(b, s, p, o) -> Result<Self, IsaFault> yes decode b's code, then dispatch to execute

Compose is the S/P/O payload algebra only. It never selects an opcode. Using the same operands with two different algebras changes S/P/O and leaves every other field identical (tested).

Dispatch over all 16 inference codes

raw code result
+1 Deduction
+2 Induction
-1 Abduction
+4 Revision step
+5 Synthesis
0, -8, -2, ±3, -4, -5, ±6, ±7 IsaFault::Unsupported { mantissa }

Before this PR, ±6 and ±7 ran the Synthesis mean and came back stamped ±6 and 7. The other unsupported codes ran some other instruction and came back stamped with that instruction's code.

Field-liveness matrix

Each row is declared in isa::contracts and checked in ce64_isa_contract.rs by perturbing one operand field at a time.

instruction computes passes through constant Compose fails when
forward / execute S/P/O, F, C, Pearl (AND of both operands) inference, Direction, Plasticity, all from B W = 0, Epi5 = 0 yes B carries an unsupported code
revision F, C everything else, from A — no never
learn S/P/O, F, C, Plasticity Pearl, Direction, inference, W, Epi5, from A — no never
syllogize S/P/O, F, C, Pearl, inference — Direction 0, Plasticity 0b111, W 0, Epi5 0 no returns None without a figure

forward and syllogize already wrote W and Epi5 as zero before this PR. They are now declared constants rather than an undocumented loss; the behaviour itself is unchanged.

Golden vectors (raw u64)

  • Legacy capture, 126 vectors recorded from the code before this PR:
    • 71 reproduce bit for bit;
    • the 55 whose weight carries an unsupported code now refuse with exactly that code;
    • nothing else changed.
  • Normative, 23 vectors:
    • run through the named methods;
    • checked against an independent f64 reference, within ±1 on F and C;
    • checked against the declared field contract.

Max-confidence revision defect

revision(c=255, c=255) returns f = c = 0. The path:

  1. c = 1.0 ≥ 0.999, so evidence_weight = f32::MAX;
  2. MAX + MAX = +inf;
  3. inf / inf = NaN;
  4. the float→u8 cast saturates NaN to 0.

A single c=255 operand gives a finite result but dominates: its frequency wins outright. The capped reference instead gives a weighted mean.

Both cases are pinned as known-bad and kept out of the normative set. The smallest fix is to cap c before evidence_weight, as the reference does; that is a separate PR.

Gadamer stays above the register

tests/gadamer_isa_revision.rs:

  • ten echo encounters or closed cycles leave confidence unchanged, because the gate never calls revision;
  • ten new independent roots raise it;
  • revision alone would inflate an echo, which is why the gate sits above it.

isa.rs names no reasoning-policy types (enforced by a source guard).

Tests

  • causal-edge: 81 lib tests plus 12 contract, 6 golden and 8 op-contract tests, all passing. Clippy passes with -D warnings.
  • planner: chain_confidence, gadamer_isa_revision and moore_nars16_probe (15) pass, as do the full planner, cognitive-shader-driver and p64-bridge suites.

Every disable run below asserts that its patch applied, and each turned the listed tests red:

invariant disabled tests red
Counterfactual decoded as Synthesis 6
forward ignores the decoded opcode 4
learn clears W 4
revision clears Epi5 1
revision formula diverges 4
known-bad case promoted to normative 2
a policy type named in isa.rs 1
counterfactual computes a result 1
Gadamer gate bypassed 2

Open

  • forward's revision step (+4) composes the payload, while revision(b) does not. Whether a payload-composing revision step should exist at all is a decision this PR does not make.
  • forward writes the executed code into bits 46..49. The transition-loop reading ("do not whisper the operation back into the result edge") says it should not. This predates the PR and is unchanged.
  • learn mixes arithmetic with policy: archetype reassignment and the 0.9 / 0.7 freeze thresholds.
  • syllogize both chooses its rule from the figure and computes it.
  • The planner's truth-function copies outside the register (TruthValue, nars_infer, NarsTables) still differ from the canonical ones.

API change: forward, forward_chain, NarsEngine::forward_edge and replay_step now return Result. ReplayError gains an Isa variant.

Docs: docs/architecture/ce64-semantic-upper-half.md now separates physical encoding, declared reading and ISA operation. Board: .claude/board/entries/2026-10-08-ce64-isa-register-contract.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R


Generated by Claude Code

claude added 6 commits October 8, 2026 08:29
Reasoning chooses the operation; CausalEdge64 defines what it means.

- isa.rs: strict Opcode decoder (5 of 16 codes execute; counterfactual,
  intervention and reserved codes fault), one canonical truth function per
  instruction, declared field contracts.
- forward decodes and dispatches to execute(op); no semantic default arm.
- register methods deduction/induction/abduction/synthesis (payload via an
  explicit Compose algebra), revision (truth-only), counterfactual and
  intervention (partial, always refuse).
- learn and syllogize use the canonical truth functions.
- forward, forward_chain, forward_edge, replay_step now return Result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
…t confidence

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 61 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: c9184858-ad81-4cfc-9471-8ec9b3800a81
📥 Commits

Reviewing files that changed from the base of the PR and between 92c4798 and bad7b15.

📒 Files selected for processing (19)
  • .claude/board/entries/2026-10-08-ce64-isa-register-contract.md
  • .claude/board/entries/README.md
  • crates/causal-edge/src/edge.rs
  • crates/causal-edge/src/isa.rs
  • crates/causal-edge/src/lib.rs
  • crates/causal-edge/src/network.rs
  • crates/causal-edge/src/syllogism.rs
  • crates/causal-edge/tests/ce64_isa_contract.rs
  • crates/causal-edge/tests/ce64_isa_golden.rs
  • crates/causal-edge/tests/ce64_legacy_capture.txt
  • crates/causal-edge/tests/ce64_op_contract.rs
  • crates/lance-graph-planner/examples/dcr_w0_replay_budget.rs
  • crates/lance-graph-planner/src/cache/nars_engine.rs
  • crates/lance-graph-planner/src/cache/stage26_v3_parity.rs
  • crates/lance-graph-planner/src/chain_replay.rs
  • crates/lance-graph-planner/tests/chain_confidence.rs
  • crates/lance-graph-planner/tests/gadamer_isa_revision.rs
  • crates/lance-graph-planner/tests/moore_nars16_probe.rs
  • docs/architecture/ce64-semantic-upper-half.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 8, 2026 08:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T08:48:01.866480Z 9fcfb8c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9fcfb8cb07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/causal-edge/src/edge.rs Outdated
Comment thread crates/lance-graph-planner/src/chain_replay.rs
Codex P2 on #1407:
- counterfactual()/intervention() built their fault from the v2 signed
  mantissa unconditionally, so under the v1 layout a direct call reported
  -6/+6 while forward() reported 6/5 for the same instruction. Both now go
  through IsaFault::unsupported, which encodes the code in the active
  layout (to_mantissa is now const for this). New unit test in isa.rs runs
  under both layouts and pins the agreement.
- ReplayError and replay_chain's # Errors said replay has one failure
  mode; they now describe ReplayError::Isa as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
@AdaWorldAPI
AdaWorldAPI merged commit 16c21c4 into main Oct 8, 2026
6 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Oct 8, 2026
forward() now returns Result and refuses non-executable codes, so the
fixture draws only the five executable mantissas and unwraps the result.
Re-verified: the energy-3-bit disable still turns J red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
AdaWorldAPI pushed a commit that referenced this pull request Oct 8, 2026
AdaWorldAPI pushed a commit that referenced this pull request Oct 8, 2026
forward() now returns Result and refuses non-executable codes, so the
fixture draws only the five executable mantissas and unwraps the result.
Re-verified: the energy-3-bit disable still turns J red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFw2WdKr1oxvaKCJC2ua2R
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