src/HOL/Word/Word.thy
changeset 45808 d26e933da5f0
parent 45807 ff10ec0d62ea
child 45809 2bee94cbae72
equal deleted inserted replaced
45807:ff10ec0d62ea 45808:d26e933da5f0
   132   by (simp add: uints_def range_bintrunc)
   132   by (simp add: uints_def range_bintrunc)
   133 
   133 
   134 lemma sints_num: "sints n = {i. - (2 ^ (n - 1)) \<le> i \<and> i < 2 ^ (n - 1)}"
   134 lemma sints_num: "sints n = {i. - (2 ^ (n - 1)) \<le> i \<and> i < 2 ^ (n - 1)}"
   135   by (simp add: sints_def range_sbintrunc)
   135   by (simp add: sints_def range_sbintrunc)
   136 
   136 
   137 (* FIXME: delete *)
       
   138 lemmas atLeastLessThan_alt = atLeastLessThan_def [unfolded 
       
   139   atLeast_def lessThan_def Collect_conj_eq [symmetric]]
       
   140   
       
   141 lemma mod_in_reps: "m > 0 \<Longrightarrow> y mod m : {0::int ..< m}"
   137 lemma mod_in_reps: "m > 0 \<Longrightarrow> y mod m : {0::int ..< m}"
   142   by auto
   138   by auto
   143 
   139 
   144 lemma 
   140 lemma 
   145   uint_0:"0 <= uint x" and 
   141   uint_0:"0 <= uint x" and 
   590     defer
   586     defer
   591     apply (rule word_ubin.norm_Rep)+
   587     apply (rule word_ubin.norm_Rep)+
   592   apply simp
   588   apply simp
   593   done
   589   done
   594 
   590 
   595 (* TODO: remove uint_lem and sint_lem *)
       
   596 lemmas uint_lem = word_uint.Rep [unfolded uints_num mem_Collect_eq]
       
   597 lemmas sint_lem = word_sint.Rep [unfolded sints_num mem_Collect_eq]
       
   598 
       
   599 lemma uint_ge_0 [iff]: "0 \<le> uint (x::'a::len0 word)"
   591 lemma uint_ge_0 [iff]: "0 \<le> uint (x::'a::len0 word)"
   600   using word_uint.Rep [of x] by (simp add: uints_num)
   592   using word_uint.Rep [of x] by (simp add: uints_num)
   601 
   593 
   602 lemma uint_lt2p [iff]: "uint (x::'a::len0 word) < 2 ^ len_of TYPE('a)"
   594 lemma uint_lt2p [iff]: "uint (x::'a::len0 word) < 2 ^ len_of TYPE('a)"
   603   using word_uint.Rep [of x] by (simp add: uints_num)
   595   using word_uint.Rep [of x] by (simp add: uints_num)
   670     (~ (EX n. x = (word_of_int n :: 'b::len0 word) &
   662     (~ (EX n. x = (word_of_int n :: 'b::len0 word) &
   671       0 <= n & n < 2 ^ len_of TYPE('b::len0) & ~ P (f n)))"
   663       0 <= n & n < 2 ^ len_of TYPE('b::len0) & ~ P (f n)))"
   672   unfolding word_int_case_def
   664   unfolding word_int_case_def
   673   by (auto simp: word_uint.eq_norm int_mod_eq')
   665   by (auto simp: word_uint.eq_norm int_mod_eq')
   674 
   666 
   675 (* FIXME: uint_range' is an exact duplicate of uint_lem *)
       
   676 lemmas uint_range' = word_uint.Rep [unfolded uints_num mem_Collect_eq]
   667 lemmas uint_range' = word_uint.Rep [unfolded uints_num mem_Collect_eq]
   677 lemmas sint_range' = word_sint.Rep [unfolded One_nat_def sints_num mem_Collect_eq]
   668 lemmas sint_range' = word_sint.Rep [unfolded One_nat_def sints_num mem_Collect_eq]
   678 
   669 
   679 lemma uint_range_size: "0 <= uint w & uint w < 2 ^ size w"
   670 lemma uint_range_size: "0 <= uint w & uint w < 2 ^ size w"
   680   unfolding word_size by (rule uint_range')
   671   unfolding word_size by (rule uint_range')