Documentation

Lean.Meta.Sym.Offset

Offset representation for natural number expressions #

This module provides utilities for representing Nat expressions in the form e + k, where e is an arbitrary expression and k is a constant. This normalization is used during pattern matching and unification.

Represents a natural number expression as a base plus a constant offset.

  • .num k represents the literal k
  • .add e k represents e + k

Used for pattern matching and unification.

Instances For

    Increments the constant part of the offset by k'.

    Equations
    Instances For

      Returns some offset if e is an offset term. That is, it is of the form

      • Nat.succ a, OR
      • a + k where k is a numeral.

      Assumption: standard instances are used for OfNat Nat n and HAdd Nat Nat Nat

      Variant of isOffset? that first checks if declName is Nat.succ or HAdd.hAdd.

      Equations
      Instances For

        Returns true if e is an offset term.

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

          Returns true if the pattern p is a + k over Nat where k contains pattern variables. Once the pattern variables are instantiated, such a subterm may match a numeral or an offset (e.g. ?m + ?n =?= 16 with ?m := 8, ?n := 8), so it must be indexed as a wildcard. See isQuasiOffsetCnstr.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            def Lean.Meta.Sym.isOffset' (declName : Name) (p : Expr) :

            Variant of isOffset? that first checks if declName is Nat.succ or HAdd.hAdd.

            Equations
            Instances For

              Converts the given expression into an offset. Assumptions: