import Tablet.NumberHelperDigitScanExact import Tablet.P347_T1_EqualOffset import Tablet.ModelSliceSplitFirst import Tablet.num_imp_dec2flt_parse_parse_number open Aeneas Aeneas.Std Result ControlFlow Error set_option autoImplicit false namespace dec2flt_model -- [TABLET NODE: P347_T1_NonDigitNumberRejection] theorem P347_T1_NonDigitNumberRejection (s : Slice Std.U8) (a : Std.U8) (tail : List Std.U8) (hs : s.val = a :: tail) (hlen : s.val.length <= 9223372036854775807) (hdigit : Not (48 <= a.val /\ a.val <= 57)) (hdot : a ≠ 46#u8) : num.imp.dec2flt.parse.parse_partial_number s = ok none /\ num.imp.dec2flt.parse.parse_number s = ok none := by -- BODY obtain ⟨value, rest, hscan, hrest, hvalue⟩ := NumberHelperDigitScanExact s (0#u64) [] s.val (by simp) (by intro b hb; cases hb) (by intro b bs hb rw [hs] at hb cases hb exact hdigit) hlen (by simp) have hrest_eq : rest = s := by apply Subtype.ext exact hrest have hvalue_eq : value = 0#u64 := by apply UScalar.eq_of_val_eq simpa using hvalue rw [hrest_eq, hvalue_eq] at hscan have hadd : (0#isize + 0#isize) = ok (0#isize) := by obtain ⟨z, hz, hzval⟩ := WP.spec_imp_exists (IScalar.add_spec (x := 0#isize) (y := 0#isize) (by scalar_tac) (by scalar_tac)) have hz0 : z = 0#isize := by apply IScalar.eq_of_val_eq simpa using hzval simpa [hz0] using hz have hpartial : num.imp.dec2flt.parse.parse_partial_number s = ok none := by rcases s with ⟨vals, bound⟩ dsimp at hs subst vals simp only [num.imp.dec2flt.parse.parse_partial_number, hscan, core.slice.Slice.is_empty, Slice.length, core.slice.Slice.split_first, ModelSliceSplitFirst] simp split · exact (hdot rfl).elim · simp [P347_T1_EqualOffset, hadd] exact ⟨hpartial, by simp [num.imp.dec2flt.parse.parse_number, hpartial]⟩ end dec2flt_model