169 by simp |
169 by simp |
170 |
170 |
171 text \<open>It looks plausible as a simprule, but its effect can be strange.\<close> |
171 text \<open>It looks plausible as a simprule, but its effect can be strange.\<close> |
172 lemma power_0_left: "0 ^ n = (if n = 0 then 1 else 0)" |
172 lemma power_0_left: "0 ^ n = (if n = 0 then 1 else 0)" |
173 by (cases n) simp_all |
173 by (cases n) simp_all |
|
174 |
|
175 end |
|
176 |
|
177 context semiring_char_0 begin |
|
178 |
|
179 lemma numeral_power_eq_of_nat_cancel_iff [simp]: |
|
180 "numeral x ^ n = of_nat y \<longleftrightarrow> numeral x ^ n = y" |
|
181 using of_nat_eq_iff by fastforce |
|
182 |
|
183 lemma real_of_nat_eq_numeral_power_cancel_iff [simp]: |
|
184 "of_nat y = numeral x ^ n \<longleftrightarrow> y = numeral x ^ n" |
|
185 using numeral_power_eq_of_nat_cancel_iff [of x n y] by (metis (mono_tags)) |
|
186 |
|
187 lemma of_nat_eq_of_nat_power_cancel_iff[simp]: "(of_nat b) ^ w = of_nat x \<longleftrightarrow> b ^ w = x" |
|
188 by (metis of_nat_power of_nat_eq_iff) |
|
189 |
|
190 lemma of_nat_power_eq_of_nat_cancel_iff[simp]: "of_nat x = (of_nat b) ^ w \<longleftrightarrow> x = b ^ w" |
|
191 by (metis of_nat_eq_of_nat_power_cancel_iff) |
174 |
192 |
175 end |
193 end |
176 |
194 |
177 context comm_semiring_1 |
195 context comm_semiring_1 |
178 begin |
196 begin |
565 |
583 |
566 lemma power2_eq_iff_nonneg [simp]: |
584 lemma power2_eq_iff_nonneg [simp]: |
567 assumes "0 \<le> x" "0 \<le> y" |
585 assumes "0 \<le> x" "0 \<le> y" |
568 shows "(x ^ 2 = y ^ 2) \<longleftrightarrow> x = y" |
586 shows "(x ^ 2 = y ^ 2) \<longleftrightarrow> x = y" |
569 using assms power2_eq_imp_eq by blast |
587 using assms power2_eq_imp_eq by blast |
|
588 |
|
589 lemma of_nat_less_numeral_power_cancel_iff[simp]: |
|
590 "of_nat x < numeral i ^ n \<longleftrightarrow> x < numeral i ^ n" |
|
591 using of_nat_less_iff[of x "numeral i ^ n", unfolded of_nat_numeral of_nat_power] . |
|
592 |
|
593 lemma of_nat_le_numeral_power_cancel_iff[simp]: |
|
594 "of_nat x \<le> numeral i ^ n \<longleftrightarrow> x \<le> numeral i ^ n" |
|
595 using of_nat_le_iff[of x "numeral i ^ n", unfolded of_nat_numeral of_nat_power] . |
|
596 |
|
597 lemma numeral_power_less_of_nat_cancel_iff[simp]: |
|
598 "numeral i ^ n < of_nat x \<longleftrightarrow> numeral i ^ n < x" |
|
599 using of_nat_less_iff[of "numeral i ^ n" x, unfolded of_nat_numeral of_nat_power] . |
|
600 |
|
601 lemma numeral_power_le_of_nat_cancel_iff[simp]: |
|
602 "numeral i ^ n \<le> of_nat x \<longleftrightarrow> numeral i ^ n \<le> x" |
|
603 using of_nat_le_iff[of "numeral i ^ n" x, unfolded of_nat_numeral of_nat_power] . |
|
604 |
|
605 lemma of_nat_le_of_nat_power_cancel_iff[simp]: "(of_nat b) ^ w \<le> of_nat x \<longleftrightarrow> b ^ w \<le> x" |
|
606 by (metis of_nat_le_iff of_nat_power) |
|
607 |
|
608 lemma of_nat_power_le_of_nat_cancel_iff[simp]: "of_nat x \<le> (of_nat b) ^ w \<longleftrightarrow> x \<le> b ^ w" |
|
609 by (metis of_nat_le_iff of_nat_power) |
|
610 |
|
611 lemma of_nat_less_of_nat_power_cancel_iff[simp]: "(of_nat b) ^ w < of_nat x \<longleftrightarrow> b ^ w < x" |
|
612 by (metis of_nat_less_iff of_nat_power) |
|
613 |
|
614 lemma of_nat_power_less_of_nat_cancel_iff[simp]: "of_nat x < (of_nat b) ^ w \<longleftrightarrow> x < b ^ w" |
|
615 by (metis of_nat_less_iff of_nat_power) |
570 |
616 |
571 end |
617 end |
572 |
618 |
573 context linordered_ring_strict |
619 context linordered_ring_strict |
574 begin |
620 begin |