# HG changeset patch # User haftmann # Date 1455742317 -3600 # Node ID 2230b70473767df9bd594215df7ea49c0fe6c92b # Parent 97f2ed2404314092d21d525f6d75581ad5aa8906 generalized some lemmas; moved some lemmas in more appropriate places; deleted potentially dangerous simp rule diff -r 97f2ed240431 -r 2230b7047376 NEWS --- a/NEWS Wed Feb 17 21:51:56 2016 +0100 +++ b/NEWS Wed Feb 17 21:51:57 2016 +0100 @@ -37,6 +37,11 @@ * Class semiring_Lcd merged into semiring_Gcd. INCOMPATIBILITY. +* Lemma generalization: + realpow_minus_mult ~> power_minus_mult + realpow_Suc_le_self ~> power_Suc_le_self +INCOMPATIBILITY. + New in Isabelle2016 (February 2016) ----------------------------------- diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Algebra/Coset.thy --- a/src/HOL/Algebra/Coset.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Algebra/Coset.thy Wed Feb 17 21:51:57 2016 +0100 @@ -936,18 +936,6 @@ thus ?thesis by (auto simp add: g) qed -lemma the_elem_image_unique: -- {* FIXME move *} - assumes "A \ {}" - assumes *: "\y. y \ A \ f y = f x" - shows "the_elem (f ` A) = f x" -unfolding the_elem_def proof (rule the1_equality) - from `A \ {}` obtain y where "y \ A" by auto - with * have "f x = f y" by simp - with `y \ A` have "f x \ f ` A" by blast - with * show "f ` A = {f x}" by auto - then show "\!x. f ` A = {x}" by auto -qed - lemma (in group_hom) FactGroup_hom: "(\X. the_elem (h`X)) \ hom (G Mod (kernel G H h)) H" apply (simp add: hom_def FactGroup_the_elem_mem normal.factorgroup_is_group [OF normal_kernel] group.axioms monoid.m_closed) diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Binomial.thy --- a/src/HOL/Binomial.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Binomial.thy Wed Feb 17 21:51:57 2016 +0100 @@ -25,9 +25,19 @@ lemma fact_Suc_0 [simp]: "fact (Suc 0) = Suc 0" by simp -lemma of_nat_fact [simp]: "of_nat (fact n) = fact n" +lemma of_nat_fact [simp]: + "of_nat (fact n) = fact n" by (induct n) (auto simp add: algebra_simps of_nat_mult) +lemma of_int_fact [simp]: + "of_int (fact n) = fact n" +proof - + have "of_int (of_nat (fact n)) = fact n" + unfolding of_int_of_nat_eq by simp + then show ?thesis + by simp +qed + lemma fact_reduce: "n > 0 \ fact n = of_nat n * fact (n - 1)" by (cases n) auto diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Fields.thy --- a/src/HOL/Fields.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Fields.thy Wed Feb 17 21:51:57 2016 +0100 @@ -1152,6 +1152,10 @@ lemma divide_le_0_abs_iff [simp]: "(a / \b\ \ 0) = (a \ 0 | b = 0)" by (auto simp: divide_le_0_iff) +lemma inverse_sgn: + "sgn (inverse a) = inverse (sgn a)" + by (simp add: sgn_if) + lemma field_le_mult_one_interval: assumes *: "\z. \ 0 < z ; z < 1 \ \ z * x \ y" shows "x \ y" diff -r 97f2ed240431 -r 2230b7047376 src/HOL/GCD.thy --- a/src/HOL/GCD.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/GCD.thy Wed Feb 17 21:51:57 2016 +0100 @@ -2057,9 +2057,6 @@ text \Fact aliasses\ -lemma dvd_int_iff: "x dvd y \ nat \x\ dvd nat \y\" - by (fact dvd_int_unfold_dvd_nat) - lemmas gcd_assoc_nat = gcd.assoc [where ?'a = nat] lemmas gcd_assoc_int = gcd.assoc [where ?'a = int] lemmas gcd_commute_nat = gcd.commute [where ?'a = nat] diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Groups.thy --- a/src/HOL/Groups.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Groups.thy Wed Feb 17 21:51:57 2016 +0100 @@ -1382,7 +1382,6 @@ lemmas ab_left_minus = left_minus \ \FIXME duplicate\ lemmas diff_diff_eq = diff_diff_add \ \FIXME duplicate\ - subsection \Tools setup\ lemma add_mono_thms_linordered_semiring: diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Int.thy --- a/src/HOL/Int.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Int.thy Wed Feb 17 21:51:57 2016 +0100 @@ -190,6 +190,21 @@ apply arith done +lemma zabs_less_one_iff [simp]: + fixes z :: int + shows "\z\ < 1 \ z = 0" (is "?P \ ?Q") +proof + assume ?Q then show ?P by simp +next + assume ?P + with zless_imp_add1_zle [of "\z\" 1] have "\z\ + 1 \ 1" + by simp + then have "\z\ \ 0" + by simp + then show ?Q + by simp +qed + lemmas int_distrib = distrib_right [of z1 z2 w] distrib_left [of w z1 z2] @@ -320,6 +335,45 @@ lemma of_int_nonneg: "z \ 0 \ of_int z \ 0" by simp +lemma of_int_abs [simp]: + "of_int \x\ = \of_int x\" + by (auto simp add: abs_if) + +lemma of_int_lessD: + assumes "\of_int n\ < x" + shows "n = 0 \ x > 1" +proof (cases "n = 0") + case True then show ?thesis by simp +next + case False + then have "\n\ \ 0" by simp + then have "\n\ > 0" by simp + then have "\n\ \ 1" + using zless_imp_add1_zle [of 0 "\n\"] by simp + then have "\of_int n\ \ 1" + unfolding of_int_1_le_iff [of "\n\", symmetric] by simp + then have "1 < x" using assms by (rule le_less_trans) + then show ?thesis .. +qed + +lemma of_int_leD: + assumes "\of_int n\ \ x" + shows "n = 0 \ 1 \ x" +proof (cases "n = 0") + case True then show ?thesis by simp +next + case False + then have "\n\ \ 0" by simp + then have "\n\ > 0" by simp + then have "\n\ \ 1" + using zless_imp_add1_zle [of 0 "\n\"] by simp + then have "\of_int n\ \ 1" + unfolding of_int_1_le_iff [of "\n\", symmetric] by simp + then have "1 \ x" using assms by (rule order_trans) + then show ?thesis .. +qed + + end text \Comparisons involving @{term of_int}.\ @@ -1152,9 +1206,6 @@ subsection\Products and 1, by T. M. Rasmussen\ -lemma zabs_less_one_iff [simp]: "(\z\ < 1) = (z = (0::int))" -by arith - lemma abs_zmult_eq_1: assumes mn: "\m * n\ = 1" shows "\m\ = (1::int)" diff -r 97f2ed240431 -r 2230b7047376 src/HOL/NthRoot.thy --- a/src/HOL/NthRoot.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/NthRoot.thy Wed Feb 17 21:51:57 2016 +0100 @@ -10,17 +10,6 @@ imports Deriv Binomial begin -lemma abs_sgn_eq: "\sgn x :: real\ = (if x = 0 then 0 else 1)" - by (simp add: sgn_real_def) - -lemma inverse_sgn: "sgn (inverse a) = inverse (sgn a :: real)" - by (simp add: sgn_real_def) - -lemma power_eq_iff_eq_base: - fixes a b :: "_ :: linordered_semidom" - shows "0 < n \ 0 \ a \ 0 \ b \ a ^ n = b ^ n \ a = b" - using power_eq_imp_eq_base[of a n b] by auto - subsection \Existence of Nth Root\ text \Existence follows from the Intermediate Value Theorem\ diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Power.thy --- a/src/HOL/Power.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Power.thy Wed Feb 17 21:51:57 2016 +0100 @@ -9,19 +9,6 @@ imports Num Equiv_Relations begin -context linordered_ring (* TODO: move *) -begin - -lemma sum_squares_ge_zero: - "0 \ x * x + y * y" - by (intro add_nonneg_nonneg zero_le_square) - -lemma not_sum_squares_lt_zero: - "\ x * x + y * y < 0" - by (simp add: not_less sum_squares_ge_zero) - -end - subsection \Powers for Arbitrary Monoids\ class power = one + times @@ -123,6 +110,10 @@ finally show ?case . qed simp +lemma power_minus_mult: + "0 < n \ a ^ (n - 1) * a = a ^ n" + by (simp add: power_commutes split add: nat_diff_split) + end context comm_monoid_mult @@ -584,6 +575,10 @@ "a ^ n = b ^ n \ 0 \ a \ 0 \ b \ 0 < n \ a = b" by (cases n) (simp_all del: power_Suc, rule power_inject_base) +lemma power_eq_iff_eq_base: + "0 < n \ 0 \ a \ 0 \ b \ a ^ n = b ^ n \ a = b" + using power_eq_imp_eq_base [of a n b] by auto + lemma power2_le_imp_le: "x\<^sup>2 \ y\<^sup>2 \ 0 \ y \ x \ y" unfolding numeral_2_eq_2 by (rule power_le_imp_le_base) @@ -596,6 +591,10 @@ "x\<^sup>2 = y\<^sup>2 \ 0 \ x \ 0 \ y \ x = y" unfolding numeral_2_eq_2 by (erule (2) power_eq_imp_eq_base) simp +lemma power_Suc_le_self: + shows "0 \ a \ a \ 1 \ a ^ Suc n \ a" + using power_decreasing [of 1 "Suc n" a] by simp + end context linordered_ring_strict diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Real.thy --- a/src/HOL/Real.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Real.thy Wed Feb 17 21:51:57 2016 +0100 @@ -1037,9 +1037,6 @@ declare of_int_1_less_iff [algebra, presburger] declare of_int_1_le_iff [algebra, presburger] -lemma of_int_abs [simp]: "of_int \x\ = (\of_int x\ :: 'a::linordered_idom)" - by (auto simp add: abs_if) - lemma int_less_real_le: "(n < m) = (real_of_int n + 1 <= real_of_int m)" proof - have "(0::real) \ 1" @@ -1309,22 +1306,9 @@ subsection \Lemmas about powers\ -(* used by Import/HOL/real.imp *) lemma two_realpow_ge_one: "(1::real) \ 2 ^ n" by simp -text \FIXME: no longer real-specific; rename and move elsewhere\ -lemma realpow_Suc_le_self: - fixes r :: "'a::linordered_semidom" - shows "[| 0 \ r; r \ 1 |] ==> r ^ Suc n \ r" -by (insert power_decreasing [of 1 "Suc n" r], simp) - -text \FIXME: no longer real-specific; rename and move elsewhere\ -lemma realpow_minus_mult: - fixes x :: "'a::monoid_mult" - shows "0 < n \ x ^ (n - 1) * x = x ^ n" -by (simp add: power_Suc power_commutes split add: nat_diff_split) - text \FIXME: declare this [simp] for all types, or not at all\ declare sum_squares_eq_zero_iff [simp] sum_power2_eq_zero_iff [simp] diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Real_Vector_Spaces.thy Wed Feb 17 21:51:57 2016 +0100 @@ -9,9 +9,6 @@ imports Real Topological_Spaces begin -lemma (in ordered_ab_group_add) diff_ge_0_iff_ge [simp]: "a - b \ 0 \ a \ b" - by (simp add: le_diff_eq) - subsection \Locale for additive functions\ locale additive = diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Rings.thy --- a/src/HOL/Rings.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Rings.thy Wed Feb 17 21:51:57 2016 +0100 @@ -1562,6 +1562,14 @@ proposition abs_eq_iff: "\x\ = \y\ \ x = y \ x = -y" by (auto simp add: abs_if split: split_if_asm) +lemma sum_squares_ge_zero: + "0 \ x * x + y * y" + by (intro add_nonneg_nonneg zero_le_square) + +lemma not_sum_squares_lt_zero: + "\ x * x + y * y < 0" + by (simp add: not_less sum_squares_ge_zero) + end class linordered_ring_strict = ring + linordered_semiring_strict @@ -1867,6 +1875,10 @@ "sgn a < 0 \ a < 0" unfolding sgn_if by auto +lemma abs_sgn_eq: + "\sgn a\ = (if a = 0 then 0 else 1)" + by (simp add: sgn_if) + lemma abs_dvd_iff [simp]: "\m\ dvd k \ m dvd k" by (simp add: abs_if) diff -r 97f2ed240431 -r 2230b7047376 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Wed Feb 17 21:51:56 2016 +0100 +++ b/src/HOL/Transcendental.thy Wed Feb 17 21:51:57 2016 +0100 @@ -29,27 +29,15 @@ qed -lemma of_int_leD: - fixes x :: "'a :: linordered_idom" - shows "\of_int n\ \ x \ n=0 \ x\1" - by (metis (no_types) le_less_trans not_less of_int_abs of_int_less_1_iff zabs_less_one_iff) - -lemma of_int_lessD: - fixes x :: "'a :: linordered_idom" - shows "\of_int n\ < x \ n=0 \ x>1" - by (metis less_le_trans not_less of_int_abs of_int_less_1_iff zabs_less_one_iff) - -lemma fact_in_Reals: "fact n \ \" by (induction n) auto +lemma fact_in_Reals: "fact n \ \" + by (induction n) auto + +lemma of_real_fact [simp]: "of_real (fact n) = fact n" + by (metis of_nat_fact of_real_of_nat_eq) lemma pochhammer_of_real: "pochhammer (of_real x) n = of_real (pochhammer x n)" by (simp add: pochhammer_def) -lemma of_real_fact [simp]: "of_real (fact n) = fact n" - by (metis of_nat_fact of_real_of_nat_eq) - -lemma of_int_fact [simp]: "of_int (fact n :: int) = fact n" - by (metis of_int_of_nat_eq of_nat_fact) - lemma norm_fact [simp]: "norm (fact n :: 'a :: {real_normed_algebra_1}) = fact n" proof -