ParserTotality__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, the extracted f64 specialization of dec2flt returns normally (its returned Rust result may be either success or a parsing error), and does not panic or diverge.

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.ParserNumericPublicOverflowWitness
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

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserTotality__Refutation]
theorem ParserTotality__Refutation : ¬ (∀ s : Str, DecimalGoalVocabularyDefault.sourceString s ->
      ∃ r, num.imp.dec2flt.dec2flt
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s = ok r) := 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 ParserNumericPublicOverflowWitness, choose the concrete source-valid string s whose bytes are 0., eleven zeroes, 1000000000000000080, and 2147483618 final zeroes. The cited statement gives both sourceString s and
\texttt{dec2flt}(s)=\texttt{fail integerOverflow}. \tag{1}
Suppose the universal totality statement were true. Specializing it to this s and its cited source-validity proof would give some public Rust result r with
\texttt{dec2flt}(s)=\texttt{ok $r$}. \tag{2}
Equations (1) and (2) are impossible because Result.fail and Result.ok are distinct constructors. Hence the universal statement is false, which is its exact negation as stated.

Lean proof


  intro claim
  obtain ⟨s, x, value_shape, size_shape, lexeme_shape, source_ok,
    numeric_ok, rendering_ok, parser_fail⟩ :=
    ParserNumericPublicOverflowWitness
  obtain ⟨r, parser_ok⟩ := claim s source_ok
  rw [parser_fail] at parser_ok
  cases parser_ok

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.ParserNumericPublicOverflowWitness
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

open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false

namespace dec2flt_model

-- [TABLET NODE: ParserTotality__Refutation]
theorem ParserTotality__Refutation : ¬ (∀ s : Str, DecimalGoalVocabularyDefault.sourceString s ->
      ∃ r, num.imp.dec2flt.dec2flt
        F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
        F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64
        F64.Insts.CoreOpsArithNegF64 s = ok r) := by
-- BODY
  intro claim
  obtain ⟨s, x, value_shape, size_shape, lexeme_shape, source_ok,
    numeric_ok, rendering_ok, parser_fail⟩ :=
    ParserNumericPublicOverflowWitness
  obtain ⟨r, parser_ok⟩ := claim s source_ok
  rw [parser_fail] at parser_ok
  cases parser_ok

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 176 entries
Technical checking records
Local closure summary
{
  "node": "ParserTotality__Refutation",
  "closure_version": "patch_c_v1",
  "active_decl_hash": "fc4b074eee0b869e879f5bd15758c42e55fbd39e46353f9ac99fccc949bc4985",
  "active_statement_hash": "3309e631d8ec652b74ac9051b1d80d73ba5e72f1907caca733a844acee3ba828",
  "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-127",
  "boundary_theorems": {},
  "strict_theorem_deps": {
    "ParserNumericPublicOverflowWitness": "6dc6a93068edfd78"
  },
  "strict_definition_deps": {
    "DecimalGoalVocabulary": "1f42f752b5d22513",
    "DecimalGoalVocabularyDefault": "512f8d0aea894250",
    "DecimalLexeme": "c43614ff2149ecf2",
    "F64": "ec4e25fbaf4e11d4",
    "F64_Insts_CoreOpsArithDivF64F64": "dc44e13a99fc6bed",
    "F64_Insts_CoreOpsArithMulF64F64": "1ae1a9021a654abd",
    "F64_Insts_CoreOpsArithNegF64": "2d9be310c546ea2e",
    "F64_Insts_Dec2flt_modelNumImpDec2fltLemireU64": "30963b4ef656cc79",
    "num_float_parse_ParseFloatError": "c43614ff2149ecf2",
    "num_imp_dec2flt_dec2flt": "f9f7d93449a25efa"
  }
}
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:d3938c329b9f53a0056a11815234d0f71e9a2c6c9e6ad28d01a068fcc21fede6",
  "superseded_for_theorem_closure": false
}
Review verdicts
{
  "corr_status": "Pass",
  "substantiveness_status": "Pass"
}