import Tablet.DecimalGoalVocabularyDefault import Tablet.P9_T1_ActualDispatchOperations import Tablet.num_imp_dec2flt_dec2flt import Tablet.ClassificationTotality import Tablet.P13_T1_ParserNumericAcceptance import Tablet.P13_T1_ParserInfinity import Tablet.P13_T1_ParserNanAcceptance import Tablet.P13_T1_ParserInvalidRejection open Aeneas Aeneas.Std Result ControlFlow Error set_option autoImplicit false namespace dec2flt_model -- [TABLET NODE: P13_T1_ParserTotality] theorem P13_T1_ParserTotality : forall s : Str, DecimalGoalVocabularyDefault.sourceString s -> s.val.length <= 3458764513820540928 -> exists r : core.result.Result F64 num.float_parse.ParseFloatError, num.imp.dec2flt.dec2flt F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 F64.Insts.CoreOpsArithDivF64F64 F64.Insts.CoreOpsArithMulF64F64 F64.Insts.CoreOpsArithNegF64 s = ok r := by -- BODY intro s hsource hlen have hbytes : ∀ b ∈ DecimalGoalVocabularyDefault.bytes s, b < 256 := by intro b hb dsimp [DecimalGoalVocabularyDefault] at hb ⊢ rcases List.mem_map.mp hb with ⟨u, hu, rfl⟩ exact u.bv.isLt obtain ⟨c, hc⟩ := ClassificationTotality (DecimalGoalVocabularyDefault.bytes s) hbytes cases c with | none => change (¬ ∃ x, DecimalGoalVocabularyDefault.validNumeric x ∧ DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s) ∧ (¬ ∃ sign nan, DecimalGoalVocabularyDefault.specialLiteral (DecimalGoalVocabularyDefault.bytes s) sign nan) at hc obtain ⟨error, herr⟩ := P13_T1_ParserInvalidRejection s hsource hlen hc exact ⟨core.result.Result.Err error, herr⟩ | some result => cases result with | inl x => change DecimalGoalVocabularyDefault.validNumeric x ∧ DecimalGoalVocabularyDefault.renderNumeric x = DecimalGoalVocabularyDefault.bytes s at hc obtain ⟨valid, rendered⟩ := hc obtain ⟨f, hf⟩ := P13_T1_ParserNumericAcceptance s x hsource hlen valid rendered exact ⟨core.result.Result.Ok f, hf⟩ | inr special => rcases special with ⟨sign, nan⟩ change DecimalGoalVocabularyDefault.specialLiteral (DecimalGoalVocabularyDefault.bytes s) sign nan at hc cases nan with | false => obtain ⟨f, hf, _⟩ := P13_T1_ParserInfinity s sign hsource hc exact ⟨core.result.Result.Ok f, hf⟩ | true => obtain ⟨f, hf, _⟩ := P13_T1_ParserNanAcceptance s sign hsource hc exact ⟨core.result.Result.Ok f, hf⟩ end dec2flt_model