src/HOL/Word/Word.thy
changeset 70749 5d06b7bb9d22
parent 70342 e4d626692640
child 70900 954e7f79c25a
equal deleted inserted replaced
70748:b3b84b71e398 70749:5d06b7bb9d22
   638 lemma lt2p_lem: "LENGTH('a) \<le> n \<Longrightarrow> uint w < 2 ^ n"
   638 lemma lt2p_lem: "LENGTH('a) \<le> n \<Longrightarrow> uint w < 2 ^ n"
   639   for w :: "'a::len0 word"
   639   for w :: "'a::len0 word"
   640   by (metis bintr_uint bintrunc_mod2p int_mod_lem zless2p)
   640   by (metis bintr_uint bintrunc_mod2p int_mod_lem zless2p)
   641 
   641 
   642 lemma uint_le_0_iff [simp]: "uint x \<le> 0 \<longleftrightarrow> uint x = 0"
   642 lemma uint_le_0_iff [simp]: "uint x \<le> 0 \<longleftrightarrow> uint x = 0"
   643   by (fact uint_ge_0 [THEN leD, THEN linorder_antisym_conv1])
   643   by (fact uint_ge_0 [THEN leD, THEN antisym_conv1])
   644 
   644 
   645 lemma uint_nat: "uint w = int (unat w)"
   645 lemma uint_nat: "uint w = int (unat w)"
   646   by (auto simp: unat_def)
   646   by (auto simp: unat_def)
   647 
   647 
   648 lemma uint_numeral: "uint (numeral b :: 'a::len0 word) = numeral b mod 2 ^ LENGTH('a)"
   648 lemma uint_numeral: "uint (numeral b :: 'a::len0 word) = numeral b mod 2 ^ LENGTH('a)"
  1680 
  1680 
  1681 
  1681 
  1682 subsection \<open>Arithmetic type class instantiations\<close>
  1682 subsection \<open>Arithmetic type class instantiations\<close>
  1683 
  1683 
  1684 lemmas word_le_0_iff [simp] =
  1684 lemmas word_le_0_iff [simp] =
  1685   word_zero_le [THEN leD, THEN linorder_antisym_conv1]
  1685   word_zero_le [THEN leD, THEN antisym_conv1]
  1686 
  1686 
  1687 lemma word_of_int_nat: "0 \<le> x \<Longrightarrow> word_of_int x = of_nat (nat x)"
  1687 lemma word_of_int_nat: "0 \<le> x \<Longrightarrow> word_of_int x = of_nat (nat x)"
  1688   by (simp add: word_of_int)
  1688   by (simp add: word_of_int)
  1689 
  1689 
  1690 text \<open>
  1690 text \<open>