src/HOL/Library/Nonpos_Ints.thy
 author wenzelm Wed Mar 08 10:50:59 2017 +0100 (2017-03-08) changeset 65151 a7394aa4d21c parent 63092 a949b2a5f51d child 67135 1a94352812f4 permissions -rw-r--r--
tuned proofs;
```     1 (*  Title:    HOL/Library/Nonpos_Ints.thy
```
```     2     Author:   Manuel Eberl, TU München
```
```     3 *)
```
```     4
```
```     5 section \<open>Non-negative, non-positive integers and reals\<close>
```
```     6
```
```     7 theory Nonpos_Ints
```
```     8 imports Complex_Main
```
```     9 begin
```
```    10
```
```    11 subsection\<open>Non-positive integers\<close>
```
```    12 text \<open>
```
```    13   The set of non-positive integers on a ring. (in analogy to the set of non-negative
```
```    14   integers @{term "\<nat>"}) This is useful e.g. for the Gamma function.
```
```    15 \<close>
```
```    16
```
```    17 definition nonpos_Ints ("\<int>\<^sub>\<le>\<^sub>0") where "\<int>\<^sub>\<le>\<^sub>0 = {of_int n |n. n \<le> 0}"
```
```    18
```
```    19 lemma zero_in_nonpos_Ints [simp,intro]: "0 \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    20   unfolding nonpos_Ints_def by (auto intro!: exI[of _ "0::int"])
```
```    21
```
```    22 lemma neg_one_in_nonpos_Ints [simp,intro]: "-1 \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    23   unfolding nonpos_Ints_def by (auto intro!: exI[of _ "-1::int"])
```
```    24
```
```    25 lemma neg_numeral_in_nonpos_Ints [simp,intro]: "-numeral n \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    26   unfolding nonpos_Ints_def by (auto intro!: exI[of _ "-numeral n::int"])
```
```    27
```
```    28 lemma one_notin_nonpos_Ints [simp]: "(1 :: 'a :: ring_char_0) \<notin> \<int>\<^sub>\<le>\<^sub>0"
```
```    29   by (auto simp: nonpos_Ints_def)
```
```    30
```
```    31 lemma numeral_notin_nonpos_Ints [simp]: "(numeral n :: 'a :: ring_char_0) \<notin> \<int>\<^sub>\<le>\<^sub>0"
```
```    32   by (auto simp: nonpos_Ints_def)
```
```    33
```
```    34 lemma minus_of_nat_in_nonpos_Ints [simp, intro]: "- of_nat n \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    35 proof -
```
```    36   have "- of_nat n = of_int (-int n)" by simp
```
```    37   also have "-int n \<le> 0" by simp
```
```    38   hence "of_int (-int n) \<in> \<int>\<^sub>\<le>\<^sub>0" unfolding nonpos_Ints_def by blast
```
```    39   finally show ?thesis .
```
```    40 qed
```
```    41
```
```    42 lemma of_nat_in_nonpos_Ints_iff: "(of_nat n :: 'a :: {ring_1,ring_char_0}) \<in> \<int>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> n = 0"
```
```    43 proof
```
```    44   assume "(of_nat n :: 'a) \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    45   then obtain m where "of_nat n = (of_int m :: 'a)" "m \<le> 0" by (auto simp: nonpos_Ints_def)
```
```    46   hence "(of_int m :: 'a) = of_nat n" by simp
```
```    47   also have "... = of_int (int n)" by simp
```
```    48   finally have "m = int n" by (subst (asm) of_int_eq_iff)
```
```    49   with \<open>m \<le> 0\<close> show "n = 0" by auto
```
```    50 qed simp
```
```    51
```
```    52 lemma nonpos_Ints_of_int: "n \<le> 0 \<Longrightarrow> of_int n \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    53   unfolding nonpos_Ints_def by blast
```
```    54
```
```    55 lemma nonpos_IntsI:
```
```    56   "x \<in> \<int> \<Longrightarrow> x \<le> 0 \<Longrightarrow> (x :: 'a :: linordered_idom) \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    57   unfolding nonpos_Ints_def Ints_def by auto
```
```    58
```
```    59 lemma nonpos_Ints_subset_Ints: "\<int>\<^sub>\<le>\<^sub>0 \<subseteq> \<int>"
```
```    60   unfolding nonpos_Ints_def Ints_def by blast
```
```    61
```
```    62 lemma nonpos_Ints_nonpos [dest]: "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x \<le> (0 :: 'a :: linordered_idom)"
```
```    63   unfolding nonpos_Ints_def by auto
```
```    64
```
```    65 lemma nonpos_Ints_Int [dest]: "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x \<in> \<int>"
```
```    66   unfolding nonpos_Ints_def Ints_def by blast
```
```    67
```
```    68 lemma nonpos_Ints_cases:
```
```    69   assumes "x \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    70   obtains n where "x = of_int n" "n \<le> 0"
```
```    71   using assms unfolding nonpos_Ints_def by (auto elim!: Ints_cases)
```
```    72
```
```    73 lemma nonpos_Ints_cases':
```
```    74   assumes "x \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    75   obtains n where "x = -of_nat n"
```
```    76 proof -
```
```    77   from assms obtain m where "x = of_int m" and m: "m \<le> 0" by (auto elim!: nonpos_Ints_cases)
```
```    78   hence "x = - of_int (-m)" by auto
```
```    79   also from m have "(of_int (-m) :: 'a) = of_nat (nat (-m))" by simp_all
```
```    80   finally show ?thesis by (rule that)
```
```    81 qed
```
```    82
```
```    83 lemma of_real_in_nonpos_Ints_iff: "(of_real x :: 'a :: real_algebra_1) \<in> \<int>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> x \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    84 proof
```
```    85   assume "of_real x \<in> (\<int>\<^sub>\<le>\<^sub>0 :: 'a set)"
```
```    86   then obtain n where "(of_real x :: 'a) = of_int n" "n \<le> 0" by (erule nonpos_Ints_cases)
```
```    87   note \<open>of_real x = of_int n\<close>
```
```    88   also have "of_int n = of_real (of_int n)" by (rule of_real_of_int_eq [symmetric])
```
```    89   finally have "x = of_int n" by (subst (asm) of_real_eq_iff)
```
```    90   with \<open>n \<le> 0\<close> show "x \<in> \<int>\<^sub>\<le>\<^sub>0" by (simp add: nonpos_Ints_of_int)
```
```    91 qed (auto elim!: nonpos_Ints_cases intro!: nonpos_Ints_of_int)
```
```    92
```
```    93 lemma nonpos_Ints_altdef: "\<int>\<^sub>\<le>\<^sub>0 = {n \<in> \<int>. (n :: 'a :: linordered_idom) \<le> 0}"
```
```    94   by (auto intro!: nonpos_IntsI elim!: nonpos_Ints_cases)
```
```    95
```
```    96 lemma uminus_in_Nats_iff: "-x \<in> \<nat> \<longleftrightarrow> x \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```    97 proof
```
```    98   assume "-x \<in> \<nat>"
```
```    99   then obtain n where "n \<ge> 0" "-x = of_int n" by (auto simp: Nats_altdef1)
```
```   100   hence "-n \<le> 0" "x = of_int (-n)" by (simp_all add: eq_commute minus_equation_iff[of x])
```
```   101   thus "x \<in> \<int>\<^sub>\<le>\<^sub>0" unfolding nonpos_Ints_def by blast
```
```   102 next
```
```   103   assume "x \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   104   then obtain n where "n \<le> 0" "x = of_int n" by (auto simp: nonpos_Ints_def)
```
```   105   hence "-n \<ge> 0" "-x = of_int (-n)" by (simp_all add: eq_commute minus_equation_iff[of x])
```
```   106   thus "-x \<in> \<nat>" unfolding Nats_altdef1 by blast
```
```   107 qed
```
```   108
```
```   109 lemma uminus_in_nonpos_Ints_iff: "-x \<in> \<int>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> x \<in> \<nat>"
```
```   110   using uminus_in_Nats_iff[of "-x"] by simp
```
```   111
```
```   112 lemma nonpos_Ints_mult: "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> y \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x * y \<in> \<nat>"
```
```   113   using Nats_mult[of "-x" "-y"] by (simp add: uminus_in_Nats_iff)
```
```   114
```
```   115 lemma Nats_mult_nonpos_Ints: "x \<in> \<nat> \<Longrightarrow> y \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x * y \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   116   using Nats_mult[of x "-y"] by (simp add: uminus_in_Nats_iff)
```
```   117
```
```   118 lemma nonpos_Ints_mult_Nats:
```
```   119   "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> y \<in> \<nat> \<Longrightarrow> x * y \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   120   using Nats_mult[of "-x" y] by (simp add: uminus_in_Nats_iff)
```
```   121
```
```   122 lemma nonpos_Ints_add:
```
```   123   "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> y \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x + y \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   124   using Nats_add[of "-x" "-y"] uminus_in_Nats_iff[of "y+x", simplified minus_add]
```
```   125   by (simp add: uminus_in_Nats_iff add.commute)
```
```   126
```
```   127 lemma nonpos_Ints_diff_Nats:
```
```   128   "x \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> y \<in> \<nat> \<Longrightarrow> x - y \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   129   using Nats_add[of "-x" "y"] uminus_in_Nats_iff[of "x-y", simplified minus_add]
```
```   130   by (simp add: uminus_in_Nats_iff add.commute)
```
```   131
```
```   132 lemma Nats_diff_nonpos_Ints:
```
```   133   "x \<in> \<nat> \<Longrightarrow> y \<in> \<int>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x - y \<in> \<nat>"
```
```   134   using Nats_add[of "x" "-y"] by (simp add: uminus_in_Nats_iff add.commute)
```
```   135
```
```   136 lemma plus_of_nat_eq_0_imp: "z + of_nat n = 0 \<Longrightarrow> z \<in> \<int>\<^sub>\<le>\<^sub>0"
```
```   137 proof -
```
```   138   assume "z + of_nat n = 0"
```
```   139   hence A: "z = - of_nat n" by (simp add: eq_neg_iff_add_eq_0)
```
```   140   show "z \<in> \<int>\<^sub>\<le>\<^sub>0" by (subst A) simp
```
```   141 qed
```
```   142
```
```   143
```
```   144 subsection\<open>Non-negative reals\<close>
```
```   145
```
```   146 definition nonneg_Reals :: "'a::real_algebra_1 set"  ("\<real>\<^sub>\<ge>\<^sub>0")
```
```   147   where "\<real>\<^sub>\<ge>\<^sub>0 = {of_real r | r. r \<ge> 0}"
```
```   148
```
```   149 lemma nonneg_Reals_of_real_iff [simp]: "of_real r \<in> \<real>\<^sub>\<ge>\<^sub>0 \<longleftrightarrow> r \<ge> 0"
```
```   150   by (force simp add: nonneg_Reals_def)
```
```   151
```
```   152 lemma nonneg_Reals_subset_Reals: "\<real>\<^sub>\<ge>\<^sub>0 \<subseteq> \<real>"
```
```   153   unfolding nonneg_Reals_def Reals_def by blast
```
```   154
```
```   155 lemma nonneg_Reals_Real [dest]: "x \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> x \<in> \<real>"
```
```   156   unfolding nonneg_Reals_def Reals_def by blast
```
```   157
```
```   158 lemma nonneg_Reals_of_nat_I [simp]: "of_nat n \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   159   by (metis nonneg_Reals_of_real_iff of_nat_0_le_iff of_real_of_nat_eq)
```
```   160
```
```   161 lemma nonneg_Reals_cases:
```
```   162   assumes "x \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   163   obtains r where "x = of_real r" "r \<ge> 0"
```
```   164   using assms unfolding nonneg_Reals_def by (auto elim!: Reals_cases)
```
```   165
```
```   166 lemma nonneg_Reals_zero_I [simp]: "0 \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   167   unfolding nonneg_Reals_def by auto
```
```   168
```
```   169 lemma nonneg_Reals_one_I [simp]: "1 \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   170   by (metis (mono_tags, lifting) nonneg_Reals_of_nat_I of_nat_1)
```
```   171
```
```   172 lemma nonneg_Reals_minus_one_I [simp]: "-1 \<notin> \<real>\<^sub>\<ge>\<^sub>0"
```
```   173   by (metis nonneg_Reals_of_real_iff le_minus_one_simps(3) of_real_1 of_real_def real_vector.scale_minus_left)
```
```   174
```
```   175 lemma nonneg_Reals_numeral_I [simp]: "numeral w \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   176   by (metis (no_types) nonneg_Reals_of_nat_I of_nat_numeral)
```
```   177
```
```   178 lemma nonneg_Reals_minus_numeral_I [simp]: "- numeral w \<notin> \<real>\<^sub>\<ge>\<^sub>0"
```
```   179   using nonneg_Reals_of_real_iff not_zero_le_neg_numeral by fastforce
```
```   180
```
```   181 lemma nonneg_Reals_add_I [simp]: "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a + b \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   182 apply (simp add: nonneg_Reals_def)
```
```   183 apply clarify
```
```   184 apply (rename_tac r s)
```
```   185 apply (rule_tac x="r+s" in exI, auto)
```
```   186 done
```
```   187
```
```   188 lemma nonneg_Reals_mult_I [simp]: "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a * b \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   189   unfolding nonneg_Reals_def  by (auto simp: of_real_def)
```
```   190
```
```   191 lemma nonneg_Reals_inverse_I [simp]:
```
```   192   fixes a :: "'a::real_div_algebra"
```
```   193   shows "a \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> inverse a \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   194   by (simp add: nonneg_Reals_def image_iff) (metis inverse_nonnegative_iff_nonnegative of_real_inverse)
```
```   195
```
```   196 lemma nonneg_Reals_divide_I [simp]:
```
```   197   fixes a :: "'a::real_div_algebra"
```
```   198   shows "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a / b \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   199   by (simp add: divide_inverse)
```
```   200
```
```   201 lemma nonneg_Reals_pow_I [simp]: "a \<in> \<real>\<^sub>\<ge>\<^sub>0 \<Longrightarrow> a^n \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   202   by (induction n) auto
```
```   203
```
```   204 lemma complex_nonneg_Reals_iff: "z \<in> \<real>\<^sub>\<ge>\<^sub>0 \<longleftrightarrow> Re z \<ge> 0 \<and> Im z = 0"
```
```   205   by (auto simp: nonneg_Reals_def) (metis complex_of_real_def complex_surj)
```
```   206
```
```   207 lemma ii_not_nonneg_Reals [iff]: "\<i> \<notin> \<real>\<^sub>\<ge>\<^sub>0"
```
```   208   by (simp add: complex_nonneg_Reals_iff)
```
```   209
```
```   210
```
```   211 subsection\<open>Non-positive reals\<close>
```
```   212
```
```   213 definition nonpos_Reals :: "'a::real_algebra_1 set"  ("\<real>\<^sub>\<le>\<^sub>0")
```
```   214   where "\<real>\<^sub>\<le>\<^sub>0 = {of_real r | r. r \<le> 0}"
```
```   215
```
```   216 lemma nonpos_Reals_of_real_iff [simp]: "of_real r \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> r \<le> 0"
```
```   217   by (force simp add: nonpos_Reals_def)
```
```   218
```
```   219 lemma nonpos_Reals_subset_Reals: "\<real>\<^sub>\<le>\<^sub>0 \<subseteq> \<real>"
```
```   220   unfolding nonpos_Reals_def Reals_def by blast
```
```   221
```
```   222 lemma nonpos_Ints_subset_nonpos_Reals: "\<int>\<^sub>\<le>\<^sub>0 \<subseteq> \<real>\<^sub>\<le>\<^sub>0"
```
```   223   by (metis nonpos_Ints_cases nonpos_Ints_nonpos nonpos_Ints_of_int
```
```   224     nonpos_Reals_of_real_iff of_real_of_int_eq subsetI)
```
```   225
```
```   226 lemma nonpos_Reals_of_nat_iff [simp]: "of_nat n \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> n=0"
```
```   227   by (metis nonpos_Reals_of_real_iff of_nat_le_0_iff of_real_of_nat_eq)
```
```   228
```
```   229 lemma nonpos_Reals_Real [dest]: "x \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> x \<in> \<real>"
```
```   230   unfolding nonpos_Reals_def Reals_def by blast
```
```   231
```
```   232 lemma nonpos_Reals_cases:
```
```   233   assumes "x \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   234   obtains r where "x = of_real r" "r \<le> 0"
```
```   235   using assms unfolding nonpos_Reals_def by (auto elim!: Reals_cases)
```
```   236
```
```   237 lemma uminus_nonneg_Reals_iff [simp]: "-x \<in> \<real>\<^sub>\<ge>\<^sub>0 \<longleftrightarrow> x \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   238   apply (auto simp: nonpos_Reals_def nonneg_Reals_def)
```
```   239   apply (metis nonpos_Reals_of_real_iff minus_minus neg_le_0_iff_le of_real_minus)
```
```   240   apply (metis neg_0_le_iff_le of_real_minus)
```
```   241   done
```
```   242
```
```   243 lemma uminus_nonpos_Reals_iff [simp]: "-x \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> x \<in> \<real>\<^sub>\<ge>\<^sub>0"
```
```   244   by (metis (no_types) minus_minus uminus_nonneg_Reals_iff)
```
```   245
```
```   246 lemma nonpos_Reals_zero_I [simp]: "0 \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   247   unfolding nonpos_Reals_def by force
```
```   248
```
```   249 lemma nonpos_Reals_one_I [simp]: "1 \<notin> \<real>\<^sub>\<le>\<^sub>0"
```
```   250   using nonneg_Reals_minus_one_I uminus_nonneg_Reals_iff by blast
```
```   251
```
```   252 lemma nonpos_Reals_numeral_I [simp]: "numeral w \<notin> \<real>\<^sub>\<le>\<^sub>0"
```
```   253   using nonneg_Reals_minus_numeral_I uminus_nonneg_Reals_iff by blast
```
```   254
```
```   255 lemma nonpos_Reals_add_I [simp]: "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; b \<in> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> a + b \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   256   by (metis nonneg_Reals_add_I add_uminus_conv_diff minus_diff_eq minus_minus uminus_nonpos_Reals_iff)
```
```   257
```
```   258 lemma nonpos_Reals_mult_I1: "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> a * b \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   259   by (metis nonneg_Reals_mult_I mult_minus_right uminus_nonneg_Reals_iff)
```
```   260
```
```   261 lemma nonpos_Reals_mult_I2: "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a * b \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   262   by (metis nonneg_Reals_mult_I mult_minus_left uminus_nonneg_Reals_iff)
```
```   263
```
```   264 lemma nonpos_Reals_mult_of_nat_iff:
```
```   265   fixes a:: "'a :: real_div_algebra" shows "a * of_nat n \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> a \<in> \<real>\<^sub>\<le>\<^sub>0 \<or> n=0"
```
```   266   apply (auto intro: nonpos_Reals_mult_I2)
```
```   267   apply (auto simp: nonpos_Reals_def)
```
```   268   apply (rule_tac x="r/n" in exI)
```
```   269   apply (auto simp: divide_simps)
```
```   270   done
```
```   271
```
```   272 lemma nonpos_Reals_inverse_I:
```
```   273     fixes a :: "'a::real_div_algebra"
```
```   274     shows "a \<in> \<real>\<^sub>\<le>\<^sub>0 \<Longrightarrow> inverse a \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   275   using nonneg_Reals_inverse_I uminus_nonneg_Reals_iff by fastforce
```
```   276
```
```   277 lemma nonpos_Reals_divide_I1:
```
```   278     fixes a :: "'a::real_div_algebra"
```
```   279     shows "\<lbrakk>a \<in> \<real>\<^sub>\<ge>\<^sub>0; b \<in> \<real>\<^sub>\<le>\<^sub>0\<rbrakk> \<Longrightarrow> a / b \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   280   by (simp add: nonpos_Reals_inverse_I nonpos_Reals_mult_I1 divide_inverse)
```
```   281
```
```   282 lemma nonpos_Reals_divide_I2:
```
```   283     fixes a :: "'a::real_div_algebra"
```
```   284     shows "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; b \<in> \<real>\<^sub>\<ge>\<^sub>0\<rbrakk> \<Longrightarrow> a / b \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   285   by (metis nonneg_Reals_divide_I minus_divide_left uminus_nonneg_Reals_iff)
```
```   286
```
```   287 lemma nonpos_Reals_divide_of_nat_iff:
```
```   288   fixes a:: "'a :: real_div_algebra" shows "a / of_nat n \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> a \<in> \<real>\<^sub>\<le>\<^sub>0 \<or> n=0"
```
```   289   apply (auto intro: nonpos_Reals_divide_I2)
```
```   290   apply (auto simp: nonpos_Reals_def)
```
```   291   apply (rule_tac x="r*n" in exI)
```
```   292   apply (auto simp: divide_simps mult_le_0_iff)
```
```   293   done
```
```   294
```
```   295 lemma nonpos_Reals_pow_I: "\<lbrakk>a \<in> \<real>\<^sub>\<le>\<^sub>0; odd n\<rbrakk> \<Longrightarrow> a^n \<in> \<real>\<^sub>\<le>\<^sub>0"
```
```   296   by (metis nonneg_Reals_pow_I power_minus_odd uminus_nonneg_Reals_iff)
```
```   297
```
```   298 lemma complex_nonpos_Reals_iff: "z \<in> \<real>\<^sub>\<le>\<^sub>0 \<longleftrightarrow> Re z \<le> 0 \<and> Im z = 0"
```
```   299    using complex_is_Real_iff by (force simp add: nonpos_Reals_def)
```
```   300
```
```   301 lemma ii_not_nonpos_Reals [iff]: "\<i> \<notin> \<real>\<^sub>\<le>\<^sub>0"
```
```   302   by (simp add: complex_nonpos_Reals_iff)
```
```   303
```
```   304 end
```