equal
deleted
inserted
replaced
454 qed (simp add: bot_nat_def) |
454 qed (simp add: bot_nat_def) |
455 |
455 |
456 end |
456 end |
457 |
457 |
458 instance nat :: no_top |
458 instance nat :: no_top |
459 by default (auto intro: less_Suc_eq_le[THEN iffD2]) |
459 by default (auto intro: less_Suc_eq_le [THEN iffD2]) |
|
460 |
460 |
461 |
461 subsubsection {* Introduction properties *} |
462 subsubsection {* Introduction properties *} |
462 |
463 |
463 lemma lessI [iff]: "n < Suc n" |
464 lemma lessI [iff]: "n < Suc n" |
464 by (simp add: less_Suc_eq_le) |
465 by (simp add: less_Suc_eq_le) |
712 done |
713 done |
713 |
714 |
714 text{*The naturals form an ordered @{text comm_semiring_1_cancel}*} |
715 text{*The naturals form an ordered @{text comm_semiring_1_cancel}*} |
715 instance nat :: linordered_semidom |
716 instance nat :: linordered_semidom |
716 proof |
717 proof |
717 fix i j k :: nat |
|
718 show "0 < (1::nat)" by simp |
718 show "0 < (1::nat)" by simp |
719 show "i \<le> j ==> k + i \<le> k + j" by simp |
719 show "\<And>m n q :: nat. m \<le> n \<Longrightarrow> q + m \<le> q + n" by simp |
720 show "i < j ==> 0 < k ==> k * i < k * j" by (simp add: mult_less_mono2) |
720 show "\<And>m n q :: nat. m < n \<Longrightarrow> 0 < q \<Longrightarrow> q * m < q * n" by (simp add: mult_less_mono2) |
721 qed |
721 qed |
722 |
722 |
723 instance nat :: no_zero_divisors |
723 instance nat :: no_zero_divisors |
724 proof |
724 proof |
725 fix a::nat and b::nat show "a ~= 0 \<Longrightarrow> b ~= 0 \<Longrightarrow> a * b ~= 0" by auto |
725 fix a::nat and b::nat show "a ~= 0 \<Longrightarrow> b ~= 0 \<Longrightarrow> a * b ~= 0" by auto |
1064 lemma diff_le_self [simp]: "m - n \<le> (m::nat)" |
1064 lemma diff_le_self [simp]: "m - n \<le> (m::nat)" |
1065 by (induct m n rule: diff_induct) (simp_all add: le_SucI) |
1065 by (induct m n rule: diff_induct) (simp_all add: le_SucI) |
1066 |
1066 |
1067 lemma le_iff_add: "(m::nat) \<le> n = (\<exists>k. n = m + k)" |
1067 lemma le_iff_add: "(m::nat) \<le> n = (\<exists>k. n = m + k)" |
1068 by (auto simp: le_add1 dest!: le_add_diff_inverse sym [of _ n]) |
1068 by (auto simp: le_add1 dest!: le_add_diff_inverse sym [of _ n]) |
|
1069 |
|
1070 instance nat :: ordered_cancel_comm_monoid_diff |
|
1071 proof |
|
1072 show "\<And>m n :: nat. m \<le> n \<longleftrightarrow> (\<exists>q. n = m + q)" by (fact le_iff_add) |
|
1073 qed |
1069 |
1074 |
1070 lemma less_imp_diff_less: "(j::nat) < k ==> j - n < k" |
1075 lemma less_imp_diff_less: "(j::nat) < k ==> j - n < k" |
1071 by (rule le_less_trans, rule diff_le_self) |
1076 by (rule le_less_trans, rule diff_le_self) |
1072 |
1077 |
1073 lemma diff_Suc_less [simp]: "0<n ==> n - Suc i < n" |
1078 lemma diff_Suc_less [simp]: "0<n ==> n - Suc i < n" |