Documentation

Mathlib.Lean.Meta.RefinedDiscrTree.Encode

Encoding an Expr as a sequence of Keys #

We compute the encoding of an expression in a lazy way. This means computing only one Key at a time and storing the state of the remaining computation in a LazyEntry.

Each step is computed by evalLazyEntryWithEta : LazyEntry → MetaM (Option (List (Key × LazyEntry))). It returns none when the last Key has already been reached.

The first step, which is used when initializing the tree, is computed by initializeLazyEntryWithEta.

To compute all the keys at once, we have

@[inline]

Encode e as a sequence of keys, computing only the first Key.

Equations
    Instances For

      Encode e as a sequence of keys, computing only the first Key.

      Equations
        Instances For

          A single step in evaluating a LazyEntry. Allow multiple different outcomes.

          Equations
            Instances For

              Return all encodings of e as a Array Key. This is used for testing.

              Equations
                Instances For

                  This variation on List.fold ensures that the array keys isn't copied unnecessarily.

                  Completely evaluate a LazyEntry.

                  Return the canonical encoding of e as a Array Key. This is used for looking up e in a RefinedDiscrTree.

                  Equations
                    Instances For