Theorem: String.Iterator.ValidFor.prev
File: .lake/packages/batteries/Batteries/Data/String/Lemmas.lean

tactic: cases h.out'
state_before: c : Char
l r : List Char
it : Iterator
h : ValidFor (c :: l) r it
⊢ ValidFor l (c :: r) it.prev
state_after: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev

tactic: have := prev_of_valid l.reverse c r
state_before: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev
state_after: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this :
  { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l.reverse + c.utf8Size } = { byteIdx := utf8Len l.reverse }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev

tactic: simp only [utf8Len_reverse] at this
state_before: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this :
  { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l.reverse + c.utf8Size } = { byteIdx := utf8Len l.reverse }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev
state_after: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev

tactic: simp only [Iterator.prev, List.reverse_cons, List.append_assoc, List.singleton_append,
  utf8Len_append, utf8Len_reverse, utf8Len_cons, utf8Len_nil, Nat.zero_add, this]
state_before: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ ValidFor l (c :: r) { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }.prev
state_after: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ ValidFor l (c :: r) { s := { data := l.reverse ++ c :: r }, i := { byteIdx := utf8Len l } }

tactic: exact .of_eq _ (by simp [List.reverseAux_eq]) (by simp)
state_before: case refl
c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ ValidFor l (c :: r) { s := { data := l.reverse ++ c :: r }, i := { byteIdx := utf8Len l } }
state_after: no goals

tactic: simp [List.reverseAux_eq]
state_before: c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ { s := { data := l.reverse ++ c :: r }, i := { byteIdx := utf8Len l } }.s.data = l.reverseAux (c :: r)
state_after: no goals

tactic: simp
state_before: c : Char
l r : List Char
h : ValidFor (c :: l) r { s := { data := (c :: l).reverse ++ r }, i := { byteIdx := utf8Len (c :: l).reverse } }
this : { data := l.reverse ++ c :: r }.prev { byteIdx := utf8Len l + c.utf8Size } = { byteIdx := utf8Len l }
⊢ { s := { data := l.reverse ++ c :: r }, i := { byteIdx := utf8Len l } }.i.byteIdx = utf8Len l
state_after: no goals