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 DecimalGoalVocabulary record is a noncomputational vocabulary package. It supplies named fields for observing slice bytes, admitting source strings, stating numeric and special grammar and classification, interpreting explicit exponents and decimal values, relating real magnitudes to binary64 words, observing NaN, infinity, and sign bits, applying a lexical sign, and interpreting raw-pair assembly. The record itself asserts no execution fact: in particular it does not preserve termination, panic versus normal return, the outer Aeneas Result versus the returned Rust Result, Option/Result discriminants, returned Decimal fields, selected-pair trace state, component compliance, deferral, or the behavior of any extracted call.

Proof

This is exactly the information in the record signature: every member is a function or relation with one of the named carriers, and there are no laws, call equations, or control-flow fields. In Aeneas, Str is definitionally Slice U8, so those carrier types alone do not distinguish Rust strings from byte slices. The sourceString field receives its concrete length-bounded UTF-8 meaning only in DecimalGoalVocabularyDefault; the complete arbitrary-byte Rust &[u8] carrier is instead identified by the separate SourceValidByteSlice definition. The bytes field is total on every model slice and carries no source-length premise. Likewise, classifies accepts every finite natural-number list and roundsMagnitude accepts every real input. Thus the purely mathematical list and real relations are not restricted to source-representable inputs. Concrete grammar, value, rounding, word, sign, and assembly meanings are supplied by DecimalGoalVocabularyDefault, not by an execution claim in this record.

Requirement: parser totality

This node contributes only the sourceString predicate for the parser's source domain. Termination, panic versus normal return, and the distinction between the outer Aeneas result and returned Rust result belong to the source-model and operation-preservation owners.

Requirement: parser numeric acceptance

This node contributes sourceString, bytes, validNumeric, and renderNumeric to state the source domain and numeric grammar. Normal return and the returned Ok discriminant are left to the parser-operation owner.

Requirement: parser invalid rejection

This node contributes sourceString, bytes, and classifies to state complete-input invalidity. It makes no claim that the parser returns normally or returns Err; those are parser-operation facts.

Requirement: parser nan acceptance

This node contributes sourceString, bytes, specialLiteral, and isNan for NaN grammar and the word predicate. Acceptance, normal return, and Ok are left to the parser-operation owner.

Requirement: parser infinity

This node contributes sourceString, bytes, specialLiteral, and isInfinity for signed infinity grammar and words. It does not assert a normal or successful parser return.

Requirement: parser non nan results

This node contributes sourceString, bytes, specialLiteral, and isNan to state the input exclusion and output-word observation. The implication from a successful extracted return to a non-NaN word is left to parser preservation.

Requirement: parser numeric sign

This node contributes sourceString, the numeric grammar fields, lexicalNegative, and signedMagnitude. It does not assert that parsing succeeds or that an extracted return satisfies the sign relation.

Requirement: parser signed zero

This node contributes sourceString, the numeric grammar fields, exactMagnitude, lexicalNegative, and signedMagnitude to express zero and its lexical sign. Acceptance and the returned word remain parser-operation facts.

Requirement: parser exact rounding

This node contributes sourceString, the numeric grammar fields, exactMagnitude, roundsMagnitude, lexicalNegative, and signedMagnitude. It does not infer acceptance or connect an extracted return to those relations.

Requirement: parser selected exponent

This node contributes only sourceString to this parser goal; it has no trace-selection or biased-exponent-range field. Normal success, selection of a raw pair, and its exponent bound belong to the traced source model and operation-preservation owners.

Requirement: parser selected magnitude sign

This node contributes sourceString and assembledWord to interpret a supplied raw pair and word. It does not establish successful execution, trace selection, or the selected word's clear sign bit.

Requirement: dispatch abstract composition

This node supplies the source-string, byte, classification, value, rounding, special-word, and lexical-sign vocabulary used to state the abstract contracts. Existence of contract implementations, dispatcher flow, branch behavior, and normal results are left to the contract and dispatcher owners.

Requirement: dispatch component compliance

This node supplies only the vocabulary used for source strings, bytes, grammar, values, word observations, signing, and assembly; SourceValidByteSlice separately supplies the exact Rust slice domain. Extracted-call agreement, component compliance, call-site preconditions, results, and trace state are left to their source-model and operation-preservation owners.

Requirement: parser accumulated rounding

This node contributes sourceString, the numeric grammar fields, accumulatedMagnitude, roundsMagnitude, lexicalNegative, and signedMagnitude. Acceptance and the relation of an extracted return to those fields remain parser-operation facts.

Requirement: parser equal target rounding

This node contributes sourceString, the numeric grammar fields, both magnitude interpretations, roundsMagnitude, lexicalNegative, and signedMagnitude. It neither asserts acceptance nor proves that a returned word is the common target.

Requirement: number helper acceptance

SourceValidByteSlice supplies the exact arbitrary-byte Rust slice domain. This node contributes only bytes, validNumeric, and renderNumeric for the unsigned numeric grammar; normal return and Some are left to the numeric-helper operation owner.

Requirement: number helper rejection

SourceValidByteSlice supplies the exact arbitrary-byte Rust slice domain without UTF-8. This node contributes only bytes, validNumeric, and renderNumeric to state failure of the unsigned grammar, not the helper's normal return or None.

Requirement: number helper record bounds

SourceValidByteSlice supplies the exact Rust slice domain, and this node contributes only its total bytes observation. Returned-record fields, the Some discriminant, normal return, negativity, and the mantissa bound are not fields or consequences of this vocabulary record.

Requirement: number helper accumulated value

SourceValidByteSlice supplies the exact Rust slice domain. This node contributes bytes, the unsigned numeric grammar, accumulatedMagnitude, and decimalMagnitude; the optional return and its record/value relationship belong to numeric-helper preservation.

Requirement: special helper infinity

SourceValidByteSlice identifies the exact arbitrary-byte Rust slice carrier. This node contributes only bytes, specialLiteral, and isInfinity; normal return, Some, and the helper's use of the separate sign argument are operation facts.

Requirement: special helper nan

SourceValidByteSlice identifies the exact arbitrary-byte Rust slice carrier. This node contributes only bytes, specialLiteral, and isNan; normal return and Some are left to special-helper preservation.

Requirement: special helper rejection

SourceValidByteSlice supplies the exact Rust slice domain without a UTF-8 premise. This node contributes only bytes and specialLiteral for the keyword grammar; normal return and None remain special-helper operation facts.

Requirement: native correct or defer

This node contributes only decimalMagnitude, roundsMagnitude, and signedMagnitude to express the record value, target, and sign. Normal return, None/Some, many_digits, and both native paths belong to native-operation preservation.

Requirement: integer correct or defer

This node contributes only roundsMagnitude and assembledWord to interpret a real target and a supplied raw pair. It does not preserve normal return, deferral, or production of that pair by the integer operation.

Requirement: slow accumulated rounding

SourceValidByteSlice supplies the exact Rust slice domain. This node contributes the byte and unsigned-grammar vocabulary together with accumulatedMagnitude, roundsMagnitude, and assembledWord; normal return and production of a raw pair are left to slow-operation preservation.

Requirement: assembly correspondence

This node contributes only assembledWord as the relation between an unrestricted supplied raw pair and a word. Normal return and agreement of the extracted assembly call with that relation belong to assembly-operation preservation.

Requirement: classification totality

The classifies field has the unrestricted finite-list domain required by this mathematical goal, independently of Rust length or UTF-8 validity. Merely supplying that relation does not prove that every byte list has a classification.

Requirement: classification determinism

The same unrestricted classifies relation records complete numeric content on finite byte lists. This vocabulary contribution does not prove uniqueness of classifications or parsed lexemes.

Requirement: classification significand digit

The unrestricted classifies and validNumeric fields provide the mathematical grammar vocabulary for significand digits. This node does not prove the claimed digit-existence theorem.

Requirement: rounding totality

The roundsMagnitude field is a relation on unrestricted real inputs and binary64 words, with no source-domain bound. Supplying the relation does not prove that a target exists for every nonnegative real.

Requirement: rounding determinism

The roundsMagnitude field supplies one unrestricted real-to-word relation for both target hypotheses. This vocabulary record does not prove uniqueness of the targets.

Requirement: exponent value agreement

The mathematical and accumulated explicit exponents, their two magnitude interpretations, and roundsMagnitude are separate unrestricted mathematical fields. This node does not prove that equality of exponents yields agreement of rounding targets.

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-13",
  "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": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "preservation-v1:4733cb7e92789f17477cf518ee1e5a6d85c8dfd98984b462ea6c73537ede06a2",
  "current_fingerprint": "preservation-v1:4733cb7e92789f17477cf518ee1e5a6d85c8dfd98984b462ea6c73537ede06a2",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}