Documentation

Lean.Elab.Tactic.Do.Attr

This attribute should not be used directly. It is an implementation detail of the mvcgen tactic.

The simp set accumulated by the @[spec] attribute. (This does not include Hoare triple specs.) It is an implementation detail of the mvcgen tactic.

Instances For
    Instances For

      A unique identifier corresponding to the origin.

      Instances For
        • prog : Expr

          Expr key tested for matching, in ∀-quantified form. keys = (← mkPath (← forallMetaTelescope prog).2.2).

        • proof : SpecProof

          The proof for the theorem.

        • etaPotential : Nat

          If etaPotential is non-zero, then the precondition contains meta variables that can be instantiated after applying mintro ∀s etaPotential many times.

        • priority : Nat
        Instances For
          @[reducible, inline]
          Instances For
            @[reducible, inline]
            Instances For

              If σs : List Type, then e : SPred σs. Return the number of times e needs to be applied in order to assign closed solutions to meta variables.

              Instances For
                Instances For

                  The kind of a spec theorem.

                  • triple : SpecTheoremKind

                    A Hoare triple spec: ⦃P⦄ prog ⦃Q⦄.

                  • simp (etaArgs : Nat := 0) : SpecTheoremKind

                    A simp/equational spec: lhs = rhs. The pattern is the LHS. When matched, the VCGen rewrites the program from lhs to rhs and continues. etaArgs is the number of extra arguments introduced by eta-expanding function-level equations (e.g., class projection unfold lemmas). These args need congrFun at instantiation time.

                  Instances For
                    Instances For

                      A unique identifier corresponding to the origin.

                      Instances For

                        Normalises a specification proof so its conclusion is in pre ⊑ wp … form.

                        • Returns some for Triple proofs (rewriting via Triple.hwp) and proofs already in pre ⊑ wp … form (passed through unchanged).
                        • Returns none if type is neither shape; callers should throwError.
                        Instances For
                          • Pattern for the program expression. This is the key used in the discrimination tree. If the proof has type ∀ a b c d e, ⦃P⦄ prog ⦃Q⦄ and only a, c and e occur in prog, then the pattern is prog[a:=#2, c:=#1, e:=#0]. For specs stated as pre ⊑ wp prog post epost, the pattern is keyed on prog.

                          • proof : SpecProof

                            The proof for the theorem.

                          • The kind of spec theorem: triple or simp.

                          • priority : Nat
                          Instances For
                            @[reducible, inline]
                            Instances For
                              @[reducible, inline]
                              Instances For

                                Drops pattern variables that the pattern expression does not depend on.

                                Sym.mkPatternFromExprWithKey/Sym.mkPatternFromDeclWithKey turn every leading ∀-binder of the source type into a pattern variable, even binders the selected key (e.g. the program of a Triple conclusion) never mentions. During matching those variables only ever become fresh metavariables (see Sym.mkPreResult); for instance binders they additionally trigger spurious trySynthInstance calls. This keeps only the variables that the pattern expression references, together with the transitive closure of variables their types depend on, and renumbers the remaining de Bruijn indices. varInfos? and checkTypeMask? are filtered to the surviving telescope; fnInfos, levelParams, and the discrimination-tree key are unchanged because the pattern expression's structure is untouched (bound variables are wildcards in the key).

                                Important: only use this when the matched arguments are not reused to rebuild a proof term, as Sym.BackwardRule/Sym.mkValue do — dropping variables would drop arguments those need. It is meant for databases such as vcgen's spec table, where the proof is re-elaborated independently of the pattern.

                                Instances For

                                  The application-argument index of declName's program parameter x, read from its signature.

                                  Instances For

                                    Selects the program a spec conclusion is keyed on: the program of a Triple, or the program inside the wp on the RHS of a pre ⊑ wp … entailment. Returns none if type is neither shape — e.g. a bare lhs ⊑ rhs whose RHS is not a wp application (an invariant entailment such as (I n h).inv … ⊑ Q n r.2, which can appear as an ordinary hypothesis but is not a spec). Callers use none to skip such non-spec hypotheses instead of failing.

                                    Instances For

                                      Builds a Sym.Pattern keyed on the program selected by selectProg from a spec conclusion. The conclusion is assumed to already be a valid spec shape (checked by the caller via selectProg); a non-spec shape reaching here is a logic error and throws.

                                      Instances For

                                        Create a SpecTheorem from a simp/equational declaration declName : ∀ xs, lhs = rhs, keyed on the LHS. Function-level equations (e.g. class projection unfold lemmas) are eta-expanded so the discrimination-tree key includes all arguments. Returns none for no-op equations whose LHS key is syntactically the RHS.

                                        Instances For

                                          Register the equational lemmas of a @[spec]-annotated declaration as .simp entries with the given priority. An equational proposition is registered directly; a definition is registered via its equation lemmas (getEqnsFor?). Anything else throws, since it cannot serve as a vcgen spec.

                                          Instances For

                                            The spec proofs a @[spec] constant contributes to the database: the constant itself for a Triple/⊑ wp spec, the equation itself for an equational spec, or its equation lemmas for a definition registered to unfold. Mirrors addSimpSpecTheoremsFromConst so [-foo] erases exactly the entries that annotating foo inserted.

                                            Instances For

                                              Marks a type as an invariant type for the mvcgen tactic. Goals whose type is an application of a tagged type will be classified as invariants rather than verification conditions.

                                              Returns true if ty is an application of a type tagged with @[spec_invariant_type].

                                              Instances For