Skip to content

Commit d478563

Browse files
committed
chore: bump dependencies (#7767)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent 23a69c7 commit d478563

File tree

15 files changed

+29
-258
lines changed

15 files changed

+29
-258
lines changed

Mathlib/Init/Align.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Authors: Daniel Selsam, Mario Carneiro
55
-/
66
import Mathlib.Mathport.Rename
77
import Mathlib.Init.Logic
8-
import Mathlib.Tactic.Relation.Rfl
98
import Mathlib.Tactic.Relation.Symm
109
import Mathlib.Tactic.Relation.Trans
1110

Mathlib/Init/Core.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ notation, basic datatypes and type classes
88
import Mathlib.Mathport.Rename
99
import Std.Classes.SetNotation
1010
import Std.Classes.Dvd
11-
import Mathlib.Tactic.Relation.Rfl
12-
import Mathlib.Tactic.Relation.Symm
11+
import Std.Tactic.Relation.Rfl
12+
import Std.Tactic.Relation.Symm
1313
import Mathlib.Tactic.Relation.Trans
1414

1515
/-! ### alignments from lean 3 `init.core` -/

Mathlib/Init/Logic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Authors: Leonardo de Moura, Jeremy Avigad, Floris van Doorn
55
-/
66
import Std.Tactic.Ext
77
import Std.Tactic.Lint.Basic
8+
import Std.Tactic.Relation.Rfl
89
import Std.Logic
910
import Std.WF
1011
import Mathlib.Tactic.Basic
11-
import Mathlib.Tactic.Relation.Rfl
1212
import Mathlib.Tactic.Relation.Symm
1313
import Mathlib.Mathport.Attributes
1414
import Mathlib.Mathport.Rename

Mathlib/Lean/Meta.lean

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,6 @@ namespace Lean.MVarId
2222
def synthInstance (g : MVarId) : MetaM Unit := do
2323
g.assign (← Lean.Meta.synthInstance (← g.getType))
2424

25-
/--
26-
Replace hypothesis `hyp` in goal `g` with `proof : typeNew`.
27-
The new hypothesis is given the same user name as the original,
28-
it attempts to avoid reordering hypotheses, and the original is cleared if possible.
29-
-/
30-
-- adapted from Lean.Meta.replaceLocalDeclCore
31-
def replace (g : MVarId) (hyp : FVarId) (proof : Expr) (typeNew : Option Expr := none) :
32-
MetaM AssertAfterResult :=
33-
g.withContext do
34-
let typeNew ← typeNew.getDM (inferType proof)
35-
let ldecl ← hyp.getDecl
36-
-- `typeNew` may contain variables that occur after `hyp`.
37-
-- Thus, we use the auxiliary function `findMaxFVar` to ensure `typeNew` is well-formed
38-
-- at the position we are inserting it.
39-
let (_, ldecl') ← findMaxFVar typeNew |>.run ldecl
40-
let result ← g.assertAfter ldecl'.fvarId ldecl.userName typeNew proof
41-
(return { result with mvarId := ← result.mvarId.clear hyp }) <|> pure result
42-
where
43-
/-- Finds the `LocalDecl` for the FVar in `e` with the highest index. -/
44-
findMaxFVar (e : Expr) : StateRefT LocalDecl MetaM Unit :=
45-
e.forEach' fun e ↦ do
46-
if e.isFVar then
47-
let ldecl' ← e.fvarId!.getDecl
48-
modify fun ldecl ↦ if ldecl'.index > ldecl.index then ldecl' else ldecl
49-
return false
50-
else
51-
return e.hasFVar
52-
5325
/-- Add the hypothesis `h : t`, given `v : t`, and return the new `FVarId`. -/
5426
def note (g : MVarId) (h : Name) (v : Expr) (t : Option Expr := .none) :
5527
MetaM (FVarId × MVarId) := do
@@ -236,10 +208,6 @@ namespace Lean.Elab.Tactic
236208
def liftMetaTactic' (tac : MVarId → MetaM MVarId) : TacticM Unit :=
237209
liftMetaTactic fun g => do pure [← tac g]
238210

239-
/-- Analogue of `liftMetaTactic` for tactics that do not return any goals. -/
240-
def liftMetaFinishingTactic (tac : MVarId → MetaM Unit) : TacticM Unit :=
241-
liftMetaTactic fun g => do tac g; pure []
242-
243211
@[inline] private def TacticM.runCore (x : TacticM α) (ctx : Context) (s : State) :
244212
TermElabM (α × State) :=
245213
x ctx |>.run s

Mathlib/Logic/Function/Conjugate.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Yury Kudryashov
55
-/
66
import Mathlib.Logic.Function.Basic
7-
import Mathlib.Tactic.Relation.Rfl
87

98
#align_import logic.function.conjugate from "leanprover-community/mathlib"@"c4658a649d216f57e99621708b09dcb3dcccbd23"
109

Mathlib/Mathport/Syntax.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ import Mathlib.Tactic.Positivity
7171
import Mathlib.Tactic.PushNeg
7272
import Mathlib.Tactic.Qify
7373
import Mathlib.Tactic.Recover
74-
import Mathlib.Tactic.Relation.Rfl
7574
import Mathlib.Tactic.Relation.Symm
7675
import Mathlib.Tactic.Relation.Trans
7776
import Mathlib.Tactic.Rename

Mathlib/Tactic/Common.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ import Mathlib.Tactic.Propose
7474
import Mathlib.Tactic.PushNeg
7575
import Mathlib.Tactic.RSuffices
7676
import Mathlib.Tactic.Recover
77-
import Mathlib.Tactic.Relation.Rfl
7877
import Mathlib.Tactic.Relation.Symm
7978
import Mathlib.Tactic.Relation.Trans
8079
import Mathlib.Tactic.Rename

Mathlib/Tactic/GCongr/Core.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,15 +356,15 @@ open Elab Tactic
356356
eval h goal := do
357357
let m ← mkFreshExprMVar none
358358
goal.assignIfDefeq (← mkAppOptM ``Eq.subst #[h, m])
359-
goal.rfl
359+
goal.applyRfl
360360

361361
/-- See if the term is `a < b` and the goal is `a ≤ b`. -/
362362
@[gcongr_forward] def exactLeOfLt : ForwardExt where
363363
eval h goal := do goal.assignIfDefeq (← mkAppM ``le_of_lt #[h])
364364

365365
/-- See if the term is `a ∼ b` with `∼` symmetric and the goal is `b ∼ a`. -/
366366
@[gcongr_forward] def symmExact : ForwardExt where
367-
eval h goal := do (← goal.symm).assignIfDefeq h
367+
eval h goal := do (← goal.applySymm).assignIfDefeq h
368368

369369
@[gcongr_forward] def exact : ForwardExt where
370370
eval e m := m.assignIfDefeq e

Mathlib/Tactic/LibrarySearch.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def librarySearchSymm (goal : MVarId)
158158
Nondet MetaM (List MVarId) :=
159159
(librarySearchCore goal required solveByElimDepth) <|>
160160
.squash fun _ => do
161-
if let some symm ← observing? goal.symm then
161+
if let some symm ← observing? goal.applySymm then
162162
return librarySearchCore symm required solveByElimDepth
163163
else
164164
return .nil

Mathlib/Tactic/Relation/Rfl.lean

Lines changed: 8 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,27 @@ Copyright (c) 2022 Newell Jensen. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Newell Jensen
55
-/
6-
import Lean
76
import Mathlib.Lean.Meta
7+
import Std.Tactic.Relation.Rfl
88

99
/-!
10-
# `rfl` tactic extension for reflexive relations
10+
# `Lean.MVarId.liftReflToEq`
1111
12-
This extends the `rfl` tactic so that it works on any reflexive relation,
13-
provided the reflexivity lemma has been marked as `@[refl]`.
12+
Convert a goal of the form `x ~ y` into the form `x = y`, where `~` is a reflexive
13+
relation, that is, a relation which has a reflexive lemma tagged with the attribute `[refl]`.
14+
If this can't be done, returns the original `MVarId`.
1415
-/
1516

1617
namespace Mathlib.Tactic
1718

18-
open Lean Meta
19-
20-
/-- Environment extensions for `refl` lemmas -/
21-
initialize reflExt :
22-
SimpleScopedEnvExtension (Name × Array (DiscrTree.Key true)) (DiscrTree Name true) ←
23-
registerSimpleScopedEnvExtension {
24-
addEntry := fun dt (n, ks) ↦ dt.insertCore ks n
25-
initial := {}
26-
}
27-
28-
initialize registerBuiltinAttribute {
29-
name := `refl
30-
descr := "reflexivity relation"
31-
add := fun decl _ kind ↦ MetaM.run' do
32-
let declTy := (← getConstInfo decl).type
33-
let (_, _, targetTy) ← withReducible <| forallMetaTelescopeReducing declTy
34-
let fail := throwError
35-
"@[refl] attribute only applies to lemmas proving x ∼ x, got {declTy}"
36-
let .app (.app rel lhs) rhs := targetTy | fail
37-
unless ← withNewMCtxDepth <| isDefEq lhs rhs do fail
38-
let key ← DiscrTree.mkPath rel
39-
reflExt.add (decl, key) kind
40-
}
41-
42-
open Elab Tactic
43-
44-
/-- Closes the goal if the target has the form `x ~ x`, where `~` is a reflexive
45-
relation, that is, a relation which has a reflexive lemma tagged with the attribute `[refl]`.
46-
Otherwise throws an error.
47-
48-
See also `Lean.MVarId.refl`, which is for `x = x` specifically.
49-
50-
This is the `MetaM` implementation of the `rfl` tactic.
51-
-/
52-
def _root_.Lean.MVarId.rfl (goal : MVarId) : MetaM Unit := do
53-
let .app (.app rel _) _ ← withReducible goal.getType'
54-
| throwError "reflexivity lemmas only apply to binary relations, not
55-
{indentExpr (← goal.getType)}"
56-
let s ← saveState
57-
let mut ex? := none
58-
for lem in ← (reflExt.getState (← getEnv)).getMatch rel do
59-
try
60-
let gs ← goal.apply (← mkConstWithFreshMVarLevels lem)
61-
if gs.isEmpty then return () else
62-
logError <| MessageData.tagged `Tactic.unsolvedGoals <| m!"unsolved goals\n
63-
{goalsToMessageData gs}"
64-
catch e =>
65-
ex? := ex? <|> (some (← saveState, e)) -- stash the first failure of `apply`
66-
s.restore
67-
if let some (sErr, e) := ex? then
68-
sErr.restore
69-
throw e
70-
else
71-
throwError "rfl failed, no lemma with @[refl] applies"
19+
open Lean Meta Elab Tactic
7220

7321
/--
7422
This tactic applies to a goal whose target has the form `x ~ x`, where `~` is a reflexive
7523
relation, that is, a relation which has a reflexive lemma tagged with the attribute [refl].
7624
-/
7725
def rflTac : TacticM Unit :=
78-
withMainContext do liftMetaFinishingTactic (·.rfl)
79-
80-
@[inherit_doc rflTac]
81-
elab_rules : tactic
82-
| `(tactic| rfl) => rflTac
26+
withMainContext do liftMetaFinishingTactic (·.applyRfl)
8327

8428
/-- Helper theorem for `Lean.MVar.liftReflToEq`. -/
8529
private theorem rel_of_eq_and_refl {α : Sort _} {R : α → α → Prop}
@@ -97,7 +41,7 @@ def _root_.Lean.MVarId.liftReflToEq (mvarId : MVarId) : MetaM MVarId := do
9741
if rel.isAppOf `Eq then
9842
-- No need to lift Eq to Eq
9943
return mvarId
100-
for lem in ← (reflExt.getState (← getEnv)).getMatch rel do
44+
for lem in ← (Std.Tactic.reflExt.getState (← getEnv)).getMatch rel do
10145
let res ← observing? do
10246
-- First create an equality relating the LHS and RHS
10347
-- and reduce the goal to proving that LHS is related to LHS.

0 commit comments

Comments
 (0)