Documentation

Lean.Elab.Tactic.Simp

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

          Implement a simp discharge function using the given tactic syntax code. Recall that simp dischargers are in SimpM which does not have access to Term.State. We need access to Term.State to store messages and update the info tree. Thus, we create an IO.ref to track these changes at Term.State when we execute tacticCode. We must set this reference with the current Term.State before we execute simp using the generated Simp.Discharge.

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

                  The result of elaborating a single simp argument

                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    • x✝.simpTheorems = #[]
                    Instances For

                      The result of elaborating a full array of simp arguments and applying them to the simp context.

                      Instances For
                        def Lean.Elab.Tactic.elabSimpArgs (stx : Syntax) (ctx : Meta.Simp.Context) (simprocs : Meta.Simp.SimprocsArray) (eraseLocal : Bool) (kind : SimpKind) (ignoreStarArg : Bool := false) :

                        Elaborate extra simp theorems provided to simp. stx is of the form "[" simpTheorem,* "]" If eraseLocal == true, then we consider local declarations when resolving names for erased theorems (- id), this option only makes sense for simp_all or * is used. When recover := true, try to recover from errors as much as possible so that users keep seeing the current goal.

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

                          If zetaDelta := false, create a FVarId set with all local let declarations in the simp argument list.

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

                            Position for the [..] child syntax in the simp tactic.

                            Equations
                            Instances For

                              Position for the only child syntax in the simp tactic.

                              Equations
                              Instances For
                                Equations
                                Instances For
                                  def Lean.Elab.Tactic.setSimpParams (stx : TSyntax `tactic) (params : Array Syntax) :
                                  TSyntax `tactic
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[inline]
                                    Equations
                                    Instances For
                                      Instances For
                                        def Lean.Elab.Tactic.mkSimpContext (stx : Syntax) (eraseLocal : Bool) (kind : SimpKind := SimpKind.simp) (ignoreStarArg : Bool := false) (simpTheorems : CoreM Meta.SimpTheorems := Meta.getSimpTheorems) :

                                        Create the Simp.Context for the simp, dsimp, and simp_all tactics. If kind != SimpKind.simp, the discharge option must be none

                                        TODO: generate error message if non rfl theorems are provided as arguments to dsimp.

                                        The argument simpTheorems defaults to getSimpTheorems, but allows overriding with an arbitrary mechanism to choose the simp theorems besides those specified in the syntax. Note that if the syntax includes simp only, the simpTheorems argument is ignored.

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

                                          Runs the given action. If it throws a maxRecDepth exception (nested or not), run the loop checking. If it does not throw, run the loop checking only if explicitly enabled.

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

                                              If stx is the syntax of a simp, simp_all or dsimp tactic invocation, and usedSimps is the set of simp lemmas used by this invocation, then mkSimpOnly creates the syntax of an equivalent simp only, simp_all only or dsimp only invocation.

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

                                                    Checks the simp arguments for unused ones, and stores a bitmask of unused ones in the info tree, to be picked up by the linter. (This indirection is necessary because the same simp syntax may be executed multiple times, and different simp arguments may be used in each step.)

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

                                                      For equational theorems, usedTheorems record the declaration name. So if the user specified foo.eq_1, we get foo in usedTheores, but we still want to mark foo.eq_1 as used. (cf. recordSimpTheorem) This may lead to unused, explicitly given foo.eq_1 to not be warned about. Ok for now, eventually recordSimpTheorem could record the actual theorem, and the logic for treating foo.eq_1 as foo be moved to SimpTrace.lean

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

                                                        simpLocation ctx discharge? varIdToLemmaId loc runs the simplifier at locations specified by loc, using the simp theorems collected in ctx optionally running a discharger specified in discharge? on generated subgoals.

                                                        Its primary use is as the implementation of the simp [...] at ... and simp only [...] at ... syntaxes, but can also be used by other tactics when a Syntax is not available.

                                                        For many tactics other than the simplifier, one should use the withLocation tactic combinator when working with a location.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  def Lean.Elab.Tactic.dsimpLocation.go (ctx : Meta.Simp.Context) (simprocs : Meta.Simp.SimprocsArray) (fvarIdsToSimp : Array FVarId) (simplifyTarget : Bool) :
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For

                                                                      The following parsers for simp arguments are not actually used at present in the implementation of simp above, but are useful for further tactics which need to parse simp arguments.

                                                                      Extract the arguments from a simpArgs syntax as an array of syntaxes

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

                                                                        Extract the arguments from a dsimpArgs syntax as an array of syntaxes

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