module_name listlengths 2 7 | index int64 0 326 | kind stringclasses 7
values | name listlengths 1 7 | signature stringlengths 0 1.77k | type stringlengths 1 7.62k | value stringlengths 3 14.5k ⌀ | docstring stringlengths 6 11.5k ⌀ |
|---|---|---|---|---|---|---|---|
[
"Mathlib",
"Tactic",
"DepRewrite"
] | 12 | instance | [
"Mathlib",
"Tactic",
"DepRewrite",
"instToStringCastMode"
] | : ToString CastMode | ToString Mathlib.Tactic.DepRewrite.CastMode | := ⟨fun
| .proofs => "proofs"
| .all => "all"⟩ | null |
[
"Mathlib",
"Tactic",
"Basic"
] | 0 | definition | [
"Mathlib",
"Tactic",
"variables"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- Syntax for the `variables` command: this command is just a stub,
and merely warns that it has been renamed to `variable` in Lean 4. -/
syntax (name := «variables») "variables" (ppSpace bracketedBinder)* : command | ("Syntax for the `variables` command: this command is just a stub,
and merely warns that it has been renamed to `variable` in Lean 4. ",f) |
[
"Mathlib",
"Tactic",
"ExistsI"
] | 0 | definition | [
"Mathlib",
"Tactic",
"tacticExistsi_,,"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | macro "existsi " es:term,+ : tactic =>
`(tactic| refine ⟨$es,*, ?_⟩) | ("`existsi e₁, e₂, ⋯` instantiates existential quantifiers in the main goal by using `e₁`, `e₂`, ...
as witnesses. `existsi e₁, e₂, ⋯` is equivalent to `refine ⟨e₁, e₂, ⋯, ?_⟩`.
See also `exists`: `exists e₁, e₂, ⋯` is equivalent to `existsi e₁, e₂, ⋯; try trivial`.
Examples:
```lean
example : ∃ x : Nat, x = x := by... |
[
"Mathlib",
"Tactic",
"ClearExclamation"
] | 0 | definition | [
"Mathlib",
"Tactic",
"clear!"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- A variant of `clear` which clears not only the given hypotheses but also any other hypotheses
depending on them -/
elab (name := clear!) "clear!" hs:(ppSpace colGt ident)* : tactic => do
let fvarIds ← getFVarIds hs
liftMetaTactic1 fun goal ↦ do
goal.tryClearMany <| (← collectForwardDeps (fvarIds.map .fv... | ("A variant of `clear` which clears not only the given hypotheses but also any other hypotheses
depending on them ",f) |
[
"Mathlib",
"Tactic",
"ToExpr"
] | 8 | instance | [
"Mathlib",
"instToExprMVarId_mathlib"
] | : ToExpr✝ (@Lean.MVarId✝.{}) | Lean.ToExpr Lean.MVarId | ToExpr | null |
[
"Mathlib",
"Tactic",
"ToExpr"
] | 0 | instance | [
"Mathlib",
"instToExprULift_mathlib"
] | {α✝} [Lean.ToExpr✝ α✝] [inst✝ : ToLevel✝.{r}] [inst✝¹ : ToLevel✝.{s}] : ToExpr✝ (@ULift✝.{r, s} α✝) | {α : Type s} → [Lean.ToExpr α] → [Lean.ToLevel] → [Lean.ToLevel] → Lean.ToExpr (ULift α) | ToExpr | null |
[
"Mathlib",
"Tactic",
"DeriveTraversable"
] | 3 | definition | [
"Mathlib",
"Deriving",
"Traversable",
"mapConstructor"
] | (c n : Name) (f α β : Expr) (args₀ : List Expr) (args₁ : List (Bool × Expr)) (m : MVarId) : TermElabM Unit | Lean.Name →
Lean.Name →
Lean.Expr →
Lean.Expr → Lean.Expr → List Lean.Expr → List (Bool × Lean.Expr) → Lean.MVarId → Lean.Elab.TermElabM Unit | := do
let ad ← getAuxDefOfDeclName
let g ← m.getType >>= instantiateMVars
let args' ← args₁.mapM (fun (y : Bool × Expr) =>
if y.1 then return mkAppN (.fvar ad) #[α, β, f, y.2]
else mapField n g.appFn! f α β y.2)
mkAppOptM c ((args₀ ++ args').map some).toArray >>= m.assign | ("similar to `traverseConstructor` but for `Functor` ",f) |
[
"Mathlib",
"Tactic",
"DeriveTraversable"
] | 13 | definition | [
"Mathlib",
"Deriving",
"Traversable",
"lawfulFunctorDeriveHandler"
] | : DerivingHandler | Lean.Elab.DerivingHandler | :=
higherOrderDeriveHandler ``LawfulFunctor deriveLawfulFunctor [functorDeriveHandler]
(fun n arg => mkAppOptM n #[arg, none]) | ("The deriving handler for `LawfulFunctor`. ",f) |
[
"Mathlib",
"Tactic",
"FBinop"
] | 5 | instance | [
"FBinopElab",
"instInhabitedSRec"
] | : Inhabited✝ (@FBinopElab.SRec✝) | Inhabited FBinopElab.SRec | Inhabited | null |
[
"Mathlib",
"Tactic",
"Qify"
] | 2 | theorem | [
"Mathlib",
"Tactic",
"Qify",
"intCast_eq"
] | (a b : ℤ) : a = b ↔ (a : ℚ) = (b : ℚ) | ∀ (a b : ℤ), a = b ↔ ↑a = ↑b | := by simp only [Int.cast_inj] | null |
[
"Mathlib",
"Tactic",
"Bound"
] | 9 | definition | [
"tacticBound[_]"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- `bound` tactic for proving inequalities via straightforward recursion on expression structure.
An example use case is
```
-- Calc example: A weak lower bound for `z ↦ z^2 + c`
lemma le_sqr_add (c z : ℝ) (cz : ‖c‖ ≤ ‖z‖) (z3 : 3 ≤ ‖z‖) :
2 * ‖z‖ ≤ ‖z^2 + c‖ := by
calc ‖z^2 + c‖
_ ≥ ‖z^2‖ - ‖c‖ := by boun... | ("`bound` tactic for proving inequalities via straightforward recursion on expression structure.
An example use case is
```
-- Calc example: A weak lower bound for `z ↦ z^2 + c`
lemma le_sqr_add (c z : ℝ) (cz : ‖c‖ ≤ ‖z‖) (z3 : 3 ≤ ‖z‖) :
2 * ‖z‖ ≤ ‖z^2 + c‖ := by
calc ‖z^2 + c‖
_ ≥ ‖z^2‖ - ‖c‖ := by bound
... |
[
"Mathlib",
"Tactic",
"Inhabit"
] | 0 | definition | [
"Lean",
"Elab",
"Tactic",
"nonempty_to_inhabited"
] | (α : Sort*) (_ : Nonempty α) : Inhabited α | (α : Sort u_1) → Nonempty α → Inhabited α | :=
Inhabited.mk (Classical.ofNonempty) | ("Derives `Inhabited α` from `Nonempty α` with `Classical.choice`. ",f) |
[
"Mathlib",
"Tactic",
"Order"
] | 2 | definition | [
"Mathlib",
"Tactic",
"Order",
"findContradictionWithNle"
] | (g : Graph) (facts : Array AtomicFact) : AtomM <| Option Expr | Mathlib.Tactic.Order.Graph → Array Mathlib.Tactic.Order.AtomicFact → Mathlib.Tactic.AtomM (Option Lean.Expr) | := do
for fact in facts do
if let .nle lhs rhs proof := fact then
let some pf ← g.buildTransitiveLeProof lhs rhs | continue
return some <| mkApp proof pf
return none | ("Using the `≤`-graph `g`, find a contradiction with some `≰`-fact. ",f) |
[
"Mathlib",
"Tactic",
"Order"
] | 3 | definition | [
"Mathlib",
"Tactic",
"Order",
"updateGraphWithNltInfSup"
] | (g : Graph) (facts : Array AtomicFact) : AtomM Graph | Mathlib.Tactic.Order.Graph → Array Mathlib.Tactic.Order.AtomicFact → Mathlib.Tactic.AtomM Mathlib.Tactic.Order.Graph | := do
let nltFacts := facts.filter fun fact => fact matches .nlt ..
let mut usedNltFacts : Vector Bool _ := .replicate nltFacts.size false
let infSupFacts := facts.filter fun fact => fact matches .isInf .. | .isSup ..
let mut g := g
let vertices : Std.HashSet Nat := g.fold (init := ∅) fun acc v edges =>
(... | ("Adds edges to the `≤`-graph using two types of facts:
1. Each fact `¬ (x < y)` allows to add the edge `(x, y)` when `y` is reachable from `x` in the
graph.
2. Each fact `x ⊔ y = z` allows to add the edge `(z, s)` when `s` is reachable from both `x`
and `y`.
We repeat the process until no more edges can be added. ",f... |
[
"Mathlib",
"Tactic",
"DepRewrite"
] | 25 | definition | [
"Mathlib",
"Tactic",
"DepRewrite",
"depRewriteSeq"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /--
`rewrite!` is like `rewrite`,
but can also insert casts to adjust types that depend on the LHS of a rewrite.
It is available as an ordinary tactic and a `conv` tactic.
The sort of casts that are inserted is controlled by the `castMode` configuration option.
By default, only proof terms are casted;
by proof irrelev... | ("`rewrite!` is like `rewrite`,
but can also insert casts to adjust types that depend on the LHS of a rewrite.
It is available as an ordinary tactic and a `conv` tactic.
The sort of casts that are inserted is controlled by the `castMode` configuration option.
By default, only proof terms are casted;
by proof irrelevan... |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Defs"
] | 33 | theorem | [
"ComputeAsymptotics",
"MultiseriesExpansion",
"Multiseries",
"map_comp"
] | {b₁ b₂ b₃ bs₁ bs₂ bs₃} (f₁ : ℝ → ℝ) (g₁ : MultiseriesExpansion bs₁ → MultiseriesExpansion bs₂) (f₂ : ℝ → ℝ)
(g₂ : MultiseriesExpansion bs₂ → MultiseriesExpansion bs₃) (ms : Multiseries b₁ bs₁) :
(ms.map (f₂ ∘ f₁) (g₂ ∘ g₁) : Multiseries b₃ bs₃) = (ms.map f₁ g₁ : Multiseries b₂ bs₂).map f₂ g₂ | ∀ {b₁ b₂ b₃ : ℝ → ℝ} {bs₁ bs₂ bs₃ : ComputeAsymptotics.Basis} (f₁ : ℝ → ℝ)
(g₁ : ComputeAsymptotics.MultiseriesExpansion bs₁ → ComputeAsymptotics.MultiseriesExpansion bs₂) (f₂ : ℝ → ℝ)
(g₂ : ComputeAsymptotics.MultiseriesExpansion bs₂ → ComputeAsymptotics.MultiseriesExpansion bs₃)
(ms : ComputeAsymptotics.Multise... | := by
simp [map, ← Stream'.Seq.map_comp]
rfl | null |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Defs"
] | 22 | theorem | [
"ComputeAsymptotics",
"MultiseriesExpansion",
"Multiseries",
"destruct_nil"
] | {basis_hd : ℝ → ℝ} {basis_tl : Basis} : destruct (nil : Multiseries basis_hd basis_tl) = none | ∀ {basis_hd : ℝ → ℝ} {basis_tl : ComputeAsymptotics.Basis},
ComputeAsymptotics.MultiseriesExpansion.Multiseries.nil.destruct = none | := by
simp [destruct, nil] | null |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Defs"
] | 4 | definition | [
"ComputeAsymptotics",
"MultiseriesExpansion",
"Multiseries",
"nil"
] | {basis_hd basis_tl} : Multiseries basis_hd basis_tl | {basis_hd : ℝ → ℝ} →
{basis_tl : ComputeAsymptotics.Basis} → ComputeAsymptotics.MultiseriesExpansion.Multiseries basis_hd basis_tl | := Seq.nil | ("The empty multiseries. ",f) |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Corecursion"
] | 24 | definition | [
"Tactic",
"ComputeAsymptotics",
"Seq",
"gcorec"
] | (F : β → Option (α × γ × β)) (op : γ → Seq α → Seq α) [FriendlyOperationClass op] : β → Seq α | {α : Type u_1} →
{β : Type u_2} →
{γ : Type u_3} →
(β → Option (α × γ × β)) →
(op : γ → Stream'.Seq α → Stream'.Seq α) →
[Tactic.ComputeAsymptotics.Seq.FriendlyOperationClass op] → β → Stream'.Seq α | := (FriendlyOperation.exists_fixed_point F op).choose | ("(General) non-primitive corecursor for `Seq α` that allows using a friendly operation in the
tail of the corecursive definition. ",f) |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Corecursion"
] | 7 | instance | [
"Tactic",
"ComputeAsymptotics",
"Seq",
"instBoundedSpaceSeq"
] | : BoundedSpace (Seq α) | ∀ {α : Type u_1}, BoundedSpace (Stream'.Seq α) | :=
instBoundedSpaceSubtype | null |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Corecursion"
] | 11 | theorem | [
"Tactic",
"ComputeAsymptotics",
"Seq",
"dist_eq_one_of_head"
] | {s t : Seq α} (h : s.head ≠ t.head) : dist s t = 1 | ∀ {α : Type u_1} {s t : Stream'.Seq α}, s.head ≠ t.head → dist s t = 1 | := by
rw [Subtype.dist_eq, PiNat.dist_eq_of_ne]
· convert pow_zero _
simp only [PiNat.firstDiff, ne_eq, Classical.dite_not, dite_eq_left_iff,
Nat.find_eq_zero]
intro h'
simpa [Stream'.cons]
· rw [Subtype.coe_ne_coe]
contrapose! h
simp [h] | null |
[
"Mathlib",
"Tactic",
"Simproc",
"ExistsAndEq"
] | 2 | instance | [
"ExistsAndEq",
"instBEqGoTo"
] | : BEq✝ (@ExistsAndEq.GoTo✝) | BEq ExistsAndEq.GoTo | BEq | null |
[
"Mathlib",
"Tactic",
"ComputeAsymptotics",
"Multiseries",
"Basis"
] | 14 | theorem | [
"Tactic",
"ComputeAsymptotics",
"WellFormedBasis",
"eventually_pos"
] | {basis : Basis} (h : WellFormedBasis basis) : ∀ᶠ x in atTop, ∀ f ∈ basis, 0 < f x | ∀ {basis : Tactic.ComputeAsymptotics.Basis},
Tactic.ComputeAsymptotics.WellFormedBasis basis → ∀ᶠ (x : ℝ) in Filter.atTop, ∀ f ∈ basis, 0 < f x | := by
induction basis with
| nil => simp
| cons hd tl ih =>
simp only [WellFormedBasis, List.pairwise_cons, List.mem_cons, forall_eq_or_imp] at h
simp only [List.mem_cons, forall_eq_or_imp]
exact (h.right.left.eventually <| eventually_gt_atTop 0).and (ih (by tauto)) | ("Eventually all functions from a well-formed basis are positive. ",f) |
[
"Mathlib",
"Tactic",
"Simproc",
"ExistsAndEq"
] | 17 | definition | [
"ExistsAndEq",
"withExistsElimAlongPath"
] | {u : Level} {α : Q(Sort u)}
{P goal : Q(Prop)} (h : Q($P)) {a a' : Q($α)} (exs : List VarQ) (path : Path)
(act : Q($a = $a') → List HypQ → MetaM Q($goal)) :
MetaM Q($goal) | {u : Lean.Level} →
{α : Q(Sort u)} →
{P goal : Q(Prop)} →
Q(«$P») →
{a a' : Q(«$α»)} →
List ExistsAndEq.VarQ →
ExistsAndEq.Path → (Q(«$a» = «$a'») → List ExistsAndEq.HypQ → Lean.MetaM Q(«$goal»)) → Lean.MetaM Q(«$goal») | :=
withExistsElimAlongPathImp h exs path [] act | ("Given `act : (a = a') → hb₁ → hb₂ → ... → hbₙ → goal` where `hb₁, ..., hbₙ` are hypotheses
obtained when unpacking existential quantifiers with variables from `exs`, it proves `goal` using
`Exists.elim`. We use this to prove implication in the forward direction. ",f) |
[
"Mathlib",
"Tactic",
"Simproc",
"ExistsAndEq"
] | 15 | definition | [
"ExistsAndEq",
"mkAfterToBefore"
] | {u : Level} {α : Q(Sort u)} {p : Q($α → Prop)}
{P' : Q(Prop)} (a' : Q($α)) (newBody : Q(Prop)) (fvars : List VarQ) (path : Path) :
MetaM <| Q($P' → (∃ a, $p a)) | {u : Lean.Level} →
{α : Q(Sort u)} →
{p : Q(«$α» → Prop)} →
{P' : Q(Prop)} → Q(«$α») → Q(Prop) → List ExistsAndEq.VarQ → ExistsAndEq.Path → Lean.MetaM Q(«$P'» → ∃ a, «$p» a) | := do
withLocalDeclQ .anonymous .default P' fun (h : Q($P')) => do
let pf : Q(∃ a, $p a) ← withNestedExistsElim fvars h fun (h : Q($newBody)) => do
let pf1 : Q($p $a') ← go h fvars path
return q(Exists.intro $a' $pf1)
mkLambdaFVars #[h] pf
where
/-- Traverses `P` and `goal` simultaneously, provi... | ("Generates a proof of `P' → ∃ a, p a`. We assume that `fvars = [f₁, ..., fₙ]` are free variables
and `P' = ∃ f₁ ... fₙ, newBody`, and `path` leads to `a = a'` in `∃ a, p a`.
The proof follows the following structure:
```
example {α β : Type} (f : β → α) {p : α → Prop} :
(∃ b, p (f b) ∧ f b = f b) → (∃ a, p a ∧ ∃ ... |
[
"Mathlib",
"Tactic",
"Order",
"CollectFacts"
] | 11 | definition | [
"Mathlib",
"Tactic",
"Order",
"collectFacts"
] | (only? : Bool) (hyps : Array Expr) (negGoal : Expr) : AtomM <| Std.HashMap Expr <| Array AtomicFact | Bool →
Array Lean.Expr → Lean.Expr → Mathlib.Tactic.AtomM (Std.HashMap Lean.Expr (Array Mathlib.Tactic.Order.AtomicFact)) | := do
return (← (collectFactsImp only? hyps negGoal).run ∅).snd | ("Collects facts from the local context. `negGoal` is the negated goal, `hyps` is the expressions
passed to the tactic using square brackets. If `only?` is true, we collect facts only from `hyps`
and `negGoal`, otherwise we also use the local context.
For each occurring type `α`, the returned map contains an array con... |
[
"Mathlib",
"Tactic",
"Widget",
"Conv"
] | 0 | inductive | [
"Mathlib",
"Tactic",
"Conv",
"Path"
] | Type | null | ("A path to a subexpression from a root expression.
The constructors are chosen to be easily translatable into `conv` directions.
",f) | |
[
"Mathlib",
"Tactic",
"Simproc",
"Factors"
] | 9 | definition | [
"Mathlib",
"Meta",
"Simproc",
"evalPrimeFactorsList"
] | {en enl : Q(ℕ)} (hn : Q(IsNat $en $enl)) : MetaM ((l : Q(List ℕ)) × Q(Nat.primeFactorsList $en = $l)) | {en enl : Q(ℕ)} →
Q(Mathlib.Meta.NormNum.IsNat «$en» «$enl») → Lean.MetaM ((l : Q(List ℕ)) × Q(«$en».primeFactorsList = «$l»)) | := do
match enl.natLit! with
| 0 =>
have _ : $enl =Q nat_lit 0 := ⟨⟩
have hen : Q($en = 0) := q($(hn).out)
return ⟨_, q($hen ▸ Nat.primeFactorsList_zero)⟩
| 1 =>
let _ : $enl =Q nat_lit 1 := ⟨⟩
have hen : Q($en = 1) := q($(hn).out)
return ⟨_, q($hen ▸ Nat.primeFactorsList_one)⟩
| _ => do... | ("Given a natural number `n`, returns `(l, ⊢ Nat.primeFactorsList n = l)`. ",f) |
[
"Mathlib",
"Tactic",
"Simproc",
"Factors"
] | 10 | definition | [
"Nat",
"primeFactorsList_ofNat"
] | : Lean.Meta.Simp.Simproc | Lean.Meta.Simp.Simproc | /-- A simproc for terms of the form `Nat.primeFactorsList (OfNat.ofNat n)`. -/
simproc Nat.primeFactorsList_ofNat (Nat.primeFactorsList _) := .ofQ fun u α e => do
match u, α, e with
| 1, ~q(List ℕ), ~q(Nat.primeFactorsList (OfNat.ofNat $n)) =>
let hn : Q(IsNat (OfNat.ofNat $n) $n) := q(⟨rfl⟩)
let ⟨l, p⟩ ← e... | ("A simproc for terms of the form `Nat.primeFactorsList (OfNat.ofNat n)`. ",f) |
[
"Mathlib",
"Tactic",
"Widget",
"Calc"
] | 4 | instance | [
"instRpcEncodableCalcParams"
] | : RpcEncodable✝ (@CalcParams✝) | Lean.Server.RpcEncodable CalcParams | RpcEncodable | null |
[
"Mathlib",
"Tactic",
"Widget",
"InteractiveUnfold"
] | 10 | definition | [
"Mathlib",
"Tactic",
"InteractiveUnfold",
"tacticUnfold?"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- Replace the selected expression with a definitional unfolding.
- After each unfolding, we apply `whnfCore` to simplify the expression.
- Explicit natural number expressions are evaluated.
- Unfolds of class projections of instances marked with `@[default_instance]` are not shown.
This is relevant for notational t... | ("Replace the selected expression with a definitional unfolding.
- After each unfolding, we apply `whnfCore` to simplify the expression.
- Explicit natural number expressions are evaluated.
- Unfolds of class projections of instances marked with `@[default_instance]` are not shown.
This is relevant for notational typ... |
[
"Mathlib",
"Tactic",
"Widget",
"CommDiag"
] | 2 | definition | [
"Mathlib",
"Tactic",
"Widget",
"homComp?"
] | (f : Expr) : Option (Expr × Expr) | Lean.Expr → Option (Lean.Expr × Lean.Expr) | := do
let some (_, _, _, _, _, f, g) := f.app7? ``CategoryStruct.comp | none
return (f, g) | ("Given composed homs `g ≫ h`, return `(g, h)`. Otherwise `none`. ",f) |
[
"Mathlib",
"Tactic",
"Translate",
"ToAdditive"
] | 0 | definition | [
"Mathlib",
"Tactic",
"ToAdditive",
"to_additive_ignore_args"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | @[inherit_doc TranslateData.ignoreArgsAttr]
syntax (name := to_additive_ignore_args) "to_additive_ignore_args" (ppSpace num)* : attr | null |
[
"Mathlib",
"Tactic",
"Translate",
"UnfoldBoundary"
] | 13 | definition | [
"Mathlib",
"Tactic",
"UnfoldBoundary",
"registerUnfoldBoundaryExt"
] | : IO UnfoldBoundaryExt | IO Mathlib.Tactic.UnfoldBoundary.UnfoldBoundaryExt | := do
registerSimplePersistentEnvExtension {
addEntryFn := UnfoldBoundaries.insert
addImportedFn as := as.foldl (Array.foldl (·.insert ·)) {}
} | ("Register a new `UnfoldBoundaryExt`. ",f) |
[
"Mathlib",
"Tactic",
"Translate",
"UnfoldBoundary"
] | 9 | definition | [
"Mathlib",
"Tactic",
"UnfoldBoundary",
"UnfoldBoundaries",
"unfoldInsertions"
] | (e : Expr) (b : UnfoldBoundaries) : CoreM Expr | Lean.Expr → Mathlib.Tactic.UnfoldBoundary.UnfoldBoundaries → Lean.CoreM Lean.Expr | :=
-- This is the same as `Meta.deltaExpand`, but with an extra beta reduction.
Core.transform e fun e => do
if let some e ← delta? e b.insertionFuns.contains then
return .visit (headBetaBody e)
return .continue
where
headBetaBody (e : Expr) : Expr :=
match e with
| .lam _ d b bi => e.update... | ("Unfold all of the auxiliary functions that were inserted as unfold boundaries. ",f) |
[
"Mathlib",
"Tactic",
"Translate",
"UnfoldBoundary"
] | 7 | definition | [
"Mathlib",
"Tactic",
"UnfoldBoundary",
"UnfoldBoundaries",
"cast"
] | (b : UnfoldBoundaries) (e expectedType : Expr) (attr : Name) : MetaM Expr | Mathlib.Tactic.UnfoldBoundary.UnfoldBoundaries → Lean.Expr → Lean.Expr → Lean.Name → Lean.MetaM Lean.Expr | :=
run b <|
try
mkCast b e expectedType
catch ex =>
throwError "@[{attr}] failed to insert a cast to make `{e}` \
have type `{expectedType}`\n\n{ex.toMessageData}" | ("Modify `e` so that it has type `expectedType` if the constants in `b` cannot be unfolded. ",f) |
[
"Mathlib",
"Tactic",
"Simps",
"Basic"
] | 64 | opaque | [
"simpsAttr"
] | : ParametricAttribute (Array Name) | Lean.ParametricAttribute (Array Lean.Name) | /-- The `simps` attribute. -/
initialize simpsAttr : ParametricAttribute (Array Name) ←
registerParametricAttribute {
name := `simps
/- So as to be run _after_ the `instance` attribute, as this handler uses
`Lean.Meta.isInstance`, which requires the `instance` handler to have
already run. -/
appli... | ("The `simps` attribute. ",f) |
[
"Mathlib",
"Tactic",
"Simps",
"Basic"
] | 19 | definition | [
"Lean",
"Parser",
"Command",
"simpsRule",
"prefix"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- Syntax for making a projection prefix. -/
syntax simpsRule.prefix := &"as_prefix " ident | ("Syntax for making a projection prefix. ",f) |
[
"Mathlib",
"Tactic",
"Simps",
"Basic"
] | 3 | definition | [
"Lean",
"Parser",
"Attr",
"simps"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- The `@[simps]` attribute automatically derives lemmas specifying the projections of this
declaration.
Example:
```lean
@[simps] def foo : ℕ × ℤ := (1, 2)
```
derives two `simp` lemmas:
```lean
@[simp] lemma foo_fst : foo.fst = 1
@[simp] lemma foo_snd : foo.snd = 2
```
* It does not derive `simp` lemmas for the pr... | ("The `@[simps]` attribute automatically derives lemmas specifying the projections of this
declaration.
Example:
```lean
@[simps] def foo : ℕ × ℤ := (1, 2)
```
derives two `simp` lemmas:
```lean
@[simp] lemma foo_fst : foo.fst = 1
@[simp] lemma foo_snd : foo.snd = 2
```
* It does not derive `simp` lemmas for the prop... |
[
"Mathlib",
"Tactic",
"Simps",
"Basic"
] | 50 | definition | [
"Simps",
"elabSimpsRule"
] | : Syntax → CommandElabM ProjectionRule | Lean.Syntax → Lean.Elab.Command.CommandElabM Simps.ProjectionRule | | `(simpsRule| $id1 → $id2) => return .rename id1.getId id1.raw id2.getId id2.raw
| `(simpsRule| - $id) => return .erase id.getId id.raw
| `(simpsRule| + $id) => return .add id.getId id.raw
| `(simpsRule| as_prefix $id) => return .prefix id.getId id.raw
| _ => Elab.th... | ("Parse a rule for `initialize_simps_projections`. It is `<name>→<name>`, `-<name>`, `+<name>`
or `as_prefix <name>`. ",f) |
[
"Mathlib",
"Tactic",
"Simps",
"Basic"
] | 28 | instance | [
"Simps",
"instInhabitedProjectionData"
] | : Inhabited✝ (@Simps.ProjectionData✝) | Inhabited Simps.ProjectionData | Inhabited | null |
[
"Mathlib",
"Tactic",
"Simps",
"NotationClass"
] | 0 | definition | [
"notation_class"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- The `@[notation_class]` attribute specifies that this is a notation class,
and this notation should be used instead of projections by `@[simps]`.
* This is only important if the projection is written differently using notation, e.g.
`+` uses `HAdd.hAdd`, not `Add.add` and `0` uses `OfNat.ofNat` not `Zero.zero... | ("The `@[notation_class]` attribute specifies that this is a notation class,
and this notation should be used instead of projections by `@[simps]`.
* This is only important if the projection is written differently using notation, e.g.
`+` uses `HAdd.hAdd`, not `Add.add` and `0` uses `OfNat.ofNat` not `Zero.zero`.... |
[
"Mathlib",
"Tactic",
"Simps",
"NotationClass"
] | 5 | definition | [
"Simps",
"nsmulArgs"
] | : findArgType | Simps.findArgType | := fun _ _ args ↦
return #[Expr.const `Nat [], args[0]?.getD default] ++ args |>.map some | ("Find arguments by prepending `ℕ` and duplicating the first argument. Used for `nsmul`. ",f) |
[
"Mathlib",
"Tactic",
"Simps",
"NotationClass"
] | 11 | instance | [
"Simps",
"instInhabitedAutomaticProjectionData"
] | : Inhabited✝ (@Simps.AutomaticProjectionData✝) | Inhabited Simps.AutomaticProjectionData | Inhabited | null |
[
"Mathlib",
"Tactic",
"NormNum",
"Result"
] | 49 | definition | [
"Mathlib",
"Meta",
"NormNum",
"Result",
"isNegNat"
] | {α : Q(Type u)} {x : Q($α)} :
∀ (inst : Q(Ring $α) := by assumption) (lit : Q(ℕ)) (proof : Q(IsInt $x (.negOfNat $lit))), Result x | {u : Lean.Level} →
{α : Q(Type u)} →
{x : Q(«$α»)} →
(inst : autoParam Q(Ring «$α») Mathlib.Meta.NormNum.Result.isNegNat._auto_1) →
(lit : Q(ℕ)) → Q(Mathlib.Meta.NormNum.IsInt «$x» (Int.negOfNat «$lit»)) → Mathlib.Meta.NormNum.Result x | := Result'.isNegNat | ("The result is `-lit` where `lit` is a raw nat literal
and `proof : isInt x (.negOfNat lit)`. ",f) |
[
"Mathlib",
"Tactic",
"NormNum",
"Result"
] | 6 | definition | [
"Mathlib",
"Meta",
"NormNum",
"mkRawIntLit"
] | (n : ℤ) : Q(ℤ) | ℤ → Q(ℤ) | :=
let lit : Q(ℕ) := mkRawNatLit n.natAbs
if 0 ≤ n then q(.ofNat $lit) else q(.negOfNat $lit) | ("Represent an integer as a ""raw"" typed expression.
This uses `.lit (.natVal n)` internally to represent a natural number,
rather than the preferred `OfNat.ofNat` form.
We use this internally to avoid unnecessary typeclass searches.
This function is the inverse of `Expr.intLit!`.
",f) |
[
"Mathlib",
"Tactic",
"NormNum",
"Result"
] | 34 | theorem | [
"Mathlib",
"Meta",
"NormNum",
"IsRat",
"to_raw_eq"
] | {n : ℤ} {d : ℕ} [DivisionRing α] : ∀ {a}, IsRat (a : α) n d → a = Rat.rawCast n d | ∀ {α : Type u} {n : ℤ} {d : ℕ} [inst : DivisionRing α] {a : α}, Mathlib.Meta.NormNum.IsRat a n d → a = Rat.rawCast n d | | _, ⟨inv, rfl⟩ => by simp [div_eq_mul_inv] | null |
[
"Mathlib",
"Tactic",
"NormNum",
"Result"
] | 39 | theorem | [
"Mathlib",
"Meta",
"NormNum",
"IsNNRat",
"den_nz"
] | {α} [DivisionSemiring α] {a n d} : IsNNRat (a : α) n d → (d : α) ≠ 0 | ∀ {α : Type u_1} [inst : DivisionSemiring α] {a : α} {n d : ℕ}, Mathlib.Meta.NormNum.IsNNRat a n d → ↑d ≠ 0 | | ⟨_, _⟩ => Invertible.ne_zero (d : α) | null |
[
"Mathlib",
"Tactic",
"NormNum",
"Ordinal"
] | 8 | theorem | [
"Mathlib",
"Meta",
"NormNum",
"isNat_ordinalSub"
] | : ∀ {a b : Ordinal.{u}} {an bn rn : ℕ}, IsNat a an → IsNat b bn → an - bn = rn → IsNat (a - b) rn | ∀ {a b : Ordinal.{u}} {an bn rn : ℕ},
Mathlib.Meta.NormNum.IsNat a an →
Mathlib.Meta.NormNum.IsNat b bn → an - bn = rn → Mathlib.Meta.NormNum.IsNat (a - b) rn | | _, _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, rfl => ⟨Eq.symm <| natCast_sub ..⟩ | null |
[
"Mathlib",
"Tactic",
"NormNum",
"Ordinal"
] | 1 | definition | [
"Mathlib",
"Meta",
"NormNum",
"evalOrdinalMul"
] | : NormNumExt | Mathlib.Meta.NormNum.NormNumExt | where
eval {u α} e := do
let some u' := u.dec | throwError "level is not succ"
haveI' : u =QL u' + 1 := ⟨⟩
match α, e with
| ~q(Ordinal.{u'}), ~q(($a : Ordinal) * ($b : Ordinal)) =>
let i : Q(AddMonoidWithOne Ordinal.{u'}) := q(inferInstance)
let ⟨an, pa⟩ ← deriveNat a i
let ⟨bn, pb⟩... | ("The `norm_num` extension for multiplication on ordinals. ",f) |
[
"Mathlib",
"Tactic",
"NormNum",
"Eq"
] | 0 | theorem | [
"Mathlib",
"Meta",
"NormNum",
"isNat_eq_false"
] | [AddMonoidWithOne α] [CharZero α] : {a b : α} → {a' b' : ℕ} → IsNat a a' → IsNat b b' → Nat.beq a' b' = false → ¬a = b | ∀ {α : Type u_1} [inst : AddMonoidWithOne α] [CharZero α] {a b : α} {a' b' : ℕ},
Mathlib.Meta.NormNum.IsNat a a' → Mathlib.Meta.NormNum.IsNat b b' → a'.beq b' = false → ¬a = b | | _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, h => by simpa using Nat.ne_of_beq_eq_false h | null |
[
"Mathlib",
"Tactic",
"NormNum",
"RealSqrt"
] | 2 | theorem | [
"Tactic",
"NormNum",
"isNNRat_nnrealSqrt_of_isNNRat"
] | {x : ℝ≥0} {n sn : ℕ} {d sd : ℕ} (hn : sn * sn = n) (hd : sd * sd = d) (h : IsNNRat x n d) :
IsNNRat (NNReal.sqrt x) sn sd | ∀ {x : NNReal} {n sn d sd : ℕ},
sn * sn = n → sd * sd = d → Mathlib.Meta.NormNum.IsNNRat x n d → Mathlib.Meta.NormNum.IsNNRat (NNReal.sqrt x) sn sd | := by
obtain ⟨_, rfl⟩ := h
refine ⟨?_, ?out⟩
· apply invertibleOfNonzero
rw [← mul_self_ne_zero, ← Nat.cast_mul, hd]
exact Invertible.ne_zero _
· simp [← hn, ← hd, NNReal.sqrt_mul] | null |
[
"Mathlib",
"Tactic",
"NormNum",
"BigOperators"
] | 3 | definition | [
"Mathlib",
"Meta",
"List",
"ProveNilOrConsResult",
"uncheckedCast"
] | {α : Q(Type u)} {β : Q(Type v)} (s : Q(List $α)) (t : Q(List $β)) :
List.ProveNilOrConsResult s → List.ProveNilOrConsResult t | {u v : Lean.Level} →
{α : Q(Type u)} →
{β : Q(Type v)} →
(s : Q(List «$α»)) →
(t : Q(List «$β»)) → Mathlib.Meta.List.ProveNilOrConsResult s → Mathlib.Meta.List.ProveNilOrConsResult t | | .nil pf => .nil pf
| .cons a s' pf => .cons a s' pf | ("If `s` unifies with `t`, convert a result for `s` to a result for `t`.
If `s` does not unify with `t`, this results in a type-incorrect proof.
",f) |
[
"Mathlib",
"Tactic",
"FunProp",
"Mor"
] | 1 | definition | [
"Mathlib",
"Meta",
"FunProp",
"Mor",
"isCoeFunName"
] | (name : Name) : CoreM Bool | Lean.Name → Lean.CoreM Bool | := do
let some info ← getCoeFnInfo? name | return false
return info.type == .coeFun | ("Is `name` a coercion from some function space to functions? ",f) |
[
"Mathlib",
"Tactic",
"FunProp",
"Mor"
] | 12 | definition | [
"Mathlib",
"Meta",
"FunProp",
"Mor",
"mkAppN"
] | (f : Expr) (xs : Array Arg) : Expr | Lean.Expr → Array Mathlib.Meta.FunProp.Mor.Arg → Lean.Expr | :=
xs.foldl (init := f) (fun f x =>
match x with
| ⟨x, .none⟩ => (f.app x)
| ⟨x, some coe⟩ => (coe.app f).app x) | ("`mkAppN f #[a₀, ..., aₙ]` ==> `f a₀ a₁ .. aₙ` where `f` can be bundled morphism. ",f) |
[
"Mathlib",
"Tactic",
"FunProp",
"Mor"
] | 11 | definition | [
"Mathlib",
"Meta",
"FunProp",
"Mor",
"getAppArgs"
] | (e : Expr) : MetaM (Array Arg) | Lean.Expr → Lean.MetaM (Array Mathlib.Meta.FunProp.Mor.Arg) | := withApp e fun _ xs => return xs | ("Given `f a₁ a₂ ... aₙ`, returns `#[a₁, ..., aₙ]` where `f` can be bundled morphism. ",f) |
[
"Mathlib",
"Tactic",
"FunProp",
"Types"
] | 9 | definition | [
"Mathlib",
"Meta",
"FunProp",
"ppOrigin"
] | {m} [Monad m] [MonadEnv m] [MonadError m] : Origin → m MessageData | {m : Type → Type} →
[Monad m] → [Lean.MonadEnv m] → [Lean.MonadError m] → Mathlib.Meta.FunProp.Origin → m Lean.MessageData | | .decl n => return m!"{← mkConstWithLevelParams n}"
| .fvar n => return mkFVar n | ("Pretty print `FunProp.Origin`. ",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"CheckCompositions"
] | 1 | definition | [
"Mathlib",
"Tactic",
"CheckCompositions",
"checkComposition"
] | (e : Expr) : MetaM Unit | Lean.Expr → Lean.MetaM Unit | := do
match_expr e with
| CategoryStruct.comp _ _ X Y Z f g =>
match_expr ← inferType f with
| Quiver.Hom _ _ X' Y' =>
withReducibleAndInstances do
if !(← isDefEq X' X) then
logInfo m!"In composition\n {e}\nthe source of\n {f}\nis\n {X'}\nbut should be\n {X}"
if !(← isDef... | ("Given a composition `CategoryStruct.comp _ _ X Y Z f g`,
infer the types of `f` and `g` and check whether their sources and targets agree,
at ""instances and reducible"" transparency, with `X`, `Y`, and `Z`,
reporting any discrepancies. ",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Elementwise"
] | 5 | definition | [
"Mathlib",
"Tactic",
"Elementwise",
"elementwise"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- The `elementwise` attribute can be added to a lemma proving an equation of morphisms, and it
creates a new lemma for a `ConcreteCategory` giving an equation with those morphisms applied
to some value.
Syntax examples:
- `@[elementwise]`
- `@[elementwise nosimp]` to not use `simp` on both sides of the generated lem... | ("The `elementwise` attribute can be added to a lemma proving an equation of morphisms, and it
creates a new lemma for a `ConcreteCategory` giving an equation with those morphisms applied
to some value.
Syntax examples:
- `@[elementwise]`
- `@[elementwise nosimp]` to not use `simp` on both sides of the generated lemma... |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Reassoc"
] | 4 | definition | [
"Mathlib",
"Tactic",
"Reassoc",
"reassoc"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /--
Adding `@[reassoc]` to a lemma named `F` of shape `∀ .., f = g`, where `f g : X ⟶ Y` are
morphisms in some category, will create a new lemma named `F_assoc` of shape
`∀ .. {Z : C} (h : Y ⟶ Z), f ≫ h = g ≫ h`
but with the conclusions simplified using the axioms for a category
(`Category.comp_id`, `Category.id_comp`,... | ("Adding `@[reassoc]` to a lemma named `F` of shape `∀ .., f = g`, where `f g : X ⟶ Y` are
morphisms in some category, will create a new lemma named `F_assoc` of shape
`∀ .. {Z : C} (h : Y ⟶ Z), f ≫ h = g ≫ h`
but with the conclusions simplified using the axioms for a category
(`Category.comp_id`, `Category.id_comp`, a... |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Reassoc"
] | 9 | definition | [
"Mathlib",
"Tactic",
"Reassoc",
"reassocExpr'"
] | (pf : Expr) : TermElabM Expr | Lean.Expr → Lean.Elab.TermElabM Lean.Expr | := do
let (e, insts) ← reassocExpr pf
for inst in insts do
inst.withContext do
unless ← Term.synthesizeInstMVarCore inst do
Term.registerSyntheticMVarWithCurrRef inst (.typeClass none)
return e | ("Version of `reassocExpr` for the `TermElabM` monad. Handles instance metavariables automatically.
",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"MonoidalComp"
] | 13 | instance | [
"CategoryTheory",
"MonoidalCoherence",
"whiskerLeft"
] | (X Y Z : C) [MonoidalCoherence Y Z] : MonoidalCoherence (X ⊗ Y) (X ⊗ Z) | {C : Type u} →
[inst : CategoryTheory.Category.{v, u} C] →
[inst_1 : CategoryTheory.MonoidalCategory C] →
(X Y Z : C) →
[CategoryTheory.MonoidalCoherence Y Z] →
CategoryTheory.MonoidalCoherence (CategoryTheory.MonoidalCategoryStruct.tensorObj X Y)
(CategoryTheory.MonoidalCatego... | :=
⟨whiskerLeftIso X ⊗𝟙⟩ | null |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"MonoidalComp"
] | 4 | definition | [
"CategoryTheory",
"monoidalComp"
] | {W X Y Z : C} [MonoidalCoherence X Y] (f : W ⟶ X) (g : Y ⟶ Z) : W ⟶ Z | {C : Type u} →
[inst : CategoryTheory.Category.{v, u} C] →
{W X Y Z : C} → [CategoryTheory.MonoidalCoherence X Y] → (W ⟶ X) → (Y ⟶ Z) → (W ⟶ Z) | :=
f ≫ ⊗𝟙.hom ≫ g | ("Compose two morphisms in a monoidal category,
inserting unitors and associators between as necessary. ",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Slice"
] | 0 | definition | [
"Mathlib",
"Tactic",
"Slice",
"slice"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /--
`slice` is a conv tactic; if the current focus is a composition of several morphisms,
`slice a b` reassociates as needed, and zooms in on the `a`-th through `b`-th morphisms.
Thus if the current focus is `(a ≫ b) ≫ ((c ≫ d) ≫ e)`, then `slice 2 3` zooms to `b ≫ c`.
-/
syntax (name := slice) "slice " num ppSpace num... | ("`slice` is a conv tactic; if the current focus is a composition of several morphisms,
`slice a b` reassociates as needed, and zooms in on the `a`-th through `b`-th morphisms.
Thus if the current focus is `(a ≫ b) ≫ ((c ≫ d) ≫ e)`, then `slice 2 3` zooms to `b ≫ c`.
",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"BicategoryCoherence"
] | 12 | instance | [
"Mathlib",
"Tactic",
"BicategoryCoherence",
"liftHom₂WhiskerRight"
] | {f g : a ⟶ b} (η : f ⟶ g) [LiftHom f] [LiftHom g] [LiftHom₂ η] {h : b ⟶ c} [LiftHom h] : LiftHom₂ (η ▷ h) | {B : Type u} →
[inst : CategoryTheory.Bicategory B] →
{a b c : B} →
{f g : a ⟶ b} →
(η : f ⟶ g) →
[inst_1 : Mathlib.Tactic.BicategoryCoherence.LiftHom f] →
[inst_2 : Mathlib.Tactic.BicategoryCoherence.LiftHom g] →
[Mathlib.Tactic.BicategoryCoherence.LiftHom₂ η] →
... | where
lift := LiftHom₂.lift η ▷ LiftHom.lift h | null |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Coherence",
"Normalize"
] | 0 | inductive | [
"Mathlib",
"Tactic",
"BicategoryLike",
"WhiskerRight"
] | : Type | Type | null | ("Expressions of the form `η ▷ f₁ ▷ ... ▷ fₙ`. ",f) |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Coherence",
"Normalize"
] | 36 | definition | [
"Mathlib",
"Tactic",
"BicategoryLike",
"Eval",
"instInhabitedResult",
"default"
] | : @Mathlib.Tactic.BicategoryLike.Eval.Result✝ | Mathlib.Tactic.BicategoryLike.Eval.Result | Inhabited | null |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Coherence",
"Datatypes"
] | 43 | definition | [
"Mathlib",
"Tactic",
"BicategoryLike",
"instInhabitedNormalizedHom",
"default"
] | : @Mathlib.Tactic.BicategoryLike.NormalizedHom✝ | Mathlib.Tactic.BicategoryLike.NormalizedHom | Inhabited | null |
[
"Mathlib",
"Tactic",
"CategoryTheory",
"Bicategory",
"Datatypes"
] | 7 | abbrev | [
"Mathlib",
"Tactic",
"Bicategory",
"BicategoryM"
] | Type → Type | := CoherenceM Context | ("The monad for the normalization of 2-morphisms. ",f) | |
[
"Mathlib",
"Tactic",
"Push",
"Attr"
] | 5 | instance | [
"Mathlib",
"Tactic",
"Push",
"instToStringHead"
] | : ToString Head | ToString Mathlib.Tactic.Push.Head | := ⟨Head.toString⟩ | null |
[
"Mathlib",
"Tactic",
"Push",
"Attr"
] | 1 | definition | [
"Mathlib",
"Tactic",
"Push",
"instInhabitedHead",
"default"
] | : @Mathlib.Tactic.Push.Head✝ | Mathlib.Tactic.Push.Head | Inhabited | null |
[
"Mathlib",
"Tactic",
"Push",
"Attr"
] | 3 | instance | [
"Mathlib",
"Tactic",
"Push",
"instBEqHead"
] | : BEq✝ (@Mathlib.Tactic.Push.Head✝) | BEq Mathlib.Tactic.Push.Head | BEq | null |
[
"Mathlib",
"Tactic",
"Push",
"Attr"
] | 6 | definition | [
"Mathlib",
"Tactic",
"Push",
"Head",
"ofExpr?"
] | : Expr → Option Head | Lean.Expr → Option Mathlib.Tactic.Push.Head | | .app f _ => f.getAppFn.constName?.map .const
| .lam .. => some .lambda
| .forallE .. => some .forall
| _ => none | ("Returns the head of an expression. ",f) |
[
"Mathlib",
"Tactic",
"Attr",
"Register"
] | 14 | definition | [
"Parser",
"Attr",
"parity_simps"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /-- Simp attribute for lemmas about `Even` -/
register_simp_attr parity_simps | ("Simp attribute for lemmas about `Even` ",f) |
[
"Mathlib",
"Tactic",
"GCongr",
"Core"
] | 20 | definition | [
"Mathlib",
"Tactic",
"GCongr",
"symmExact"
] | : ForwardExt | Mathlib.Tactic.GCongr.ForwardExt | where
eval h goal := do (← goal.applySymm).assignIfDefEq h | ("See if the term is `a ∼ b` with `∼` symmetric and the goal is `b ∼ a`. ",f) |
[
"Mathlib",
"Tactic",
"GCongr",
"Core"
] | 4 | definition | [
"Mathlib",
"Tactic",
"GCongr",
"instInhabitedGCongrLemma",
"default"
] | : @Mathlib.Tactic.GCongr.GCongrLemma✝ | Mathlib.Tactic.GCongr.GCongrLemma | Inhabited | null |
[
"Mathlib",
"Tactic",
"Sat",
"FromLRAT"
] | 16 | definition | [
"Sat",
"Fmla",
"proof"
] | (f : Fmla) (c : Clause) : Prop | Sat.Fmla → Sat.Clause → Prop | :=
∀ v : Valuation, v.satisfies_fmla f → v.satisfies c | ("`f.proof c` asserts that `c` is derivable from `f`. ",f) |
[
"Mathlib",
"Tactic",
"Sat",
"FromLRAT"
] | 8 | definition | [
"Sat",
"Fmla",
"one"
] | (c : Clause) : Fmla | Sat.Clause → Sat.Fmla | := [c] | ("A single clause as a formula. ",f) |
[
"Mathlib",
"Tactic",
"Sat",
"FromLRAT"
] | 34 | inductive | [
"Mathlib",
"Tactic",
"Sat",
"LRATStep"
] | Type | null | ("An LRAT step is either an addition or a deletion step. ",f) | |
[
"Mathlib",
"Tactic",
"Linter",
"DeprecatedModule"
] | 5 | definition | [
"Mathlib",
"Linter",
"deprecated_modules"
] | : Lean.ParserDescr✝ | Lean.ParserDescr | /--
`deprecated_module "Optional string" (since := "yyyy-mm-dd")` deprecates the current module `A`
in favour of its direct imports.
This means that any file that directly imports `A` will get a notification on the `import A` line
suggesting to instead import the *direct imports* of `A`.
-/
elab (name := deprecated_mod... | ("`deprecated_module ""Optional string"" (since := ""yyyy-mm-dd"")` deprecates the current module `A`
in favour of its direct imports.
This means that any file that directly imports `A` will get a notification on the `import A` line
suggesting to instead import the *direct imports* of `A`.
",f) |
[
"Mathlib",
"Tactic",
"Linter",
"DeprecatedSyntaxLinter"
] | 9 | opaque | [
"Mathlib",
"Linter",
"Style",
"linter",
"style",
"nativeDecide"
] | : Lean.Option✝ Bool | Lean.Option Bool | /-- The option `linter.style.nativeDecide` of the deprecated syntax linter flags usages of
the `native_decide` tactic, which is disallowed in mathlib. -/
-- Note: this linter is purely for user information. Running `lean4checker` in CI catches *any*
-- additional axioms that are introduced (not just `ofReduceBool`): th... | ("The option `linter.style.nativeDecide` of the deprecated syntax linter flags usages of
the `native_decide` tactic, which is disallowed in mathlib. ",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Parsing"
] | 13 | definition | [
"Mathlib",
"Tactic",
"Linarith",
"one"
] | : Monom | Mathlib.Tactic.Linarith.Monom | := TreeMap.empty | ("The unit monomial `one` is represented by the empty TreeMap. ",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Parsing"
] | 7 | abbrev | [
"Mathlib",
"Tactic",
"Linarith",
"Sum"
] | : Type | Type | := Map Monom ℤ | ("Linear combinations of monomials are represented by mapping monomials to coefficients. ",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Lemmas"
] | 11 | theorem | [
"Mathlib",
"Tactic",
"Linarith",
"natCast_nonneg"
] | [IsOrderedRing α] (n : ℕ) : (0 : α) ≤ n | ∀ (α : Type u) [inst : Semiring α] [inst_1 : PartialOrder α] [IsOrderedRing α] (n : ℕ), 0 ≤ ↑n | := Nat.cast_nonneg n | null |
[
"Mathlib",
"Tactic",
"Linarith",
"Lemmas"
] | 17 | definition | [
"Mathlib",
"Ineq",
"toConstMulName"
] | : Ineq → Lean.Name | Mathlib.Ineq → Lean.Name | | .lt => ``mul_neg
| .le => ``mul_nonpos
| .eq => ``mul_eq | ("Finds the name of a multiplicative lemma corresponding to an inequality strength. ",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Frontend"
] | 2 | definition | [
"Mathlib",
"Tactic",
"Linarith",
"applyContrLemma"
] | (g : MVarId) : MetaM (Option (Expr × Expr) × MVarId) | Lean.MVarId → Lean.MetaM (Option (Lean.Expr × Lean.Expr) × Lean.MVarId) | := do
try
let (nm, tp) ← getContrLemma (← withReducible g.getType')
let [g] ← g.apply (← mkConst' nm) | failure
let (f, g) ← g.intro1P
return (some (tp, .fvar f), g)
catch _ => return (none, g) | ("`applyContrLemma` inspects the target to see if it can be moved to a hypothesis by negation.
For example, a goal `⊢ a ≤ b` can become `b < a ⊢ false`.
If this is the case, it applies the appropriate lemma and introduces the new hypothesis.
It returns the type of the terms in the comparison (e.g. the type of `a` and `... |
[
"Mathlib",
"Tactic",
"Linarith",
"Oracle",
"FourierMotzkin"
] | 0 | inductive | [
"Mathlib",
"Tactic",
"Linarith",
"CompSource"
] | : Type | Type | null | ("`CompSource` tracks the source of a comparison.
The atomic source of a comparison is an assumption, indexed by a natural number.
Two comparisons can be added to produce a new comparison,
and one comparison can be scaled by a natural number to produce a new comparison.
",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Oracle",
"FourierMotzkin"
] | 27 | definition | [
"Mathlib",
"Tactic",
"Linarith",
"CertificateOracle",
"fourierMotzkin"
] | : CertificateOracle | Mathlib.Tactic.Linarith.CertificateOracle | where
produceCertificate hyps maxVar := do
let linarithData := mkLinarithData hyps maxVar
let result ←
(ExceptT.run (StateT.run (do validate; elimAllVarsM : LinarithM Unit) linarithData) :)
match result with
| (Except.ok _) => failure
| (Except.error contr) => return contr.src.flatten | ("An oracle that uses Fourier-Motzkin elimination. ",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Oracle",
"SimplexAlgorithm",
"SimplexAlgorithm"
] | 5 | definition | [
"Mathlib",
"Tactic",
"Linarith",
"SimplexAlgorithm",
"chooseExitingVar"
] | (enterIdx : Nat) : SimplexAlgorithmM matType Nat | {matType : Nat → Nat → Type} →
[inst : Mathlib.Tactic.Linarith.SimplexAlgorithm.UsableInSimplexAlgorithm matType] →
Nat → Mathlib.Tactic.Linarith.SimplexAlgorithm.SimplexAlgorithmM matType Nat | := do
let mut exitIdxOpt : Option Nat := none -- index of entering variable in the `basic` array
let mut minCoef := 0
let mut minIdx := 0
for i in [1:(← get).basic.size] do
if (← get).mat[(i, enterIdx)]! >= 0 then
continue
let lastIdx := (← get).free.size - 1
let coef := -(← get).mat[(i, lastI... | ("Chooses an exiting variable: the variable imposing the strictest limit on the increase of the
entering variable, breaking ties by choosing the variable with smallest index.
",f) |
[
"Mathlib",
"Tactic",
"Linarith",
"Oracle",
"SimplexAlgorithm",
"Datatypes"
] | 2 | instance | [
"Mathlib",
"Tactic",
"Linarith",
"SimplexAlgorithm",
"instUsableInSimplexAlgorithmSparseMatrix"
] | : UsableInSimplexAlgorithm SparseMatrix | Mathlib.Tactic.Linarith.SimplexAlgorithm.UsableInSimplexAlgorithm Mathlib.Tactic.Linarith.SimplexAlgorithm.SparseMatrix | where
getElem mat i j := mat.data[i]!.getD j 0
setElem mat i j v :=
if v == 0 then
⟨mat.data.modify i fun row => row.erase j⟩
else
⟨mat.data.modify i fun row => row.insert j v⟩
getValues mat :=
mat.data.zipIdx.foldl (init := []) fun acc (row, i) =>
let rowVals := row.toList.map fun (... | null |
[
"Mathlib",
"Tactic",
"Bound",
"Attribute"
] | 5 | definition | [
"Mathlib",
"Tactic",
"Bound",
"declPriority"
] | (decl : Lean.Name) : Lean.MetaM Nat | Lean.Name → Lean.MetaM Nat | := do
match (← Lean.getEnv).find? decl with
| some info => do
typePriority decl info.type
| none => throwError "unknown declaration {decl}" | ("Map a theorem decl to a score (0 means `norm apply`, `0 <` means `safe apply`) ",f) |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 27 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"mul_pf_left"
] | (a₁ : R) (a₂) (_ : a₃ * b = c) : (a₁ ^ a₂ * a₃ : R) * b = a₁ ^ a₂ * c | ∀ {R : Type u_1} [inst : CommSemiring R] {a₃ b c : R} (a₁ : R) (a₂ : ℕ), a₃ * b = c → a₁ ^ a₂ * a₃ * b = a₁ ^ a₂ * c | := by
subst_vars; rw [mul_assoc] | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 69 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"pow_bit0"
] | {k : ℕ} (_ : (a : R) ^ k = b) (_ : b * b = c) : a ^ (Nat.mul (nat_lit 2) k) = c | ∀ {R : Type u_1} [inst : CommSemiring R] {a b c : R} {k : ℕ}, a ^ k = b → b * b = c → a ^ Nat.mul 2 k = c | := by
subst_vars; simp [Nat.succ_mul, pow_add] | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 37 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"natCast_nat"
] | (n) : ((Nat.rawCast n : ℕ) : R) = Nat.rawCast n | ∀ {R : Type u_1} [inst : CommSemiring R] (n : ℕ), ↑n.rawCast = n.rawCast | := by simp | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 39 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"natCast_zero"
] | : ((0 : ℕ) : R) = 0 | ∀ {R : Type u_1} [inst : CommSemiring R], ↑0 = 0 | := Nat.cast_zero | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 56 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"neg_add"
] | {R} [CommRing R] {a₁ a₂ b₁ b₂ : R} (_ : -a₁ = b₁) (_ : -a₂ = b₂) : -(a₁ + a₂) = b₁ + b₂ | ∀ {R : Type u_2} [inst : CommRing R] {a₁ a₂ b₁ b₂ : R}, -a₁ = b₁ → -a₂ = b₂ → -(a₁ + a₂) = b₁ + b₂ | := by
subst_vars; simp [add_comm] | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 93 | definition | [
"Mathlib",
"Tactic",
"Ring",
"evalCast"
] | {α : Q(Type u)} (sα : Q(CommSemiring $α)) {e : Q($α)} : NormNum.Result e → Option (Result (ExSum sα) e) | {u : Lean.Level} →
{α : Q(Type u)} →
(sα : Q(CommSemiring «$α»)) →
{e : Q(«$α»)} →
Mathlib.Meta.NormNum.Result e → Option (Mathlib.Tactic.Ring.Result (Mathlib.Tactic.Ring.ExSum sα) e) | | .isNat _ (.lit (.natVal 0)) p => do
assumeInstancesCommute
pure ⟨_, .zero, q(cast_zero $p)⟩
| .isNat _ lit p => do
assumeInstancesCommute
have ⟨e', s⟩ := ExProd.mkNat sα lit.natLit!
have : $e' =Q ($lit).rawCast := ⟨⟩
pure ⟨_, s.toSum, q(cast_pos $p)⟩
/- In the following cases, Qq needs hel... | ("Converts a proof by `norm_num` that `e` is a numeral, into a normalization as a monomial:
* `e = 0` if `norm_num` returns `IsNat e 0`
* `e = Nat.rawCast n + 0` if `norm_num` returns `IsNat e n`
* `e = Int.rawCast n + 0` if `norm_num` returns `IsInt e n`
* `e = NNRat.rawCast n d + 0` if `norm_num` returns `IsNNRat e ... |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 80 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"zero_pow"
] | {b : ℕ} (_ : 0 < b) : (0 : R) ^ b = 0 | ∀ {R : Type u_1} [inst : CommSemiring R] {b : ℕ}, 0 < b → 0 ^ b = 0 | := match b with | b+1 => by simp [pow_succ] | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 40 | theorem | [
"Mathlib",
"Tactic",
"Ring",
"natCast_add"
] | {a₁ a₂ : ℕ} (_ : ((a₁ : ℕ) : R) = b₁) (_ : ((a₂ : ℕ) : R) = b₂) : ((a₁ + a₂ : ℕ) : R) = b₁ + b₂ | ∀ {R : Type u_1} [inst : CommSemiring R] {b₁ b₂ : R} {a₁ a₂ : ℕ}, ↑a₁ = b₁ → ↑a₂ = b₂ → ↑(a₁ + a₂) = b₁ + b₂ | := by
subst_vars; simp | null |
[
"Mathlib",
"Tactic",
"Ring",
"Common"
] | 57 | definition | [
"Mathlib",
"Tactic",
"Ring",
"evalNeg"
] | {a : Q($α)} (rα : Q(CommRing $α)) (va : ExSum sα a) : MetaM <| Result (ExSum sα) q(-$a) | {u : Lean.Level} →
{α : Q(Type u)} →
(sα : Q(CommSemiring «$α»)) →
{a : Q(«$α»)} →
(rα : Q(CommRing «$α»)) →
Mathlib.Tactic.Ring.ExSum sα a →
Lean.MetaM (Mathlib.Tactic.Ring.Result (Mathlib.Tactic.Ring.ExSum sα) q(-«$a»)) | := do
assumeInstancesCommute
match va with
| .zero => return ⟨_, .zero, q(neg_zero (R := $α))⟩
| .add va₁ va₂ =>
let ⟨_, vb₁, pb₁⟩ ← evalNegProd sα rα va₁
let ⟨_, vb₂, pb₂⟩ ← evalNeg rα va₂
return ⟨_, .add vb₁ vb₂, q(neg_add $pb₁ $pb₂)⟩ | ("Negates a polynomial `va` to get another polynomial.
* `-0 = 0` (for `c` coefficient)
* `-(a₁ + a₂) = -a₁ + -a₂`
",f) |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 31