Documentation

SEq.Tactic.DepRewrite

theorem SEq.Tactic.DRewrite.dcongrArg {α : Sort u} {a a' : α} {β : (a' : α) → a = a'Sort v} (h : a = a') (f : (a' : α) → (h : a = a') → β a' h) :
f a = f a' h
theorem SEq.Tactic.DRewrite.nddcongrArg {α : Sort u} {a a' : α} {β : Sort v} (h : a = a') (f : (a' : α) → a = a'β) :
f a = f a' h
theorem SEq.Tactic.DRewrite.heqL {α β : Sort u} {a : α} {b : β} (h : HEq a b) :
a = cast b
theorem SEq.Tactic.DRewrite.heqR {α β : Sort u} {a : α} {b : β} (h : HEq a b) :
cast a = b

Determines which, if any, type-incorrect subterms should be casted along the equality that drewrite is rewriting by.

  • none : CastMode

    Don't insert any casts.

  • proofs : CastMode

    Only insert casts on proofs.

    In this mode, it is not permitted to cast subterms of proofs that are not themselves proofs. For example, given y : Fin n, P : Fin n → Prop, p : (x : Fin n) → P x and eq : n = m, we will not rewrite p y : P y to p (eq ▸ y) : P (eq ▸ y).

  • all : CastMode

    Insert as many Eq.recs as necessary.

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

        Monad for computing dabstract. The cache is for visit (not visitAndCast, which has two arguments), and the Nat tracks which occurrence of the pattern we are currently seeing.

        Equations
        Instances For

          Check that casting e : t is allowed in the current mode. (We don't need to know what type e is cast to: we only check the sort of t, and it cannot change.)

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

            If e : te is a term whose type mentions x or h (the generalization variables), return ⋯ ▸ e : te[p/x,rfl/h]. Otherwise return none.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              def SEq.Tactic.DRewrite.withSubst? {α : Type} (x tx : Lean.Expr) (k : M α) :
              M α
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Given e, return e[x/p] (i.e., e with occurrences of p replaced by x). If et? is not none, the output is guaranteed to have type (defeq to) et?.

                Does not assume that e is well-typed, but assumes that for all subterms e' of e, e'[x/p] is well-typed. We use this when processing lambdas: to traverse fun (x : α) => b, we add x : α[x/p] to the local context and continue traversing b. x : α[x/p] ⊢ b may be ill-typed, but the output x : α[x/p] ⊢ b[x/p] is well-typed.

                Like visitAndCast, but does not insert casts at the top level. The expected types of certain subterms are computed from et?.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Lean.MVarId.depRewrite (mvarId : MVarId) (e heq : Expr) (symm : Bool := false) (config : SEq.Tactic.DRewrite.Config := { transparency := Meta.TransparencyMode.reducible, offsetCnstrs := true, occs := Meta.Occurrences.all, castMode := SEq.Tactic.DRewrite.CastMode.proofs }) :

                  Rewrite goal mvarId dependently.

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

                    rewrite! is like rewrite, but can also rewrite inside types by inserting casts. This means that the 'motive is not type correct' error never occurs, at the expense of potentially creating complicated terms. It is also available as a conv tactic.

                    The sort of casts that are inserted is controlled by the castMode configuration option. By default, only proof terms are casted: by proof irrelevance, this adds no observable complexity.

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

                      rw! is like rewrite!, but also calls dsimp to simplify the result after every substitution. It is also available as a conv tactic.

                      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
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  rewrite! [thm] rewrites the target dependently using thm. See the rewrite! tactic for more information.

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

                                    rw! [thm] rewrites the target using thm. See the rw! tactic for more information.

                                    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
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For