Skip to content

FEAT-042 (v2.6): widening with thresholds#78

Merged
avrabe merged 1 commit into
mainfrom
feat-042-threshold-widening
Jun 27, 2026
Merged

FEAT-042 (v2.6): widening with thresholds#78
avrabe merged 1 commit into
mainfrom
feat-042-threshold-widening

Conversation

@avrabe

@avrabe avrabe commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Third feature of v2.6.0. A sound precision lever for loops.

What

  • scry-interval::widen_with_thresholds(a, b, &[i64]) — when a bound would jump to ±∞, snap it to the nearest enclosing syntactic threshold instead (least threshold ≥ b.hi; greatest ≤ b.lo; ±∞ fallback). Sound (result ⊒ both inputs), terminating (finite threshold ladder).
  • Interp carries per-function widen_thresholds (the function's i32/i64 const operands + 0); the loop-header fixpoint widening uses it.

Honesty

Neutral on the current fixture corpus — guard refinement + narrowing already bound the constant-guarded loops (all 45 core tests pass unchanged). This adds a sound lever for loops the guard-refine idiom doesn't catch. The mechanism's soundness + termination is unit-tested (widen_with_thresholds_snaps_and_terminates).

Traces REQ-001. release: v2.6.0. clippy + fmt clean.

🤖 Generated with Claude Code

Replace the loop-header's jump-to-±∞ widening with widening to syntactic
thresholds: when a bound would go to ±∞, snap it to the nearest enclosing
constant from the function's operands instead. Recovers loop bounds plain
widening over-approximates to ⊤, while staying a sound, terminating widening.

- scry-interval: widen_with_thresholds(a, b, &[i64]) — snaps the growing bound
  to the least threshold ≥ b.hi (or greatest ≤ b.lo), ±∞ fallback. Sound
  (result ⊒ a and ⊒ b); terminating (finite threshold ladder + ∞). Unit test
  widen_with_thresholds_snaps_and_terminates (soundness + ascending + reaches ∞).
- scry-analyze-core: Interp carries per-function widen_thresholds
  (collect_widen_thresholds = the i32/i64 const operands + 0); the loop fixpoint
  widening uses widen_with_thresholds.

Honest framing: NEUTRAL on the current fixture corpus (guard refinement +
narrowing already bound those constant-guarded loops — all 45 core tests pass
unchanged), but adds a sound precision lever for loops the guard-refine idiom
does not catch. clippy + fmt clean. FEAT-042 accepted (release v2.6.0).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📐 rivet artifact delta

PR: #78 Base SHA: 065da6f9

Validation

head — `rivet validate` result
  SR-5 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SYS-3 (system-req, status: accepted) — missing: sys-integration-verification
  SR-2 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-4 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SYS-2 (system-req, status: accepted) — missing: sys-integration-verification
  SR-12 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-13 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SYS-1 (system-req, status: accepted) — missing: sys-integration-verification
  SR-8 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-1 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-6 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-9 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-7 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SYS-4 (system-req, status: accepted) — missing: sys-integration-verification
  SR-3 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  SR-10 (sw-req, status: accepted) — missing: sw-integration-verification, unit-verification
  → run `rivet validate --explain SR-11` to see which link type and source types satisfy a gap

Result: PASS (74 warnings)
Schemas: common@0.3.0 (embedded), dev@0.2.0 (embedded), research@0.1.0 (embedded), research-ext@0.1.0 (on-disk), safety-case@0.1.0 (embedded), aspice@0.2.0 (embedded)
base — `rivet validate` result (for comparison)
  SYS-3 (system-req, status: accepted) — missing: sys-integration-verification
  SR-3 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SYS-2 (system-req, status: accepted) — missing: sys-integration-verification
  SR-4 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-6 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SYS-5 (system-req, status: accepted) — missing: sys-integration-verification
  SR-8 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-5 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-1 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-12 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-2 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-13 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-10 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-11 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-9 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  SR-7 (sw-req, status: accepted) — missing: unit-verification, sw-integration-verification
  → run `rivet validate --explain SYS-4` to see which link type and source types satisfy a gap

Result: PASS (74 warnings)
Schemas: common@0.3.0 (embedded), dev@0.2.0 (embedded), research@0.1.0 (embedded), research-ext@0.1.0 (on-disk), safety-case@0.1.0 (embedded), aspice@0.2.0 (embedded)

Artifact stats

base head
Total artifacts 203 203
full stats — head
Artifact summary:
  academic-reference               24
  competitive-analysis             11
  design-decision                  17
  feature                          58
  market-finding                    7
  requirement                      17
  safety-context                    3
  safety-goal                       5
  safety-justification              3
  safety-solution                   6
  safety-strategy                   1
  stakeholder-req                   3
  sw-req                           13
  sw-verification                  13
  sys-verification                  5
  system-req                        5
  technology-evaluation            12
  TOTAL                           203

Orphan artifacts (no links): 11
  CA-001
  CA-002
  CA-003
  CA-004
  CA-005
  CA-006
  CA-007
  CA-008
  CA-009
  CA-010
  CA-011

Diagnostics: 0 error(s), 74 warning(s), 16 info(s)

Diff (base → head)

~ FEAT-042
  status: - proposed -> + accepted

0 added, 0 removed, 1 modified, 202 unchanged

AADL model — head

spar/scry.aadl: OK

Posted by the rivet-delta workflow. Informational only — does not gate the PR.

@avrabe avrabe merged commit c99e8fb into main Jun 27, 2026
10 checks passed
@avrabe avrabe deleted the feat-042-threshold-widening branch June 27, 2026 10:39
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.

1 participant