Documentation

Init.Data.String.Lemmas.Pattern.Pred

theorem String.Slice.Pattern.Model.CharPred.isLongestMatchAt_iff {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestMatchAt p pos pos' ↔ ∃ (h : pos ≠ s.endPos), pos' = pos.next h ∧ p (pos.get h) = true
theorem String.Slice.Pattern.Model.CharPred.isLongestMatchAtChain_iff {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestMatchAtChain p pos pos' ↔ pos ≤ pos' ∧ ∀ (pos'' : s.Pos), pos ≤ pos'' → ∀ (h : pos'' < pos'), p (pos''.get ⋯) = true
theorem String.Slice.Pattern.Model.CharPred.isLongestMatchAtChain_iff_toList {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestMatchAtChain p pos pos' ↔ ∃ (h : pos ≤ pos'), ∀ (c : Char), c ∈ (s.slice pos pos' h).copy.toList → p c = true
theorem String.Slice.Pattern.Model.CharPred.isLongestRevMatchAt_iff {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestRevMatchAt p pos pos' ↔ ∃ (h : pos' ≠ s.startPos), pos = pos'.prev h ∧ p ((pos'.prev h).get ⋯) = true
theorem String.Slice.Pattern.Model.CharPred.isLongestMatchAt_of_get {p : Char → Bool} {s : Slice} {pos : s.Pos} {h : pos ≠ s.endPos} (hc : p (pos.get h) = true) :
IsLongestMatchAt p pos (pos.next h)
theorem String.Slice.Pattern.Model.CharPred.isLongestRevMatchAt_of_get {p : Char → Bool} {s : Slice} {pos : s.Pos} {h : pos ≠ s.startPos} (hc : p ((pos.prev h).get ⋯) = true) :
theorem String.Slice.Pattern.Model.CharPred.isLongestRevMatchAtChain_iff {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestRevMatchAtChain p pos pos' ↔ pos ≤ pos' ∧ ∀ (pos'' : s.Pos), pos ≤ pos'' → ∀ (h : pos'' < pos'), p (pos''.get ⋯) = true
theorem String.Slice.Pattern.Model.CharPred.isLongestRevMatchAtChain_iff_toList {p : Char → Bool} {s : Slice} {pos pos' : s.Pos} :
IsLongestRevMatchAtChain p pos pos' ↔ ∃ (h : pos ≤ pos'), ∀ (c : Char), c ∈ (s.slice pos pos' h).copy.toList → p c = true
theorem String.Slice.Pattern.Model.CharPred.matchesAt_iff {p : Char → Bool} {s : Slice} {pos : s.Pos} :
MatchesAt p pos ↔ ∃ (h : pos ≠ s.endPos), p (pos.get h) = true
theorem String.Slice.Pattern.Model.CharPred.not_matchesAt_of_get {p : Char → Bool} {s : Slice} {pos : s.Pos} {h : pos ≠ s.endPos} (hc : p (pos.get h) = false) :
theorem String.Slice.Pattern.Model.CharPred.not_revMatchesAt_of_get {p : Char → Bool} {s : Slice} {pos : s.Pos} {h : pos ≠ s.startPos} (hc : p ((pos.prev h).get ⋯) = false) :
theorem String.Slice.Pattern.Model.CharPred.matchAt?_eq {s : Slice} {pos : s.Pos} {p : Char → Bool} :
matchAt? p pos = if h₀ : ∃ (h : pos ≠ s.endPos), p (pos.get h) = true then some (pos.next ⋯) else none
theorem String.Slice.Pattern.Model.CharPred.revMatchAt?_eq {s : Slice} {pos : s.Pos} {p : Char → Bool} :
revMatchAt? p pos = if h₀ : ∃ (h : pos ≠ s.startPos), p ((pos.prev h).get ⋯) = true then some (pos.prev ⋯) else none
theorem String.Slice.Pattern.Model.CharPred.Decidable.isLongestMatchAt_iff {p : Char → Prop} [DecidablePred p] {s : Slice} {pos pos' : s.Pos} :
IsLongestMatchAt p pos pos' ↔ ∃ (h : pos ≠ s.endPos), pos' = pos.next h ∧ p (pos.get h)
theorem String.Slice.Pattern.Model.CharPred.Decidable.isLongestRevMatchAt_iff {p : Char → Prop} [DecidablePred p] {s : Slice} {pos pos' : s.Pos} :
IsLongestRevMatchAt p pos pos' ↔ ∃ (h : pos' ≠ s.startPos), pos = pos'.prev h ∧ p ((pos'.prev h).get ⋯)
theorem String.Slice.Pattern.Model.CharPred.Decidable.isLongestMatchAt_of_get {p : Char → Prop} [DecidablePred p] {s : Slice} {pos : s.Pos} {h : pos ≠ s.endPos} (hc : p (pos.get h)) :
IsLongestMatchAt p pos (pos.next h)
theorem String.Slice.Pattern.Model.CharPred.Decidable.isLongestRevMatchAt_of_get {p : Char → Prop} [DecidablePred p] {s : Slice} {pos : s.Pos} {h : pos ≠ s.startPos} (hc : p ((pos.prev h).get ⋯)) :
theorem String.Slice.Pattern.Model.CharPred.Decidable.matchAt?_eq {s : Slice} {pos : s.Pos} {p : Char → Prop} [DecidablePred p] :
matchAt? p pos = if h₀ : ∃ (h : pos ≠ s.endPos), p (pos.get h) then some (pos.next ⋯) else none
theorem String.Slice.Pattern.Model.CharPred.Decidable.revMatchAt?_eq {s : Slice} {pos : s.Pos} {p : Char → Prop} [DecidablePred p] :
revMatchAt? p pos = if h₀ : ∃ (h : pos ≠ s.startPos), p ((pos.prev h).get ⋯) then some (pos.prev ⋯) else none
theorem String.Slice.Pos.skip?_prop_eq_skip?_decide {p : Char → Prop} [DecidablePred p] {s : Slice} {pos : s.Pos} :
pos.skip? p = pos.skip? fun (x : Char) => decide (p x)
theorem String.Slice.Pos.skipWhile_prop_eq_skipWhile_decide {p : Char → Prop} [DecidablePred p] {s : Slice} (curr : s.Pos) :
curr.skipWhile p = curr.skipWhile fun (x : Char) => decide (p x)
theorem String.Slice.all_prop_eq_all_decide {p : Char → Prop} [DecidablePred p] {s : Slice} :
s.all p = s.all fun (x : Char) => decide (p x)
theorem String.Slice.find?_prop_eq_find?_decide {p : Char → Prop} [DecidablePred p] {s : Slice} :
s.find? p = s.find? fun (x : Char) => decide (p x)
theorem String.Slice.Pos.find?_prop_eq_find?_decide {p : Char → Prop} [DecidablePred p] {s : Slice} {pos : s.Pos} :
pos.find? p = pos.find? fun (x : Char) => decide (p x)
theorem String.Slice.Pos.revSkip?_prop_eq_revSkip?_decide {p : Char → Prop} [DecidablePred p] {s : Slice} {pos : s.Pos} :
pos.revSkip? p = pos.revSkip? fun (x : Char) => decide (p x)