Definition and explanation
This explanation was written alongside the formalization to describe the statement and its reasoning.
Definition
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: DecimalLexeme]
structure DecimalLexeme where
-- BODY
leadingSign : Option Bool
integerDigits : List Nat
fractionDigits : Option (List Nat)
exponent : Option (Bool × Option Bool × List Nat)
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
none,
some false, or some true. Each ASCII digit byte is encoded
uniquely by its value in 0,\ldots,9. Absence of a decimal point is encoded by
fractionDigits = none; a present point is encoded by
fractionDigits = some ds, including when the following digit list
ds is empty. Absence of an exponent is encoded by exponent = none.
A present exponent is encoded by a triple that records lowercase
e as false and uppercase E as true, records its absent, plus,
or minus sign as none, some false, or some true,
and contains its entire digit list. Projecting such an encoding recovers every
one of these components, and two decimal-lexeme records are equal exactly when
their four fields are componentwise equal.Proof
e/E exponent with
its optional sign and digit list
(reference/model-evidence/goal-vocabulary.txt). The three sign
cases go to distinct constructors or Boolean values. ASCII digit bytes are
exactly 48,\ldots,57, so subtracting 48 maps them bijectively and in order to
0,\ldots,9; adding 48 is the inverse on this domain. Mapping a list applies
these mutually inverse operations at every position and therefore loses no
digit or order.some retains all following digits and may be empty.
For the exponent, the outer option separates absence from presence; in the
present triple the first Boolean separates the two marker cases, the inner
option and Boolean separate all three sign cases, and the list retains every
exponent digit. Reading the four record fields and applying the inverse sign,
marker, and digit tables therefore recovers the original decomposition.
Finally, equality of structure values is equivalent to equality of each named
field, and equality of the option, product, Boolean, and list components is
componentwise; hence record equality has exactly the stated characterization.Decimal records, or source execution
behavior.Requirement: parser totality
Requirement: parser numeric acceptance
Requirement: parser invalid rejection
Err.Requirement: parser nan acceptance
Requirement: parser infinity
Requirement: parser non nan results
Requirement: parser numeric sign
Requirement: parser signed zero
Requirement: parser exact rounding
Requirement: parser selected exponent
Requirement: parser selected magnitude sign
Requirement: dispatch abstract composition
Requirement: dispatch component compliance
Decimal arguments have already discarded lexical distinctions; this carrier asserts no component compliance, call-site precondition, or result.Requirement: parser accumulated rounding
Requirement: parser equal target rounding
Requirement: number helper acceptance
leadingSign = none; its exponent sign is still retained independently. Unsigned validity, rendering, byte-domain coverage, acceptance, and Some remain outside this carrier.Requirement: number helper rejection
None claim.Requirement: number helper record bounds
Decimal record, mantissa, many_digits, returned option, or execution observation, so record bounds and negativity are noninterfering.Requirement: number helper accumulated value
Requirement: special helper infinity
Requirement: special helper nan
Requirement: special helper rejection
Requirement: native correct or defer
Decimal records, whereas this carrier supplies no source record or conversion value. It is noninterfering and provides no lexeme witness, deferral, many_digits, rounding, or return claim.Requirement: integer correct or defer
Requirement: slow accumulated rounding
Requirement: assembly correspondence
BiasedFp, bit operation, assembled word, float, or source-call field and is noninterfering with unrestricted assembly.Requirement: classification totality
Requirement: classification determinism
Requirement: classification significand digit
Requirement: rounding totality
Requirement: rounding determinism
Requirement: exponent value agreement
Proof structure
Follow the declared dependencies to read the supporting statements and proofs.
Inspect related source (44)
- from_u64 · dec2flt/mod.rs:263 Program Rust
- FloatErrorKind · num/mod.rs:18 Program Rust
- ParseFloatError · num/mod.rs:13 Program Rust
More program dependencies (11)
- Dec2FltAssemblyTrace · dec2flt/mod.rs:329 Program Rust
- Dec2FltTrace · dec2flt/mod.rs:295 Program Rust
- Lemire · dec2flt/mod.rs:115 Program Rust
- BiasedFp · dec2flt/common.rs:52 Program Rust
- ByteSlice · dec2flt/common.rs:4 Program Rust
- Decimal · dec2flt/decimal.rs:32 Program Rust
- DecimalSeq · dec2flt/decimal_seq.rs:21 Program Rust
- CastInto · traits.rs:18 Program Rust
- Float · traits.rs:74 Program Rust
- FloatExt · traits.rs:170 Program Rust
- Int · traits.rs:27 Program Rust
Standard-library dependencies (30)
- clone · core/src/clone.rs:698 Rust library
- div · core/src/ops/arith.rs:515 Rust library
- mul · core/src/ops/arith.rs:350 Rust library
- neg · core/src/ops/arith.rs:719 Rust library
- bitand · core/src/ops/bit.rs:178 Rust library
- bitor · core/src/ops/bit.rs:282 Rust library
- shl · core/src/ops/bit.rs:489 Rust library
- shr · core/src/ops/bit.rs:612 Rust library
- EXPONENT_MASK · core/src/num/f64.rs:615 Rust library
- INFINITY · core/src/num/f64.rs:512 Rust library
- MANTISSA_DIGITS · core/src/num/f64.rs:412 Rust library
- MANTISSA_MASK · core/src/num/f64.rs:637 Rust library
- NAN · core/src/num/f64.rs:509 Rust library
- NEG_INFINITY · core/src/num/f64.rs:515 Rust library
- classify · core/src/num/f64.rs:782 Rust library
- from_bits · core/src/num/f64.rs:1269 Rust library
- to_bits · core/src/num/f64.rs:1223 Rust library
- is_ascii_digit · core/src/num/mod.rs:958 Rust library
- from_residual · core/src/option.rs:2793 Rust library
- branch · core/src/option.rs:2779 Rust library
- first · core/src/slice/mod.rs:155 Rust library
- split_first · core/src/slice/mod.rs:198 Rust library
- as_bytes · core/src/str/mod.rs:498 Rust library
- FpCategory · core/src/num/mod.rs:1522 Rust library
- Div · core/src/ops/arith.rs:460 Rust library
- Mul · core/src/ops/arith.rs:322 Rust library
- Neg · core/src/ops/arith.rs:690 Rust library
- BitOr · core/src/ops/bit.rs:254 Rust library
- Shl · core/src/ops/bit.rs:461 Rust library
- Shr · core/src/ops/bit.rs:584 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": "DecimalLexeme",
"closure_version": "patch_c_v1",
"active_decl_hash": "647f6faf0b0b16232d26033aeacffcf3ef0d6f68f7151c52f4afef31f5bd1b0f",
"active_statement_hash": "2227a26a68ede6cea6a61e5db647c12f28eb09e24db63973c2039eca507f2ee6",
"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-13",
"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:6e0662b43d58b11899df5abc12b068d22507d1ac93928a9e58ea8f922dffe6fa",
"current_fingerprint": "preservation-v1:6e0662b43d58b11899df5abc12b068d22507d1ac93928a9e58ea8f922dffe6fa",
"superseded_for_theorem_closure": false
}Review verdicts
{
"corr_status": "Pass",
"sound_status": "Pass",
"substantiveness_status": "Pass"
}