Documentation

Lean.Meta.Tactic.Grind.Arith.Linear.Types

Auxiliary type for normalizing Ring and Field inequalities.

Instances For
    Instances For

      Auxiliary type for normalizing Ring and Field equalities.

      Instances For
        Instances For

          Auxiliary type for normalizing Ring and Field disequalities.

          Instances For

            An equality constraint and its justification/proof.

            Instances For
              Instances For

                An inequality constraint and its justification/proof.

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

                      State for each algebraic structure by this module. Each type must at least implement the instance IntModule. For being able to process inequalities, it must at least implement Preorder, and OrderedAdd

                      • id : Nat
                      • ringId? : Option Nat

                        If the structure is a ring, we store its id in the CommRing module at ringId?

                      • type : Expr
                      • u : Level

                        Cached getDecLevel type

                      • intModuleInst : Expr

                        IntModule instance

                      • leInst? : Option Expr

                        LE instance if available

                      • ltInst? : Option Expr

                        LT instance if available

                      • lawfulOrderLTInst? : Option Expr

                        LawfulOrderLT instance if available

                      • isPreorderInst? : Option Expr

                        IsPreorder instance if available

                      • orderedAddInst? : Option Expr

                        OrderedAdd instance with IsPreorder if available

                      • isLinearInst? : Option Expr

                        IsLinearOrder instance if available

                      • noNatDivInst? : Option Expr

                        NoNatZeroDivisors

                      • ringInst? : Option Expr

                        Ring instance

                      • commRingInst? : Option Expr

                        CommRing instance

                      • orderedRingInst? : Option Expr

                        OrderedRing instance with Preorder

                      • fieldInst? : Option Expr

                        Field instance

                      • charInst? : Option (Expr × Nat)

                        IsCharP instance for type if available.

                      • zero : Expr
                      • ofNatZero : Expr
                      • one? : Option Expr
                      • leFn? : Option Expr
                      • ltFn? : Option Expr
                      • addFn : Expr
                      • zsmulFn : Expr
                      • nsmulFn : Expr
                      • zsmulFn? : Option Expr
                      • nsmulFn? : Option Expr
                      • homomulFn? : Option Expr
                      • subFn : Expr
                      • negFn : Expr
                      • vars : PArray Expr

                        Mapping from variables to their denotations. Remark each variable can be in only one ring.

                      • Mapping from Expr to a variable representing it.

                      • Mapping from variables to their "lower" bounds. We say a relational constraint c is a lower bound for a variable x if x is the maximal variable in c, and x coefficient in c is negative.

                      • Mapping from variables to their "upper" bounds. We say a relational constraint c is a upper bound for a variable x if x is the maximal variable in c, and x coefficient in c is positive.

                      • Mapping from variables to their disequalities. We say a disequality constraint c is a disequality for a variable x if x is the maximal variable in c.

                      • assignment : PArray Rat

                        Partial assignment being constructed by linarith.

                      • caseSplits : Bool

                        caseSplits is true if linarith is searching for model and already performed case splits. This information is used to decide whether a conflict should immediately close the current grind goal or not.

                      • conflict? : Option UnsatProof

                        conflict? is some .. if a contradictory constraint was derived. This field is only set when caseSplits is true. Otherwise, we can convert UnsatProof into a Lean term and close the current grind goal.

                      • diseqSplits : PHashMap Poly FVarId

                        Cache decision variables used when splitting on disequalities. This is necessary because the same disequality may be in different conflicts.

                      • elimEqs : PArray (Option EqCnstr)

                        Mapping from variable to equation constraint used to eliminate it. solved variables should not occur in diseqs, lowers, or uppers.

                      • elimStack : List Var

                        Elimination stack. For every variable in elimStack. If x in elimStack, then elimEqs[x] is not none.

                      • occurs : PArray VarSet

                        Mapping from variable to occurrences. For example, an entry x ↦ {y, z} means that x may occur in lowers, or uppers, or diseqs of variables y and z. If x occurs in diseqs[y], lowers[y], or uppers[y], then y is in occurs[x], but the reverse is not true. If x is in elimStack, then occurs[x] is the empty set.

                      • ignored : PArray Expr

                        Linear constraints that are not supported. We use this information for diagnostics. TODO: store constraints instead.

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

                            State for all IntModule types detected by grind.

                            • structs : Array Struct

                              Structures detected. We expect to find a small number of IntModules in a given goal. Thus, using Array is fine here.

                            • typeIdOf : PHashMap ExprPtr (Option Nat)

                              Mapping from types to its "structure id". We cache failures using none. typeIdOf[type] is some id, then id < structs.size.

                            • exprToStructId : PHashMap ExprPtr Nat
                            • exprToStructIdEntries : PArray (Expr × Nat)

                              exprToStructId content as an array for traversal.

                            • forbiddenNatModules : PHashSet ExprPtr

                              Some types are unordered rings, so we do not process them in linarith. When such types are detected in getStructId?, we add them to the set forbiddenNatModules to avoid reprocessing them in getNatStructId?.

                            • natStructs : Array NatStruct

                              NatModule. We support them using the envelope OfNatModule.Q

                            • natTypeIdOf : PHashMap ExprPtr (Option Nat)

                              Mapping from types to its "nat module id". We cache failures using none. natTypeIdOf[type] is some id, then id < natStructs.size. If a type is in this map, it is not in typeIdOf.

                            • exprToNatStructId : PHashMap ExprPtr Nat
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For