Skip to content

Commit

Permalink
feat: add Mathlib.Tactic.Common, and import
Browse files Browse the repository at this point in the history
  • Loading branch information
semorrison committed May 17, 2023
1 parent 9ab4016 commit 1ce2f69
Show file tree
Hide file tree
Showing 18 changed files with 117 additions and 20 deletions.
1 change: 1 addition & 0 deletions Mathlib.lean
Expand Up @@ -1890,6 +1890,7 @@ import Mathlib.Tactic.Clear!
import Mathlib.Tactic.ClearExcept
import Mathlib.Tactic.Clear_
import Mathlib.Tactic.Coe
import Mathlib.Tactic.Common
import Mathlib.Tactic.Congr!
import Mathlib.Tactic.Constructor
import Mathlib.Tactic.Continuity
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Algebra/Group/Defs.lean
Expand Up @@ -12,6 +12,7 @@ Authors: Jeremy Avigad, Leonardo de Moura, Simon Hudon, Mario Carneiro
import Mathlib.Init.ZeroOne
import Mathlib.Init.Data.Int.Basic
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Common

/-!
# Typeclasses for (semi)groups and monoids
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/Algebra/Quotient.lean
Expand Up @@ -9,6 +9,8 @@ Authors: Anne Baanen
! if you have ported upstream changes.
-/
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Common

/-!
# Algebraic quotients
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Control/Monad/Basic.lean
Expand Up @@ -10,6 +10,7 @@ Authors: Simon Hudon
-/
import Mathlib.Logic.Equiv.Defs
import Mathlib.Control.SimpSet
import Mathlib.Tactic.Common

/-!
# Monad
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Option/Basic.lean
Expand Up @@ -12,7 +12,7 @@ import Mathlib.Init.Control.Combinators
import Mathlib.Data.Option.Defs
import Mathlib.Logic.IsEmpty
import Mathlib.Logic.Relator
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Common

/-!
# Option of a type
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Prod/Basic.lean
Expand Up @@ -12,7 +12,7 @@ import Mathlib.Init.Core
import Mathlib.Init.Data.Prod
import Mathlib.Init.Function
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Inhabit
import Mathlib.Tactic.Common

/-!
# Extra facts about `prod`
Expand Down
2 changes: 0 additions & 2 deletions Mathlib/Data/Real/CauSeq.lean
Expand Up @@ -928,7 +928,6 @@ protected theorem sup_eq_right {a b : CauSeq α abs} (h : a ≤ b) : a ⊔ b ≈
exact ε0.le.trans (h _ hj)
· refine' Setoid.trans (sup_equiv_sup h (Setoid.refl _)) _
rw [CauSeq.sup_idem]
exact Setoid.refl _
#align cau_seq.sup_eq_right CauSeq.sup_eq_right

protected theorem inf_eq_right {a b : CauSeq α abs} (h : b ≤ a) : a ⊓ b ≈ b := by
Expand All @@ -941,7 +940,6 @@ protected theorem inf_eq_right {a b : CauSeq α abs} (h : b ≤ a) : a ⊓ b ≈
exact ε0.le.trans (h _ hj)
· refine' Setoid.trans (inf_equiv_inf (Setoid.symm h) (Setoid.refl _)) _
rw [CauSeq.inf_idem]
exact Setoid.refl _
#align cau_seq.inf_eq_right CauSeq.inf_eq_right

protected theorem sup_eq_left {a b : CauSeq α abs} (h : b ≤ a) : a ⊔ b ≈ a := by
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Seq/Computation.lean
Expand Up @@ -11,7 +11,7 @@ Coinductive formalization of unbounded computations.
! if you have ported upstream changes.
-/
import Mathlib.Data.Stream.Init
import Mathlib.Tactic.Basic
import Mathlib.Tactic.Common

/-!
# Coinductive formalization of unbounded computations.
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Sum/Basic.lean
Expand Up @@ -9,7 +9,7 @@ Authors: Mario Carneiro, Yury G. Kudryashov
! if you have ported upstream changes.
-/
import Mathlib.Logic.Function.Basic
import Mathlib.Mathport.Rename
import Mathlib.Tactic.Rename

/-!
# Disjoint union of types
Expand Down
5 changes: 1 addition & 4 deletions Mathlib/Data/TypeVec.lean
Expand Up @@ -11,10 +11,7 @@ Authors: Jeremy Avigad, Mario Carneiro, Simon Hudon
import Mathlib.Data.Fin.Fin2
import Mathlib.Data.TypeVec.Attr
import Mathlib.Logic.Function.Basic
import Mathlib.Tactic.Basic
import Mathlib.Tactic.ScopedNS
import Mathlib.Tactic.Replace
import Mathlib.Tactic.SolveByElim
import Mathlib.Tactic.Common

/-!
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Logic/Pairwise.lean
Expand Up @@ -11,6 +11,7 @@ Authors: Johannes Hölzl
import Mathlib.Logic.Function.Basic
import Mathlib.Logic.Relation
import Mathlib.Init.Set
import Mathlib.Tactic.Common

/-!
# Relations holding pairwise
Expand Down
4 changes: 1 addition & 3 deletions Mathlib/Logic/Relation.lean
Expand Up @@ -10,10 +10,8 @@ Authors: Johannes Hölzl
-/
import Mathlib.Logic.Relator
import Mathlib.Init.Propext
import Mathlib.Tactic.Relation.Rfl
import Mathlib.Tactic.Use
import Mathlib.Init.Data.Quot
import Mathlib.Tactic.MkIffOfInductiveProp
import Mathlib.Tactic.Common

/-!
# Relation closures
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Logic/Unique.lean
Expand Up @@ -11,7 +11,7 @@ Authors: Johan Commelin
import Mathlib.Logic.IsEmpty
import Mathlib.Init.Logic
import Mathlib.Init.Data.Fin.Basic
import Mathlib.Tactic.Inhabit
import Mathlib.Tactic.Common

/-!
# Types with a unique term
Expand Down
1 change: 1 addition & 0 deletions Mathlib/Tactic.lean
Expand Up @@ -16,6 +16,7 @@ import Mathlib.Tactic.Clear!
import Mathlib.Tactic.ClearExcept
import Mathlib.Tactic.Clear_
import Mathlib.Tactic.Coe
import Mathlib.Tactic.Common
import Mathlib.Tactic.Congr!
import Mathlib.Tactic.Constructor
import Mathlib.Tactic.Continuity
Expand Down
3 changes: 2 additions & 1 deletion Mathlib/Tactic/Backtracking.lean
Expand Up @@ -45,7 +45,8 @@ def Except.emoji : Except ε α → String
returning the list of elements on which the function fails, and the list of successful results. -/
def List.tryAllM [Monad m] [Alternative m] (L : List α) (f : α → m β) : m (List α × List β) := do
let R ← L.mapM (fun a => (Sum.inr <$> f a) <|> (pure (Sum.inl a)))
return (R.filterMap Sum.getLeft, R.filterMap Sum.getRight)
return (R.filterMap (fun s => match s with | .inl a => a | _ => none),
R.filterMap (fun s => match s with | .inr b => b | _ => none))

namespace Lean.MVarId

Expand Down
98 changes: 98 additions & 0 deletions Mathlib/Tactic/Common.lean
@@ -0,0 +1,98 @@
/-
Copyright (c) 2023 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/

/-
This file imports all tactics which do not have significant theory imports,
and hence can be imported very low in the theory import hierarchy,
thereby making tactics widely available without needing specific imports.
We include some commented out imports here, with an explanation of their theory requirements,
to save some time for anyone wondering why they are not here.
-/

import Mathlib.Mathport.Rename
import Mathlib.Tactic.Alias
import Mathlib.Tactic.ApplyCongr
-- ApplyFun imports `Mathlib.Order.Monotone.Basic`
-- import Mathlib.Tactic.ApplyFun
import Mathlib.Tactic.ApplyWith
import Mathlib.Tactic.Basic
import Mathlib.Tactic.ByContra
import Mathlib.Tactic.Cases
import Mathlib.Tactic.CasesM
import Mathlib.Tactic.Choose
import Mathlib.Tactic.Classical
import Mathlib.Tactic.Clear_
import Mathlib.Tactic.Clear!
import Mathlib.Tactic.ClearExcept
import Mathlib.Tactic.Congr!
import Mathlib.Tactic.Constructor
import Mathlib.Tactic.Contrapose
import Mathlib.Tactic.Conv
import Mathlib.Tactic.Convert
import Mathlib.Tactic.DeriveToExpr
import Mathlib.Tactic.Eqns
import Mathlib.Tactic.Existsi
import Mathlib.Tactic.Find
import Mathlib.Tactic.GeneralizeProofs
import Mathlib.Tactic.GuardGoalNums
import Mathlib.Tactic.GuardHypNums
import Mathlib.Tactic.Have
import Mathlib.Tactic.HelpCmd
import Mathlib.Tactic.HigherOrder
import Mathlib.Tactic.InferParam
import Mathlib.Tactic.Inhabit
import Mathlib.Tactic.IrreducibleDef
import Mathlib.Tactic.LabelAttr
import Mathlib.Tactic.LeftRight
import Mathlib.Tactic.LibrarySearch
import Mathlib.Tactic.Lift
import Mathlib.Tactic.MkIffOfInductiveProp
-- NormCast imports `Mathlib.Algebra.Group.Defs`
-- import Mathlib.Tactic.NormCast
import Mathlib.Tactic.NthRewrite
import Mathlib.Tactic.PermuteGoals
import Mathlib.Tactic.PrintPrefix
import Mathlib.Tactic.ProjectionNotation
import Mathlib.Tactic.Propose
import Mathlib.Tactic.PushNeg
import Mathlib.Tactic.Recover
import Mathlib.Tactic.Rename
import Mathlib.Tactic.RenameBVar
import Mathlib.Tactic.Relation.Rfl
import Mathlib.Tactic.Relation.Symm
import Mathlib.Tactic.Relation.Trans
import Mathlib.Tactic.Replace
import Mathlib.Tactic.Rewrites
import Mathlib.Tactic.RSuffices
import Mathlib.Tactic.RunCmd
import Mathlib.Tactic.ScopedNS
import Mathlib.Tactic.Set
import Mathlib.Tactic.SimpIntro
import Mathlib.Tactic.SimpRw
-- SlimCheck has unnecessarily complicated imports, and could be streamlined.
-- `Gen` / `Testable` / `Sampleable` instances for types should be out in the library,
-- rather than the theory for those types being imported into `SlimCheck`.
-- import Mathlib.Tactic.SlimCheck
import Mathlib.Tactic.SolveByElim
import Mathlib.Tactic.SplitIfs
import Mathlib.Tactic.Spread
import Mathlib.Tactic.Substs
import Mathlib.Tactic.SuccessIfFailWithMsg
import Mathlib.Tactic.SudoSetOption
import Mathlib.Tactic.SwapVar
import Mathlib.Tactic.SplitIfs
import Mathlib.Tactic.Tauto
-- TFAE imports `Mathlib.Data.List.TFAE` and thence `Mathlib.Data.List.Basic`.
-- import Mathlib.Tactic.TFAE
import Mathlib.Tactic.ToExpr
import Mathlib.Tactic.ToLevel
import Mathlib.Tactic.Trace
import Mathlib.Tactic.TryThis
import Mathlib.Tactic.TypeCheck
import Mathlib.Tactic.UnsetOption
import Mathlib.Tactic.Use
import Mathlib.Tactic.WLOG
6 changes: 3 additions & 3 deletions Mathlib/Testing/SlimCheck/Gen.lean
Expand Up @@ -4,9 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henrik Böving, Simon Hudon
-/
import Mathlib.Control.Random
import Mathlib.Data.List.Perm
import Mathlib.Data.Subtype
import Mathlib.Data.Nat.Basic
-- import Mathlib.Data.List.Perm

Check failure on line 7 in Mathlib/Testing/SlimCheck/Gen.lean

View workflow job for this annotation

GitHub Actions / Lint style

Mathlib/Testing/SlimCheck/Gen.lean#L7: ERR_MOD: Module docstring missing, or too late
-- import Mathlib.Data.Subtype
-- import Mathlib.Data.Nat.Basic

/-!
# `Gen` Monad
Expand Down
2 changes: 0 additions & 2 deletions Mathlib/Testing/SlimCheck/Testable.lean
Expand Up @@ -3,8 +3,6 @@ Copyright (c) 2022 Henrik Böving. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Henrik Böving, Simon Hudon
-/

import Mathlib.Data.Array.Basic
import Mathlib.Testing.SlimCheck.Sampleable
import Lean

Expand Down

0 comments on commit 1ce2f69

Please sign in to comment.