src/HOL/Word/WordGenLib.thy
changeset 35416 d8d7d1b785af
parent 30729 461ee3e49ad3
equal deleted inserted replaced
35342:4dc65845eab3 35416:d8d7d1b785af
   342   "\<lbrakk>P 0; \<And>n. \<lbrakk>1 + n \<noteq> 0; P n\<rbrakk> \<Longrightarrow> P (1 + n)\<rbrakk> \<Longrightarrow> P (n::'b::len word)"
   342   "\<lbrakk>P 0; \<And>n. \<lbrakk>1 + n \<noteq> 0; P n\<rbrakk> \<Longrightarrow> P (1 + n)\<rbrakk> \<Longrightarrow> P (n::'b::len word)"
   343   apply (rule word_induct, simp)
   343   apply (rule word_induct, simp)
   344   apply (case_tac "1+n = 0", auto)
   344   apply (case_tac "1+n = 0", auto)
   345   done
   345   done
   346 
   346 
   347 constdefs
   347 definition word_rec :: "'a \<Rightarrow> ('b::len word \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> 'b word \<Rightarrow> 'a" where
   348   word_rec :: "'a \<Rightarrow> ('b::len word \<Rightarrow> 'a \<Rightarrow> 'a) \<Rightarrow> 'b word \<Rightarrow> 'a"
       
   349   "word_rec forZero forSuc n \<equiv> nat_rec forZero (forSuc \<circ> of_nat) (unat n)"
   348   "word_rec forZero forSuc n \<equiv> nat_rec forZero (forSuc \<circ> of_nat) (unat n)"
   350 
   349 
   351 lemma word_rec_0: "word_rec z s 0 = z"
   350 lemma word_rec_0: "word_rec z s 0 = z"
   352   by (simp add: word_rec_def)
   351   by (simp add: word_rec_def)
   353 
   352