Skip to content

Commit 9e73522

Browse files
committed
feat: import #click_suggestions in Mathlib.Tactic.Common (leanprover-community#40755)
This PR adds the `#click_suggestions` command to `Mathlib.Tactic.Common`, so that it can be used in most mathlib files. To allow this, I reduced the theory imports, since `Mathlib.Tactic.Common` is not supposed to import much theory. The extra import will probably give a minor slowdown, but I think it is worth it.
1 parent 8c60a81 commit 9e73522

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

Mathlib/Tactic/ClickSuggestions/GRewrite.lean

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Jovan Gerbscheid
66
module
77

88
public import Mathlib.Tactic.ClickSuggestions.SectionState
9-
public import Mathlib.Order.Antisymmetrization
109
public meta import Lean.Meta.ExprLens
1110

1211
/-!
@@ -43,10 +42,11 @@ private def gcongrBackward (relName : Name) (relation : Expr) (symm : Bool) :
4342
withLocalDeclD `a α fun a ↦ do
4443
withLocalDeclD `b α fun b ↦ do
4544
withNewMCtxDepth do
45+
let mut result : Array GrwPos := #[]
4646
-- Any relation `r` can be proved from `AntisymmRel r`, so we add this as a possible relation
47-
let antiSymm := mkApp2 (.const ``AntisymmRel [u]) α relation
48-
let mut result : Array GrwPos :=
49-
#[{ relName := ``AntisymmRel, relation := antiSymm, symm? := none }]
47+
if (← getEnv).contains `AntisymmRel then
48+
let antiSymm := mkApp2 (.const `AntisymmRel [u]) α relation
49+
result := result.push { relName := `AntisymmRel, relation := antiSymm, symm? := none }
5050
-- If `relName` is symmetric, then include the reverse as a possible relation (`symm? := none`)
5151
let symm? ← try
5252
let dummyVar ← mkFreshExprMVar (mkApp2 relation a b)
@@ -61,7 +61,9 @@ private def gcongrBackward (relName : Name) (relation : Expr) (symm : Bool) :
6161
result := result.push { relName, relation, symm? }
6262
-- For `≤`, we add the relation `<`.
6363
if relName == ``LE.le then
64-
let (mvars, _, le) ← forallMetaTelescope (← inferType (← mkConstWithFreshMVarLevels ``le_of_lt))
64+
if (← getEnv).contains `le_of_lt then
65+
let (mvars, _, le) ←
66+
forallMetaTelescope (← inferType (← mkConstWithFreshMVarLevels `le_of_lt))
6567
if ← isDefEq le.appFn!.appFn! relation then
6668
let lt ← instantiateMVars (← inferType mvars.back!).appFn!.appFn!
6769
result := result.push { relName := ``LT.lt, relation := lt, symm? := symm }

Mathlib/Tactic/Common.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public import Mathlib.Tactic.Choose
4242
public import Mathlib.Tactic.ClearExclamation
4343
public import Mathlib.Tactic.ClearExcept
4444
public import Mathlib.Tactic.Clear_
45+
public import Mathlib.Tactic.ClickSuggestions
4546
public import Mathlib.Tactic.Coe
4647
public import Mathlib.Tactic.CongrExclamation
4748
public import Mathlib.Tactic.CongrM

0 commit comments

Comments
 (0)