Repository navigation
docs: SPEC for checked integer arithmetic in fallible bodies, and Q17 for the input encoding contract - #333
Merged
Merged
Conversation
… for the input encoding contract The user confirmed the direction (design A+as, §9-69.2) and asked for SPEC and the Q17 table. SPEC-checked-arithmetic: in `!` bodies, i32 + - *, unary -, MIN/-1 and f64 as i32 fail with a new ML_ST_OVERFLOW (-3); % keeps MIN % -1 = 0; fingerprint and ABI version unchanged; after `result` it behaves like -2. DP-O3..O8 await confirmation; Grok's plan gate chose -2 for the status at first, and its own verify then confirmed that -2 carries most of the same cost. OPEN_QUESTIONS Q17: reopening DP-S2, with the CP949 measurement and the EUC-KR counterexample; recommendation (A) keep it open, awaiting confirmation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… time, and names who confirmed Grok's unasked line: the SPEC left open whether an overflowing constant expression in a `!` body folds or fails. DP-O9: it fails at run time with -3; a compile-time diagnostic stays a separate candidate. The two confirmed DPs now say the user confirmed them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
Author
🔵 SCAManager 분석 결과총점: 89/100 (등급 B) 점수 상세
|
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.
This PR is a draft SPEC plus an open question. There is no product code. The user confirmed the direction on 2026-09-26: design A+as from §9-69.2, and put the encoding question in OPEN_QUESTIONS.
docs/slices/SPEC-checked-arithmetic.mdInside fallible bodies (
-> T!,-> string!,-> [T]!), these operations fail with a new reserved statusML_ST_OVERFLOW = -3instead of wrapping or saturating:+ - *and unary-;i32::MIN / -1;f64 as i32when the value is NaN or out of range.Infallible functions keep today's semantics. That means the wrap decisions (DP-I4, DP-U4, the D2 row) and the saturation rule (§2.3) still hold for them.
Evidence (§0). This comes from the §7 measurements and the local design-A prototype (E2, 626 rows):
DPs. DP-O1 and DP-O2 are confirmed by the user. DP-O3 through DP-O9 await confirmation:
-3, not a reused-2%MIN % -1stays0, the true remainderresult-2: buffer undefineddocs/OPEN_QUESTIONS.mdQ17Reopen DP-S2 (input string encoding)? It covers:
It lists three options. The recommendation is (A) keep it open and document the hazard, awaiting confirmation.
Grok
Following the user's instruction, every call carried one claim and ran in parallel. All of them finished in 2 to 4 turns.
Plan gate, one call per DP:
%: keepwrapping_rem.-2, citing the cost fix(bindings): -2를 낼 수 있는 모듈이 헤더에서 그것을 말한다 #238 measured. A follow-up verify then CONFIRMED that reusing-2also requires widening the-2declaration predicate. That leaves one constant as the only difference, so the SPEC proposes-3and records the dissent.Verify, 5 single-claim calls, all CONFIRMED:
checked_remonMIN % -1;result;One unasked line found a gap: an overflowing literal-only expression was unspecified. It is now DP-O9.
Evidence:
cargo test -p ml_oracle --test doc_claims --lockedgives 50 passed.Related: D17, D18, SPEC-i32 DP-I4, SPEC-unary DP-U4, SPEC-i32-division D2, SPEC-numeric-conversion §2.3, SPEC-array-return DP-R9, SPEC-fixed-decimals DP-M4, SPEC-string-input DP-S2, §9-69.
🤖 Generated with Claude Code