Definition and explanation
This explanation was written alongside the formalization to describe the statement and its reasoning.
Definition
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: ModelSliceFirst]
def ModelSliceFirst {T : Type} (s : Slice T) : Result (Option T) :=
-- BODY
ok s.val.head?
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
Slice Std.U8 satisfying
SourceValidByteSlice and representing a configured Rust
&[u8], this binding returns normally with ok none for the
empty slice and otherwise with ok (some x), where x is the
same first byte returned by the source's shared reference.
It leaves the complete ordered input unchanged and requires no UTF-8,
lexical-validity, A/B, or termination premise.Proof
[], the Rust body and ModelSliceFirst both return
None; on x :: xs, both return the identical head, by shared
reference in Rust and as the immutable value x in Aeneas.
Both cases return normally, do not change the input, and inspect no length
or content condition beyond the empty/head distinction.first call is
generated.lean:4568, in dec2flt_with_trace, immediately
after as_bytes at 4567;
its source counterpart is crate/dec2flt/mod.rs:365.
Here T = Std.U8 and the head is copied to test + and
-; no reference identity, lifetime, or mutation is observed.
The fixed dispatcher frame of DispatchFrame retains this
same first-byte operation
even with abstract helper components, as recorded in the current evidence.
On a Rust string, the complete UTF-8 bytes satisfy the slice length predicate
of SourceValidByteSlice; on arbitrary source-valid helper slices
the primitive claim needs no UTF-8 condition.
If a leading sign is consumed, the nonempty case justifies taking the tail,
whose length is no greater than the original slice's. The original complete
string length is not replaced by this shortened length in any GOAL premise.upstream/dec2flt/parse.rs:86 uses first in the scientific
digit-entry test. Its audited replacement at
crate/dec2flt/parse.rs:134-137 first tests nonemptiness and then
reads index zero for is_ascii_digit.
On an empty post-exponent-sign slice both tests are false and read no byte;
on x :: xs both test the same x. Index zero is in bounds
because 0<1+|\mathit{xs}|.
The current extraction at 1747-1753 therefore implements that
upstream first observation without calling this bound external.
The distinction also applies transitively through parse_number
and through the slow-to-decimal-to-scientific path recorded in the evidence.
This binding does not implement or remove their indexed tests; the already
audited adaptation remains fixed.Requirement: assembly correspondence
Requirement: classification determinism
Requirement: classification significand digit
Requirement: classification totality
Requirement: dispatch abstract composition
Requirement: dispatch component compliance
Requirement: exponent value agreement
Requirement: integer correct or defer
i64/u64 input and
has no first callee. Its on-normal alternatives are unaffected.Requirement: native correct or defer
Decimal, including the
disguised path, and has no first callee. Its on-normal contract is unchanged.Requirement: number helper acceptance
Some.Requirement: number helper accumulated value
Requirement: number helper record bounds
Requirement: number helper rejection
None remain unchanged, including malformed
tails after exponent updates stop.Requirement: parser accumulated rounding
Requirement: parser equal target rounding
Requirement: parser exact rounding
Requirement: parser infinity
Requirement: parser invalid rejection
Requirement: parser nan acceptance
Requirement: parser non nan results
Requirement: parser numeric acceptance
Ok without panic remains required, not presumed.Requirement: parser numeric sign
Requirement: parser selected exponent
Requirement: parser selected magnitude sign
Requirement: parser signed zero
Requirement: parser totality
Requirement: rounding determinism
Requirement: rounding totality
Requirement: slow accumulated rounding
Requirement: special helper infinity
Requirement: special helper nan
Requirement: special helper rejection
None.Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Uses
No declared dependencies.
Inspect related source (1)
- first · core/src/slice/mod.rs:155 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": "ModelSliceFirst",
"closure_version": "patch_c_v1",
"active_decl_hash": "f38dbcad0a84ab884eec3f16d86eb111712b828a19dccf0bf5974d6d1e02bd18",
"active_statement_hash": "335139a4afbfb70e58bb0bcb1244b046933cf859037e19598e254e40a3e50024",
"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:aedbbbd4a7880b1356e415074ee4bd3935090ad3bbe1ef542efe4966b1047b47",
"current_fingerprint": "preservation-v1:aedbbbd4a7880b1356e415074ee4bd3935090ad3bbe1ef542efe4966b1047b47",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}