Skip to content

Commit a82e5ea

Browse files
committed
chore(Tactic): make the (deprecated) replace syntax a @[tactic_alt] (leanprover-community#37931)
This PR replaces the tactic docstring for Mathlib's version of `replace` with a `@[tactic_alt]` attribute + `tactic_extension`. Also update the module docs which did not get updated when `replace` got upstreamed to core Lean. Co-authored-by: Anne C.A. Baanen <vierkantor@vierkantor.com>
1 parent 2776842 commit a82e5ea

1 file changed

Lines changed: 7 additions & 31 deletions

File tree

Mathlib/Tactic/Replace.lean

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ public import Mathlib.Tactic.Have
1010
/-!
1111
# Extending `replace`
1212
13-
This file extends the `replace` tactic from `Batteries` to allow the addition of hypotheses to
14-
the context without requiring their proofs to be provided immediately.
13+
This file extends the `replace` tactic from the standard library to allow the addition of hypotheses
14+
to the context without requiring their proofs to be provided immediately.
1515
1616
As a style choice, this should not be used in mathlib; but is provided for downstream users who
1717
preferred the old style.
@@ -24,36 +24,12 @@ namespace Mathlib.Tactic
2424
open Lean Elab.Tactic
2525

2626
/--
27-
Acts like `have`, but removes a hypothesis with the same name as
28-
this one if possible. For example, if the state is:
29-
30-
Then after `replace h : β` the state will be:
31-
32-
```lean
33-
case h
34-
f : α → β
35-
h : α
36-
⊢ β
37-
38-
f : α → β
39-
h : β
40-
⊢ goal
41-
```
42-
43-
whereas `have h : β` would result in:
44-
45-
```lean
46-
case h
47-
f : α → β
48-
h : α
49-
⊢ β
50-
51-
f : α → β
52-
h✝ : α
53-
h : β
54-
⊢ goal
55-
```
27+
`replace h : t`, without a subsequent proof, creates a new main goal `case h : ... ⊢ t`.
28+
This form is considered deprecated in Mathlib: use `replace h : t := _` instead.
5629
-/
30+
tactic_extension Lean.Parser.Tactic.replace
31+
32+
@[tactic_alt Lean.Parser.Tactic.replace]
5733
syntax (name := replace') "replace" haveIdLhs' : tactic
5834

5935
elab_rules : tactic

0 commit comments

Comments
 (0)