ParserInvalidRejection__Refutation

Lean checked

Statement

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

Theorem

The following result is false: For every source-valid Rust string classified as neither a numeric nor a special literal under the complete-input grammar, the extracted f64 parser returns 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_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_biased_fp_to_float
import Tablet.InvalidOverflowBoundaryWitness

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserInvalidRejection__Refutation]
theorem ParserInvalidRejection__Refutation : Not
  (∀ (s : Aeneas.Std.Str),
    dec2flt_model.DecimalGoalVocabulary.sourceString dec2flt_model.DecimalGoalVocabularyDefault s →
      dec2flt_model.DecimalGoalVocabulary.classifies dec2flt_model.DecimalGoalVocabularyDefault
          (dec2flt_model.DecimalGoalVocabulary.bytes dec2flt_model.DecimalGoalVocabularyDefault s)
          (@Option.none.{0} (Sum.{0, 0} dec2flt_model.DecimalLexeme (Prod.{0, 0} (Option.{0} Bool) Bool))) →
        @Exists.{1} dec2flt_model.num.float_parse.ParseFloatError
          fun (e : dec2flt_model.num.float_parse.ParseFloatError) =>
          @Eq.{1}
            (Aeneas.Std.Result.{0}
              (Aeneas.Std.core.result.Result.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError))
            (@dec2flt_model.num.imp.dec2flt.dec2flt dec2flt_model.F64 Aeneas.Std.U64
              dec2flt_model.F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 dec2flt_model.F64.Insts.CoreOpsArithDivF64F64
              dec2flt_model.F64.Insts.CoreOpsArithMulF64F64 dec2flt_model.F64.Insts.CoreOpsArithNegF64 s)
            (@Aeneas.Std.Result.ok.{0}
              (Aeneas.Std.core.result.Result.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError)
              (@Aeneas.Std.core.result.Result.Err.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError
                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

By InvalidOverflowBoundaryWitness, there is a source-valid Rust string s whose bytes are a point, followed by 9223372036854120450 copies of the ASCII byte for 1, followed by the bytes for e-655359x. The cited theorem states, in particular, all three facts needed here: s satisfies the source-string predicate, the complete-input grammar classifies its bytes as none, and the public extracted binary64 specialization of dec2flt applied to s returns fail integerOverflow.
Suppose, for contradiction, that the displayed universal result were true. Specializing it to this s, and applying its two premises using the source-string and none-classification facts above, would give an error value e such that the same public extracted call returns normally as ok (Err e). Rewriting that equality with the cited concrete failure would equate fail integerOverflow with ok (Err e). These are distinct constructors of the Aeneas Result type, so the equality is impossible. This contradiction proves the exact negation.

Lean proof


  intro hall
  obtain ⟨s, _, _, _, hsource, _, _, _, hclassifies, _, hpublic⟩ :=
    InvalidOverflowBoundaryWitness
  obtain ⟨e, hnormal⟩ := hall s hsource hclassifies
  rw [hpublic] at hnormal
  cases hnormal

Download Lean source · Download TeX source

Complete Lean module
import Tablet.DecimalGoalVocabularyDefault
import Tablet.F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64
import Tablet.F64_Insts_CoreOpsArithDivF64F64
import Tablet.F64_Insts_CoreOpsArithMulF64F64
import Tablet.F64_Insts_CoreOpsArithNegF64
import Tablet.F64_Insts_Dec2flt_modelNumImpTraitsFloatExtU64
import Tablet.num_imp_dec2flt_dec2flt
import Tablet.num_imp_dec2flt_dec2flt_with_trace
import Tablet.num_imp_dec2flt_parse_parse_number
import Tablet.num_imp_dec2flt_parse_parse_inf_nan
import Tablet.num_imp_dec2flt_decimal_Decimal_try_fast_path
import Tablet.num_imp_dec2flt_lemire_compute_float
import Tablet.num_imp_dec2flt_slow_parse_long_mantissa
import Tablet.num_imp_dec2flt_biased_fp_to_float
import Tablet.InvalidOverflowBoundaryWitness

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserInvalidRejection__Refutation]
theorem ParserInvalidRejection__Refutation : Not
  (∀ (s : Aeneas.Std.Str),
    dec2flt_model.DecimalGoalVocabulary.sourceString dec2flt_model.DecimalGoalVocabularyDefault s →
      dec2flt_model.DecimalGoalVocabulary.classifies dec2flt_model.DecimalGoalVocabularyDefault
          (dec2flt_model.DecimalGoalVocabulary.bytes dec2flt_model.DecimalGoalVocabularyDefault s)
          (@Option.none.{0} (Sum.{0, 0} dec2flt_model.DecimalLexeme (Prod.{0, 0} (Option.{0} Bool) Bool))) →
        @Exists.{1} dec2flt_model.num.float_parse.ParseFloatError
          fun (e : dec2flt_model.num.float_parse.ParseFloatError) =>
          @Eq.{1}
            (Aeneas.Std.Result.{0}
              (Aeneas.Std.core.result.Result.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError))
            (@dec2flt_model.num.imp.dec2flt.dec2flt dec2flt_model.F64 Aeneas.Std.U64
              dec2flt_model.F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 dec2flt_model.F64.Insts.CoreOpsArithDivF64F64
              dec2flt_model.F64.Insts.CoreOpsArithMulF64F64 dec2flt_model.F64.Insts.CoreOpsArithNegF64 s)
            (@Aeneas.Std.Result.ok.{0}
              (Aeneas.Std.core.result.Result.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError)
              (@Aeneas.Std.core.result.Result.Err.{0, 0} dec2flt_model.F64 dec2flt_model.num.float_parse.ParseFloatError
                e))) := by
-- BODY
  intro hall
  obtain ⟨s, _, _, _, hsource, _, _, _, hclassifies, _, hpublic⟩ :=
    InvalidOverflowBoundaryWitness
  obtain ⟨e, hnormal⟩ := hall s hsource hclassifies
  rw [hpublic] at hnormal
  cases hnormal

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": "ParserInvalidRejection__Refutation",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "30702cd1facc99c28125e5d2e1d0280144c83cab42c18958a995c39ee557339c",
  "active_statement_hash": "b9636f5db0132f904c9495940ca05f0b0a5d64e787490133800583d3b3adc2c9",
  "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-121",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "InvalidOverflowBoundaryWitness": "7da3742aef5e9c73"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "64f24e4e46904b6a",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "SourceValidByteSlice": "3dc42716a6378d26",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_dec2flt": "f9f7d93449a25efa",
    "num_imp_dec2flt_decimal_Decimal": "c43614ff2149ecf2",
    "num_imp_dec2flt_parse_parse_number": "f73f8bc11faa6db3"
  }
}
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:ea34c96d0c9df3e5f06fb74fc4fb4d97009541e26cb97ad60f9f8f10b12780d0",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}