import Tablet.DecimalGoalVocabularyDefault import Tablet.DispatchContracts import Tablet.DispatchContractsUninhabited import Tablet.SourceValidByteSlice 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 open Aeneas Aeneas.Std Result ControlFlow Error set_option autoImplicit false namespace dec2flt_model -- [TABLET NODE: DispatchComponentCompliance__Refutation] theorem DispatchComponentCompliance__Refutation : ¬ (∃ C : DispatchContracts, (∀ (s : Slice Std.U8), SourceValidByteSlice s -> s.val ≠ [] -> ∃ out, num.imp.dec2flt.parse.parse_number s = ok out ∧ C.parseNumber (DecimalGoalVocabularyDefault.bytes s) = out) ∧ (∀ (s : Slice Std.U8) negative, SourceValidByteSlice s -> ∃ out, num.imp.dec2flt.parse.parse_inf_nan F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 s negative = ok out ∧ C.parseSpecial (DecimalGoalVocabularyDefault.bytes s) negative = out) ∧ (∀ d out, num.imp.dec2flt.decimal.Decimal.try_fast_path F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64 F64.Insts.CoreOpsArithNegF64 d = ok out -> C.native d = out) ∧ (∀ q w fp, num.imp.dec2flt.lemire.compute_float F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 q w = ok fp -> C.integer q w = fp) ∧ (∀ (body : Slice Std.U8) x, SourceValidByteSlice body -> x.leadingSign = none -> DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes body -> ∃ fp, num.imp.dec2flt.slow.parse_long_mantissa F64.Insts.Dec2flt_modelNumImpTraitsFloatU64 body = ok fp ∧ C.slow (DecimalGoalVocabularyDefault.bytes body) = fp) ∧ (∀ fp f, num.imp.dec2flt.biased_fp_to_float F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64 fp = ok f -> C.assemble fp = f) ∧ (∀ magnitude result, F64.Insts.CoreOpsArithNegF64.neg magnitude = ok result -> C.applySign true magnitude = result) ∧ (∀ magnitude, C.applySign false magnitude = magnitude) ∧ (∀ a b equal, num.imp.dec2flt.common.BiasedFp.Insts.CoreCmpPartialEqBiasedFp.eq a b = ok equal -> C.samePair a b = equal) ∧ ∀ (s : Str) r (tr : num.imp.dec2flt.Dec2FltTrace F64), DecimalGoalVocabularyDefault.sourceString s -> num.imp.dec2flt.dec2flt_with_trace F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64 F64.Insts.CoreOpsArithNegF64 s = ok (r, tr) -> num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64 F64.Insts.CoreOpsArithNegF64 s = ok r ∧ match tr with | num.imp.dec2flt.Dec2FltTrace.EmptyInput => DecimalGoalVocabularyDefault.bytes s = [] ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = none ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) none ∧ ∃ e, r = core.result.Result.Err e | num.imp.dec2flt.Dec2FltTrace.SignOnly body negative => body.val = [] ∧ DecimalGoalVocabularyDefault.bytes s = [if negative then 45 else 43] ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = none ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) none ∧ ∃ e, r = core.result.Result.Err e | num.imp.dec2flt.Dec2FltTrace.Invalid body negative parseNumber parseSpecial => ∃ sign, body.val ≠ [] ∧ SourceValidByteSlice body ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = some (sign, DecimalGoalVocabularyDefault.bytes body) ∧ negative = decide (sign = some true) ∧ parseNumber = none ∧ C.parseNumber (DecimalGoalVocabularyDefault.bytes body) = none ∧ parseSpecial = none ∧ C.parseSpecial (DecimalGoalVocabularyDefault.bytes body) negative = none ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) none ∧ ∃ e, r = core.result.Result.Err e | num.imp.dec2flt.Dec2FltTrace.Special body negative parseNumber parseSpecial result => ∃ sign, body.val ≠ [] ∧ SourceValidByteSlice body ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = some (sign, DecimalGoalVocabularyDefault.bytes body) ∧ negative = decide (sign = some true) ∧ parseNumber = none ∧ C.parseNumber (DecimalGoalVocabularyDefault.bytes body) = none ∧ parseSpecial = some result ∧ C.parseSpecial (DecimalGoalVocabularyDefault.bytes body) negative = some result ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) (some result) ∧ r = core.result.Result.Ok result | num.imp.dec2flt.Dec2FltTrace.FastPath body negative parseNumber fastInput fastResult result => ∃ sign parsed, body.val ≠ [] ∧ SourceValidByteSlice body ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = some (sign, DecimalGoalVocabularyDefault.bytes body) ∧ negative = decide (sign = some true) ∧ parseNumber = some parsed ∧ C.parseNumber (DecimalGoalVocabularyDefault.bytes body) = some parsed ∧ fastInput = { parsed with negative := negative } ∧ C.native fastInput = fastResult ∧ fastResult = some result ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) (some result) ∧ r = core.result.Result.Ok result | num.imp.dec2flt.Dec2FltTrace.Assembled a => ∃ sign parsed, a.body.val ≠ [] ∧ SourceValidByteSlice a.body ∧ C.stripSign (DecimalGoalVocabularyDefault.bytes s) = some (sign, DecimalGoalVocabularyDefault.bytes a.body) ∧ a.negative = decide (sign = some true) ∧ a.parse_number_result = some parsed ∧ C.parseNumber (DecimalGoalVocabularyDefault.bytes a.body) = some parsed ∧ a.fast_path_input = { parsed with negative := a.negative } ∧ a.fast_path_result = none ∧ C.native a.fast_path_input = none ∧ a.first_compute_exponent = parsed.exponent ∧ a.first_compute_mantissa = parsed.mantissa ∧ C.integer a.first_compute_exponent a.first_compute_mantissa = a.first_compute_result ∧ parsed.mantissa.val < 10 ^ 19 ∧ parsed.mantissa.val + 1 < 2 ^ 64 ∧ a.second_compute_guard = (parsed.many_digits && decide (0 <= a.first_compute_result.p_biased.val)) ∧ (a.second_compute_guard = true -> ∃ nextMantissa second, a.second_compute_exponent = some parsed.exponent ∧ a.second_compute_mantissa = some nextMantissa ∧ C.incrementMantissa parsed.mantissa = some nextMantissa ∧ nextMantissa.val = parsed.mantissa.val + 1 ∧ a.second_compute_result = some second ∧ C.integer parsed.exponent nextMantissa = second ∧ a.second_equals_first = some (C.samePair a.first_compute_result second) ∧ ((C.samePair a.first_compute_result second = true ∧ a.forced_deferral = false ∧ a.post_comparison_pair = a.first_compute_result) ∨ (C.samePair a.first_compute_result second = false ∧ a.forced_deferral = true ∧ a.post_comparison_pair = C.forceDefer a.first_compute_result ∧ a.post_comparison_pair.m = a.first_compute_result.m ∧ a.post_comparison_pair.p_biased.val = -1))) ∧ (a.second_compute_guard = false -> a.second_compute_exponent = none ∧ a.second_compute_mantissa = none ∧ a.second_compute_result = none ∧ a.second_equals_first = none ∧ a.forced_deferral = false ∧ a.post_comparison_pair = a.first_compute_result) ∧ a.slow_path_guard = decide (a.post_comparison_pair.p_biased.val < 0) ∧ (a.slow_path_guard = true -> ∃ replacement, a.slow_path_result = some replacement ∧ C.slow (DecimalGoalVocabularyDefault.bytes a.body) = replacement ∧ a.selected_pair = replacement) ∧ (a.slow_path_guard = false -> a.slow_path_result = none ∧ a.selected_pair = a.post_comparison_pair) ∧ C.assemble a.selected_pair = a.assembly_result ∧ DecimalGoalVocabularyDefault.assembledWord a.selected_pair a.assembly_result ∧ a.assembled_word.val = a.assembly_result.val ∧ a.lexical_sign_applied = a.negative ∧ C.applySign a.negative a.assembly_result = a.result ∧ C.flow (DecimalGoalVocabularyDefault.bytes s) (some a.result) ∧ r = core.result.Result.Ok a.result) := by -- BODY rintro ⟨C, _⟩ exact DispatchContractsUninhabited (Nonempty.intro C)