Splits predicates on String.Pos and String.Slice.Pos. #
We introduce the predicate p.Splits t₁ t₂ for a position p on a string or slice s, which means
that s = t₁ ++ t₂ with p lying between the two parts. This is a useful primitive when verifying
string operations.
Given a position that splits s into t₁ and t₂ ++ t₃ with witness h, constructs a position
h.rotateRight that splits s into t₁ ++ t₂ and t₃. Use h.splits_rotateRight for the witness
that h.rotateRight splits s as required.
Equations
- h.rotateRight = s.pos (p.offset.increaseBy t₂.utf8ByteSize) ⋯
Instances For
Given a position that splits s into t₁ ++ t₂ and t₃ with witness h, construct a position
h.rotateLeft that splits s into t₁ and t₂ ++ t₃. Use h.splits_rotateLeft for the witness
that h.rotateLEft splits s as required.
Equations
- h.rotateLeft = s.pos t₁.rawEndPos ⋯
Instances For
Given a position that splits s into t₁ and t₂ ++ t₃ with witness h, constructs a position
h.rotateRight that splits s into t₁ ++ t₂ and t₃. Use h.splits_rotateRight for the witness
that h.rotateRight splits s as required.
Equations
Instances For
Given a position that splits s into t₁ ++ t₂ and t₃ with witness h, construct a position
h.rotateLeft that splits s into t₁ and t₂ ++ t₃. Use h.splits_rotateLeft for the witness
that h.rotateLEft splits s as required.