
haftmann@30661: (* Author: Tobias Nipkow *)
nipkow@26273: 
nipkow@26273: header {* Orders as Relations *}
nipkow@26273: 
nipkow@26273: theory Order_Relation
nipkow@29859: imports Main
nipkow@26273: begin
nipkow@26273: 
nipkow@26295: subsection{* Orders on a set *}
nipkow@26295: 
nipkow@30198: definition "preorder_on A r \<equiv> refl_on A r \<and> trans r"
nipkow@26295: 
nipkow@26295: definition "partial_order_on A r \<equiv> preorder_on A r \<and> antisym r"
nipkow@26273: 
nipkow@26295: definition "linear_order_on A r \<equiv> partial_order_on A r \<and> total_on A r"
nipkow@26295: 
nipkow@26295: definition "strict_linear_order_on A r \<equiv> trans r \<and> irrefl r \<and> total_on A r"
nipkow@26295: 
nipkow@26295: definition "well_order_on A r \<equiv> linear_order_on A r \<and> wf(r - Id)"
nipkow@26273: 
nipkow@26295: lemmas order_on_defs =
nipkow@26295:   preorder_on_def partial_order_on_def linear_order_on_def
nipkow@26295:   strict_linear_order_on_def well_order_on_def
nipkow@26295: 
nipkow@26273: 
nipkow@26295: lemma preorder_on_empty[simp]: "preorder_on {} {}"
nipkow@26295: by(simp add:preorder_on_def trans_def)
nipkow@26295: 
nipkow@26295: lemma partial_order_on_empty[simp]: "partial_order_on {} {}"
nipkow@26295: by(simp add:partial_order_on_def)
nipkow@26273: 
nipkow@26295: lemma lnear_order_on_empty[simp]: "linear_order_on {} {}"
nipkow@26295: by(simp add:linear_order_on_def)
nipkow@26295: 
nipkow@26295: lemma well_order_on_empty[simp]: "well_order_on {} {}"
nipkow@26295: by(simp add:well_order_on_def)
nipkow@26295: 
nipkow@26273: 
nipkow@26295: lemma preorder_on_converse[simp]: "preorder_on A (r^-1) = preorder_on A r"
nipkow@26295: by (simp add:preorder_on_def)
nipkow@26295: 
nipkow@26295: lemma partial_order_on_converse[simp]:
nipkow@26295:   "partial_order_on A (r^-1) = partial_order_on A r"
nipkow@26295: by (simp add: partial_order_on_def)
nipkow@26273: 
nipkow@26295: lemma linear_order_on_converse[simp]:
nipkow@26295:   "linear_order_on A (r^-1) = linear_order_on A r"
nipkow@26295: by (simp add: linear_order_on_def)
nipkow@26295: 
nipkow@26273: 
nipkow@26295: lemma strict_linear_order_on_diff_Id:
nipkow@26295:   "linear_order_on A r \<Longrightarrow> strict_linear_order_on A (r-Id)"
nipkow@26295: by(simp add: order_on_defs trans_diff_Id)
nipkow@26295: 
nipkow@26295: 
nipkow@26295: subsection{* Orders on the field *}
nipkow@26273: 
nipkow@30198: abbreviation "Refl r \<equiv> refl_on (Field r) r"
nipkow@26295: 
nipkow@26295: abbreviation "Preorder r \<equiv> preorder_on (Field r) r"
nipkow@26295: 
nipkow@26295: abbreviation "Partial_order r \<equiv> partial_order_on (Field r) r"
nipkow@26273: 
nipkow@26295: abbreviation "Total r \<equiv> total_on (Field r) r"
nipkow@26295: 
nipkow@26295: abbreviation "Linear_order r \<equiv> linear_order_on (Field r) r"
nipkow@26295: 
nipkow@26295: abbreviation "Well_order r \<equiv> well_order_on (Field r) r"
nipkow@26295: 
nipkow@26273: 
nipkow@26273: lemma subset_Image_Image_iff:
nipkow@26273:   "\<lbrakk> Preorder r; A \<subseteq> Field r; B \<subseteq> Field r\<rbrakk> \<Longrightarrow>
nipkow@26273:    r `` A \<subseteq> r `` B \<longleftrightarrow> (\<forall>a\<in>A.\<exists>b\<in>B. (b,a):r)"
blanchet@48750: unfolding preorder_on_def refl_on_def Image_def
blanchet@48750: apply (simp add: subset_eq)
blanchet@48750: unfolding trans_def by fast
nipkow@26273: 
nipkow@26273: lemma subset_Image1_Image1_iff:
nipkow@26273:   "\<lbrakk> Preorder r; a : Field r; b : Field r\<rbrakk> \<Longrightarrow> r `` {a} \<subseteq> r `` {b} \<longleftrightarrow> (b,a):r"
nipkow@26273: by(simp add:subset_Image_Image_iff)
nipkow@26273: 
nipkow@26273: lemma Refl_antisym_eq_Image1_Image1_iff:
nipkow@26273:   "\<lbrakk>Refl r; antisym r; a:Field r; b:Field r\<rbrakk> \<Longrightarrow> r `` {a} = r `` {b} \<longleftrightarrow> a=b"
nipkow@39302: by(simp add: set_eq_iff antisym_def refl_on_def) metis
nipkow@26273: 
nipkow@26273: lemma Partial_order_eq_Image1_Image1_iff:
nipkow@26273:   "\<lbrakk>Partial_order r; a:Field r; b:Field r\<rbrakk> \<Longrightarrow> r `` {a} = r `` {b} \<longleftrightarrow> a=b"
nipkow@26295: by(auto simp:order_on_defs Refl_antisym_eq_Image1_Image1_iff)
nipkow@26295: 
nipkow@26295: 
nipkow@26295: subsection{* Orders on a type *}
nipkow@26295: 
nipkow@26295: abbreviation "strict_linear_order \<equiv> strict_linear_order_on UNIV"
nipkow@26295: 
nipkow@26295: abbreviation "linear_order \<equiv> linear_order_on UNIV"
nipkow@26295: 
nipkow@26295: abbreviation "well_order r \<equiv> well_order_on UNIV"
nipkow@26273: 
nipkow@26273: end




