Skip to content

Commit 71ce9df

Browse files
committed
fix
1 parent 91f2dac commit 71ce9df

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Batteries/Data/String/Lemmas.lean

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,20 @@ theorem utf8PrevAux_of_valid {cs cs' : List Char} {c : Char} {i p : Nat}
224224
simp only [utf8PrevAux, List.cons_append, utf8Len_cons, ← hp]
225225
rw [if_neg]
226226
case hnc =>
227-
simp only [Pos.ext_iff]
228-
rw [Nat.add_right_comm, Nat.add_left_comm]
229-
apply ne_add_utf8Size_add_self
227+
simp only [Pos.le_iff, pos_add_char]
228+
grind [Char.utf8Size_pos]
230229
refine (utf8PrevAux_of_valid (by simp [Nat.add_assoc, Nat.add_left_comm])).trans ?_
231230
simp [Nat.add_assoc, Nat.add_comm]
232231

233232
theorem prev_of_valid (cs : List Char) (c : Char) (cs' : List Char) :
234233
prev ⟨cs ++ c :: cs'⟩ ⟨utf8Len cs + c.utf8Size⟩ = ⟨utf8Len cs⟩ := by
235234
simp only [prev]
236-
refine (if_neg (Pos.ne_of_gt add_utf8Size_pos)).trans ?_
237235
rw [utf8PrevAux_of_valid] <;> simp
238236

239237
theorem prev_of_valid' (cs cs' : List Char) :
240238
prev ⟨cs ++ cs'⟩ ⟨utf8Len cs⟩ = ⟨utf8Len cs.dropLast⟩ := by
241239
match cs, cs.eq_nil_or_concat with
242-
| _, .inl rfl => rfl
240+
| _, .inl rfl => apply prev_zero
243241
| _, .inr ⟨cs, c, rfl⟩ => simp [prev_of_valid]
244242

245243
theorem front_eq (s : String) : front s = s.1.headD default := by

0 commit comments

Comments
 (0)