equal
deleted
inserted
replaced
808 |
808 |
809 text{*Collapse nested embeddings*} |
809 text{*Collapse nested embeddings*} |
810 lemma of_int_of_nat_eq [simp]: "of_int (of_nat n) = of_nat n" |
810 lemma of_int_of_nat_eq [simp]: "of_int (of_nat n) = of_nat n" |
811 by (induct n, auto) |
811 by (induct n, auto) |
812 |
812 |
813 lemma of_int_int_eq [simp]: "of_int (int n) = int n" |
813 lemma of_int_int_eq [simp]: "of_int (int n) = of_nat n" |
814 by (simp add: int_eq_of_nat) |
814 by (simp add: int_eq_of_nat) |
815 |
|
816 |
815 |
817 lemma Ints_cases [case_names of_int, cases set: Ints]: |
816 lemma Ints_cases [case_names of_int, cases set: Ints]: |
818 "q \<in> \<int> ==> (!!z. q = of_int z ==> C) ==> C" |
817 "q \<in> \<int> ==> (!!z. q = of_int z ==> C) ==> C" |
819 proof (simp add: Ints_def) |
818 proof (simp add: Ints_def) |
820 assume "!!z. q = of_int z ==> C" |
819 assume "!!z. q = of_int z ==> C" |
918 done |
917 done |
919 |
918 |
920 theorem int_induct [induct type: int, case_names nonneg neg]: |
919 theorem int_induct [induct type: int, case_names nonneg neg]: |
921 "[|!! n. P (int n); !!n. P (- (int (Suc n))) |] ==> P z" |
920 "[|!! n. P (int n); !!n. P (- (int (Suc n))) |] ==> P z" |
922 by (cases z) auto |
921 by (cases z) auto |
|
922 |
|
923 |
|
924 lemma of_nat_nat: "0 \<le> z ==> of_nat (nat z) = of_int z" |
|
925 apply (cases z) |
|
926 apply (simp_all add: not_zle_0_negative del: int_Suc) |
|
927 done |
923 |
928 |
924 |
929 |
925 (*Legacy ML bindings, but no longer the structure Int.*) |
930 (*Legacy ML bindings, but no longer the structure Int.*) |
926 ML |
931 ML |
927 {* |
932 {* |