src/HOL/Word/WordShift.thy
changeset 26086 3c243098b64a
parent 26072 f65a7fa2da6c
child 26289 9d2c375e242b
equal deleted inserted replaced
26085:4ce22e7a81bd 26086:3c243098b64a
    12 subsection "Bit shifting"
    12 subsection "Bit shifting"
    13 
    13 
    14 lemma shiftl1_number [simp] :
    14 lemma shiftl1_number [simp] :
    15   "shiftl1 (number_of w) = number_of (w BIT bit.B0)"
    15   "shiftl1 (number_of w) = number_of (w BIT bit.B0)"
    16   apply (unfold shiftl1_def word_number_of_def)
    16   apply (unfold shiftl1_def word_number_of_def)
    17   apply (simp add: word_ubin.norm_eq_iff [symmetric] word_ubin.eq_norm)
    17   apply (simp add: word_ubin.norm_eq_iff [symmetric] word_ubin.eq_norm
       
    18               del: BIT_simps)
    18   apply (subst refl [THEN bintrunc_BIT_I, symmetric])
    19   apply (subst refl [THEN bintrunc_BIT_I, symmetric])
    19   apply (subst bintrunc_bintrunc_min)
    20   apply (subst bintrunc_bintrunc_min)
    20   apply simp
    21   apply simp
    21   done
    22   done
    22 
    23 
   329 
   330 
   330 (* note - the following results use 'a :: len word < number_ring *)
   331 (* note - the following results use 'a :: len word < number_ring *)
   331 
   332 
   332 lemma shiftl1_2t: "shiftl1 (w :: 'a :: len word) = 2 * w"
   333 lemma shiftl1_2t: "shiftl1 (w :: 'a :: len word) = 2 * w"
   333   apply (simp add: shiftl1_def_u)
   334   apply (simp add: shiftl1_def_u)
   334   apply (simp only:  double_number_of_BIT [symmetric])
   335   apply (simp only:  double_number_of_Bit0 [symmetric])
   335   apply simp
   336   apply simp
   336   done
   337   done
   337 
   338 
   338 lemma shiftl1_p: "shiftl1 (w :: 'a :: len word) = w + w"
   339 lemma shiftl1_p: "shiftl1 (w :: 'a :: len word) = w + w"
   339   apply (simp add: shiftl1_def_u)
   340   apply (simp add: shiftl1_def_u)
   340   apply (simp only: double_number_of_BIT [symmetric])
   341   apply (simp only: double_number_of_Bit0 [symmetric])
   341   apply simp
   342   apply simp
   342   done
   343   done
   343 
   344 
   344 lemma shiftl_t2n: "shiftl (w :: 'a :: len word) n = 2 ^ n * w"
   345 lemma shiftl_t2n: "shiftl (w :: 'a :: len word) n = 2 ^ n * w"
   345   unfolding shiftl_def 
   346   unfolding shiftl_def