Documentation

Lean.Meta.DiscrTree.Util

@[specialize #[]]
partial def Lean.Meta.DiscrTree.Trie.foldM {m : Type u_1 → Type u_2} {σ : Type u_1} {α : Type} [Monad m] (initialKeys : Array Key) (f : σArray Keyαm σ) (init : σ) :
Trie αm σ

Monadically fold the keys and values stored in a Trie.

@[inline]
def Lean.Meta.DiscrTree.Trie.fold {σ : Type u_1} {α : Type} (initialKeys : Array Key) (f : σArray Keyασ) (init : σ) (t : Trie α) :
σ

Fold the keys and values stored in a Trie.

Equations
Instances For
    @[specialize #[]]
    partial def Lean.Meta.DiscrTree.Trie.foldValuesM {m : Type u_1 → Type u_2} {σ : Type u_1} {α : Type} [Monad m] (f : σαm σ) (init : σ) :
    Trie αm σ

    Monadically fold the values stored in a Trie.

    @[inline]
    def Lean.Meta.DiscrTree.Trie.foldValues {σ : Type u_1} {α : Type} (f : σασ) (init : σ) (t : Trie α) :
    σ

    Fold the values stored in a Trie.

    Equations
    Instances For
      partial def Lean.Meta.DiscrTree.Trie.size {α : Type} :
      Trie αNat

      The number of values stored in a Trie.

      @[inline]
      def Lean.Meta.DiscrTree.Trie.mkNode {α : Type} (vs : Array α) (cs : Array (Key × Trie α)) :
      Trie α

      Generate a trie node from values and an array of children.

      Equations
      Instances For
        @[inline]

        Inspect a trie node as an array of values and an array of children.

        Equations
        Instances For
          @[inline]

          Returns the values stored at the current trie node. Equivalent to t.asNode.1.

          Equations
          Instances For
            @[inline]

            Returns the child nodes of the current trie node. Equivalent to t.asNode.2.

            Equations
            Instances For
              @[inline]

              Checks whether a trie node is empty (no values and no children).

              This is only a check for actual trie emptiness (t.size = 0) if all operations maintain the invariant that no trie node has an empty child node.

              Equations
              Instances For
                @[inline]
                def Lean.Meta.DiscrTree.foldM {m : Type u_1 → Type u_2} {σ : Type u_1} {α : Type} [Monad m] (f : σArray Keyαm σ) (init : σ) (t : DiscrTree α) :
                m σ

                Monadically fold over the keys and values stored in a DiscrTree.

                Equations
                Instances For
                  @[inline]
                  def Lean.Meta.DiscrTree.fold {σ : Type u_1} {α : Type} (f : σArray Keyασ) (init : σ) (t : DiscrTree α) :
                  σ

                  Fold over the keys and values stored in a DiscrTree

                  Equations
                  Instances For
                    @[inline]
                    def Lean.Meta.DiscrTree.foldValuesM {m : Type u_1 → Type u_2} {σ : Type u_1} {α : Type} [Monad m] (f : σαm σ) (init : σ) (t : DiscrTree α) :
                    m σ

                    Monadically fold over the values stored in a DiscrTree.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      @[inline]
                      def Lean.Meta.DiscrTree.foldValues {σ : Type u_1} {α : Type} (f : σασ) (init : σ) (t : DiscrTree α) :
                      σ

                      Fold over the values stored in a DiscrTree.

                      Equations
                      Instances For
                        @[inline]
                        def Lean.Meta.DiscrTree.containsValueP {α : Type} (t : DiscrTree α) (f : αBool) :

                        Check for the presence of a value satisfying a predicate.

                        Equations
                        Instances For
                          @[inline]

                          Extract the values stored in a DiscrTree.

                          Equations
                          Instances For
                            @[inline]

                            Extract the keys and values stored in a DiscrTree.

                            Equations
                            Instances For
                              @[inline]

                              Get the number of values stored in a DiscrTree. O(n) in the size of the tree.

                              Equations
                              Instances For
                                @[specialize #[]]
                                partial def Lean.Meta.DiscrTree.Trie.mapArraysM {m : TypeType} [Monad m] {α β : Type} (t : Trie α) (f : Array αm (Array β)) :
                                m (Trie β)

                                Apply a monadic function to the array of values at each node in a DiscrTree. Any resulting subtrees containing no values will be pruned.

                                @[inline]
                                def Lean.Meta.DiscrTree.mapArraysM {m : TypeType} [Monad m] {α β : Type} (d : DiscrTree α) (f : Array αm (Array β)) :
                                m (DiscrTree β)

                                Apply a monadic function to the array of values at each node in a DiscrTree.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[inline]
                                  def Lean.Meta.DiscrTree.mapArrays {α β : Type} (d : DiscrTree α) (f : Array αArray β) :

                                  Apply a function to the array of values at each node in a DiscrTree.

                                  Equations
                                  Instances For