import Tablet.P435_T1_RenderedDigitBlocks import Tablet.P435_T1_DigitDecoding import Tablet.P435_T1_DigitPrefixUnique import Tablet.P435_T1_SignificandScanA import Tablet.P364_T1_NumberHelperDigitPrefix import Tablet.Assumptions import Tablet.ModelSliceSplitFirst import Tablet.P367_T1_NumberHelperScientificScan import Tablet.P364_T1_NumberHelperOffsetSourceLength import Tablet.ModelOptionBranch import Tablet.ModelOptionFromResidual import Tablet.num_imp_dec2flt_parse_parse_partial_number import Tablet.P835_T1_PartialRunForwardA import Tablet.P835_T1_PartialRunReverseA open Aeneas Aeneas.Std Result ControlFlow Error set_option autoImplicit false namespace dec2flt_model -- [TABLET NODE: P435_T1_PartialLexicalCertificateA] theorem P435_T1_PartialLexicalCertificateA (s : Slice Std.U8) (hne : s.val ≠ []) (hlen : s.val.length <= 3458764513820540928) (result : Option (num.imp.dec2flt.decimal.Decimal × Std.Usize)) (hnormal : num.imp.dec2flt.parse.parse_partial_number s = ok result) : (forall d consumed, result = some (d, consumed) -> exists (x : DecimalLexeme) (tail : List Std.U8), x.leadingSign = none /\ DecimalGoalVocabularyDefault.validNumeric x /\ DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x ++ tail.map (fun b => b.val) /\ (forall b rest, tail = b :: rest -> ¬ (48 <= b.val /\ b.val <= 57)) /\ (x.exponent = none -> forall b rest, tail = b :: rest -> b ≠ 69#u8 /\ b ≠ 101#u8 /\ (x.fractionDigits = none -> b ≠ 46#u8)) /\ consumed.val = (DecimalGoalVocabularyDefault.renderNumeric x).length) /\ (forall (x : DecimalLexeme) (tail : List Std.U8), x.leadingSign = none -> DecimalGoalVocabularyDefault.validNumeric x -> DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x ++ tail.map (fun b => b.val) -> (forall b rest, tail = b :: rest -> ¬ (48 <= b.val /\ b.val <= 57)) -> (x.exponent = none -> forall b rest, tail = b :: rest -> b ≠ 69#u8 /\ b ≠ 101#u8 /\ (x.fractionDigits = none -> b ≠ 46#u8)) -> exists d consumed, result = some (d, consumed) /\ consumed.val = (DecimalGoalVocabularyDefault.renderNumeric x).length) := by -- BODY constructor · obtain ⟨integer, intTail, hsplit, hd, ht⟩ := P364_T1_NumberHelperDigitPrefix s.val cases intTail with | nil => exact P835_T1_PartialRunForwardA s integer [] [] false hne hlen (by simpa using hsplit) (by simp) hd (by simp) (by simp) (by simp) result hnormal | cons b bs => by_cases hp : b = 46#u8 · obtain ⟨fraction, tail, hfrac, hf, htail⟩ := P364_T1_NumberHelperDigitPrefix bs exact P835_T1_PartialRunForwardA s integer fraction tail true hne hlen (by simpa [hp, hfrac] using hsplit) (by simp) hd hf htail (by simp) result hnormal · exact P835_T1_PartialRunForwardA s integer [] (b :: bs) false hne hlen (by simpa using hsplit) (by simp) hd (by simp) ht (by intro _ c cs h; cases h; exact hp) result hnormal · intro x tail hsign hvalid hrender htail hguards exact P835_T1_PartialRunReverseA s hne hlen result hnormal x tail hsign hvalid hrender htail hguards end dec2flt_model