DecimalGoalVocabulary

Lean checked

Definition and explanation

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

Definition

The decimal-goal vocabulary is a record of the following interpretations: the natural-number byte list of an Aeneas byte slice; source-valid UTF-8 strings; valid and rendered decimal lexemes; a decimal literal's derived negativity; signed case-insensitive special literals (an optional sign followed by a Boolean distinguishing NaN from infinity); classification as a numeric lexeme, a signed special literal, or invalid; mathematical and source-accumulated explicit exponents; exact and accumulated nonnegative real values; the real value of a source Decimal record; binary64 magnitude rounding; NaN, signed infinity, and sign-bit observations; application of a lexical sign to a magnitude word; and unrestricted BiasedFp assembly.

Lean definition

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

import Tablet.DecimalLexeme
import Tablet.F64
import Tablet.num_imp_dec2flt_common_BiasedFp
import Tablet.num_imp_dec2flt_decimal_Decimal
import Mathlib.Data.Real.Basic

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: DecimalGoalVocabulary]
structure DecimalGoalVocabulary where
-- BODY
  bytes : Slice Std.U8 -> List Nat
  sourceString : Str -> Prop
  validNumeric : DecimalLexeme -> Prop
  renderNumeric : DecimalLexeme -> List Nat
  lexicalNegative : DecimalLexeme -> Bool
  specialLiteral : List Nat -> Option Bool -> Bool -> Prop
  classifies : List Nat -> Option (Sum DecimalLexeme (Option Bool × Bool)) -> Prop
  mathExplicitExponent : DecimalLexeme -> Int
  accumulatedExplicitExponent : DecimalLexeme -> Int
  exactMagnitude : DecimalLexeme -> Real
  accumulatedMagnitude : DecimalLexeme -> Real
  decimalMagnitude : num.imp.dec2flt.decimal.Decimal -> Real
  roundsMagnitude : Real -> F64 -> Prop
  isNan : F64 -> Prop
  isInfinity : Bool -> F64 -> Prop
  isNegative : F64 -> Prop
  signedMagnitude : Bool -> F64 -> F64 -> Prop
  assembledWord : num.imp.dec2flt.common.BiasedFp -> F64 -> Prop

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

The interface keeps source strings, arbitrary byte slices, real decimal values, binary64 words, source records, and raw pairs as distinct domains and exposes all observations named by the 32 GOAL obligations.

Proof

The field types show each domain and quantifier boundary explicitly. In particular source-string validity is a predicate only on Str; byte-list classification is unrestricted; rounding accepts real inputs; and raw-pair assembly has no well-formedness argument. The interface introduces no computation and is instantiated concretely in DecimalGoalVocabularyDefault.

Requirement: parser totality

The outer Aeneas result remains separate from the returned Rust result.

Requirement: parser numeric acceptance

Source-string validity and the exact numeric grammar are separate fields.

Requirement: parser invalid rejection

Invalidity is the third exhaustive classification rather than a weakened grammar.

Requirement: parser nan acceptance

NaN spelling and the returned-word NaN observation are both exposed.

Requirement: parser infinity

Keyword sign and signed-infinity word observations are both exposed.

Requirement: parser non nan results

The NaN observation applies to every successful word.

Requirement: parser numeric sign

Lexical sign and word sign are independent observations.

Requirement: parser signed zero

Signed-magnitude assembly retains the distinction between the two zero words.

Requirement: parser exact rounding

Exact real magnitude and binary64 rounding are explicit fields.

Requirement: parser selected exponent

Raw-pair fields remain available through the extracted trace.

Requirement: parser selected magnitude sign

Raw assembly and the binary64 sign observation are explicit.

Requirement: dispatch abstract composition

Lexical, conversion, sign, and rounding observations can be quantified independently.

Requirement: dispatch component compliance

The same observations apply to the extracted source components.

Requirement: parser accumulated rounding

The accumulated real magnitude is distinct from the exact magnitude.

Requirement: parser equal target rounding

Both values use the same rounding relation.

Requirement: number helper acceptance

The helper's slice domain and optional record result remain explicit.

Requirement: number helper rejection

No UTF-8 condition is imposed on source byte slices.

Requirement: number helper record bounds

All four source record fields remain observable.

Requirement: number helper accumulated value

Record values and accumulated lexical values share the real domain.

Requirement: special helper infinity

The slice, separate sign argument, optional result, and infinity observation remain explicit.

Requirement: special helper nan

The slice, separate sign argument, optional result, and NaN observation remain explicit.

Requirement: special helper rejection

The complete special grammar is exposed on arbitrary byte lists.

Requirement: native correct or defer

Record value, record sign, optional result, and rounding are explicit.

Requirement: integer correct or defer

All machine inputs, raw-pair outputs, deferral, and assembly observations remain explicit.

Requirement: slow accumulated rounding

The arbitrary byte slice, accumulated value, raw pair, and assembly remain explicit.

Requirement: assembly correspondence

Assembly accepts every raw pair and observes the exact resulting word.

Requirement: classification totality

Classification is defined on unrestricted finite byte lists.

Requirement: classification determinism

Classification and complete numeric content share one relation.

Requirement: classification significand digit

Numeric validity exposes the two significand digit lists.

Requirement: rounding totality

Rounding is defined on the full nonnegative-real domain.

Requirement: rounding determinism

Targets are exact raw binary64 magnitude words.

Requirement: exponent value agreement

Mathematical and accumulated explicit exponents remain distinct fields.

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": "DecimalGoalVocabulary",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "5601e4b8972898f281d0342a7ec52725dc401cb4f6791d2ebbedfd0b5f47a17a",
  "active_statement_hash": "a980a77f6202d8b6641c6c672d63ec493e14295fdbdf5942b636290e1c1d5881",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "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-18",
  "boundary_theorems": {},
  "strict_theorem_deps": {},
  "strict_definition_deps": {
    "DecimalLexeme": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2"
  }
}
Prose assessment
{
  "label": "Prose review has no verdict in this snapshot",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "preservation-v1:d63b27cd78c64f8397679df368ad7520a8585220f4c0d6e936de5cd0d2a0aaa7",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}