Skip to content

Proofs (reader): noncharacter and safe-integer core with Pearlite contracts and a Verus model, not yet run - #55

Draft
hyperpolymath wants to merge 1 commit into
claude/beta-proof-gatefrom
claude/beta-proof-reader
Draft

hyperpolymath wants to merge 1 commit into
claude/beta-proof-gatefrom
claude/beta-proof-reader

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Proof module 2 of the beta track: src/strict.rs and src/ijson.rs. Stacked on #54 (base branch claude/beta-proof-gate), which is stacked on #53; review those first.

No verifier has been run. Every proof row is OPEN or TESTED.

Scope, and what is not in it

In scope and done: the Unicode and numeric predicates, moved to a dependency-free core (src/ijson_core.rs) with Pearlite contracts, included by path in the Creusot harness, with one more true control and one more false control.

Not annotated on the production code, with the reason: StrictVisitor implements serde::de::Visitor and is driven by serde_json::Deserializer, and validate_value recurses over serde_json::Value. Termination under MAX_DEPTH, panic-freedom and duplicate rejection before insertion all need a trusted Pearlite model of Value, Map and the Visitor/MapAccess protocol first. That model is the trust boundary the brief names, and I have recorded it (A-6) but not written it. Those rows therefore stay TESTED on existing tests or OPEN; I did not write contracts I could not anchor to a model.

A Verus model covers the same properties at the model level (verification/verus/reader_model.rs): the predicates, traversal with a termination measure, and duplicate-key rejection with a proof that the reader accepts exactly the key sequences with no repeat. It is a separately written model, so it is not a proof of the production code and not a second independent witness (policy §1.2).

Production change

is_noncharacter now tests code_point % 0x10000 >= 0xFFFE instead of (code_point & 0xFFFF) >= 0xFFFE, so its contract needs no bit-vector reasoning. validate_number_is_i_json calls is_safe_i64 / is_safe_u64. Behaviour is unchanged, as tested below.

Evidence (executed here, rustc 1.99.1)

Check Result
cargo test --locked --all-features 168 passed, 0 failed
is_noncharacter vs the previous definition, every value in 0..=0x20FFFF (covers all code points) all equal; exactly the 66 listed noncharacters accepted
Safe-integer boundaries (11 values) pass
Planted mutants of src/ijson_core.rs 5 of 5 fail the tests
pearlite-syn 0.15.0 syntax check 33 + 7 + 6 contract terms parse; malformed terms refused
scripts/tests/proof-gate-test.sh (stub verifiers) 11 of 11 cases
clippy -D warnings, cargo fmt --check clean
scripts/proven-coverage.sh no new uncovered line; three src/ijson.rs exclusions re-bound to moved lines; still exits 1 for the pre-existing parse_jcs lines

Not executed: Creusot, Why3, Verus, Kani, Z3, CVC5. Kani has no scope: no unsafe, no FFI.

Row census

Denominator: the 7 obligations R-1 to R-7 added to PROOF-STATUS.adoc.

Token Count Rows
PROVEN 0
PROVEN-WITH-AXIOMS 0
TESTED 5 R-1 noncharacters, R-2 safe integers, R-3 depth bound, R-4 duplicate rejection, R-7 feature unification
ASSUMED 0
OPEN 2 R-5 panic-freedom, R-6 accepted language

With #53: 16 obligations, PROVEN 0, TESTED 8, OPEN 8; 7 ASSUMED boundaries.

Open points

  • R-5: check_integer_tokens indexes under an unstated precondition (the text already parsed). It holds at both call sites, so this is not a hole, but the proof would be simpler and unconditional if the scan bounds-checked. Not changed here; it needs a ruling because it adds unreachable branches.
  • R-3 and R-4 are the rows the beta gate names. They cannot move past TESTED until the serde model (A-6) is written and a Creusot image exists.

Generated by Claude Code

…h contracts (not yet run)

- src/ijson_core.rs: is_noncharacter (arithmetic, no bit mask), is_safe_i64,
  is_safe_u64, with Pearlite contracts behind cfg(creusot) and a lemma tying
  the arithmetic form to the Unicode list. Exhaustive test over every code
  point; boundary test for the safe range.
- Harness: includes the new file by path; one more true and false control;
  the gate self-test and SCOPE follow.
- verification/verus/reader_model.rs: model of the predicates, bounded
  traversal and duplicate-key rejection. Not run.
- verification/PROOF-STATUS.adoc: reader section R-1 to R-7, A-6, A-7.

No verifier has been run; every proof row stays OPEN or TESTED.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J4QvDfneftEg71bUadt3v3
@gitnotebooks

gitnotebooks Bot commented Dec 1, 2026

Copy link
Copy Markdown

Review these changes at https://app.gitnotebooks.com/hyperpolymath/ijson-jcs/pull/55

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: fd582aa1-f512-4a7d-9dba-db280cc38d24

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

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