Definition and explanation
This explanation was written alongside the formalization to describe the statement and its reasoning.
Definition
Str byte slice s,
\mathsf{ModelStrAsBytes}(s) successfully returns s itself.Lean definition
Trellis authored this Lean model for an operation outside the mechanical extraction. Modeling choices explains its behavior and review.
import Aeneas
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ModelStrAsBytes]
def ModelStrAsBytes (s : Str) : Result (Slice Std.U8) :=
-- BODY
ok s
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
Str value s satisfying
\mathsf{DecimalGoalVocabularyDefault.sourceString}(s), the configured Rust
str represented by s has exactly the same complete ordered UTF-8
bytes, source str::as_bytes returns normally with a shared slice of
exactly those bytes, and \mathsf{ModelStrAsBytes}(s) returns
ok of the identical ordered Aeneas Slice U8 s.Proof
Str to be Slice U8; its exact definition, the
frozen external declaration, its sole generated call, the support binding, and
the configured Rust as_bytes body are pinned in
reference/model-evidence/aeneas-string-bytes.txt. By itself this
Aeneas type overapproximates Rust str: it permits arbitrary byte values
up to Aeneas's Usize.max slice bound, rather than requiring UTF-8 and
the stricter configured isize::MAX byte bound. The paired definition
DecimalGoalVocabularyDefault supplies exactly the missing restriction:
its sourceString predicate requires length at most
9223372036854775807 and a witness Lean string whose UTF-8 encoding is the
entire byte list of s. Those are precisely the configured Rust
str representation conditions established by
reference/model-evidence/source-valid-byte-slice.txt.str with the same complete ordered bytes. The frozen Rust body is an
infallible same-layout transmutation from that str to a shared
[u8] slice, so it neither changes the byte sequence nor introduces a
panic or error. Aeneas represents the slice as the complete ordered list
subtype and erases this immutable shared borrow to its value observation, as
pinned in reference/model-evidence/aeneas-slice-observations.txt.
Finally, the bound implementation is literally ok s. Hence, on
exactly the sourceString subset and without making a claim about other
Aeneas Str values, the source call and its replacement both continue
normally with the identical complete ordered U8 slice.Requirement: assembly correspondence
biased_fp_to_float begins from a
BiasedFp and contains no string-to-bytes conversion; the unique frozen
as_bytes call is instead in dec2flt_with_trace, as shown by
reference/model-evidence/aeneas-string-bytes.txt. This binding is
therefore noninterfering with every execution and raw-word observation of the
assembly goal.Requirement: classification determinism
as_bytes call, so this binding neither restricts its byte
domain nor supplies its uniqueness conclusion.Requirement: classification significand digit
Requirement: classification totality
as_bytes; this source-valid-string claim
therefore adds no restriction and does not assert total classification.Requirement: dispatch abstract composition
Requirement: dispatch component compliance
as_bytes call is the first operation of the concrete
dec2flt_with_trace execution, as pinned in
reference/model-evidence/aeneas-string-bytes.txt. On the goal's
source-valid strings, the replacement succeeds exactly when the infallible
source call does and feeds the identical ordered bytes to every subsequent
branch, helper call, trace field, and result; later panic-versus-normal behavior
is therefore unchanged. This establishes only preservation of the concrete
execution and of later comparisons with contracts, not existence of a compliant
contract instance or the component-compliance conclusion.Requirement: exponent value agreement
Requirement: integer correct or defer
compute_float starts directly from an i64
exponent and u64 mantissa and has no string conversion. The sole
as_bytes call belongs to the outer traced dispatcher, so this binding
does not affect the integer tier's return, deferral, or assembled-word behavior.Requirement: native correct or defer
try_fast_path starts directly from a
Decimal record and contains no str::as_bytes call. Hence the
binding is noninterfering with its panic/normal, None/Some, and
float-result observations and does not assert native correctness.Requirement: number helper acceptance
parse_number receives a Rust byte slice directly;
it does not convert a Rust string. The sole frozen as_bytes call is in
the outer traced dispatcher, so this binding neither restricts helper slices nor
asserts that this helper accepts numeric input.Requirement: number helper accumulated value
parse_number. Since that source function contains no string
conversion, this binding changes neither its returned record nor the values
compared with that record, and supplies none of the interval conclusion.Requirement: number helper record bounds
str. The helper
therefore does not call as_bytes; this binding is noninterfering with
normal return and the record-field bounds.Requirement: number helper rejection
parse_number takes its arbitrary nonempty byte slice
directly and performs no string conversion. Thus this binding adds no UTF-8
premise, changes no helper execution, and does not presume the asserted
None result.Requirement: parser accumulated rounding
as_bytes call is the first operation of the public
parser path through dec2flt_with_trace, as pinned in
reference/model-evidence/aeneas-string-bytes.txt. On each
source-valid input the source call and replacement both continue with identical
ordered bytes, so every later branch, panic/normal outcome, returned word, and
trace observation is unchanged. This does not assume accumulated-value
rounding.Requirement: parser equal target rounding
as_bytes call recorded in
reference/model-evidence/aeneas-string-bytes.txt, the
sourceString premise places the input exactly in the claim's domain.
Both sides continue infallibly with the same ordered bytes, preserving all
downstream branches, panic/normal behavior, words, and traces without assuming
the equal-target bridge.Requirement: parser exact rounding
ok of precisely the same
ordered bytes, with no new failure; hence all subsequent control flow,
panic-versus-normal behavior, and result words are preserved. No exact-rounding
conclusion is used here.Requirement: parser infinity
as_bytes call pinned in
reference/model-evidence/aeneas-string-bytes.txt and its model both
continue normally with the literal's identical ordered bytes. All subsequent
matching, sign handling, panic/normal behavior, and returned word are therefore
unchanged; this does not assert acceptance or the infinity result.Requirement: parser invalid rejection
dec2flt_with_trace, pinned in
reference/model-evidence/aeneas-string-bytes.txt, is infallible and
is replaced by ok of the exact same bytes. Downstream classification,
panic/normal behavior, and Ok/Err observations are preserved
without assuming that invalid inputs are rejected.Requirement: parser nan acceptance
as_bytes call recorded in
reference/model-evidence/aeneas-string-bytes.txt. That call and
the replacement both continue with exactly the same ordered bytes, preserving
later case matching, sign handling, panic/normal behavior, and result bits; no
NaN acceptance claim is assumed.Requirement: parser non nan results
as_bytes call is pinned in
reference/model-evidence/aeneas-string-bytes.txt. On every
source-valid non-NaN input it and the replacement succeed with identical bytes,
so later branches, panic/normal outcomes, and the returned word are unchanged.
Whether that word is non-NaN remains the separate GOAL obligation.Requirement: parser numeric acceptance
Ok/Err results are preserved without
asserting acceptance.Requirement: parser numeric sign
as_bytes call pinned in
reference/model-evidence/aeneas-string-bytes.txt, each source-valid
numeric input and its model expose the same first sign byte and remaining
ordered bytes. Thus all downstream branches, panic/normal behavior, assembly,
and returned words are unchanged, without assuming the claimed lexical sign.Requirement: parser selected exponent
as_bytes call on the public traced-parser path is
pinned in reference/model-evidence/aeneas-string-bytes.txt. On
source-valid inputs the model supplies its exact bytes with the same infallible
boundary behavior, preserving every later branch, panic/normal outcome, and
recorded selected pair. It does not assume that the selected exponent is in
range.Requirement: parser selected magnitude sign
Requirement: parser signed zero
as_bytes call pinned in
reference/model-evidence/aeneas-string-bytes.txt and the replacement
both continue infallibly with the identical sign and digit bytes. This preserves
later branches, panic/normal behavior, and the returned word but does not assert
the signed-zero conclusion.Requirement: parser totality
sourceString lies in the claim's exact domain, and source and
model both pass the same ordered bytes without failure at this boundary. Thus
all later execution, including any panic, normal return, or divergence, is
unchanged; this application does not assume totality.Requirement: rounding determinism
as_bytes, so
the binding is noninterfering and supplies no uniqueness premise or conclusion.Requirement: rounding totality
Requirement: slow accumulated rounding
parse_long_mantissa begins directly from a Rust
byte slice and does not call str::as_bytes; the sole frozen call is in
the outer traced dispatcher. This binding therefore changes neither helper
execution nor its raw pair and does not assert the rounding conclusion.Requirement: special helper infinity
parse_inf_nan source subject receives its keyword as
a Rust byte slice directly, so it performs no string conversion. This binding
adds no UTF-8 condition and is noninterfering with its return and sign
observations, without assuming infinity acceptance.Requirement: special helper nan
as_bytes call. The string binding therefore changes no
branch, panic/normal outcome, or returned word and does not assume NaN acceptance.Requirement: special helper rejection
parse_inf_nan receives an arbitrary Rust byte slice
directly and never converts a Rust string. Consequently this binding is
noninterfering, imposes no UTF-8 restriction, and supplies none of the claimed
None result.Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
No declared dependencies.
Used by
- InvalidOverflowBoundaryWitness
- ParserAccumulatedRounding
- ParserExactRoundingExecution
- ParserExactRounding Refutation
- ParserInfinity
- ParserInvalidRejectionSafeLength
All 15 entries
- InvalidOverflowBoundaryWitness
- ParserAccumulatedRounding
- ParserExactRoundingExecution
- ParserExactRounding Refutation
- ParserInfinity
- ParserInvalidRejectionSafeLength
- ParserNanAcceptance
- ParserNonNanResults
- ParserNumericAcceptance Refutation
- ParserNumericOverflowPropagation
- ParserNumericPublicOverflowWitness
- ParserNumericSign
- ParserNumericTraceShape
- ParserSignedZero
- Preamble
Inspect related source (1)
- as_bytes · core/src/str/mod.rs:498 Rust library
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
- propext
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": "ModelStrAsBytes",
"closure_version": "patch_c_v1",
"active_decl_hash": "8021e96ef85ff3c69be4b89e2bcdd08beb0207aed3c1c3c141e633c44ade6981",
"active_statement_hash": "f2c07a8479b86f8e65e17874a1a1ac6d3d23b6e603a676dd49d6a90c93970974",
"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-12",
"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:71a95de8883b0a988e9389c8489ef382ae05dfb9eafc47a61a198d21de57d498",
"current_fingerprint": "preservation-v1:71a95de8883b0a988e9389c8489ef382ae05dfb9eafc47a61a198d21de57d498",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}