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 |
|---|---|---|---|---|---|---|---|---|---|---|
list_binary_operands (f : expr) : expr → tactic (list expr) | | x@(expr.app (expr.app g a) b) := do
some _ ← try_core (unify f g) | pure [x],
as ← list_binary_operands a,
bs ← list_binary_operands b,
pure (as ++ bs)
| a := pure [a] | def | tactic.list_binary_operands | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Given an expression `f` (likely a binary operation) and a further expression `x`, calling
`list_binary_operands f x` breaks `x` apart into successions of applications of `f` until this can
no longer be done and returns a list of the leaves of the process.
This matches `f` up to semireducible unification. In particular... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_theorem (n : name) (ls : list name) (t : expr) (e : expr) : declaration | declaration.thm n ls t (task.pure e) | def | tactic.mk_theorem | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `mk_theorem n ls t e` creates a theorem declaration with name `n`, universe parameters named
`ls`, type `t`, and body `e`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
add_theorem_by (n : name) (ls : list name) (type : expr) (tac : tactic unit) :
tactic expr | do ((), body) ← solve_aux type tac,
body ← instantiate_mvars body,
add_decl $ mk_theorem n ls type body,
return $ expr.const n $ ls.map level.param | def | tactic.add_theorem_by | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `add_theorem_by n ls type tac` uses `tac` to synthesize a term with type `type`, and adds this
to the environment as a theorem with name `n` and universe parameters `ls`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eval_expr' (α : Type*) [reflected _ α] (e : expr) : tactic α | mk_app ``id [e] >>= eval_expr α | def | tactic.eval_expr' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `eval_expr' α e` attempts to evaluate the expression `e` in the type `α`.
This is a variant of `eval_expr` in core. Due to unexplained behavior in the VM, in rare
situations the latter will fail but the former will succeed. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_user_fresh_name : tactic name | do nm ← mk_fresh_name,
return $ `user__ ++ nm.pop_prefix.sanitize_name ++ `user__ | def | tactic.mk_user_fresh_name | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `mk_fresh_name` returns identifiers starting with underscores,
which are not legal when emitted by tactic programs. `mk_user_fresh_name`
turns the useful source of random names provided by `mk_fresh_name` into
names which are usable by tactic programs.
The returned name has four components which are all strings. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
has_attribute' (attr_name decl_name : name) : tactic bool | succeeds (has_attribute attr_name decl_name) | def | tactic.has_attribute' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"succeeds"
] | `has_attribute' attr_name decl_name` checks
whether `decl_name` exists and has attribute `attr_name`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
is_simp_lemma : name → tactic bool | has_attribute' `simp | def | tactic.is_simp_lemma | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Checks whether the name is a simp lemma | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
is_instance : name → tactic bool | has_attribute' `instance | def | tactic.is_instance | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Checks whether the name is an instance. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
local_decls : tactic (name_map declaration) | do e ← tactic.get_env,
let xs := e.fold native.mk_rb_map
(λ d s, if environment.in_current_file e d.to_name
then s.insert d.to_name d else s),
pure xs | def | tactic.local_decls | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `local_decls` returns a dictionary mapping names to their corresponding declarations.
Covers all declarations from the current file. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_decls_from (fs : list (option string)) : tactic (name_map declaration) | do root ← unsafe_run_io $ io.env.get_cwd,
let fs := fs.map (option.map $ λ path, root ++ "/" ++ path),
err ← unsafe_run_io $ (fs.filter_map id).mfilter $ (<$>) bnot ∘ io.fs.file_exists,
guard (err = []) <|> fail format!"File not found: {err}",
e ← tactic.get_env,
let xs := e.fold native.mk_rb_map
(λ... | def | tactic.get_decls_from | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"path"
] | `get_decls_from` returns a dictionary mapping names to their
corresponding declarations. Covers all declarations the files listed
in `fs`, with the current file listed as `none`.
The path of the file names is expected to be relative to
the root of the project (i.e. the location of `leanpkg.toml` when it
is present); ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_unused_decl_name_aux (e : environment) (nm : name) : ℕ → tactic name | n | let nm' := nm.append_suffix ("_" ++ to_string n) in
if e.contains nm' then get_unused_decl_name_aux (n+1) else return nm' | def | tactic.get_unused_decl_name_aux | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | If `{nm}_{n}` doesn't exist in the environment, returns that, otherwise tries `{nm}_{n+1}` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_unused_decl_name (nm : name) : tactic name | get_env >>= λ e, if e.contains nm then get_unused_decl_name_aux e nm 2 else return nm | def | tactic.get_unused_decl_name | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Return a name which doesn't already exist in the environment. If `nm` doesn't exist, it
returns that, otherwise it tries `nm_2`, `nm_3`, ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
decl_mk_const (d : declaration) : tactic (expr × expr) | do subst ← d.univ_params.mmap $ λ u, prod.mk u <$> mk_meta_univ,
let e : expr := expr.const d.to_name (prod.snd <$> subst),
return (e, d.type.instantiate_univ_params subst) | def | tactic.decl_mk_const | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Returns a pair `(e, t)`, where `e ← mk_const d.to_name`, and `t = d.type`
but with universe params updated to match the fresh universe metavariables in `e`.
This should have the same effect as just
```lean
do e ← mk_const d.to_name,
t ← infer_type e,
return (e, t)
```
but is hopefully faster. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
replace_univ_metas_with_univ_params (e : expr) : tactic expr | do
e.list_univ_meta_vars.enum.mmap (λ n, do
let n' := (`u).append_suffix ("_" ++ to_string (n.1+1)),
unify (expr.sort (level.mvar n.2)) (expr.sort (level.param n'))),
instantiate_mvars e | def | tactic.replace_univ_metas_with_univ_params | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Replace every universe metavariable in an expression with a universe parameter.
(This is useful when making new declarations.) | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_local (n : name) : expr | expr.local_const n n binder_info.default (expr.const n []) | def | tactic.mk_local | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `mk_local n` creates a dummy local variable with name `n`.
The type of this local constant is a constant with name `n`, so it is very unlikely to be
a meaningful expression. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_psigma : list expr → tactic expr | | [] := mk_const ``punit
| [x@(expr.local_const _ _ _ _)] := pure x
| (x@(expr.local_const _ _ _ _) :: xs) :=
do y ← mk_psigma xs,
α ← infer_type x,
β ← infer_type y,
t ← lambdas [x] β >>= instantiate_mvars,
r ← mk_mapp ``psigma.mk [α,t],
pure $ r x y
| _ := fail "mk_psigma expects a list of ... | def | tactic.mk_psigma | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `mk_psigma [x,y,z]`, with `[x,y,z]` list of local constants of types `x : tx`,
`y : ty x` and `z : tz x y`, creates an expression of sigma type:
`⟨x,y,z⟩ : Σ' (x : tx) (y : ty x), tz x y`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
update_type : expr → tactic expr | | e@(expr.local_const ppname uname binfo _) :=
expr.local_const ppname uname binfo <$> infer_type e
| e@(expr.mvar ppname uname _) :=
expr.mvar ppname uname <$> infer_type e
| e := pure e | def | tactic.update_type | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Update the type of a local constant or metavariable. For local constants and
metavariables obtained via, for example, `tactic.get_local`, the type stored in
the expression is not necessarily the same as the type returned by `infer_type`.
This tactic, given a local constant or metavariable, updates the stored type to
ma... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
elim_gen_prod : nat → expr → list expr → list name → tactic (list expr × expr × list name) | | 0 e hs ns := return (hs.reverse, e, ns)
| (n + 1) e hs ns := do
t ← infer_type e,
if t.is_app_of `eq then return (hs.reverse, e, ns)
else do
[(_, [h, h'], _)] ← cases_core e (ns.take 1),
elim_gen_prod n h' (h :: hs) (ns.drop 1) | def | tactic.elim_gen_prod | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `elim_gen_prod n e _ ns` with `e` an expression of type `psigma _`, applies `cases` on `e` `n`
times and uses `ns` to name the resulting variables. Returns a triple: list of new variables,
remaining term and unused variable names. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
elim_gen_sum_aux : nat → expr → list expr → tactic (list expr × expr) | | 0 e hs := return (hs, e)
| (n + 1) e hs := do
[(_, [h], _), (_, [h'], _)] ← induction e [],
swap,
elim_gen_sum_aux n h' (h::hs) | def | tactic.elim_gen_sum_aux | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
elim_gen_sum (n : nat) (e : expr) : tactic (list expr) | do
(hs, h') ← elim_gen_sum_aux n e [],
gs ← get_goals,
set_goals $ (gs.take (n+1)).reverse ++ gs.drop (n+1),
return $ hs.reverse ++ [h'] | def | tactic.elim_gen_sum | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `elim_gen_sum n e` applies cases on `e` `n` times. `e` is assumed to be a local constant whose
type is a (nested) sum `⊕`. Returns the list of local constants representing the components of `e`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
extract_def (n : name) (trusted : bool) (elab_def : tactic unit) : tactic unit | do cxt ← list.map expr.to_implicit_local_const <$> local_context,
t ← target,
(eqns,d) ← solve_aux t elab_def,
d ← instantiate_mvars d,
t' ← pis cxt t,
d' ← lambdas cxt d,
let univ := t'.collect_univ_params,
add_decl $ declaration.defn n univ t' d' (reducibility_hints.regular 1 tt) trusted,
appl... | def | tactic.extract_def | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"expr.to_implicit_local_const"
] | Given `elab_def`, a tactic to solve the current goal,
`extract_def n trusted elab_def` will create an auxiliary definition named `n` and use it
to close the goal. If `trusted` is false, it will be a meta definition. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
exact_dec_trivial : tactic unit | `[exact dec_trivial] | def | tactic.exact_dec_trivial | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Attempts to close the goal with `dec_trivial`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
retrieve {α} (tac : tactic α) : tactic α | λ s, result.cases_on (tac s)
(λ a s', result.success a s)
result.exception | def | tactic.retrieve | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Runs a tactic for a result, reverting the state after completion. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
retrieve' {α} (tac : tactic α) : tactic α | λ s, result.cases_on (tac s)
(λ a s', result.success a s)
(λ msg pos s', result.exception msg pos s) | def | tactic.retrieve' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Runs a tactic for a result, reverting the state after completion or error. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
repeat1 (t : tactic unit) : tactic unit | t; repeat t | def | tactic.repeat1 | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Repeat a tactic at least once, calling it recursively on all subgoals,
until it fails. This tactic fails if the first invocation fails. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iterate_range : ℕ → ℕ → tactic unit → tactic unit | | 0 0 t := skip
| 0 (n+1) t := try (t >> iterate_range 0 n t)
| (m+1) n t := t >> iterate_range m (n-1) t | def | tactic.iterate_range | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `iterate_range m n t`: Repeat the given tactic at least `m` times and
at most `n` times or until `t` fails. Fails if `t` does not run at least `m` times. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
replace_at (tac : expr → tactic (expr × expr)) (hs : list expr) (tgt : bool) :
tactic bool | do to_remove ← hs.mfilter $ λ h, do
{ h_type ← infer_type h,
succeeds $ do
(new_h_type, pr) ← tac h_type,
assert h.local_pp_name new_h_type,
mk_eq_mp pr h >>= tactic.exact },
goal_simplified ← succeeds $ do
{ guard tgt,
(new_t, pr) ← target >>= tac,
replace_target new_t pr },
to_re... | def | tactic.replace_at | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"succeeds"
] | Given a tactic `tac` that takes an expression
and returns a new expression and a proof of equality,
use that tactic to change the type of the hypotheses listed in `hs`,
as well as the goal if `tgt = tt`.
Returns `tt` if any types were successfully changed. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_after (e : expr) : tactic ℕ | do
l ← local_context,
[pos] ← return $ l.indexes_of e | pp e >>= λ s, fail format!"No such local constant {s}",
let l := l.drop pos.succ, -- all local hypotheses after `e`
revert_lst l | def | tactic.revert_after | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `revert_after e` reverts all local constants after local constant `e`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
revert_target_deps : tactic ℕ | do tgt ← target,
ctx ← local_context,
l ← ctx.mfilter (kdepends_on tgt),
n ← revert_lst l,
if l = [] then return n
else do m ← revert_target_deps, return (m + n) | def | tactic.revert_target_deps | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `revert_target_deps` reverts all local constants on which the target depends (recursively).
Returns the number of local constants that have been reverted. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
generalize' (e : expr) (n : name) : tactic expr | (generalize e n >> intro n) <|> note n none e | def | tactic.generalize' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `generalize' e n` generalizes the target with respect to `e`. It creates a new local constant
with name `n` of the same type as `e` and replaces all occurrences of `e` by `n`.
`generalize'` is similar to `generalize` but also succeeds when `e` does not occur in the
goal, in which case it just calls `assert`.
In contra... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intron_no_renames : ℕ → tactic unit | | 0 := pure ()
| (n+1) := do
expr.pi pp_n _ _ _ ← target,
intro pp_n,
intron_no_renames n | def | tactic.intron_no_renames | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `intron_no_renames n` calls `intro` `n` times, using the pretty-printing name
provided by the binder to name the new local constant.
Unlike `intron`, it does not rename introduced constants if the names shadow existing constants. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_univ_level (t : expr) (md := semireducible) (unfold_ginductive := tt) :
tactic level | do expr.sort u ← infer_type t >>= λ s, whnf s md unfold_ginductive |
fail "get_univ_level: argument is not a type",
return u | def | tactic.get_univ_level | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `get_univ_level t` returns the universe level of a type `t` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
local_def_value (e : expr) : tactic expr | pp e >>= λ s, -- running `pp` here, because we cannot access it in the `type_context` monad.
tactic.unsafe.type_context.run $ do
lctx <- tactic.unsafe.type_context.get_local_context,
some ldecl <- return $ lctx.get_local_decl e.local_uniq_name |
tactic.unsafe.type_context.fail format!"No such hypothesis {s}.",
... | def | tactic.local_def_value | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `local_def_value e` returns the value of the expression `e`, assuming that `e` has been defined
locally using a `let` expression. Otherwise it fails. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
is_local_def (e : expr) : tactic unit | do
ctx ← unsafe.type_context.get_local_context.run,
(some decl) ← pure $ ctx.get_local_decl e.local_uniq_name |
fail format!"is_local_def: {e} is not a local constant",
when decl.value.is_none $ fail
format!"is_local_def: {e} is not a local definition" | def | tactic.is_local_def | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `is_local_def e` succeeds when `e` is a local definition (a local constant of the form
`e : α := t`) and otherwise fails. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
local_defs : tactic (list expr) | do
ctx ← unsafe.type_context.get_local_context.run,
ctx' ← local_context,
ctx'.mfilter $ λ h, do
(some decl) ← pure $ ctx.get_local_decl h.local_uniq_name |
fail format!"local_defs: local {h} not found in the local context",
pure decl.value.is_some | def | tactic.local_defs | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Returns the local definitions from the context. A local definition is a
local constant of the form `e : α := t`. The local definitions are returned in
the order in which they appear in the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
partition_local_deps_aux {α} [decidable_eq α] (vs : list α) :
list α → list α → list (list α) | | [] acc := [acc.reverse]
| (l :: ls) acc :=
if l ∈ vs then acc.reverse :: partition_local_deps_aux ls [l]
else partition_local_deps_aux ls (l :: acc) | def | tactic.partition_local_deps_aux | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | like `split_on_p p xs`, `partition_local_deps_aux vs xs acc` searches for matches in `xs`
(using membership to `vs` instead of a predicate) and breaks `xs` when matches are found.
whereas `split_on_p p xs` removes the matches, `partition_local_deps_aux vs xs acc` includes
them in the following partition. Also, `partiti... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
partition_local_deps (vs : list expr) : tactic (list (list expr)) | do ls ← local_context,
pure (partition_local_deps_aux vs ls []).tail.reverse | def | tactic.partition_local_deps | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `partition_local_deps vs`, with `vs` a list of local constants,
reorders `vs` in the order they appear in the local context together
with the variables that follow them. If local context is `[a,b,c,d,e,f]`,
and that we call `partition_local_deps [d,b]`, we get `[[d,e,f], [b,c]]`.
The head of each list is one of the var... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
clear_value (vs : list expr) : tactic unit | do
ls ← partition_local_deps vs,
ls.mmap' $ λ vs, do
{ revert_lst vs,
(expr.elet v t d b) ← target |
fail format!"Cannot clear the body of {vs.head}. It is not a local definition.",
let e := expr.pi v binder_info.default t b,
type_check e <|>
fail format!"Cannot clear the body of {vs.head}... | def | tactic.clear_value | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `clear_value [e₀, e₁, e₂, ...]` clears the body of the local definitions `e₀`, `e₁`, `e₂`, ...
changing them into regular hypotheses. A hypothesis `e : α := t` is changed to `e : α`. The order of
locals `e₀`, `e₁`, `e₂` does not matter as a permutation will be chosen so as to preserve type
correctness. This tactic is c... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
context_has_local_def : tactic bool | do
ctx ← local_context,
ctx.many (succeeds ∘ local_def_value) | def | tactic.context_has_local_def | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"succeeds"
] | `context_has_local_def` is true iff there is at least one local definition in
the context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
context_upto_hyp_has_local_def (h : expr) : tactic bool | do
ff ← succeeds (local_def_value h) | pure tt,
ctx ← local_context,
let ctx := ctx.take_while (≠ h),
ctx.many (succeeds ∘ local_def_value) | def | tactic.context_upto_hyp_has_local_def | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"succeeds"
] | `context_upto_hyp_has_local_def h` is true iff any of the hypotheses in the
context up to and including `h` is a local definition. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
subst' (h : expr) : tactic unit | do
e ← do { -- we first find the variable being substituted away
t ← infer_type h,
let (f, args) := t.get_app_fn_args,
if (f.const_name = `eq ∨ f.const_name = `heq) then do
{ let lhs := args.inth 1,
let rhs := args.ilast,
if rhs.is_local_constant then return rhs else
if lhs.is_local_... | def | tactic.subst' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | If the expression `h` is a local variable with type `x = t` or `t = x`, where `x` is a local
constant, `tactic.subst' h` substitutes `x` by `t` everywhere in the main goal and then clears `h`.
If `h` is another local variable, then we find a local constant with type `h = t` or `t = h` and
substitute `t` for `h`.
This ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
simp_bottom_up' (post : expr → tactic (expr × expr)) (e : expr) (cfg : simp_config := {}) :
tactic (expr × expr) | prod.snd <$> simplify_bottom_up () (λ _, (<$>) (prod.mk ()) ∘ post) e cfg | def | tactic.simp_bottom_up' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | A variant of `simplify_bottom_up`. Given a tactic `post` for rewriting subexpressions,
`simp_bottom_up post e` tries to rewrite `e` starting at the leaf nodes. Returns the resulting
expression and a proof of equality. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
instance_cache | (α : expr)
(univ : level)
(inst : name_map expr) | structure | tactic.instance_cache | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Caches unary type classes on a type `α : Type.{univ}`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_instance_cache (α : expr) : tactic instance_cache | do u ← mk_meta_univ,
infer_type α >>= unify (expr.sort (level.succ u)),
u ← get_univ_assignment u,
return ⟨α, u, mk_name_map⟩ | def | tactic.mk_instance_cache | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Creates an `instance_cache` for the type `α`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get (c : instance_cache) (n : name) : tactic (instance_cache × expr) | match c.inst.find n with
| some i := return (c, i)
| none := do e ← mk_app n [c.α] >>= mk_instance,
return (⟨c.α, c.univ, c.inst.insert n e⟩, e)
end | def | tactic.instance_cache.get | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | If `n` is the name of a type class with one parameter, `get c n` tries to find an instance of
`n c.α` by checking the cache `c`. If there is no entry in the cache, it tries to find the instance
via type class resolution, and updates the cache. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
append_typeclasses : expr → instance_cache → list expr →
tactic (instance_cache × list expr) | | (pi _ binder_info.inst_implicit (app (const n _) (var _)) body) c l :=
do (c, p) ← c.get n, return (c, p :: l)
| _ c l := return (c, l) | def | tactic.instance_cache.append_typeclasses | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | If `e` is a `pi` expression that binds an instance-implicit variable of type `n`,
`append_typeclasses e c l` searches `c` for an instance `p` of type `n` and returns `p :: l`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_app (c : instance_cache) (n : name) (l : list expr) : tactic (instance_cache × expr) | do d ← get_decl n,
(c, l) ← append_typeclasses d.type.binding_body c l,
return (c, (expr.const n [c.univ]).mk_app (c.α :: l)) | def | tactic.instance_cache.mk_app | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Creates the application `n c.α p l`, where `p` is a type class instance found in the cache `c`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
of_nat (c : instance_cache) (n : ℕ) : tactic (instance_cache × expr) | if n = 0 then c.mk_app ``has_zero.zero [] else do
(c, ai) ← c.get ``has_add,
(c, oi) ← c.get ``has_one,
(c, one) ← c.mk_app ``has_one.one [],
return (c, n.binary_rec one $ λ b n e,
if n = 0 then one else
cond b
((expr.const ``bit1 [c.univ]).mk_app [c.α, oi, ai, e])
((expr.const ``bit0 [c.uni... | def | tactic.instance_cache.of_nat | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `c.of_nat n` creates the `c.α`-valued numeral expression corresponding to `n`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
of_int (c : instance_cache) : ℤ → tactic (instance_cache × expr) | | (n : ℕ) := c.of_nat n
| -[1+ n] := do
(c, e) ← c.of_nat (n+1),
c.mk_app ``has_neg.neg [e] | def | tactic.instance_cache.of_int | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `c.of_int n` creates the `c.α`-valued numeral expression corresponding to `n`.
The output is either a numeral or the negation of a numeral. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
local_proof (h : name) (p : expr) (tac₀ : tactic unit) :
tactic (expr × list expr) | focus1 $
do h' ← assert h p,
[g₀,g₁] ← get_goals,
set_goals [g₀], tac₀,
gs ← get_goals,
set_goals [g₁],
return (h', gs) | def | tactic.local_proof | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | A variation on `assert` where a (possibly incomplete)
proof of the assertion is provided as a parameter.
``(h,gs) ← local_proof `h p tac`` creates a local `h : p` and
use `tac` to (partially) construct a proof for it. `gs` is the
list of remaining goals in the proof of `h`.
The benefits over assert are:
- unlike with... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
var_names : expr → list name | | (expr.pi n _ _ b) := n :: var_names b
| _ := [] | def | tactic.var_names | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `var_names e` returns a list of the unique names of the initial pi bindings in `e`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
subobject_names (struct_n : name) : tactic (list name × list name) | do env ← get_env,
c ← match env.constructors_of struct_n with
| [c] := pure c
| [] :=
if env.is_inductive struct_n
then fail format!"{struct_n} does not have constructors"
else fail format!"{struct_n} is not an inductive type"
| _ := fail "too many constructors"
... | def | tactic.subobject_names | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | When `struct_n` is the name of a structure type,
`subobject_names struct_n` returns two lists of names `(instances, fields)`.
The names in `instances` are the projections from `struct_n` to the structures that it extends
(assuming it was defined with `old_structure_cmd false`).
The names in `fields` are the standard fi... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
expanded_field_list' : name → tactic (dlist $ name × name) | struct_n | do (so,fs) ← subobject_names struct_n,
ts ← so.mmap (λ n, do
(_, e) ← mk_const (n.update_prefix struct_n) >>= infer_type >>= open_pis,
expanded_field_list' $ e.get_app_fn.const_name),
return $ dlist.join ts ++ dlist.of_list (fs.map $ prod.mk struct_n) | def | tactic.expanded_field_list' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"dlist.join"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
expanded_field_list (struct_n : name) : tactic (list $ name × name) | dlist.to_list <$> expanded_field_list' struct_n | def | tactic.expanded_field_list | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `expanded_field_list struct_n` produces a list of the names of the fields of the structure
named `struct_n`. These are returned as pairs of names `(prefix, name)`, where the full name
of the projection is `prefix.name`.
`struct_n` cannot be a synonym for a `structure`, it must be itself a `structure` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_classes (e : expr) : tactic (list name) | attribute.get_instances `class >>= list.mfilter (λ n,
succeeds $ mk_app n [e] >>= mk_instance) | def | tactic.get_classes | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"succeeds"
] | Return a list of all type classes which can be instantiated
for the given expression. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_conditional_instance (cond tgt : expr) : tactic (expr × expr) | do
f ← mk_meta_var cond,
e ← assertv `c cond f, swap,
reset_instance_cache,
inst ← mk_instance tgt,
return (e, inst) | def | tactic.mk_conditional_instance | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Finds an instance of an implication `cond → tgt`.
Returns a pair of a local constant `e` of type `cond`, and an instance of `tgt` that can mention
`e`. The local constant `e` is added as an hypothesis to the tactic state, but should not be used,
since it has been "proven" by a metavariable. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_mvar_list : ℕ → tactic (list expr) | | 0 := pure []
| (succ n) := (::) <$> mk_mvar <*> mk_mvar_list n | def | tactic.mk_mvar_list | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Create a list of `n` fresh metavariables. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_goal : tactic expr | do gs ← get_goals,
match gs with
| [a] := return a
| [] := fail "there are no goals"
| _ := fail "there are too many goals"
end | def | tactic.get_goal | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Returns the only goal, or fails if there isn't just one goal. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iterate_at_most_on_all_goals : nat → tactic unit → tactic unit | | 0 tac := trace "maximal iterations reached"
| (succ n) tac := tactic.all_goals' $ (do tac, iterate_at_most_on_all_goals n tac) <|> skip | def | tactic.iterate_at_most_on_all_goals | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `iterate_at_most_on_all_goals n t`: repeat the given tactic at most `n` times on all goals,
or until it fails. Always succeeds. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iterate_at_most_on_subgoals : nat → tactic unit → tactic unit | | 0 tac := trace "maximal iterations reached"
| (succ n) tac := focus1 (do tac, iterate_at_most_on_all_goals n tac) | def | tactic.iterate_at_most_on_subgoals | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `iterate_at_most_on_subgoals n t`: repeat the tactic `t` at most `n` times on the first
goal and on all subgoals thus produced, or until it fails. Fails iff `t` fails on
current goal. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
lock_tactic_state {α} (t : tactic α) : tactic α | | s := match t s with
| result.success a s' := result.success a s
| result.exception msg pos s' := result.exception msg pos s
end | def | tactic.lock_tactic_state | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | This makes sure that the execution of the tactic does not change the tactic state.
This can be helpful while using rewrite, apply, or expr munging.
Remember to instantiate your metavariables before you're done! | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_list_expr (opt : apply_cfg) : list (tactic expr) → tactic unit | | [] := fail "no matching rule"
| (h::t) := (do e ← h, interactive.concat_tags (apply e opt)) <|> apply_list_expr t | def | tactic.apply_list_expr | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `apply_list l`, for `l : list (tactic expr)`,
tries to apply one of the lemmas generated by the tactics in `l` to the first goal, and
fail if none succeeds. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
resolve_attribute_expr_list (attr_name : name) : tactic (list (tactic expr)) | do
l ← attribute.get_instances attr_name,
list.map i_to_expr_for_apply <$> list.reverse
<$> l.mmap (λ n, do c ← (mk_const n), return (pexpr.of_expr c)) | def | tactic.resolve_attribute_expr_list | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Given the name of a user attribute, produces a list of `tactic expr`s, each of which is the
application of `i_to_expr_for_apply` to a declaration with that attribute. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_rules (args : list pexpr) (attrs : list name) (n : nat) (opt : apply_cfg) :
tactic unit | do
attr_exprs ← lock_tactic_state $ attrs.mfoldl
(λ l n, list.append l <$> resolve_attribute_expr_list n) [],
let args_exprs := args.map i_to_expr_for_apply ++ attr_exprs,
-- `args_exprs` is a list of `tactic expr`, rather than just `expr`, because these expressions will
-- be repeatedly applied against goals, ... | def | tactic.apply_rules | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `apply_rules args attrs n`: apply the lists of rules `args` (given as pexprs) and `attrs` (given
as names of attributes) and the tactic `assumption` on the first goal and the resulting subgoals,
iteratively, at most `n` times.
Unlike `solve_by_elim`, `apply_rules` does not do any backtracking, and just greedily applie... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
replace (h : name) (p : pexpr) : tactic unit | do h' ← get_local h,
p ← to_expr p,
note h none p,
clear h' | def | tactic.replace | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `replace h p` elaborates the pexpr `p`, clears the existing hypothesis named `h` from the local
context, and adds a new hypothesis named `h`. The type of this hypothesis is the type of `p`.
Fails if there is nothing named `h` in the local context. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_iff_mp_app (iffmp : name) : expr → (nat → expr) → option expr | | (expr.pi n bi e t) f := expr.lam n bi e <$> mk_iff_mp_app t (λ n, f (n+1) (expr.var n))
| `(%%a ↔ %%b) f := some $ @expr.const tt iffmp [] a b (f 0)
| _ f := none | def | tactic.mk_iff_mp_app | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Auxiliary function for `iff_mp` and `iff_mpr`. Takes a name, which should be either `` `iff.mp``
or `` `iff.mpr``. If the passed expression is an iterated function type eventually producing an
`iff`, returns an expression with the `iff` converted to either the forwards or backwards
implication, as requested. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iff_mp_core (e ty: expr) : option expr | mk_iff_mp_app `iff.mp ty (λ_, e) | def | tactic.iff_mp_core | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `iff_mp_core e ty` assumes that `ty` is the type of `e`.
If `ty` has the shape `Π ..., A ↔ B`, returns an expression whose type is `Π ..., A → B`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iff_mpr_core (e ty: expr) : option expr | mk_iff_mp_app `iff.mpr ty (λ_, e) | def | tactic.iff_mpr_core | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `iff_mpr_core e ty` assumes that `ty` is the type of `e`.
If `ty` has the shape `Π ..., A ↔ B`, returns an expression whose type is `Π ..., B → A`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iff_mp (e : expr) : tactic expr | do t ← infer_type e,
iff_mp_core e t <|> fail "Target theorem must have the form `Π x y z, a ↔ b`" | def | tactic.iff_mp | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Given an expression whose type is (a possibly iterated function producing) an `iff`,
create the expression which is the forward implication. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iff_mpr (e : expr) : tactic expr | do t ← infer_type e,
iff_mpr_core e t <|> fail "Target theorem must have the form `Π x y z, a ↔ b`" | def | tactic.iff_mpr | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Given an expression whose type is (a possibly iterated function producing) an `iff`,
create the expression which is the reverse implication. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_iff (e : expr) : tactic (list (name × expr)) | let ap e := tactic.apply e {new_goals := new_goals.non_dep_only} in
ap e <|> (iff_mp e >>= ap) <|> (iff_mpr e >>= ap) | def | tactic.apply_iff | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Attempts to apply `e`, and if that fails, if `e` is an `iff`,
try applying both directions separately. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_any_opt extends apply_cfg | (use_symmetry : bool := tt)
(use_exfalso : bool := tt) | structure | tactic.apply_any_opt | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Configuration options for `apply_any`:
* `use_symmetry`: if `apply_any` fails to apply any lemma, call `symmetry` and try again.
* `use_exfalso`: if `apply_any` fails to apply any lemma, call `exfalso` and try again.
* `apply`: specify an alternative to `tactic.apply`; usually `apply := tactic.eapply`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_any_thunk
(lemmas : list (tactic expr))
(opt : apply_any_opt := {})
(tac : tactic unit := skip)
(on_success : expr → tactic unit := (λ _, skip))
(on_failure : tactic unit := skip) : tactic unit | do
let modes := [skip]
++ (if opt.use_symmetry then [symmetry] else [])
++ (if opt.use_exfalso then [exfalso] else []),
modes.any_of (λ m, do m,
lemmas.any_of (λ H, H >>= (λ e, do apply e opt.to_apply_cfg, on_success e, tac))) <|>
(on_failure >> fail "apply_any tactic failed; no lemma could be applied... | def | tactic.apply_any_thunk | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | This is a version of `apply_any` that takes a list of `tactic expr`s instead of `expr`s,
and evaluates these as thunks before trying to apply them.
We need to do this to avoid metavariables getting stuck during subsequent rounds of `apply`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_any
(lemmas : list expr)
(opt : apply_any_opt := {})
(tac : tactic unit := skip) : tactic unit | apply_any_thunk (lemmas.map pure) opt tac | def | tactic.apply_any | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `apply_any lemmas` tries to apply one of the list `lemmas` to the current goal.
`apply_any lemmas opt` allows control over how lemmas are applied.
`opt` has fields:
* `use_symmetry`: if no lemma applies, call `symmetry` and try again. (Defaults to `tt`.)
* `use_exfalso`: if no lemma applies, call `exfalso` and try aga... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_assumption : tactic unit | local_context >>= apply_any | def | tactic.apply_assumption | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Try to apply a hypothesis from the local context to the goal. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
change_core (e : expr) : option expr → tactic unit | | none := tactic.change e
| (some h) :=
do num_reverted : ℕ ← revert h,
expr.pi n bi d b ← target,
tactic.change $ expr.pi n bi e b,
intron num_reverted | def | tactic.change_core | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `change_core e none` is equivalent to `change e`. It tries to change the goal to `e` and fails
if this is not a definitional equality.
`change_core e (some h)` assumes `h` is a local constant, and tries to change the type of `h` to `e`
by reverting `h`, changing the goal, and reintroducing hypotheses. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
change_with_at (olde newe : pexpr) (hyp : name) : tactic unit | do h ← get_local hyp,
tp ← infer_type h,
olde ← to_expr olde, newe ← to_expr newe,
let repl_tp := tp.replace (λ a n, if a = olde then some newe else none),
when (repl_tp ≠ tp) $ change_core repl_tp (some h) | def | tactic.change_with_at | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `change_with_at olde newe hyp` replaces occurences of `olde` with `newe` at hypothesis `hyp`,
assuming `olde` and `newe` are defeq when elaborated. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
metavariables : tactic (list expr) | expr.list_meta_vars <$> result | def | tactic.metavariables | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"expr.list_meta_vars"
] | Returns a list of all metavariables in the current partial proof. This can differ from
the list of goals, since the goals can be manually edited. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
sorry_if_contains_sorry : tactic unit | do
g ← target,
guard g.contains_sorry <|> fail "goal does not contain `sorry`",
tactic.admit | def | tactic.sorry_if_contains_sorry | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `sorry_if_contains_sorry` will solve any goal already containing `sorry` in its type with `sorry`,
and fail otherwise. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
no_mvars_in_target : tactic unit | expr.has_meta_var <$> target >>= guardb ∘ bnot | def | tactic.no_mvars_in_target | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Fail if the target contains a metavariable. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
propositional_goal : tactic unit | do g :: _ ← get_goals,
is_proof g >>= guardb | def | tactic.propositional_goal | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Succeeds only if the current goal is a proposition. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
subsingleton_goal : tactic unit | do g :: _ ← get_goals,
ty ← infer_type g >>= instantiate_mvars,
to_expr ``(subsingleton %%ty) >>= mk_instance >> skip | def | tactic.subsingleton_goal | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Succeeds only if we can construct an instance showing the
current goal is a subsingleton type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
terminal_goal : tactic unit | propositional_goal <|> subsingleton_goal <|>
do g₀ :: _ ← get_goals,
mvars ← (λ L, list.erase L g₀) <$> metavariables,
mvars.mmap' $ λ g, do
t ← infer_type g >>= instantiate_mvars,
d ← kdepends_on t g₀,
monad.whenb d $
pp t >>= λ s, fail ("The current goal is not terminal: " ++ s.to_string +... | def | tactic.terminal_goal | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Succeeds only if the current goal is "terminal",
in the sense that no other goals depend on it
(except possibly through shared metavariables; see `independent_goal`). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
independent_goal : tactic unit | no_mvars_in_target >> terminal_goal | def | tactic.independent_goal | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Succeeds only if the current goal is "independent", in the sense
that no other goals depend on it, even through shared meta-variables. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
triv' : tactic unit | do c ← mk_const `trivial, exact c reducible | def | tactic.triv' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `triv'` tries to close the first goal with the proof `trivial : true`. Unlike `triv`,
it only unfolds reducible definitions, so it sometimes fails faster. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
iterate1 (t : tactic α) : tactic (list α) | do r ← decorate_ex "iterate1 failed: tactic did not succeed" t,
L ← iterate t,
return (r :: L) | def | tactic.iterate1 | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Apply a tactic as many times as possible, collecting the results in a list.
Fail if the tactic does not succeed at least once. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
check_target_changes (tac : tactic α) : tactic α | focus1 $ do
t ← target,
x ← tac,
gs ← get_goals >>= list.mmap infer_type,
(success_if_fail $ gs.mfirst $ unify t) <|> fail "Goal did not change",
pure x | def | tactic.check_target_changes | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | A simple check: `check_target_changes tac` applies tactic `tac` and fails if the main target
before applying the tactic `tac` unifies with one of the goals produced by the tactic itself.
Useful to make sure that the tactic `tac` is actually making progress. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
intros1 : tactic (list expr) | iterate1 intro1 | def | tactic.intros1 | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Introduces one or more variables and returns the new local constants.
Fails if `intro` cannot be applied. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
under_binders {α : Type} (t : tactic α) : tactic α | do
v ← intros,
r ← t,
revert_lst v,
return r | def | tactic.under_binders | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Run a tactic "under binders", by running `intros` before, and `revert` afterwards. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
under_binders (i : itactic) : itactic | tactic.under_binders i | def | tactic.interactive.under_binders | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [
"tactic.under_binders"
] | Run a tactic "under binders", by running `intros` before, and `revert` afterwards. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
successes (tactics : list (tactic α)) : tactic (list α) | list.filter_map id <$> monad.sequence (tactics.map (λ t, try_core t)) | def | tactic.successes | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `successes` invokes each tactic in turn, returning the list of successful results. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
try_all {α : Type} (tactics : list (tactic α)) : tactic (list α) | λ s, result.success
(tactics.map $
λ t : tactic α,
match t s with
| result.success a s' := [a]
| _ := []
end).join s | def | tactic.try_all | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
try_all_sorted {α : Type} (tactics : list (tactic α)) (sort_by : tactic ℕ := num_goals) :
tactic (list (α × ℕ)) | λ s, result.success
((tactics.map $
λ t : tactic α,
match (do a ← t, n ← sort_by, return (a, n)) s with
| result.success a s' := [a]
| _ := []
end).join.qsort (λ p q : α × ℕ, p.2 < q.2)) s | def | tactic.try_all_sorted | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Try all the tactics in a list, each time starting at the original `tactic_state`,
returning the list of successful results sorted by
the value produced by a subsequent execution of the `sort_by` tactic,
and reverting to the original `tactic_state`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
target' : tactic expr | target >>= instantiate_mvars >>= whnf | def | tactic.target' | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Return target after instantiating metavars and whnf. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fsplit : tactic unit | do [c] ← target' >>= get_constructors_for |
fail "fsplit tactic failed, target is not an inductive datatype with only one constructor",
mk_const c >>= λ e, apply e {new_goals := new_goals.all, auto_param := ff} >> skip | def | tactic.fsplit | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
injections_and_clear : tactic unit | do l ← local_context,
results ← successes $ l.map $ λ e, injection e >> clear e,
when (results.empty) (fail "could not use `injection` then `clear` on any hypothesis") | def | tactic.injections_and_clear | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Calls `injection` on each hypothesis, and then, for each hypothesis on which `injection`
succeeds, clears the old hypothesis. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
case_bash : tactic unit | do l ← local_context,
r ← successes (l.reverse.map (λ h, cases h >> skip)),
when (r.empty) failed | def | tactic.case_bash | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | Calls `cases` on every local hypothesis, succeeding if
it succeeds on at least one hypothesis. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
note_anon (t : option expr) (v : expr) : tactic expr | do h ← get_unused_name `h none,
note h t v | def | tactic.note_anon | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
find_local (t : pexpr) : tactic expr | do t' ← to_expr t,
(prod.snd <$> solve_aux t' assumption >>= instantiate_mvars) <|>
fail format!"No hypothesis found of the form: {t'}" | def | tactic.find_local | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `find_local t` returns a local constant with type t, or fails if none exists. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
dependent_pose_core (l : list (expr × expr)) : tactic unit | do
let lc := l.map prod.fst,
let lm := l.map (λ⟨l, v⟩, (l.local_uniq_name, v)),
old::other_goals ← get_goals,
t ← infer_type old,
new_goal ← mk_meta_var (t.pis lc),
set_goals (old :: new_goal :: other_goals),
exact ((new_goal.mk_app lc).instantiate_locals lm),
return () | def | tactic.dependent_pose_core | tactic | src/tactic/core.lean | [
"control.basic",
"data.dlist.basic",
"meta.expr",
"system.io",
"tactic.binder_matching",
"tactic.interactive_expr",
"tactic.lean_core_docs",
"tactic.project_dir"
] | [] | `dependent_pose_core l`: introduce dependent hypotheses, where the proofs depend on the values
of the previous local constants. `l` is a list of local constants and their values. | 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.