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 |
|---|---|---|---|---|---|---|---|---|---|---|
compare_hyp_le (e a b p₂ : expr) : tactic strictness | do
is_def_eq e b,
strict_a ← norm_num.positivity a,
match strict_a with
| positive p₁ := positive <$> mk_app ``lt_of_lt_of_le [p₁, p₂]
| nonnegative p₁ := nonnegative <$> mk_app ``le_trans [p₁, p₂]
| _ := do
e' ← pp e,
p₂' ← pp p₂,
fail (↑"`norm_num` can't prove nonnegativity o... | def | tactic.positivity.compare_hyp_le | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Calls `norm_num` on `a` to prove positivity/nonnegativity of `e` assuming `b` is defeq to `e`
and `p₂ : a ≤ b`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
compare_hyp_lt (e a b p₂ : expr) : tactic strictness | do
is_def_eq e b,
strict_a ← norm_num.positivity a,
match strict_a with
| positive p₁ := positive <$> mk_app ``lt_trans [p₁, p₂]
| nonnegative p₁ := positive <$> mk_app ``lt_of_le_of_lt [p₁, p₂]
| _ := do
e' ← pp e,
p₂' ← pp p₂,
fail (↑"`norm_num` can't prove positivity of " ++... | def | tactic.positivity.compare_hyp_lt | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Calls `norm_num` on `a` to prove positivity/nonnegativity of `e` assuming `b` is defeq to `e`
and `p₂ : a < b`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
compare_hyp_eq (e a b p₂ : expr) : tactic strictness | do
is_def_eq e b,
strict_a ← norm_num.positivity a,
match strict_a with
| positive p₁ := positive <$> mk_app ``lt_of_lt_of_eq [p₁, p₂]
| nonnegative p₁ := nonnegative <$> mk_app ``le_of_le_of_eq [p₁, p₂]
| nonzero p₁ := nonzero <$> to_expr ``(ne_of_ne_of_eq' %%p₁ %%p₂)
end | def | tactic.positivity.compare_hyp_eq | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"le_of_le_of_eq",
"lt_of_lt_of_eq"
] | Calls `norm_num` on `a` to prove positivity/nonnegativity/nonzeroness of `e` assuming `b` is
defeq to `e` and `p₂ : a = b`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
compare_hyp_ne (e a b p₂ : expr) : tactic strictness | do
is_def_eq e b,
(a', p₁) ← norm_num.derive a <|> refl_conv a,
a'' ← a'.to_rat,
if a'' = 0 then
nonzero <$> mk_mapp ``ne_of_ne_of_eq [none, none, none, none, p₂, p₁]
else do
e' ← pp e,
p₂' ← pp p₂,
a' ← pp a,
fail (↑"`norm_num` can't prove non-zeroness of " ++ e' ++ " using " ++ p₂' ++ " ... | def | tactic.positivity.compare_hyp_ne | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"norm_num.derive"
] | Calls `norm_num` on `a` to prove nonzeroness of `e` assuming `b` is defeq to `e` and
`p₂ : b ≠ a`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
compare_hyp (e p₂ : expr) : tactic strictness | do
p_typ ← infer_type p₂,
match p_typ with
| `(%%lo ≤ %%hi) := compare_hyp_le e lo hi p₂
| `(%%hi ≥ %%lo) := compare_hyp_le e lo hi p₂
| `(%%lo < %%hi) := compare_hyp_lt e lo hi p₂
| `(%%hi > %%lo) := compare_hyp_lt e lo hi p₂
| `(%%lo = %%hi) := compare_hyp_eq e lo hi p₂ <|> do
p₂... | def | tactic.positivity.compare_hyp | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Third base case of the `positivity` tactic. Prove an expression `e` is
positive/nonnegative/nonzero by finding a hypothesis of the form `a < e`, `a ≤ e` or `a = e` in
which `a` can be proved positive/nonnegative/nonzero by `norm_num`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
attr : user_attribute (expr → tactic strictness) unit | { name := `positivity,
descr := "extensions handling particular operations for the `positivity` tactic",
cache_cfg :=
{ mk_cache := λ ns, do
{ t ← ns.mfoldl
(λ (t : expr → tactic strictness) n, do
t' ← eval_expr (expr → tactic strictness) (expr.const n []),
pure (λ e, t' e... | def | tactic.positivity.attr | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Attribute allowing a user to tag a tactic as an extension for `tactic.interactive.positivity`.
The main (recursive) step of this tactic is to try successively all the extensions tagged with this
attribute on the expression at hand, and also to try the two "base case" tactics
`tactic.norm_num.positivity`, `tactic.positi... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
core (e : expr) : tactic strictness | do
f ← attr.get_cache,
f e <|> fail "failed to prove positivity/nonnegativity/nonzeroness" | def | tactic.positivity.core | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Look for a proof of positivity/nonnegativity of an expression `e`; if found, return the proof
together with a `strictness` stating whether the proof found was for strict positivity
(`positive p`), nonnegativity (`nonnegative p`), or nonzeroness (`nonzero p`). | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity : tactic unit | focus1 $ do
t ← target >>= instantiate_mvars,
(rel_desired, a) ← match t with
| `(0 ≤ %%e) := pure (order_rel.le, e)
| `(%%e ≥ 0) := pure (order_rel.le, e)
| `(0 < %%e) := pure (order_rel.lt, e)
| `(%%e > 0) := pure (order_rel.lt, e)
| `(%%e₁ ≠ %%e₂) := do
match e₂ with
... | def | tactic.interactive.positivity | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"tactic.positivity.core"
] | Tactic solving goals of the form `0 ≤ x`, `0 < x` and `x ≠ 0`. The tactic works recursively
according to the syntax of the expression `x`, if the atoms composing the expression all have
numeric lower bounds which can be proved positive/nonnegative/nonzero by `norm_num`. This tactic
either closes the goal or fails.
E... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
ite_pos [has_lt α] (ha : 0 < a) (hb : 0 < b) : 0 < ite p a b | by by_cases p; simp [*] | lemma | tactic.ite_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_nonneg [has_le α] (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ ite p a b | by by_cases p; simp [*] | lemma | tactic.ite_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_nonneg_of_pos_of_nonneg [preorder α] (ha : 0 < a) (hb : 0 ≤ b) : 0 ≤ ite p a b | ite_nonneg ha.le hb | lemma | tactic.ite_nonneg_of_pos_of_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_nonneg_of_nonneg_of_pos [preorder α] (ha : 0 ≤ a) (hb : 0 < b) : 0 ≤ ite p a b | ite_nonneg ha hb.le | lemma | tactic.ite_nonneg_of_nonneg_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_ne_zero (ha : a ≠ 0) (hb : b ≠ 0) : ite p a b ≠ 0 | by by_cases p; simp [*] | lemma | tactic.ite_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_ne_zero_of_pos_of_ne_zero [preorder α] (ha : 0 < a) (hb : b ≠ 0) :
ite p a b ≠ 0 | ite_ne_zero ha.ne' hb | lemma | tactic.ite_ne_zero_of_pos_of_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
ite_ne_zero_of_ne_zero_of_pos [preorder α] (ha : a ≠ 0) (hb : 0 < b) :
ite p a b ≠ 0 | ite_ne_zero ha hb.ne' | lemma | tactic.ite_ne_zero_of_ne_zero_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_ite : expr → tactic strictness | | e@`(@ite %%typ %%p %%hp %%a %%b) := do
strictness_a ← core a,
strictness_b ← core b,
match strictness_a, strictness_b with
| positive pa, positive pb := positive <$> mk_app ``ite_pos [pa, pb]
| positive pa, nonnegative pb := nonnegative <$> mk_app ``ite_nonneg_of_pos_of_nonneg [pa, pb]
| nonnegative pa, p... | def | tactic.positivity_ite | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: the `if then else` of two numbers is
positive/nonnegative/nonzero if both are. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
le_min_of_lt_of_le (ha : a < b) (hb : a ≤ c) : a ≤ min b c | le_min ha.le hb | lemma | tactic.le_min_of_lt_of_le | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
le_min_of_le_of_lt (ha : a ≤ b) (hb : a < c) : a ≤ min b c | le_min ha hb.le | lemma | tactic.le_min_of_le_of_lt | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
min_ne (ha : a ≠ c) (hb : b ≠ c) : min a b ≠ c | by { rw min_def, split_ifs; assumption } | lemma | tactic.min_ne | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
min_ne_of_ne_of_lt (ha : a ≠ c) (hb : c < b) : min a b ≠ c | min_ne ha hb.ne' | lemma | tactic.min_ne_of_ne_of_lt | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
min_ne_of_lt_of_ne (ha : c < a) (hb : b ≠ c) : min a b ≠ c | min_ne ha.ne' hb | lemma | tactic.min_ne_of_lt_of_ne | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
max_ne (ha : a ≠ c) (hb : b ≠ c) : max a b ≠ c | by { rw max_def, split_ifs; assumption } | lemma | tactic.max_ne | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_min : expr → tactic strictness | | e@`(min %%a %%b) := do
strictness_a ← core a,
strictness_b ← core b,
match strictness_a, strictness_b with
| (positive pa), (positive pb) := positive <$> mk_app ``lt_min [pa, pb]
| (positive pa), (nonnegative pb) := nonnegative <$> mk_app ``le_min_of_lt_of_le [pa, pb]
| (nonnegative pa), (positive pb) :=... | def | tactic.positivity_min | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: the `min` of two numbers is nonnegative if both are
nonnegative, and strictly positive if both are. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_max : expr → tactic strictness | | `(max %%a %%b) := do
strictness_a ← try_core (core a),
(do
match strictness_a with
| some (positive pa) := positive <$> mk_mapp ``lt_max_of_lt_left [none, none, none, a, b, pa]
| some (nonnegative pa) :=
nonnegative <$> mk_mapp ``le_max_of_le_left [none, none, none, a, b, pa]
| _... | def | tactic.positivity_max | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"le_max_of_le_left",
"le_max_of_le_right",
"lt_max_of_lt_left",
"lt_max_of_lt_right"
] | Extension for the `positivity` tactic: the `max` of two numbers is nonnegative if at least one
is nonnegative, strictly positive if at least one is positive, and nonzero if both are nonzero. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_add : expr → tactic strictness | | e@`(%%a + %%b) := do
strictness_a ← core a,
strictness_b ← core b,
match strictness_a, strictness_b with
| (positive pa), (positive pb) := positive <$> mk_app ``add_pos [pa, pb]
| (positive pa), (nonnegative pb) := positive <$> mk_app ``lt_add_of_pos_of_le [pa, pb]
| (nonnegative pa), (positive pb) := pos... | def | tactic.positivity_add | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: addition is nonnegative if both summands are nonnegative,
and strictly positive if at least one summand is. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mul_nonneg_of_pos_of_nonneg (ha : 0 < a) (hb : 0 ≤ b) : 0 ≤ a * b | mul_nonneg ha.le hb | lemma | tactic.mul_nonneg_of_pos_of_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
mul_nonneg_of_nonneg_of_pos (ha : 0 ≤ a) (hb : 0 < b) : 0 ≤ a * b | mul_nonneg ha hb.le | lemma | tactic.mul_nonneg_of_nonneg_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
mul_ne_zero_of_pos_of_ne_zero [no_zero_divisors R] (ha : 0 < a) (hb : b ≠ 0) :
a * b ≠ 0 | mul_ne_zero ha.ne' hb | lemma | tactic.mul_ne_zero_of_pos_of_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"mul_ne_zero",
"no_zero_divisors"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
mul_ne_zero_of_ne_zero_of_pos [no_zero_divisors R] (ha : a ≠ 0) (hb : 0 < b) :
a * b ≠ 0 | mul_ne_zero ha hb.ne' | lemma | tactic.mul_ne_zero_of_ne_zero_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"mul_ne_zero",
"no_zero_divisors"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_mul : expr → tactic strictness | | e@`(%%a * %%b) := do
strictness_a ← core a,
strictness_b ← core b,
match strictness_a, strictness_b with
| (positive pa), (positive pb) := positive <$> mk_app ``mul_pos [pa, pb]
| (positive pa), (nonnegative pb) := nonnegative <$> mk_app ``mul_nonneg_of_pos_of_nonneg [pa, pb]
| (nonnegative pa), (positive... | def | tactic.positivity_mul | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: multiplication is nonnegative/positive/nonzero if both
multiplicands are. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
div_nonneg_of_pos_of_nonneg (ha : 0 < a) (hb : 0 ≤ b) : 0 ≤ a / b | div_nonneg ha.le hb | lemma | tactic.div_nonneg_of_pos_of_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"div_nonneg"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
div_nonneg_of_nonneg_of_pos (ha : 0 ≤ a) (hb : 0 < b) : 0 ≤ a / b | div_nonneg ha hb.le | lemma | tactic.div_nonneg_of_nonneg_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"div_nonneg"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
div_ne_zero_of_pos_of_ne_zero (ha : 0 < a) (hb : b ≠ 0) : a / b ≠ 0 | div_ne_zero ha.ne' hb | lemma | tactic.div_ne_zero_of_pos_of_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"div_ne_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
div_ne_zero_of_ne_zero_of_pos (ha : a ≠ 0) (hb : 0 < b) : a / b ≠ 0 | div_ne_zero ha hb.ne' | lemma | tactic.div_ne_zero_of_ne_zero_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"div_ne_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_div_self_pos {a : ℤ} (ha : 0 < a) : 0 < a / a | by { rw int.div_self ha.ne', exact zero_lt_one } | lemma | tactic.int_div_self_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"int.div_self",
"zero_lt_one"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_div_nonneg_of_pos_of_nonneg {a b : ℤ} (ha : 0 < a) (hb : 0 ≤ b) : 0 ≤ a / b | int.div_nonneg ha.le hb | lemma | tactic.int_div_nonneg_of_pos_of_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"int.div_nonneg"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_div_nonneg_of_nonneg_of_pos {a b : ℤ} (ha : 0 ≤ a) (hb : 0 < b) : 0 ≤ a / b | int.div_nonneg ha hb.le | lemma | tactic.int_div_nonneg_of_nonneg_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"int.div_nonneg"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_div_nonneg_of_pos_of_pos {a b : ℤ} (ha : 0 < a) (hb : 0 < b) : 0 ≤ a / b | int.div_nonneg ha.le hb.le | lemma | tactic.int_div_nonneg_of_pos_of_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"int.div_nonneg"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_div : expr → tactic strictness | | e@`(@has_div.div ℤ _ %%a %%b) := do
strictness_a ← core a,
strictness_b ← core b,
match strictness_a, strictness_b with
| positive pa, positive pb :=
if a = b then -- Only attempts to prove `0 < a / a`, otherwise falls back to `0 ≤ a / b`
positive <$> mk_app ``int_div_self_pos [pa]
else
... | def | tactic.positivity_div | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"div_nonneg",
"div_pos",
"int.div_nonneg"
] | Extension for the `positivity` tactic: division is nonnegative if both numerator and denominator
are nonnegative, and strictly positive if both numerator and denominator are. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_inv : expr → tactic strictness | | `((%%a)⁻¹) := do
strictness_a ← core a,
match strictness_a with
| (positive pa) := positive <$> mk_app ``inv_pos_of_pos [pa]
| (nonnegative pa) := nonnegative <$> mk_app ``inv_nonneg_of_nonneg [pa]
| nonzero pa := nonzero <$> to_expr ``(inv_ne_zero %%pa)
end
| e := pp e >>= fail ∘ ... | def | tactic.positivity_inv | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: an inverse of a positive number is positive, an inverse
of a nonnegative number is nonnegative. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
pow_zero_pos [ordered_semiring R] [nontrivial R] (a : R) : 0 < a ^ 0 | zero_lt_one.trans_le (pow_zero a).ge | lemma | tactic.pow_zero_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nontrivial",
"ordered_semiring",
"pow_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
zpow_zero_pos [linear_ordered_semifield R] (a : R) : 0 < a ^ (0 : ℤ) | zero_lt_one.trans_le (zpow_zero a).ge | lemma | tactic.zpow_zero_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"linear_ordered_semifield",
"zpow_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_pow : expr → tactic strictness | | e@`(%%a ^ %%n) := do
typ ← infer_type n,
(do
unify typ `(ℕ),
if n = `(0) then
positive <$> mk_app ``pow_zero_pos [a]
else
do -- even powers are nonnegative
-- Note this is automatically strengthened to `0 < a ^ n` when `a ≠ 0` thanks to the `orelse'`
match n with -- TODO: Dec... | def | tactic.positivity_pow | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"pow_bit0_nonneg",
"pow_nonneg",
"pow_pos",
"zpow_bit0_nonneg",
"zpow_nonneg",
"zpow_pos_of_pos"
] | Extension for the `positivity` tactic: raising a number `a` to a natural/integer power `n` is
positive if `n = 0` (since `a ^ 0 = 1`) or if `0 < a`, and is nonnegative if `n` is even (squares
are nonnegative) or if `0 ≤ a`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_canon_pow : expr → tactic strictness | | `(%%r ^ %%n) := do
typ_n ← infer_type n,
unify typ_n `(ℕ),
positive p ← core r,
positive <$> mk_app ``canonically_ordered_comm_semiring.pow_pos [p, n]
-- The nonzero never happens because of `tactic.positivity_canon`
| e := pp e >>= fail ∘ format.bracket "The expression `"
"` is not of the for... | def | tactic.positivity_canon_pow | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"canonically_ordered_comm_semiring.pow_pos"
] | Extension for the `positivity` tactic: raising a positive number in a canonically ordered
semiring gives a positive number. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_abs : expr → tactic strictness | | `(|%%a|) := do
(do -- if can prove `0 < a` or `a ≠ 0`, report positivity
strict_a ← core a,
match strict_a with
| positive p := positive <$> mk_app ``abs_pos_of_pos [p]
| nonzero p := positive <$> mk_app ``abs_pos_of_ne_zero [p]
| _ := failed
end) <|>
nonnegative <$> mk_app ``abs_nonneg [a... | def | tactic.positivity_abs | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"abs_nonneg",
"abs_pos_of_pos"
] | Extension for the `positivity` tactic: an absolute value is nonnegative, and is strictly
positive if its input is nonzero. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
int_nat_abs_pos {n : ℤ} (hn : 0 < n) : 0 < n.nat_abs | int.nat_abs_pos_of_ne_zero hn.ne' | lemma | tactic.int_nat_abs_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_nat_abs : expr → tactic strictness | | `(int.nat_abs %%a) := do
strict_a ← core a,
match strict_a with
| positive p := positive <$> mk_app ``int_nat_abs_pos [p]
| nonzero p := positive <$> mk_app ``int.nat_abs_pos_of_ne_zero [p]
| _ := failed
end
| _ := failed | def | tactic.positivity_nat_abs | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: `int.nat_abs` is positive when its input is.
Since the output type of `int.nat_abs` is `ℕ`, the nonnegative case is handled by the default
`positivity` tactic. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
nat_cast_pos [ordered_semiring α] [nontrivial α] {n : ℕ} : 0 < n → 0 < (n : α) | nat.cast_pos.2 | lemma | tactic.nat_cast_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nontrivial",
"ordered_semiring"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) | n.cast_nonneg | lemma | tactic.int_coe_nat_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_coe_nat_pos {n : ℕ} : 0 < n → 0 < (n : ℤ) | nat.cast_pos.2 | lemma | tactic.int_coe_nat_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_cast_ne_zero [add_group_with_one α] [char_zero α] {n : ℤ} : n ≠ 0 → (n : α) ≠ 0 | int.cast_ne_zero.2 | lemma | tactic.int_cast_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"add_group_with_one",
"char_zero"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_cast_nonneg [ordered_ring α] {n : ℤ} (hn : 0 ≤ n) : 0 ≤ (n : α) | by { rw ←int.cast_zero, exact int.cast_mono hn } | lemma | tactic.int_cast_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"int.cast_mono",
"ordered_ring"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
int_cast_pos [ordered_ring α] [nontrivial α] {n : ℤ} : 0 < n → 0 < (n : α) | int.cast_pos.2 | lemma | tactic.int_cast_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nontrivial",
"ordered_ring"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat_cast_ne_zero [division_ring α] [char_zero α] {q : ℚ} : q ≠ 0 → (q : α) ≠ 0 | rat.cast_ne_zero.2 | lemma | tactic.rat_cast_ne_zero | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"char_zero",
"division_ring"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat_cast_nonneg [linear_ordered_field α] {q : ℚ} : 0 ≤ q → 0 ≤ (q : α) | rat.cast_nonneg.2 | lemma | tactic.rat_cast_nonneg | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"linear_ordered_field"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat_cast_pos [linear_ordered_field α] {q : ℚ} : 0 < q → 0 < (q : α) | rat.cast_pos.2 | lemma | tactic.rat_cast_pos | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"linear_ordered_field"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
positivity_coe : expr → tactic strictness | | `(@coe _ %%typ %%inst %%a) := do
-- TODO: Using `match` here might turn out too strict since we really want the instance to *unify*
-- with one of the instances below rather than being equal on the nose.
-- If this turns out to indeed be a problem, we should figure out the right way to pattern match
-- up to ... | def | tactic.positivity_coe | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nat.cast_nonneg"
] | Extension for the `positivity` tactic: casts from `ℕ`, `ℤ`, `ℚ`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_succ : expr → tactic strictness | | `(nat.succ %%a) := positive <$> mk_app `nat.succ_pos [a]
| e := pp e >>= fail ∘ format.bracket "The expression `" "` isn't of the form `nat.succ n`" | def | tactic.positivity_succ | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [] | Extension for the `positivity` tactic: `nat.succ` is always positive. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_factorial : expr → tactic strictness | | `(nat.factorial %%a) := positive <$> mk_app ``nat.factorial_pos [a]
| e := pp e >>= fail ∘ format.bracket "The expression `" "` isn't of the form `n!`" | def | tactic.positivity_factorial | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nat.factorial_pos"
] | Extension for the `positivity` tactic: `nat.factorial` is always positive. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_asc_factorial : expr → tactic strictness | | `(nat.asc_factorial %%a %%b) := positive <$> mk_app ``nat.asc_factorial_pos [a, b]
| e := pp e >>= fail ∘ format.bracket "The expression `"
"` isn't of the form `nat.asc_factorial n k`" | def | tactic.positivity_asc_factorial | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"nat.asc_factorial_pos"
] | Extension for the `positivity` tactic: `nat.asc_factorial` is always positive. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
positivity_map : expr → tactic strictness | | (expr.app `(⇑%%f) `(%%a)) := nonnegative <$> mk_app ``map_nonneg [f, a]
| _ := failed | def | tactic.positivity_map | tactic | src/tactic/positivity.lean | [
"tactic.norm_num",
"algebra.order.field.power",
"algebra.order.hom.basic",
"data.nat.factorial.basic"
] | [
"map_nonneg"
] | Extension for the `positivity` tactic: nonnegative maps take nonnegative values. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
pretty_cases_advice : tactic string | retrieve $ do
gs ← get_goals,
cases ← gs.mmap $ λ g, do
{ t : list name ← get_tag g,
let vs := t.tail,
let ⟨vs,ts⟩ := vs.span (λ n, name.last_string n = "_arg"),
set_goals [g],
ls ← local_context,
let m := native.rb_map.of_list $ (ls.map expr.local_uniq_name).zip (ls.map expr.local_pp_name),
let vs := vs.ma... | def | tactic.pretty_cases_advice | tactic | src/tactic/pretty_cases.lean | [
"tactic.core"
] | [
"name.last_string"
] | Query the proof goal and print the skeleton of a proof by cases. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
pretty_cases : tactic unit | pretty_cases_advice >>= trace | def | tactic.interactive.pretty_cases | tactic | src/tactic/pretty_cases.lean | [
"tactic.core"
] | [] | Query the proof goal and print the skeleton of a proof by
cases.
For example, let us consider the following proof:
```lean
example {α} (xs ys : list α) (h : xs ~ ys) : true :=
begin
induction h,
pretty_cases,
-- Try this:
-- case list.perm.nil :
-- { admit },
-- case list.perm.cons : h_x h_l... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
find_all_expr_data | (matching_subexpr : bool) -- this declaration contains a subexpression on which the test passes
(test_passed : bool) -- the search has found a matching subexpression somewhere
-- name, contains subexpression directly, direct descendants
(descendants : list (name × bool × name_set))
(name_map : name_map bool) -- all dat... | structure | tactic.find_all_expr_data | tactic | src/tactic/print_sorry.lean | [
"tactic.core",
"data.bool.basic"
] | [] | Auxiliary data type for `tactic.find_all_exprs` | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
find_all_exprs_aux (env : environment) (f : expr → bool) (g : name → bool) : name →
find_all_expr_data → tactic find_all_expr_data | | n ⟨b₀, b₁, l, ns, desc⟩ :=
match ns.find n with -- Skip declarations that we have already handled.
| some b := pure ⟨b₀, b || b₁, l, ns, if b then desc.insert n else desc⟩
| none := if g n then pure ⟨b₀, b₁, l, ns.insert n ff, desc⟩ else do
d ← env.get n,
let process (v : expr) : tactic find_all_expr_da... | def | tactic.find_all_exprs_aux | tactic | src/tactic/print_sorry.lean | [
"tactic.core",
"data.bool.basic"
] | [] | Auxiliary declaration for `tactic.find_all_exprs`.
Traverse all declarations occurring in the declaration with the given name,
excluding declarations `n` such that `g n` is true (and all their descendants),
recording the structure of which declaration depends on which,
and whether `f e` is true on any subexpression `e... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
find_all_exprs (env : environment) (test : expr → bool) (exclude : name → bool)
(nm : name) : tactic $ list $ name × bool × name_set | do
⟨_, _, l, _, _⟩ ← find_all_exprs_aux env test exclude nm ⟨ff, ff, [], mk_name_map, mk_name_set⟩,
pure l | def | tactic.find_all_exprs | tactic | src/tactic/print_sorry.lean | [
"tactic.core",
"data.bool.basic"
] | [] | `tactic.find_all_exprs env test exclude nm` searches for all declarations (transitively)
occuring in `nm` that contain a subexpression `e` such that `test e` is true.
All declarations `n` such that `exclude n` is true (and all their descendants) are ignored. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
print_sorry_in (nm : name) (ignore_mathlib := tt) : tactic unit | do
env ← get_env,
dir ← get_mathlib_dir,
data ← find_all_exprs env (λ e, e.is_sorry.is_some)
(if ignore_mathlib then env.is_prefix_of_file dir else λ _, ff) nm,
let to_print : list format := data.map $ λ ⟨nm, contains_sorry, desc⟩,
let s1 := if contains_sorry then " contains sorry" else "",
s2 :... | def | print_sorry_in | tactic | src/tactic/print_sorry.lean | [
"tactic.core",
"data.bool.basic"
] | [
"get_mathlib_dir"
] | Print all declarations that (transitively) occur in the value of declaration `nm` and depend on
`sorry`. If `ignore_mathlib` is set true, then all declarations in `mathlib` are
assumed to be `sorry`-free, which greatly reduces the search space. We could also exclude `core`,
but this doesn't speed up the search. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
print_sorry_in_cmd (_ : parse $ tk "#print_sorry_in") : parser unit | do
nm ← ident,
nm ← resolve_name nm,
print_sorry_in nm.const_name | def | print_sorry_in_cmd | tactic | src/tactic/print_sorry.lean | [
"tactic.core",
"data.bool.basic"
] | [
"print_sorry_in"
] | The command
```
#print_sorry_in nm
```
prints all declarations that (transitively) occur in the value of declaration `nm` and depend on
`sorry`. This command assumes that no `sorry` occurs in mathlib. To find `sorry` in mathlib, use
``#eval print_sorry_in `nm ff`` instead.
Example:
```
def foo1 : false := sorry
def foo... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
mathlib_dir_locator : true | trivial | lemma | mathlib_dir_locator | tactic | src/tactic/project_dir.lean | [] | [] | This is a dummy declaration that is used to determine the project folder of mathlib, using the
tactic `tactic.decl_olean`. This is used in `tactic.get_mathlib_dir`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
protected_attr : user_attribute | { name := "protected",
descr := "Attribute to protect a declaration
If a declaration `foo.bar` is marked protected, then it must be referred to
by its full name `foo.bar`, even when the `foo` namespace is open.",
after_set := some (λ n _ _, mk_protected n) } | def | tactic.protected_attr | tactic | src/tactic/protected.lean | [
"tactic.core"
] | [] | Attribute to protect a declaration.
If a declaration `foo.bar` is marked protected, then it must be referred to
by its full name `foo.bar`, even when the `foo` namespace is open.
Protectedness is a built in parser feature that is independent of this attribute.
A declaration may be protected even if it does not have th... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
protect_proj_tac (n : name) (l : list name) : tactic unit | do env ← get_env,
match env.structure_fields_full n with
| none := fail "protect_proj failed: declaration is not a structure"
| some fields := fields.mmap' $ λ field,
when (l.all $ λ m, bnot $ m.is_suffix_of field) $ mk_protected field
end | def | tactic.protect_proj_tac | tactic | src/tactic/protected.lean | [
"tactic.core"
] | [
"field"
] | Tactic that is executed when a structure is marked with the `protect_proj` attribute | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
protect_proj_attr : user_attribute unit (list name) | { name := "protect_proj",
descr := "Attribute to protect the projections of a structure.
If a structure `foo` is marked with the `protect_proj` user attribute, then
all of the projections become protected, meaning they must always be referred to by
their full name `foo.bar`, even when the `foo` namespace ... | def | tactic.protect_proj_attr | tactic | src/tactic/protected.lean | [
"tactic.core"
] | [] | Attribute to protect the projections of a structure.
If a structure `foo` is marked with the `protect_proj` user attribute, then
all of the projections become protected, meaning they must always be referred to by
their full name `foo.bar`, even when the `foo` namespace is open.
`protect_proj without bar baz` will prot... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
not_and_eq : (¬ (p ∧ q)) = (p → ¬ q) | propext not_and | theorem | push_neg.not_and_eq | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [
"not_and"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
not_and_distrib_eq : (¬ (p ∧ q)) = (¬ p ∨ ¬ q) | propext not_and_distrib | theorem | push_neg.not_and_distrib_eq | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [
"not_and_distrib"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
not_eq (a b : α) : (¬ a = b) ↔ (a ≠ b) | iff.rfl | theorem | push_neg.not_eq | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
not_le_eq (a b : β) : (¬ (a ≤ b)) = (b < a) | propext not_le | theorem | push_neg.not_le_eq | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
not_lt_eq (a b : β) : (¬ (a < b)) = (b ≤ a) | propext not_lt | theorem | push_neg.not_lt_eq | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
transform_negation_step (e : expr) :
tactic (option (expr × expr)) | do e ← whnf_reducible e,
match e with
| `(¬ %%ne) :=
(do ne ← whnf_reducible ne,
match ne with
| `(¬ %%a) := do pr ← mk_app ``not_not_eq [a],
return (some (a, pr))
| `(%%a ∧ %%b) := do distrib ← get_bool_option `trace.push_neg.use_distrib ff,
... | def | push_neg.transform_negation_step | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [
"distrib"
] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
transform_negation : expr → tactic (option (expr × expr)) | | e :=
do (some (e', pr)) ← transform_negation_step e | return none,
(some (e'', pr')) ← transform_negation e' | return (some (e', pr)),
pr'' ← mk_eq_trans pr pr',
return (some (e'', pr'')) | def | push_neg.transform_negation | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
normalize_negations (t : expr) : tactic (expr × expr) | do (_, e, pr) ← simplify_top_down ()
(λ _, λ e, do
oepr ← transform_negation e,
match oepr with
| (some (e', pr)) := return ((), e', pr)
| none := do pr ← mk_eq_refl e, return ((), e, pr)
... | def | push_neg.normalize_negations | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
push_neg_at_hyp (h : name) : tactic unit | do H ← get_local h,
t ← infer_type H,
(e, pr) ← normalize_negations t,
replace_hyp H e pr,
skip | def | push_neg.push_neg_at_hyp | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
push_neg_at_goal : tactic unit | do H ← target,
(e, pr) ← normalize_negations H,
replace_target e pr | def | push_neg.push_neg_at_goal | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tactic.interactive.push_neg : parse location → tactic unit | | (loc.ns loc_l) :=
loc_l.mmap'
(λ l, match l with
| some h := do push_neg_at_hyp h,
try $ interactive.simp_core { eta := ff } failed tt
[simp_arg_type.expr ``(push_neg.not_eq)] []
(interactive.loc.ns [some h])
... | def | tactic.interactive.push_neg | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [
"push_neg.not_eq"
] | Push negations in the goal of some assumption.
For instance, a hypothesis `h : ¬ ∀ x, ∃ y, x ≤ y` will be transformed by `push_neg at h` into
`h : ∃ x, ∀ y, y < x`. Variables names are conserved.
This tactic pushes negations inside expressions. For instance, given an assumption
```lean
h : ¬ ∀ ε > 0, ∃ δ > 0, ∀ x, |x... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
imp_of_not_imp_not (P Q : Prop) : (¬ Q → ¬ P) → (P → Q) | λ h hP, classical.by_contradiction (λ h', h h' hP) | lemma | imp_of_not_imp_not | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
name_with_opt : lean.parser (name × option name) | prod.mk <$> ident <*> (some <$> (tk "with" *> ident) <|> return none) | def | name_with_opt | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | Matches either an identifier "h" or a pair of identifiers "h with k" | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.interactive.contrapose (push : parse (tk "!" )?) :
parse name_with_opt? → tactic unit | | (some (h, h')) := get_local h >>= revert >> tactic.interactive.contrapose none >>
intro (h'.get_or_else h) >> skip
| none :=
do `(%%P → %%Q) ← target | fail
"The goal is not an implication, and you didn't specify an assumption",
cp ← mk_mapp ``imp_of_not_imp_not [P, Q] <|> fail
"contrapose only applies ... | def | tactic.interactive.contrapose | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [
"imp_of_not_imp_not",
"tactic.interactive.push_neg"
] | Transforms the goal into its contrapositive.
* `contrapose` turns a goal `P → Q` into `¬ Q → ¬ P`
* `contrapose!` turns a goal `P → Q` into `¬ Q → ¬ P` and pushes negations inside `P` and `Q`
using `push_neg`
* `contrapose h` first reverts the local assumption `h`, and then uses `contrapose` and `intro h`
*... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
push_neg_cmd (_ : parse $ tk "#push_neg") : lean.parser unit | do
e ← texpr,
/- Synthesize a `tactic_state` including local variables as hypotheses under which
`normalize_negations` may be safely called with expected behaviour given the `variables` in the
environment. -/
(ts, _) ← synthesize_tactic_state_with_variables_as_hyps [e],
/- Enter the `tactic` monad, ... | def | tactic.push_neg_cmd | tactic | src/tactic/push_neg.lean | [
"tactic.core",
"logic.basic"
] | [] | The syntax is `#push_neg e`, where `e` is an expression,
which will print the `push_neg` form of `e`.
`#push_neg` understands local variables, so you can use them to
introduce parameters. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
qify_attr : user_attribute simp_lemmas unit | { name := `qify,
descr := "Used to tag lemmas for use in the `qify` tactic",
cache_cfg :=
{ mk_cache :=
λ ns, mmap (λ n, do c ← mk_const n, return (c, tt)) ns >>= simp_lemmas.mk.append_with_symm,
dependencies := [] } } | def | qify.qify_attr | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | The `qify` attribute is used by the `qify` tactic. It applies to lemmas that shift propositions
from `nat` or `int` to `rat`.
`qify` lemmas should have the form `∀ a₁ ... aₙ : ℕ, Pq (a₁ : ℚ) ... (aₙ : ℚ) ↔ Pn a₁ ... aₙ` or
`∀ a₁ ... aₙ : ℤ, Pq (a₁ : ℚ) ... (aₙ : ℚ) ↔ Pz a₁ ... aₙ`.
For example, `rat.coe_nat_le_coe_na... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
lift_to_q (e : expr) : tactic (expr × expr) | do sl ← qify_attr.get_cache,
sl ← sl.add_simp `ge_iff_le, sl ← sl.add_simp `gt_iff_lt,
(e', prf, _) ← simplify sl [] e,
return (e', prf) | def | qify.lift_to_q | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [
"ge_iff_le",
"gt_iff_lt"
] | Given an expression `e`, `lift_to_q e` looks for subterms of `e` that are propositions "about"
natural numbers or integers and change them to propositions about rational numbers.
Returns an expression `e'` and a proof that `e = e'`.
Includes `ge_iff_le` and `gt_iff_lt` in the simp set. These can't be tagged with `qif... | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
rat.coe_nat_le_coe_nat_iff (a b : ℕ) : (a : ℚ) ≤ b ↔ a ≤ b | by simp | lemma | qify.rat.coe_nat_le_coe_nat_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_nat_lt_coe_nat_iff (a b : ℕ) : (a : ℚ) < b ↔ a < b | by simp | lemma | qify.rat.coe_nat_lt_coe_nat_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_nat_eq_coe_nat_iff (a b : ℕ) : (a : ℚ) = b ↔ a = b | by simp | lemma | qify.rat.coe_nat_eq_coe_nat_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_nat_ne_coe_nat_iff (a b : ℕ) : (a : ℚ) ≠ b ↔ a ≠ b | by simp | lemma | qify.rat.coe_nat_ne_coe_nat_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_int_le_coe_int_iff (a b : ℤ) : (a : ℚ) ≤ b ↔ a ≤ b | by simp | lemma | qify.rat.coe_int_le_coe_int_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_int_lt_coe_int_iff (a b : ℤ) : (a : ℚ) < b ↔ a < b | by simp | lemma | qify.rat.coe_int_lt_coe_int_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_int_eq_coe_int_iff (a b : ℤ) : (a : ℚ) = b ↔ a = b | by simp | lemma | qify.rat.coe_int_eq_coe_int_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
rat.coe_int_ne_coe_int_iff (a b : ℤ) : (a : ℚ) ≠ b ↔ a ≠ b | by simp | lemma | qify.rat.coe_int_ne_coe_int_iff | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [] | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 | |
tactic.qify (extra_lems : list simp_arg_type) : expr → tactic (expr × expr) | λ q,
do (q1, p1) ← qify.lift_to_q q <|> fail "failed to find an applicable qify lemma",
(q2, p2) ← norm_cast.derive_push_cast extra_lems q1,
prod.mk q2 <$> mk_eq_trans p1 p2 | def | tactic.qify | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [
"norm_cast.derive_push_cast",
"qify.lift_to_q"
] | `qify extra_lems e` is used to shift propositions in `e` from `ℕ` or `ℤ` to `ℚ`.
This is often useful since `ℚ` has well-behaved division and subtraction.
The list of extra lemmas is used in the `push_cast` step.
Returns an expression `e'` and a proof that `e = e'`. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.qify_proof (extra_lems : list simp_arg_type) (h : expr) : tactic expr | do (_, pf) ← infer_type h >>= tactic.qify extra_lems,
mk_eq_mp pf h | def | tactic.qify_proof | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [
"tactic.qify"
] | A variant of `tactic.qify` that takes `h`, a proof of a proposition about natural numbers
or integers, and returns a proof of the qified version of that propositon. | https://github.com/leanprover-community/mathlib | 65a1391a0106c9204fe45bc73a039f056558cb83 |
tactic.interactive.qify (sl : parse simp_arg_list) (l : parse location) : tactic unit | do locs ← l.get_locals,
replace_at (tactic.qify sl) locs l.include_goal >>= guardb | def | tactic.interactive.qify | tactic | src/tactic/qify.lean | [
"tactic.norm_cast",
"data.rat.cast"
] | [
"tactic.qify"
] | The `qify` tactic is used to shift propositions from `ℕ` or `ℤ` to `ℚ`.
This is often useful since `ℚ` has well-behaved division and subtraction.
```lean
example (a b c : ℕ) (x y z : ℤ) (h : ¬ x*y*z < 0) : c < a + 3*b :=
begin
qify,
qify at h,
/-
h : ¬↑x * ↑y * ↑z < 0
⊢ ↑c < ↑a + 3 * ↑b
-/
end
```
`qify` ... | 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.