1.1 --- a/src/HOL/Library/Order_Relation.thy Thu Dec 05 17:52:12 2013 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,116 +0,0 @@
1.4 -(* Author: Tobias Nipkow *)
1.5 -
1.6 -header {* Orders as Relations *}
1.7 -
1.8 -theory Order_Relation
1.9 -imports Main
1.10 -begin
1.11 -
1.12 -subsection{* Orders on a set *}
1.13 -
1.14 -definition "preorder_on A r \<equiv> refl_on A r \<and> trans r"
1.15 -
1.16 -definition "partial_order_on A r \<equiv> preorder_on A r \<and> antisym r"
1.17 -
1.18 -definition "linear_order_on A r \<equiv> partial_order_on A r \<and> total_on A r"
1.19 -
1.20 -definition "strict_linear_order_on A r \<equiv> trans r \<and> irrefl r \<and> total_on A r"
1.21 -
1.22 -definition "well_order_on A r \<equiv> linear_order_on A r \<and> wf(r - Id)"
1.23 -
1.24 -lemmas order_on_defs =
1.25 - preorder_on_def partial_order_on_def linear_order_on_def
1.26 - strict_linear_order_on_def well_order_on_def
1.27 -
1.28 -
1.29 -lemma preorder_on_empty[simp]: "preorder_on {} {}"
1.30 -by(simp add:preorder_on_def trans_def)
1.31 -
1.32 -lemma partial_order_on_empty[simp]: "partial_order_on {} {}"
1.33 -by(simp add:partial_order_on_def)
1.34 -
1.35 -lemma lnear_order_on_empty[simp]: "linear_order_on {} {}"
1.36 -by(simp add:linear_order_on_def)
1.37 -
1.38 -lemma well_order_on_empty[simp]: "well_order_on {} {}"
1.39 -by(simp add:well_order_on_def)
1.40 -
1.41 -
1.42 -lemma preorder_on_converse[simp]: "preorder_on A (r^-1) = preorder_on A r"
1.43 -by (simp add:preorder_on_def)
1.44 -
1.45 -lemma partial_order_on_converse[simp]:
1.46 - "partial_order_on A (r^-1) = partial_order_on A r"
1.47 -by (simp add: partial_order_on_def)
1.48 -
1.49 -lemma linear_order_on_converse[simp]:
1.50 - "linear_order_on A (r^-1) = linear_order_on A r"
1.51 -by (simp add: linear_order_on_def)
1.52 -
1.53 -
1.54 -lemma strict_linear_order_on_diff_Id:
1.55 - "linear_order_on A r \<Longrightarrow> strict_linear_order_on A (r-Id)"
1.56 -by(simp add: order_on_defs trans_diff_Id)
1.57 -
1.58 -
1.59 -subsection{* Orders on the field *}
1.60 -
1.61 -abbreviation "Refl r \<equiv> refl_on (Field r) r"
1.62 -
1.63 -abbreviation "Preorder r \<equiv> preorder_on (Field r) r"
1.64 -
1.65 -abbreviation "Partial_order r \<equiv> partial_order_on (Field r) r"
1.66 -
1.67 -abbreviation "Total r \<equiv> total_on (Field r) r"
1.68 -
1.69 -abbreviation "Linear_order r \<equiv> linear_order_on (Field r) r"
1.70 -
1.71 -abbreviation "Well_order r \<equiv> well_order_on (Field r) r"
1.72 -
1.73 -
1.74 -lemma subset_Image_Image_iff:
1.75 - "\<lbrakk> Preorder r; A \<subseteq> Field r; B \<subseteq> Field r\<rbrakk> \<Longrightarrow>
1.76 - r `` A \<subseteq> r `` B \<longleftrightarrow> (\<forall>a\<in>A.\<exists>b\<in>B. (b,a):r)"
1.77 -unfolding preorder_on_def refl_on_def Image_def
1.78 -apply (simp add: subset_eq)
1.79 -unfolding trans_def by fast
1.80 -
1.81 -lemma subset_Image1_Image1_iff:
1.82 - "\<lbrakk> Preorder r; a : Field r; b : Field r\<rbrakk> \<Longrightarrow> r `` {a} \<subseteq> r `` {b} \<longleftrightarrow> (b,a):r"
1.83 -by(simp add:subset_Image_Image_iff)
1.84 -
1.85 -lemma Refl_antisym_eq_Image1_Image1_iff:
1.86 - "\<lbrakk>Refl r; antisym r; a:Field r; b:Field r\<rbrakk> \<Longrightarrow> r `` {a} = r `` {b} \<longleftrightarrow> a=b"
1.87 -by(simp add: set_eq_iff antisym_def refl_on_def) metis
1.88 -
1.89 -lemma Partial_order_eq_Image1_Image1_iff:
1.90 - "\<lbrakk>Partial_order r; a:Field r; b:Field r\<rbrakk> \<Longrightarrow> r `` {a} = r `` {b} \<longleftrightarrow> a=b"
1.91 -by(auto simp:order_on_defs Refl_antisym_eq_Image1_Image1_iff)
1.92 -
1.93 -lemma Total_Id_Field:
1.94 -assumes TOT: "Total r" and NID: "\<not> (r <= Id)"
1.95 -shows "Field r = Field(r - Id)"
1.96 -using mono_Field[of "r - Id" r] Diff_subset[of r Id]
1.97 -proof(auto)
1.98 - have "r \<noteq> {}" using NID by fast
1.99 - then obtain b and c where "b \<noteq> c \<and> (b,c) \<in> r" using NID by fast
1.100 - hence 1: "b \<noteq> c \<and> {b,c} \<le> Field r" by (auto simp: Field_def)
1.101 - (* *)
1.102 - fix a assume *: "a \<in> Field r"
1.103 - obtain d where 2: "d \<in> Field r" and 3: "d \<noteq> a"
1.104 - using * 1 by auto
1.105 - hence "(a,d) \<in> r \<or> (d,a) \<in> r" using * TOT
1.106 - by (simp add: total_on_def)
1.107 - thus "a \<in> Field(r - Id)" using 3 unfolding Field_def by blast
1.108 -qed
1.109 -
1.110 -
1.111 -subsection{* Orders on a type *}
1.112 -
1.113 -abbreviation "strict_linear_order \<equiv> strict_linear_order_on UNIV"
1.114 -
1.115 -abbreviation "linear_order \<equiv> linear_order_on UNIV"
1.116 -
1.117 -abbreviation "well_order r \<equiv> well_order_on UNIV"
1.118 -
1.119 -end