src/HOL/Word/Word.thy
changeset 46020 0a29b51f0b0d
parent 46013 d2f179d26133
child 46021 272c63f83398
equal deleted inserted replaced
46019:507331bd8a08 46020:0a29b51f0b0d
  1089   by (simp only: Pls_def word_0_wi)
  1089   by (simp only: Pls_def word_0_wi)
  1090 
  1090 
  1091 lemma word_0_no: "(0::'a::len0 word) = Numeral0"
  1091 lemma word_0_no: "(0::'a::len0 word) = Numeral0"
  1092   by (simp add: word_number_of_alt)
  1092   by (simp add: word_number_of_alt)
  1093 
  1093 
  1094 lemma int_one_bin: "(1 :: int) = (Int.Pls BIT 1)"
  1094 lemma word_1_no: "(1::'a::len0 word) = Numeral1"
  1095   unfolding Pls_def Bit_def by auto
  1095   by (simp add: word_number_of_alt)
  1096 
       
  1097 lemma word_1_no: 
       
  1098   "(1 :: 'a :: len0 word) = number_of (Int.Pls BIT 1)"
       
  1099   unfolding word_1_wi word_number_of_def int_one_bin by auto
       
  1100 
  1096 
  1101 lemma word_m1_wi: "-1 = word_of_int -1" 
  1097 lemma word_m1_wi: "-1 = word_of_int -1" 
  1102   by (rule word_number_of_alt)
  1098   by (rule word_number_of_alt)
  1103 
  1099 
  1104 lemma word_m1_wi_Min: "-1 = word_of_int Int.Min"
  1100 lemma word_m1_wi_Min: "-1 = word_of_int Int.Min"
  1230   unfolding word_number_of_def Int.succ_def Int.pred_def
  1226   unfolding word_number_of_def Int.succ_def Int.pred_def
  1231   by (simp add: word_of_int_homs)
  1227   by (simp add: word_of_int_homs)
  1232 
  1228 
  1233 lemma word_sp_01 [simp] : 
  1229 lemma word_sp_01 [simp] : 
  1234   "word_succ -1 = 0 & word_succ 0 = 1 & word_pred 0 = -1 & word_pred 1 = 0"
  1230   "word_succ -1 = 0 & word_succ 0 = 1 & word_pred 0 = -1 & word_pred 1 = 0"
  1235   by (unfold word_0_no word_1_no) (auto simp: BIT_simps)
  1231   unfolding word_0_no word_1_no by simp
  1236 
  1232 
  1237 (* alternative approach to lifting arithmetic equalities *)
  1233 (* alternative approach to lifting arithmetic equalities *)
  1238 lemma word_of_int_Ex:
  1234 lemma word_of_int_Ex:
  1239   "\<exists>y. x = word_of_int y"
  1235   "\<exists>y. x = word_of_int y"
  1240   by (rule_tac x="uint x" in exI) simp
  1236   by (rule_tac x="uint x" in exI) simp
  4565   "1 + n \<noteq> (0::'a::len word) \<Longrightarrow> unat (1 + n) = Suc (unat n)"
  4561   "1 + n \<noteq> (0::'a::len word) \<Longrightarrow> unat (1 + n) = Suc (unat n)"
  4566   by unat_arith
  4562   by unat_arith
  4567 
  4563 
  4568 
  4564 
  4569 lemma word_no_1 [simp]: "(Numeral1::'a::len0 word) = 1"
  4565 lemma word_no_1 [simp]: "(Numeral1::'a::len0 word) = 1"
  4570   by (fact word_1_no [symmetric, unfolded BIT_simps])
  4566   by (fact word_1_no [symmetric])
  4571 
  4567 
  4572 lemma word_no_0 [simp]: "(Numeral0::'a::len0 word) = 0"
  4568 lemma word_no_0 [simp]: "(Numeral0::'a::len0 word) = 0"
  4573   by (fact word_0_no [symmetric])
  4569   by (fact word_0_no [symmetric])
  4574 
  4570 
  4575 declare bin_to_bl_def [simp]
  4571 declare bin_to_bl_def [simp]