DecimalLexeme

Lean checked

Definition and explanation

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

Definition

A decimal lexeme records an optional lexical sign (true means minus and false means plus); a list of digits before the decimal point; an optional list of digits after a present decimal point; and an optional exponent. An exponent records whether its marker is uppercase, an optional sign (true means minus and false means plus), and its digit list. The lists contain digit values rather than ASCII codes. This representation deliberately permits invalid records; validity is imposed by the concrete goal vocabulary.

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

Decimal lexemes retain every syntactic distinction in the GOAL numeric grammar: the leading sign, digits on either side of an optional point, marker case, an optional exponent sign, and all exponent digits.

Proof

The four fields are a direct product decomposition of those grammar choices. Using an option for the fraction distinguishes an absent point from a present point with no following digits, and the nested exponent options independently distinguish absence, marker case, and absence or polarity of its sign. No source computation is changed by this mathematical record.

Requirement: parser totality

The record only specifies inputs and does not alter execution or normal-return observations.

Requirement: parser numeric acceptance

Every numeric grammar witness, including its lexical sign, is represented.

Requirement: parser invalid rejection

All grammar choices are exposed, so being outside the grammar is not weakened.

Requirement: parser nan acceptance

NaN is handled separately and this numeric record adds no NaN case.

Requirement: parser infinity

Infinity is handled separately and this numeric record adds no infinity case.

Requirement: parser non nan results

Numeric and special syntax remain disjoint in the vocabulary.

Requirement: parser numeric sign

The leading lexical sign is an explicit field, including for zero and infinity results.

Requirement: parser signed zero

The leading lexical sign and all zero digits are retained.

Requirement: parser exact rounding

All significand and exponent digits needed for the exact decimal value are retained.

Requirement: parser selected exponent

The record does not constrain the dispatcher's raw-pair trace.

Requirement: parser selected magnitude sign

The record retains the lexical sign separately from the selected magnitude.

Requirement: dispatch abstract composition

The lexical contract can carry the complete parsed content through every tier.

Requirement: dispatch component compliance

Actual component inputs have a lossless grammar witness.

Requirement: parser accumulated rounding

All exponent digits needed by bounded accumulation are retained.

Requirement: parser equal target rounding

Both exact and accumulated values are computed from the same lossless witness.

Requirement: number helper acceptance

Unsigned witnesses are exactly those whose optional leading-sign field is absent.

Requirement: number helper rejection

The full unsigned numeric grammar remains available to state rejection.

Requirement: number helper record bounds

Parsed content is kept distinct from the bounded source record.

Requirement: number helper accumulated value

Every significand and exponent digit needed for the diagnostic value is retained.

Requirement: special helper infinity

Special keywords are modeled separately, so this record is noninterfering.

Requirement: special helper nan

Special keywords are modeled separately, so this record is noninterfering.

Requirement: special helper rejection

This record does not add a special-keyword spelling.

Requirement: native correct or defer

Native-path records are related to exact powers of ten without losing syntax.

Requirement: integer correct or defer

The integer helper's numeric arguments are independent of this syntax carrier.

Requirement: slow accumulated rounding

The full significand remains available to the slow-path statement.

Requirement: assembly correspondence

Raw-pair assembly is independent of this syntax carrier.

Requirement: classification totality

Every finite byte list can be compared with a fully represented numeric witness.

Requirement: classification determinism

Parsed numeric content means equality of these complete records.

Requirement: classification significand digit

Both digit lists are explicit, so the required significand digit can be stated without approximation.

Requirement: rounding totality

Pure rounding is independent of lexical representation.

Requirement: rounding determinism

Pure rounding is independent of lexical representation.

Requirement: exponent value agreement

The same exponent digit list supplies both exponent interpretations.

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": "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-2",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {}
}
Prose assessment
{
  "label": "Prose review has no verdict in this snapshot",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "preservation-v1:7e75646fd88565698893272987e38e5198340bfa12b5291d237055b52fe5e646",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}