File: .lake/packages/lean4/src/lean/Lean/Meta/LazyDiscrTree.lean

full_name: Lean.Meta.LazyDiscrTree.Key.const
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Name → Nat → Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.instInhabitedKey
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Inhabited Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.fvar
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.FVarId → Nat → Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.other
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.instBEqKey
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: BEq Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.proj
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Name → Nat → Nat → Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Type

full_name: Lean.Meta.LazyDiscrTree.Key.lit
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Literal → Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.star
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.arrow
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.instReprKey
code: /--
Discrimination tree key.
-/
inductive Key where
  | const : Name → Nat → Key
  | fvar  : FVarId → Nat → Key
  | lit   : Literal → Key
  | star  : Key
  | other : Key
  | arrow : Key
  | proj  : Name → Nat → Nat → Key
  deriving Inhabited, BEq, Repr
goal: Repr Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.Key.hash
code: /-- Hash function -/
protected def hash : Key → UInt64
  
goal: Lean.Meta.LazyDiscrTree.Key → UInt64

full_name: Lean.Meta.LazyDiscrTree.Key.instHashable
code: instance : Hashable Key 
goal: Hashable Lean.Meta.LazyDiscrTree.Key

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.tmpMVarId
code: private def tmpMVarId : MVarId 
goal: Lean.MVarId

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.tmpStar
code: private def tmpStar 
goal: Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.ignoreArg
code: /--
  Returns true iff the argument should be treated as a "wildcard" by the
  discrimination tree.

  This includes proofs, instance implicit arguments, implicit arguments,
  and terms of the form `noIndexing t`

  This is a clone of `Lean.Meta.DiscrTree.ignoreArg` and mainly added to
  avoid coupling between `DiscrTree` and `LazyDiscrTree` while both are
  potentially subject to independent changes.
-/
private def ignoreArg (a : Expr) (i : Nat) (infos : Array ParamInfo) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.pushArgsAux
code: private partial def pushArgsAux (infos : Array ParamInfo) : Nat → Expr → Array Expr → MetaM (Array Expr)
  
goal: Nat → Lean.Expr → Array Lean.Expr → Lean.MetaM (Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.isNumeral
code: /--
  Returns `true` if `e` is one of the following
  - A nat literal (numeral)
  - `Nat.zero`
  - `Nat.succ x` where `isNumeral x`
  - `OfNat.ofNat _ x _` where `isNumeral x` -/
private partial def isNumeral (e : Expr) : Bool 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.toNatLit?
code: private partial def toNatLit? (e : Expr) : Option Literal 
goal: Option Lean.Literal

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.toNatLit?.loop
code: private partial def toNatLit? (e : Expr) : Option Literal 
goal: OptionT Id Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.isNatType
code: private def isNatType (e : Expr) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.isNatOffset
code: /--
  Returns `true` if `e` is one of the following
  - `Nat.add _ k` where `isNumeral k`
  - `Add.add Nat _ _ k` where `isNumeral k`
  - `HAdd.hAdd _ Nat _ _ k` where `isNumeral k`
  - `Nat.succ _`
  This function assumes `e.isAppOf fName`
-/
private def isNatOffset (fName : Name) (e : Expr) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.shouldAddAsStar
code: private def shouldAddAsStar (fName : Name) (e : Expr) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.elimLooseBVarsByBeta
code: /--
Eliminate loose bound variables via beta-reduction.

This is primarily used to reduce pi-terms `∀(x : P), T` into
non-dependend functions `P → T`.  The latter has a more specific
discrimination tree key `.arrow..` and this improves the accuracy of the
discrimination tree.

Clone of `Lean.Meta.DiscrTree.elimLooseBVarsByBeta`.  See it for more
discussion.
-/
private def elimLooseBVarsByBeta (e : Expr) : CoreM Expr 
goal: Lean.CoreM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.getKeyArgs
code: private def getKeyArgs (e : Expr) (isMatch root : Bool) (config : WhnfCoreConfig) :
    MetaM (Key × Array Expr) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.Key × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchClone.getMatchKeyArgs
code: private abbrev getMatchKeyArgs (e : Expr) (root : Bool) (config : WhnfCoreConfig) :
    MetaM (Key × Array Expr) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.Key × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.LazyEntry
code: /--
An unprocessed entry in the lazy discrimination tree.
-/
private abbrev LazyEntry α 
goal: Type u_1

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.TrieIndex
code: /--
Index identifying trie in a discrimination tree.
-/
@[reducible]
private def TrieIndex 
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.children
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Lean.HashMap Lean.Meta.LazyDiscrTree.Key Lean.Meta.LazyDiscrTree.TrieIndex

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.pending
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Array (Lean.Meta.LazyDiscrTree.LazyEntry α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Type

full_name: Lean.Meta.LazyDiscrTree.instInhabitedTrie
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: {a : Type} → Inhabited (Lean.Meta.LazyDiscrTree.Trie a)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.star
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Lean.Meta.LazyDiscrTree.TrieIndex

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.node
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Lean.Meta.LazyDiscrTree.Trie α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.values
code: /--
Discrimination tree trie. See `LazyDiscrTree`.
-/
private structure Trie (α : Type) where
  node ::
    /-- Values for matches ending at this trie. -/
    values : Array α
    /-- Index of trie matching star. -/
    star : TrieIndex
    /-- Following matches based on key of trie. -/
    children : HashMap Key TrieIndex
    /-- Lazy entries at this trie that are not processed. -/
    pending : Array (LazyEntry α) := #[]
  deriving Inhabited
goal: Array α

full_name: Lean.Meta.LazyDiscrTree.instEmptyCollectionTrie
code: instance : EmptyCollection (Trie α) 
goal: EmptyCollection (Lean.Meta.LazyDiscrTree.Trie α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.Trie.pushPending
code: /-- Push lazy entry to trie. -/
private def Trie.pushPending : Trie α → LazyEntry α → Trie α

goal: Lean.Meta.LazyDiscrTree.Trie α → Lean.Meta.LazyDiscrTree.LazyEntry α → Lean.Meta.LazyDiscrTree.Trie α

full_name: Lean.Meta.LazyDiscrTree.tries
code: /--
`LazyDiscrTree` is a variant of the discriminator tree datatype
`DiscrTree` in Lean core that is designed to be efficiently
initializable with a large number of patterns.  This is useful
in contexts such as searching an entire Lean environment for
expressions that match a pattern.

Lazy discriminator trees achieve good performance by minimizing
the amount of work that is done up front to build the discriminator
tree.  When first adding patterns to the tree, only the root
discriminator key is computed and processing the remaining
terms is deferred until demanded by a match.
-/
structure LazyDiscrTree (α : Type) where
  /-- Configuration for normalization. -/
  config : Lean.Meta.WhnfCoreConfig := {}
  /-- Backing array of trie entries.  Should be owned by this trie. -/
  tries : Array (LazyDiscrTree.Trie α) := #[default]
  /-- Map from discriminator trie roots to the index. -/
  roots : Lean.HashMap LazyDiscrTree.Key LazyDiscrTree.TrieIndex := {}
goal: Array (Lean.Meta.LazyDiscrTree.Trie α)

full_name: Lean.Meta.LazyDiscrTree.config
code: /--
`LazyDiscrTree` is a variant of the discriminator tree datatype
`DiscrTree` in Lean core that is designed to be efficiently
initializable with a large number of patterns.  This is useful
in contexts such as searching an entire Lean environment for
expressions that match a pattern.

Lazy discriminator trees achieve good performance by minimizing
the amount of work that is done up front to build the discriminator
tree.  When first adding patterns to the tree, only the root
discriminator key is computed and processing the remaining
terms is deferred until demanded by a match.
-/
structure LazyDiscrTree (α : Type) where
  /-- Configuration for normalization. -/
  config : Lean.Meta.WhnfCoreConfig := {}
  /-- Backing array of trie entries.  Should be owned by this trie. -/
  tries : Array (LazyDiscrTree.Trie α) := #[default]
  /-- Map from discriminator trie roots to the index. -/
  roots : Lean.HashMap LazyDiscrTree.Key LazyDiscrTree.TrieIndex := {}
goal: Lean.Meta.WhnfCoreConfig

full_name: Lean.Meta.LazyDiscrTree
code: /--
`LazyDiscrTree` is a variant of the discriminator tree datatype
`DiscrTree` in Lean core that is designed to be efficiently
initializable with a large number of patterns.  This is useful
in contexts such as searching an entire Lean environment for
expressions that match a pattern.

Lazy discriminator trees achieve good performance by minimizing
the amount of work that is done up front to build the discriminator
tree.  When first adding patterns to the tree, only the root
discriminator key is computed and processing the remaining
terms is deferred until demanded by a match.
-/
structure LazyDiscrTree (α : Type) where
  /-- Configuration for normalization. -/
  config : Lean.Meta.WhnfCoreConfig := {}
  /-- Backing array of trie entries.  Should be owned by this trie. -/
  tries : Array (LazyDiscrTree.Trie α) := #[default]
  /-- Map from discriminator trie roots to the index. -/
  roots : Lean.HashMap LazyDiscrTree.Key LazyDiscrTree.TrieIndex := {}
goal: Type

full_name: Lean.Meta.LazyDiscrTree.roots
code: /--
`LazyDiscrTree` is a variant of the discriminator tree datatype
`DiscrTree` in Lean core that is designed to be efficiently
initializable with a large number of patterns.  This is useful
in contexts such as searching an entire Lean environment for
expressions that match a pattern.

Lazy discriminator trees achieve good performance by minimizing
the amount of work that is done up front to build the discriminator
tree.  When first adding patterns to the tree, only the root
discriminator key is computed and processing the remaining
terms is deferred until demanded by a match.
-/
structure LazyDiscrTree (α : Type) where
  /-- Configuration for normalization. -/
  config : Lean.Meta.WhnfCoreConfig := {}
  /-- Backing array of trie entries.  Should be owned by this trie. -/
  tries : Array (LazyDiscrTree.Trie α) := #[default]
  /-- Map from discriminator trie roots to the index. -/
  roots : Lean.HashMap LazyDiscrTree.Key LazyDiscrTree.TrieIndex := {}
goal: Lean.HashMap Lean.Meta.LazyDiscrTree.Key Lean.Meta.LazyDiscrTree.TrieIndex

full_name: Lean.Meta.LazyDiscrTree.instInhabited
code: instance : Inhabited (LazyDiscrTree α) 
goal: Inhabited (Lean.Meta.LazyDiscrTree α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.pushArgs
code: /--
Specialization of Lean.Meta.DiscrTree.pushArgs
-/
private def pushArgs (root : Bool) (todo : Array Expr) (e : Expr) (config : WhnfCoreConfig) :
    MetaM (Key × Array Expr) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.Key × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.initCapacity
code: /-- Initial capacity for key and todo vector. -/
private def initCapacity 
goal: Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.rootKey
code: /--
Get the root key and rest of terms of an expression using the specified config.
-/
private def rootKey (cfg: WhnfCoreConfig) (e : Expr) : MetaM (Key × Array Expr) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.Key × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.buildPath
code: private partial def buildPath (op : Bool → Array Expr → Expr → MetaM (Key × Array Expr)) (root : Bool) (todo : Array Expr) (keys : Array Key) : MetaM (Array Key) 
goal: Lean.MetaM (Array Lean.Meta.LazyDiscrTree.Key)

full_name: Lean.Meta.LazyDiscrTree.patternPath
code: /--
Create a key path from an expression using the function used for patterns.

This differs from Lean.Meta.DiscrTree.mkPath and targetPath in that the expression
should uses free variables rather than meta-variables for holes.
-/
def patternPath (e : Expr) (config : WhnfCoreConfig) : MetaM (Array Key) 
goal: Lean.MetaM (Array Lean.Meta.LazyDiscrTree.Key)

full_name: Lean.Meta.LazyDiscrTree.targetPath
code: /--
Create a key path from an expression we are matching against.

This should have mvars instantiated where feasible.
-/
def targetPath (e : Expr) (config : WhnfCoreConfig) : MetaM (Array Key) 
goal: Lean.MetaM (Array Lean.Meta.LazyDiscrTree.Key)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchM
code: @[reducible]
private def MatchM α 
goal: Type → Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.runMatch
code: private def runMatch (d : LazyDiscrTree α) (m : MatchM α β)  : MetaM (β × LazyDiscrTree α) 
goal: Lean.MetaM (β × Lean.Meta.LazyDiscrTree α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.setTrie
code: private def setTrie (i : TrieIndex) (v : Trie α) : MatchM α Unit 
goal: Lean.Meta.LazyDiscrTree.MatchM α Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.newTrie
code: /-- Create a new trie with the given lazy entry. -/
private def newTrie [Monad m] [MonadState (Array (Trie α)) m] (e : LazyEntry α) : m TrieIndex 
goal: m Lean.Meta.LazyDiscrTree.TrieIndex

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.addLazyEntryToTrie
code: /-- Add a lazy entry to an existing trie. -/
private def addLazyEntryToTrie (i:TrieIndex) (e : LazyEntry α) : MatchM α Unit 
goal: Lean.Meta.LazyDiscrTree.MatchM α Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.evalLazyEntry
code: private def evalLazyEntry (config : WhnfCoreConfig)
    (p : Array α × TrieIndex × HashMap Key TrieIndex)
    (entry : LazyEntry α)
    : MatchM α (Array α × TrieIndex × HashMap Key TrieIndex) 
goal: Lean.Meta.LazyDiscrTree.MatchM α
  (Array α ×
    Lean.Meta.LazyDiscrTree.TrieIndex × Lean.HashMap Lean.Meta.LazyDiscrTree.Key Lean.Meta.LazyDiscrTree.TrieIndex)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.evalLazyEntries
code: /--
This evaluates all lazy entries in a trie and updates `values`, `starIdx`, and `children`
accordingly.
-/
private partial def evalLazyEntries (config : WhnfCoreConfig)
    (values : Array α) (starIdx : TrieIndex) (children : HashMap Key TrieIndex)
    (entries : Array (LazyEntry α)) :
    MatchM α (Array α × TrieIndex × HashMap Key TrieIndex) 
goal: Lean.Meta.LazyDiscrTree.MatchM α
  (Array α ×
    Lean.Meta.LazyDiscrTree.TrieIndex × Lean.HashMap Lean.Meta.LazyDiscrTree.Key Lean.Meta.LazyDiscrTree.TrieIndex)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.evalNode
code: private def evalNode (c : TrieIndex) :
    MatchM α (Array α × TrieIndex × HashMap Key TrieIndex) 
goal: Lean.Meta.LazyDiscrTree.MatchM α
  (Array α ×
    Lean.Meta.LazyDiscrTree.TrieIndex × Lean.HashMap Lean.Meta.LazyDiscrTree.Key Lean.Meta.LazyDiscrTree.TrieIndex)

full_name: Lean.Meta.LazyDiscrTree.dropKeyAux
code: def dropKeyAux (next : TrieIndex) (rest : List Key) :
    MatchM α Unit 
goal: Lean.Meta.LazyDiscrTree.MatchM α Unit

full_name: Lean.Meta.LazyDiscrTree.dropKey
code: /--
This drops a specific key from the lazy discrimination tree so that
all the entries matching that key exactly are removed.
-/
def dropKey (t : LazyDiscrTree α) (path : List LazyDiscrTree.Key) : MetaM (LazyDiscrTree α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.MatchResult.elts
code: /--
A match result contains the terms formed from matching a term against
patterns in the discrimination tree.

-/
structure MatchResult (α : Type) where
  /--
  The elements in the match result.

  The top-level array represents an array from `score` values to the
  results with that score. A `score` is the number of non-star matches
  in a pattern against the term, and thus bounded by the size of the
  term being matched against.  The elements of this array are themselves
  arrays of non-empty arrays so that we can defer concatenating results until
  needed.
  -/
  elts : Array (Array (Array α)) := #[]
goal: Array (Array (Array α))

full_name: Lean.Meta.LazyDiscrTree.MatchResult
code: /--
A match result contains the terms formed from matching a term against
patterns in the discrimination tree.

-/
structure MatchResult (α : Type) where
  /--
  The elements in the match result.

  The top-level array represents an array from `score` values to the
  results with that score. A `score` is the number of non-star matches
  in a pattern against the term, and thus bounded by the size of the
  term being matched against.  The elements of this array are themselves
  arrays of non-empty arrays so that we can defer concatenating results until
  needed.
  -/
  elts : Array (Array (Array α)) := #[]
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchResult.push.loop
code: private def push (r : MatchResult α) (score : Nat) (e : Array α) : MatchResult α 
goal: Lean.Meta.LazyDiscrTree.MatchResult α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.MatchResult.push
code: private def push (r : MatchResult α) (score : Nat) (e : Array α) : MatchResult α 
goal: Lean.Meta.LazyDiscrTree.MatchResult α

full_name: Lean.Meta.LazyDiscrTree.MatchResult.size
code: /--
Number of elements in result
-/
partial def size (mr : MatchResult α) : Nat 
goal: Nat

full_name: Lean.Meta.LazyDiscrTree.MatchResult.appendResultsAux
code: /--
Append results to array
-/
@[specialize]
partial def appendResultsAux (mr : MatchResult α) (a : Array β) (f : Nat → α → β) : Array β 
goal: Array β

full_name: Lean.Meta.LazyDiscrTree.MatchResult.appendResults
code: partial def appendResults (mr : MatchResult α) (a : Array α) : Array α 
goal: Array α

full_name: Lean.Meta.LazyDiscrTree.PartialMatch.c
code: structure PartialMatch where
  -- Remaining terms to match
  todo : Array Expr
  -- Number of non-star matches so far.
  score : Nat
  -- Trie to match next
  c : TrieIndex
  deriving Inhabited
goal: Lean.Meta.LazyDiscrTree.TrieIndex

full_name: Lean.Meta.LazyDiscrTree.PartialMatch.todo
code: structure PartialMatch where
  -- Remaining terms to match
  todo : Array Expr
  -- Number of non-star matches so far.
  score : Nat
  -- Trie to match next
  c : TrieIndex
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.LazyDiscrTree.PartialMatch.score
code: structure PartialMatch where
  -- Remaining terms to match
  todo : Array Expr
  -- Number of non-star matches so far.
  score : Nat
  -- Trie to match next
  c : TrieIndex
  deriving Inhabited
goal: Nat

full_name: Lean.Meta.LazyDiscrTree.instInhabitedPartialMatch
code: structure PartialMatch where
  -- Remaining terms to match
  todo : Array Expr
  -- Number of non-star matches so far.
  score : Nat
  -- Trie to match next
  c : TrieIndex
  deriving Inhabited
goal: Inhabited Lean.Meta.LazyDiscrTree.PartialMatch

full_name: Lean.Meta.LazyDiscrTree.PartialMatch
code: structure PartialMatch where
  -- Remaining terms to match
  todo : Array Expr
  -- Number of non-star matches so far.
  score : Nat
  -- Trie to match next
  c : TrieIndex
  deriving Inhabited
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.getMatchLoop
code: /--
Evaluate all partial matches and add resulting matches to `MatchResult`.

The partial matches are stored in an array that is used as a stack. When adding
multiple partial matches to explore next, to ensure the order of results matches
user expectations, this code must add paths we want to prioritize and return
results earlier are added last.
-/
private partial def getMatchLoop (cases : Array PartialMatch) (result : MatchResult α) : MatchM α (MatchResult α) 
goal: Lean.Meta.LazyDiscrTree.MatchM α (Lean.Meta.LazyDiscrTree.MatchResult α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.getStarResult
code: private def getStarResult (root : Lean.HashMap Key TrieIndex) : MatchM α (MatchResult α) 
goal: Lean.Meta.LazyDiscrTree.MatchM α (Lean.Meta.LazyDiscrTree.MatchResult α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.pushRootCase
code: private def pushRootCase (r : Lean.HashMap Key TrieIndex) (k : Key) (args : Array Expr)
    (cases : Array PartialMatch) : Array PartialMatch 
goal: Array Lean.Meta.LazyDiscrTree.PartialMatch

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.getMatchCore
code: /--
  Find values that match `e` in `root`.
-/
private def getMatchCore (root : Lean.HashMap Key TrieIndex) (e : Expr) :
    MatchM α (MatchResult α) 
goal: Lean.Meta.LazyDiscrTree.MatchM α (Lean.Meta.LazyDiscrTree.MatchResult α)

full_name: Lean.Meta.LazyDiscrTree.getMatch
code: /--
  Find values that match `e` in `d`.

  The results are ordered so that the longest matches in terms of number of
  non-star keys are first with ties going to earlier operators first.
-/
def getMatch (d : LazyDiscrTree α) (e : Expr) : MetaM (MatchResult α × LazyDiscrTree α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.MatchResult α × Lean.Meta.LazyDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.instInhabitedPreDiscrTree
code: /--
Structure for quickly initializing a lazy discrimination tree with a large number
of elements using concurrent functions for generating entries.
-/
private structure PreDiscrTree (α : Type) where
  /-- Maps keys to index in tries array. -/
  roots : HashMap Key Nat := {}
  /-- Lazy entries for root of trie. -/
  tries : Array (Array (LazyEntry α)) := #[]
  deriving Inhabited
goal: {a : Type} → Inhabited (Lean.Meta.LazyDiscrTree.PreDiscrTree a)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree
code: /--
Structure for quickly initializing a lazy discrimination tree with a large number
of elements using concurrent functions for generating entries.
-/
private structure PreDiscrTree (α : Type) where
  /-- Maps keys to index in tries array. -/
  roots : HashMap Key Nat := {}
  /-- Lazy entries for root of trie. -/
  tries : Array (Array (LazyEntry α)) := #[]
  deriving Inhabited
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree.roots
code: /--
Structure for quickly initializing a lazy discrimination tree with a large number
of elements using concurrent functions for generating entries.
-/
private structure PreDiscrTree (α : Type) where
  /-- Maps keys to index in tries array. -/
  roots : HashMap Key Nat := {}
  /-- Lazy entries for root of trie. -/
  tries : Array (Array (LazyEntry α)) := #[]
  deriving Inhabited
goal: Lean.HashMap Lean.Meta.LazyDiscrTree.Key Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree.tries
code: /--
Structure for quickly initializing a lazy discrimination tree with a large number
of elements using concurrent functions for generating entries.
-/
private structure PreDiscrTree (α : Type) where
  /-- Maps keys to index in tries array. -/
  roots : HashMap Key Nat := {}
  /-- Lazy entries for root of trie. -/
  tries : Array (Array (LazyEntry α)) := #[]
  deriving Inhabited
goal: Array (Array (Lean.Meta.LazyDiscrTree.LazyEntry α))

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree.modifyAt
code: private def modifyAt (d : PreDiscrTree α) (k : Key)
    (f : Array (LazyEntry α) → Array (LazyEntry α)) : PreDiscrTree α 
goal: Lean.Meta.LazyDiscrTree.PreDiscrTree α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree.push
code: /-- Add an entry to the pre-discrimination tree.-/
private def push (d : PreDiscrTree α) (k : Key) (e : LazyEntry α) : PreDiscrTree α 
goal: Lean.Meta.LazyDiscrTree.PreDiscrTree α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.PreDiscrTree.toLazy
code: /-- Convert a pre-discrimination tree to a lazy discrimination tree. -/
private def toLazy (d : PreDiscrTree α) (config : WhnfCoreConfig := {}) : LazyDiscrTree α 
goal: Lean.Meta.LazyDiscrTree α

full_name: Lean.Meta.LazyDiscrTree.PreDiscrTree.append
code: /-- Merge two discrimination trees. -/
protected def append (x y : PreDiscrTree α) : PreDiscrTree α 
goal: Lean.Meta.LazyDiscrTree.PreDiscrTree α

full_name: Lean.Meta.LazyDiscrTree.PreDiscrTree.instAppendPreDiscrTree
code: instance : Append (PreDiscrTree α) 
goal: Append (Lean.Meta.LazyDiscrTree.PreDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.InitEntry.entry
code: /-- Initial entry in lazy discrimination tree -/
structure InitEntry (α : Type) where
  /-- Return root key for an entry. -/
  key : Key
  /-- Returns rest of entry for later insertion. -/
  entry : LazyEntry α
goal: Lean.Meta.LazyDiscrTree.LazyEntry α

full_name: Lean.Meta.LazyDiscrTree.InitEntry
code: /-- Initial entry in lazy discrimination tree -/
structure InitEntry (α : Type) where
  /-- Return root key for an entry. -/
  key : Key
  /-- Returns rest of entry for later insertion. -/
  entry : LazyEntry α
goal: Type

full_name: Lean.Meta.LazyDiscrTree.InitEntry.key
code: /-- Initial entry in lazy discrimination tree -/
structure InitEntry (α : Type) where
  /-- Return root key for an entry. -/
  key : Key
  /-- Returns rest of entry for later insertion. -/
  entry : LazyEntry α
goal: Lean.Meta.LazyDiscrTree.Key

full_name: Lean.Meta.LazyDiscrTree.InitEntry.fromExpr
code: /--
Constructs an initial entry from an expression and value.
-/
def fromExpr (expr : Expr) (value : α) (config : WhnfCoreConfig := {}) : MetaM (InitEntry α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.InitEntry α)

full_name: Lean.Meta.LazyDiscrTree.InitEntry.mkSubEntry
code: /--
Creates an entry for a subterm of an initial entry.

This is slightly more efficient than using `fromExpr` on subterms since it avoids a redundant call
to `whnf`.
-/
def mkSubEntry (e : InitEntry α) (idx : Nat) (value : α) (config : WhnfCoreConfig := {}) :
    MetaM (InitEntry α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.InitEntry α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportFailure.module
code: /-- Information about a failed import. -/
private structure ImportFailure where
  /-- Module with constant that import failed on. -/
  module  : Name
  /-- Constant that import failed on. -/
  const   : Name
  /-- Exception that triggers error. -/
  exception : Exception
goal: Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportFailure
code: /-- Information about a failed import. -/
private structure ImportFailure where
  /-- Module with constant that import failed on. -/
  module  : Name
  /-- Constant that import failed on. -/
  const   : Name
  /-- Exception that triggers error. -/
  exception : Exception
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportFailure.const
code: /-- Information about a failed import. -/
private structure ImportFailure where
  /-- Module with constant that import failed on. -/
  module  : Name
  /-- Constant that import failed on. -/
  const   : Name
  /-- Exception that triggers error. -/
  exception : Exception
goal: Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportFailure.exception
code: /-- Information about a failed import. -/
private structure ImportFailure where
  /-- Module with constant that import failed on. -/
  module  : Name
  /-- Constant that import failed on. -/
  const   : Name
  /-- Exception that triggers error. -/
  exception : Exception
goal: Lean.Exception

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportData.errors
code: /-- Information generation from imported modules. -/
private structure ImportData where
  errors : IO.Ref (Array ImportFailure)
goal: IO.Ref (Array Lean.Meta.LazyDiscrTree.ImportFailure)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportData
code: /-- Information generation from imported modules. -/
private structure ImportData where
  errors : IO.Ref (Array ImportFailure)
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.ImportData.new
code: private def ImportData.new : BaseIO ImportData 
goal: BaseIO Lean.Meta.LazyDiscrTree.ImportData

full_name: Lean.Meta.LazyDiscrTree.Cache
code: structure Cache where
  ngen : NameGenerator
  core : Lean.Core.Cache
  meta : Lean.Meta.Cache
goal: Type

full_name: Lean.Meta.LazyDiscrTree.Cache.meta
code: structure Cache where
  ngen : NameGenerator
  core : Lean.Core.Cache
  meta : Lean.Meta.Cache
goal: Lean.Meta.Cache

full_name: Lean.Meta.LazyDiscrTree.Cache.ngen
code: structure Cache where
  ngen : NameGenerator
  core : Lean.Core.Cache
  meta : Lean.Meta.Cache
goal: Lean.NameGenerator

full_name: Lean.Meta.LazyDiscrTree.Cache.core
code: structure Cache where
  ngen : NameGenerator
  core : Lean.Core.Cache
  meta : Lean.Meta.Cache
goal: Lean.Core.Cache

full_name: Lean.Meta.LazyDiscrTree.Cache.empty
code: def Cache.empty (ngen : NameGenerator) : Cache 
goal: Lean.Meta.LazyDiscrTree.Cache

full_name: Lean.Meta.LazyDiscrTree.blacklistInsertion
code: def blacklistInsertion (env : Environment) (declName : Name) : Bool 
goal: Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.addConstImportData
code: private def addConstImportData
    (cctx : Core.Context)
    (env : Environment)
    (modName : Name)
    (d : ImportData)
    (cacheRef : IO.Ref Cache)
    (tree : PreDiscrTree α)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (name : Name) (constInfo : ConstantInfo) : BaseIO (PreDiscrTree α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.PreDiscrTree α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.InitResults.errors
code: /--
Contains the pre discrimination tree and any errors occuring during initialization of
the library search tree.
-/
private structure InitResults (α : Type) where
  tree  : PreDiscrTree α := {}
  errors : Array ImportFailure := #[]
goal: Array Lean.Meta.LazyDiscrTree.ImportFailure

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.InitResults.tree
code: /--
Contains the pre discrimination tree and any errors occuring during initialization of
the library search tree.
-/
private structure InitResults (α : Type) where
  tree  : PreDiscrTree α := {}
  errors : Array ImportFailure := #[]
goal: Lean.Meta.LazyDiscrTree.PreDiscrTree α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.InitResults
code: /--
Contains the pre discrimination tree and any errors occuring during initialization of
the library search tree.
-/
private structure InitResults (α : Type) where
  tree  : PreDiscrTree α := {}
  errors : Array ImportFailure := #[]
goal: Type

full_name: Lean.Meta.LazyDiscrTree.instInhabitedInitResults
code: instance : Inhabited (InitResults α) 
goal: Inhabited (Lean.Meta.LazyDiscrTree.InitResults α)

full_name: Lean.Meta.LazyDiscrTree.InitResults.append
code: /-- Combine two initial results. -/
protected def append (x y : InitResults α) : InitResults α 
goal: Lean.Meta.LazyDiscrTree.InitResults α

full_name: Lean.Meta.LazyDiscrTree.InitResults.instAppendInitResults
code: instance : Append (InitResults α) 
goal: Append (Lean.Meta.LazyDiscrTree.InitResults α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.toFlat
code: private def toFlat (d : ImportData) (tree : PreDiscrTree α) :
    BaseIO (InitResults α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.InitResults α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.loadImportedModule
code: private partial def loadImportedModule
    (cctx : Core.Context)
    (env : Environment)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (d : ImportData)
    (cacheRef : IO.Ref Cache)
    (tree : PreDiscrTree α)
    (mname : Name)
    (mdata : ModuleData)
    (i : Nat := 0) : BaseIO (PreDiscrTree α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.PreDiscrTree α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.createImportedEnvironmentSeq
code: private def createImportedEnvironmentSeq (cctx : Core.Context) (ngen : NameGenerator) (env : Environment)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (start stop : Nat) : BaseIO (InitResults α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.InitResults α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.createImportedEnvironmentSeq.go
code: private def createImportedEnvironmentSeq (cctx : Core.Context) (ngen : NameGenerator) (env : Environment)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (start stop : Nat) : BaseIO (InitResults α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.InitResults α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.combineGet
code: /-- Get the results of each task and merge using combining function -/
private def combineGet [Append α] (z : α) (tasks : Array (Task α)) : α 
goal: α

full_name: Lean.Meta.LazyDiscrTree.getChildNgen
code: def getChildNgen [Monad M] [MonadNameGenerator M] : M NameGenerator 
goal: M Lean.NameGenerator

full_name: Lean.Meta.LazyDiscrTree.createLocalPreDiscrTree
code: def createLocalPreDiscrTree
    (cctx : Core.Context)
    (ngen : NameGenerator)
    (env : Environment)
    (d : ImportData)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α))) :
    BaseIO (PreDiscrTree α) 
goal: BaseIO (Lean.Meta.LazyDiscrTree.PreDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.dropKeys
code: def dropKeys (t : LazyDiscrTree α) (keys : List (List LazyDiscrTree.Key)) : MetaM (LazyDiscrTree α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.logImportFailure
code: def logImportFailure [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] (f : ImportFailure) : m Unit 
goal: m Unit

full_name: Lean.Meta.LazyDiscrTree.createImportedDiscrTree.go
code: /-- Create a discriminator tree for imported environment. -/
def createImportedDiscrTree [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] [MonadLiftT BaseIO m]
    (cctx : Core.Context) (ngen : NameGenerator) (env : Environment)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (constantsPerTask : Nat := 1000) :
    m (LazyDiscrTree α) 
goal: m (Array (Task (Lean.Meta.LazyDiscrTree.InitResults α)))

full_name: Lean.Meta.LazyDiscrTree.createImportedDiscrTree
code: /-- Create a discriminator tree for imported environment. -/
def createImportedDiscrTree [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] [MonadLiftT BaseIO m]
    (cctx : Core.Context) (ngen : NameGenerator) (env : Environment)
    (act : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (constantsPerTask : Nat := 1000) :
    m (LazyDiscrTree α) 
goal: m (Lean.Meta.LazyDiscrTree α)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.LazyDiscrTree.0.Lean.Meta.LazyDiscrTree.createTreeCtx
code: /-- Creates the core context used for initializing a tree using the current context. -/
private def createTreeCtx (ctx : Core.Context) : Core.Context 
goal: Lean.Core.Context

full_name: Lean.Meta.LazyDiscrTree.findImportMatches
code: def findImportMatches
      (ext : EnvExtension (IO.Ref (Option (LazyDiscrTree α))))
      (addEntry : Name → ConstantInfo → MetaM (Array (InitEntry α)))
      (droppedKeys : List (List LazyDiscrTree.Key) := [])
      (constantsPerTask : Nat := 1000)
      (ty : Expr) : MetaM (MatchResult α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.MatchResult α)

full_name: Lean.Meta.LazyDiscrTree.ModuleDiscrTreeRef.ref
code: /--
A discriminator tree for the current module's declarations only.

Note. We use different discriminator trees for imported and current module
declarations since imported declarations are typically much more numerous but
not changed after the environment is created.
-/
structure ModuleDiscrTreeRef (α : Type _)  where
  ref : IO.Ref (LazyDiscrTree α)
goal: IO.Ref (Lean.Meta.LazyDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.ModuleDiscrTreeRef
code: /--
A discriminator tree for the current module's declarations only.

Note. We use different discriminator trees for imported and current module
declarations since imported declarations are typically much more numerous but
not changed after the environment is created.
-/
structure ModuleDiscrTreeRef (α : Type _)  where
  ref : IO.Ref (LazyDiscrTree α)
goal: Type

full_name: Lean.Meta.LazyDiscrTree.createModuleDiscrTree
code: /-- Create a discriminator tree for current module declarations. -/
def createModuleDiscrTree
    (entriesForConst : Name → ConstantInfo → MetaM (Array (InitEntry α))) :
    CoreM (LazyDiscrTree α) 
goal: Lean.CoreM (Lean.Meta.LazyDiscrTree α)

full_name: Lean.Meta.LazyDiscrTree.createModuleTreeRef
code: /--
Creates reference for lazy discriminator tree that only contains this module's definitions.
-/
def createModuleTreeRef (entriesForConst : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (droppedKeys : List (List LazyDiscrTree.Key)) : MetaM (ModuleDiscrTreeRef α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.ModuleDiscrTreeRef α)

full_name: Lean.Meta.LazyDiscrTree.findModuleMatches
code: /--
Returns candidates from this module in this module that match the expression.

* `moduleRef` is a references to a lazy discriminator tree only containing
this module's definitions.
-/
def findModuleMatches (moduleRef : ModuleDiscrTreeRef α) (ty : Expr) : MetaM (MatchResult α) 
goal: Lean.MetaM (Lean.Meta.LazyDiscrTree.MatchResult α)

full_name: Lean.Meta.LazyDiscrTree.findMatchesExt
code: /--
`findMatchesExt` searches for entries in a lazily initialized discriminator tree.

It provides some additional capabilities beyond `findMatches` to adjust results
based on priority and cache module declarations

* `modulesTreeRef` points to the discriminator tree for local environment.
  Used for caching and created by `createLocalTree`.
* `ext` should be an environment extension with an IO.Ref for caching the import lazy
   discriminator tree.
* `addEntry` is the function for creating discriminator tree entries from constants.
* `droppedKeys` contains keys we do not want to consider when searching for matches.
  It is used for dropping very general keys.
* `constantsPerTask` stores number of constants in imported modules used to
  decide when to create new task.
* `adjustResult` takes the priority and value to produce a final result.
* `ty` is the expression type.
-/
def findMatchesExt
    (moduleTreeRef : ModuleDiscrTreeRef α)
    (ext : EnvExtension (IO.Ref (Option (LazyDiscrTree α))))
    (addEntry : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (droppedKeys : List (List LazyDiscrTree.Key) := [])
    (constantsPerTask : Nat := 1000)
    (adjustResult : Nat → α → β)
    (ty : Expr) : MetaM (Array β) 
goal: Lean.MetaM (Array β)

full_name: Lean.Meta.LazyDiscrTree.findMatches
code: /--
`findMatches` searches for entries in a lazily initialized discriminator tree.

* `ext` should be an environment extension with an IO.Ref for caching the import lazy
   discriminator tree.
* `addEntry` is the function for creating discriminator tree entries from constants.
* `droppedKeys` contains keys we do not want to consider when searching for matches.
  It is used for dropping very general keys.
-/
def findMatches (ext : EnvExtension (IO.Ref (Option (LazyDiscrTree α))))
    (addEntry : Name → ConstantInfo → MetaM (Array (InitEntry α)))
    (droppedKeys : List (List LazyDiscrTree.Key) := [])
    (constantsPerTask : Nat := 1000)
    (ty : Expr) : MetaM (Array α) 
goal: Lean.MetaM (Array α)