# HG changeset patch # User haftmann # Date 1178480967 -7200 # Node ID 83b9f2d3fb3c760a5b5dbbd6520721c18527dfbc # Parent 643bb625a2c3e098b27a233619b01f75ce8bec76 dropped preorders, unified syntax diff -r 643bb625a2c3 -r 83b9f2d3fb3c src/HOL/Orderings.thy --- a/src/HOL/Orderings.thy Sun May 06 21:49:26 2007 +0200 +++ b/src/HOL/Orderings.thy Sun May 06 21:49:27 2007 +0200 @@ -48,11 +48,11 @@ definition min :: "'a \ 'a \ 'a" where - "min a b = (if a \ b then a else b)" + "min a b = (if a \<^loc>\ b then a else b)" definition max :: "'a \ 'a \ 'a" where - "max a b = (if a \ b then b else a)" + "max a b = (if a \<^loc>\ b then b else a)" end @@ -98,104 +98,99 @@ by rule+ (simp add: max_def ord_class.max_def) -subsection {* Quasiorders (preorders) *} +subsection {* Partial orders *} -class preorder = ord + +class order = ord + assumes less_le: "x \ y \ x \ y \ x \ y" and order_refl [iff]: "x \ x" and order_trans: "x \ y \ y \ z \ x \ z" + assumes antisym: "x \ y \ y \ x \ x = y" + begin text {* Reflexivity. *} -lemma eq_refl: "x = y \ x \ y" +lemma eq_refl: "x = y \ x \<^loc>\ y" -- {* This form is useful with the classical reasoner. *} by (erule ssubst) (rule order_refl) -lemma less_irrefl [iff]: "\ x \ x" +lemma less_irrefl [iff]: "\ x \<^loc>< x" by (simp add: less_le) -lemma le_less: "x \ y \ x \ y \ x = y" +lemma le_less: "x \<^loc>\ y \ x \<^loc>< y \ x = y" -- {* NOT suitable for iff, since it can cause PROOF FAILED. *} by (simp add: less_le) blast -lemma le_imp_less_or_eq: "x \ y \ x \ y \ x = y" +lemma le_imp_less_or_eq: "x \<^loc>\ y \ x \<^loc>< y \ x = y" unfolding less_le by blast -lemma less_imp_le: "x \ y \ x \ y" +lemma less_imp_le: "x \<^loc>< y \ x \<^loc>\ y" unfolding less_le by blast -lemma less_imp_neq: "x \ y \ x \ y" +lemma less_imp_neq: "x \<^loc>< y \ x \ y" by (erule contrapos_pn, erule subst, rule less_irrefl) text {* Useful for simplification, but too risky to include by default. *} -lemma less_imp_not_eq: "x \ y \ (x = y) \ False" +lemma less_imp_not_eq: "x \<^loc>< y \ (x = y) \ False" by auto -lemma less_imp_not_eq2: "x \ y \ (y = x) \ False" +lemma less_imp_not_eq2: "x \<^loc>< y \ (y = x) \ False" by auto text {* Transitivity rules for calculational reasoning *} -lemma neq_le_trans: "\ a \ b; a \ b \ \ a \ b" - by (simp add: less_le) - -lemma le_neq_trans: "\ a \ b; a \ b \ \ a \ b" +lemma neq_le_trans: "a \ b \ a \<^loc>\ b \ a \<^loc>< b" by (simp add: less_le) -end - -subsection {* Partial orderings *} +lemma le_neq_trans: "a \<^loc>\ b \ a \ b \ a \<^loc>< b" + by (simp add: less_le) -class order = preorder + - assumes antisym: "x \ y \ y \ x \ x = y" -begin text {* Asymmetry. *} -lemma less_not_sym: "x \ y \ \ (y \ x)" +lemma less_not_sym: "x \<^loc>< y \ \ (y \<^loc>< x)" by (simp add: less_le antisym) -lemma less_asym: "x \ y \ (\ P \ y \ x) \ P" +lemma less_asym: "x \<^loc>< y \ (\ P \ y \<^loc>< x) \ P" by (drule less_not_sym, erule contrapos_np) simp -lemma eq_iff: "x = y \ x \ y \ y \ x" +lemma eq_iff: "x = y \ x \<^loc>\ y \ y \<^loc>\ x" by (blast intro: antisym) -lemma antisym_conv: "y \ x \ x \ y \ x = y" +lemma antisym_conv: "y \<^loc>\ x \ x \<^loc>\ y \ x = y" by (blast intro: antisym) -lemma less_imp_neq: "x \ y \ x \ y" +lemma less_imp_neq: "x \<^loc>< y \ x \ y" by (erule contrapos_pn, erule subst, rule less_irrefl) text {* Transitivity. *} -lemma less_trans: "\ x \ y; y \ z \ \ x \ z" +lemma less_trans: "x \<^loc>< y \ y \<^loc>< z \ x \<^loc>< z" by (simp add: less_le) (blast intro: order_trans antisym) -lemma le_less_trans: "\ x \ y; y \ z \ \ x \ z" +lemma le_less_trans: "x \<^loc>\ y \ y \<^loc>< z \ x \<^loc>< z" by (simp add: less_le) (blast intro: order_trans antisym) -lemma less_le_trans: "\ x \ y; y \ z \ \ x \ z" +lemma less_le_trans: "x \<^loc>< y \ y \<^loc>\ z \ x \<^loc>< z" by (simp add: less_le) (blast intro: order_trans antisym) text {* Useful for simplification, but too risky to include by default. *} -lemma less_imp_not_less: "x \ y \ (\ y \ x) \ True" +lemma less_imp_not_less: "x \<^loc>< y \ (\ y \<^loc>< x) \ True" by (blast elim: less_asym) -lemma less_imp_triv: "x \ y \ (y \ x \ P) \ True" +lemma less_imp_triv: "x \<^loc>< y \ (y \<^loc>< x \ P) \ True" by (blast elim: less_asym) text {* Transitivity rules for calculational reasoning *} -lemma less_asym': "\ a \ b; b \ a \ \ P" +lemma less_asym': "a \<^loc>< b \ b \<^loc>< a \ P" by (rule less_asym) end @@ -207,88 +202,88 @@ assumes linear: "x \ y \ y \ x" begin -lemma less_linear: "x \ y \ x = y \ y \ x" +lemma less_linear: "x \<^loc>< y \ x = y \ y \<^loc>< x" unfolding less_le using less_le linear by blast -lemma le_less_linear: "x \ y \ y \ x" +lemma le_less_linear: "x \<^loc>\ y \ y \<^loc>< x" by (simp add: le_less less_linear) lemma le_cases [case_names le ge]: - "\ x \ y \ P; y \ x \ P\ \ P" + "(x \<^loc>\ y \ P) \ (y \<^loc>\ x \ P) \ P" using linear by blast lemma linorder_cases [case_names less equal greater]: - "\ x \ y \ P; x = y \ P; y \ x \ P\ \ P" + "(x \<^loc>< y \ P) \ (x = y \ P) \ (y \<^loc>< x \ P) \ P" using less_linear by blast -lemma not_less: "\ x \ y \ y \ x" +lemma not_less: "\ x \<^loc>< y \ y \<^loc>\ x" apply (simp add: less_le) using linear apply (blast intro: antisym) done -lemma not_le: "\ x \ y \ y \ x" +lemma not_le: "\ x \<^loc>\ y \ y \<^loc>< x" apply (simp add: less_le) using linear apply (blast intro: antisym) done -lemma neq_iff: "x \ y \ x \ y \ y \ x" +lemma neq_iff: "x \ y \ x \<^loc>< y \ y \<^loc>< x" by (cut_tac x = x and y = y in less_linear, auto) -lemma neqE: "\ x \ y; x \ y \ R; y \ x \ R\ \ R" +lemma neqE: "x \ y \ (x \<^loc>< y \ R) \ (y \<^loc>< x \ R) \ R" by (simp add: neq_iff) blast -lemma antisym_conv1: "\ x \ y \ x \ y \ x = y" +lemma antisym_conv1: "\ x \<^loc>< y \ x \<^loc>\ y \ x = y" by (blast intro: antisym dest: not_less [THEN iffD1]) -lemma antisym_conv2: "x \ y \ \ x \ y \ x = y" +lemma antisym_conv2: "x \<^loc>\ y \ \ x \<^loc>< y \ x = y" by (blast intro: antisym dest: not_less [THEN iffD1]) -lemma antisym_conv3: "\ y \ x \ \ x \ y \ x = y" +lemma antisym_conv3: "\ y \<^loc>< x \ \ x \<^loc>< y \ x = y" by (blast intro: antisym dest: not_less [THEN iffD1]) text{*Replacing the old Nat.leI*} -lemma leI: "\ x \ y \ y \ x" +lemma leI: "\ x \<^loc>< y \ y \<^loc>\ x" unfolding not_less . -lemma leD: "y \ x \ \ x \ y" +lemma leD: "y \<^loc>\ x \ \ x \<^loc>< y" unfolding not_less . (*FIXME inappropriate name (or delete altogether)*) -lemma not_leE: "\ y \ x \ x \ y" +lemma not_leE: "\ y \<^loc>\ x \ x \<^loc>< y" unfolding not_le . text {* min/max properties *} lemma min_le_iff_disj: - "min x y \ z \ x \ z \ y \ z" + "min x y \<^loc>\ z \ x \<^loc>\ z \ y \<^loc>\ z" unfolding min_def using linear by (auto intro: order_trans) lemma le_max_iff_disj: - "z \ max x y \ z \ x \ z \ y" + "z \<^loc>\ max x y \ z \<^loc>\ x \ z \<^loc>\ y" unfolding max_def using linear by (auto intro: order_trans) lemma min_less_iff_disj: - "min x y \ z \ x \ z \ y \ z" + "min x y \<^loc>< z \ x \<^loc>< z \ y \<^loc>< z" unfolding min_def le_less using less_linear by (auto intro: less_trans) lemma less_max_iff_disj: - "z \ max x y \ z \ x \ z \ y" + "z \<^loc>< max x y \ z \<^loc>< x \ z \<^loc>< y" unfolding max_def le_less using less_linear by (auto intro: less_trans) lemma min_less_iff_conj [simp]: - "z \ min x y \ z \ x \ z \ y" + "z \<^loc>< min x y \ z \<^loc>< x \ z \<^loc>< y" unfolding min_def le_less using less_linear by (auto intro: less_trans) lemma max_less_iff_conj [simp]: - "max x y \ z \ x \ z \ y \ z" + "max x y \<^loc>< z \ x \<^loc>< z \ y \<^loc>< z" unfolding max_def le_less using less_linear by (auto intro: less_trans) lemma split_min: - "P (min i j) \ (i \ j \ P i) \ (\ i \ j \ P j)" + "P (min i j) \ (i \<^loc>\ j \ P i) \ (\ i \<^loc>\ j \ P j)" by (simp add: min_def) lemma split_max: - "P (max i j) \ (i \ j \ P j) \ (\ i \ j \ P i)" + "P (max i j) \ (i \<^loc>\ j \ P j) \ (\ i \<^loc>\ j \ P i)" by (simp add: max_def) end @@ -297,15 +292,15 @@ subsection {* Name duplicates *} lemmas order_less_le = less_le -lemmas order_eq_refl = preorder_class.eq_refl -lemmas order_less_irrefl = preorder_class.less_irrefl -lemmas order_le_less = preorder_class.le_less -lemmas order_le_imp_less_or_eq = preorder_class.le_imp_less_or_eq -lemmas order_less_imp_le = preorder_class.less_imp_le -lemmas order_less_imp_not_eq = preorder_class.less_imp_not_eq -lemmas order_less_imp_not_eq2 = preorder_class.less_imp_not_eq2 -lemmas order_neq_le_trans = preorder_class.neq_le_trans -lemmas order_le_neq_trans = preorder_class.le_neq_trans +lemmas order_eq_refl = order_class.eq_refl +lemmas order_less_irrefl = order_class.less_irrefl +lemmas order_le_less = order_class.le_less +lemmas order_le_imp_less_or_eq = order_class.le_imp_less_or_eq +lemmas order_less_imp_le = order_class.less_imp_le +lemmas order_less_imp_not_eq = order_class.less_imp_not_eq +lemmas order_less_imp_not_eq2 = order_class.less_imp_not_eq2 +lemmas order_neq_le_trans = order_class.neq_le_trans +lemmas order_le_neq_trans = order_class.le_neq_trans lemmas order_antisym = antisym lemmas order_less_not_sym = order_class.less_not_sym @@ -371,6 +366,7 @@ in +(* sorry - there is no preorder class structure Quasi_Tac = Quasi_Tac_Fun ( struct val le_trans = thm "order_trans"; @@ -384,7 +380,7 @@ val less_imp_neq = thm "less_imp_neq"; val decomp_trans = decomp_gen ["Orderings.preorder"]; val decomp_quasi = decomp_gen ["Orderings.preorder"]; -end); +end);*) structure Order_Tac = Order_Tac_Fun ( struct