feat: add auto_attach simp set (no functionality yet) (#6956)

this PR helps with bootstrapping #6744.
This commit is contained in:
Joachim Breitner 2025-02-05 14:33:35 +01:00 committed by GitHub
parent 53ed233f38
commit 255d931e0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 0 deletions

View file

@ -1662,6 +1662,14 @@ If there are several with the same priority, it is uses the "most recent one". E
-/
syntax (name := simp) "simp" (Tactic.simpPre <|> Tactic.simpPost)? patternIgnore("← " <|> "<- ")? (ppSpace prio)? : attr
/--
Theorems tagged with the `auto_attach` attribute are used during the processing of functions defined
by well-founded recursion. They are applied to the function's body to add additional hypotheses,
such as replacing `if c then _ else _` with `if h : c then _ else _` or `xs.map` with
`xs.attach.map`. Also see `wfParam`.
-/
syntax (name := auto_attach) "auto_attach" (Tactic.simpPre <|> Tactic.simpPost)? patternIgnore("← " <|> "<- ")? (ppSpace prio)? : attr
/-- The possible `norm_cast` kinds: `elim`, `move`, or `squash`. -/
syntax normCastLabel := &"elim" <|> &"move" <|> &"squash"

View file

@ -0,0 +1,19 @@
/-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joachim Breitner
-/
prelude
import Lean.Meta.Transform
import Lean.Meta.Match.MatcherApp.Basic
import Lean.Elab.Tactic.Simp
open Lean Meta
namespace Lean.Elab.WF
builtin_initialize autoAttachSimpExtension : SimpExtension ←
registerSimpAttr `auto_attach
"(not yet functional)"
end Lean.Elab.WF

View file

@ -13,6 +13,7 @@ import Lean.Elab.PreDefinition.WF.Rel
import Lean.Elab.PreDefinition.WF.Fix
import Lean.Elab.PreDefinition.WF.Unfold
import Lean.Elab.PreDefinition.WF.Ite
import Lean.Elab.PreDefinition.WF.AutoAttach
import Lean.Elab.PreDefinition.WF.GuessLex
namespace Lean.Elab

View file

@ -1,5 +1,7 @@
#include "util/options.h"
// please update stage0
namespace lean {
options get_default_options() {
options opts;