ParserInvalidRejectionSafeLength

Lean checked

Statement

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

Theorem · Public invalid rejection through the sharp safe length

Every source-valid Rust string of length at most 9223372036854120459 that is classified as neither a complete numeric nor a complete special literal makes the extracted public f64 parser return normally with Err.

Lean statement

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

import Tablet.DecimalGoalVocabularyDefault
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.ModelSliceFirst
import Tablet.ModelStrAsBytes
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.NumberHelperRejectionSafeLength
import Tablet.ParserSpecialRejectionSafeLength
import Tablet.SourceValidByteSlice
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_pfe_empty
import Tablet.num_imp_dec2flt_pfe_invalid

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserInvalidRejectionSafeLength]
theorem ParserInvalidRejectionSafeLength :
    forall s : Str,
      DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 9223372036854120459 ->
      DecimalGoalVocabularyDefault.classifies
        (DecimalGoalVocabularyDefault.bytes s) none ->
      exists e,
        num.imp.dec2flt.dec2flt
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          F64.Insts.CoreOpsArithDivF64F64
          F64.Insts.CoreOpsArithMulF64F64
          F64.Insts.CoreOpsArithNegF64 s =
            ok (core.result.Result.Err e) := 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

Let s satisfy the hypotheses and let L be its byte length. By ModelStrAsBytes, the first bind of num imp dec2flt dec2flt with trace returns the identical complete byte slice. Unfolding the none clause of DecimalGoalVocabularyDefault, the classification hypothesis gives both absence of a complete numeric lexeme and absence of a complete signed special literal.
By ModelSliceFirst, an empty input selects the empty-input branch. The definition num imp dec2flt pfe empty returns normally with its error record, and the traced dispatcher returns Err of that record. Assume henceforth that the input is nonempty and call its first byte c. The dispatcher removes exactly one byte when c is ASCII minus or plus, and otherwise leaves the body unchanged. If this body is empty, the input was a sign alone; num imp dec2flt pfe invalid constructs its invalid-error record normally and the sign-only branch returns Err. We may therefore also assume that the body is nonempty.
The body is a suffix of the original byte slice, so its length is at most L\leq9223372036854120459 and hence it satisfies SourceValidByteSlice. It is not a complete unsigned numeric literal. Indeed, suppose an unsigned valid lexeme rendered the body. If c was minus or plus, replacing that lexeme's absent leading sign by the corresponding sign value preserves every clause of validNumeric, and its rendering is the removed sign byte followed by the body, namely all bytes of s. If c was not a sign, the body is all of s and the unsigned lexeme already renders it. Either case supplies a complete numeric witness forbidden by the classification hypothesis. All premises of NumberHelperRejectionSafeLength now hold, so parse_number returns ok none on the body.
We next check the special helper rather than assuming its rejection. Unfold num imp dec2flt parse parse inf nan. At lengths other than three and eight it returns ok none immediately. At length eight, the exact-length guard makes the read in SliceU8 Insts Dec2flt modelNumImpDec2fltCommonByteSlice read u64 safe. The mask \mathtt{0xdfdfdfdfdfdfdfdf} clears exactly the ASCII case bit in each byte, by ModelU64BitAnd. Its only successful eight-byte match is therefore a case variant of infinity; the other displayed constants return none. At length three, all three indices are in bounds. The casts are widening, the shift counts eight and sixteen are below 64 by ModelU64Shl, and the two operations from ModelU64BitOr assemble the bytes in little-endian order. Applying the same case-bit mask shows that the two successful constants are exactly case variants of inf and nan. Thus a some result from the helper would mean that the unsigned body is one of precisely those three case-insensitive keywords.
If such a keyword match existed, prepend a special sign value of some true when the removed byte was minus, some false when it was plus, and none when no byte was removed. Together with the helper's infinity-versus-NaN match, this is exactly a specialLiteral witness for the complete original bytes under DecimalGoalVocabularyDefault. The invalid classification forbids that witness. Hence the special helper takes no successful match and returns ok none; no infinity, NaN, or negation operation is reached.
The two established helper results put the traced dispatcher in its invalid branch. There num imp dec2flt pfe invalid returns the error record normally, and num imp dec2flt dec2flt with trace returns ok of Err of that record paired with its invalid trace. Finally, num imp dec2flt dec2flt binds this normal traced result and projects the first component, preserving the same Err. Taking the constructed empty-input or invalid-input record as e in the corresponding case proves the existential conclusion.

Lean proof


  intro s hsource hlen hclass
  dsimp [DecimalGoalVocabularyDefault] at hsource hclass
  rcases hclass with ⟨hnum, hspecial⟩
  rcases s with ⟨xs, hbound⟩
  cases xs with
  | nil =>
      refine ⟨{ kind := num.float_parse.FloatErrorKind.Empty }, ?_⟩
      simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
        core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
        ModelSliceFirst, num.imp.dec2flt.pfe_empty]
  | cons a tail =>
      by_cases hminus : a = 45#u8
      · subst a
        cases tail with
        | nil =>
            refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
            simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
              core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
              ModelSliceFirst,
              core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, num.imp.dec2flt.pfe_invalid]
        | cons b rest =>
            have bodyBound : (b :: rest).length ≤ Usize.max := by scalar_tac
            let body : Slice Std.U8 := ⟨b :: rest, bodyBound⟩
            have bodyValid : SourceValidByteSlice body := by
              have hslen := hsource.1
              simp at hslen
              simp [SourceValidByteSlice, body]
              omega
            have bodyLength : body.val.length ≤ 9223372036854120459 := by
              simp [body] at ⊢
              simp at hlen
              omega
            have noNumeric : ¬ ∃ x : DecimalLexeme,
                x.leadingSign = none ∧
                DecimalGoalVocabularyDefault.validNumeric x ∧
                DecimalGoalVocabularyDefault.bytes body =
                  DecimalGoalVocabularyDefault.renderNumeric x := by
              rintro ⟨x, hxsign, hxvalid, hxrender⟩
              apply hnum
              let y : DecimalLexeme := { x with leadingSign := some true }
              refine ⟨y, ?_, ?_⟩
              · simpa [DecimalGoalVocabularyDefault, y] using hxvalid
              · dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
                simpa [y, hxsign] using hxrender.symm
            have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
                (DecimalGoalVocabularyDefault.bytes body) none false := by
              intro hbody
              apply hspecial
              refine ⟨some true, false, ?_⟩
              dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
              rcases hbody with ⟨word, hword, hcase⟩
              refine ⟨word, ?_, hcase⟩
              simpa using hword
            have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
                (DecimalGoalVocabularyDefault.bytes body) none true := by
              intro hbody
              apply hspecial
              refine ⟨some true, true, ?_⟩
              dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
              rcases hbody with ⟨word, hword, hcase⟩
              refine ⟨word, ?_, hcase⟩
              simpa using hword
            have numberResult := NumberHelperRejectionSafeLength body bodyValid
              (by simp [body]) bodyLength noNumeric
            have specialResult := ParserSpecialRejectionSafeLength body true noInf noNan
            refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
            simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
              core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
              ModelSliceFirst,
              core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, body, numberResult, specialResult,
              num.imp.dec2flt.pfe_invalid]
      · by_cases hplus : a = 43#u8
        · subst a
          cases tail with
          | nil =>
              refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
              simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
                core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
                ModelSliceFirst,
                core.slice.index.SliceIndexRangeFromUsizeSlice.index,
                Slice.drop, num.imp.dec2flt.pfe_invalid]
          | cons b rest =>
              have bodyBound : (b :: rest).length ≤ Usize.max := by scalar_tac
              let body : Slice Std.U8 := ⟨b :: rest, bodyBound⟩
              have bodyValid : SourceValidByteSlice body := by
                have hslen := hsource.1
                simp at hslen
                simp [SourceValidByteSlice, body]
                omega
              have bodyLength : body.val.length ≤ 9223372036854120459 := by
                simp [body] at ⊢
                simp at hlen
                omega
              have noNumeric : ¬ ∃ x : DecimalLexeme,
                  x.leadingSign = none ∧
                  DecimalGoalVocabularyDefault.validNumeric x ∧
                  DecimalGoalVocabularyDefault.bytes body =
                    DecimalGoalVocabularyDefault.renderNumeric x := by
                rintro ⟨x, hxsign, hxvalid, hxrender⟩
                apply hnum
                let y : DecimalLexeme := { x with leadingSign := some false }
                refine ⟨y, ?_, ?_⟩
                · simpa [DecimalGoalVocabularyDefault, y] using hxvalid
                · dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
                  simpa [y, hxsign] using hxrender.symm
              have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
                  (DecimalGoalVocabularyDefault.bytes body) none false := by
                intro hbody
                apply hspecial
                refine ⟨some false, false, ?_⟩
                dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
                rcases hbody with ⟨word, hword, hcase⟩
                refine ⟨word, ?_, hcase⟩
                simpa using hword
              have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
                  (DecimalGoalVocabularyDefault.bytes body) none true := by
                intro hbody
                apply hspecial
                refine ⟨some false, true, ?_⟩
                dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
                rcases hbody with ⟨word, hword, hcase⟩
                refine ⟨word, ?_, hcase⟩
                simpa using hword
              have numberResult := NumberHelperRejectionSafeLength body bodyValid
                (by simp [body]) bodyLength noNumeric
              have specialResult := ParserSpecialRejectionSafeLength body false noInf noNan
              refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
              simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
                core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
                ModelSliceFirst,
                core.slice.index.SliceIndexRangeFromUsizeSlice.index,
                Slice.drop, body, numberResult, specialResult,
                num.imp.dec2flt.pfe_invalid]
        · let body : Slice Std.U8 := ⟨a :: tail, hbound⟩
          have bodyValid : SourceValidByteSlice body := by
            simpa [SourceValidByteSlice, body] using hsource.1
          have bodyLength : body.val.length ≤ 9223372036854120459 := by
            simpa [body] using hlen
          have noNumeric : ¬ ∃ x : DecimalLexeme,
              x.leadingSign = none ∧
              DecimalGoalVocabularyDefault.validNumeric x ∧
              DecimalGoalVocabularyDefault.bytes body =
                DecimalGoalVocabularyDefault.renderNumeric x := by
            rintro ⟨x, hxsign, hxvalid, hxrender⟩
            apply hnum
            refine ⟨x, hxvalid, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
            simpa [hxsign] using hxrender.symm
          have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
              (DecimalGoalVocabularyDefault.bytes body) none false := by
            intro hbody
            apply hspecial
            refine ⟨none, false, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
            exact hbody
          have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
              (DecimalGoalVocabularyDefault.bytes body) none true := by
            intro hbody
            apply hspecial
            refine ⟨none, true, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
            exact hbody
          have numberResult := NumberHelperRejectionSafeLength body bodyValid
            (by simp [body]) bodyLength noNumeric
          have specialResult := ParserSpecialRejectionSafeLength body false noInf noNan
          refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
          simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
            core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
            ModelSliceFirst, body, numberResult, specialResult,
            num.imp.dec2flt.pfe_invalid, hminus, hplus]


end dec2flt_model

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.ModelSliceFirst
import Tablet.ModelStrAsBytes
import Tablet.ModelU64BitAnd
import Tablet.ModelU64BitOr
import Tablet.ModelU64Shl
import Tablet.NumberHelperRejectionSafeLength
import Tablet.ParserSpecialRejectionSafeLength
import Tablet.SourceValidByteSlice
import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_pfe_empty
import Tablet.num_imp_dec2flt_pfe_invalid

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserInvalidRejectionSafeLength]
theorem ParserInvalidRejectionSafeLength :
    forall s : Str,
      DecimalGoalVocabularyDefault.sourceString s ->
      s.val.length <= 9223372036854120459 ->
      DecimalGoalVocabularyDefault.classifies
        (DecimalGoalVocabularyDefault.bytes s) none ->
      exists e,
        num.imp.dec2flt.dec2flt
          F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
          F64.Insts.CoreOpsArithDivF64F64
          F64.Insts.CoreOpsArithMulF64F64
          F64.Insts.CoreOpsArithNegF64 s =
            ok (core.result.Result.Err e) := by
-- BODY
  intro s hsource hlen hclass
  dsimp [DecimalGoalVocabularyDefault] at hsource hclass
  rcases hclass with ⟨hnum, hspecial⟩
  rcases s with ⟨xs, hbound⟩
  cases xs with
  | nil =>
      refine ⟨{ kind := num.float_parse.FloatErrorKind.Empty }, ?_⟩
      simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
        core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
        ModelSliceFirst, num.imp.dec2flt.pfe_empty]
  | cons a tail =>
      by_cases hminus : a = 45#u8
      · subst a
        cases tail with
        | nil =>
            refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
            simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
              core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
              ModelSliceFirst,
              core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, num.imp.dec2flt.pfe_invalid]
        | cons b rest =>
            have bodyBound : (b :: rest).length ≤ Usize.max := by scalar_tac
            let body : Slice Std.U8 := ⟨b :: rest, bodyBound⟩
            have bodyValid : SourceValidByteSlice body := by
              have hslen := hsource.1
              simp at hslen
              simp [SourceValidByteSlice, body]
              omega
            have bodyLength : body.val.length ≤ 9223372036854120459 := by
              simp [body] at ⊢
              simp at hlen
              omega
            have noNumeric : ¬ ∃ x : DecimalLexeme,
                x.leadingSign = none ∧
                DecimalGoalVocabularyDefault.validNumeric x ∧
                DecimalGoalVocabularyDefault.bytes body =
                  DecimalGoalVocabularyDefault.renderNumeric x := by
              rintro ⟨x, hxsign, hxvalid, hxrender⟩
              apply hnum
              let y : DecimalLexeme := { x with leadingSign := some true }
              refine ⟨y, ?_, ?_⟩
              · simpa [DecimalGoalVocabularyDefault, y] using hxvalid
              · dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
                simpa [y, hxsign] using hxrender.symm
            have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
                (DecimalGoalVocabularyDefault.bytes body) none false := by
              intro hbody
              apply hspecial
              refine ⟨some true, false, ?_⟩
              dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
              rcases hbody with ⟨word, hword, hcase⟩
              refine ⟨word, ?_, hcase⟩
              simpa using hword
            have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
                (DecimalGoalVocabularyDefault.bytes body) none true := by
              intro hbody
              apply hspecial
              refine ⟨some true, true, ?_⟩
              dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
              rcases hbody with ⟨word, hword, hcase⟩
              refine ⟨word, ?_, hcase⟩
              simpa using hword
            have numberResult := NumberHelperRejectionSafeLength body bodyValid
              (by simp [body]) bodyLength noNumeric
            have specialResult := ParserSpecialRejectionSafeLength body true noInf noNan
            refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
            simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
              core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
              ModelSliceFirst,
              core.slice.index.SliceIndexRangeFromUsizeSlice.index,
              Slice.drop, body, numberResult, specialResult,
              num.imp.dec2flt.pfe_invalid]
      · by_cases hplus : a = 43#u8
        · subst a
          cases tail with
          | nil =>
              refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
              simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
                core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
                ModelSliceFirst,
                core.slice.index.SliceIndexRangeFromUsizeSlice.index,
                Slice.drop, num.imp.dec2flt.pfe_invalid]
          | cons b rest =>
              have bodyBound : (b :: rest).length ≤ Usize.max := by scalar_tac
              let body : Slice Std.U8 := ⟨b :: rest, bodyBound⟩
              have bodyValid : SourceValidByteSlice body := by
                have hslen := hsource.1
                simp at hslen
                simp [SourceValidByteSlice, body]
                omega
              have bodyLength : body.val.length ≤ 9223372036854120459 := by
                simp [body] at ⊢
                simp at hlen
                omega
              have noNumeric : ¬ ∃ x : DecimalLexeme,
                  x.leadingSign = none ∧
                  DecimalGoalVocabularyDefault.validNumeric x ∧
                  DecimalGoalVocabularyDefault.bytes body =
                    DecimalGoalVocabularyDefault.renderNumeric x := by
                rintro ⟨x, hxsign, hxvalid, hxrender⟩
                apply hnum
                let y : DecimalLexeme := { x with leadingSign := some false }
                refine ⟨y, ?_, ?_⟩
                · simpa [DecimalGoalVocabularyDefault, y] using hxvalid
                · dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
                  simpa [y, hxsign] using hxrender.symm
              have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
                  (DecimalGoalVocabularyDefault.bytes body) none false := by
                intro hbody
                apply hspecial
                refine ⟨some false, false, ?_⟩
                dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
                rcases hbody with ⟨word, hword, hcase⟩
                refine ⟨word, ?_, hcase⟩
                simpa using hword
              have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
                  (DecimalGoalVocabularyDefault.bytes body) none true := by
                intro hbody
                apply hspecial
                refine ⟨some false, true, ?_⟩
                dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
                rcases hbody with ⟨word, hword, hcase⟩
                refine ⟨word, ?_, hcase⟩
                simpa using hword
              have numberResult := NumberHelperRejectionSafeLength body bodyValid
                (by simp [body]) bodyLength noNumeric
              have specialResult := ParserSpecialRejectionSafeLength body false noInf noNan
              refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
              simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
                core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
                ModelSliceFirst,
                core.slice.index.SliceIndexRangeFromUsizeSlice.index,
                Slice.drop, body, numberResult, specialResult,
                num.imp.dec2flt.pfe_invalid]
        · let body : Slice Std.U8 := ⟨a :: tail, hbound⟩
          have bodyValid : SourceValidByteSlice body := by
            simpa [SourceValidByteSlice, body] using hsource.1
          have bodyLength : body.val.length ≤ 9223372036854120459 := by
            simpa [body] using hlen
          have noNumeric : ¬ ∃ x : DecimalLexeme,
              x.leadingSign = none ∧
              DecimalGoalVocabularyDefault.validNumeric x ∧
              DecimalGoalVocabularyDefault.bytes body =
                DecimalGoalVocabularyDefault.renderNumeric x := by
            rintro ⟨x, hxsign, hxvalid, hxrender⟩
            apply hnum
            refine ⟨x, hxvalid, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hxrender ⊢
            simpa [hxsign] using hxrender.symm
          have noInf : ¬ DecimalGoalVocabularyDefault.specialLiteral
              (DecimalGoalVocabularyDefault.bytes body) none false := by
            intro hbody
            apply hspecial
            refine ⟨none, false, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
            exact hbody
          have noNan : ¬ DecimalGoalVocabularyDefault.specialLiteral
              (DecimalGoalVocabularyDefault.bytes body) none true := by
            intro hbody
            apply hspecial
            refine ⟨none, true, ?_⟩
            dsimp [DecimalGoalVocabularyDefault, body] at hbody ⊢
            exact hbody
          have numberResult := NumberHelperRejectionSafeLength body bodyValid
            (by simp [body]) bodyLength noNumeric
          have specialResult := ParserSpecialRejectionSafeLength body false noInf noNan
          refine ⟨{ kind := num.float_parse.FloatErrorKind.Invalid }, ?_⟩
          simp [num.imp.dec2flt.dec2flt, num.imp.dec2flt.dec2flt_with_trace,
            core.str.Str.as_bytes, core.slice.Slice.first, ModelStrAsBytes,
            ModelSliceFirst, body, numberResult, specialResult,
            num.imp.dec2flt.pfe_invalid, hminus, hplus]


end dec2flt_model

Proof structure

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

Explore this dependency tree

Inspect related source (201)
More program dependencies (159)
Standard-library dependencies (39)

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 166 entries
Technical checking records
Local closure summary
{
  "node": "ParserInvalidRejectionSafeLength",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "fd7fd3a99fd68fdaf7370486c1f66d013db2023ff8447e922a975f2b73c2fba9",
  "active_statement_hash": "e9f48051fd7dbcaa8cc904ba2bbecbcb776af845a1752ab5486d2f8d7b07de13",
  "kernel_axioms": [
    "Classical.choice",
    "Quot.sound",
    "propext"
  ],
  "toolchain_hash": "ce4c4e3d87434b9663f46de25ce34b48a0cf0d392e0a320a0787b4674a2d7b61",
  "lean_executable_hash": "3e0d0d3d801675359f2d4cf9815bfdb417b20b92fdd9d48b3b14c95bbae28bbf",
  "checker_script_hash": "c8e4a03273e23b9a8f2e141020652a4e0b7b0a8ab0883366ea9d031ca3f37aa1",
  "approved_axioms_hash": "ab64d13f256386ee0e494a5abcc6a5db49512cf3d90bbdfcabd6327793a31f95",
  "axcheck_status": "Agreed",
  "accepted_at_snapshot_id": "worker-result-local-closure-issuance-cycle-117",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "DecimalGoalVocabularyDefault": "2bbf2be48b5a4a4b",
    "NumberHelperPartialNumberSafeLength": "4dbd872ba02a631e",
    "NumberHelperRejectionSafeLength": "6080db0f121f1be2",
    "ParserSpecialRejectionSafeLength": "1edbaca00e34bed4",
    "num_imp_dec2flt_dec2flt_with_trace": "f3e7d4ffbf9b4d68",
    "num_imp_traits_Float_SIG_BITS_default": "9ab622d85ef04d94"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "c08dd4b4aea4abb4",
    "DecimalGoalVocabularyDefault": "f230c9551c8d76e0",
    "DecimalLexeme": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64": "60afe26c6a80cf0f",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64": "94095c9bf79da164",
    "F64_Insts_Dec2flt_modelNumImpTraitsFloatU64_SIG_TOTAL_BITS": "887b52d84a3fc9c4",
    "ModelSliceFirst": "a31394b3c1080f71",
    "ModelStrAsBytes": "024fe35b4dbfa9a3",
    "Preamble": "5575719dcb1443eb",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "core_ops_arith_Div": "6e5df64b87169aa0",
    "core_ops_arith_Mul": "6e5df64b87169aa0",
    "core_ops_arith_Neg": "0ff07135a60bcbf9",
    "num_float_parse_FloatErrorKind": "20698e72f41a7333",
    "num_float_parse_ParseFloatError": "50fdc93f3a82a17e",
    "num_imp_dec2flt_Dec2FltAssemblyTrace": "7bda5de02611ad76",
    "num_imp_dec2flt_Dec2FltTrace": "51a72ca46ca811cd",
    "num_imp_dec2flt_Lemire": "1923f90c53d323e6",
    "num_imp_dec2flt_biased_fp_to_float": "acdde060e8d35ca7",
    "num_imp_dec2flt_common_BiasedFp": "c43614ff2149ecf2",
    "num_imp_dec2flt_common_BiasedFp_Insts_CoreCmpPartialEqBiasedFp_eq": "fbbf553e3c502a05",
    "num_imp_dec2flt_dec2flt": "f9f7d93449a25efa",
    "num_imp_dec2flt_dec2flt_with_trace": "ebe6a57c6dce0df6",
    "num_imp_dec2flt_decimal_Decimal": "fe99f3f976739f2d",
    "num_imp_dec2flt_decimal_Decimal_try_fast_path": "2e4888f65a06b49f",
    "num_imp_dec2flt_lemire_compute_float": "39d89e3f0a8a9d4c",
    "num_imp_dec2flt_parse_parse_inf_nan": "85655c19a8791b54",
    "num_imp_dec2flt_parse_parse_number": "f73f8bc11faa6db3",
    "num_imp_dec2flt_pfe_empty": "89046d1da5ac1ce2",
    "num_imp_dec2flt_pfe_invalid": "21db875427d92c6d",
    "num_imp_dec2flt_slow_parse_long_mantissa": "cd8af64c3688b60f",
    "num_imp_traits_Float": "02acccb9db3e30f2",
    "num_imp_traits_FloatExt": "f996e5400649797d"
  }
}
Prose assessment
{
  "label": "Recorded Sound: VerifierPass",
  "assessment_status": "VerifierPass",
  "fingerprint_relation": "matches current fingerprint",
  "assessment_fingerprint": "sound-v2:362a29cf27593344dea6b341240173ca99670eff3e1f056fe95ba0171b2fe23b",
  "current_fingerprint": "sound-v2:362a29cf27593344dea6b341240173ca99670eff3e1f056fe95ba0171b2fe23b",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "sound_status": "Pass",
  "substantiveness_status": "Pass"
}