Documentation

Init.Data.String.Lemmas.Pattern.Split

structure String.Slice.Pattern.Model.SlicesFrom {s : Slice} (startPos : s.Pos) :

Represents a list of subslices of a slice s, the first of which starts at the given position startPos. This is a natural type for a split routine to return.

Instances For
    theorem String.Slice.Pattern.Model.SlicesFrom.ext {s : Slice} {startPos : s.Pos} {x y : SlicesFrom startPos} (l : x.l = y.l) :
    x = y
    theorem String.Slice.Pattern.Model.SlicesFrom.ext_iff {s : Slice} {startPos : s.Pos} {x y : SlicesFrom startPos} :
    x = y x.l = y.l

    A SlicesFrom consisting of a single empty subslice at the position pos.

    Equations
    Instances For
      @[simp]
      theorem String.Slice.Pattern.Model.SlicesFrom.l_at {s : Slice} (pos : s.Pos) :
      («at» pos).l = [s.subslice pos pos ]
      def String.Slice.Pattern.Model.SlicesFrom.append {s : Slice} {p₁ p₂ : s.Pos} (l₁ : SlicesFrom p₁) (l₂ : SlicesFrom p₂) :

      Concatenating two SlicesFrom yields a SlicesFrom from the first position.

      Equations
      Instances For
        @[simp]
        theorem String.Slice.Pattern.Model.SlicesFrom.l_append {s : Slice} {p₁ p₂ : s.Pos} {l₁ : SlicesFrom p₁} {l₂ : SlicesFrom p₂} :
        (l₁.append l₂).l = l₁.l ++ l₂.l
        def String.Slice.Pattern.Model.SlicesFrom.extend {s : Slice} (p₁ : s.Pos) {p₂ : s.Pos} (h : p₁ p₂) (l : SlicesFrom p₂) :

        Given a SlicesFrom p₂ and a position p₁ such that p₁ ≤ p₂, obtain a SlicesFrom p₁ by extending the left end of the first subslice to from p₂ to p₁.

        Equations
        Instances For
          @[simp]
          theorem String.Slice.Pattern.Model.SlicesFrom.l_extend {s : Slice} {p₁ p₂ : s.Pos} (h : p₁ p₂) {l : SlicesFrom p₂} :
          (extend p₁ h l).l = match l.l, with | st :: sts, h_1 => st.extendLeft p₁ :: sts
          @[simp]
          theorem String.Slice.Pattern.Model.SlicesFrom.extend_self {s : Slice} {p₁ : s.Pos} (l : SlicesFrom p₁) :
          extend p₁ l = l
          @[simp]
          theorem String.Slice.Pattern.Model.SlicesFrom.extend_extend {s : Slice} {p₀ p₁ p₂ : s.Pos} {h : p₀ p₁} {h' : p₁ p₂} {l : SlicesFrom p₂} :
          extend p₀ h (extend p₁ h' l) = extend p₀ l
          @[irreducible]
          noncomputable def String.Slice.Pattern.Model.split {ρ : Type} (pat : ρ) [ForwardPatternModel pat] {s : Slice} (start : s.Pos) :

          Noncomputable model implementation of String.Slice.splitToSubslice based on ForwardPatternModel. This is supposed to be simple enough to allow deriving higher-level API lemmas about the public splitting functions.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem String.Slice.Pattern.Model.split_eq_of_isLongestMatchAt {ρ : Type} {pat : ρ} [ForwardPatternModel pat] {s : Slice} {start stop : s.Pos} (h : IsLongestMatchAt pat start stop) :
            Model.split pat start = (SlicesFrom.at start).append (Model.split pat stop)
            theorem String.Slice.Pattern.Model.split_eq_of_not_matchesAt {ρ : Type} {pat : ρ} [ForwardPatternModel pat] {s : Slice} {start stop : s.Pos} (h₀ : start stop) (h : ∀ (p : s.Pos), start pp < stop¬MatchesAt pat p) :
            Model.split pat start = SlicesFrom.extend start h₀ (Model.split pat stop)