P347_T1_UnsignedSpecialRejection

Lean checked

Statement

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

Lemma

For every model byte slice s and Boolean kind n, if DecimalGoalVocabularyDefault's special-literal predicate holds for its bytes with sign none and kind n, then the extracted parse_number(s) returns normally with None. Thus every complete unsigned case-insensitive inf, infinity, or nan spelling is normally rejected by the numeric helper.

Lean statement

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

import Tablet.P347_T1_UnsignedSpecialShape
import Tablet.P347_T1_NonDigitNumberRejection

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P347_T1_UnsignedSpecialRejection]
theorem P347_T1_UnsignedSpecialRejection
    (s : Slice Std.U8) (nan : Bool)
    (h : DecimalGoalVocabularyDefault.specialLiteral
      (DecimalGoalVocabularyDefault.bytes s) none nan) :
    num.imp.dec2flt.parse.parse_number s = ok none := by
Proof

Natural-language proof

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.

Proof

By UnsignedSpecialShape, the slice has length three or eight and decomposes as a::T, with the head value in \{73,78,105,110\}. Both possible lengths are at most 2^{63}-1. Every value in the head set exceeds 57, and none equals 46. Hence the head is neither an ASCII digit nor a decimal point; scalar value injectivity also gives a\ne\texttt{46\#u8}. Apply NonDigitNumberRejection with this decomposition, length bound, and the two head facts. Its parse_number conclusion is exactly the required normal None result, including the length-eight alternative. No platform-width assumption is used.

Lean proof


  obtain ⟨hlen, a, tail, hs, ha⟩ := P347_T1_UnsignedSpecialShape s nan h
  have hdigit : Not (48 <= a.val /\ a.val <= 57) := by omega
  have hdot : a ≠ 46#u8 := by
    intro heq
    have hval := congrArg UScalar.val heq
    simp at hval
    omega
  exact (P347_T1_NonDigitNumberRejection s a tail hs (by omega) hdigit hdot).2

end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.P347_T1_UnsignedSpecialShape
import Tablet.P347_T1_NonDigitNumberRejection

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: P347_T1_UnsignedSpecialRejection]
theorem P347_T1_UnsignedSpecialRejection
    (s : Slice Std.U8) (nan : Bool)
    (h : DecimalGoalVocabularyDefault.specialLiteral
      (DecimalGoalVocabularyDefault.bytes s) none nan) :
    num.imp.dec2flt.parse.parse_number s = ok none := by
-- BODY
  obtain ⟨hlen, a, tail, hs, ha⟩ := P347_T1_UnsignedSpecialShape s nan h
  have hdigit : Not (48 <= a.val /\ a.val <= 57) := by omega
  have hdot : a ≠ 46#u8 := by
    intro heq
    have hval := congrArg UScalar.val heq
    simp at hval
    omega
  exact (P347_T1_NonDigitNumberRejection s a tail hs (by omega) hdigit hdot).2

end dec2flt_model

Proof structure

Follow the declared dependencies to read the supporting statements and proofs.

Explore this dependency tree

Inspect related source (69)
More program dependencies (36)
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
All 57 entries
Technical checking records
Local closure summary
{
  "node": "P347_T1_UnsignedSpecialRejection",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "f6e2ad4dff8e008f64c6b038bb54d0ca40f4d1ddf245a90dd9fb02f88099f92d",
  "active_statement_hash": "0686a90eaa6af70cad42556f6f7f5095f8a720265662ae8c12874a4340b53b08",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "576e6bf9480cfd32f53c309c7ac8fb115c1ba6e413f299ed5ff9fa7c647e6769",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-181",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "P347_T1_NonDigitNumberRejection": "4e0b16cae9c122e8",
    "P347_T1_UnsignedSpecialShape": "414dfcc312f29b3f"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "1696fb9af4405e6e",
    "DecimalGoalVocabularyDefault": "71a18a6c119a3cdc",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2",
    "num_imp_dec2flt_parse_parse_number": "f73f8bc11faa6db3",
    "num_imp_dec2flt_parse_parse_partial_number": "94ed7b2ff71604ef"
  }
}
Prose assessment
{
  "label": "Lean proof closed; predictive prose review no longer required",
  "assessment_status": null,
  "fingerprint_relation": "unknown",
  "assessment_fingerprint": null,
  "current_fingerprint": "sound-v2:a0952289d20b8e7aa82e094f57879281e71537330f461cb2b48515e1d6882dac",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}