@@ -14,55 +14,57 @@ This file collects basic facts about the operation of raising an element of a `d
14
14
integer power. More specialised results are provided in the case of a linearly ordered field.
15
15
-/
16
16
17
- universe u
17
+ open function int
18
18
19
- @[simp] lemma ring_hom.map_zpow {K L : Type *} [division_ring K] [division_ring L] (f : K →+* L) :
20
- ∀ (a : K) (n : ℤ), f (a ^ n) = f a ^ n :=
19
+ variables {α β : Type *}
20
+
21
+ section division_ring
22
+ variables [division_ring α] [division_ring β]
23
+
24
+ @[simp] lemma ring_hom.map_zpow (f : α →+* β) : ∀ (a : α) (n : ℤ), f (a ^ n) = f a ^ n :=
21
25
f.to_monoid_with_zero_hom.map_zpow
22
26
23
- @[simp] lemma ring_equiv.map_zpow {K L : Type *} [division_ring K] [division_ring L] (f : K ≃+* L) :
24
- ∀ (a : K) (n : ℤ), f (a ^ n) = f a ^ n :=
27
+ @[simp] lemma ring_equiv.map_zpow (f : α ≃+* β) : ∀ (a : α) (n : ℤ), f (a ^ n) = f a ^ n :=
25
28
f.to_ring_hom.map_zpow
26
29
27
- @[simp] lemma zpow_bit1_neg {K : Type *} [division_ring K] (x : K) (n : ℤ) :
28
- (-x) ^ (bit1 n) = - x ^ bit1 n :=
30
+ @[simp] lemma zpow_bit1_neg (x : α) (n : ℤ) : (-x) ^ bit1 n = - x ^ bit1 n :=
29
31
by rw [zpow_bit1', zpow_bit1', neg_mul_neg, neg_mul_eq_mul_neg]
30
32
31
- section ordered_field_power
32
- open int
33
+ @[simp, norm_cast] lemma rat.cast_zpow [char_zero α] (q : ℚ) (n : ℤ) : ((q ^ n : ℚ) : α) = q ^ n :=
34
+ (rat.cast_hom α).map_zpow q n
33
35
34
- variables {K : Type u} [linear_ordered_field K] {a : K} {n : ℤ}
36
+ end division_ring
35
37
36
- lemma zpow_nonneg {a : K} (ha : 0 ≤ a) : ∀ (z : ℤ), 0 ≤ a ^ z
38
+ section linear_ordered_semifield
39
+ variables [linear_ordered_semifield α] {a b x : α} {m n : ℤ}
40
+
41
+ lemma zpow_nonneg (ha : 0 ≤ a) : ∀ (z : ℤ), 0 ≤ a ^ z
37
42
| (n : ℕ) := by { rw zpow_coe_nat, exact pow_nonneg ha _ }
38
43
| -[1 +n] := by { rw zpow_neg_succ_of_nat, exact inv_nonneg.2 (pow_nonneg ha _) }
39
44
40
- lemma zpow_pos_of_pos {a : K} (ha : 0 < a) : ∀ (z : ℤ), 0 < a ^ z
45
+ lemma zpow_pos_of_pos (ha : 0 < a) : ∀ (z : ℤ), 0 < a ^ z
41
46
| (n : ℕ) := by { rw zpow_coe_nat, exact pow_pos ha _ }
42
47
| -[1 +n] := by { rw zpow_neg_succ_of_nat, exact inv_pos.2 (pow_pos ha _) }
43
48
44
- lemma zpow_le_of_le {x : K} (hx : 1 ≤ x) {a b : ℤ} (h : a ≤ b ) : x ^ a ≤ x ^ b :=
49
+ lemma zpow_le_of_le (ha : 1 ≤ a) (h : m ≤ n ) : a ^ m ≤ a ^ n :=
45
50
begin
46
- induction a with a a ; induction b with b b ,
51
+ induction m with m m ; induction n with n n ,
47
52
{ simp only [of_nat_eq_coe, zpow_coe_nat],
48
- apply pow_le_pow hx,
49
- apply le_of_coe_nat_le_coe_nat h },
50
- { apply absurd h,
51
- apply not_le_of_gt,
52
- exact lt_of_lt_of_le (neg_succ_lt_zero _) (of_nat_nonneg _) },
53
+ exact pow_le_pow ha (le_of_coe_nat_le_coe_nat h) },
54
+ { cases h.not_lt ((neg_succ_lt_zero _).trans_le $ of_nat_nonneg _) },
53
55
{ simp only [zpow_neg_succ_of_nat, one_div, of_nat_eq_coe, zpow_coe_nat],
54
- apply le_trans (inv_le_one _); apply one_le_pow_of_one_le hx },
56
+ apply le_trans (inv_le_one _); apply one_le_pow_of_one_le ha },
55
57
{ simp only [zpow_neg_succ_of_nat],
56
58
apply (inv_le_inv _ _).2 ,
57
- { apply pow_le_pow hx ,
58
- have : -(↑(a +1 ) : ℤ) ≤ -(↑(b +1 ) : ℤ), from h,
59
+ { apply pow_le_pow ha ,
60
+ have : -(↑(m +1 ) : ℤ) ≤ -(↑(n +1 ) : ℤ), from h,
59
61
have h' := le_of_neg_le_neg this ,
60
62
apply le_of_coe_nat_le_coe_nat h' },
61
- repeat { apply pow_pos (lt_of_lt_of_le zero_lt_one hx ) } }
63
+ repeat { apply pow_pos (zero_lt_one.trans_le ha ) } }
62
64
end
63
65
64
- lemma pow_le_max_of_min_le {x : K} (hx : 1 ≤ x) {a b c : ℤ} (h : min a b ≤ c) :
65
- x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) :=
66
+ lemma pow_le_max_of_min_le (hx : 1 ≤ x) {a b c : ℤ} (h : min a b ≤ c) :
67
+ x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) :=
66
68
begin
67
69
wlog hle : a ≤ b,
68
70
have hnle : -b ≤ -a, from neg_le_neg hle,
@@ -73,104 +75,54 @@ begin
73
75
simpa only [max_eq_left hfle]
74
76
end
75
77
76
- lemma zpow_le_one_of_nonpos {p : K} (hp : 1 ≤ p) {z : ℤ} (hz : z ≤ 0 ) : p ^ z ≤ 1 :=
77
- calc p ^ z ≤ p ^ 0 : zpow_le_of_le hp hz
78
- ... = 1 : by simp
79
-
80
- lemma one_le_zpow_of_nonneg {p : K} (hp : 1 ≤ p) {z : ℤ} (hz : 0 ≤ z) : 1 ≤ p ^ z :=
81
- calc p ^ z ≥ p ^ 0 : zpow_le_of_le hp hz
82
- ... = 1 : by simp
83
-
84
- theorem zpow_bit0_nonneg (a : K) (n : ℤ) : 0 ≤ a ^ bit0 n :=
85
- by { rw zpow_bit0, exact mul_self_nonneg _ }
86
-
87
- theorem zpow_two_nonneg (a : K) : 0 ≤ a ^ (2 : ℤ) :=
88
- zpow_bit0_nonneg a 1
89
-
90
- theorem zpow_bit0_pos {a : K} (h : a ≠ 0 ) (n : ℤ) : 0 < a ^ bit0 n :=
91
- (zpow_bit0_nonneg a n).lt_of_ne (zpow_ne_zero _ h).symm
92
-
93
- theorem zpow_two_pos_of_ne_zero (a : K) (h : a ≠ 0 ) : 0 < a ^ (2 : ℤ) :=
94
- zpow_bit0_pos h 1
95
-
96
- @[simp] theorem zpow_bit1_neg_iff : a ^ bit1 n < 0 ↔ a < 0 :=
97
- ⟨λ h, not_le.1 $ λ h', not_le.2 h $ zpow_nonneg h' _,
98
- λ h, by rw [bit1, zpow_add_one₀ h.ne]; exact mul_neg_of_pos_of_neg (zpow_bit0_pos h.ne _) h⟩
78
+ lemma zpow_le_one_of_nonpos (ha : 1 ≤ a) (hn : n ≤ 0 ) : a ^ n ≤ 1 :=
79
+ (zpow_le_of_le ha hn).trans_eq $ zpow_zero _
99
80
100
- @[simp] theorem zpow_bit1_nonneg_iff : 0 ≤ a ^ bit1 n ↔ 0 ≤ a :=
101
- le_iff_le_iff_lt_iff_lt. 2 zpow_bit1_neg_iff
81
+ lemma one_le_zpow_of_nonneg (ha : 1 ≤ a) (hn : 0 ≤ n) : 1 ≤ a ^ n :=
82
+ (zpow_zero _).symm.trans_le $ zpow_le_of_le ha hn
102
83
103
- @[simp] theorem zpow_bit1_nonpos_iff : a ^ bit1 n ≤ 0 ↔ a ≤ 0 :=
104
- begin
105
- rw [le_iff_lt_or_eq, zpow_bit1_neg_iff],
106
- split,
107
- { rintro (h | h),
108
- { exact h.le },
109
- { exact (zpow_eq_zero h).le } },
110
- { intro h,
111
- rcases eq_or_lt_of_le h with rfl|h,
112
- { exact or.inr (zero_zpow _ (bit1_ne_zero n)) },
113
- { exact or.inl h } }
114
- end
115
-
116
- @[simp] theorem zpow_bit1_pos_iff : 0 < a ^ bit1 n ↔ 0 < a :=
117
- lt_iff_lt_of_le_iff_le zpow_bit1_nonpos_iff
84
+ protected lemma nat.zpow_pos_of_pos {a : ℕ} (h : 0 < a) (n : ℤ) : 0 < (a : α)^n :=
85
+ by { apply zpow_pos_of_pos, exact_mod_cast h }
118
86
119
- end ordered_field_power
87
+ lemma nat.zpow_ne_zero_of_pos {a : ℕ} (h : 0 < a) (n : ℤ) : (a : α)^n ≠ 0 :=
88
+ (nat.zpow_pos_of_pos h n).ne'
120
89
121
- lemma one_lt_zpow {K} [linear_ordered_field K] {p : K} (hp : 1 < p) :
122
- ∀ z : ℤ, 0 < z → 1 < p ^ z
123
- | (n : ℕ) h := (zpow_coe_nat p n).symm.subst (one_lt_pow hp $ int.coe_nat_ne_zero.mp h.ne')
90
+ lemma one_lt_zpow (ha : 1 < a) : ∀ n : ℤ, 0 < n → 1 < a ^ n
91
+ | (n : ℕ) h := (zpow_coe_nat _ _).symm.subst (one_lt_pow ha $ int.coe_nat_ne_zero.mp h.ne')
124
92
| -[1 + n] h := ((int.neg_succ_not_pos _).mp h).elim
125
93
126
- section ordered
127
- variables {K : Type *} [linear_ordered_field K]
128
-
129
- lemma nat.zpow_pos_of_pos {p : ℕ} (h : 0 < p) (n:ℤ) : 0 < (p:K)^n :=
130
- by { apply zpow_pos_of_pos, exact_mod_cast h }
131
-
132
- lemma nat.zpow_ne_zero_of_pos {p : ℕ} (h : 0 < p) (n:ℤ) : (p:K)^n ≠ 0 :=
133
- ne_of_gt (nat.zpow_pos_of_pos h n)
134
-
135
- lemma zpow_strict_mono {x : K} (hx : 1 < x) :
136
- strict_mono (λ n:ℤ, x ^ n) :=
94
+ lemma zpow_strict_mono (hx : 1 < x) : strict_mono ((^) x : ℤ → α) :=
137
95
strict_mono_int_of_lt_succ $ λ n,
138
96
have xpos : 0 < x, from zero_lt_one.trans hx,
139
97
calc x ^ n < x ^ n * x : lt_mul_of_one_lt_right (zpow_pos_of_pos xpos _) hx
140
98
... = x ^ (n + 1 ) : (zpow_add_one₀ xpos.ne' _).symm
141
99
142
- lemma zpow_strict_anti {x : K} (h₀ : 0 < x) (h₁ : x < 1 ) : strict_anti (λ n : ℤ, x ^ n ) :=
100
+ lemma zpow_strict_anti (h₀ : 0 < x) (h₁ : x < 1 ) : strict_anti ((^) x : ℤ → α ) :=
143
101
strict_anti_int_of_succ_lt $ λ n,
144
102
calc x ^ (n + 1 ) = x ^ n * x : zpow_add_one₀ h₀.ne' _
145
103
... < x ^ n * 1 : (mul_lt_mul_left $ zpow_pos_of_pos h₀ _).2 h₁
146
104
... = x ^ n : mul_one _
147
105
148
- @[simp] lemma zpow_lt_iff_lt {x : K} (hx : 1 < x) {m n : ℤ} :
149
- x ^ m < x ^ n ↔ m < n :=
150
- (zpow_strict_mono hx).lt_iff_lt
106
+ @[simp] lemma zpow_lt_iff_lt (hx : 1 < x) : x ^ m < x ^ n ↔ m < n := (zpow_strict_mono hx).lt_iff_lt
107
+ @[simp] lemma zpow_le_iff_le (hx : 1 < x) : x ^ m ≤ x ^ n ↔ m ≤ n := (zpow_strict_mono hx).le_iff_le
151
108
152
- @[simp] lemma zpow_le_iff_le {x : K} (hx : 1 < x) {m n : ℤ} :
153
- x ^ m ≤ x ^ n ↔ m ≤ n :=
154
- (zpow_strict_mono hx).le_iff_le
155
-
156
- lemma min_le_of_zpow_le_max {x : K} (hx : 1 < x) {a b c : ℤ}
157
- (h_max : x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b)) ) : min a b ≤ c :=
109
+ lemma min_le_of_zpow_le_max (hx : 1 < x) {a b c : ℤ}
110
+ (h_max : x ^ (-c) ≤ max (x ^ (-a)) (x ^ (-b))) : min a b ≤ c :=
158
111
begin
159
112
rw min_le_iff,
160
113
refine or.imp (λ h, _) (λ h, _) (le_max_iff.mp h_max);
161
114
rwa [zpow_le_iff_le hx, neg_le_neg_iff] at h
162
115
end
163
116
164
- @[simp] lemma pos_div_pow_pos {a b : K} (ha : 0 < a) (hb : 0 < b) (k : ℕ) : 0 < a/b^k :=
117
+ @[simp] lemma pos_div_pow_pos (ha : 0 < a) (hb : 0 < b) (k : ℕ) : 0 < a/b^k :=
165
118
div_pos ha (pow_pos hb k)
166
119
167
- @[simp] lemma div_pow_le {a b : K} (ha : 0 < a) (hb : 1 ≤ b) (k : ℕ) : a/b^k ≤ a :=
120
+ @[simp] lemma div_pow_le (ha : 0 < a) (hb : 1 ≤ b) (k : ℕ) : a/b^k ≤ a :=
168
121
(div_le_iff $ pow_pos (lt_of_lt_of_le zero_lt_one hb) k).mpr
169
122
(calc a = a * 1 : (mul_one a).symm
170
123
... ≤ a*b^k : (mul_le_mul_left ha).mpr $ one_le_pow_of_one_le hb _)
171
124
172
- lemma zpow_injective {x : K} (h₀ : 0 < x) (h₁ : x ≠ 1 ) :
173
- function.injective ((^) x : ℤ → K) :=
125
+ lemma zpow_injective (h₀ : 0 < x) (h₁ : x ≠ 1 ) : injective ((^) x : ℤ → α) :=
174
126
begin
175
127
intros m n h,
176
128
rcases h₁.lt_or_lt with H|H,
@@ -181,17 +133,45 @@ begin
181
133
{ exact (zpow_strict_mono H).injective h, },
182
134
end
183
135
184
- @[simp] lemma zpow_inj {x : K} (h₀ : 0 < x) (h₁ : x ≠ 1 ) {m n : ℤ} :
185
- x ^ m = x ^ n ↔ m = n :=
136
+ @[simp] lemma zpow_inj (h₀ : 0 < x) (h₁ : x ≠ 1 ) : x ^ m = x ^ n ↔ m = n :=
186
137
(zpow_injective h₀ h₁).eq_iff
187
138
188
- end ordered
139
+ end linear_ordered_semifield
140
+
141
+ section linear_ordered_field
142
+ variables [linear_ordered_field α] {a x : α} {m n : ℤ}
143
+
144
+ lemma zpow_bit0_nonneg (a : α) (n : ℤ) : 0 ≤ a ^ bit0 n :=
145
+ (mul_self_nonneg _).trans_eq $ (zpow_bit0 _ _).symm
146
+
147
+ lemma zpow_two_nonneg (a : α) : 0 ≤ a ^ (2 : ℤ) := zpow_bit0_nonneg _ _
189
148
190
- section
191
- variables {K : Type *} [division_ring K]
149
+ lemma zpow_bit0_pos (h : a ≠ 0 ) (n : ℤ) : 0 < a ^ bit0 n :=
150
+ (zpow_bit0_nonneg a n).lt_of_ne (zpow_ne_zero _ h).symm
151
+
152
+ lemma zpow_two_pos_of_ne_zero (h : a ≠ 0 ) : 0 < a ^ (2 : ℤ) := zpow_bit0_pos h _
153
+
154
+ @[simp] theorem zpow_bit1_neg_iff : a ^ bit1 n < 0 ↔ a < 0 :=
155
+ ⟨λ h, not_le.1 $ λ h', not_le.2 h $ zpow_nonneg h' _,
156
+ λ h, by rw [bit1, zpow_add_one₀ h.ne]; exact mul_neg_of_pos_of_neg (zpow_bit0_pos h.ne _) h⟩
192
157
193
- @[simp, norm_cast] theorem rat.cast_zpow [char_zero K] (q : ℚ) (n : ℤ) :
194
- ((q ^ n : ℚ) : K) = q ^ n :=
195
- (rat.cast_hom K).map_zpow q n
158
+ @[simp] theorem zpow_bit1_nonneg_iff : 0 ≤ a ^ bit1 n ↔ 0 ≤ a :=
159
+ le_iff_le_iff_lt_iff_lt.2 zpow_bit1_neg_iff
196
160
161
+ @[simp] theorem zpow_bit1_nonpos_iff : a ^ bit1 n ≤ 0 ↔ a ≤ 0 :=
162
+ begin
163
+ rw [le_iff_lt_or_eq, zpow_bit1_neg_iff],
164
+ split,
165
+ { rintro (h | h),
166
+ { exact h.le },
167
+ { exact (zpow_eq_zero h).le } },
168
+ { intro h,
169
+ rcases eq_or_lt_of_le h with rfl|h,
170
+ { exact or.inr (zero_zpow _ (bit1_ne_zero n)) },
171
+ { exact or.inl h } }
197
172
end
173
+
174
+ @[simp] theorem zpow_bit1_pos_iff : 0 < a ^ bit1 n ↔ 0 < a :=
175
+ lt_iff_lt_of_le_iff_le zpow_bit1_nonpos_iff
176
+
177
+ end linear_ordered_field
0 commit comments