SourceValidByteSlice

Lean checked

Definition and explanation

This explanation was written alongside the formalization to describe the statement and its reasoning.

Definition

An Aeneas byte slice is source-valid for the configured 64-bit Rust target exactly when its byte length is at most \mathtt{isize::MAX}=2^{63}-1=9223372036854775807. This predicate places no restriction on byte values and, in particular, imposes no UTF-8 condition.

Lean definition

Trellis authored these statements and proofs. Lean checks the formal proofs; the assumptions used by each proof are listed below.

import Aeneas
import Tablet.Preamble

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: SourceValidByteSlice]
def SourceValidByteSlice (s : Slice Std.U8) : Prop :=
-- BODY
  s.val.length <= 9223372036854775807

end dec2flt_model
Preservation and explanation

Natural-language argument

The status above describes the Lean proof. Its explanatory prose may remain a sketch after that proof closes.

Explanatory prose status

Prose retained as authored. The explanatory prose is preserved as it stood when captured.

Preservation argument

Claim

For the configured x86_64-unknown-linux-gnu source domain, SourceValidByteSlice is exactly the length condition on a Rust &[u8] represented by an Aeneas byte slice: the represented byte count is at most isize::MAX; byte contents are unrestricted.

Proof

An Aeneas Slice Std.U8 exposes its represented elements as s.val, so s.val.length is its byte count. The pinned toolchain reports a 64-bit pointer width, isize::MAX equal to 9223372036854775807, and one-byte u8 elements. Its core slice source records that a slice occupies at most isize::MAX bytes. These commands, raw results, and source locations are recorded in reference/model-evidence/source-valid-byte-slice.txt. Thus the Lean inequality is precisely the configured source length bound. Since the definition inspects only length, it adds neither a byte-value condition nor the UTF-8 invariant that belongs specifically to Rust strings.

Requirement: parser totality

The parser's Rust-string domain already carries its own source-validity and UTF-8 conditions; this byte-slice predicate does not alter that domain.

Requirement: parser numeric acceptance

The parser's source-valid string supplies a bounded byte slice when as_bytes is called; numeric grammar remains a separate premise.

Requirement: parser invalid rejection

The parser's source-valid string supplies the same bounded byte slice, while invalidity remains the complement of the stated grammar.

Requirement: parser nan acceptance

The predicate contributes only the length fact inherited by the helper slice and does not change NaN spelling or UTF-8 validity.

Requirement: parser infinity

The predicate contributes only the length fact inherited by the helper slice and does not change infinity spelling or sign.

Requirement: parser non nan results

The byte-length representation does not change any returned floating-point observation.

Requirement: parser numeric sign

The byte-length representation does not change lexical or returned-word signs.

Requirement: parser signed zero

The byte-length representation does not identify or alter the two signed-zero words.

Requirement: parser exact rounding

The predicate only identifies source-representable helper inputs and leaves exact decimal values and binary64 rounding unchanged.

Requirement: parser selected exponent

The predicate adds no constraint on selected raw-pair fields.

Requirement: parser selected magnitude sign

The predicate adds no constraint on selected raw-pair words or their sign bits.

Requirement: dispatch abstract composition

The abstract flow ranges over bytes of source-valid Rust strings. Sign stripping preserves their inherent length bound on the body, so this predicate supplies exactly the helper-slice domain used by the numeric, special, and slow contracts without adding UTF-8 to those helper inputs.

Requirement: dispatch component compliance

Every helper body slice comes from a source-valid Rust string by taking a subslice, so its byte count still satisfies this exact source bound.

Requirement: parser accumulated rounding

The predicate identifies the actual helper-call domain without changing the accumulated-exponent value.

Requirement: parser equal target rounding

The predicate identifies the actual helper-call domain without changing either rounding target.

Requirement: number helper acceptance

The GOAL quantifies over Rust byte slices, whose exact modeled length domain is supplied by this predicate; arbitrary byte contents remain allowed.

Requirement: number helper rejection

The GOAL quantifies over Rust byte slices, so this predicate supplies only their inherent length bound and imposes no UTF-8 condition.

Requirement: number helper record bounds

Premising the model theorem with this predicate makes its slice quantifier exactly the configured Rust domain while retaining nonemptiness and every returned-record conclusion.

Requirement: number helper accumulated value

The GOAL's unsigned numeric Rust slice must satisfy this inherent bound; the predicate does not discard any source input or alter its diagnostic value.

Requirement: special helper infinity

The GOAL's Rust byte slices satisfy this inherent bound, independently of keyword bytes and the separate sign argument.

Requirement: special helper nan

The GOAL's Rust byte slices satisfy this inherent bound, independently of keyword bytes and the separate sign argument.

Requirement: special helper rejection

The GOAL's Rust byte slices satisfy this inherent bound without any UTF-8 restriction on rejected contents.

Requirement: native correct or defer

This goal ranges over Decimal records rather than slices, so the predicate is noninterfering.

Requirement: integer correct or defer

This goal ranges over integer machine values rather than slices, so the predicate is noninterfering.

Requirement: slow accumulated rounding

The GOAL's unsigned-numeric Rust slice satisfies this inherent bound; its full significand and accumulated value remain unchanged.

Requirement: assembly correspondence

This goal ranges over unrestricted raw pairs rather than slices, so the predicate is noninterfering.

Requirement: classification totality

This purely mathematical goal remains quantified over every finite byte string, including lists longer than the Rust slice bound.

Requirement: classification determinism

This purely mathematical goal remains quantified over every finite byte string, including lists longer than the Rust slice bound.

Requirement: classification significand digit

This purely mathematical grammar fact remains unrestricted by source representability.

Requirement: rounding totality

This purely mathematical real-number goal has no slice input, so the predicate is noninterfering.

Requirement: rounding determinism

This purely mathematical real-number goal has no slice input, so the predicate is noninterfering.

Requirement: exponent value agreement

This lexical value comparison is unchanged; source-facing uses apply the predicate only to their Rust slice carrier.

Download Lean source · Download TeX source

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (44)
More program dependencies (11)
Standard-library dependencies (30)

Related source and models come from the extraction records and declared dependencies.

Proof assumptions and review

Lean checks the formal proof. Trellis also reviews how the statement corresponds to the intended requirement.

Transitive assumptions

This list combines the assumptions recorded for this declaration and its dependencies. It may include assumptions used by auxiliary declarations in those modules.

Helper theorems included
Technical checking records
Local closure summary
{
  "node": "SourceValidByteSlice",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "e3fc0fac38d439193be9c7ae857a5e1259008c58b50ae1f59f09c298c45d1a8d",
  "active_statement_hash": "4e0fcf145a106e1a56bf0be06531e6e36acdfa0045c6ee07d4766bc30eef45d9",
  "kernel_axioms": [
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "d5c04ffa333d9b33b238a527f5beaa2be82e021d3e9c0bbe01b1310280f7f55a",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-68",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {}
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:588bb23bbf5abc3cbacc628bb377f7c226b8672ef83db1a0522da3b5130239e3",
  "current_fingerprint": "preservation-v1:588bb23bbf5abc3cbacc628bb377f7c226b8672ef83db1a0522da3b5130239e3",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}