99public import Init.Data.String.Pattern.Basic
1010public import Init.Data.Iterators.Internal.Termination
1111public import Init.Data.Iterators.Consumers.Monadic.Loop
12+ import Init.Data.String.Termination
1213
1314set_option doc.verso true
1415
@@ -152,8 +153,8 @@ instance (s : Slice) : Std.Iterators.Iterator (ForwardSliceSearcher s) Id (Searc
152153 | .atEnd => pure (.deflate ⟨.done, by simp⟩)
153154
154155private def toOption : ForwardSliceSearcher s → Option (Nat × Nat)
155- | .emptyBefore pos => some (s.utf8ByteSize - pos.offset.byteIdx , 1 )
156- | .emptyAt pos _ => some (s.utf8ByteSize - pos.offset.byteIdx , 0 )
156+ | .emptyBefore pos => some (pos.remainingBytes , 1 )
157+ | .emptyAt pos _ => some (pos.remainingBytes , 0 )
157158 | .proper _ _ sp _ => some (s.utf8ByteSize - sp.byteIdx, 0 )
158159 | .atEnd => none
159160
@@ -179,12 +180,10 @@ private def finitenessRelation :
179180 | .emptyBefore pos =>
180181 rintro (⟨h, h'⟩|h') <;> simp [h', ForwardSliceSearcher.toOption, Option.lt, Prod.lex_def]
181182 | .emptyAt pos h =>
182- simp
183+ simp only [forall_exists_index, and_imp]
183184 intro x hx h
184- have := x.isValidForSlice.le_utf8ByteSize
185- simp [h, ForwardSliceSearcher.toOption, Option.lt, Prod.lex_def, Slice.Pos.lt_iff,
186- Pos.Raw.lt_iff] at ⊢ hx
187- omega
185+ simpa [h, ForwardSliceSearcher.toOption, Option.lt, Prod.lex_def,
186+ ← Pos.lt_iff_remainingBytes_lt]
188187 | .proper needle table stackPos needlePos =>
189188 simp only [exists_and_left]
190189 rintro (⟨newStackPos, h₁, h₂, ⟨x, hx⟩⟩|h)
0 commit comments