Documentation

Projects.Util.Data.Trie.Raw

structure Trie.Raw (α : Type u_1) (β : Type u_2) [DecidableEq α] [Hashable α] :
Type (max u_1 u_2)
Instances For
    theorem Trie.Raw.ext {α : Type u_1} {β : Type u_2} {inst✝ : DecidableEq α} {inst✝¹ : Hashable α} {x y : Raw α β} (inner : x.inner = y.inner) :
    x = y
    theorem Trie.Raw.ext_iff {α : Type u_1} {β : Type u_2} {inst✝ : DecidableEq α} {inst✝¹ : Hashable α} {x y : Raw α β} :
    x = y x.inner = y.inner
    @[simp]
    instance Trie.Raw.instWFInner {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} :
    def Trie.Raw.val {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) :
    Equations
    Instances For
      def Trie.Raw.mp {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) :
      Std.DHashMap.Raw α fun (x : α) => Raw₀ α β
      Equations
      Instances For
        @[simp]
        theorem Trie.Raw.val_mk {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {inner : Raw₀ α β} {wf : inner.WF} :
        { inner := inner, wf := wf }.val = inner.val
        @[simp]
        theorem Trie.Raw.mp_mk {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {inner : Raw₀ α β} {wf : inner.WF} :
        { inner := inner, wf := wf }.mp = inner.mp
        @[irreducible]
        def Trie.Raw.rec' {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {γ : Raw α βSort u_3} (motive : (val : Option β) → (mp : Std.DHashMap.Raw α fun (x : α) => Raw₀ α β) → (wf : (Raw₀.mk val mp).WF) → ((i : α) → (t : Raw α β) → mp.get? i = some t.innerγ t)γ { inner := Raw₀.mk val mp, wf := wf }) (t : Raw α β) :
        γ t
        Equations
        Instances For
          @[reducible, inline]
          abbrev Trie.Raw.ind {α : Type u_3} {β : Type u_4} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {γ : Raw α βSort u_5} (motive : (val : Option β) → (mp : Std.DHashMap.Raw α fun (x : α) => Raw₀ α β) → (wf : (Raw₀.mk val mp).WF) → ((i : α) → (t : Raw α β) → mp.get? i = some t.innerγ t)γ { inner := Raw₀.mk val mp, wf := wf }) (t : Raw α β) :
          γ t
          Equations
          Instances For
            @[simp]
            theorem Trie.Raw.rec'_mk {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {γ : Raw α βSort u_3} {val : Option β} {mp : Std.DHashMap.Raw α fun (x : α) => Raw₀ α β} {wf : (Raw₀.mk val mp).WF} {motive : (val : Option β) → (mp : Std.DHashMap.Raw α fun (x : α) => Raw₀ α β) → (wf : (Raw₀.mk val mp).WF) → ((i : α) → (t : Raw α β) → mp.get? i = some t.innerγ t)γ { inner := Raw₀.mk val mp, wf := wf }} :
            rec' motive { inner := Raw₀.mk val mp, wf := wf } = motive val mp wf fun (x : α) (t : Raw α β) (h : mp.get? x = some t.inner) => rec' motive t
            def Trie.Raw.empty {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] :
            Raw α β
            Equations
            Instances For
              @[instance_reducible]
              instance Trie.Raw.instEmptyCollection {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] :
              Equations
              theorem Trie.Raw.empty_def {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] :
              = { inner := , wf := }
              @[simp]
              theorem Trie.Raw.inner_empty {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] :
              def Trie.Raw.depth {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) :
              Equations
              Instances For
                @[simp]
                theorem Trie.Raw.depth_empty {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] :
                def Trie.Raw.get1? {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) (k : α) :
                Option (Raw α β)
                Equations
                Instances For
                  theorem Trie.Raw.get1?_eq_some_iff {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {k : α} {t' : Raw α β} :
                  t.get1? k = some t' t.mp.get? k = some t'.inner
                  theorem Trie.Raw.depth_eq_depth_inner {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} :
                  theorem Trie.Raw.depth_lt {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {k : α} {t' : Raw α β} (h : t.get1? k = some t') :
                  @[simp]
                  theorem Trie.Raw.depth_mk {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {raw : Raw₀ α β} [wf : raw.WF] :
                  { inner := raw, wf := wf }.depth = raw.depth
                  @[simp]
                  theorem Trie.Raw.get?_mp_inner_eq_some_inner_iff {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t t' : Raw α β} {k : α} :
                  t.inner.mp.get? k = some t'.inner t.get1? k = some t'
                  @[simp]
                  theorem Trie.Raw.WF.mp {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} :
                  t.mp.WF
                  theorem Trie.Raw.get?_mp {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {k : α} :
                  t.mp.get? k = Option.map (fun (x : Raw α β) => x.inner) (t.get1? k)
                  theorem Trie.Raw.mem_of_get?_eq_some {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {k : α} {x : Raw α β} (h : t.get1? k = some x) :
                  k t.mp
                  theorem Trie.Raw.mem_mp_iff_get?_eq_some {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {k : α} :
                  k t.mp ∃ (x : Raw α β), t.get1? k = some x
                  def Trie.Raw.isEmpty {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) :
                  Equations
                  Instances For
                    @[instance_reducible]
                    instance Trie.Raw.instDecidableIsEmpty {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} :
                    Equations
                    def Trie.Raw.setVal {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) (val : Option β) :
                    Raw α β
                    Equations
                    Instances For
                      @[simp]
                      theorem Trie.Raw.val_setVal {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {val : Option β} :
                      (t.setVal val).val = val
                      @[simp]
                      theorem Trie.Raw.mp_setVal {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {val : Option β} :
                      (t.setVal val).mp = t.mp
                      def Trie.Raw.erase1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) (i : α) :
                      Raw α β
                      Equations
                      Instances For
                        @[simp]
                        theorem Trie.Raw.val_erase1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} :
                        (t.erase1 i).val = t.val
                        @[simp]
                        theorem Trie.Raw.mp_erase1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} :
                        (t.erase1 i).mp = t.mp.erase i
                        def Trie.Raw.insert1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] (t : Raw α β) (i : α) (t₁ : Raw α β) :
                        Raw α β
                        Equations
                        Instances For
                          @[simp]
                          theorem Trie.Raw.val_insert1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} {t₁ : Raw α β} :
                          (t.insert1 i t₁).val = t.val
                          theorem Trie.Raw.mp_insert1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t t₁ : Raw α β} {i : α} :
                          (t.insert1 i t₁).mp = if t₁.isEmpty then t.mp.erase i else t.mp.insert i t₁.inner
                          theorem Trie.Raw.get1?_eq_get1?_inner {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} :
                          t.get1? i = match h : t.inner.get1? i with | none => none | some t₁ => some { inner := t₁, wf := }
                          theorem Trie.Raw.get1?_eq_some_iff_inner {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} {t₁ : Raw α β} :
                          t.get1? i = some t₁ t.inner.get1? i = some t₁.inner
                          theorem Trie.Raw.get1?_eq_none_iff_inner {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i : α} :
                          theorem Trie.Raw.get1?_erase1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i j : α} :
                          (t.erase1 i).get1? j = if i = j then none else t.get1? j
                          theorem Trie.Raw.get1?_insert1 {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t : Raw α β} {i j : α} {t₁ : Raw α β} :
                          (t.insert1 i t₁).get1? j = if i = j then if t₁.isEmpty then none else some t₁ else t.get1? j
                          @[simp]
                          theorem Trie.Raw.get1?_erase1_eq_some_iff {α : Type u_1} {β : Type u_2} [ha₁ : DecidableEq α] [ha₂ : Hashable α] {t t₁ : Raw α β} {i j : α} :
                          (t.erase1 i).get1? j = some t₁ i j t.get1? j = some t₁