src/HOL/Word/Word.thy
changeset 61169 4de9ff3ea29a
parent 61076 bdc1e2f0a86a
child 61260 e6f03fae14d5
equal deleted inserted replaced
61168:dcdfb6355a05 61169:4de9ff3ea29a
   311 
   311 
   312 definition
   312 definition
   313   word_mod_def: "a mod b = word_of_int (uint a mod uint b)"
   313   word_mod_def: "a mod b = word_of_int (uint a mod uint b)"
   314 
   314 
   315 instance
   315 instance
   316   by default (transfer, simp add: algebra_simps)+
   316   by standard (transfer, simp add: algebra_simps)+
   317 
   317 
   318 end
   318 end
   319 
   319 
   320 text {* Legacy theorems: *}
   320 text {* Legacy theorems: *}
   321 
   321 
   382 
   382 
   383 definition
   383 definition
   384   word_less_def: "a < b \<longleftrightarrow> uint a < uint b"
   384   word_less_def: "a < b \<longleftrightarrow> uint a < uint b"
   385 
   385 
   386 instance
   386 instance
   387   by default (auto simp: word_less_def word_le_def)
   387   by standard (auto simp: word_less_def word_le_def)
   388 
   388 
   389 end
   389 end
   390 
   390 
   391 definition word_sle :: "'a :: len word => 'a word => bool" ("(_/ <=s _)" [50, 51] 50)
   391 definition word_sle :: "'a :: len word => 'a word => bool" ("(_/ <=s _)" [50, 51] 50)
   392 where
   392 where
  1192 
  1192 
  1193 lemma word_less_alt: "(a < b) = (uint a < uint b)"
  1193 lemma word_less_alt: "(a < b) = (uint a < uint b)"
  1194   by (fact word_less_def)
  1194   by (fact word_less_def)
  1195 
  1195 
  1196 lemma signed_linorder: "class.linorder word_sle word_sless"
  1196 lemma signed_linorder: "class.linorder word_sle word_sless"
  1197   by default (unfold word_sle_def word_sless_def, auto)
  1197   by standard (unfold word_sle_def word_sless_def, auto)
  1198 
  1198 
  1199 interpretation signed: linorder "word_sle" "word_sless"
  1199 interpretation signed: linorder "word_sle" "word_sless"
  1200   by (rule signed_linorder)
  1200   by (rule signed_linorder)
  1201 
  1201 
  1202 lemma udvdI: 
  1202 lemma udvdI: 
  2213 
  2213 
  2214 
  2214 
  2215 subsection {* Cardinality, finiteness of set of words *}
  2215 subsection {* Cardinality, finiteness of set of words *}
  2216 
  2216 
  2217 instance word :: (len0) finite
  2217 instance word :: (len0) finite
  2218   by (default, simp add: type_definition.univ [OF type_definition_word])
  2218   by standard (simp add: type_definition.univ [OF type_definition_word])
  2219 
  2219 
  2220 lemma card_word: "CARD('a::len0 word) = 2 ^ len_of TYPE('a)"
  2220 lemma card_word: "CARD('a::len0 word) = 2 ^ len_of TYPE('a)"
  2221   by (simp add: type_definition.card [OF type_definition_word] nat_power_eq)
  2221   by (simp add: type_definition.card [OF type_definition_word] nat_power_eq)
  2222 
  2222 
  2223 lemma card_word_size: 
  2223 lemma card_word_size: