88prelude
99public import Init.Data.String.Modify
1010import all Init.Data.String.Modify
11+ import Init.Data.String.Lemmas.Basic
1112
1213/-!
1314# Lemmas for `Init.Data.String.Modify`
@@ -21,28 +22,28 @@ public section
2122
2223namespace String
2324
24- -- TODO: `hp` actually follows from `h`.
2525/-- You might want to invoke `ValidPos.Splits.exists_eq_singleton_append` to be able to apply this. -/
26- theorem ValidPos.Splits.pastSet {s : String} {p : s.ValidPos} {t₁ t₂ : String} (hp : p ≠ s.endValidPos)
26+ theorem ValidPos.Splits.pastSet {s : String} {p : s.ValidPos} {t₁ t₂ : String}
2727 {c d : Char} (h : p.Splits t₁ (singleton c ++ t₂)) :
28- (p.pastSet d hp).Splits (t₁ ++ singleton d) t₂ := by
28+ (p.pastSet d h.ne_endValidPos_of_singleton).Splits (t₁ ++ singleton d) t₂ := by
29+ generalize h.ne_endValidPos_of_singleton = hp
2930 obtain ⟨rfl, rfl, rfl⟩ := by simpa using h.eq (p.splits_next_right hp)
3031 apply splits_pastSet
3132
32- -- TODO: `hp` actually follows from `h`.
3333/-- You might want to invoke `ValidPos.Splits.exists_eq_singleton_append` to be able to apply this. -/
34- theorem ValidPos.Splits.pastModify {s : String} {p : s.ValidPos} {t₁ t₂ : String} (hp : p ≠ s.endValidPos)
34+ theorem ValidPos.Splits.pastModify {s : String} {p : s.ValidPos} {t₁ t₂ : String}
3535 {c : Char} (h : p.Splits t₁ (singleton c ++ t₂)) :
36- (p.pastModify f hp).Splits (t₁ ++ singleton (f (p.get hp))) t₂ :=
37- h.pastSet hp
36+ (p.pastModify f h.ne_endValidPos_of_singleton).Splits
37+ (t₁ ++ singleton (f (p.get h.ne_endValidPos_of_singleton))) t₂ :=
38+ h.pastSet
3839
3940theorem toList_mapAux {f : Char → Char} {s : String} {p : s.ValidPos}
4041 (h : p.Splits t₁ t₂) : (mapAux f s p).toList = t₁.toList ++ t₂.toList.map f := by
4142 fun_induction mapAux generalizing t₁ t₂ with
4243 | case1 s => simp_all
4344 | case2 s p hp ih =>
4445 obtain ⟨c, rfl⟩ := h.exists_eq_singleton_append hp
45- simp [ih ( h.pastModify hp) ]
46+ simp [ih h.pastModify]
4647
4748@[simp]
4849theorem toList_map {f : Char → Char} {s : String} : (s.map f).toList = s.toList.map f := by
0 commit comments