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
adc_bit0_bit1 {α} [semiring α] (a b c : α) (h : a + b + 1 = c) : bit0 a + bit1 b + 1 = bit0 c
h ▸ by simp [bit1, bit0, add_left_comm, add_assoc]
theorem
norm_num.adc_bit0_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
adc_bit1_bit1 {α} [semiring α] (a b c : α) (h : a + b + 1 = c) : bit1 a + bit1 b + 1 = bit1 c
h ▸ by simp [bit1, bit0, add_left_comm, add_assoc]
theorem
norm_num.adc_bit1_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_add_nat' (c : instance_cache) (a b : expr) : tactic (instance_cache × expr × expr)
do na ← a.to_nat, nb ← b.to_nat, (c, r) ← c.of_nat (na + nb), (c, p) ← prove_add_nat c a b r, return (c, r, p)
def
norm_num.prove_add_nat'
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` natural numerals, returns `(r, ⊢ a + b = r)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
bit0_mul {α} [semiring α] (a b c : α) (h : a * b = c) : bit0 a * b = bit0 c
h ▸ by simp [bit0, add_mul]
theorem
norm_num.bit0_mul
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "bit0_mul", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_bit0' {α} [semiring α] (a b c : α) (h : a * b = c) : a * bit0 b = bit0 c
h ▸ by simp [bit0, mul_add]
theorem
norm_num.mul_bit0'
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_bit0_bit0 {α} [semiring α] (a b c : α) (h : a * b = c) : bit0 a * bit0 b = bit0 (bit0 c)
bit0_mul _ _ _ (mul_bit0' _ _ _ h)
theorem
norm_num.mul_bit0_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "bit0_mul", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_bit1_bit1 {α} [semiring α] (a b c d e : α) (hc : a * b = c) (hd : a + b = d) (he : bit0 c + d = e) : bit1 a * bit1 b = bit1 e
by rw [← he, ← hd, ← hc]; simp [bit1, bit0, mul_add, add_mul, add_left_comm, add_assoc]
theorem
norm_num.mul_bit1_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_mul_nat : instance_cache → expr → expr → tactic (instance_cache × expr × expr)
| ic a b := match match_numeral a, match_numeral b with | zero, _ := do (ic, z) ← ic.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``zero_mul [b], return (ic, z, p) | _, zero := do (ic, z) ← ic.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``mul_zero [a], return (ic, z, p) | one, _ := ...
def
norm_num.prove_mul_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "bit0_mul", "mul_one", "mul_zero", "one_mul", "zero_mul" ]
Given `a`,`b` natural numerals, returns `(r, ⊢ a * b = r)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
zero_lt_one [linear_ordered_semiring α] : (0 : α) < 1
zero_lt_one
lemma
norm_num.zero_lt_one
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring", "zero_lt_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_pos_nat (c : instance_cache) : expr → tactic (instance_cache × expr)
| e := match match_numeral e with | one := c.mk_app ``zero_lt_one [] | bit0 e := do (c, p) ← prove_pos_nat e, c.mk_app ``bit0_pos [e, p] | bit1 e := do (c, p) ← prove_pos_nat e, c.mk_app ``bit1_pos' [e, p] | _ := failed end
def
norm_num.prove_pos_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "bit0_pos", "bit1_pos'", "zero_lt_one" ]
Given `a` a positive natural numeral, returns `⊢ 0 < a`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_pos (c : instance_cache) : expr → tactic (instance_cache × expr)
| `(%%e₁ / %%e₂) := do (c, p₁) ← prove_pos_nat c e₁, (c, p₂) ← prove_pos_nat c e₂, c.mk_app ``div_pos [e₁, e₂, p₁, p₂] | e := prove_pos_nat c e
def
norm_num.prove_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "div_pos" ]
Given `a` a rational numeral, returns `⊢ 0 < a`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
match_neg : expr → option expr
| `(- %%e) := some e | _ := none
def
norm_num.match_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
`match_neg (- e) = some e`, otherwise `none`
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
match_sign : expr → expr ⊕ bool
| `(- %%e) := sum.inl e | `(has_zero.zero) := sum.inr ff | _ := sum.inr tt
def
norm_num.match_sign
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
`match_sign (- e) = inl e`, `match_sign 0 = inr ff`, otherwise `inr tt`
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
ne_zero_of_pos {α} [ordered_add_comm_group α] (a : α) : 0 < a → a ≠ 0
ne_of_gt
theorem
norm_num.ne_zero_of_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ordered_add_comm_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
ne_zero_neg {α} [add_group α] (a : α) : a ≠ 0 → -a ≠ 0
mt neg_eq_zero.1
theorem
norm_num.ne_zero_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_ne_zero' (c : instance_cache) : expr → tactic (instance_cache × expr)
| a := match match_neg a with | some a := do (c, p) ← prove_ne_zero' a, c.mk_app ``ne_zero_neg [a, p] | none := do (c, p) ← prove_pos c a, c.mk_app ``ne_zero_of_pos [a, p] end
def
norm_num.prove_ne_zero'
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` a rational numeral, returns `⊢ a ≠ 0`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_div {α} [division_ring α] (a b b' c d : α) (h₀ : b ≠ 0) (h₁ : b * b' = d) (h₂ : a * b' = c) : (a / b) * d = c
by rwa [← h₁, ← mul_assoc, div_mul_cancel _ h₀]
theorem
norm_num.clear_denom_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "div_mul_cancel", "division_ring", "mul_assoc" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_clear_denom' (prove_ne_zero : instance_cache → expr → ℚ → tactic (instance_cache × expr)) (c : instance_cache) (a d : expr) (na : ℚ) (nd : ℕ) : tactic (instance_cache × expr × expr)
if na.denom = 1 then prove_mul_nat c a d else do [_, _, a, b] ← return a.get_app_args, (c, b') ← c.of_nat (nd / na.denom), (c, p₀) ← prove_ne_zero c b na.denom, (c, _, p₁) ← prove_mul_nat c b b', (c, r, p₂) ← prove_mul_nat c a b', (c, p) ← c.mk_app ``clear_denom_div [a, b, b', r, d, p₀, p₁, p₂], return ...
def
norm_num.prove_clear_denom'
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` nonnegative rational and `d` a natural number, returns `(b, ⊢ a * d = b)`. (`d` should be a multiple of the denominator of `a`, so that `b` is a natural number.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nonneg_pos {α} [ordered_cancel_add_comm_monoid α] (a : α) : 0 < a → 0 ≤ a
le_of_lt
theorem
norm_num.nonneg_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ordered_cancel_add_comm_monoid" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_one_bit0 {α} [linear_ordered_semiring α] (a : α) (h : 1 ≤ a) : 1 < bit0 a
lt_of_lt_of_le one_lt_two (bit0_le_bit0.2 h)
theorem
norm_num.lt_one_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring", "one_lt_two" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_one_bit1 {α} [linear_ordered_semiring α] (a : α) (h : 0 < a) : 1 < bit1 a
one_lt_bit1.2 h
theorem
norm_num.lt_one_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_bit0_bit0 {α} [linear_ordered_semiring α] (a b : α) : a < b → bit0 a < bit0 b
bit0_lt_bit0.2
theorem
norm_num.lt_bit0_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_bit0_bit1 {α} [linear_ordered_semiring α] (a b : α) (h : a ≤ b) : bit0 a < bit1 b
lt_of_le_of_lt (bit0_le_bit0.2 h) (lt_add_one _)
theorem
norm_num.lt_bit0_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring", "lt_add_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_bit1_bit0 {α} [linear_ordered_semiring α] (a b : α) (h : a + 1 ≤ b) : bit1 a < bit0 b
lt_of_lt_of_le (by simp [bit0, bit1, zero_lt_one, add_assoc]) (bit0_le_bit0.2 h)
theorem
norm_num.lt_bit1_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring", "zero_lt_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_bit1_bit1 {α} [linear_ordered_semiring α] (a b : α) : a < b → bit1 a < bit1 b
bit1_lt_bit1.2
theorem
norm_num.lt_bit1_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_one_bit0 {α} [linear_ordered_semiring α] (a : α) (h : 1 ≤ a) : 1 ≤ bit0 a
le_of_lt (lt_one_bit0 _ h)
theorem
norm_num.le_one_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_one_bit1 {α} [linear_ordered_semiring α] (a : α) (h : 0 < a) : 1 ≤ bit1 a
le_of_lt (lt_one_bit1 _ h)
theorem
norm_num.le_one_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_bit0_bit0 {α} [linear_ordered_semiring α] (a b : α) : a ≤ b → bit0 a ≤ bit0 b
bit0_le_bit0.2
theorem
norm_num.le_bit0_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_bit0_bit1 {α} [linear_ordered_semiring α] (a b : α) (h : a ≤ b) : bit0 a ≤ bit1 b
le_of_lt (lt_bit0_bit1 _ _ h)
theorem
norm_num.le_bit0_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_bit1_bit0 {α} [linear_ordered_semiring α] (a b : α) (h : a + 1 ≤ b) : bit1 a ≤ bit0 b
le_of_lt (lt_bit1_bit0 _ _ h)
theorem
norm_num.le_bit1_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_bit1_bit1 {α} [linear_ordered_semiring α] (a b : α) : a ≤ b → bit1 a ≤ bit1 b
bit1_le_bit1.2
theorem
norm_num.le_bit1_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_one_bit0 {α} [linear_ordered_semiring α] (a : α) : 1 ≤ a → 1 + 1 ≤ bit0 a
bit0_le_bit0.2
theorem
norm_num.sle_one_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_one_bit1 {α} [linear_ordered_semiring α] (a : α) : 1 ≤ a → 1 + 1 ≤ bit1 a
le_bit0_bit1 _ _
theorem
norm_num.sle_one_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_bit0_bit0 {α} [linear_ordered_semiring α] (a b : α) : a + 1 ≤ b → bit0 a + 1 ≤ bit0 b
le_bit1_bit0 _ _
theorem
norm_num.sle_bit0_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_bit0_bit1 {α} [linear_ordered_semiring α] (a b : α) (h : a ≤ b) : bit0 a + 1 ≤ bit1 b
bit1_le_bit1.2 h
theorem
norm_num.sle_bit0_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_bit1_bit0 {α} [linear_ordered_semiring α] (a b : α) (h : a + 1 ≤ b) : bit1 a + 1 ≤ bit0 b
(bit1_succ a _ rfl).symm ▸ bit0_le_bit0.2 h
theorem
norm_num.sle_bit1_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
sle_bit1_bit1 {α} [linear_ordered_semiring α] (a b : α) (h : a + 1 ≤ b) : bit1 a + 1 ≤ bit1 b
(bit1_succ a _ rfl).symm ▸ le_bit0_bit1 _ _ h
theorem
norm_num.sle_bit1_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_nonneg (ic : instance_cache) : expr → tactic (instance_cache × expr)
| e@`(has_zero.zero) := ic.mk_app ``le_refl [e] | e := if ic.α = `(ℕ) then return (ic, `(nat.zero_le).mk_app [e]) else do (ic, p) ← prove_pos ic e, ic.mk_app ``nonneg_pos [e, p]
def
norm_num.prove_nonneg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` a rational numeral, returns `⊢ 0 ≤ a`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_one_le_nat (ic : instance_cache) : expr → tactic (instance_cache × expr)
| a := match match_numeral a with | one := ic.mk_app ``le_refl [a] | bit0 a := do (ic, p) ← prove_one_le_nat a, ic.mk_app ``le_one_bit0 [a, p] | bit1 a := do (ic, p) ← prove_pos_nat ic a, ic.mk_app ``le_one_bit1 [a, p] | _ := failed end
def
norm_num.prove_one_le_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` a rational numeral, returns `⊢ 1 ≤ a`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_lt_nat (ic : instance_cache) : expr → expr → tactic (instance_cache × expr)
| a b := match match_numeral a, match_numeral b with | zero, _ := prove_pos ic b | one, bit0 b := do (ic, p) ← prove_one_le_nat ic b, ic.mk_app ``lt_one_bit0 [b, p] | one, bit1 b := do (ic, p) ← prove_pos_nat ic b, ic.mk_app ``lt_one_bit1 [b, p] | bit0 a, bit0 b := do (ic, p) ← prove_lt_nat a b, ic.mk_app ``l...
def
norm_num.prove_lt_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` natural numerals, proves `⊢ a < b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_lt {α} [linear_ordered_semiring α] (a a' b b' d : α) (h₀ : 0 < d) (ha : a * d = a') (hb : b * d = b') (h : a' < b') : a < b
lt_of_mul_lt_mul_right (by rwa [ha, hb]) (le_of_lt h₀)
theorem
norm_num.clear_denom_lt
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "linear_ordered_semiring", "lt_of_mul_lt_mul_right" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_lt_nonneg_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr)
if na.denom = 1 ∧ nb.denom = 1 then prove_lt_nat ic a b else do let nd := na.denom.lcm nb.denom, (ic, d) ← ic.of_nat nd, (ic, p₀) ← prove_pos ic d, (ic, a', pa) ← prove_clear_denom' (λ ic e _, prove_ne_zero' ic e) ic a d na nd, (ic, b', pb) ← prove_clear_denom' (λ ic e _, prove_ne_zero' ic e) ic b d nb nd, ...
def
norm_num.prove_lt_nonneg_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` nonnegative rational numerals, proves `⊢ a < b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
lt_neg_pos {α} [ordered_add_comm_group α] (a b : α) (ha : 0 < a) (hb : 0 < b) : -a < b
lt_trans (neg_neg_of_pos ha) hb
lemma
norm_num.lt_neg_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ordered_add_comm_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_lt_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr)
match match_sign a, match_sign b with | sum.inl a, sum.inl b := do -- we have to switch the order of `a` and `b` because `a < b ↔ -b < -a` (ic, p) ← prove_lt_nonneg_rat ic b a (-nb) (-na), ic.mk_app ``neg_lt_neg [b, a, p] | sum.inl a, sum.inr ff := do (ic, p) ← prove_pos ic a, ic.mk_app ``neg_neg_of_pos [a, p...
def
norm_num.prove_lt_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` rational numerals, proves `⊢ a < b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_le {α} [linear_ordered_semiring α] (a a' b b' d : α) (h₀ : 0 < d) (ha : a * d = a') (hb : b * d = b') (h : a' ≤ b') : a ≤ b
le_of_mul_le_mul_right (by rwa [ha, hb]) h₀
theorem
norm_num.clear_denom_le
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "le_of_mul_le_mul_right", "linear_ordered_semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_le_nonneg_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr)
if na.denom = 1 ∧ nb.denom = 1 then prove_le_nat ic a b else do let nd := na.denom.lcm nb.denom, (ic, d) ← ic.of_nat nd, (ic, p₀) ← prove_pos ic d, (ic, a', pa) ← prove_clear_denom' (λ ic e _, prove_ne_zero' ic e) ic a d na nd, (ic, b', pb) ← prove_clear_denom' (λ ic e _, prove_ne_zero' ic e) ic b d nb nd, ...
def
norm_num.prove_le_nonneg_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` nonnegative rational numerals, proves `⊢ a ≤ b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
le_neg_pos {α} [ordered_add_comm_group α] (a b : α) (ha : 0 ≤ a) (hb : 0 ≤ b) : -a ≤ b
le_trans (neg_nonpos_of_nonneg ha) hb
lemma
norm_num.le_neg_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ordered_add_comm_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_le_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr)
match match_sign a, match_sign b with | sum.inl a, sum.inl b := do (ic, p) ← prove_le_nonneg_rat ic a b (-na) (-nb), ic.mk_app ``neg_le_neg [a, b, p] | sum.inl a, sum.inr ff := do (ic, p) ← prove_nonneg ic a, ic.mk_app ``neg_nonpos_of_nonneg [a, p] | sum.inl a, sum.inr tt := do (ic, pa) ← prove_nonneg ic a, ...
def
norm_num.prove_le_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` rational numerals, proves `⊢ a ≤ b`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_ne_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr)
if na < nb then do (ic, p) ← prove_lt_rat ic a b na nb, ic.mk_app ``ne_of_lt [a, b, p] else do (ic, p) ← prove_lt_rat ic b a nb na, ic.mk_app ``ne_of_gt [a, b, p]
def
norm_num.prove_ne_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` rational numerals, proves `⊢ a ≠ b`. This version tries to prove `⊢ a < b` or `⊢ b < a`, and so is not appropriate for types without an order relation.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nat_cast_zero {α} [semiring α] : ↑(0 : ℕ) = (0 : α)
nat.cast_zero
theorem
norm_num.nat_cast_zero
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "nat.cast_zero", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nat_cast_one {α} [semiring α] : ↑(1 : ℕ) = (1 : α)
nat.cast_one
theorem
norm_num.nat_cast_one
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "nat.cast_one", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nat_cast_bit0 {α} [semiring α] (a : ℕ) (a' : α) (h : ↑a = a') : ↑(bit0 a) = bit0 a'
h ▸ nat.cast_bit0 _
theorem
norm_num.nat_cast_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "nat.cast_bit0", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nat_cast_bit1 {α} [semiring α] (a : ℕ) (a' : α) (h : ↑a = a') : ↑(bit1 a) = bit1 a'
h ▸ nat.cast_bit1 _
theorem
norm_num.nat_cast_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "nat.cast_bit1", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_zero {α} [ring α] : ↑(0 : ℤ) = (0 : α)
int.cast_zero
theorem
norm_num.int_cast_zero
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "int.cast_zero", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_one {α} [ring α] : ↑(1 : ℤ) = (1 : α)
int.cast_one
theorem
norm_num.int_cast_one
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "int.cast_one", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_bit0 {α} [ring α] (a : ℤ) (a' : α) (h : ↑a = a') : ↑(bit0 a) = bit0 a'
h ▸ int.cast_bit0 _
theorem
norm_num.int_cast_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "int.cast_bit0", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_bit1 {α} [ring α] (a : ℤ) (a' : α) (h : ↑a = a') : ↑(bit1 a) = bit1 a'
h ▸ int.cast_bit1 _
theorem
norm_num.int_cast_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "int.cast_bit1", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
rat_cast_bit0 {α} [division_ring α] [char_zero α] (a : ℚ) (a' : α) (h : ↑a = a') : ↑(bit0 a) = bit0 a'
h ▸ rat.cast_bit0 _
theorem
norm_num.rat_cast_bit0
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "division_ring", "rat.cast_bit0" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
rat_cast_bit1 {α} [division_ring α] [char_zero α] (a : ℚ) (a' : α) (h : ↑a = a') : ↑(bit1 a) = bit1 a'
h ▸ rat.cast_bit1 _
theorem
norm_num.rat_cast_bit1
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "division_ring", "rat.cast_bit1" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_nat_uncast (ic nc : instance_cache) : ∀ (a' : expr), tactic (instance_cache × instance_cache × expr × expr)
| a' := match match_numeral a' with | match_numeral_result.zero := do (nc, e) ← nc.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``nat_cast_zero [], return (ic, nc, e, p) | match_numeral_result.one := do (nc, e) ← nc.mk_app ``has_one.one [], (ic, p) ← ic.mk_app ``nat_cast_one [], return (...
def
norm_num.prove_nat_uncast
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a' : α` a natural numeral, returns `(a : ℕ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_int_uncast_nat (ic zc : instance_cache) : ∀ (a' : expr), tactic (instance_cache × instance_cache × expr × expr)
| a' := match match_numeral a' with | match_numeral_result.zero := do (zc, e) ← zc.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``int_cast_zero [], return (ic, zc, e, p) | match_numeral_result.one := do (zc, e) ← zc.mk_app ``has_one.one [], (ic, p) ← ic.mk_app ``int_cast_one [], return (...
def
norm_num.prove_int_uncast_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a' : α` a natural numeral, returns `(a : ℤ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_rat_uncast_nat (ic qc : instance_cache) (cz_inst : expr) : ∀ (a' : expr), tactic (instance_cache × instance_cache × expr × expr)
| a' := match match_numeral a' with | match_numeral_result.zero := do (qc, e) ← qc.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``rat.cast_zero [], return (ic, qc, e, p) | match_numeral_result.one := do (qc, e) ← qc.mk_app ``has_one.one [], (ic, p) ← ic.mk_app ``rat.cast_one [], return (...
def
norm_num.prove_rat_uncast_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "rat.cast_one", "rat.cast_zero" ]
Given `a' : α` a natural numeral, returns `(a : ℚ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
rat_cast_div {α} [division_ring α] [char_zero α] (a b : ℚ) (a' b' : α) (ha : ↑a = a') (hb : ↑b = b') : ↑(a / b) = a' / b'
ha ▸ hb ▸ rat.cast_div _ _
theorem
norm_num.rat_cast_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "division_ring", "rat.cast_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_rat_uncast_nonneg (ic qc : instance_cache) (cz_inst a' : expr) (na' : ℚ) : tactic (instance_cache × instance_cache × expr × expr)
if na'.denom = 1 then prove_rat_uncast_nat ic qc cz_inst a' else do [_, _, a', b'] ← return a'.get_app_args, (ic, qc, a, pa) ← prove_rat_uncast_nat ic qc cz_inst a', (ic, qc, b, pb) ← prove_rat_uncast_nat ic qc cz_inst b', (qc, e) ← qc.mk_app ``has_div.div [a, b], (ic, p) ← ic.mk_app ``rat_cast_div [cz_inst...
def
norm_num.prove_rat_uncast_nonneg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a' : α` a nonnegative rational numeral, returns `(a : ℚ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_neg {α} [ring α] (a : ℤ) (a' : α) (h : ↑a = a') : ↑-a = -a'
h ▸ int.cast_neg _
theorem
norm_num.int_cast_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "int.cast_neg", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
rat_cast_neg {α} [division_ring α] (a : ℚ) (a' : α) (h : ↑a = a') : ↑-a = -a'
h ▸ rat.cast_neg _
theorem
norm_num.rat_cast_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "rat.cast_neg" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_int_uncast (ic zc : instance_cache) (a' : expr) : tactic (instance_cache × instance_cache × expr × expr)
match match_neg a' with | some a' := do (ic, zc, a, p) ← prove_int_uncast_nat ic zc a', (zc, e) ← zc.mk_app ``has_neg.neg [a], (ic, p) ← ic.mk_app ``int_cast_neg [a, a', p], return (ic, zc, e, p) | none := prove_int_uncast_nat ic zc a' end
def
norm_num.prove_int_uncast
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a' : α` an integer numeral, returns `(a : ℤ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_rat_uncast (ic qc : instance_cache) (cz_inst a' : expr) (na' : ℚ) : tactic (instance_cache × instance_cache × expr × expr)
match match_neg a' with | some a' := do (ic, qc, a, p) ← prove_rat_uncast_nonneg ic qc cz_inst a' (-na'), (qc, e) ← qc.mk_app ``has_neg.neg [a], (ic, p) ← ic.mk_app ``rat_cast_neg [a, a', p], return (ic, qc, e, p) | none := prove_rat_uncast_nonneg ic qc cz_inst a' na' end
def
norm_num.prove_rat_uncast
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a' : α` a rational numeral, returns `(a : ℚ, ⊢ ↑a = a')`. (Note that the returned value is on the left of the equality.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
nat_cast_ne {α} [semiring α] [char_zero α] (a b : ℕ) (a' b' : α) (ha : ↑a = a') (hb : ↑b = b') (h : a ≠ b) : a' ≠ b'
ha ▸ hb ▸ mt nat.cast_inj.1 h
theorem
norm_num.nat_cast_ne
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "semiring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
int_cast_ne {α} [ring α] [char_zero α] (a b : ℤ) (a' b' : α) (ha : ↑a = a') (hb : ↑b = b') (h : a ≠ b) : a' ≠ b'
ha ▸ hb ▸ mt int.cast_inj.1 h
theorem
norm_num.int_cast_ne
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
rat_cast_ne {α} [division_ring α] [char_zero α] (a b : ℚ) (a' b' : α) (ha : ↑a = a') (hb : ↑b = b') (h : a ≠ b) : a' ≠ b'
ha ▸ hb ▸ mt rat.cast_inj.1 h
theorem
norm_num.rat_cast_ne
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero", "division_ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_ne : instance_cache → expr → expr → ℚ → ℚ → tactic (instance_cache × expr)
| ic a b na nb := prove_ne_rat ic a b na nb <|> do cz_inst ← mk_mapp ``char_zero [ic.α, none] >>= mk_instance, if na.denom = 1 ∧ nb.denom = 1 then if na ≥ 0 ∧ nb ≥ 0 then do guard (ic.α ≠ `(ℕ)), nc ← mk_instance_cache `(ℕ), (ic, nc, a', pa) ← prove_nat_uncast ic nc a, (ic, nc, b', pb) ← ...
def
norm_num.prove_ne
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "char_zero" ]
Given `a`,`b` rational numerals, proves `⊢ a ≠ b`. Currently it tries two methods: * Prove `⊢ a < b` or `⊢ b < a`, if the base type has an order * Embed `↑(a':ℚ) = a` and `↑(b':ℚ) = b`, and then prove `a' ≠ b'`. This requires that the base type be `char_zero`, and also that it be a `division_ring` so that ...
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_ne_zero (ic : instance_cache) : expr → ℚ → tactic (instance_cache × expr)
| a na := do (ic, z) ← ic.mk_app ``has_zero.zero [], prove_ne ic a z na 0
def
norm_num.prove_ne_zero
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` a rational numeral, returns `⊢ a ≠ 0`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_clear_denom : instance_cache → expr → expr → ℚ → ℕ → tactic (instance_cache × expr × expr)
prove_clear_denom' prove_ne_zero
def
norm_num.prove_clear_denom
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` nonnegative rational and `d` a natural number, returns `(b, ⊢ a * d = b)`. (`d` should be a multiple of the denominator of `a`, so that `b` is a natural number.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_add {α} [division_ring α] (a a' b b' c c' d : α) (h₀ : d ≠ 0) (ha : a * d = a') (hb : b * d = b') (hc : c * d = c') (h : a' + b' = c') : a + b = c
mul_right_cancel₀ h₀ $ by rwa [add_mul, ha, hb, hc]
theorem
norm_num.clear_denom_add
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "mul_right_cancel₀" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_add_nonneg_rat (ic : instance_cache) (a b c : expr) (na nb nc : ℚ) : tactic (instance_cache × expr)
if na.denom = 1 ∧ nb.denom = 1 then prove_add_nat ic a b c else do let nd := na.denom.lcm nb.denom, (ic, d) ← ic.of_nat nd, (ic, p₀) ← prove_ne_zero ic d nd, (ic, a', pa) ← prove_clear_denom ic a d na nd, (ic, b', pb) ← prove_clear_denom ic b d nb nd, (ic, c', pc) ← prove_clear_denom ic c d nc nd, (ic, ...
def
norm_num.prove_add_nonneg_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b`,`c` nonnegative rational numerals, returns `⊢ a + b = c`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_pos_neg_pos {α} [add_group α] (a b c : α) (h : c + b = a) : a + -b = c
h ▸ by simp
theorem
norm_num.add_pos_neg_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_pos_neg_neg {α} [add_group α] (a b c : α) (h : c + a = b) : a + -b = -c
h ▸ by simp
theorem
norm_num.add_pos_neg_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_neg_pos_pos {α} [add_group α] (a b c : α) (h : a + c = b) : -a + b = c
h ▸ by simp
theorem
norm_num.add_neg_pos_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_neg_pos_neg {α} [add_group α] (a b c : α) (h : b + c = a) : -a + b = -c
h ▸ by simp
theorem
norm_num.add_neg_pos_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
add_neg_neg {α} [add_group α] (a b c : α) (h : b + a = c) : -a + -b = -c
h ▸ by simp
theorem
norm_num.add_neg_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "add_group" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_add_rat (ic : instance_cache) (ea eb ec : expr) (a b c : ℚ) : tactic (instance_cache × expr)
match match_neg ea, match_neg eb, match_neg ec with | some ea, some eb, some ec := do (ic, p) ← prove_add_nonneg_rat ic eb ea ec (-b) (-a) (-c), ic.mk_app ``add_neg_neg [ea, eb, ec, p] | some ea, none, some ec := do (ic, p) ← prove_add_nonneg_rat ic eb ec ea b (-c) (-a), ic.mk_app ``add_neg_pos_neg [ea, eb, ec,...
def
norm_num.prove_add_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b`,`c` rational numerals, returns `⊢ a + b = c`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_add_rat' (ic : instance_cache) (a b : expr) : tactic (instance_cache × expr × expr)
do na ← a.to_rat, nb ← b.to_rat, let nc := na + nb, (ic, c) ← ic.of_rat nc, (ic, p) ← prove_add_rat ic a b c na nb nc, return (ic, c, p)
def
norm_num.prove_add_rat'
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` rational numerals, returns `(c, ⊢ a + b = c)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_simple_nat {α} [division_ring α] (a : α) : (1:α) ≠ 0 ∧ a * 1 = a
⟨one_ne_zero, mul_one _⟩
theorem
norm_num.clear_denom_simple_nat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "mul_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_simple_div {α} [division_ring α] (a b : α) (h : b ≠ 0) : b ≠ 0 ∧ a / b * b = a
⟨h, div_mul_cancel _ h⟩
theorem
norm_num.clear_denom_simple_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "div_mul_cancel", "division_ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_clear_denom_simple (c : instance_cache) (a : expr) (na : ℚ) : tactic (instance_cache × expr × expr × expr)
if na.denom = 1 then do (c, d) ← c.mk_app ``has_one.one [], (c, p) ← c.mk_app ``clear_denom_simple_nat [a], return (c, d, a, p) else do [α, _, a, b] ← return a.get_app_args, (c, p₀) ← prove_ne_zero c b na.denom, (c, p) ← c.mk_app ``clear_denom_simple_div [a, b, p₀], return (c, b, a, p)
def
norm_num.prove_clear_denom_simple
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a` a nonnegative rational numeral, returns `(b, c, ⊢ a * b = c)` where `b` and `c` are natural numerals. (`b` will be the denominator of `a`.)
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
clear_denom_mul {α} [field α] (a a' b b' c c' d₁ d₂ d : α) (ha : d₁ ≠ 0 ∧ a * d₁ = a') (hb : d₂ ≠ 0 ∧ b * d₂ = b') (hc : c * d = c') (hd : d₁ * d₂ = d) (h : a' * b' = c') : a * b = c
mul_right_cancel₀ ha.1 $ mul_right_cancel₀ hb.1 $ by rw [mul_assoc c, hd, hc, ← h, ← ha.2, ← hb.2, ← mul_assoc, mul_right_comm a]
theorem
norm_num.clear_denom_mul
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "field", "mul_assoc", "mul_right_cancel₀", "mul_right_comm" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_mul_nonneg_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr × expr)
if na.denom = 1 ∧ nb.denom = 1 then prove_mul_nat ic a b else do let nc := na * nb, (ic, c) ← ic.of_rat nc, (ic, d₁, a', pa) ← prove_clear_denom_simple ic a na, (ic, d₂, b', pb) ← prove_clear_denom_simple ic b nb, (ic, d, pd) ← prove_mul_nat ic d₁ d₂, nd ← d.to_nat, (ic, c', pc) ← prove_clear_denom ic c d n...
def
norm_num.prove_mul_nonneg_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` nonnegative rational numerals, returns `(c, ⊢ a * b = c)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_neg_pos {α} [ring α] (a b c : α) (h : a * b = c) : -a * b = -c
h ▸ by simp
theorem
norm_num.mul_neg_pos
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_pos_neg {α} [ring α] (a b c : α) (h : a * b = c) : a * -b = -c
h ▸ by simp
theorem
norm_num.mul_pos_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
mul_neg_neg {α} [ring α] (a b c : α) (h : a * b = c) : -a * -b = c
h ▸ by simp
theorem
norm_num.mul_neg_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_mul_rat (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr × expr)
match match_sign a, match_sign b with | sum.inl a, sum.inl b := do (ic, c, p) ← prove_mul_nonneg_rat ic a b (-na) (-nb), (ic, p) ← ic.mk_app ``mul_neg_neg [a, b, c, p], return (ic, c, p) | sum.inr ff, _ := do (ic, z) ← ic.mk_app ``has_zero.zero [], (ic, p) ← ic.mk_app ``zero_mul [b], return (ic, z, p) | _, ...
def
norm_num.prove_mul_rat
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "mul_zero", "zero_mul" ]
Given `a`,`b` rational numerals, returns `(c, ⊢ a * b = c)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_neg {α} [division_ring α] (a b : α) (h : a⁻¹ = b) : (-a)⁻¹ = -b
h ▸ by simp only [inv_eq_one_div, one_div_neg_eq_neg_one_div]
theorem
norm_num.inv_neg
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "inv_eq_one_div", "inv_neg", "one_div_neg_eq_neg_one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_one {α} [division_ring α] : (1 : α)⁻¹ = 1
inv_one
theorem
norm_num.inv_one
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "inv_one" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_one_div {α} [division_ring α] (a : α) : (1 / a)⁻¹ = a
by rw [one_div, inv_inv]
theorem
norm_num.inv_one_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "inv_inv", "one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_div_one {α} [division_ring α] (a : α) : a⁻¹ = 1 / a
inv_eq_one_div _
theorem
norm_num.inv_div_one
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "inv_eq_one_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
inv_div {α} [division_ring α] (a b : α) : (a / b)⁻¹ = b / a
by simp only [inv_eq_one_div, one_div_div]
theorem
norm_num.inv_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "division_ring", "inv_div", "inv_eq_one_div", "one_div_div" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_inv : instance_cache → expr → ℚ → tactic (instance_cache × expr × expr)
| ic e n := match match_sign e with | sum.inl e := do (ic, e', p) ← prove_inv ic e (-n), (ic, r) ← ic.mk_app ``has_neg.neg [e'], (ic, p) ← ic.mk_app ``inv_neg [e, e', p], return (ic, r, p) | sum.inr ff := do (ic, p) ← ic.mk_app ``inv_zero [], return (ic, e, p) | sum.inr tt := if n.nu...
def
norm_num.prove_inv
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "inv_div", "inv_neg", "inv_one", "inv_zero" ]
Given `a` a rational numeral, returns `(b, ⊢ a⁻¹ = b)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
div_eq {α} [division_ring α] (a b b' c : α) (hb : b⁻¹ = b') (h : a * b' = c) : a / b = c
by rwa [ ← hb, ← div_eq_mul_inv] at h
theorem
norm_num.div_eq
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[ "div_eq_mul_inv", "division_ring" ]
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83
prove_div (ic : instance_cache) (a b : expr) (na nb : ℚ) : tactic (instance_cache × expr × expr)
do (ic, b', pb) ← prove_inv ic b nb, (ic, c, p) ← prove_mul_rat ic a b' na nb⁻¹, (ic, p) ← ic.mk_app ``div_eq [a, b, b', c, pb, p], return (ic, c, p)
def
norm_num.prove_div
tactic
src/tactic/norm_num.lean
[ "data.rat.cast", "data.rat.meta_defs", "data.int.lemmas" ]
[]
Given `a`,`b` rational numerals, returns `(c, ⊢ a / b = c)`.
https://github.com/leanprover-community/mathlib
65a1391a0106c9204fe45bc73a039f056558cb83