src/HOL/Int.thy
changeset 63539 70d4d9e5707b
parent 62390 842917225d56
child 63648 f9f3006a5579
equal deleted inserted replaced
63533:42b6186fc0e4 63539:70d4d9e5707b
   631   shows "P"
   631   shows "P"
   632 proof (cases k "0::int" rule: linorder_cases)
   632 proof (cases k "0::int" rule: linorder_cases)
   633   case equal with assms(1) show P by simp
   633   case equal with assms(1) show P by simp
   634 next
   634 next
   635   case greater
   635   case greater
   636   then have "nat k > 0" by simp
   636   then have *: "nat k > 0" by simp
   637   moreover from this have "k = int (nat k)" by auto
   637   moreover from * have "k = int (nat k)" by auto
   638   ultimately show P using assms(2) by blast
   638   ultimately show P using assms(2) by blast
   639 next
   639 next
   640   case less
   640   case less
   641   then have "nat (- k) > 0" by simp
   641   then have *: "nat (- k) > 0" by simp
   642   moreover from this have "k = - int (nat (- k))" by auto
   642   moreover from * have "k = - int (nat (- k))" by auto
   643   ultimately show P using assms(3) by blast
   643   ultimately show P using assms(3) by blast
   644 qed
   644 qed
   645 
   645 
   646 theorem int_of_nat_induct [case_names nonneg neg, induct type: int]:
   646 theorem int_of_nat_induct [case_names nonneg neg, induct type: int]:
   647      "[|!! n. P (int n);  !!n. P (- (int (Suc n))) |] ==> P z"
   647      "[|!! n. P (int n);  !!n. P (- (int (Suc n))) |] ==> P z"