Theorem: Substring.ValidFor.drop
File: .lake/packages/batteries/Batteries/Data/String/Lemmas.lean

tactic: have : Substring.nextn {..} .. = _ := h.nextn (m₁ := []) n
state_before: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r (s.drop n)
state_after: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this :
  { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n { byteIdx := utf8Len [] } =
    { byteIdx := utf8Len [] + utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r (s.drop n)

tactic: simp only [utf8Len_nil, Pos.mk_zero, Nat.zero_add] at this
state_before: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this :
  { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n { byteIdx := utf8Len [] } =
    { byteIdx := utf8Len [] + utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r (s.drop n)
state_after: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r (s.drop n)

tactic: simp only [Substring.drop, this]
state_before: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r (s.drop n)
state_after: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := s.str, startPos := s.startPos + { byteIdx := utf8Len (List.take n m) }, stopPos := s.stopPos }

tactic: simp only [h.str, List.append_assoc, h.startPos, h.stopPos]
state_before: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := s.str, startPos := s.startPos + { byteIdx := utf8Len (List.take n m) }, stopPos := s.stopPos }
state_after: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
      stopPos := { byteIdx := utf8Len l + utf8Len m } }

tactic: rw [← List.take_append_drop n m] at h
state_before: l m r : List Char
s : Substring
h : ValidFor l m r s
n : Nat
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
      stopPos := { byteIdx := utf8Len l + utf8Len m } }
state_after: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
      stopPos := { byteIdx := utf8Len l + utf8Len m } }

tactic: refine .of_eq _ (by simp) (by simp) ?_
state_before: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ ValidFor (l ++ List.take n m) (List.drop n m) r
    { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
      stopPos := { byteIdx := utf8Len l + utf8Len m } }
state_after: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
          stopPos := { byteIdx := utf8Len l + utf8Len m } }.stopPos.byteIdx =
    utf8Len (l ++ List.take n m) + utf8Len (List.drop n m)

tactic: conv => lhs; rw [← List.take_append_drop n m]
state_before: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
          stopPos := { byteIdx := utf8Len l + utf8Len m } }.stopPos.byteIdx =
    utf8Len (l ++ List.take n m) + utf8Len (List.drop n m)
state_after: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (List.take n m ++ List.drop n m ++ r) },
          startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n (List.take n m ++ List.drop n m)) },
          stopPos := { byteIdx := utf8Len l + utf8Len (List.take n m ++ List.drop n m) } }.stopPos.byteIdx =
    utf8Len (l ++ List.take n m) + utf8Len (List.drop n m)

tactic: simp [-List.take_append_drop, Nat.add_assoc]
state_before: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (List.take n m ++ List.drop n m ++ r) },
          startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n (List.take n m ++ List.drop n m)) },
          stopPos := { byteIdx := utf8Len l + utf8Len (List.take n m ++ List.drop n m) } }.stopPos.byteIdx =
    utf8Len (l ++ List.take n m) + utf8Len (List.drop n m)
state_after: no goals

tactic: simp
state_before: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
          stopPos := { byteIdx := utf8Len l + utf8Len m } }.str.data =
    l ++ List.take n m ++ List.drop n m ++ r
state_after: no goals

tactic: simp
state_before: l m r : List Char
s : Substring
n : Nat
h : ValidFor l (List.take n m ++ List.drop n m) r s
this : { str := s.str, startPos := s.startPos, stopPos := s.stopPos }.nextn n 0 = { byteIdx := utf8Len (List.take n m) }
⊢ { str := { data := l ++ (m ++ r) }, startPos := { byteIdx := utf8Len l } + { byteIdx := utf8Len (List.take n m) },
          stopPos := { byteIdx := utf8Len l + utf8Len m } }.startPos.byteIdx =
    utf8Len (l ++ List.take n m)
state_after: no goals