The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V33. Data structures and computation

Mathlib.Data.String.Basic

11 declarations. Mathlib docs · Source

theorem String.ltb.induct_unfolding E1 #

∀ (motive : String.Legacy.Iterator → String.Legacy.Iterator → Bool → Prop),
  (∀ (s₁ s₂ : String.Legacy.Iterator),
      s₂.hasNext = true →
        s₁.hasNext = true →
          s₁.curr = s₂.curr →
            motive s₁.next s₂.next (String.ltb s₁.next s₂.next) → motive s₁ s₂ (String.ltb s₁.next s₂.next)) →
    (∀ (s₁ s₂ : String.Legacy.Iterator),
        s₂.hasNext = true → s₁.hasNext = true → ¬s₁.curr = s₂.curr → motive s₁ s₂ (decide (s₁.curr < s₂.curr))) →
      (∀ (s₁ s₂ : String.Legacy.Iterator), s₂.hasNext = true → ¬s₁.hasNext = true → motive s₁ s₂ true) →
        (∀ (s₁ s₂ : String.Legacy.Iterator), ¬s₂.hasNext = true → motive s₁ s₂ false) →
          ∀ (s₁ s₂ : String.Legacy.Iterator), motive s₁ s₂ (String.ltb s₁ s₂)

def String.ltb E1 #

String.Legacy.Iterator → String.Legacy.Iterator → Bool

< on string iterators. This coincides with < on strings as lists.

def String.ltb.inductionOn E1 #

{motive : String.Legacy.Iterator → String.Legacy.Iterator → Sort u} →
  (it₁ it₂ : String.Legacy.Iterator) →
    ((s₁ s₂ : String) →
        (i₁ i₂ : String.Pos.Raw) →
          { s := s₂, i := i₂ }.hasNext = true →
            { s := s₁, i := i₁ }.hasNext = true →
              String.Pos.Raw.get s₁ i₁ = String.Pos.Raw.get s₂ i₂ →
                motive { s := s₁, i := i₁ }.next { s := s₂, i := i₂ }.next →
                  motive { s := s₁, i := i₁ } { s := s₂, i := i₂ }) →
      ((s₁ s₂ : String) →
          (i₁ i₂ : String.Pos.Raw) →
            { s := s₂, i := i₂ }.hasNext = true →
              { s := s₁, i := i₁ }.hasNext = true →
                ¬String.Pos.Raw.get s₁ i₁ = String.Pos.Raw.get s₂ i₂ →
                  motive { s := s₁, i := i₁ } { s := s₂, i := i₂ }) →
        ((s₁ s₂ : String) →
            (i₁ i₂ : String.Pos.Raw) →
              { s := s₂, i := i₂ }.hasNext = true →
                ¬{ s := s₁, i := i₁ }.hasNext = true → motive { s := s₁, i := i₁ } { s := s₂, i := i₂ }) →
          ((s₁ s₂ : String) →
              (i₁ i₂ : String.Pos.Raw) →
                ¬{ s := s₂, i := i₂ }.hasNext = true → motive { s := s₁, i := i₁ } { s := s₂, i := i₂ }) →
            motive it₁ it₂

Induction on String.ltb.

theorem String.ltb_cons_addChar' E1 #

∀ (c : Char) (s₁ s₂ : String.Legacy.Iterator),
  String.ltb { s := String.ofList (c :: s₁.s.toList), i := s₁.i + c }
      { s := String.ofList (c :: s₂.s.toList), i := s₂.i + c } =
    String.ltb s₁ s₂

theorem String.ltb_cons_addChar E1 #

∀ (c : Char) (cs₁ cs₂ : List Char) (i₁ i₂ : String.Pos.Raw),
  String.ltb { s := String.ofList (c :: cs₁), i := i₁ + c } { s := String.ofList (c :: cs₂), i := i₂ + c } =
    String.ltb { s := String.ofList cs₁, i := i₁ } { s := String.ofList cs₂, i := i₂ }

theorem String.lt_iff_toList_lt E1 #

∀ {s₁ s₂ : String}, s₁ < s₂ ↔ s₁.toList < s₂.toList

theorem String.lt_iff_ltb E1 #

∀ {s₁ s₂ : String}, s₁ < s₂ ↔ String.ltb (String.Legacy.iter s₁) (String.Legacy.iter s₂) = true

theorem String.head_empty E0 #

"".toList.head! = default

theorem String.le_iff_toList_le E1 #

∀ {s₁ s₂ : String}, s₁ ≤ s₂ ↔ s₁.toList ≤ s₂.toList

instance String.instLinearOrder E0 #

LinearOrder String

theorem String.ofList_eq E0 #

∀ {l : List Char} {s : String}, String.ofList l = s ↔ l = s.toList