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 |
|---|---|---|---|---|---|---|---|---|---|---|
term_add_term {α} [add_comm_monoid α] (n₁ x a₁ n₂ a₂ n' a')
(h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') :
@term α _ n₁ x a₁ + @term α _ n₂ x a₂ = term n' x a' | by simp [h₁.symm, h₂.symm, term, add_nsmul]; ac_refl | theorem | tactic.abel.term_add_term | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_add_termg {α} [add_comm_group α] (n₁ x a₁ n₂ a₂ n' a')
(h₁ : n₁ + n₂ = n') (h₂ : a₁ + a₂ = a') :
@termg α _ n₁ x a₁ + @termg α _ n₂ x a₂ = termg n' x a' | by simp [h₁.symm, h₂.symm, termg, add_zsmul]; ac_refl | theorem | tactic.abel.term_add_termg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
zero_term {α} [add_comm_monoid α] (x a) : @term α _ 0 x a = a | by simp [term, zero_nsmul, one_nsmul] | theorem | tactic.abel.zero_term | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
zero_termg {α} [add_comm_group α] (x a) : @termg α _ 0 x a = a | by simp [termg] | theorem | tactic.abel.zero_termg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval_add (c : context) : normal_expr → normal_expr → tactic (normal_expr × expr) | | (zero _) e₂ := do
p ← mk_app ``zero_add [e₂],
return (e₂, p)
| e₁ (zero _) := do
p ← mk_app ``add_zero [e₁],
return (e₁, p)
| he₁@(nterm e₁ n₁ x₁ a₁) he₂@(nterm e₂ n₂ x₂ a₂) :=
(do
is_def_eq x₁ x₂ c.red,
(n', h₁) ← mk_app ``has_add.add [n₁.1, n₂.1] >>= norm_num.eval_field,
(a', h₂) ← eval_add a₁... | def | tactic.abel.eval_add | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"norm_num.eval_field"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_neg {α} [add_comm_group α] (n x a n' a')
(h₁ : -n = n') (h₂ : -a = a') :
-@termg α _ n x a = termg n' x a' | by simp [h₂.symm, h₁.symm, termg]; ac_refl | theorem | tactic.abel.term_neg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval_neg (c : context) : normal_expr → tactic (normal_expr × expr) | | (zero e) := do
p ← c.mk_app ``neg_zero ``neg_zero_class [],
return (zero' c, p)
| (nterm e n x a) := do
(n', h₁) ← mk_app ``has_neg.neg [n.1] >>= norm_num.eval_field,
(a', h₂) ← eval_neg a,
return (term' c (n', -n.2) x a',
c.app ``term_neg c.inst [n.1, x, a, n', a', h₁, h₂]) | def | tactic.abel.eval_neg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"neg_zero_class",
"norm_num.eval_field"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat_smul_inst {α} [add_comm_monoid α] : has_smul ℕ α | by apply_instance | def | tactic.abel.nat_smul_inst | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid",
"has_smul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
nat_smul_instg {α} [add_comm_group α] : has_smul ℕ α | by apply_instance | def | tactic.abel.nat_smul_instg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group",
"has_smul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_smul_instg {α} [add_comm_group α] : has_smul ℤ α | by apply_instance | def | tactic.abel.int_smul_instg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group",
"has_smul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
smul {α} [add_comm_monoid α] (n : ℕ) (x : α) : α | n • x | def | tactic.abel.smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
smulg {α} [add_comm_group α] (n : ℤ) (x : α) : α | n • x | def | tactic.abel.smulg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
zero_smul {α} [add_comm_monoid α] (c) : smul c (0 : α) = 0 | by simp [smul, nsmul_zero] | theorem | tactic.abel.zero_smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid",
"zero_smul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
zero_smulg {α} [add_comm_group α] (c) : smulg c (0 : α) = 0 | by simp [smulg, zsmul_zero] | theorem | tactic.abel.zero_smulg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_smul {α} [add_comm_monoid α] (c n x a n' a')
(h₁ : c * n = n') (h₂ : smul c a = a') :
smul c (@term α _ n x a) = term n' x a' | by simp [h₂.symm, h₁.symm, term, smul, nsmul_add, mul_nsmul] | theorem | tactic.abel.term_smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_smulg {α} [add_comm_group α] (c n x a n' a')
(h₁ : c * n = n') (h₂ : smulg c a = a') :
smulg c (@termg α _ n x a) = termg n' x a' | by simp [h₂.symm, h₁.symm, termg, smulg, zsmul_add, mul_zsmul] | theorem | tactic.abel.term_smulg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval_smul (c : context) (k : expr × ℤ) :
normal_expr → tactic (normal_expr × expr) | | (zero _) := return (zero' c, c.iapp ``zero_smul [k.1])
| (nterm e n x a) := do
(n', h₁) ← mk_app ``has_mul.mul [k.1, n.1] >>= norm_num.eval_field,
(a', h₂) ← eval_smul a,
return (term' c (n', k.2 * n.2) x a',
c.iapp ``term_smul [k.1, n.1, x, a, n', a', h₁, h₂]) | def | tactic.abel.eval_smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"norm_num.eval_field",
"zero_smul"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_atom {α} [add_comm_monoid α] (x : α) : x = term 1 x 0 | by simp [term] | theorem | tactic.abel.term_atom | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
term_atomg {α} [add_comm_group α] (x : α) : x = termg 1 x 0 | by simp [termg] | theorem | tactic.abel.term_atomg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval_atom (c : context) (e : expr) : tactic (normal_expr × expr) | do n1 ← c.int_to_expr 1,
return (term' c (n1, 1) e (zero' c), c.iapp ``term_atom [e]) | def | tactic.abel.eval_atom | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unfold_sub {α} [subtraction_monoid α] (a b c : α) (h : a + -b = c) : a - b = c | by rw [sub_eq_add_neg, h] | lemma | tactic.abel.unfold_sub | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"subtraction_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unfold_smul {α} [add_comm_monoid α] (n) (x y : α)
(h : smul n x = y) : n • x = y | h | theorem | tactic.abel.unfold_smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unfold_smulg {α} [add_comm_group α] (n : ℕ) (x y : α)
(h : smulg (int.of_nat n) x = y) : (n : ℤ) • x = y | h | theorem | tactic.abel.unfold_smulg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
unfold_zsmul {α} [add_comm_group α] (n : ℤ) (x y : α)
(h : smulg n x = y) : n • x = y | h | theorem | tactic.abel.unfold_zsmul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
subst_into_smul {α} [add_comm_monoid α]
(l r tl tr t) (prl : l = tl) (prr : r = tr)
(prt : @smul α _ tl tr = t) : smul l r = t | by simp [prl, prr, prt] | lemma | tactic.abel.subst_into_smul | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_monoid"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
subst_into_smulg {α} [add_comm_group α]
(l r tl tr t) (prl : l = tl) (prr : r = tr)
(prt : @smulg α _ tl tr = t) : smulg l r = t | by simp [prl, prr, prt] | lemma | tactic.abel.subst_into_smulg | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
subst_into_smul_upcast {α} [add_comm_group α]
(l r tl zl tr t) (prl₁ : l = tl) (prl₂ : ↑tl = zl) (prr : r = tr)
(prt : @smulg α _ zl tr = t) : smul l r = t | by simp [← prt, prl₁, ← prl₂, prr, smul, smulg] | lemma | tactic.abel.subst_into_smul_upcast | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"add_comm_group"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval_smul' (c : context) (eval : expr → tactic (normal_expr × expr))
(is_smulg : bool) (orig e₁ e₂ : expr) : tactic (normal_expr × expr) | do (e₁', p₁) ← norm_num.derive e₁ <|> refl_conv e₁,
match if is_smulg then e₁'.to_int else coe <$> e₁'.to_nat with
| some n := do
(e₂', p₂) ← eval e₂,
if c.is_group = is_smulg then do
(e', p) ← eval_smul c (e₁', n) e₂',
return (e', c.iapp ``subst_into_smul [e₁, e₂, e₁', e₂', e', p₁, p₂, p])
... | def | tactic.abel.eval_smul' | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"norm_num.derive",
"norm_num.prove_nat_uncast"
] | Normalize a term `orig` of the form `smul e₁ e₂` or `smulg e₁ e₂`.
Normalized terms use `smul` for monoids and `smulg` for groups,
so there are actually four cases to handle:
* Using `smul` in a monoid just simplifies the pieces using `subst_into_smul`
* Using `smulg` in a group just simplifies the pieces using... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eval (c : context) : expr → tactic (normal_expr × expr) | | `(%%e₁ + %%e₂) := do
(e₁', p₁) ← eval e₁,
(e₂', p₂) ← eval e₂,
(e', p') ← eval_add c e₁' e₂',
p ← c.mk_app ``norm_num.subst_into_add ``has_add [e₁, e₂, e₁', e₂', e', p₁, p₂, p'],
return (e', p)
| `(%%e₁ - %%e₂) := do
e₂' ← mk_app ``has_neg.neg [e₂],
e ← mk_app ``has_add.add [e₁, e₂'],
(e', p) ← eval e... | def | tactic.abel.eval | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"norm_num.subst_into_add",
"norm_num.subst_into_neg",
"subtraction_monoid",
"succeeds"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
eval' (c : context) (e : expr) : tactic (expr × expr) | do (e', p) ← eval c e, return (e', p) | def | tactic.abel.eval' | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
normalize_mode | raw | term | inductive | tactic.abel.normalize_mode | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | ||
normalize (red : transparency) (mode := normalize_mode.term) (e : expr) :
tactic (expr × expr) | do
pow_lemma ← simp_lemmas.mk.add_simp ``pow_one,
let lemmas := match mode with
| normalize_mode.term :=
[``term.equations._eqn_1, ``termg.equations._eqn_1, ``add_zero, ``one_nsmul, ``one_zsmul,
``zsmul_zero]
| _ := []
end,
lemmas ← lemmas.mfoldl simp_lemmas.add_simp simp_lemmas.mk,
(_, e', pr) ← ext_simplify_cor... | def | tactic.abel.normalize | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"normalize",
"pow_one"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
abel1 (red : parse (tk "!")?) : tactic unit | do `(%%e₁ = %%e₂) ← target,
c ← mk_context (if red.is_some then semireducible else reducible) e₁,
(e₁', p₁) ← eval c e₁,
(e₂', p₂) ← eval c e₂,
is_def_eq e₁' e₂',
p ← mk_eq_symm p₂ >>= mk_eq_trans p₁,
tactic.exact p | def | interactive.abel1 | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [] | Tactic for solving equations in the language of
*additive*, commutative monoids and groups.
This version of `abel` fails if the target is not an equality
that is provable by the axioms of commutative monoids/groups.
`abel1!` will use a more aggressive reducibility setting to identify atoms.
This can prove goals that `... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
abel.mode : lean.parser abel.normalize_mode | with_desc "(raw|term)?" $
do mode ← ident?, match mode with
| none := return abel.normalize_mode.term
| some `term := return abel.normalize_mode.term
| some `raw := return abel.normalize_mode.raw
| _ := failed
end | def | interactive.abel.mode | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
abel (red : parse (tk "!")?) (SOP : parse abel.mode) (loc : parse location) :
tactic unit | match loc with
| interactive.loc.ns [none] := abel1 red
| _ := failed
end <|>
do ns ← loc.get_locals,
let red := if red.is_some then semireducible else reducible,
tt ← tactic.replace_at (normalize red SOP) ns loc.include_goal
| fail "abel failed to simplify",
when loc.include_goal $ try tactic.reflexivit... | def | interactive.abel | tactic | src/tactic/abel.lean | [
"tactic.norm_num"
] | [
"normalize",
"tactic.replace_at"
] | Evaluate expressions in the language of *additive*, commutative monoids and groups.
It attempts to prove the goal outright if there is no `at`
specifier and the target is an equality, but if this
fails, it falls back to rewriting all monoid expressions into a normal form.
If there is an `at` specifier, it rewrites the ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reflect_name_list : has_reflect (list name) | ns | `(id %%(expr.mk_app `(Prop) $ ns.map (flip expr.const [])) : list name) | def | tactic.reflect_name_list | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [
"reflect_name_list"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
parse_name_list (e : expr) : list name | e.app_arg.get_app_args.map expr.const_name | def | tactic.parse_name_list | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [
"parse_name_list"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ancestor_attr : user_attribute unit (list name) | { name := `ancestor,
descr := "ancestor of old structures",
parser := many ident } | def | tactic.ancestor_attr | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [] | The `ancestor` attributes is used to record the names of structures which appear in the
extends clause of a `structure` or `class` declared with `old_structure_cmd` set to true.
As an example:
```
set_option old_structure_cmd true
structure base_one := (one : ℕ)
structure base_two (α : Type*) := (two : ℕ)
@[ancesto... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_tagged_ancestors (cl : name) : tactic (list name) | parse_name_list <$> ancestor_attr.get_param_untyped cl <|> pure [] | def | tactic.get_tagged_ancestors | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [
"parse_name_list"
] | Returns the parents of a structure added via the `ancestor` attribute.
On failure, the empty list is returned. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_ancestors (cl : name) : tactic (list name) | (++) <$> (prod.fst <$> subobject_names cl <|> pure [])
<*> get_tagged_ancestors cl | def | tactic.get_ancestors | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [] | Returns the parents of a structure added via the `ancestor` attribute, as well as subobjects.
On failure, the empty list is returned. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
find_ancestors : name → expr → tactic (list expr) | cl arg | do cs ← get_ancestors cl,
r ← cs.mmap $ λ c, list.ret <$> (mk_app c [arg] >>= mk_instance) <|> find_ancestors c arg,
return r.join | def | tactic.find_ancestors | tactic | src/tactic/algebra.lean | [
"tactic.core"
] | [] | Returns the (transitive) ancestors of a structure added via the `ancestor`
attribute (or reachable via subobjects).
On failure, the empty list is returned. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
target
| plain : name → target
| forward : name → target
| backwards : name → target | inductive | tactic.alias.target | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | An alias can be in one of three forms | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
target.to_name : target → name | | (target.plain n) := n
| (target.forward n) := n
| (target.backwards n) := n | def | tactic.alias.target.to_name | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | The name underlying an alias target | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
target.to_string : target → string | | (target.plain n) := sformat!"**Alias** of `{n}`."
| (target.forward n) := sformat!"**Alias** of the forward direction of `{n}`."
| (target.backwards n) := sformat!"**Alias** of the reverse direction of `{n}`." | def | tactic.alias.target.to_string | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | The docstring for an alias. Used by `alias` _and_ by `to_additive` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
alias_attr : user_attribute unit target | { name := `alias, descr := "This definition is an alias of another.", parser := failed } | def | tactic.alias.alias_attr | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | An auxiliary attribute which is placed on definitions created by the `alias` command. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
alias_direct (doc : option string) (d : declaration) (al : name) : tactic unit | do updateex_env $ λ env,
env.add (match d.to_definition with
| declaration.defn n ls t _ _ _ :=
declaration.defn al ls t (expr.const n (level.param <$> ls))
reducibility_hints.abbrev tt
| declaration.thm n ls t _ :=
declaration.thm al ls t $ task.pure $ expr.const n (level.param <$> ls)
| _ := und... | def | tactic.alias.alias_direct | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | The core tactic which handles `alias d ← al`. Creates an alias `al` for declaration `d`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_iff_mp_app (iffmp : name) : expr → (ℕ → expr) → tactic 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 := pure $ @expr.const tt iffmp [] a b (f 0)
| _ f := fail "Target theorem must have the form `Π x y z, a ↔ b`" | def | tactic.alias.mk_iff_mp_app | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | Given a proof of `Π x y z, a ↔ b`, produces a proof of `Π x y z, a → b` or `Π x y z, b → a`
(depending on whether `iffmp` is `iff.mp` or `iff.mpr`). The variable `f` supplies the proof,
under the specified number of binders. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
alias_iff (doc : option string)
(d : declaration) (ns al : name) (is_forward : bool) : tactic unit | if al = `_ then skip else
let al := ns.append_namespace al in
(get_decl al >> skip) <|> do
let ls := d.univ_params,
let t := d.type,
let target := if is_forward then target.forward d.to_name else target.backwards d.to_name,
let iffmp := if is_forward then `iff.mp else `iff.mpr,
v ← mk_iff_mp_app... | def | tactic.alias.alias_iff | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | The core tactic which handles `alias d ↔ al _` or `alias d ↔ _ al`. `ns` is the current
namespace, and `is_forward` is true if this is the forward implication (the first form). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
make_left_right : name → tactic (name × name) | | (name.mk_string s p) := do
let buf : char_buffer := s.to_char_buffer,
let parts := s.split_on '_',
(left, _::right) ← pure $ parts.span (≠ "iff"),
let pfx (a b : string) := a.to_list.is_prefix_of b.to_list,
(suffix', right') ← pure $ right.reverse.span (λ s, pfx "left" s ∨ pfx "right" s),
let right := rig... | def | tactic.alias.make_left_right | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | Get the default names for left/right to be used by `alias d ↔ ..`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
alias_cmd (meta_info : decl_meta_info)
(_ : parse $ tk "alias") : lean.parser unit | do old ← ident,
d ← (do old ← resolve_constant old, get_decl old) <|>
fail ("declaration " ++ to_string old ++ " not found"),
ns ← get_current_namespace,
let doc := meta_info.doc_string,
do
{ tk "←" <|> tk "<-",
aliases ← many ident,
↑(aliases.mmap' $ λ al, alias_direct doc d (ns.append_namespace ... | def | tactic.alias.alias_cmd | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | The `alias` command can be used to create copies
of a theorem or definition with different names.
Syntax:
```lean
/-- doc string -/
alias my_theorem ← alias1 alias2 ...
```
This produces defs or theorems of the form:
```lean
/-- doc string -/
@[alias] theorem alias1 : <type of my_theorem> := my_theorem
/-- doc str... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_alias_target (n : name) : tactic (option target) | do tt ← has_attribute' `alias n | pure none,
v ← alias_attr.get_param n,
pure $ some v | def | tactic.alias.get_alias_target | tactic | src/tactic/alias.lean | [
"tactic.core"
] | [] | Given a definition, look up the definition that it is an alias of.
Returns `none` if this defintion is not an alias. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reorder_goals {α} (gs : list (bool × α)) : new_goals → list α | | new_goals.non_dep_first :=
let ⟨dep,non_dep⟩ := gs.partition (coe ∘ prod.fst) in
non_dep.map prod.snd ++ dep.map prod.snd
| new_goals.non_dep_only := (gs.filter (coe ∘ bnot ∘ prod.fst)).map prod.snd
| new_goals.all := gs.map prod.snd | def | tactic.reorder_goals | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | With `gs` a list of proof goals, `reorder_goals gs new_g` will use the `new_goals` policy
`new_g` to rearrange the dependent goals to either drop them, push them to the end of the list
or leave them in place. The `bool` values in `gs` indicates whether the goal is dependent or not. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
has_opt_auto_param_inst_for_apply (ms : list (name × expr)) : tactic bool | ms.mfoldl
(λ r m, do type ← infer_type m.2,
b ← is_class type,
return $ r || type.is_napp_of `opt_param 2 || type.is_napp_of `auto_param 2 || b)
ff | def | tactic.has_opt_auto_param_inst_for_apply | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
try_apply_opt_auto_param_instance_for_apply (cfg : apply_cfg)
(ms : list (name × expr)) : tactic unit | mwhen (has_opt_auto_param_inst_for_apply ms) $ do
gs ← get_goals,
ms.mmap' (λ m, mwhen (bnot <$> (is_assigned m.2)) $
set_goals [m.2] >>
try apply_instance >>
when cfg.opt_param (try apply_opt_param) >>
when cfg.auto_param (try apply_auto_p... | def | tactic.try_apply_opt_auto_param_instance_for_apply | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
retry_apply_aux :
Π (e : expr) (cfg : apply_cfg), list (bool × name × expr) → tactic (list (name × expr)) | | e cfg gs :=
focus1 (do
{ tgt : expr ← target, t ← infer_type e,
unify t tgt,
exact e,
gs' ← get_goals,
let r := reorder_goals gs.reverse cfg.new_goals,
set_goals (gs' ++ r.map prod.snd),
return r }) <|>
do (expr.pi n bi d b) ← infer_type e >>= whnf | apply_core e cfg,
v ← mk_meta_v... | def | tactic.retry_apply_aux | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
retry_apply (e : expr) (cfg : apply_cfg) : tactic (list (name × expr)) | apply_core e cfg <|> retry_apply_aux e cfg [] | def | tactic.retry_apply | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
apply' (e : expr) (cfg : apply_cfg := {}) : tactic (list (name × expr)) | do r ← retry_apply e cfg,
try_apply_opt_auto_param_instance_for_apply cfg r,
return r | def | tactic.apply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | `apply'` mimics the behavior of `apply_core`. When
`apply_core` fails, it is retried by providing the term with meta
variables as additional arguments. The meta variables can then
become new goals depending on the `cfg.new_goals` policy.
`apply'` also finds instances and applies opt_params and auto_params. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fapply' (e : expr) : tactic (list (name × expr)) | apply' e {new_goals := new_goals.all} | def | tactic.fapply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | Same as `apply'` but __all__ arguments that weren't inferred are added to goal list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eapply' (e : expr) : tactic (list (name × expr)) | apply' e {new_goals := new_goals.non_dep_only} | def | tactic.eapply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | Same as `apply'` but only goals that don't depend on other goals are added to goal list. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
relation_tactic (md : transparency) (op_for : environment → name → option name)
(tac_name : string) : tactic unit | do tgt ← target >>= instantiate_mvars,
env ← get_env,
let r := expr.get_app_fn tgt,
match op_for env (expr.const_name r) with
| (some refl) := do r ← mk_const refl,
retry_apply r {md := md, new_goals := new_goals.non_dep_only },
return ()
| none :=... | def | tactic.relation_tactic | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | `relation_tactic` finds a proof rule for the relation found in the goal and uses `apply'`
to make one proof step. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reflexivity' (md := semireducible) : tactic unit | relation_tactic md environment.refl_for "reflexivity" | def | tactic.reflexivity' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | Similar to `reflexivity` with the difference that `apply'` is used instead of `apply` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
symmetry' (md := semireducible) : tactic unit | relation_tactic md environment.symm_for "symmetry" | def | tactic.symmetry' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | Similar to `symmetry` with the difference that `apply'` is used instead of `apply` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
transitivity' (md := semireducible) : tactic unit | relation_tactic md environment.trans_for "transitivity" | def | tactic.transitivity' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [] | Similar to `transitivity` with the difference that `apply'` is used instead of `apply` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply' (q : parse texpr) : tactic unit | concat_tags (do h ← i_to_expr_for_apply q, tactic.apply' h) | def | tactic.interactive.apply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.apply'"
] | Similarly to `apply`, the `apply'` tactic tries to match the current goal against the conclusion
of the type of term.
It differs from `apply` in that it does not unfold definition in order to find out what the
assumptions of the provided term is. It is especially useful when defining relations on function
spaces (e.g.... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
fapply' (q : parse texpr) : tactic unit | concat_tags (i_to_expr_for_apply q >>= tactic.fapply') | def | tactic.interactive.fapply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.fapply'"
] | Similar to the `apply'` tactic, but does not reorder goals. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
eapply' (q : parse texpr) : tactic unit | concat_tags (i_to_expr_for_apply q >>= tactic.eapply') | def | tactic.interactive.eapply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.eapply'"
] | Similar to the `apply'` tactic, but only creates subgoals for non-dependent premises that have not
been fixed by type inference or type class resolution. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_with' (q : parse parser.pexpr) (cfg : apply_cfg) : tactic unit | concat_tags (do e ← i_to_expr_for_apply q, tactic.apply' e cfg) | def | tactic.interactive.apply_with' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.apply'"
] | Similar to the `apply'` tactic, but allows the user to provide a `apply_cfg` configuration object. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mapply' (q : parse texpr) : tactic unit | concat_tags (do e ← i_to_expr_for_apply q, tactic.apply' e {unify := ff}) | def | tactic.interactive.mapply' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.apply'"
] | Similar to the `apply'` tactic, but uses matching instead of unification.
`mapply' t` is equivalent to `apply_with' t {unify := ff}` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
reflexivity' : tactic unit | tactic.reflexivity' | def | tactic.interactive.reflexivity' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.reflexivity'"
] | Similar to `reflexivity` with the difference that `apply'` is used instead of `apply`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
refl' : tactic unit | tactic.reflexivity' | def | tactic.interactive.refl' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.reflexivity'"
] | Shorter name for the tactic `reflexivity'`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
symmetry' : parse location → tactic unit | | l@loc.wildcard := l.try_apply symmetry_hyp tactic.symmetry'
| (loc.ns hs) := (loc.ns hs.reverse).apply symmetry_hyp tactic.symmetry' | def | tactic.interactive.symmetry' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.symmetry'"
] | `symmetry'` behaves like `symmetry` but also offers the option `symmetry' at h` to apply symmetry
to assumption `h` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
transitivity' (q : parse texpr?) : tactic unit | tactic.transitivity' >> match q with
| none := skip
| some q :=
do (r, lhs, rhs) ← target_lhs_rhs,
t ← infer_type lhs,
i_to_expr ``(%%q : %%t) >>= unify rhs
end | def | tactic.interactive.transitivity' | tactic | src/tactic/apply.lean | [
"tactic.core"
] | [
"tactic.transitivity'"
] | Similar to `transitivity` with the difference that `apply'` is used instead of `apply`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_fun_to_hyp (e : pexpr) (mono_lem : option pexpr) (hyp : expr) : tactic unit | do
{ t ← infer_type hyp >>= instantiate_mvars,
prf ← match t with
| `(%%l = %%r) := do
ltp ← infer_type l,
mv ← mk_mvar,
to_expr ``(congr_arg (%%e : %%ltp → %%mv) %%hyp)
| `(%%l ≤ %%r) := do
Hmono ← match mono_lem with
| some mono_lem :=
tactic.i_to_expr mono_lem
... | def | tactic.apply_fun_to_hyp | tactic | src/tactic/apply_fun.lean | [
"tactic.monotonicity"
] | [] | Apply the function `f` given by `e : pexpr` to the local hypothesis `hyp`, which must either be
of the form `a = b` or `a ≤ b`, replacing the type of `hyp` with `f a = f b` or `f a ≤ f b`. If
`hyp` names an inequality then a new goal `monotone f` is created, unless the name of a proof of
this fact is passed as the opti... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_fun_to_goal (e : pexpr) (lem : option pexpr) : tactic unit | do t ← target,
match t with
| `(%%l ≠ %%r) := to_expr ``(ne_of_apply_ne %%e) >>= apply >> skip
| `(¬%%l = %%r) := to_expr ``(ne_of_apply_ne %%e) >>= apply >> skip
| `(%%l ≤ %%r) := to_expr ``((order_iso.le_iff_le %%e).mp) >>= apply >> skip
| `(%%l < %%r) := to_expr ``((order_iso.lt_iff_lt %%e).mp) >>= apply >... | def | tactic.apply_fun_to_goal | tactic | src/tactic/apply_fun.lean | [
"tactic.monotonicity"
] | [] | Attempt to "apply" a function `f` represented by the argument `e : pexpr` to the goal.
If the goal is of the form `a ≠ b`, we obtain the new goal `f a ≠ f b`.
If the goal is of the form `a = b`, we obtain a new goal `f a = f b`, and a subsidiary goal
`injective f`.
(We attempt to discharge this subsidiary goal automat... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
apply_fun (q : parse texpr) (locs : parse location) (lem : parse (tk "using" *> texpr)?)
: tactic unit | locs.apply (apply_fun_to_hyp q lem) (apply_fun_to_goal q lem) | def | tactic.interactive.apply_fun | tactic | src/tactic/apply_fun.lean | [
"tactic.monotonicity"
] | [] | Apply a function to an equality or inequality in either a local hypothesis or the goal.
* If we have `h : a = b`, then `apply_fun f at h` will replace this with `h : f a = f b`.
* If we have `h : a ≤ b`, then `apply_fun f at h` will replace this with `h : f a ≤ f b`,
and create a subsidiary goal `monotone f`.
`app... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_exists (_ : parse $ tk "assert_exists") : lean.parser unit | do decl ← ident,
d ← get_decl decl,
return () | def | assert_exists | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [] | `assert_exists n` is a user command that asserts that a declaration named `n` exists
in the current import scope.
Be careful to use names (e.g. `rat`) rather than notations (e.g. `ℚ`). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_not_exists (_ : parse $ tk "assert_not_exists") : lean.parser unit | do
decl ← ident,
ff ← succeeds (get_decl decl) |
fail format!"Declaration {decl} is not allowed to exist in this file.",
n ← tactic.mk_fresh_name,
let marker := (`assert_not_exists._checked).append (decl.append n),
add_decl
(declaration.defn marker [] `(name) `(decl) default tt),
pure () | def | assert_not_exists | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [
"succeeds"
] | `assert_not_exists n` is a user command that asserts that a declaration named `n` *does not exist*
in the current import scope.
Be careful to use names (e.g. `rat`) rather than notations (e.g. `ℚ`).
It may be used (sparingly!) in mathlib to enforce plans that certain files
are independent of each other.
If you encou... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_not_exists.linter : linter | { test := λ d, (do
let n := d.to_name,
tt ← pure ((`assert_not_exists._checked).is_prefix_of n) | pure none,
declaration.defn _ _ `(name) val _ _ ← pure d,
n ← tactic.eval_expr name val,
tt ← succeeds (get_decl n) | pure (some (format!"`{n}` does not ever exist").to_string),
pure none),
auto_d... | def | assert_not_exists.linter | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [
"linter",
"succeeds"
] | A linter for checking that the declarations marked `assert_not_exists` eventually exist. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_instance (_ : parse $ tk "assert_instance") : lean.parser unit | do q ← texpr,
e ← i_to_expr q,
mk_instance e,
return () | def | assert_instance | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [] | `assert_instance e` is a user command that asserts that an instance `e` is available
in the current import scope.
Example usage:
```
assert_instance semiring ℕ
``` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_no_instance (_ : parse $ tk "assert_no_instance") : lean.parser unit | do
q ← texpr,
e ← i_to_expr q,
i ← try_core (mk_instance e),
match i with
| none := do
n ← tactic.mk_fresh_name,
e_str ← to_string <$> pp e,
let marker := ((`assert_no_instance._checked).mk_string e_str).append n,
et ← infer_type e,
tt ← succeeds (get_decl marker) |
add_dec... | def | assert_no_instance | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [
"succeeds"
] | `assert_no_instance e` is a user command that asserts that an instance `e` *is not available*
in the current import scope.
It may be used (sparingly!) in mathlib to enforce plans that certain files
are independent of each other.
If you encounter an error on an `assert_no_instance` command while developing mathlib,
it... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
assert_no_instance.linter : linter | { test := λ d, (do
let n := d.to_name,
tt ← pure ((`assert_no_instance._checked).is_prefix_of n) | pure none,
declaration.defn _ _ _ val _ _ ← pure d,
tt ← succeeds (tactic.mk_instance val)
| (some ∘ format.to_string) <$> pformat!"No instance of `{val}`",
pure none),
auto_decls := tt,
no_e... | def | assert_no_instance.linter | tactic | src/tactic/assert_exists.lean | [
"tactic.core",
"tactic.lint.basic"
] | [
"linter",
"succeeds"
] | A linter for checking that the declarations marked `assert_no_instance` eventually exist. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
auto_cases_tac | (name : string)
{α : Type}
(tac : expr → tactic α) | structure | tactic.auto_cases.auto_cases_tac | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [] | Structure representing a tactic which can be used by `tactic.auto_cases`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tac_cases : auto_cases_tac | ⟨"cases", cases⟩ | def | tactic.auto_cases.tac_cases | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [] | The `auto_cases_tac` for `tactic.cases`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tac_induction : auto_cases_tac | ⟨"induction", induction⟩ | def | tactic.auto_cases.tac_induction | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [] | The `auto_cases_tac` for `tactic.induction`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
find_tac : expr → option auto_cases_tac | | `(empty) := tac_cases
| `(pempty) := tac_cases
| `(false) := tac_cases
| `(unit) := tac_cases
| `(punit) := tac_cases
| `(ulift _) := tac_cases
| `(plift _) := tac_cases
| `(prod _ _) := tac_cases
| `(and _ _) := tac_cases
| `(sigma _) := tac_cases
| `(psigma _) := tac_cases
| `(subtype ... | def | tactic.auto_cases.find_tac | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [] | Find an `auto_cases_tac` which matches the given `type : expr`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
auto_cases_at (find : expr → option auto_cases.auto_cases_tac) (hyp : expr) :
tactic string | do t ← infer_type hyp >>= whnf,
match find t with
| some atac := do
atac.tac hyp,
pp ← pp hyp,
return sformat!"{atac.name} {pp}"
| none := fail "hypothesis type unsupported"
end | def | tactic.auto_cases_at | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [] | Applies `cases` or `induction` on the local_hypothesis `hyp : expr`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
auto_cases (find := tactic.auto_cases.find_tac) : tactic string | do l ← local_context,
results ← successes $ l.reverse.map (auto_cases_at find),
when (results.empty) $
fail "`auto_cases` did not find any hypotheses to apply `cases` or `induction` to",
return (string.intercalate ", " results) | def | tactic.auto_cases | tactic | src/tactic/auto_cases.lean | [
"tactic.hint"
] | [
"tactic.auto_cases.find_tac"
] | Applies `cases` or `induction` on certain hypotheses. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_binder (do_whnf : option (transparency × bool))
(pi_or_lambda : bool) (e : expr) :
tactic (option (name × binder_info × expr × expr)) | do
e ← do_whnf.elim (pure e) (λ p, whnf e p.1 p.2),
pure $ if pi_or_lambda then match_pi e else match_lam e | def | tactic.get_binder | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `get_binder do_whnf pi_or_lambda e` matches `e` of the form `λ x, e'` or
`Π x, e`. Returns information about the leading binder (its name, `binder_info`,
type and body), or `none` if `e` does not start with a binder.
If `do_whnf = some (md, unfold_ginductive)`, then `e` is weak head normalised
with transparency `md` b... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mk_binder_replacement (local_or_meta : bool) (b : binder) :
tactic expr | if local_or_meta then mk_local' b.name b.info b.type else mk_meta_var b.type | def | tactic.mk_binder_replacement | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [
"binder"
] | `mk_binder_replacement local_or_meta b` creates an expression that can be used
to replace the binder `b`. If `local_or_meta` is true, we create a fresh local
constant with `b`'s display name, `binder_info` and type; otherwise a fresh
metavariable with `b`'s type. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_binders (do_whnf : option (transparency × bool))
(pis_or_lambdas : bool) (locals_or_metas : bool) :
expr → tactic (list expr × expr) | λ e, do
some (name, bi, type, body) ← get_binder do_whnf pis_or_lambdas e
| pure ([], e),
replacement ← mk_binder_replacement locals_or_metas ⟨name, bi, type⟩,
(rs, rest) ← open_binders (body.instantiate_var replacement),
pure (replacement :: rs, rest) | def | tactic.open_binders | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_binders` is a generalisation of functions like `open_pis`,
`mk_meta_lambdas` etc. `open_binders do_whnf pis_or_lamdas local_or_metas e`
proceeds as follows:
- Match a leading λ or Π binder using `get_binder do_whnf pis_or_lambdas`.
See `get_binder` for details. Return `e` unchanged (and an empty list) if
`e`... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_n_binders (do_whnf : option (transparency × bool))
(pis_or_lambdas : bool) (locals_or_metas : bool) :
expr → ℕ → tactic (list expr × expr) | | e 0 := pure ([], e)
| e (d + 1) := do
some (name, bi, type, body) ← get_binder do_whnf pis_or_lambdas e | failed,
replacement ← mk_binder_replacement locals_or_metas ⟨name, bi, type⟩,
(rs, rest) ← open_n_binders (body.instantiate_var replacement) d,
pure (replacement :: rs, rest) | def | tactic.open_n_binders | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_n_binders do_whnf pis_or_lambdas local_or_metas e n` is like
`open_binders do_whnf pis_or_lambdas local_or_metas e`, but it matches exactly `n`
leading Π/λ binders of `e`. If `e` does not start with at least `n` Π/λ binders,
(after normalisation, if `do_whnf` is given), the tactic fails. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_pis : expr → tactic (list expr × expr) | mk_local_pis | abbreviation | tactic.open_pis | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_pis e` instantiates all leading Π binders of `e` with fresh local
constants. Returns the local constants and the remainder of `e`. This is an
alias for `tactic.mk_local_pis`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_pis_metas : expr → tactic (list expr × expr) | open_binders none tt ff | def | tactic.open_pis_metas | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_pis_metas e` instantiates all leading Π binders of `e` with fresh
metavariables. Returns the metavariables and the remainder of `e`. This is
`open_pis` but with metavariables instead of local constants. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_n_pis : expr → ℕ → tactic (list expr × expr) | open_n_binders none tt tt | def | tactic.open_n_pis | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_n_pis e n` instantiates the first `n` Π binders of `e` with fresh local
constants. Returns the local constants and the remainder of `e`. Fails if
`e` does not start with at least `n` Π binders. This is `open_pis` but limited
to `n` binders. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_n_pis_metas : expr → ℕ → tactic (list expr × expr) | open_n_binders none tt ff | def | tactic.open_n_pis_metas | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_n_pis_metas e n` instantiates the first `n` Π binders of `e` with fresh
metavariables. Returns the metavariables and the remainder of `e`. This is
`open_n_pis` but with metavariables instead of local constants. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_pis_whnf (e : expr) (md := semireducible)
(unfold_ginductive := tt) : tactic (list expr × expr) | open_binders (some (md, unfold_ginductive)) tt tt e | def | tactic.open_pis_whnf | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_pis_whnf e md unfold_ginductive` instantiates all leading Π binders of `e`
with fresh local constants. The leading Π binders of `e` are matched up to
normalisation with transparency `md`. `unfold_ginductive` determines whether
constructors of generalised inductive types are unfolded during normalisation.
This is ... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_pis_metas_whnf (e : expr) (md := semireducible)
(unfold_ginductive := tt) : tactic (list expr × expr) | open_binders (some (md, unfold_ginductive)) tt ff e | def | tactic.open_pis_metas_whnf | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_pis_metas_whnf e md unfold_ginductive` instantiates all leading Π binders
of `e` with fresh metavariables. The leading Π binders of `e` are matched up to
normalisation with transparency `md`. `unfold_ginductive` determines whether
constructors of generalised inductive types are unfolded during normalisation.
This... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_n_pis_whnf (e : expr) (n : ℕ) (md := semireducible)
(unfold_ginductive := tt) : tactic (list expr × expr) | open_n_binders (some (md, unfold_ginductive)) tt tt e n | def | tactic.open_n_pis_whnf | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_n_pis_whnf e n md unfold_ginductive` instantiates the first `n` Π binders
of `e` with fresh local constants. The leading Π binders of `e` are matched up
to normalisation with transparency `md`. `unfold_ginductive` determines whether
constructors of generalised inductive types are unfolded during normalisation.
Th... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
open_n_pis_metas_whnf (e : expr) (n : ℕ) (md := semireducible)
(unfold_ginductive := tt) : tactic (list expr × expr) | open_n_binders (some (md, unfold_ginductive)) tt ff e n | def | tactic.open_n_pis_metas_whnf | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [] | `open_n_pis_metas_whnf e n md unfold_ginductive` instantiates the first `n` Π
binders of `e` with fresh metavariables. The leading Π binders of `e` are
matched up to normalisation with transparency `md`. `unfold_ginductive`
determines whether constructors of generalised inductive types are unfolded
during normalisation... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
get_pi_binders (e : expr) : tactic (list binder × expr) | do
(lcs, rest) ← open_pis e,
pure (lcs.map to_binder, rest) | def | tactic.get_pi_binders | tactic | src/tactic/binder_matching.lean | [
"data.option.defs",
"meta.expr"
] | [
"binder"
] | `get_pi_binders e` instantiates all leading Π binders of `e` with fresh local
constants (like `open_pis`). Returns the remainder of `e` and information about
the binders that were instantiated (but not the new local constants). See also
`expr.pi_binders` (which produces open terms). | 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.