Slice s is a subslice of Slice t, if the underlying strings are equal
and t.startInclusive ≤ s.startInclusive and s.endExclusive ≤ t.endExclusive.
Equations
- s.isSubslice t = (s.str = t.str ∧ t.startInclusive.offset ≤ s.startInclusive.offset ∧ s.endExclusive.offset ≤ t.endExclusive.offset)
Instances For
@[simp]
theorem
String.Slice.replaceStartEnd_is_subslice_of
{s : Slice}
{p0 p1 : s.Pos}
{h : p0 ≤ p1}
:
(s.replaceStartEnd p0 p1 h).isSubslice s
cast p : s.Pos to t.Pos
Equations
Instances For
s.startPos : s.Pos as t.Pos
Equations
Instances For
theorem
String.Slice.startPosOfSubslice_eq
{s t : Slice}
(h : s.isSubslice t)
:
{ byteIdx := s.startInclusive.offset.byteIdx - t.startInclusive.offset.byteIdx } = (startPosOfSubslice h).offset
s.endPos : s.Pos as t.Pos
Equations
Instances For
theorem
String.Slice.endPosOfSubslice_eq
{s t : Slice}
(h : s.isSubslice t)
:
{ byteIdx := s.endExclusive.offset.byteIdx - t.startInclusive.offset.byteIdx } = (endPosOfSubslice h).offset
@[simp]
@[simp]
theorem
String.Slice.byteDistance_of_offset_and_char_lt
{s : Slice}
{pos : s.Pos}
(h : pos ≠ s.endPos)
: