src/HOL/Int.thy
changeset 78935 5e788ff7a489
parent 78698 1b9388e6eb75
child 79296 f758b4e9d643
equal deleted inserted replaced
78934:5553a86a1091 78935:5e788ff7a489
   178   show "sgn (i::int) = (if i=0 then 0 else if 0<i then 1 else - 1)"
   178   show "sgn (i::int) = (if i=0 then 0 else if 0<i then 1 else - 1)"
   179     by (simp only: zsgn_def)
   179     by (simp only: zsgn_def)
   180 qed
   180 qed
   181 
   181 
   182 end
   182 end
       
   183 
       
   184 instance int :: discrete_linordered_semidom
       
   185 proof
       
   186   fix k l :: int
       
   187   show \<open>k < l \<longleftrightarrow> k + 1 \<le> l\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>)
       
   188   proof
       
   189     assume ?Q
       
   190     then show ?P
       
   191       by simp
       
   192   next
       
   193     assume ?P
       
   194     then have \<open>l - k > 0\<close>
       
   195       by simp
       
   196     with zero_less_imp_eq_int obtain n where \<open>l - k = int n\<close>
       
   197       by blast
       
   198     then have \<open>n > 0\<close>
       
   199       using \<open>l - k > 0\<close> by simp
       
   200     then have \<open>n \<ge> 1\<close>
       
   201       by simp
       
   202     then have \<open>int n \<ge> int 1\<close>
       
   203       by (rule of_nat_mono)
       
   204     with \<open>l - k = int n\<close> show ?Q
       
   205       by simp
       
   206   qed
       
   207 qed
   183 
   208 
   184 lemma zless_imp_add1_zle: "w < z \<Longrightarrow> w + 1 \<le> z"
   209 lemma zless_imp_add1_zle: "w < z \<Longrightarrow> w + 1 \<le> z"
   185   for w z :: int
   210   for w z :: int
   186   by transfer clarsimp
   211   by transfer clarsimp
   187 
   212