import Tablet.Assumptions import Tablet.DecimalGoalVocabularyDefault import Tablet.NumberHelperAcceptanceSafeLength import Tablet.NumberHelperSharpFractionBytes import Tablet.NumberHelperSharpParseFailure import Tablet.NumberHelperScientificExponentBounds import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_offset_from import Tablet.SliceU8_Insts_Dec2flt_modelNumImpDec2fltCommonByteSlice_read_u64 import Tablet.SourceValidByteSlice import Tablet.num_imp_dec2flt_common_is_8digits import Tablet.num_imp_dec2flt_parse_parse_8digits import Tablet.num_imp_dec2flt_parse_parse_8digits_MASK import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL1 import Tablet.num_imp_dec2flt_parse_parse_8digits_MUL2 import Tablet.num_imp_dec2flt_parse_parse_number import Tablet.num_imp_dec2flt_parse_parse_partial_number import Tablet.num_imp_dec2flt_parse_try_parse_digits open Aeneas Aeneas.Std Result ControlFlow Error set_option autoImplicit false namespace dec2flt_model -- [TABLET NODE: NumberHelperSafeLengthSharpness] theorem NumberHelperSafeLengthSharpness : exists (s : Slice Std.U8) (x : DecimalLexeme), s.val = [46#u8] ++ List.replicate 9223372036854120450 49#u8 ++ [101#u8, 45#u8, 54#u8, 53#u8, 53#u8, 51#u8, 53#u8, 57#u8] /\ s.val.length = 9223372036854120459 /\ x = { leadingSign := none integerDigits := [] fractionDigits := some (List.replicate 9223372036854120450 1) exponent := some (false, some true, [6, 5, 5, 3, 5, 9]) } /\ SourceValidByteSlice s /\ s.val != [] /\ x.leadingSign = none /\ DecimalGoalVocabularyDefault.validNumeric x /\ DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x /\ num.imp.dec2flt.parse.parse_number s = fail integerOverflow := by -- BODY obtain ⟨fractionBytes, hfractionValue, hfractionLength⟩ := NumberHelperSharpFractionBytes have hBound : 9223372036854120459 <= Usize.max := by have h := Usize.max_succ_eq_pow rw [Dec2Flt.configured_x86_64_numBits] at h norm_num at h omega let s : Slice Std.U8 := ⟨46#u8 :: fractionBytes, by simp only [List.length_cons, hfractionLength] exact hBound⟩ let x : DecimalLexeme := { leadingSign := none integerDigits := [] fractionDigits := some (List.replicate 9223372036854120450 1) exponent := some (false, some true, [6, 5, 5, 3, 5, 9]) } have hsTail : s.val = 46#u8 :: fractionBytes := by rfl have hsVal : s.val = [46#u8] ++ List.replicate 9223372036854120450 49#u8 ++ [101#u8, 45#u8, 54#u8, 53#u8, 53#u8, 51#u8, 53#u8, 57#u8] := by rw [hsTail, hfractionValue] simp only [List.cons_append, List.nil_append] have hsLen : s.val.length = 9223372036854120459 := by rw [hsTail, List.length_cons, hfractionLength] have hsource : SourceValidByteSlice s := by unfold SourceValidByteSlice rw [hsLen] norm_num have hnonempty : s.val != [] := by rw [hsTail] simp only [bne_iff_ne] exact List.cons_ne_nil _ _ have hvalid : DecimalGoalVocabularyDefault.validNumeric x := by dsimp only [DecimalGoalVocabularyDefault, x] simp only [List.not_mem_nil, false_implies, implies_true, List.mem_replicate, and_imp, true_and] constructor · intro d _ hd omega constructor · right intro h have q := congrArg List.length h simp only [List.length_replicate, List.length_nil] at q omega · constructor · exact List.cons_ne_nil _ _ · norm_num have hrenders : DecimalGoalVocabularyDefault.bytes s = DecimalGoalVocabularyDefault.renderNumeric x := by change s.val.map (fun b : Std.U8 => b.val) = [46] ++ (List.replicate 9223372036854120450 1).map (fun d => 48 + d) ++ [101, 45, 54, 53, 53, 51, 53, 57] rw [hsVal] simp only [List.map_append, List.map_cons, List.map_nil, List.map_replicate] norm_num have hparse : num.imp.dec2flt.parse.parse_number s = fail integerOverflow := NumberHelperSharpParseFailure s hsVal exact ⟨s, x, hsVal, hsLen, rfl, hsource, hnonempty, rfl, hvalid, hrenders, hparse⟩ end dec2flt_model