Documentation

LeanPool.OrderClosures.BanLat.Tactic.LLexpr

The llarith tactic #

llarith proves lattice-linear identities and non-strict inequalities in vector lattices by reducing them to the corresponding statement over ℝ. It quotes the goal as an LLexpr, proves the real identity by expanding lattice operations to max and min and splitting cases, and transfers the result back with LLexpr.vanishes_of_vanishes_real.

The supported expression language consists of vector-valued atoms, 0, addition, subtraction, negation, real scalar multiplication, ⊔, ⊓, positive parts, negative parts, and absolute values. A goal a ≤ b is handled as the equivalent lattice-linear identity a ⊔ b = b. Local hypotheses of the form 0 ≤ x, x ≤ 0, 0 < x, and x < 0 are used when x is one of the quoted atoms.

A quoted lattice-linear expression whose coefficients are elaborated Lean expressions.

Unsupported vector-valued subterms are represented by var; they are treated as atomic variables in the real identity check.

  • zero : Quoted

    The constant zero expression.

  • var (idx : ℕ) : Quoted

    A vector-valued atom, represented by its index in the collected atom list.

  • add (lhs rhs : Quoted) : Quoted

    Addition of quoted expressions.

  • smul (coeff : Lean.Expr) (arg : Quoted) : Quoted

    Real scalar multiplication of a quoted expression.

  • sup (lhs rhs : Quoted) : Quoted

    Supremum of quoted expressions.

  • inf (lhs rhs : Quoted) : Quoted

    Infimum of quoted expressions.

Instances For

    The sign information about a quoted atom that llarith can use.

    • unknown : AtomSign

      No usable sign information was found.

    • nonneg : AtomSign

      The atom is known to be non-negative.

    • nonpos : AtomSign

      The atom is known to be non-positive.

    Instances For

      Sign information for an atom, together with a proof of the corresponding weak inequality.

      • sign : AtomSign

        Whether the atom is known to be non-negative or non-positive.

      • proof : Lean.Expr

        A proof of 0 ≤ x in the non-negative case, or x ≤ 0 in the non-positive case.

      Instances For

        State threaded through quotation: the distinct vector-valued atoms already found.

        • The vector-valued atoms, in the order used for the generated Fin n → X tuple.

        Instances For
          @[reducible, inline]

          The monad used while quoting a goal into an LLexpr.

          Equations
          Instances For

            Report that the current target is outside the goal shapes supported by llarith.

            Equations
            Instances For

              Syntactic comparison of vector-valued atoms, ignoring metadata.

              Equations
              Instances For

                Return the index of an atom, adding it to the quotation state if it is new.

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

                  Return the index of an already collected atom, if any.

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

                    Test whether an expression is definitionally the zero element of the given type.

                    Equations
                    Instances For

                      Test whether an elaborated type expression is definitionally ℝ.

                      Equations
                      Instances For

                        Quote a vector-valued expression as a lattice-linear expression.

                        Recognized syntax is translated to the corresponding Quoted constructor. Any other vector-valued subterm is registered as an atomic variable.

                        Equations
                        Instances For

                          The expression size bounds the number of recursive quotation steps along any branch.

                          Equations
                          Instances For

                            Replace atoms with sign-parametrized expressions when a sign hypothesis is available.

                            For a non-negative atom x, the real side uses x⁺; for a non-positive atom, it uses -(-x)⁺. After transfer, the original sign hypothesis rewrites these expressions back to x.

                            Equations
                            Instances For

                              Test whether an elaborated scalar coefficient is definitionally -1.

                              Equations
                              Instances For

                                Remove simple redundancies introduced while quoting and applying signs.

                                Equations
                                Instances For

                                  Convert an array of optional sign information to the sign array used by quotation.

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

                                    If a proposition gives sign information about a collected atom, return that information.

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

                                      Collect atom-level sign information from the local context.

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

                                        Add the weak inequalities extracted from sign hypotheses to the local context.

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

                                          Build a closed expression for the idxth element of Fin arity.

                                          Instances For

                                            Convert quoted syntax into the corresponding formal LLexpr.

                                            Equations
                                            Instances For

                                              Build the finite tuple of vector-valued atoms used to evaluate the quoted LLexprs.

                                              The tuple is emitted as a PiFin literal so that the final simplification step can unfold each variable lookup.

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

                                                Prove the generated real vanishing statement.

                                                After introducing the real variables, this unfolds LLexpr.eval and first tries grind on the real lattice expression. If that does not close the goal, it falls back to expanding max and min, splitting cases, and closing the resulting arithmetic goals with linarith or nlinarith.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def LLexpr.Tactic.closeByTransfer (type : Lean.Expr) (lhsQ rhsQ : Quoted) (atoms : Array Lean.Expr) (asLe hasSigns : Bool) :

                                                  Transfer a quoted real identity back to the original vector-lattice goal.

                                                  If asLe is true, the quoted equality has the form lhs ⊔ rhs = rhs and is post-processed as a proof of lhs ≤ rhs.

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

                                                    Implementation of the user-facing llarith tactic.

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

                                                      Prove lattice-linear identities by checking the corresponding identity over ℝ.

                                                      The tactic supports equality and non-strict inequality goals built from vector-valued atoms, 0, +, -, unary negation, real scalar multiplication, ⊔, ⊓, positive and negative parts, and absolute values. It also uses atom-level sign hypotheses of the form 0 ≤ x, x ≤ 0, 0 < x, or x < 0.

                                                      Equations
                                                      Instances For