Documentation

Mathlib.Tactic.FunProp.RefinedDiscrTree

RefinedDiscrTree discrimination tree with refined indexing #

We define discrimination trees for the purpose of unifying local expressions with library results.

This implementation is based on the DiscrTree in Lean. I document here what is not in the original.

Discrimination tree key.

Instances For

    Constructor index as a help for ordering Key. Note that the index of the star pattern is 0, so that when looking up in a Trie, we can look at the start of the sorted array for all .star patterns.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Return the number of arguments that the Key takes.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Discrimination tree trie. See RefinedDiscrTree.

        Instances For
          Equations

          Trie constructor for a single value.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Return the values from a Trie α, assuming that it is a leaf

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Return the children of a Trie α, assuming that it is not a leaf. The result is sorted by the Key's

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • Mathlib.Meta.FunProp.RefinedDiscrTree.instToFormatTrie = { format := Mathlib.Meta.FunProp.RefinedDiscrTree.Trie.format }

                Discrimination tree. It is an index from expressions to values of type α.

                Instances For
                  Equations
                  • Mathlib.Meta.FunProp.RefinedDiscrTree.instInhabitedRefinedDiscrTree = { default := { root := default } }
                  Equations
                  • Mathlib.Meta.FunProp.RefinedDiscrTree.instToFormatRefinedDiscrTree = { format := Mathlib.Meta.FunProp.RefinedDiscrTree.RefinedDiscrTree.format }

                  Return the size of the DTExpr. This is used for calculating the matching score when two expressions are equal. The score is not incremented at a lambda, which is so that the expressions ∀ x, p[x] and ∃ x, p[x] get the same size.

                  Check whether the expression is represented by Key.star and has arg as an argument.

                  Equations
                  Instances For

                    If e is of the form (fun x₀ ... xₙ => b y₀ ... yₙ), where each yᵢ has a metavariable head with xᵢ as an argument, then return some b. Otherwise, return none.

                    Equations
                    Instances For

                      If e is of the form (fun x₁ ... xₙ => b y₁ ... yₙ), then introduce variables for x₁, ..., xₙ, instantiate these in b, and run k on b.

                      Return the encoding of e as a DTExpr. If root = false, then e is a strict sub expression of the original expression.

                      Introduce a bound variable of type domain to the context, instantiate it in e, and then return all encodings of e as a DTExpr

                      Return all encodings of e as a DTExpr, taking possible η-reductions into account. If root = false, then e is a strict sub expression of the original expression.

                      Introduce a bound variable of type domain to the context, instantiate it in e, and then return all encodings of e as a DTExpr

                      Return the encoding of e as a DTExpr. The argument fvarInContext allows you to specify which free variables in e will still be in the context when the RefinedDiscrTree is being used for lookup. It should return true only if the RefinedDiscrTree is build and used locally.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Similar to mkDTExpr. Return all encodings of e as a DTExpr, taking possible η-reductions into account.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Make discr tree path for expression e.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Insert the value v at index keys : Array Key in a RefinedDiscrTree.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Insert the value v at index e : Expr in a RefinedDiscrTree. The argument fvarInContext allows you to specify which free variables in e will still be in the context when the RefinedDiscrTree is being used for lookup. It should return true only if the RefinedDiscrTree is build and used locally.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For

                                If k is a key in children, return the corresponding Trie α. Otherwise return none.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Return the possible Trie α that match with anything. We add 1 to the matching score when the key equals .opaque, since this pattern is "harder" to match with.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For

                                    Return the possible Trie α that come from a Key.star, while keeping track of the Key.star assignments.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Return the results from the RefinedDiscrTree that match the given expression, together with their matching scores, in decreasing order of score.

                                      Each entry of type Array α × Nat corresponds to one pattern.

                                      If unify := false, then metavariables in e are treated as opaque variables. This is for when you don't want the matched keys to instantiate metavariables in e.

                                      If allowRootStar := false, then we don't allow e or the matched key in d to be a star pattern.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

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

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

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For