src/HOL/Word/WordGenLib.thy
changeset 25349 0d46bea01741
parent 24465 70f0214b3ecc
child 26558 7fcc10088e72
equal deleted inserted replaced
25348:510b46987886 25349:0d46bea01741
   261   fixes x :: "'a :: len word"
   261   fixes x :: "'a :: len word"
   262   shows "x \<noteq> 0 ==> 1 \<le> x = (0 \<le> x - 1)"
   262   shows "x \<noteq> 0 ==> 1 \<le> x = (0 \<le> x - 1)"
   263   by (simp add: unat_sub_if_size order_le_less word_less_nat_alt)
   263   by (simp add: unat_sub_if_size order_le_less word_less_nat_alt)
   264 
   264 
   265 lemmas word_less_sub1_numberof [simp] =
   265 lemmas word_less_sub1_numberof [simp] =
   266   word_less_sub1 [of "number_of ?w"]
   266   word_less_sub1 [of "number_of w", standard]
   267 lemmas word_le_sub1_numberof [simp] =
   267 lemmas word_le_sub1_numberof [simp] =
   268   word_le_sub1 [of "number_of ?w"]
   268   word_le_sub1 [of "number_of w", standard]
   269   
   269   
   270 lemma word_of_int_minus: 
   270 lemma word_of_int_minus: 
   271   "word_of_int (2^len_of TYPE('a) - i) = (word_of_int (-i)::'a::len word)"
   271   "word_of_int (2^len_of TYPE('a) - i) = (word_of_int (-i)::'a::len word)"
   272 proof -
   272 proof -
   273   have x: "2^len_of TYPE('a) - i = -i + 2^len_of TYPE('a)" by simp
   273   have x: "2^len_of TYPE('a) - i = -i + 2^len_of TYPE('a)" by simp
   394 apply clarsimp
   394 apply clarsimp
   395 apply (rule_tac t="1 + n - m" and s="1 + (n - m)" in subst)
   395 apply (rule_tac t="1 + n - m" and s="1 + (n - m)" in subst)
   396  apply simp
   396  apply simp
   397 apply (case_tac "1 + (n - m) = 0")
   397 apply (case_tac "1 + (n - m) = 0")
   398  apply (simp add: word_rec_0)
   398  apply (simp add: word_rec_0)
   399  apply (rule arg_cong[where f="word_rec ?a ?b"])
   399  apply (rule_tac f = "word_rec ?a ?b" in arg_cong)
   400  apply (rule_tac t="m" and s="m + (1 + (n - m))" in subst)
   400  apply (rule_tac t="m" and s="m + (1 + (n - m))" in subst)
   401   apply simp
   401   apply simp
   402  apply (simp (no_asm_use))
   402  apply (simp (no_asm_use))
   403 apply (simp add: word_rec_Suc word_rec_in2)
   403 apply (simp add: word_rec_Suc word_rec_in2)
   404 apply (erule impE)
   404 apply (erule impE)