l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
⊢ firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop } { byteIdx := p } =
    {
      byteIdx :=
        p +
          utf8Len
            (match r₁, r₂ with
              | a :: as, b :: bs =>
                if decide (a = b) = true then
                  match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) as bs with
                  | (as', bs') => (a :: as', b :: bs')
                else ([], [])
              | x, x_1 => ([], [])).fst }
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
⊢ firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop } { byteIdx := p } =
    { byteIdx := p + utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst }
unfold List.takeWhile₂
case h_1
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a✝ : Char
as✝ : List Char
b✝ : Char
bs✝ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a✝ :: as✝)) (utf8Len l₂ + utf8Len (b✝ :: bs✝))
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if
          (get { data := l₁ ++ a✝ :: as✝ } { byteIdx := p } != get { data := l₂ ++ b✝ :: bs✝ } { byteIdx := p }) =
            true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ a✝ :: as✝ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ a✝ :: as✝ } { data := l₂ ++ b✝ :: bs✝ } { byteIdx := stop }
          (next { data := l₁ ++ a✝ :: as✝ } { byteIdx := p })
    else { byteIdx := p }) =
    {
      byteIdx :=
        p +
          utf8Len
            (if decide (a✝ = b✝) = true then
                match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) as✝ bs✝ with
                | (as', bs') => (a✝ :: as', b✝ :: bs')
              else ([], [])).fst }

case h_2
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝² x✝¹ : List Char
x✝ : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if (get { data := l₁ ++ r₁ } { byteIdx := p } != get { data := l₂ ++ r₂ } { byteIdx := p }) = true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ r₁ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop }
          (next { data := l₁ ++ r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    { byteIdx := p + utf8Len ([], []).fst }
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
⊢ firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop } { byteIdx := p } =
    {
      byteIdx :=
        p +
          utf8Len
            (match r₁, r₂ with
              | a :: as, b :: bs =>
                if decide (a = b) = true then
                  match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) as bs with
                  | (as', bs') => (a :: as', b :: bs')
                else ([], [])
              | x, x_1 => ([], [])).fst }
split <;> unfold firstDiffPos.loop
no goals
case h_1
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a✝ : Char
as✝ : List Char
b✝ : Char
bs✝ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a✝ :: as✝)) (utf8Len l₂ + utf8Len (b✝ :: bs✝))
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if
          (get { data := l₁ ++ a✝ :: as✝ } { byteIdx := p } != get { data := l₂ ++ b✝ :: bs✝ } { byteIdx := p }) =
            true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ a✝ :: as✝ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ a✝ :: as✝ } { data := l₂ ++ b✝ :: bs✝ } { byteIdx := stop }
          (next { data := l₁ ++ a✝ :: as✝ } { byteIdx := p })
    else { byteIdx := p }) =
    {
      byteIdx :=
        p +
          utf8Len
            (if decide (a✝ = b✝) = true then
                match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) as✝ bs✝ with
                | (as', bs') => (a✝ :: as', b✝ :: bs')
              else ([], [])).fst }
next a r₁ b r₂ =>
rw [
  dif_pos <| by
    rw [hstop, ← hl₁, ← hl₂]
    refine Nat.lt_min.2 ⟨?_, ?_⟩ <;> exact Nat.lt_add_of_pos_right add_csize_pos,
  show get ⟨l₁ ++ a :: r₁⟩ ⟨p⟩ = a by simp [hl₁, get_of_valid],
  show get ⟨l₂ ++ b :: r₂⟩ ⟨p⟩ = b by simp [hl₂, get_of_valid]]
simp [bne]; split <;> simp
subst b
rw [show next ⟨l₁ ++ a :: r₁⟩ ⟨p⟩ = ⟨utf8Len l₁ + csize a⟩ by simp [hl₁, next_of_valid]]
simpa [← hl₁, ← Nat.add_assoc, Nat.add_right_comm] using
  firstDiffPos_loop_eq (l₁ ++ [a]) (l₂ ++ [a]) r₁ r₂ stop (p + csize a)
    (by simp [hl₁]) (by simp [hl₂]) (by simp [hstop, ← Nat.add_assoc, Nat.add_right_comm])
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ (if (a != b) = true then { byteIdx := p }
    else
      let_fun this :=
        (_ :
          { byteIdx := stop }.byteIdx - (next { data := l₁ ++ a :: r₁ } { byteIdx := p }).byteIdx <
            { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
      firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
        (next { data := l₁ ++ a :: r₁ } { byteIdx := p })) =
    {
      byteIdx :=
        p +
          utf8Len
            (if decide (a = b) = true then
                match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂ with
                | (as', bs') => (a :: as', b :: bs')
              else ([], [])).fst }
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if (get { data := l₁ ++ a :: r₁ } { byteIdx := p } != get { data := l₂ ++ b :: r₂ } { byteIdx := p }) = true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ a :: r₁ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
          (next { data := l₁ ++ a :: r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    {
      byteIdx :=
        p +
          utf8Len
            (if decide (a = b) = true then
                match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂ with
                | (as', bs') => (a :: as', b :: bs')
              else ([], [])).fst }
rw [
  dif_pos <| by
    rw [hstop, ← hl₁, ← hl₂]
    refine Nat.lt_min.2 ⟨?_, ?_⟩ <;> exact Nat.lt_add_of_pos_right add_csize_pos,
  show get ⟨l₁ ++ a :: r₁⟩ ⟨p⟩ = a by simp [hl₁, get_of_valid],
  show get ⟨l₂ ++ b :: r₂⟩ ⟨p⟩ = b by simp [hl₂, get_of_valid]]
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ (if a = b then
      firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
        (next { data := l₁ ++ a :: r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    {
      byteIdx :=
        p +
          utf8Len
            (if a = b then
                (a :: (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst,
                  b :: (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).snd)
              else ([], [])).fst }
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ (if (a != b) = true then { byteIdx := p }
    else
      let_fun this :=
        (_ :
          { byteIdx := stop }.byteIdx - (next { data := l₁ ++ a :: r₁ } { byteIdx := p }).byteIdx <
            { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
      firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
        (next { data := l₁ ++ a :: r₁ } { byteIdx := p })) =
    {
      byteIdx :=
        p +
          utf8Len
            (if decide (a = b) = true then
                match List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂ with
                | (as', bs') => (a :: as', b :: bs')
              else ([], [])).fst }
simp [bne]
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
h✝ : a = b
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
      (next { data := l₁ ++ a :: r₁ } { byteIdx := p }) =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ (if a = b then
      firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
        (next { data := l₁ ++ a :: r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    {
      byteIdx :=
        p +
          utf8Len
            (if a = b then
                (a :: (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst,
                  b :: (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).snd)
              else ([], [])).fst }
split <;> simp
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ a :: r₂ } { byteIdx := stop }
      (next { data := l₁ ++ a :: r₁ } { byteIdx := p }) =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
h✝ : a = b
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ b :: r₂ } { byteIdx := stop }
      (next { data := l₁ ++ a :: r₁ } { byteIdx := p }) =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
subst b
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ a :: r₂ } { byteIdx := stop }
      { byteIdx := utf8Len l₁ + csize a } =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ a :: r₂ } { byteIdx := stop }
      (next { data := l₁ ++ a :: r₁ } { byteIdx := p }) =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
rw [show next ⟨l₁ ++ a :: r₁⟩ ⟨p⟩ = ⟨utf8Len l₁ + csize a⟩ by simp [hl₁, next_of_valid]]
no goals
case inl
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ firstDiffPos.loop { data := l₁ ++ a :: r₁ } { data := l₂ ++ a :: r₂ } { byteIdx := stop }
      { byteIdx := utf8Len l₁ + csize a } =
    { byteIdx := p + (utf8Len (List.takeWhile₂ (fun x x_1 => decide (x = x_1)) r₁ r₂).fst + csize a) }
simpa [← hl₁, ← Nat.add_assoc, Nat.add_right_comm] using
  firstDiffPos_loop_eq (l₁ ++ [a]) (l₂ ++ [a]) r₁ r₂ stop (p + csize a)
    (by simp [hl₁]) (by simp [hl₂]) (by simp [hstop, ← Nat.add_assoc, Nat.add_right_comm])
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ { byteIdx := p } < { byteIdx := min (p + utf8Len (a :: r₁)) (p + utf8Len (b :: r₂)) }
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ { byteIdx := p } < { byteIdx := stop }
rw [hstop, ← hl₁, ← hl₂]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ { byteIdx := p } < { byteIdx := min (p + utf8Len (a :: r₁)) (p + utf8Len (b :: r₂)) }
refine Nat.lt_min.2 ⟨?_, ?_⟩ <;> exact Nat.lt_add_of_pos_right add_csize_pos
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ get { data := l₁ ++ a :: r₁ } { byteIdx := p } = a
simp [hl₁, get_of_valid]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ : List Char
b : Char
r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (b :: r₂))
⊢ get { data := l₂ ++ b :: r₂ } { byteIdx := p } = b
simp [hl₂, get_of_valid]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ next { data := l₁ ++ a :: r₁ } { byteIdx := p } = { byteIdx := utf8Len l₁ + csize a }
simp [hl₁, next_of_valid]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ p + csize a = utf8Len (l₁ ++ [a])
simp [hl₁]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ p + csize a = utf8Len (l₂ ++ [a])
simp [hl₂]
no goals
l₁ l₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
x✝¹ x✝ : List Char
a : Char
r₁ r₂ : List Char
hstop : stop = min (utf8Len l₁ + utf8Len (a :: r₁)) (utf8Len l₂ + utf8Len (a :: r₂))
⊢ stop = min (utf8Len (l₁ ++ [a]) + utf8Len r₁) (utf8Len (l₂ ++ [a]) + utf8Len r₂)
simp [hstop, ← Nat.add_assoc, Nat.add_right_comm]
no goals
case h_2
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝² x✝¹ : List Char
x✝ : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if (get { data := l₁ ++ r₁ } { byteIdx := p } != get { data := l₂ ++ r₂ } { byteIdx := p }) = true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ r₁ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop }
          (next { data := l₁ ++ r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    { byteIdx := p + utf8Len ([], []).fst }
next h =>
rw [dif_neg] <;> simp [hstop, ← hl₁, ← hl₂, -Nat.not_lt, Nat.lt_min]
intro h₁ h₂
have : ∀ {cs}, p < p + utf8Len cs → cs ≠ [] := by rintro _ h rfl; simp at h
obtain ⟨a, as, e₁⟩ := List.exists_cons_of_ne_nil (this h₁)
obtain ⟨b, bs, e₂⟩ := List.exists_cons_of_ne_nil (this h₂)
exact h _ _ _ _ e₁ e₂
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
⊢ p < p + utf8Len r₁ → ¬p < p + utf8Len r₂
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
⊢ (if h : { byteIdx := p } < { byteIdx := stop } then
      if (get { data := l₁ ++ r₁ } { byteIdx := p } != get { data := l₂ ++ r₂ } { byteIdx := p }) = true then
        { byteIdx := p }
      else
        let_fun this :=
          (_ :
            { byteIdx := stop }.byteIdx - (next { data := l₁ ++ r₁ } { byteIdx := p }).byteIdx <
              { byteIdx := stop }.byteIdx - { byteIdx := p }.byteIdx);
        firstDiffPos.loop { data := l₁ ++ r₁ } { data := l₂ ++ r₂ } { byteIdx := stop }
          (next { data := l₁ ++ r₁ } { byteIdx := p })
    else { byteIdx := p }) =
    { byteIdx := p + utf8Len ([], []).fst }
rw [dif_neg] <;> simp [hstop, ← hl₁, ← hl₂, -Nat.not_lt, Nat.lt_min]
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
⊢ False
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
⊢ p < p + utf8Len r₁ → ¬p < p + utf8Len r₂
intro h₁ h₂
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
⊢ False
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
⊢ False
have : ∀ {cs}, p < p + utf8Len cs → cs ≠ [] := by rintro _ h rfl; simp at h
case hnc.intro.intro
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
a : Char
as : List Char
e₁ : r₁ = a :: as
⊢ False
case hnc
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
⊢ False
obtain ⟨a, as, e₁⟩ := List.exists_cons_of_ne_nil (this h₁)
case hnc.intro.intro.intro.intro
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
a : Char
as : List Char
e₁ : r₁ = a :: as
b : Char
bs : List Char
e₂ : r₂ = b :: bs
⊢ False
case hnc.intro.intro
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
a : Char
as : List Char
e₁ : r₁ = a :: as
⊢ False
obtain ⟨b, bs, e₂⟩ := List.exists_cons_of_ne_nil (this h₂)
no goals
case hnc.intro.intro.intro.intro
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
this : ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
a : Char
as : List Char
e₁ : r₁ = a :: as
b : Char
bs : List Char
e₂ : r₂ = b :: bs
⊢ False
exact h _ _ _ _ e₁ e₂
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h✝ : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
h : p < p + utf8Len []
⊢ False
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
⊢ ∀ {cs : List Char}, p < p + utf8Len cs → cs ≠ []
rintro _ h rfl
no goals
l₁ l₂ r₁ r₂ : List Char
stop p : Nat
hl₁ : p = utf8Len l₁
hl₂ : p = utf8Len l₂
hstop : stop = min (utf8Len l₁ + utf8Len r₁) (utf8Len l₂ + utf8Len r₂)
x✝¹ x✝ : List Char
h✝ : ∀ (a : Char) (as : List Char) (b : Char) (bs : List Char), r₁ = a :: as → r₂ = b :: bs → False
h₁ : p < p + utf8Len r₁
h₂ : p < p + utf8Len r₂
h : p < p + utf8Len []
⊢ False
simp at h