statement stringlengths 1 2.88k | proof stringlengths 0 13.9k | type stringclasses 10
values | symbolic_name stringlengths 1 131 | library stringclasses 417
values | filename stringlengths 17 80 | imports listlengths 0 16 | deps listlengths 0 64 | docstring stringlengths 0 10.2k | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|
direct_dependencies_of_hyp_inclusive (h : expr) : tactic (list expr) | rb_set.to_list <$> direct_dependency_set_of_hyp_inclusive h | def | tactic.direct_dependencies_of_hyp_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `direct_dependencies_of_hyp_inclusive h` is the list of hypotheses that the
hypothesis `h` directly depends on, plus `h` itself. The dependencies are
returned in no particular order. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_name_set' : expr_set → expr → name_set →
tactic (bool × expr_set) | λ cache h ns, do
ff ← pure $ cache.contains h | pure (ff, cache),
direct_deps ← direct_dependency_set_of_hyp h,
let has_dep := direct_deps.fold ff (λ d b, b || ns.contains d.local_uniq_name),
ff ← pure has_dep | pure (tt, cache),
(has_dep, cache) ← direct_deps.mfold (ff, cache) $ λ d ⟨b, cache⟩,
if b
... | def | tactic.hyp_depends_on_local_name_set' | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_local_name_set' cache h ns` is true iff `h` depends on any of
the hypotheses whose unique names appear in `ns`. `cache` must be a set of
hypotheses known *not* to depend (even indirectly) on any of the `ns`. This is
a performance optimisation, so you can give an empty cache. The tactic also
returns an e... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_name_set (h : expr) (ns : name_set) : tactic bool | do
ctx_has_local_def ← context_upto_hyp_has_local_def h,
if ctx_has_local_def
then prod.fst <$> hyp_depends_on_local_name_set' mk_expr_set h ns
else hyp_directly_depends_on_local_name_set h ns | def | tactic.hyp_depends_on_local_name_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_local_name_set h ns` is true iff the hypothesis `h` depends on
any of the hypotheses whose unique names appear in `ns`. If you need to check
dependencies of multiple hypotheses, use `tactic.hyps_depend_on_local_name_set`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_set (h : expr) (hs : expr_set) : tactic bool | hyp_depends_on_local_name_set h $ local_set_to_name_set hs | def | tactic.hyp_depends_on_local_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_local_set h hs` is true iff the hypothesis `h` depends on
any of the hypotheses `hs`. If you need to check dependencies of multiple
hypotheses, use `tactic.hyps_depend_on_local_set`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_locals (h : expr) (hs : list expr) : tactic bool | hyp_depends_on_local_name_set h $ local_list_to_name_set hs | def | tactic.hyp_depends_on_locals | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_locals h hs` is true iff the hypothesis `h` depends on any of
the hypotheses `hs`. If you need to check dependencies of multiple hypotheses,
use `tactic.hyps_depend_on_locals`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_local_name_set (hs : list expr) (ns : name_set) :
tactic (list bool) | do
ctx_has_local ← context_has_local_def,
if ctx_has_local
then
let go : expr → list bool × expr_set → tactic (list bool × expr_set) :=
λ h ⟨deps, cache⟩, do
{ (h_dep, cache) ← hyp_depends_on_local_name_set' cache h ns,
pure (h_dep :: deps, cache) }
in
prod.fst <$> hs.mfold... | def | tactic.hyps_depend_on_local_name_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_local_name_set hs ns` returns, for each `h ∈ hs`, whether `h`
depends on a hypothesis whose unique name appears in `ns`. This is the same as
(but more efficient than) calling `tactic.hyp_depends_on_local_name_set` for
every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_local_set (hs : list expr) (is : expr_set) :
tactic (list bool) | hyps_depend_on_local_name_set hs $ local_set_to_name_set is | def | tactic.hyps_depend_on_local_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_local_set hs is` returns, for each `h ∈ hs`, whether `h` depends
on any of the hypotheses `is`. This is the same as (but more efficient than)
calling `tactic.hyp_depends_on_local_set` for every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_locals (hs is : list expr) : tactic (list bool) | hyps_depend_on_local_name_set hs $ local_list_to_name_set is | def | tactic.hyps_depend_on_locals | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_locals hs is` returns, for each `h ∈ hs`, whether `h` depends
on any of the hypotheses `is`. This is the same as (but more efficient than)
calling `tactic.hyp_depends_on_locals` for every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_name_set_inclusive' (cache : expr_set) (h : expr)
(ns : name_set) : tactic (bool × expr_set) | if ns.contains h.local_uniq_name
then pure (tt, cache)
else hyp_depends_on_local_name_set' cache h ns | def | tactic.hyp_depends_on_local_name_set_inclusive' | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_local_name_set_inclusive' cache h ns` is true iff the hypothesis
`h` inclusively depends on a hypothesis whose unique name appears in `ns`.
`cache` must be a set of hypotheses known *not* to depend (even indirectly) on
any of the `ns`. This is a performance optimisation, so you can give an empty
cache. ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_name_set_inclusive (h : expr) (ns : name_set) :
tactic bool | list.mbor
[ pure $ ns.contains h.local_uniq_name,
hyp_depends_on_local_name_set h ns ] | def | tactic.hyp_depends_on_local_name_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [
"list.mbor"
] | `hyp_depends_on_local_name_set_inclusive h ns` is true iff the hypothesis `h`
inclusively depends on any of the hypotheses whose unique names appear in `ns`.
If you need to check the dependencies of multiple hypotheses, use
`tactic.hyps_depend_on_local_name_set_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_local_set_inclusive (h : expr) (hs : expr_set) :
tactic bool | hyp_depends_on_local_name_set_inclusive h $ local_set_to_name_set hs | def | tactic.hyp_depends_on_local_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_local_set_inclusive h hs` is true iff the hypothesis `h`
inclusively depends on any of the hypotheses `hs`. If you need to check
dependencies of multiple hypotheses, use
`tactic.hyps_depend_on_local_set_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyp_depends_on_locals_inclusive (h : expr) (hs : list expr) :
tactic bool | hyp_depends_on_local_name_set_inclusive h $ local_list_to_name_set hs | def | tactic.hyp_depends_on_locals_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyp_depends_on_locals_inclusive h hs` is true iff the hypothesis `h`
inclusively depends on any of the hypotheses `hs`. If you need to check
dependencies of multiple hypotheses, use
`tactic.hyps_depend_on_locals_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_local_name_set_inclusive (hs : list expr) (ns : name_set) :
tactic (list bool) | do
ctx_has_local ← context_has_local_def,
if ctx_has_local
then
let go : expr → list bool × expr_set → tactic (list bool × expr_set) :=
λ h ⟨deps, cache⟩, do
{ (h_dep, cache) ← hyp_depends_on_local_name_set_inclusive' cache h ns,
pure (h_dep :: deps, cache) }
in
prod.fst <$... | def | tactic.hyps_depend_on_local_name_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_local_name_set_inclusive hs ns` returns, for each `h ∈ hs`,
whether `h` inclusively depends on a hypothesis whose unique name appears in
`ns`. This is the same as (but more efficient than) calling
`tactic.hyp_depends_on_local_name_set_inclusive` for every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_local_set_inclusive (hs : list expr) (is : expr_set) :
tactic (list bool) | hyps_depend_on_local_name_set_inclusive hs $ local_set_to_name_set is | def | tactic.hyps_depend_on_local_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_local_set_inclusive hs is` returns, for each `h ∈ hs`, whether
`h` depends inclusively on any of the hypotheses `is`. This is the same as
(but more efficient than) calling `tactic.hyp_depends_on_local_set_inclusive`
for every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
hyps_depend_on_locals_inclusive (hs is : list expr) : tactic (list bool) | hyps_depend_on_local_name_set_inclusive hs $ local_list_to_name_set is | def | tactic.hyps_depend_on_locals_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `hyps_depend_on_locals_inclusive hs is` returns, for each `h ∈ hs`, whether `h`
depends inclusively on any of the hypotheses `is`. This is the same as (but more
efficient than) calling `tactic.hyp_depends_on_locals_inclusive` for every
`h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_set_of_hyp' : expr_map expr_set → expr →
tactic (expr_set × expr_map expr_set) | λ cache h, do
match cache.find h with
| some deps := pure (deps, cache)
| none := do
direct_deps ← direct_dependency_set_of_hyp h,
(deps, cache) ←
direct_deps.mfold (direct_deps, cache) $ λ h' ⟨deps, cache⟩, do
{ (deps', cache) ← dependency_set_of_hyp' cache h',
pure (deps.union deps',... | def | tactic.dependency_set_of_hyp' | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_set_of_hyp' cache h` is the set of dependencies of the hypothesis
`h`. `cache` is a map from hypotheses to all their dependencies (including
indirect dependencies). This is a performance optimisation, so you can give an
empty cache. The tactic also returns an expanded cache with hypotheses which
the tactic ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_set_of_hyp (h : expr) : tactic expr_set | do
ctx_has_local ← context_upto_hyp_has_local_def h,
if ctx_has_local
then prod.fst <$> dependency_set_of_hyp' mk_expr_map h
else direct_dependency_set_of_hyp h | def | tactic.dependency_set_of_hyp | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_set_of_hyp h` is the set of dependencies of the hypothesis `h`. If
you need the dependencies of multiple hypotheses, use
`tactic.dependency_sets_of_hyps`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_name_set_of_hyp (h : expr) : tactic name_set | local_set_to_name_set <$> dependency_set_of_hyp h | def | tactic.dependency_name_set_of_hyp | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_name_set_of_hyp h` is the set of unique names of the dependencies of
the hypothesis `h`. If you need the dependencies of multiple hypotheses, use
`tactic.dependency_name_sets_of_hyps`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependencies_of_hyp (h : expr) : tactic (list expr) | rb_set.to_list <$> dependency_set_of_hyp h | def | tactic.dependencies_of_hyp | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependencies_of_hyp h` is the list of dependencies of the hypothesis `h`.
The dependencies are returned in no particular order. If you need the
dependencies of multiple hypotheses, use `tactic.dependencies_of_hyps`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_sets_of_hyps (hs : list expr) : tactic (list expr_set) | do
ctx_has_def ← context_has_local_def,
if ctx_has_def
then
let go : expr → list expr_set × expr_map expr_set →
tactic (list expr_set × expr_map expr_set) := do
λ h ⟨deps, cache⟩, do
{ (h_deps, cache) ← dependency_set_of_hyp' cache h,
pure (h_deps :: deps, cache) }
in... | def | tactic.dependency_sets_of_hyps | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_sets_of_hyps hs` returns, for each `h ∈ hs`, the set of dependencies
of `h`. This is the same as (but more performant than) using
`tactic.dependency_set_of_hyp` on every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_name_sets_of_hyps (hs : list expr) : tactic (list name_set) | list.map local_set_to_name_set <$> dependency_sets_of_hyps hs | def | tactic.dependency_name_sets_of_hyps | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_name_sets_of_hyps hs` returns, for each `h ∈ hs`, the set of unique
names of the dependencies of `h`. This is the same as (but more performant than)
using `tactic.dependency_name_set_of_hyp` on every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependencies_of_hyps (hs : list expr) : tactic (list (list expr)) | list.map rb_set.to_list <$> dependency_sets_of_hyps hs | def | tactic.dependencies_of_hyps | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependencies_of_hyps hs` returns, for each `h ∈ hs`, the dependencies of `h`.
The dependencies appear in no particular order in the returned lists. This is
the same as (but more performant than) using `tactic.dependencies_of_hyp` on
every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_set_of_hyp_inclusive' (cache : expr_map expr_set) (h : expr) :
tactic (expr_set × expr_map expr_set) | do
(deps, cache) ← dependency_set_of_hyp' cache h,
pure (deps.insert h, cache) | def | tactic.dependency_set_of_hyp_inclusive' | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_set_of_hyp_inclusive' cache h` is the set of dependencies of the
hypothesis `h`, plus `h` itself. `cache` is a map from hypotheses to all their
dependencies (including indirect dependencies). This is a performance
optimisation, so you can give an empty cache. The tactic also returns an
expanded cache with h... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_set_of_hyp_inclusive (h : expr) : tactic expr_set | do
deps ← dependency_set_of_hyp h,
pure $ deps.insert h | def | tactic.dependency_set_of_hyp_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_set_of_hyp_inclusive h` is the set of dependencies of the hypothesis
`h`, plus `h` itself. If you need the dependencies of multiple hypotheses, use
`tactic.dependency_sets_of_hyps_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_name_set_of_hyp_inclusive (h : expr) : tactic name_set | local_set_to_name_set <$> dependency_set_of_hyp_inclusive h | def | tactic.dependency_name_set_of_hyp_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_name_set_of_hyp_inclusive h` is the set of unique names of the
dependencies of the hypothesis `h`, plus the unique name of `h` itself. If you
need the dependencies of multiple hypotheses, use
`tactic.dependency_name_sets_of_hyps_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependencies_of_hyp_inclusive (h : expr) : tactic (list expr) | rb_set.to_list <$> dependency_set_of_hyp_inclusive h | def | tactic.dependencies_of_hyp_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependencies_of_hyp_inclusive h` is the list of dependencies of the hypothesis
`h`, plus `h` itself. The dependencies are returned in no particular order. If
you need the dependencies of multiple hypotheses, use
`tactic.dependencies_of_hyps_inclusive`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_sets_of_hyps_inclusive (hs : list expr) :
tactic (list expr_set) | do
ctx_has_def ← context_has_local_def,
if ctx_has_def
then
let go : expr → list expr_set × expr_map expr_set →
tactic (list expr_set × expr_map expr_set) :=
λ h ⟨deps, cache⟩, do
{ (h_deps, cache) ← dependency_set_of_hyp_inclusive' cache h,
pure (h_deps :: deps, cache) }
... | def | tactic.dependency_sets_of_hyps_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_sets_of_hyps_inclusive hs` returns, for each `h ∈ hs`, the
dependencies of `h`, plus `h` itself. This is the same as (but more performant
than) using `tactic.dependency_set_of_hyp_inclusive` on every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependency_name_sets_of_hyps_inclusive (hs : list expr) :
tactic (list name_set) | list.map local_set_to_name_set <$> dependency_sets_of_hyps_inclusive hs | def | tactic.dependency_name_sets_of_hyps_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependency_name_sets_of_hyps_inclusive hs` returns, for each `h ∈ hs`, the
unique names of the dependencies of `h`, plus the unique name of `h` itself.
This is the same as (but more performant than) using
`tactic.dependency_name_set_of_hyp_inclusive` on every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependencies_of_hyps_inclusive (hs : list expr) :
tactic (list (list expr)) | list.map rb_set.to_list <$> dependency_sets_of_hyps_inclusive hs | def | tactic.dependencies_of_hyps_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `dependencies_of_hyps_inclusive hs` returns, for each `h ∈ hs`, the dependencies
of `h`, plus `h` itself. The dependencies appear in no particular order in the
returned lists. This is the same as (but more performant than) using
`tactic.dependencies_of_hyp_inclusive` on every `h ∈ hs`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyp_name_set_aux (hs : name_set) :
list expr → list expr → name_set → tactic (list expr) | | [] revdeps _ := pure revdeps.reverse
| (H :: Hs) revdeps ns := do
let H_uname := H.local_uniq_name,
H_is_revdep ← list.mband
[ pure $ ¬ hs.contains H_uname,
hyp_directly_depends_on_local_name_set H ns ],
if H_is_revdep
then
reverse_dependencies_of_hyp_name_set_aux Hs (H :: revdeps)
(... | def | tactic.reverse_dependencies_of_hyp_name_set_aux | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [
"list.mband"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
reverse_dependencies_of_hyp_name_set (hs : name_set) :
tactic (list expr) | do
ctx ← local_context,
let ctx := ctx.after (λ h, hs.contains h.local_uniq_name),
reverse_dependencies_of_hyp_name_set_aux hs ctx [] hs | def | tactic.reverse_dependencies_of_hyp_name_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyp_name_set hs` is the list of reverse dependencies of
the hypotheses whose unique names appear in `hs`, excluding the `hs` themselves.
The reverse dependencies are returned in the order in which they appear in the
context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyp_set (hs : expr_set) : tactic (list expr) | reverse_dependencies_of_hyp_name_set $ local_set_to_name_set hs | def | tactic.reverse_dependencies_of_hyp_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyp_set hs` is the list of reverse dependencies of the
hypotheses `hs`, excluding the `hs` themselves. The reverse dependencies are
returned in the order in which they appear in the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyps (hs : list expr) : tactic (list expr) | reverse_dependencies_of_hyp_name_set $ local_list_to_name_set hs | def | tactic.reverse_dependencies_of_hyps | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyps hs` is the list of reverse dependencies of the
hypotheses `hs`, excluding the `hs` themselves. The reverse dependencies are
returned in the order in which they appear in the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyp_name_set_inclusive_aux :
list expr → list expr → name_set → tactic (list expr) | | [] revdeps _ := pure revdeps.reverse
| (H :: Hs) revdeps ns := do
let H_uname := H.local_uniq_name,
H_is_revdep ← list.mbor
[ pure $ ns.contains H.local_uniq_name,
hyp_directly_depends_on_local_name_set H ns ],
if H_is_revdep
then
reverse_dependencies_of_hyp_name_set_inclusive_aux Hs (H :: r... | def | tactic.reverse_dependencies_of_hyp_name_set_inclusive_aux | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [
"list.mbor"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
reverse_dependencies_of_hyp_name_set_inclusive (hs : name_set) :
tactic (list expr) | do
ctx ← local_context,
let ctx := ctx.drop_while (λ h, ¬ hs.contains h.local_uniq_name),
reverse_dependencies_of_hyp_name_set_inclusive_aux ctx [] hs | def | tactic.reverse_dependencies_of_hyp_name_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyp_name_set_inclusive hs` is the list of reverse
dependencies of the hypotheses whose unique names appear in `hs`, including the
`hs` themselves. The reverse dependencies are returned in the order in which
they appear in the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyp_set_inclusive (hs : expr_set) :
tactic (list expr) | reverse_dependencies_of_hyp_name_set_inclusive $ local_set_to_name_set hs | def | tactic.reverse_dependencies_of_hyp_set_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyp_set_inclusive hs` is the list of reverse
dependencies of the hypotheses `hs`, including the `hs` themselves. The
inclusive reverse dependencies are returned in the order in which they appear in
the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reverse_dependencies_of_hyps_inclusive (hs : list expr) :
tactic (list expr) | reverse_dependencies_of_hyp_name_set_inclusive $ local_list_to_name_set hs | def | tactic.reverse_dependencies_of_hyps_inclusive | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `reverse_dependencies_of_hyps_inclusive hs` is the list of reverse dependencies
of the hypotheses `hs`, including the `hs` themselves. The reverse dependencies
are returned in the order in which they appear in the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_name_set (hs : name_set) : tactic (ℕ × list expr) | do
to_revert ← reverse_dependencies_of_hyp_name_set_inclusive hs,
to_revert_with_types ← to_revert.mmap update_type,
num_reverted ← revert_lst to_revert,
pure (num_reverted, to_revert_with_types) | def | tactic.revert_name_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_name_set hs` reverts the hypotheses whose unique names appear in `hs`,
as well as any hypotheses that depend on them. Returns the number of reverted
hypotheses and a list containing these hypotheses. The reverted hypotheses are
returned in the order in which they used to appear in the context and are
guaranteed... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_set (hs : expr_set) : tactic (ℕ × list expr) | revert_name_set $ local_set_to_name_set hs | def | tactic.revert_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_set hs` reverts the hypotheses `hs`, as well as any hypotheses that
depend on them. Returns the number of reverted hypotheses and a list containing
these hypotheses. The reverted hypotheses are returned in the order in which
they used to appear in the context and are guaranteed to store the correct type
(see `t... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_lst' (hs : list expr) : tactic (ℕ × list expr) | revert_name_set $ local_list_to_name_set hs | def | tactic.revert_lst' | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_lst' hs` reverts the hypotheses `hs`, as well as any hypotheses that
depend on them. Returns the number of reverted hypotheses and a list containing
these hypotheses. The reverted hypotheses are returned in the order in which
they used to appear in the context and are guaranteed to store the correct type
(see `... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_reverse_dependencies_of_hyp (h : expr) : tactic ℕ | reverse_dependencies_of_hyp_name_set (mk_name_set.insert h.local_uniq_name) >>=
revert_lst | def | tactic.revert_reverse_dependencies_of_hyp | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
revert_reverse_dependencies_of_hyp_name_set (hs : name_set) : tactic ℕ | reverse_dependencies_of_hyp_name_set hs >>= revert_lst | def | tactic.revert_reverse_dependencies_of_hyp_name_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_reverse_dependencies_of_hyp_name_set hs` reverts all the hypotheses that
depend on a hypothesis whose unique name appears in `hs`. The `hs` themselves
are not reverted, unless they depend on each other. Returns the number of
reverted hypotheses. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_reverse_dependencies_of_hyp_set (hs : expr_set) : tactic ℕ | reverse_dependencies_of_hyp_set hs >>= revert_lst | def | tactic.revert_reverse_dependencies_of_hyp_set | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_reverse_dependencies_of_hyp_set hs` reverts all the hypotheses that
depend on a hypothesis in `hs`. The `hs` themselves are not reverted, unless
they depend on each other. Returns the number of reverted hypotheses. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_reverse_dependencies_of_hyps (hs : list expr) : tactic ℕ | reverse_dependencies_of_hyps hs >>= revert_lst | def | tactic.revert_reverse_dependencies_of_hyps | tactic | src/tactic/dependencies.lean | [
"meta.rb_map",
"tactic.core"
] | [] | `revert_reverse_dependencies_of_hyp hs` reverts all the hypotheses that depend
on a hypothesis in `hs`. The `hs` themselves are not reverted, unless they
depend on each other. Returns the number of reverted hypotheses. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_above (α) (enum : α → ℕ) (n : ℕ) | {s : finset α // ∀ x ∈ s, n ≤ enum x} | def | derive_fintype.finset_above | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"finset"
] | A step in the construction of `finset.univ` for a finite inductive type.
We will set `enum` to the discriminant of the inductive type, so a `finset_above`
represents a finset that enumerates all elements in a tail of the constructor list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_fintype {α} (enum : α → ℕ) (s : finset_above α enum 0) (H : ∀ x, x ∈ s.1) :
fintype α | ⟨s.1, H⟩ | def | derive_fintype.mk_fintype | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"fintype"
] | Construct a fintype instance from a completed `finset_above`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_above.cons {α} {enum : α → ℕ} (n)
(a : α) (h : enum a = n) (s : finset_above α enum (n+1)) : finset_above α enum n | begin
refine ⟨finset.cons a s.1 _, _⟩,
{ intro h',
have := s.2 _ h', rw h at this,
exact nat.not_succ_le_self n this },
{ intros x h', rcases finset.mem_cons.1 h' with rfl | h',
{ exact ge_of_eq h },
{ exact nat.le_of_succ_le (s.2 _ h') } }
end | def | derive_fintype.finset_above.cons | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"ge_of_eq"
] | This is the case for a simple variant (no arguments) in an inductive type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_above.mem_cons_self {α} {enum : α → ℕ} {n a h s} :
a ∈ (@finset_above.cons α enum n a h s).1 | multiset.mem_cons_self _ _ | theorem | derive_fintype.finset_above.mem_cons_self | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"multiset.mem_cons_self"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
finset_above.mem_cons_of_mem {α} {enum : α → ℕ} {n a h s b} :
b ∈ (s : finset_above _ _ _).1 → b ∈ (@finset_above.cons α enum n a h s).1 | multiset.mem_cons_of_mem | theorem | derive_fintype.finset_above.mem_cons_of_mem | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"multiset.mem_cons_of_mem"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
finset_above.nil {α} {enum : α → ℕ} (n) : finset_above α enum n | ⟨∅, by rintro _ ⟨⟩⟩ | def | derive_fintype.finset_above.nil | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | The base case is when we run out of variants; we just put an empty finset at the end. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_in {α} (P : α → Prop) | {s : finset α // ∀ x ∈ s, P x} | def | derive_fintype.finset_in | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"finset"
] | This is a finset covering a nontrivial variant (with one or more constructor arguments).
The property `P` here is `λ a, enum a = n` where `n` is the discriminant for the current
variant. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_in.mk {α} {P : α → Prop} (Γ) [fintype Γ]
(f : Γ → α) (inj : function.injective f) (mem : ∀ x, P (f x)) : finset_in P | ⟨finset.univ.map ⟨f, inj⟩,
λ x h, by rcases finset.mem_map.1 h with ⟨x, _, rfl⟩; exact mem x⟩ | def | derive_fintype.finset_in.mk | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"fintype"
] | To construct the finset, we use an injective map from the type `Γ`, which will be the
sigma over all constructor arguments. We use sigma instances and existing fintype instances
to prove that `Γ` is a fintype, and construct the function `f` that maps `⟨a, b, c, ...⟩`
to `C_n a b c ...` where `C_n` is the nth constructo... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_in.mem_mk {α} {P : α → Prop} {Γ} {s : fintype Γ} {f : Γ → α} {inj mem a}
(b) (H : f b = a) : a ∈ (@finset_in.mk α P Γ s f inj mem).1 | finset.mem_map.2 ⟨_, finset.mem_univ _, H⟩ | theorem | derive_fintype.finset_in.mem_mk | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"finset.mem_univ",
"fintype"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
finset_above.union {α} {enum : α → ℕ} (n)
(s : finset_in (λ a, enum a = n)) (t : finset_above α enum (n+1)) : finset_above α enum n | begin
refine ⟨finset.disj_union s.1 t.1 _, _⟩,
{ rw finset.disjoint_left,
intros a hs ht,
have := t.2 _ ht, rw s.2 _ hs at this,
exact nat.not_succ_le_self n this },
{ intros x h', rcases finset.mem_disj_union.1 h' with h' | h',
{ exact ge_of_eq (s.2 _ h') },
{ exact nat.le_of_succ_le (t.2 _ h... | def | derive_fintype.finset_above.union | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"finset.disjoint_left",
"ge_of_eq"
] | For nontrivial variants, we split the constructor list into a `finset_in` component for the
current constructor and a `finset_above` for the rest. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
finset_above.mem_union_left {α} {enum : α → ℕ} {n s t a}
(H : a ∈ (s : finset_in _).1) : a ∈ (@finset_above.union α enum n s t).1 | multiset.mem_add.2 (or.inl H) | theorem | derive_fintype.finset_above.mem_union_left | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
finset_above.mem_union_right {α} {enum : α → ℕ} {n s t a}
(H : a ∈ (t : finset_above _ _ _).1) : a ∈ (@finset_above.union α enum n s t).1 | multiset.mem_add.2 (or.inr H) | theorem | derive_fintype.finset_above.mem_union_right | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
mk_sigma : expr → tactic expr | | (expr.pi n bi d b) := do
p ← mk_local' n bi d,
e ← mk_sigma (expr.instantiate_var b p),
tactic.mk_app ``psigma [d, bind_lambda e p]
| _ := pure `(unit) | def | tactic.derive_fintype.mk_sigma | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Construct the term `Σ' (a:A) (b:B a) (c:C a b), unit` from
`Π (a:A) (b:B a), C a b → T` (the type of a constructor). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_sigma_elim : expr → expr → tactic ℕ | | (expr.pi n bi d b) c := do
refine ``(@psigma.elim %%d _ _ _),
i ← intro_fresh n,
(+ 1) <$> mk_sigma_elim (expr.instantiate_var b i) (c i)
| _ c := do intro1, exact c $> 0 | def | tactic.derive_fintype.mk_sigma_elim | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Prove the goal `(Σ' (a:A) (b:B a) (c:C a b), unit) → T`
(this is the function `f` in `finset_in.mk`) using recursive `psigma.elim`,
finishing with the constructor. The two arguments are the type of the constructor,
and the constructor term itself; as we recurse we add arguments
to the constructor application and destru... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_sigma_elim_inj : ℕ → expr → expr → tactic unit | | (m+1) x y := do
[(_, [x1, x2])] ← cases x,
[(_, [y1, y2])] ← cases y,
mk_sigma_elim_inj m x2 y2
| 0 x y := do
cases x, cases y,
is ← intro1 >>= injection,
is.mmap' cases,
reflexivity | def | tactic.derive_fintype.mk_sigma_elim_inj | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Prove the goal `a, b |- f a = f b → g a = g b` where `f` is the function we constructed in
`mk_sigma_elim`, and `g` is some other term that gets built up and eventually closed by
reflexivity. Here `a` and `b` have sigma types so the proof approach is to case on `a` and `b`
until the goal reduces to `C_n a1 ... am = C_n... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_sigma_elim_eq : ℕ → expr → tactic unit | | (n+1) x := do
[(_, [x1, x2])] ← cases x,
mk_sigma_elim_eq n x2
| 0 x := reflexivity | def | tactic.derive_fintype.mk_sigma_elim_eq | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Prove the goal `a |- enum (f a) = n`, where `f` is the function constructed in `mk_sigma_elim`,
and `enum` is a function that reduces to `n` on the constructor `C_n`. Here we just have to case on
`a` `m` times, and then `reflexivity` finishes the proof. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_finset (ls : list level) (args : list expr) : ℕ → list name → tactic unit | | k (c::cs) := do
let e := (expr.const c ls).mk_app args,
t ← infer_type e,
if is_pi t then do
to_expr ``(finset_above.union %%(reflect k)) tt ff >>=
(λ c, apply c {new_goals := new_goals.all}),
Γ ← mk_sigma t,
to_expr ``(finset_in.mk %%Γ) tt ff >>= (λ c, apply c {new_goals := new_goals.all}),
... | def | tactic.derive_fintype.mk_finset | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Prove the goal `|- finset_above T enum k`, where `T` is the inductive type and `enum` is the
discriminant function. The arguments are `args`, the parameters to the inductive type (and all
constructors), `k`, the index of the current variant, and `cs`, the list of constructor names.
This uses `finset_above.cons` for bas... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_sigma_mem : list expr → tactic unit | | (x::xs) := fconstructor >> exact x >> mk_sigma_mem xs
| [] := fconstructor $> () | def | tactic.derive_fintype.mk_sigma_mem | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Prove the goal `|- Σ' (a:A) (b: B a) (c:C a b), unit` given a list of terms `a, b, c`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_finset_total : tactic unit → list (name × list expr) → tactic unit | | tac [] := done
| tac ((_, xs) :: gs) := do
tac,
b ← succeeds (applyc ``finset_above.mem_cons_self),
if b then
mk_finset_total (tac >> applyc ``finset_above.mem_cons_of_mem) gs
else do
applyc ``finset_above.mem_union_left,
applyc ``finset_in.mem_mk {new_goals := new_goals.all},
mk_sigma_mem xs,... | def | tactic.derive_fintype.mk_finset_total | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"succeeds"
] | This function is called to prove `a : T |- a ∈ S.1` where `S` is the `finset_above` constructed
by `mk_finset`, after the initial cases on `a : T`, producing a list of subgoals. For each case,
we have to navigate past all the variants that don't apply (which is what the `tac` input tactic
does), and then call either `f... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_fintype_instance : tactic unit | do
intros,
`(fintype %%e) ← target >>= whnf,
(const I ls, args) ← pure (get_app_fn_args e),
env ← get_env,
let cs := env.constructors_of I,
guard (env.inductive_num_indices I = 0) <|>
fail "@[derive fintype]: inductive indices are not supported",
guard (¬ env.is_recursive I) <|>
fail ("@[derive fi... | def | tactic.mk_fintype_instance | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [] | Proves `|- fintype T` where `T` is a non-recursive inductive type with no indices,
where all arguments to all constructors are fintypes. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fintype_instance : derive_handler | instance_derive_handler ``fintype mk_fintype_instance | def | tactic.fintype_instance | tactic | src/tactic/derive_fintype.lean | [
"data.fintype.basic"
] | [
"fintype"
] | Tries to derive a `fintype` instance for inductives and structures.
For example:
```
@[derive fintype]
inductive foo (n m : ℕ)
| zero : foo
| one : bool → foo
| two : fin n → fin m → foo
```
Here, `@[derive fintype]` adds the instance `foo.fintype`. The underlying finset
definitionally unfolds to a list that enumerate... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
inhabited_instance : derive_handler | instance_derive_handler ``inhabited $ do
applyc ``inhabited.mk,
`[refine {..}] <|> (constructor >> skip),
all_goals' $ do
applyc ``default <|> (do s ← read,
fail $ to_fmt "could not find inhabited instance for:\n" ++ to_fmt s) | def | tactic.inhabited_instance | tactic | src/tactic/derive_inhabited.lean | [
"logic.basic",
"data.rbmap.basic"
] | [] | Tries to derive an `inhabited` instance for inductives and structures.
For example:
```
@[derive inhabited]
structure foo :=
(a : ℕ := 42)
(b : list ℕ)
```
Here, `@[derive inhabited]` adds the instance `foo.inhabited`, which is defined as
`⟨⟨42, default⟩⟩`. For inductives, the default value is the first constructor.
... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
string.hash (s : string) : ℕ | s.fold 1 (λ h c, (33*h + c.val) % unsigned_sz) | def | string.hash | tactic | src/tactic/doc_commands.lean | [] | [] | A rudimentary hash function on strings. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
name.last : name → string | | (name.mk_string s _) := s
| (name.mk_numeral n _) := repr n
| anonymous := "[anonymous]" | def | name.last | tactic | src/tactic/doc_commands.lean | [] | [] | Get the last component of a name, and convert it to a string. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.copy_doc_string (fr : name) (to : list name) : tactic unit | do fr_ds ← doc_string fr,
to.mmap' $ λ tgt, add_doc_string tgt fr_ds | def | tactic.copy_doc_string | tactic | src/tactic/doc_commands.lean | [] | [] | `copy_doc_string fr to` copies the docstring from the declaration named `fr`
to each declaration named in the list `to`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
copy_doc_string_cmd
(_ : parse (tk "copy_doc_string")) : parser unit | do fr ← parser.ident,
tk "->",
to ← parser.many parser.ident,
expr.const fr _ ← resolve_name fr,
to ← parser.of_tactic (to.mmap $ λ n, expr.const_name <$> resolve_name n),
tactic.copy_doc_string fr to | def | copy_doc_string_cmd | tactic | src/tactic/doc_commands.lean | [] | [
"tactic.copy_doc_string"
] | `copy_doc_string source → target_1 target_2 ... target_n` copies the doc string of the
declaration named `source` to each of `target_1`, `target_2`, ..., `target_n`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
library_note_attr : user_attribute | { name := `library_note,
descr := "Notes about library features to be included in documentation",
parser := failed } | def | library_note_attr | tactic | src/tactic/doc_commands.lean | [] | [
"library_note"
] | A user attribute `library_note` for tagging decls of type `string × string` for use in note
output. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_reflected_definition (decl_name : name) {type} [reflected _ type]
(body : type) [reflected _ body] : declaration | mk_definition decl_name (reflect type).collect_univ_params (reflect type) (reflect body) | def | mk_reflected_definition | tactic | src/tactic/doc_commands.lean | [] | [] | `mk_reflected_definition name val` constructs a definition declaration by reflection.
Example: ``mk_reflected_definition `foo 17`` constructs the definition
declaration corresponding to `def foo : ℕ := 17` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.add_library_note (note_name note : string) : tactic unit | do let decl_name := `library_note <.> note_name,
add_decl $ mk_reflected_definition decl_name (),
add_doc_string decl_name note,
library_note_attr.set decl_name () tt none | def | tactic.add_library_note | tactic | src/tactic/doc_commands.lean | [] | [
"library_note",
"mk_reflected_definition"
] | If `note_name` and `note` are strings, `add_library_note note_name note` adds a declaration named
`library_note.<note_name>` with `note` as the docstring and tags it with the `library_note`
attribute. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
library_note (mi : interactive.decl_meta_info)
(_ : parse (tk "library_note")) : parser unit | do
note_name ← parser.pexpr,
note_name ← eval_pexpr string note_name,
some doc_string ← pure mi.doc_string | fail "library_note requires a doc string",
add_library_note note_name doc_string | def | library_note | tactic | src/tactic/doc_commands.lean | [] | [] | A command to add library notes. Syntax:
```
/--
note message
-/
library_note "note id"
``` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.get_library_notes : tactic (list (string × string)) | attribute.get_instances `library_note >>=
list.mmap (λ dcl, prod.mk dcl.last <$> doc_string dcl) | def | tactic.get_library_notes | tactic | src/tactic/doc_commands.lean | [] | [
"library_note"
] | Collects all notes in the current environment.
Returns a list of pairs `(note_id, note_content)` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
doc_category
| tactic | cmd | hole_cmd | attr | inductive | doc_category | tactic | src/tactic/doc_commands.lean | [] | [] | The categories of tactic doc entry. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
doc_category.to_string : doc_category → string | | doc_category.tactic := "tactic"
| doc_category.cmd := "command"
| doc_category.hole_cmd := "hole_command"
| doc_category.attr := "attribute" | def | doc_category.to_string | tactic | src/tactic/doc_commands.lean | [] | [
"doc_category"
] | Format a `doc_category` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic_doc_entry | (name : string)
(category : doc_category)
(decl_names : list _root_.name)
(tags : list string := [])
(inherit_description_from : option _root_.name := none) | structure | tactic_doc_entry | tactic | src/tactic/doc_commands.lean | [] | [
"doc_category"
] | The information used to generate a tactic doc entry | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic_doc_entry.to_json (d : tactic_doc_entry) (desc : string) : json | json.object [
("name", d.name),
("category", d.category.to_string),
("decl_names", d.decl_names.map (json.of_string ∘ to_string)),
("tags", d.tags.map json.of_string),
("description", desc)
] | def | tactic_doc_entry.to_json | tactic | src/tactic/doc_commands.lean | [] | [
"tactic_doc_entry"
] | Turns a `tactic_doc_entry` into a JSON representation. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic_doc_entry.has_to_string : has_to_string (tactic_doc_entry × string) | ⟨λ ⟨doc, desc⟩, json.unparse (doc.to_json desc)⟩ | instance | tactic_doc_entry.has_to_string | tactic | src/tactic/doc_commands.lean | [] | [
"tactic_doc_entry"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tactic_doc_entry_attr : user_attribute | { name := `tactic_doc,
descr := "Information about a tactic to be included in documentation",
parser := failed } | def | tactic_doc_entry_attr | tactic | src/tactic/doc_commands.lean | [] | [] | A user attribute `tactic_doc` for tagging decls of type `tactic_doc_entry`
for use in doc output | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.get_tactic_doc_entries : tactic (list (tactic_doc_entry × string)) | attribute.get_instances `tactic_doc >>=
list.mmap (λ dcl, prod.mk <$> (mk_const dcl >>= eval_expr tactic_doc_entry) <*> doc_string dcl) | def | tactic.get_tactic_doc_entries | tactic | src/tactic/doc_commands.lean | [] | [
"tactic_doc_entry"
] | Collects everything in the environment tagged with the attribute `tactic_doc`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.add_tactic_doc (tde : tactic_doc_entry) (doc : option string) : tactic unit | do desc ← doc <|> (do
inh_id ← match tde.inherit_description_from, tde.decl_names with
| some inh_id, _ := pure inh_id
| none, [inh_id] := pure inh_id
| none, _ := fail "A tactic doc entry must either:
1. have a description written as a doc-string for the `add_tactic_doc` invocation, or
2. have a sing... | def | tactic.add_tactic_doc | tactic | src/tactic/doc_commands.lean | [] | [
"tactic_doc_entry"
] | `add_tactic_doc tde` adds a declaration to the environment
with `tde` as its body and tags it with the `tactic_doc`
attribute. If `tde.decl_names` has exactly one entry `` `decl`` and
if `tde.description` is the empty string, `add_tactic_doc` uses the doc
string of `decl` as the description. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
add_tactic_doc_command (mi : interactive.decl_meta_info)
(_ : parse $ tk "add_tactic_doc") : parser unit | do
pe ← parser.pexpr,
e ← eval_pexpr tactic_doc_entry pe,
tactic.add_tactic_doc e mi.doc_string | def | add_tactic_doc_command | tactic | src/tactic/doc_commands.lean | [] | [
"tactic.add_tactic_doc",
"tactic_doc_entry"
] | A command used to add documentation for a tactic, command, hole command, or attribute.
Usage: after defining an interactive tactic, command, or attribute,
add its documentation as follows.
```lean
/--
describe what the command does here
-/
add_tactic_doc
{ name := "display name of the tactic",
category := cat,
dec... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
add_decl_doc_command (mi : interactive.decl_meta_info)
(_ : parse $ tk "add_decl_doc") : parser unit | do
n ← parser.ident,
n ← resolve_constant n,
some doc ← pure mi.doc_string | fail "add_decl_doc requires a doc string",
add_doc_string n doc | def | add_decl_doc_command | tactic | src/tactic/doc_commands.lean | [] | [] | The `add_decl_doc` command is used to add a doc string to an existing declaration.
```lean
def foo := 5
/--
Doc string for foo.
-/
add_decl_doc foo
``` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
extract_category : expr → tactic expr | | `(@eq (@quiver.hom ._ (@category_struct.to_quiver _
(@category.to_category_struct _ %%S)) _ _) _ _) := pure S
| _ := failed | def | tactic.extract_category | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | From an expression `f = g`,
where `f g : X ⟶ Y` for some objects `X Y : V` with `[S : category V]`,
extract the expression for `S`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
prove_elementwise (h : expr) : tactic (expr × expr × option name) | do
(vs,t) ← infer_type h >>= open_pis,
(f, g) ← match_eq t,
S ← extract_category t <|> fail "no morphism equation found in statement",
`(@quiver.hom _ %%H %%X %%Y) ← infer_type f,
C ← infer_type X,
CC_type ← to_expr ``(@concrete_category %%C %%S),
(CC, CC_found) ← (do CC ← mk_instance CC_type, pure... | def | tactic.prove_elementwise | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
elementwise_lemma (n : name) (n' : name := n.append_suffix "_apply") : tactic unit | do d ← get_decl n,
let c := @expr.const tt n d.univ_levels,
(t'',pr',l') ← prove_elementwise c,
let params := l'.to_list ++ d.univ_params,
add_decl $ declaration.thm n' params t'' (pure pr'),
copy_attribute `simp n n' | def | tactic.elementwise_lemma | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | (implementation for `@[elementwise]`)
Given a declaration named `n` of the form `∀ ..., f = g`, proves a new lemma named `n'`
of the form `∀ ... [concrete_category V] (x : X), f x = g x`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
elementwise_attr : user_attribute unit (option name) | { name := `elementwise,
descr := "create a companion lemma for a morphism equation applied to an element",
parser := optional ident,
after_set := some (λ n _ _,
do some n' ← elementwise_attr.get_param n | elementwise_lemma n (n.append_suffix "_apply"),
elementwise_lemma n $ n.get_prefix ++ n' ) } | def | tactic.elementwise_attr | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | The `elementwise` attribute can be applied to a lemma
```lean
@[elementwise]
lemma some_lemma {C : Type*} [category C]
{X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) (h : X ⟶ Z) (w : ...) : f ≫ g = h := ...
```
and will produce
```lean
lemma some_lemma_apply {C : Type*} [category C] [concrete_category C]
{X Y Z : C} (f : X... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
elementwise (del : parse (tk "!")?) (ns : parse ident*) : tactic unit | do ns.mmap' (λ n,
do h ← get_local n,
(t,pr,u) ← prove_elementwise h,
assertv n t pr,
when del.is_some (tactic.clear h) ) | def | tactic.interactive.elementwise | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | `elementwise h`, for assumption `w : ∀ ..., f ≫ g = h`, creates a new assumption
`w : ∀ ... (x : X), g (f x) = h x`.
`elementwise! h`, does the same but deletes the initial `h` assumption.
(You can also add the attribute `@[elementwise]` to lemmas to generate new declarations generalized
in this way.) | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
derive_elementwise_proof : tactic unit | do `(calculated_Prop %%v %%h) ← target,
(t,pr,n) ← prove_elementwise h,
unify v t,
exact pr | def | tactic.derive_elementwise_proof | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [] | Auxiliary definition for `category_theory.elementwise_of`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
category_theory.elementwise_of {α} (hh : α) {β}
(x : tactic.calculated_Prop β hh . tactic.derive_elementwise_proof) : β | x | theorem | category_theory.elementwise_of | tactic | src/tactic/elementwise.lean | [
"category_theory.concrete_category.basic",
"tactic.fresh_names",
"tactic.reassoc_axiom",
"tactic.slice"
] | [
"tactic.calculated_Prop",
"tactic.derive_elementwise_proof"
] | With `w : ∀ ..., f ≫ g = h` (with universal quantifiers tolerated),
`elementwise_of w : ∀ ... (x : X), g (f x) = h x`.
The type and proof of `elementwise_of h` is generated by `tactic.derive_elementwise_proof`
which makes `elementwise_of` meta-programming adjacent. It is not called as a tactic but as
an expression. Th... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
replace : ℕ → expr → tactic expr | | 0 e := do
t ← infer_type e,
expr.sort u ← infer_type t,
return $ (expr.const ``hidden [u]).app t e
| (i+1) (expr.app f x) := do
f' ← replace (i+1) f,
x' ← replace i x,
return (f' x')
| (i+1) (expr.lam n b d e) := do
d' ← replace i d,
var ← mk_local' n b d,
e' ← replace i (expr.instantiate_var e var)... | def | tactic.elide.replace | tactic | src/tactic/elide.lean | [
"tactic.core"
] | [
"hidden"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unelide (e : expr) : expr | expr.replace e $ λ e n,
match e with
| (expr.app (expr.app (expr.const n _) _) e') :=
if n = ``hidden then some e' else none
| (expr.app (expr.lam _ _ _ (expr.var 0)) e') := some e'
| _ := none
end | def | tactic.elide.unelide | tactic | src/tactic/elide.lean | [
"tactic.core"
] | [
"hidden"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
elide (n : parse small_nat) (loc : parse location) : tactic unit | loc.apply
(λ h, do t ← infer_type h >>= tactic.elide.replace n,
tactic.change_core t (some h))
(target >>= tactic.elide.replace n >>= tactic.change) | def | tactic.interactive.elide | tactic | src/tactic/elide.lean | [
"tactic.core"
] | [
"tactic.change_core",
"tactic.elide.replace"
] | The `elide n (at ...)` tactic hides all subterms of the target goal or hypotheses
beyond depth `n` by replacing them with `hidden`, which is a variant
on the identity function. (Tactics should still mostly be able to see
through the abbreviation, but if you want to unhide the term you can use
`unelide`.) | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
unelide (loc : parse location) : tactic unit | loc.apply
(λ h, do t ← infer_type h,
tactic.change_core (elide.unelide t) (some h))
(target >>= tactic.change ∘ elide.unelide) | def | tactic.interactive.unelide | tactic | src/tactic/elide.lean | [
"tactic.core"
] | [
"tactic.change_core"
] | The `unelide (at ...)` tactic removes all `hidden` subterms in the target
types (usually added by `elide`). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
equiv_congr_lemmas : list (tactic expr) | [ `equiv.of_iff,
-- TODO decide what to do with this; it's an equiv_bifunctor?
`equiv.equiv_congr,
-- The function arrow is technically a bifunctor `Typeᵒᵖ → Type → Type`,
-- but the pattern matcher will never see this.
`equiv.arrow_congr',
-- Allow rewriting in subtypes:
`equiv.subtype_equiv_of_subtype',... | def | tactic.equiv_congr_lemmas | tactic | src/tactic/equiv_rw.lean | [
"logic.equiv.defs",
"tactic.clear",
"tactic.simp_result",
"tactic.apply",
"control.equiv_functor.instances",
"logic.equiv.functor"
] | [
"bifunctor.map_equiv",
"equiv.Pi_congr_left'",
"equiv.arrow_congr'",
"equiv.equiv_congr",
"equiv.forall_congr'",
"equiv.forall₂_congr'",
"equiv.forall₃_congr'",
"equiv.of_iff",
"equiv.refl",
"equiv.sigma_congr_left'",
"equiv.subtype_equiv_of_subtype'",
"equiv_functor.map_equiv"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
equiv_rw_cfg | (max_depth : ℕ := 10) | structure | tactic.equiv_rw_cfg | tactic | src/tactic/equiv_rw.lean | [
"logic.equiv.defs",
"tactic.clear",
"tactic.simp_result",
"tactic.apply",
"control.equiv_functor.instances",
"logic.equiv.functor"
] | [] | Configuration structure for `equiv_rw`.
* `max_depth` bounds the search depth for equivalences to rewrite along.
The default value is 10.
(e.g., if you're rewriting along `e : α ≃ β`, and `max_depth := 2`,
you can rewrite `option (option α))` but not `option (option (option α))`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
equiv_rw_type_core (eq : expr) (cfg : equiv_rw_cfg) : tactic unit | do
/-
We now call `solve_by_elim` to try to generate the requested equivalence.
There are a few subtleties!
* We make sure that `eq` is the first lemma, so it is applied whenever possible.
* In `equiv_congr_lemmas`, we put `equiv.refl` last so it is only used when it is not possible
to descend f... | def | tactic.equiv_rw_type_core | tactic | src/tactic/equiv_rw.lean | [
"logic.equiv.defs",
"tactic.clear",
"tactic.simp_result",
"tactic.apply",
"control.equiv_functor.instances",
"logic.equiv.functor"
] | [
"trace_if_enabled"
] | Implementation of `equiv_rw_type`, using `solve_by_elim`.
Expects a goal of the form `t ≃ _`,
and tries to solve it using `eq : α ≃ β` and congruence lemmas. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
equiv_rw_type (eqv : expr) (ty : expr) (cfg : equiv_rw_cfg) : tactic expr | do
when_tracing `equiv_rw_type (do
ty_pp ← pp ty,
eqv_pp ← pp eqv,
eqv_ty_pp ← infer_type eqv >>= pp,
trace format!"Attempting to rewrite the type `{ty_pp}` using `{eqv_pp} : {eqv_ty_pp}`."),
`(_ ≃ _) ← infer_type eqv | fail format!"{eqv} must be an `equiv`",
-- We prepare a synthetic goal of type... | def | tactic.equiv_rw_type | tactic | src/tactic/equiv_rw.lean | [
"logic.equiv.defs",
"tactic.clear",
"tactic.simp_result",
"tactic.apply",
"control.equiv_functor.instances",
"logic.equiv.functor"
] | [] | `equiv_rw_type e t` rewrites the type `t` using the equivalence `e : α ≃ β`,
returning a new equivalence `t ≃ t'`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.