import Tablet.DecimalGoalVocabularyDefault import Tablet.ParserAccumulatedRounding import Tablet.RoundingDeterminism 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: ParserEqualTargetRounding] theorem ParserEqualTargetRounding : ∀ (s : Str) (x : DecimalLexeme) (f target : F64), DecimalGoalVocabularyDefault.sourceString s -> DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x -> DecimalGoalVocabularyDefault.roundsMagnitude (DecimalGoalVocabularyDefault.exactMagnitude x) target -> DecimalGoalVocabularyDefault.roundsMagnitude (DecimalGoalVocabularyDefault.accumulatedMagnitude x) target -> num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64 F64.Insts.CoreOpsArithNegF64 s = ok (core.result.Result.Ok f) -> DecimalGoalVocabularyDefault.signedMagnitude (DecimalGoalVocabularyDefault.lexicalNegative x) target f := by -- BODY intro s x f target hsource hvalid hrender _hexact htarget hparse obtain ⟨m, hm, hsigned⟩ := ParserAccumulatedRounding s x f hsource hvalid hrender hparse have hnonnegative : 0 <= DecimalGoalVocabularyDefault.accumulatedMagnitude x := by change 0 <= DecimalGoalVocabularyDefault.accumulatedMagnitude x ∧ _ at htarget exact htarget.1 have heq : m = target := RoundingDeterminism (DecimalGoalVocabularyDefault.accumulatedMagnitude x) m target hnonnegative hm htarget simpa [heq] using hsigned end dec2flt_model