| author | fleury | 
| Wed, 30 Jul 2014 14:03:12 +0200 | |
| changeset 57704 | c0da3fc313e3 | 
| parent 57447 | 87429bdecad5 | 
| child 58826 | 2ed2eaabe3df | 
| permissions | -rw-r--r-- | 
| 28685 | 1 | (* Title: HOL/Orderings.thy | 
| 15524 | 2 | Author: Tobias Nipkow, Markus Wenzel, and Larry Paulson | 
| 3 | *) | |
| 4 | ||
| 25614 | 5 | header {* Abstract orderings *}
 | 
| 15524 | 6 | |
| 7 | theory Orderings | |
| 35301 
90e42f9ba4d1
distributed theory Algebras to theories Groups and Lattices
 haftmann parents: 
35115diff
changeset | 8 | imports HOL | 
| 46950 
d0181abdbdac
declare command keywords via theory header, including strict checking outside Pure;
 wenzelm parents: 
46884diff
changeset | 9 | keywords "print_orders" :: diag | 
| 15524 | 10 | begin | 
| 11 | ||
| 48891 | 12 | ML_file "~~/src/Provers/order.ML" | 
| 13 | ML_file "~~/src/Provers/quasi.ML" (* FIXME unused? *) | |
| 14 | ||
| 51487 | 15 | subsection {* Abstract ordering *}
 | 
| 16 | ||
| 17 | locale ordering = | |
| 18 | fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<preceq>" 50) | |
| 19 | and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (infix "\<prec>" 50) | |
| 20 | assumes strict_iff_order: "a \<prec> b \<longleftrightarrow> a \<preceq> b \<and> a \<noteq> b" | |
| 21 |   assumes refl: "a \<preceq> a" -- {* not @{text iff}: makes problems due to multiple (dual) interpretations *}
 | |
| 22 | and antisym: "a \<preceq> b \<Longrightarrow> b \<preceq> a \<Longrightarrow> a = b" | |
| 23 | and trans: "a \<preceq> b \<Longrightarrow> b \<preceq> c \<Longrightarrow> a \<preceq> c" | |
| 24 | begin | |
| 25 | ||
| 26 | lemma strict_implies_order: | |
| 27 | "a \<prec> b \<Longrightarrow> a \<preceq> b" | |
| 28 | by (simp add: strict_iff_order) | |
| 29 | ||
| 30 | lemma strict_implies_not_eq: | |
| 31 | "a \<prec> b \<Longrightarrow> a \<noteq> b" | |
| 32 | by (simp add: strict_iff_order) | |
| 33 | ||
| 34 | lemma not_eq_order_implies_strict: | |
| 35 | "a \<noteq> b \<Longrightarrow> a \<preceq> b \<Longrightarrow> a \<prec> b" | |
| 36 | by (simp add: strict_iff_order) | |
| 37 | ||
| 38 | lemma order_iff_strict: | |
| 39 | "a \<preceq> b \<longleftrightarrow> a \<prec> b \<or> a = b" | |
| 40 | by (auto simp add: strict_iff_order refl) | |
| 41 | ||
| 42 | lemma irrefl: -- {* not @{text iff}: makes problems due to multiple (dual) interpretations *}
 | |
| 43 | "\<not> a \<prec> a" | |
| 44 | by (simp add: strict_iff_order) | |
| 45 | ||
| 46 | lemma asym: | |
| 47 | "a \<prec> b \<Longrightarrow> b \<prec> a \<Longrightarrow> False" | |
| 48 | by (auto simp add: strict_iff_order intro: antisym) | |
| 49 | ||
| 50 | lemma strict_trans1: | |
| 51 | "a \<preceq> b \<Longrightarrow> b \<prec> c \<Longrightarrow> a \<prec> c" | |
| 52 | by (auto simp add: strict_iff_order intro: trans antisym) | |
| 53 | ||
| 54 | lemma strict_trans2: | |
| 55 | "a \<prec> b \<Longrightarrow> b \<preceq> c \<Longrightarrow> a \<prec> c" | |
| 56 | by (auto simp add: strict_iff_order intro: trans antisym) | |
| 57 | ||
| 58 | lemma strict_trans: | |
| 59 | "a \<prec> b \<Longrightarrow> b \<prec> c \<Longrightarrow> a \<prec> c" | |
| 60 | by (auto intro: strict_trans1 strict_implies_order) | |
| 61 | ||
| 62 | end | |
| 63 | ||
| 64 | locale ordering_top = ordering + | |
| 65 | fixes top :: "'a" | |
| 66 | assumes extremum [simp]: "a \<preceq> top" | |
| 67 | begin | |
| 68 | ||
| 69 | lemma extremum_uniqueI: | |
| 70 | "top \<preceq> a \<Longrightarrow> a = top" | |
| 71 | by (rule antisym) auto | |
| 72 | ||
| 73 | lemma extremum_unique: | |
| 74 | "top \<preceq> a \<longleftrightarrow> a = top" | |
| 75 | by (auto intro: antisym) | |
| 76 | ||
| 77 | lemma extremum_strict [simp]: | |
| 78 | "\<not> (top \<prec> a)" | |
| 79 | using extremum [of a] by (auto simp add: order_iff_strict intro: asym irrefl) | |
| 80 | ||
| 81 | lemma not_eq_extremum: | |
| 82 | "a \<noteq> top \<longleftrightarrow> a \<prec> top" | |
| 83 | by (auto simp add: order_iff_strict intro: not_eq_order_implies_strict extremum) | |
| 84 | ||
| 85 | end | |
| 86 | ||
| 87 | ||
| 35092 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 88 | subsection {* Syntactic orders *}
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 89 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 90 | class ord = | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 91 | fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 92 | and less :: "'a \<Rightarrow> 'a \<Rightarrow> bool" | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 93 | begin | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 94 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 95 | notation | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 96 |   less_eq  ("op <=") and
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 97 |   less_eq  ("(_/ <= _)" [51, 51] 50) and
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 98 |   less  ("op <") and
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 99 |   less  ("(_/ < _)"  [51, 51] 50)
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 100 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 101 | notation (xsymbols) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 102 |   less_eq  ("op \<le>") and
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 103 |   less_eq  ("(_/ \<le> _)"  [51, 51] 50)
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 104 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 105 | notation (HTML output) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 106 |   less_eq  ("op \<le>") and
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 107 |   less_eq  ("(_/ \<le> _)"  [51, 51] 50)
 | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 108 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 109 | abbreviation (input) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 110 | greater_eq (infix ">=" 50) where | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 111 | "x >= y \<equiv> y <= x" | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 112 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 113 | notation (input) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 114 | greater_eq (infix "\<ge>" 50) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 115 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 116 | abbreviation (input) | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 117 | greater (infix ">" 50) where | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 118 | "x > y \<equiv> y < x" | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 119 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 120 | end | 
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 121 | |
| 
cfe605c54e50
moved less_eq, less to Orderings.thy; moved abs, sgn to Groups.thy
 haftmann parents: 
35028diff
changeset | 122 | |
| 27682 | 123 | subsection {* Quasi orders *}
 | 
| 15524 | 124 | |
| 27682 | 125 | class preorder = ord + | 
| 126 | assumes less_le_not_le: "x < y \<longleftrightarrow> x \<le> y \<and> \<not> (y \<le> x)" | |
| 25062 | 127 | and order_refl [iff]: "x \<le> x" | 
| 128 | and order_trans: "x \<le> y \<Longrightarrow> y \<le> z \<Longrightarrow> x \<le> z" | |
| 21248 | 129 | begin | 
| 130 | ||
| 15524 | 131 | text {* Reflexivity. *}
 | 
| 132 | ||
| 25062 | 133 | lemma eq_refl: "x = y \<Longrightarrow> x \<le> y" | 
| 15524 | 134 |     -- {* This form is useful with the classical reasoner. *}
 | 
| 23212 | 135 | by (erule ssubst) (rule order_refl) | 
| 15524 | 136 | |
| 25062 | 137 | lemma less_irrefl [iff]: "\<not> x < x" | 
| 27682 | 138 | by (simp add: less_le_not_le) | 
| 139 | ||
| 140 | lemma less_imp_le: "x < y \<Longrightarrow> x \<le> y" | |
| 141 | unfolding less_le_not_le by blast | |
| 142 | ||
| 143 | ||
| 144 | text {* Asymmetry. *}
 | |
| 145 | ||
| 146 | lemma less_not_sym: "x < y \<Longrightarrow> \<not> (y < x)" | |
| 147 | by (simp add: less_le_not_le) | |
| 148 | ||
| 149 | lemma less_asym: "x < y \<Longrightarrow> (\<not> P \<Longrightarrow> y < x) \<Longrightarrow> P" | |
| 150 | by (drule less_not_sym, erule contrapos_np) simp | |
| 151 | ||
| 152 | ||
| 153 | text {* Transitivity. *}
 | |
| 154 | ||
| 155 | lemma less_trans: "x < y \<Longrightarrow> y < z \<Longrightarrow> x < z" | |
| 156 | by (auto simp add: less_le_not_le intro: order_trans) | |
| 157 | ||
| 158 | lemma le_less_trans: "x \<le> y \<Longrightarrow> y < z \<Longrightarrow> x < z" | |
| 159 | by (auto simp add: less_le_not_le intro: order_trans) | |
| 160 | ||
| 161 | lemma less_le_trans: "x < y \<Longrightarrow> y \<le> z \<Longrightarrow> x < z" | |
| 162 | by (auto simp add: less_le_not_le intro: order_trans) | |
| 163 | ||
| 164 | ||
| 165 | text {* Useful for simplification, but too risky to include by default. *}
 | |
| 166 | ||
| 167 | lemma less_imp_not_less: "x < y \<Longrightarrow> (\<not> y < x) \<longleftrightarrow> True" | |
| 168 | by (blast elim: less_asym) | |
| 169 | ||
| 170 | lemma less_imp_triv: "x < y \<Longrightarrow> (y < x \<longrightarrow> P) \<longleftrightarrow> True" | |
| 171 | by (blast elim: less_asym) | |
| 172 | ||
| 173 | ||
| 174 | text {* Transitivity rules for calculational reasoning *}
 | |
| 175 | ||
| 176 | lemma less_asym': "a < b \<Longrightarrow> b < a \<Longrightarrow> P" | |
| 177 | by (rule less_asym) | |
| 178 | ||
| 179 | ||
| 180 | text {* Dual order *}
 | |
| 181 | ||
| 182 | lemma dual_preorder: | |
| 36635 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
35828diff
changeset | 183 | "class.preorder (op \<ge>) (op >)" | 
| 28823 | 184 | proof qed (auto simp add: less_le_not_le intro: order_trans) | 
| 27682 | 185 | |
| 186 | end | |
| 187 | ||
| 188 | ||
| 189 | subsection {* Partial orders *}
 | |
| 190 | ||
| 191 | class order = preorder + | |
| 192 | assumes antisym: "x \<le> y \<Longrightarrow> y \<le> x \<Longrightarrow> x = y" | |
| 193 | begin | |
| 194 | ||
| 51487 | 195 | lemma less_le: "x < y \<longleftrightarrow> x \<le> y \<and> x \<noteq> y" | 
| 196 | by (auto simp add: less_le_not_le intro: antisym) | |
| 197 | ||
| 54868 | 198 | sublocale order!: ordering less_eq less + dual_order!: ordering greater_eq greater | 
| 51487 | 199 | by default (auto intro: antisym order_trans simp add: less_le) | 
| 200 | ||
| 201 | ||
| 202 | text {* Reflexivity. *}
 | |
| 15524 | 203 | |
| 25062 | 204 | lemma le_less: "x \<le> y \<longleftrightarrow> x < y \<or> x = y" | 
| 15524 | 205 |     -- {* NOT suitable for iff, since it can cause PROOF FAILED. *}
 | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 206 | by (fact order.order_iff_strict) | 
| 15524 | 207 | |
| 25062 | 208 | lemma le_imp_less_or_eq: "x \<le> y \<Longrightarrow> x < y \<or> x = y" | 
| 23212 | 209 | unfolding less_le by blast | 
| 15524 | 210 | |
| 21329 | 211 | |
| 212 | text {* Useful for simplification, but too risky to include by default. *}
 | |
| 213 | ||
| 25062 | 214 | lemma less_imp_not_eq: "x < y \<Longrightarrow> (x = y) \<longleftrightarrow> False" | 
| 23212 | 215 | by auto | 
| 21329 | 216 | |
| 25062 | 217 | lemma less_imp_not_eq2: "x < y \<Longrightarrow> (y = x) \<longleftrightarrow> False" | 
| 23212 | 218 | by auto | 
| 21329 | 219 | |
| 220 | ||
| 221 | text {* Transitivity rules for calculational reasoning *}
 | |
| 222 | ||
| 25062 | 223 | lemma neq_le_trans: "a \<noteq> b \<Longrightarrow> a \<le> b \<Longrightarrow> a < b" | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 224 | by (fact order.not_eq_order_implies_strict) | 
| 21329 | 225 | |
| 25062 | 226 | lemma le_neq_trans: "a \<le> b \<Longrightarrow> a \<noteq> b \<Longrightarrow> a < b" | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 227 | by (rule order.not_eq_order_implies_strict) | 
| 21329 | 228 | |
| 15524 | 229 | |
| 230 | text {* Asymmetry. *}
 | |
| 231 | ||
| 25062 | 232 | lemma eq_iff: "x = y \<longleftrightarrow> x \<le> y \<and> y \<le> x" | 
| 23212 | 233 | by (blast intro: antisym) | 
| 15524 | 234 | |
| 25062 | 235 | lemma antisym_conv: "y \<le> x \<Longrightarrow> x \<le> y \<longleftrightarrow> x = y" | 
| 23212 | 236 | by (blast intro: antisym) | 
| 15524 | 237 | |
| 25062 | 238 | lemma less_imp_neq: "x < y \<Longrightarrow> x \<noteq> y" | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 239 | by (fact order.strict_implies_not_eq) | 
| 21248 | 240 | |
| 21083 | 241 | |
| 27107 | 242 | text {* Least value operator *}
 | 
| 243 | ||
| 27299 | 244 | definition (in ord) | 
| 27107 | 245 |   Least :: "('a \<Rightarrow> bool) \<Rightarrow> 'a" (binder "LEAST " 10) where
 | 
| 246 | "Least P = (THE x. P x \<and> (\<forall>y. P y \<longrightarrow> x \<le> y))" | |
| 247 | ||
| 248 | lemma Least_equality: | |
| 249 | assumes "P x" | |
| 250 | and "\<And>y. P y \<Longrightarrow> x \<le> y" | |
| 251 | shows "Least P = x" | |
| 252 | unfolding Least_def by (rule the_equality) | |
| 253 | (blast intro: assms antisym)+ | |
| 254 | ||
| 255 | lemma LeastI2_order: | |
| 256 | assumes "P x" | |
| 257 | and "\<And>y. P y \<Longrightarrow> x \<le> y" | |
| 258 | and "\<And>x. P x \<Longrightarrow> \<forall>y. P y \<longrightarrow> x \<le> y \<Longrightarrow> Q x" | |
| 259 | shows "Q (Least P)" | |
| 260 | unfolding Least_def by (rule theI2) | |
| 261 | (blast intro: assms antisym)+ | |
| 262 | ||
| 263 | ||
| 26014 | 264 | text {* Dual order *}
 | 
| 22916 | 265 | |
| 26014 | 266 | lemma dual_order: | 
| 36635 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
35828diff
changeset | 267 | "class.order (op \<ge>) (op >)" | 
| 27682 | 268 | by (intro_locales, rule dual_preorder) (unfold_locales, rule antisym) | 
| 22916 | 269 | |
| 21248 | 270 | end | 
| 15524 | 271 | |
| 21329 | 272 | |
| 56545 | 273 | text {* Alternative introduction rule with bias towards strict order *}
 | 
| 274 | ||
| 275 | lemma order_strictI: | |
| 276 | fixes less (infix "\<sqsubset>" 50) | |
| 277 | and less_eq (infix "\<sqsubseteq>" 50) | |
| 278 | assumes less_eq_less: "\<And>a b. a \<sqsubseteq> b \<longleftrightarrow> a \<sqsubset> b \<or> a = b" | |
| 279 | assumes asym: "\<And>a b. a \<sqsubset> b \<Longrightarrow> \<not> b \<sqsubset> a" | |
| 280 | assumes irrefl: "\<And>a. \<not> a \<sqsubset> a" | |
| 281 | assumes trans: "\<And>a b c. a \<sqsubset> b \<Longrightarrow> b \<sqsubset> c \<Longrightarrow> a \<sqsubset> c" | |
| 282 | shows "class.order less_eq less" | |
| 283 | proof | |
| 284 | fix a b | |
| 285 | show "a \<sqsubset> b \<longleftrightarrow> a \<sqsubseteq> b \<and> \<not> b \<sqsubseteq> a" | |
| 286 | by (auto simp add: less_eq_less asym irrefl) | |
| 287 | next | |
| 288 | fix a | |
| 289 | show "a \<sqsubseteq> a" | |
| 290 | by (auto simp add: less_eq_less) | |
| 291 | next | |
| 292 | fix a b c | |
| 293 | assume "a \<sqsubseteq> b" and "b \<sqsubseteq> c" then show "a \<sqsubseteq> c" | |
| 294 | by (auto simp add: less_eq_less intro: trans) | |
| 295 | next | |
| 296 | fix a b | |
| 297 | assume "a \<sqsubseteq> b" and "b \<sqsubseteq> a" then show "a = b" | |
| 298 | by (auto simp add: less_eq_less asym) | |
| 299 | qed | |
| 300 | ||
| 301 | ||
| 21329 | 302 | subsection {* Linear (total) orders *}
 | 
| 303 | ||
| 22316 | 304 | class linorder = order + | 
| 25207 | 305 | assumes linear: "x \<le> y \<or> y \<le> x" | 
| 21248 | 306 | begin | 
| 307 | ||
| 25062 | 308 | lemma less_linear: "x < y \<or> x = y \<or> y < x" | 
| 23212 | 309 | unfolding less_le using less_le linear by blast | 
| 21248 | 310 | |
| 25062 | 311 | lemma le_less_linear: "x \<le> y \<or> y < x" | 
| 23212 | 312 | by (simp add: le_less less_linear) | 
| 21248 | 313 | |
| 314 | lemma le_cases [case_names le ge]: | |
| 25062 | 315 | "(x \<le> y \<Longrightarrow> P) \<Longrightarrow> (y \<le> x \<Longrightarrow> P) \<Longrightarrow> P" | 
| 23212 | 316 | using linear by blast | 
| 21248 | 317 | |
| 22384 
33a46e6c7f04
prefix of class interpretation not mandatory any longer
 haftmann parents: 
22377diff
changeset | 318 | lemma linorder_cases [case_names less equal greater]: | 
| 25062 | 319 | "(x < y \<Longrightarrow> P) \<Longrightarrow> (x = y \<Longrightarrow> P) \<Longrightarrow> (y < x \<Longrightarrow> P) \<Longrightarrow> P" | 
| 23212 | 320 | using less_linear by blast | 
| 21248 | 321 | |
| 57447 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
56545diff
changeset | 322 | lemma linorder_wlog[case_names le sym]: | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
56545diff
changeset | 323 | "(\<And>a b. a \<le> b \<Longrightarrow> P a b) \<Longrightarrow> (\<And>a b. P b a \<Longrightarrow> P a b) \<Longrightarrow> P a b" | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
56545diff
changeset | 324 | by (cases rule: le_cases[of a b]) blast+ | 
| 
87429bdecad5
import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
 hoelzl parents: 
56545diff
changeset | 325 | |
| 25062 | 326 | lemma not_less: "\<not> x < y \<longleftrightarrow> y \<le> x" | 
| 23212 | 327 | apply (simp add: less_le) | 
| 328 | using linear apply (blast intro: antisym) | |
| 329 | done | |
| 330 | ||
| 331 | lemma not_less_iff_gr_or_eq: | |
| 25062 | 332 | "\<not>(x < y) \<longleftrightarrow> (x > y | x = y)" | 
| 23212 | 333 | apply(simp add:not_less le_less) | 
| 334 | apply blast | |
| 335 | done | |
| 15524 | 336 | |
| 25062 | 337 | lemma not_le: "\<not> x \<le> y \<longleftrightarrow> y < x" | 
| 23212 | 338 | apply (simp add: less_le) | 
| 339 | using linear apply (blast intro: antisym) | |
| 340 | done | |
| 15524 | 341 | |
| 25062 | 342 | lemma neq_iff: "x \<noteq> y \<longleftrightarrow> x < y \<or> y < x" | 
| 23212 | 343 | by (cut_tac x = x and y = y in less_linear, auto) | 
| 15524 | 344 | |
| 25062 | 345 | lemma neqE: "x \<noteq> y \<Longrightarrow> (x < y \<Longrightarrow> R) \<Longrightarrow> (y < x \<Longrightarrow> R) \<Longrightarrow> R" | 
| 23212 | 346 | by (simp add: neq_iff) blast | 
| 15524 | 347 | |
| 25062 | 348 | lemma antisym_conv1: "\<not> x < y \<Longrightarrow> x \<le> y \<longleftrightarrow> x = y" | 
| 23212 | 349 | by (blast intro: antisym dest: not_less [THEN iffD1]) | 
| 15524 | 350 | |
| 25062 | 351 | lemma antisym_conv2: "x \<le> y \<Longrightarrow> \<not> x < y \<longleftrightarrow> x = y" | 
| 23212 | 352 | by (blast intro: antisym dest: not_less [THEN iffD1]) | 
| 15524 | 353 | |
| 25062 | 354 | lemma antisym_conv3: "\<not> y < x \<Longrightarrow> \<not> x < y \<longleftrightarrow> x = y" | 
| 23212 | 355 | by (blast intro: antisym dest: not_less [THEN iffD1]) | 
| 15524 | 356 | |
| 25062 | 357 | lemma leI: "\<not> x < y \<Longrightarrow> y \<le> x" | 
| 23212 | 358 | unfolding not_less . | 
| 16796 | 359 | |
| 25062 | 360 | lemma leD: "y \<le> x \<Longrightarrow> \<not> x < y" | 
| 23212 | 361 | unfolding not_less . | 
| 16796 | 362 | |
| 363 | (*FIXME inappropriate name (or delete altogether)*) | |
| 25062 | 364 | lemma not_leE: "\<not> y \<le> x \<Longrightarrow> x < y" | 
| 23212 | 365 | unfolding not_le . | 
| 21248 | 366 | |
| 26014 | 367 | text {* Dual order *}
 | 
| 22916 | 368 | |
| 26014 | 369 | lemma dual_linorder: | 
| 36635 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
35828diff
changeset | 370 | "class.linorder (op \<ge>) (op >)" | 
| 
080b755377c0
locale predicates of classes carry a mandatory "class" prefix
 haftmann parents: 
35828diff
changeset | 371 | by (rule class.linorder.intro, rule dual_order) (unfold_locales, rule linear) | 
| 22916 | 372 | |
| 21248 | 373 | end | 
| 374 | ||
| 23948 | 375 | |
| 56545 | 376 | text {* Alternative introduction rule with bias towards strict order *}
 | 
| 377 | ||
| 378 | lemma linorder_strictI: | |
| 379 | fixes less (infix "\<sqsubset>" 50) | |
| 380 | and less_eq (infix "\<sqsubseteq>" 50) | |
| 381 | assumes "class.order less_eq less" | |
| 382 | assumes trichotomy: "\<And>a b. a \<sqsubset> b \<or> a = b \<or> b \<sqsubset> a" | |
| 383 | shows "class.linorder less_eq less" | |
| 384 | proof - | |
| 385 | interpret order less_eq less | |
| 386 | by (fact `class.order less_eq less`) | |
| 387 | show ?thesis | |
| 388 | proof | |
| 389 | fix a b | |
| 390 | show "a \<sqsubseteq> b \<or> b \<sqsubseteq> a" | |
| 391 | using trichotomy by (auto simp add: le_less) | |
| 392 | qed | |
| 393 | qed | |
| 394 | ||
| 395 | ||
| 21083 | 396 | subsection {* Reasoning tools setup *}
 | 
| 397 | ||
| 21091 | 398 | ML {*
 | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 399 | signature ORDERS = | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 400 | sig | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 401 | val print_structures: Proof.context -> unit | 
| 32215 | 402 | val order_tac: Proof.context -> thm list -> int -> tactic | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 403 | end; | 
| 21091 | 404 | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 405 | structure Orders: ORDERS = | 
| 21248 | 406 | struct | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 407 | |
| 56508 | 408 | (* context data *) | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 409 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 410 | fun struct_eq ((s1: string, ts1), (s2, ts2)) = | 
| 56508 | 411 | s1 = s2 andalso eq_list (op aconv) (ts1, ts2); | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 412 | |
| 33519 | 413 | structure Data = Generic_Data | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 414 | ( | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 415 | type T = ((string * term list) * Order_Tac.less_arith) list; | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 416 | (* Order structures: | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 417 | identifier of the structure, list of operations and record of theorems | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 418 | needed to set up the transitivity reasoner, | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 419 | identifier and operations identify the structure uniquely. *) | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 420 | val empty = []; | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 421 | val extend = I; | 
| 33519 | 422 | fun merge data = AList.join struct_eq (K fst) data; | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 423 | ); | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 424 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 425 | fun print_structures ctxt = | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 426 | let | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 427 | val structs = Data.get (Context.Proof ctxt); | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 428 | fun pretty_term t = Pretty.block | 
| 24920 | 429 | [Pretty.quote (Syntax.pretty_term ctxt t), Pretty.brk 1, | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 430 | Pretty.str "::", Pretty.brk 1, | 
| 24920 | 431 | Pretty.quote (Syntax.pretty_typ ctxt (type_of t))]; | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 432 | fun pretty_struct ((s, ts), _) = Pretty.block | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 433 | [Pretty.str s, Pretty.str ":", Pretty.brk 1, | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 434 |        Pretty.enclose "(" ")" (Pretty.breaks (map pretty_term ts))];
 | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 435 | in | 
| 51579 | 436 | Pretty.writeln (Pretty.big_list "order structures:" (map pretty_struct structs)) | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 437 | end; | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 438 | |
| 56508 | 439 | val _ = | 
| 440 |   Outer_Syntax.improper_command @{command_spec "print_orders"}
 | |
| 441 | "print order structures available to transitivity reasoner" | |
| 442 | (Scan.succeed (Toplevel.unknown_context o | |
| 443 | Toplevel.keep (print_structures o Toplevel.context_of))); | |
| 21091 | 444 | |
| 56508 | 445 | |
| 446 | (* tactics *) | |
| 447 | ||
| 448 | fun struct_tac ((s, ops), thms) ctxt facts = | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 449 | let | 
| 56508 | 450 | val [eq, le, less] = ops; | 
| 30107 
f3b3b0e3d184
Fixed nonexhaustive match problem in decomp, to make it fail more gracefully
 berghofe parents: 
29823diff
changeset | 451 |     fun decomp thy (@{const Trueprop} $ t) =
 | 
| 56508 | 452 | let | 
| 453 | fun excluded t = | |
| 454 | (* exclude numeric types: linear arithmetic subsumes transitivity *) | |
| 455 | let val T = type_of t | |
| 456 | in | |
| 457 | T = HOLogic.natT orelse T = HOLogic.intT orelse T = HOLogic.realT | |
| 458 | end; | |
| 459 | fun rel (bin_op $ t1 $ t2) = | |
| 460 | if excluded t1 then NONE | |
| 461 | else if Pattern.matches thy (eq, bin_op) then SOME (t1, "=", t2) | |
| 462 | else if Pattern.matches thy (le, bin_op) then SOME (t1, "<=", t2) | |
| 463 | else if Pattern.matches thy (less, bin_op) then SOME (t1, "<", t2) | |
| 464 | else NONE | |
| 465 | | rel _ = NONE; | |
| 466 |             fun dec (Const (@{const_name Not}, _) $ t) =
 | |
| 467 | (case rel t of NONE => | |
| 468 | NONE | |
| 469 | | SOME (t1, rel, t2) => SOME (t1, "~" ^ rel, t2)) | |
| 470 | | dec x = rel x; | |
| 471 | in dec t end | |
| 472 | | decomp _ _ = NONE; | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 473 | in | 
| 56508 | 474 | (case s of | 
| 475 | "order" => Order_Tac.partial_tac decomp thms ctxt facts | |
| 476 | | "linorder" => Order_Tac.linear_tac decomp thms ctxt facts | |
| 477 |     | _ => error ("Unknown order kind " ^ quote s ^ " encountered in transitivity reasoner"))
 | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 478 | end | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 479 | |
| 56508 | 480 | fun order_tac ctxt facts = | 
| 481 | FIRST' (map (fn s => CHANGED o struct_tac s ctxt facts) (Data.get (Context.Proof ctxt))); | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 482 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 483 | |
| 56508 | 484 | (* attributes *) | 
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 485 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 486 | fun add_struct_thm s tag = | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 487 | Thm.declaration_attribute | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 488 | (fn thm => Data.map (AList.map_default struct_eq (s, Order_Tac.empty TrueI) (Order_Tac.update tag thm))); | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 489 | fun del_struct s = | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 490 | Thm.declaration_attribute | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 491 | (fn _ => Data.map (AList.delete struct_eq s)); | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 492 | |
| 24867 | 493 | val _ = | 
| 56508 | 494 | Theory.setup | 
| 495 |     (Attrib.setup @{binding order}
 | |
| 496 | (Scan.lift ((Args.add -- Args.name >> (fn (_, s) => SOME s) || Args.del >> K NONE) --| | |
| 497 | Args.colon (* FIXME || Scan.succeed true *) ) -- Scan.lift Args.name -- | |
| 498 | Scan.repeat Args.term | |
| 499 | >> (fn ((SOME tag, n), ts) => add_struct_thm (n, ts) tag | |
| 500 | | ((NONE, n), ts) => del_struct (n, ts))) | |
| 501 | "theorems controlling transitivity reasoner"); | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 502 | |
| 21091 | 503 | end; | 
| 504 | *} | |
| 505 | ||
| 47432 | 506 | method_setup order = {*
 | 
| 507 | Scan.succeed (fn ctxt => SIMPLE_METHOD' (Orders.order_tac ctxt [])) | |
| 508 | *} "transitivity reasoner" | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 509 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 510 | |
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 511 | text {* Declarations to set up transitivity reasoner of partial and linear orders. *}
 | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 512 | |
| 25076 | 513 | context order | 
| 514 | begin | |
| 515 | ||
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 516 | (* The type constraint on @{term op =} below is necessary since the operation
 | 
| 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 517 | is not a parameter of the locale. *) | 
| 25076 | 518 | |
| 27689 | 519 | declare less_irrefl [THEN notE, order add less_reflE: order "op = :: 'a \<Rightarrow> 'a \<Rightarrow> bool" "op <=" "op <"] | 
| 520 | ||
| 521 | declare order_refl [order add le_refl: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 522 | ||
| 523 | declare less_imp_le [order add less_imp_le: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 524 | ||
| 525 | declare antisym [order add eqI: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 526 | ||
| 527 | declare eq_refl [order add eqD1: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 528 | ||
| 529 | declare sym [THEN eq_refl, order add eqD2: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 530 | ||
| 531 | declare less_trans [order add less_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 532 | ||
| 533 | declare less_le_trans [order add less_le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 534 | ||
| 535 | declare le_less_trans [order add le_less_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 536 | ||
| 537 | declare order_trans [order add le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 538 | ||
| 539 | declare le_neq_trans [order add le_neq_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 540 | ||
| 541 | declare neq_le_trans [order add neq_le_trans: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 542 | ||
| 543 | declare less_imp_neq [order add less_imp_neq: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 544 | ||
| 545 | declare eq_neq_eq_imp_neq [order add eq_neq_eq_imp_neq: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 546 | ||
| 547 | declare not_sym [order add not_sym: order "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 548 | |
| 25076 | 549 | end | 
| 550 | ||
| 551 | context linorder | |
| 552 | begin | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 553 | |
| 27689 | 554 | declare [[order del: order "op = :: 'a => 'a => bool" "op <=" "op <"]] | 
| 555 | ||
| 556 | declare less_irrefl [THEN notE, order add less_reflE: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 557 | ||
| 558 | declare order_refl [order add le_refl: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 559 | ||
| 560 | declare less_imp_le [order add less_imp_le: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 561 | ||
| 562 | declare not_less [THEN iffD2, order add not_lessI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 563 | ||
| 564 | declare not_le [THEN iffD2, order add not_leI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 565 | ||
| 566 | declare not_less [THEN iffD1, order add not_lessD: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 567 | ||
| 568 | declare not_le [THEN iffD1, order add not_leD: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 569 | ||
| 570 | declare antisym [order add eqI: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 571 | ||
| 572 | declare eq_refl [order add eqD1: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 25076 | 573 | |
| 27689 | 574 | declare sym [THEN eq_refl, order add eqD2: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | 
| 575 | ||
| 576 | declare less_trans [order add less_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 577 | ||
| 578 | declare less_le_trans [order add less_le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 579 | ||
| 580 | declare le_less_trans [order add le_less_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 581 | ||
| 582 | declare order_trans [order add le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 583 | ||
| 584 | declare le_neq_trans [order add le_neq_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 585 | ||
| 586 | declare neq_le_trans [order add neq_le_trans: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 587 | ||
| 588 | declare less_imp_neq [order add less_imp_neq: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 589 | ||
| 590 | declare eq_neq_eq_imp_neq [order add eq_neq_eq_imp_neq: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 591 | ||
| 592 | declare not_sym [order add not_sym: linorder "op = :: 'a => 'a => bool" "op <=" "op <"] | |
| 24641 
448edc627ee4
Transitivity reasoner set up for locales order and linorder.
 ballarin parents: 
24422diff
changeset | 593 | |
| 25076 | 594 | end | 
| 595 | ||
| 21083 | 596 | setup {*
 | 
| 56509 | 597 | map_theory_simpset (fn ctxt0 => ctxt0 addSolver | 
| 598 | mk_solver "Transitivity" (fn ctxt => Orders.order_tac ctxt (Simplifier.prems_of ctxt))) | |
| 599 | (*Adding the transitivity reasoners also as safe solvers showed a slight | |
| 600 | speed up, but the reasoning strength appears to be not higher (at least | |
| 601 | no breaking of additional proofs in the entire HOL distribution, as | |
| 602 | of 5 March 2004, was observed).*) | |
| 603 | *} | |
| 15524 | 604 | |
| 56509 | 605 | ML {*
 | 
| 606 | local | |
| 607 | fun prp t thm = Thm.prop_of thm = t; (* FIXME proper aconv!? *) | |
| 608 | in | |
| 15524 | 609 | |
| 56509 | 610 | fun antisym_le_simproc ctxt ct = | 
| 611 | (case term_of ct of | |
| 612 | (le as Const (_, T)) $ r $ s => | |
| 613 | (let | |
| 614 | val prems = Simplifier.prems_of ctxt; | |
| 615 |         val less = Const (@{const_name less}, T);
 | |
| 616 | val t = HOLogic.mk_Trueprop(le $ s $ r); | |
| 617 | in | |
| 618 | (case find_first (prp t) prems of | |
| 619 | NONE => | |
| 620 | let val t = HOLogic.mk_Trueprop(HOLogic.Not $ (less $ r $ s)) in | |
| 621 | (case find_first (prp t) prems of | |
| 622 | NONE => NONE | |
| 623 |               | SOME thm => SOME(mk_meta_eq(thm RS @{thm linorder_class.antisym_conv1})))
 | |
| 624 | end | |
| 625 |          | SOME thm => SOME (mk_meta_eq (thm RS @{thm order_class.antisym_conv})))
 | |
| 626 | end handle THM _ => NONE) | |
| 627 | | _ => NONE); | |
| 15524 | 628 | |
| 56509 | 629 | fun antisym_less_simproc ctxt ct = | 
| 630 | (case term_of ct of | |
| 631 | NotC $ ((less as Const(_,T)) $ r $ s) => | |
| 632 | (let | |
| 633 | val prems = Simplifier.prems_of ctxt; | |
| 634 |        val le = Const (@{const_name less_eq}, T);
 | |
| 635 | val t = HOLogic.mk_Trueprop(le $ r $ s); | |
| 636 | in | |
| 637 | (case find_first (prp t) prems of | |
| 638 | NONE => | |
| 639 | let val t = HOLogic.mk_Trueprop (NotC $ (less $ s $ r)) in | |
| 640 | (case find_first (prp t) prems of | |
| 641 | NONE => NONE | |
| 642 |               | SOME thm => SOME (mk_meta_eq(thm RS @{thm linorder_class.antisym_conv3})))
 | |
| 643 | end | |
| 644 |         | SOME thm => SOME (mk_meta_eq (thm RS @{thm linorder_class.antisym_conv2})))
 | |
| 645 | end handle THM _ => NONE) | |
| 646 | | _ => NONE); | |
| 21083 | 647 | |
| 56509 | 648 | end; | 
| 21083 | 649 | *} | 
| 15524 | 650 | |
| 56509 | 651 | simproc_setup antisym_le ("(x::'a::order) \<le> y") = "K antisym_le_simproc"
 | 
| 652 | simproc_setup antisym_less ("\<not> (x::'a::linorder) < y") = "K antisym_less_simproc"
 | |
| 653 | ||
| 15524 | 654 | |
| 21083 | 655 | subsection {* Bounded quantifiers *}
 | 
| 656 | ||
| 657 | syntax | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 658 |   "_All_less" :: "[idt, 'a, bool] => bool"    ("(3ALL _<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 659 |   "_Ex_less" :: "[idt, 'a, bool] => bool"    ("(3EX _<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 660 |   "_All_less_eq" :: "[idt, 'a, bool] => bool"    ("(3ALL _<=_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 661 |   "_Ex_less_eq" :: "[idt, 'a, bool] => bool"    ("(3EX _<=_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 662 | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 663 |   "_All_greater" :: "[idt, 'a, bool] => bool"    ("(3ALL _>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 664 |   "_Ex_greater" :: "[idt, 'a, bool] => bool"    ("(3EX _>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 665 |   "_All_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3ALL _>=_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 666 |   "_Ex_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3EX _>=_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 667 | |
| 668 | syntax (xsymbols) | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 669 |   "_All_less" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 670 |   "_Ex_less" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 671 |   "_All_less_eq" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 672 |   "_Ex_less_eq" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 673 | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 674 |   "_All_greater" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 675 |   "_Ex_greater" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 676 |   "_All_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_\<ge>_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 677 |   "_Ex_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_\<ge>_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 678 | |
| 679 | syntax (HOL) | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 680 |   "_All_less" :: "[idt, 'a, bool] => bool"    ("(3! _<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 681 |   "_Ex_less" :: "[idt, 'a, bool] => bool"    ("(3? _<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 682 |   "_All_less_eq" :: "[idt, 'a, bool] => bool"    ("(3! _<=_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 683 |   "_Ex_less_eq" :: "[idt, 'a, bool] => bool"    ("(3? _<=_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 684 | |
| 685 | syntax (HTML output) | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 686 |   "_All_less" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 687 |   "_Ex_less" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_<_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 688 |   "_All_less_eq" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 689 |   "_Ex_less_eq" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 690 | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 691 |   "_All_greater" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 692 |   "_Ex_greater" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_>_./ _)"  [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 693 |   "_All_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3\<forall>_\<ge>_./ _)" [0, 0, 10] 10)
 | 
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 694 |   "_Ex_greater_eq" :: "[idt, 'a, bool] => bool"    ("(3\<exists>_\<ge>_./ _)" [0, 0, 10] 10)
 | 
| 21083 | 695 | |
| 696 | translations | |
| 697 | "ALL x<y. P" => "ALL x. x < y \<longrightarrow> P" | |
| 698 | "EX x<y. P" => "EX x. x < y \<and> P" | |
| 699 | "ALL x<=y. P" => "ALL x. x <= y \<longrightarrow> P" | |
| 700 | "EX x<=y. P" => "EX x. x <= y \<and> P" | |
| 701 | "ALL x>y. P" => "ALL x. x > y \<longrightarrow> P" | |
| 702 | "EX x>y. P" => "EX x. x > y \<and> P" | |
| 703 | "ALL x>=y. P" => "ALL x. x >= y \<longrightarrow> P" | |
| 704 | "EX x>=y. P" => "EX x. x >= y \<and> P" | |
| 705 | ||
| 706 | print_translation {*
 | |
| 707 | let | |
| 42287 
d98eb048a2e4
discontinued special treatment of structure Mixfix;
 wenzelm parents: 
42284diff
changeset | 708 |   val All_binder = Mixfix.binder_name @{const_syntax All};
 | 
| 
d98eb048a2e4
discontinued special treatment of structure Mixfix;
 wenzelm parents: 
42284diff
changeset | 709 |   val Ex_binder = Mixfix.binder_name @{const_syntax Ex};
 | 
| 38786 
e46e7a9cb622
formerly unnamed infix impliciation now named HOL.implies
 haftmann parents: 
38715diff
changeset | 710 |   val impl = @{const_syntax HOL.implies};
 | 
| 38795 
848be46708dc
formerly unnamed infix conjunction and disjunction now named HOL.conj and HOL.disj
 haftmann parents: 
38786diff
changeset | 711 |   val conj = @{const_syntax HOL.conj};
 | 
| 22916 | 712 |   val less = @{const_syntax less};
 | 
| 713 |   val less_eq = @{const_syntax less_eq};
 | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 714 | |
| 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 715 | val trans = | 
| 35115 | 716 | [((All_binder, impl, less), | 
| 717 |     (@{syntax_const "_All_less"}, @{syntax_const "_All_greater"})),
 | |
| 718 | ((All_binder, impl, less_eq), | |
| 719 |     (@{syntax_const "_All_less_eq"}, @{syntax_const "_All_greater_eq"})),
 | |
| 720 | ((Ex_binder, conj, less), | |
| 721 |     (@{syntax_const "_Ex_less"}, @{syntax_const "_Ex_greater"})),
 | |
| 722 | ((Ex_binder, conj, less_eq), | |
| 723 |     (@{syntax_const "_Ex_less_eq"}, @{syntax_const "_Ex_greater_eq"}))];
 | |
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 724 | |
| 35115 | 725 | fun matches_bound v t = | 
| 726 | (case t of | |
| 35364 | 727 |       Const (@{syntax_const "_bound"}, _) $ Free (v', _) => v = v'
 | 
| 35115 | 728 | | _ => false); | 
| 729 | fun contains_var v = Term.exists_subterm (fn Free (x, _) => x = v | _ => false); | |
| 49660 
de49d9b4d7bc
more explicit Syntax_Trans.mark_bound_abs/mark_bound_body: preserve type information for show_markup;
 wenzelm parents: 
48891diff
changeset | 730 | fun mk x c n P = Syntax.const c $ Syntax_Trans.mark_bound_body x $ n $ P; | 
| 21180 
f27f12bcafb8
fixed print_translation for ALL/EX and <, <=, etc.; tuned syntax names;
 wenzelm parents: 
21091diff
changeset | 731 | |
| 52143 | 732 | fun tr' q = (q, fn _ => | 
| 733 |     (fn [Const (@{syntax_const "_bound"}, _) $ Free (v, T),
 | |
| 35364 | 734 | Const (c, _) $ (Const (d, _) $ t $ u) $ P] => | 
| 35115 | 735 | (case AList.lookup (op =) trans (q, c, d) of | 
| 736 | NONE => raise Match | |
| 737 | | SOME (l, g) => | |
| 49660 
de49d9b4d7bc
more explicit Syntax_Trans.mark_bound_abs/mark_bound_body: preserve type information for show_markup;
 wenzelm parents: 
48891diff
changeset | 738 | if matches_bound v t andalso not (contains_var v u) then mk (v, T) l u P | 
| 
de49d9b4d7bc
more explicit Syntax_Trans.mark_bound_abs/mark_bound_body: preserve type information for show_markup;
 wenzelm parents: 
48891diff
changeset | 739 | else if matches_bound v u andalso not (contains_var v t) then mk (v, T) g t P | 
| 35115 | 740 | else raise Match) | 
| 52143 | 741 | | _ => raise Match)); | 
| 21524 | 742 | in [tr' All_binder, tr' Ex_binder] end | 
| 21083 | 743 | *} | 
| 744 | ||
| 745 | ||
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 746 | subsection {* Transitivity reasoning *}
 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 747 | |
| 25193 | 748 | context ord | 
| 749 | begin | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 750 | |
| 25193 | 751 | lemma ord_le_eq_trans: "a \<le> b \<Longrightarrow> b = c \<Longrightarrow> a \<le> c" | 
| 752 | by (rule subst) | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 753 | |
| 25193 | 754 | lemma ord_eq_le_trans: "a = b \<Longrightarrow> b \<le> c \<Longrightarrow> a \<le> c" | 
| 755 | by (rule ssubst) | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 756 | |
| 25193 | 757 | lemma ord_less_eq_trans: "a < b \<Longrightarrow> b = c \<Longrightarrow> a < c" | 
| 758 | by (rule subst) | |
| 759 | ||
| 760 | lemma ord_eq_less_trans: "a = b \<Longrightarrow> b < c \<Longrightarrow> a < c" | |
| 761 | by (rule ssubst) | |
| 762 | ||
| 763 | end | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 764 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 765 | lemma order_less_subst2: "(a::'a::order) < b ==> f b < (c::'c::order) ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 766 | (!!x y. x < y ==> f x < f y) ==> f a < c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 767 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 768 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 769 | assume "a < b" hence "f a < f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 770 | also assume "f b < c" | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 771 | finally (less_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 772 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 773 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 774 | lemma order_less_subst1: "(a::'a::order) < f b ==> (b::'b::order) < c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 775 | (!!x y. x < y ==> f x < f y) ==> a < f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 776 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 777 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 778 | assume "a < f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 779 | also assume "b < c" hence "f b < f c" by (rule r) | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 780 | finally (less_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 781 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 782 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 783 | lemma order_le_less_subst2: "(a::'a::order) <= b ==> f b < (c::'c::order) ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 784 | (!!x y. x <= y ==> f x <= f y) ==> f a < c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 785 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 786 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 787 | assume "a <= b" hence "f a <= f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 788 | also assume "f b < c" | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 789 | finally (le_less_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 790 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 791 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 792 | lemma order_le_less_subst1: "(a::'a::order) <= f b ==> (b::'b::order) < c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 793 | (!!x y. x < y ==> f x < f y) ==> a < f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 794 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 795 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 796 | assume "a <= f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 797 | also assume "b < c" hence "f b < f c" by (rule r) | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 798 | finally (le_less_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 799 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 800 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 801 | lemma order_less_le_subst2: "(a::'a::order) < b ==> f b <= (c::'c::order) ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 802 | (!!x y. x < y ==> f x < f y) ==> f a < c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 803 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 804 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 805 | assume "a < b" hence "f a < f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 806 | also assume "f b <= c" | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 807 | finally (less_le_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 808 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 809 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 810 | lemma order_less_le_subst1: "(a::'a::order) < f b ==> (b::'b::order) <= c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 811 | (!!x y. x <= y ==> f x <= f y) ==> a < f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 812 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 813 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 814 | assume "a < f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 815 | also assume "b <= c" hence "f b <= f c" by (rule r) | 
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 816 | finally (less_le_trans) show ?thesis . | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 817 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 818 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 819 | lemma order_subst1: "(a::'a::order) <= f b ==> (b::'b::order) <= c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 820 | (!!x y. x <= y ==> f x <= f y) ==> a <= f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 821 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 822 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 823 | assume "a <= f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 824 | also assume "b <= c" hence "f b <= f c" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 825 | finally (order_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 826 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 827 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 828 | lemma order_subst2: "(a::'a::order) <= b ==> f b <= (c::'c::order) ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 829 | (!!x y. x <= y ==> f x <= f y) ==> f a <= c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 830 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 831 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 832 | assume "a <= b" hence "f a <= f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 833 | also assume "f b <= c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 834 | finally (order_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 835 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 836 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 837 | lemma ord_le_eq_subst: "a <= b ==> f b = c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 838 | (!!x y. x <= y ==> f x <= f y) ==> f a <= c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 839 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 840 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 841 | assume "a <= b" hence "f a <= f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 842 | also assume "f b = c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 843 | finally (ord_le_eq_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 844 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 845 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 846 | lemma ord_eq_le_subst: "a = f b ==> b <= c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 847 | (!!x y. x <= y ==> f x <= f y) ==> a <= f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 848 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 849 | assume r: "!!x y. x <= y ==> f x <= f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 850 | assume "a = f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 851 | also assume "b <= c" hence "f b <= f c" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 852 | finally (ord_eq_le_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 853 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 854 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 855 | lemma ord_less_eq_subst: "a < b ==> f b = c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 856 | (!!x y. x < y ==> f x < f y) ==> f a < c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 857 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 858 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 859 | assume "a < b" hence "f a < f b" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 860 | also assume "f b = c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 861 | finally (ord_less_eq_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 862 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 863 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 864 | lemma ord_eq_less_subst: "a = f b ==> b < c ==> | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 865 | (!!x y. x < y ==> f x < f y) ==> a < f c" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 866 | proof - | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 867 | assume r: "!!x y. x < y ==> f x < f y" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 868 | assume "a = f b" | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 869 | also assume "b < c" hence "f b < f c" by (rule r) | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 870 | finally (ord_eq_less_trans) show ?thesis . | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 871 | qed | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 872 | |
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 873 | text {*
 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 874 | Note that this list of rules is in reverse order of priorities. | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 875 | *} | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 876 | |
| 27682 | 877 | lemmas [trans] = | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 878 | order_less_subst2 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 879 | order_less_subst1 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 880 | order_le_less_subst2 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 881 | order_le_less_subst1 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 882 | order_less_le_subst2 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 883 | order_less_le_subst1 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 884 | order_subst2 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 885 | order_subst1 | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 886 | ord_le_eq_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 887 | ord_eq_le_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 888 | ord_less_eq_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 889 | ord_eq_less_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 890 | forw_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 891 | back_subst | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 892 | rev_mp | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 893 | mp | 
| 27682 | 894 | |
| 895 | lemmas (in order) [trans] = | |
| 896 | neq_le_trans | |
| 897 | le_neq_trans | |
| 898 | ||
| 899 | lemmas (in preorder) [trans] = | |
| 900 | less_trans | |
| 901 | less_asym' | |
| 902 | le_less_trans | |
| 903 | less_le_trans | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 904 | order_trans | 
| 27682 | 905 | |
| 906 | lemmas (in order) [trans] = | |
| 907 | antisym | |
| 908 | ||
| 909 | lemmas (in ord) [trans] = | |
| 910 | ord_le_eq_trans | |
| 911 | ord_eq_le_trans | |
| 912 | ord_less_eq_trans | |
| 913 | ord_eq_less_trans | |
| 914 | ||
| 915 | lemmas [trans] = | |
| 916 | trans | |
| 917 | ||
| 918 | lemmas order_trans_rules = | |
| 919 | order_less_subst2 | |
| 920 | order_less_subst1 | |
| 921 | order_le_less_subst2 | |
| 922 | order_le_less_subst1 | |
| 923 | order_less_le_subst2 | |
| 924 | order_less_le_subst1 | |
| 925 | order_subst2 | |
| 926 | order_subst1 | |
| 927 | ord_le_eq_subst | |
| 928 | ord_eq_le_subst | |
| 929 | ord_less_eq_subst | |
| 930 | ord_eq_less_subst | |
| 931 | forw_subst | |
| 932 | back_subst | |
| 933 | rev_mp | |
| 934 | mp | |
| 935 | neq_le_trans | |
| 936 | le_neq_trans | |
| 937 | less_trans | |
| 938 | less_asym' | |
| 939 | le_less_trans | |
| 940 | less_le_trans | |
| 941 | order_trans | |
| 942 | antisym | |
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 943 | ord_le_eq_trans | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 944 | ord_eq_le_trans | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 945 | ord_less_eq_trans | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 946 | ord_eq_less_trans | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 947 | trans | 
| 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 948 | |
| 21083 | 949 | text {* These support proving chains of decreasing inequalities
 | 
| 950 | a >= b >= c ... in Isar proofs. *} | |
| 951 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 952 | lemma xt1 [no_atp]: | 
| 21083 | 953 | "a = b ==> b > c ==> a > c" | 
| 954 | "a > b ==> b = c ==> a > c" | |
| 955 | "a = b ==> b >= c ==> a >= c" | |
| 956 | "a >= b ==> b = c ==> a >= c" | |
| 957 | "(x::'a::order) >= y ==> y >= x ==> x = y" | |
| 958 | "(x::'a::order) >= y ==> y >= z ==> x >= z" | |
| 959 | "(x::'a::order) > y ==> y >= z ==> x > z" | |
| 960 | "(x::'a::order) >= y ==> y > z ==> x > z" | |
| 23417 | 961 | "(a::'a::order) > b ==> b > a ==> P" | 
| 21083 | 962 | "(x::'a::order) > y ==> y > z ==> x > z" | 
| 963 | "(a::'a::order) >= b ==> a ~= b ==> a > b" | |
| 964 | "(a::'a::order) ~= b ==> a >= b ==> a > b" | |
| 965 | "a = f b ==> b > c ==> (!!x y. x > y ==> f x > f y) ==> a > f c" | |
| 966 | "a > b ==> f b = c ==> (!!x y. x > y ==> f x > f y) ==> f a > c" | |
| 967 | "a = f b ==> b >= c ==> (!!x y. x >= y ==> f x >= f y) ==> a >= f c" | |
| 968 | "a >= b ==> f b = c ==> (!! x y. x >= y ==> f x >= f y) ==> f a >= c" | |
| 25076 | 969 | by auto | 
| 21083 | 970 | |
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 971 | lemma xt2 [no_atp]: | 
| 21083 | 972 | "(a::'a::order) >= f b ==> b >= c ==> (!!x y. x >= y ==> f x >= f y) ==> a >= f c" | 
| 973 | by (subgoal_tac "f b >= f c", force, force) | |
| 974 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 975 | lemma xt3 [no_atp]: "(a::'a::order) >= b ==> (f b::'b::order) >= c ==> | 
| 21083 | 976 | (!!x y. x >= y ==> f x >= f y) ==> f a >= c" | 
| 977 | by (subgoal_tac "f a >= f b", force, force) | |
| 978 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 979 | lemma xt4 [no_atp]: "(a::'a::order) > f b ==> (b::'b::order) >= c ==> | 
| 21083 | 980 | (!!x y. x >= y ==> f x >= f y) ==> a > f c" | 
| 981 | by (subgoal_tac "f b >= f c", force, force) | |
| 982 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 983 | lemma xt5 [no_atp]: "(a::'a::order) > b ==> (f b::'b::order) >= c==> | 
| 21083 | 984 | (!!x y. x > y ==> f x > f y) ==> f a > c" | 
| 985 | by (subgoal_tac "f a > f b", force, force) | |
| 986 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 987 | lemma xt6 [no_atp]: "(a::'a::order) >= f b ==> b > c ==> | 
| 21083 | 988 | (!!x y. x > y ==> f x > f y) ==> a > f c" | 
| 989 | by (subgoal_tac "f b > f c", force, force) | |
| 990 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 991 | lemma xt7 [no_atp]: "(a::'a::order) >= b ==> (f b::'b::order) > c ==> | 
| 21083 | 992 | (!!x y. x >= y ==> f x >= f y) ==> f a > c" | 
| 993 | by (subgoal_tac "f a >= f b", force, force) | |
| 994 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 995 | lemma xt8 [no_atp]: "(a::'a::order) > f b ==> (b::'b::order) > c ==> | 
| 21083 | 996 | (!!x y. x > y ==> f x > f y) ==> a > f c" | 
| 997 | by (subgoal_tac "f b > f c", force, force) | |
| 998 | ||
| 45221 
3eadb9b6a055
mark "xt..." rules as "no_atp", since they are easy consequences of other better named properties
 blanchet parents: 
44921diff
changeset | 999 | lemma xt9 [no_atp]: "(a::'a::order) > b ==> (f b::'b::order) > c ==> | 
| 21083 | 1000 | (!!x y. x > y ==> f x > f y) ==> f a > c" | 
| 1001 | by (subgoal_tac "f a > f b", force, force) | |
| 1002 | ||
| 54147 
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
 blanchet parents: 
53216diff
changeset | 1003 | lemmas xtrans = xt1 xt2 xt3 xt4 xt5 xt6 xt7 xt8 xt9 | 
| 21083 | 1004 | |
| 1005 | (* | |
| 1006 | Since "a >= b" abbreviates "b <= a", the abbreviation "..." stands | |
| 1007 | for the wrong thing in an Isar proof. | |
| 1008 | ||
| 1009 | The extra transitivity rules can be used as follows: | |
| 1010 | ||
| 1011 | lemma "(a::'a::order) > z" | |
| 1012 | proof - | |
| 1013 | have "a >= b" (is "_ >= ?rhs") | |
| 1014 | sorry | |
| 1015 | also have "?rhs >= c" (is "_ >= ?rhs") | |
| 1016 | sorry | |
| 1017 | also (xtrans) have "?rhs = d" (is "_ = ?rhs") | |
| 1018 | sorry | |
| 1019 | also (xtrans) have "?rhs >= e" (is "_ >= ?rhs") | |
| 1020 | sorry | |
| 1021 | also (xtrans) have "?rhs > f" (is "_ > ?rhs") | |
| 1022 | sorry | |
| 1023 | also (xtrans) have "?rhs > z" | |
| 1024 | sorry | |
| 1025 | finally (xtrans) show ?thesis . | |
| 1026 | qed | |
| 1027 | ||
| 1028 | Alternatively, one can use "declare xtrans [trans]" and then | |
| 1029 | leave out the "(xtrans)" above. | |
| 1030 | *) | |
| 1031 | ||
| 23881 | 1032 | |
| 54860 | 1033 | subsection {* Monotonicity *}
 | 
| 21083 | 1034 | |
| 25076 | 1035 | context order | 
| 1036 | begin | |
| 1037 | ||
| 30298 | 1038 | definition mono :: "('a \<Rightarrow> 'b\<Colon>order) \<Rightarrow> bool" where
 | 
| 25076 | 1039 | "mono f \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> f x \<le> f y)" | 
| 1040 | ||
| 1041 | lemma monoI [intro?]: | |
| 1042 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | |
| 1043 | shows "(\<And>x y. x \<le> y \<Longrightarrow> f x \<le> f y) \<Longrightarrow> mono f" | |
| 1044 | unfolding mono_def by iprover | |
| 21216 
1c8580913738
made locale partial_order compatible with axclass order; changed import order; consecutive changes
 haftmann parents: 
21204diff
changeset | 1045 | |
| 25076 | 1046 | lemma monoD [dest?]: | 
| 1047 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | |
| 1048 | shows "mono f \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y" | |
| 1049 | unfolding mono_def by iprover | |
| 1050 | ||
| 51263 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1051 | lemma monoE: | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1052 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1053 | assumes "mono f" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1054 | assumes "x \<le> y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1055 | obtains "f x \<le> f y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1056 | proof | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1057 | from assms show "f x \<le> f y" by (simp add: mono_def) | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1058 | qed | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1059 | |
| 56020 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1060 | definition antimono :: "('a \<Rightarrow> 'b\<Colon>order) \<Rightarrow> bool" where
 | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1061 | "antimono f \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> f x \<ge> f y)" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1062 | |
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1063 | lemma antimonoI [intro?]: | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1064 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1065 | shows "(\<And>x y. x \<le> y \<Longrightarrow> f x \<ge> f y) \<Longrightarrow> antimono f" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1066 | unfolding antimono_def by iprover | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1067 | |
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1068 | lemma antimonoD [dest?]: | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1069 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1070 | shows "antimono f \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<ge> f y" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1071 | unfolding antimono_def by iprover | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1072 | |
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1073 | lemma antimonoE: | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1074 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1075 | assumes "antimono f" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1076 | assumes "x \<le> y" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1077 | obtains "f x \<ge> f y" | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1078 | proof | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1079 | from assms show "f x \<ge> f y" by (simp add: antimono_def) | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1080 | qed | 
| 
f92479477c52
introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
 hoelzl parents: 
54868diff
changeset | 1081 | |
| 30298 | 1082 | definition strict_mono :: "('a \<Rightarrow> 'b\<Colon>order) \<Rightarrow> bool" where
 | 
| 1083 | "strict_mono f \<longleftrightarrow> (\<forall>x y. x < y \<longrightarrow> f x < f y)" | |
| 1084 | ||
| 1085 | lemma strict_monoI [intro?]: | |
| 1086 | assumes "\<And>x y. x < y \<Longrightarrow> f x < f y" | |
| 1087 | shows "strict_mono f" | |
| 1088 | using assms unfolding strict_mono_def by auto | |
| 1089 | ||
| 1090 | lemma strict_monoD [dest?]: | |
| 1091 | "strict_mono f \<Longrightarrow> x < y \<Longrightarrow> f x < f y" | |
| 1092 | unfolding strict_mono_def by auto | |
| 1093 | ||
| 1094 | lemma strict_mono_mono [dest?]: | |
| 1095 | assumes "strict_mono f" | |
| 1096 | shows "mono f" | |
| 1097 | proof (rule monoI) | |
| 1098 | fix x y | |
| 1099 | assume "x \<le> y" | |
| 1100 | show "f x \<le> f y" | |
| 1101 | proof (cases "x = y") | |
| 1102 | case True then show ?thesis by simp | |
| 1103 | next | |
| 1104 | case False with `x \<le> y` have "x < y" by simp | |
| 1105 | with assms strict_monoD have "f x < f y" by auto | |
| 1106 | then show ?thesis by simp | |
| 1107 | qed | |
| 1108 | qed | |
| 1109 | ||
| 25076 | 1110 | end | 
| 1111 | ||
| 1112 | context linorder | |
| 1113 | begin | |
| 1114 | ||
| 51263 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1115 | lemma mono_invE: | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1116 | fixes f :: "'a \<Rightarrow> 'b\<Colon>order" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1117 | assumes "mono f" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1118 | assumes "f x < f y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1119 | obtains "x \<le> y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1120 | proof | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1121 | show "x \<le> y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1122 | proof (rule ccontr) | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1123 | assume "\<not> x \<le> y" | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1124 | then have "y \<le> x" by simp | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1125 | with `mono f` obtain "f y \<le> f x" by (rule monoE) | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1126 | with `f x < f y` show False by simp | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1127 | qed | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1128 | qed | 
| 
31e786e0e6a7
turned example into library for comparing growth of functions
 haftmann parents: 
49769diff
changeset | 1129 | |
| 30298 | 1130 | lemma strict_mono_eq: | 
| 1131 | assumes "strict_mono f" | |
| 1132 | shows "f x = f y \<longleftrightarrow> x = y" | |
| 1133 | proof | |
| 1134 | assume "f x = f y" | |
| 1135 | show "x = y" proof (cases x y rule: linorder_cases) | |
| 1136 | case less with assms strict_monoD have "f x < f y" by auto | |
| 1137 | with `f x = f y` show ?thesis by simp | |
| 1138 | next | |
| 1139 | case equal then show ?thesis . | |
| 1140 | next | |
| 1141 | case greater with assms strict_monoD have "f y < f x" by auto | |
| 1142 | with `f x = f y` show ?thesis by simp | |
| 1143 | qed | |
| 1144 | qed simp | |
| 1145 | ||
| 1146 | lemma strict_mono_less_eq: | |
| 1147 | assumes "strict_mono f" | |
| 1148 | shows "f x \<le> f y \<longleftrightarrow> x \<le> y" | |
| 1149 | proof | |
| 1150 | assume "x \<le> y" | |
| 1151 | with assms strict_mono_mono monoD show "f x \<le> f y" by auto | |
| 1152 | next | |
| 1153 | assume "f x \<le> f y" | |
| 1154 | show "x \<le> y" proof (rule ccontr) | |
| 1155 | assume "\<not> x \<le> y" then have "y < x" by simp | |
| 1156 | with assms strict_monoD have "f y < f x" by auto | |
| 1157 | with `f x \<le> f y` show False by simp | |
| 1158 | qed | |
| 1159 | qed | |
| 1160 | ||
| 1161 | lemma strict_mono_less: | |
| 1162 | assumes "strict_mono f" | |
| 1163 | shows "f x < f y \<longleftrightarrow> x < y" | |
| 1164 | using assms | |
| 1165 | by (auto simp add: less_le Orderings.less_le strict_mono_eq strict_mono_less_eq) | |
| 1166 | ||
| 54860 | 1167 | end | 
| 1168 | ||
| 1169 | ||
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54860diff
changeset | 1170 | subsection {* min and max -- fundamental *}
 | 
| 54860 | 1171 | |
| 1172 | definition (in ord) min :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" where | |
| 1173 | "min a b = (if a \<le> b then a else b)" | |
| 1174 | ||
| 1175 | definition (in ord) max :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" where | |
| 1176 | "max a b = (if a \<le> b then b else a)" | |
| 1177 | ||
| 45931 | 1178 | lemma min_absorb1: "x \<le> y \<Longrightarrow> min x y = x" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54860diff
changeset | 1179 | by (simp add: min_def) | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 1180 | |
| 54857 | 1181 | lemma max_absorb2: "x \<le> y \<Longrightarrow> max x y = y" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54860diff
changeset | 1182 | by (simp add: max_def) | 
| 21383 
17e6275e13f5
added transitivity rules, reworking of min/max lemmas
 haftmann parents: 
21329diff
changeset | 1183 | |
| 45931 | 1184 | lemma min_absorb2: "(y\<Colon>'a\<Colon>order) \<le> x \<Longrightarrow> min x y = y" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54860diff
changeset | 1185 | by (simp add:min_def) | 
| 45893 | 1186 | |
| 45931 | 1187 | lemma max_absorb1: "(y\<Colon>'a\<Colon>order) \<le> x \<Longrightarrow> max x y = x" | 
| 54861 
00d551179872
postponed min/max lemmas until abstract lattice is available
 haftmann parents: 
54860diff
changeset | 1188 | by (simp add: max_def) | 
| 45893 | 1189 | |
| 1190 | ||
| 43813 
07f0650146f2
tightened specification of classes bot and top: uniqueness of top and bot elements
 haftmann parents: 
43597diff
changeset | 1191 | subsection {* (Unique) top and bottom elements *}
 | 
| 28685 | 1192 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1193 | class bot = | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1194 |   fixes bot :: 'a ("\<bottom>")
 | 
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1195 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1196 | class order_bot = order + bot + | 
| 51487 | 1197 | assumes bot_least: "\<bottom> \<le> a" | 
| 54868 | 1198 | begin | 
| 51487 | 1199 | |
| 54868 | 1200 | sublocale bot!: ordering_top greater_eq greater bot | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 1201 | by default (fact bot_least) | 
| 51487 | 1202 | |
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1203 | lemma le_bot: | 
| 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1204 | "a \<le> \<bottom> \<Longrightarrow> a = \<bottom>" | 
| 51487 | 1205 | by (fact bot.extremum_uniqueI) | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1206 | |
| 43816 | 1207 | lemma bot_unique: | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1208 | "a \<le> \<bottom> \<longleftrightarrow> a = \<bottom>" | 
| 51487 | 1209 | by (fact bot.extremum_unique) | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1210 | |
| 51487 | 1211 | lemma not_less_bot: | 
| 1212 | "\<not> a < \<bottom>" | |
| 1213 | by (fact bot.extremum_strict) | |
| 43816 | 1214 | |
| 43814 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1215 | lemma bot_less: | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1216 | "a \<noteq> \<bottom> \<longleftrightarrow> \<bottom> < a" | 
| 51487 | 1217 | by (fact bot.not_eq_extremum) | 
| 43814 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1218 | |
| 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1219 | end | 
| 41082 | 1220 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1221 | class top = | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1222 |   fixes top :: 'a ("\<top>")
 | 
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1223 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1224 | class order_top = order + top + | 
| 51487 | 1225 | assumes top_greatest: "a \<le> \<top>" | 
| 54868 | 1226 | begin | 
| 51487 | 1227 | |
| 54868 | 1228 | sublocale top!: ordering_top less_eq less top | 
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 1229 | by default (fact top_greatest) | 
| 51487 | 1230 | |
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1231 | lemma top_le: | 
| 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1232 | "\<top> \<le> a \<Longrightarrow> a = \<top>" | 
| 51487 | 1233 | by (fact top.extremum_uniqueI) | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1234 | |
| 43816 | 1235 | lemma top_unique: | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1236 | "\<top> \<le> a \<longleftrightarrow> a = \<top>" | 
| 51487 | 1237 | by (fact top.extremum_unique) | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1238 | |
| 51487 | 1239 | lemma not_top_less: | 
| 1240 | "\<not> \<top> < a" | |
| 1241 | by (fact top.extremum_strict) | |
| 43816 | 1242 | |
| 43814 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1243 | lemma less_top: | 
| 43853 
020ddc6a9508
consolidated bot and top classes, tuned notation
 haftmann parents: 
43816diff
changeset | 1244 | "a \<noteq> \<top> \<longleftrightarrow> a < \<top>" | 
| 51487 | 1245 | by (fact top.not_eq_extremum) | 
| 43814 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1246 | |
| 
58791b75cf1f
moved lemmas bot_less and less_top to classes bot and top respectively
 haftmann parents: 
43813diff
changeset | 1247 | end | 
| 28685 | 1248 | |
| 1249 | ||
| 27823 | 1250 | subsection {* Dense orders *}
 | 
| 1251 | ||
| 53216 | 1252 | class dense_order = order + | 
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1253 | assumes dense: "x < y \<Longrightarrow> (\<exists>z. x < z \<and> z < y)" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1254 | |
| 53216 | 1255 | class dense_linorder = linorder + dense_order | 
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1256 | begin | 
| 27823 | 1257 | |
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1258 | lemma dense_le: | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1259 | fixes y z :: 'a | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1260 | assumes "\<And>x. x < y \<Longrightarrow> x \<le> z" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1261 | shows "y \<le> z" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1262 | proof (rule ccontr) | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1263 | assume "\<not> ?thesis" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1264 | hence "z < y" by simp | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1265 | from dense[OF this] | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1266 | obtain x where "x < y" and "z < x" by safe | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1267 | moreover have "x \<le> z" using assms[OF `x < y`] . | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1268 | ultimately show False by auto | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1269 | qed | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1270 | |
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1271 | lemma dense_le_bounded: | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1272 | fixes x y z :: 'a | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1273 | assumes "x < y" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1274 | assumes *: "\<And>w. \<lbrakk> x < w ; w < y \<rbrakk> \<Longrightarrow> w \<le> z" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1275 | shows "y \<le> z" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1276 | proof (rule dense_le) | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1277 | fix w assume "w < y" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1278 | from dense[OF `x < y`] obtain u where "x < u" "u < y" by safe | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1279 | from linear[of u w] | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1280 | show "w \<le> z" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1281 | proof (rule disjE) | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1282 | assume "u \<le> w" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1283 | from less_le_trans[OF `x < u` `u \<le> w`] `w < y` | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1284 | show "w \<le> z" by (rule *) | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1285 | next | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1286 | assume "w \<le> u" | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1287 | from `w \<le> u` *[OF `x < u` `u < y`] | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1288 | show "w \<le> z" by (rule order_trans) | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1289 | qed | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1290 | qed | 
| 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1291 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1292 | lemma dense_ge: | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1293 | fixes y z :: 'a | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1294 | assumes "\<And>x. z < x \<Longrightarrow> y \<le> x" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1295 | shows "y \<le> z" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1296 | proof (rule ccontr) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1297 | assume "\<not> ?thesis" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1298 | hence "z < y" by simp | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1299 | from dense[OF this] | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1300 | obtain x where "x < y" and "z < x" by safe | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1301 | moreover have "y \<le> x" using assms[OF `z < x`] . | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1302 | ultimately show False by auto | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1303 | qed | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1304 | |
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1305 | lemma dense_ge_bounded: | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1306 | fixes x y z :: 'a | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1307 | assumes "z < x" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1308 | assumes *: "\<And>w. \<lbrakk> z < w ; w < x \<rbrakk> \<Longrightarrow> y \<le> w" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1309 | shows "y \<le> z" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1310 | proof (rule dense_ge) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1311 | fix w assume "z < w" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1312 | from dense[OF `z < x`] obtain u where "z < u" "u < x" by safe | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1313 | from linear[of u w] | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1314 | show "y \<le> w" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1315 | proof (rule disjE) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1316 | assume "w \<le> u" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1317 | from `z < w` le_less_trans[OF `w \<le> u` `u < x`] | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1318 | show "y \<le> w" by (rule *) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1319 | next | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1320 | assume "u \<le> w" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1321 | from *[OF `z < u` `u < x`] `u \<le> w` | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1322 | show "y \<le> w" by (rule order_trans) | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1323 | qed | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1324 | qed | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1325 | |
| 35579 
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
 hoelzl parents: 
35364diff
changeset | 1326 | end | 
| 27823 | 1327 | |
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1328 | class no_top = order + | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1329 | assumes gt_ex: "\<exists>y. x < y" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1330 | |
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1331 | class no_bot = order + | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1332 | assumes lt_ex: "\<exists>y. y < x" | 
| 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1333 | |
| 53216 | 1334 | class unbounded_dense_linorder = dense_linorder + no_top + no_bot | 
| 51329 
4a3c453f99a1
split dense into inner_dense_order and no_top/no_bot
 hoelzl parents: 
51263diff
changeset | 1335 | |
| 51546 
2e26df807dc7
more uniform style for interpretation and sublocale declarations
 haftmann parents: 
51487diff
changeset | 1336 | |
| 27823 | 1337 | subsection {* Wellorders *}
 | 
| 1338 | ||
| 1339 | class wellorder = linorder + | |
| 1340 | assumes less_induct [case_names less]: "(\<And>x. (\<And>y. y < x \<Longrightarrow> P y) \<Longrightarrow> P x) \<Longrightarrow> P a" | |
| 1341 | begin | |
| 1342 | ||
| 1343 | lemma wellorder_Least_lemma: | |
| 1344 | fixes k :: 'a | |
| 1345 | assumes "P k" | |
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1346 | shows LeastI: "P (LEAST x. P x)" and Least_le: "(LEAST x. P x) \<le> k" | 
| 27823 | 1347 | proof - | 
| 1348 | have "P (LEAST x. P x) \<and> (LEAST x. P x) \<le> k" | |
| 1349 | using assms proof (induct k rule: less_induct) | |
| 1350 | case (less x) then have "P x" by simp | |
| 1351 | show ?case proof (rule classical) | |
| 1352 | assume assm: "\<not> (P (LEAST a. P a) \<and> (LEAST a. P a) \<le> x)" | |
| 1353 | have "\<And>y. P y \<Longrightarrow> x \<le> y" | |
| 1354 | proof (rule classical) | |
| 1355 | fix y | |
| 38705 | 1356 | assume "P y" and "\<not> x \<le> y" | 
| 27823 | 1357 | with less have "P (LEAST a. P a)" and "(LEAST a. P a) \<le> y" | 
| 1358 | by (auto simp add: not_le) | |
| 1359 | with assm have "x < (LEAST a. P a)" and "(LEAST a. P a) \<le> y" | |
| 1360 | by auto | |
| 1361 | then show "x \<le> y" by auto | |
| 1362 | qed | |
| 1363 | with `P x` have Least: "(LEAST a. P a) = x" | |
| 1364 | by (rule Least_equality) | |
| 1365 | with `P x` show ?thesis by simp | |
| 1366 | qed | |
| 1367 | qed | |
| 1368 | then show "P (LEAST x. P x)" and "(LEAST x. P x) \<le> k" by auto | |
| 1369 | qed | |
| 1370 | ||
| 1371 | -- "The following 3 lemmas are due to Brian Huffman" | |
| 1372 | lemma LeastI_ex: "\<exists>x. P x \<Longrightarrow> P (Least P)" | |
| 1373 | by (erule exE) (erule LeastI) | |
| 1374 | ||
| 1375 | lemma LeastI2: | |
| 1376 | "P a \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> Q (Least P)" | |
| 1377 | by (blast intro: LeastI) | |
| 1378 | ||
| 1379 | lemma LeastI2_ex: | |
| 1380 | "\<exists>a. P a \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> Q (Least P)" | |
| 1381 | by (blast intro: LeastI_ex) | |
| 1382 | ||
| 38705 | 1383 | lemma LeastI2_wellorder: | 
| 1384 | assumes "P a" | |
| 1385 | and "\<And>a. \<lbrakk> P a; \<forall>b. P b \<longrightarrow> a \<le> b \<rbrakk> \<Longrightarrow> Q a" | |
| 1386 | shows "Q (Least P)" | |
| 1387 | proof (rule LeastI2_order) | |
| 1388 | show "P (Least P)" using `P a` by (rule LeastI) | |
| 1389 | next | |
| 1390 | fix y assume "P y" thus "Least P \<le> y" by (rule Least_le) | |
| 1391 | next | |
| 1392 | fix x assume "P x" "\<forall>y. P y \<longrightarrow> x \<le> y" thus "Q x" by (rule assms(2)) | |
| 1393 | qed | |
| 1394 | ||
| 27823 | 1395 | lemma not_less_Least: "k < (LEAST x. P x) \<Longrightarrow> \<not> P k" | 
| 1396 | apply (simp (no_asm_use) add: not_le [symmetric]) | |
| 1397 | apply (erule contrapos_nn) | |
| 1398 | apply (erule Least_le) | |
| 1399 | done | |
| 1400 | ||
| 38705 | 1401 | end | 
| 27823 | 1402 | |
| 28685 | 1403 | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1404 | subsection {* Order on @{typ bool} *}
 | 
| 28685 | 1405 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1406 | instantiation bool :: "{order_bot, order_top, linorder}"
 | 
| 28685 | 1407 | begin | 
| 1408 | ||
| 1409 | definition | |
| 41080 | 1410 | le_bool_def [simp]: "P \<le> Q \<longleftrightarrow> P \<longrightarrow> Q" | 
| 28685 | 1411 | |
| 1412 | definition | |
| 41080 | 1413 | [simp]: "(P\<Colon>bool) < Q \<longleftrightarrow> \<not> P \<and> Q" | 
| 28685 | 1414 | |
| 1415 | definition | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1416 | [simp]: "\<bottom> \<longleftrightarrow> False" | 
| 28685 | 1417 | |
| 1418 | definition | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1419 | [simp]: "\<top> \<longleftrightarrow> True" | 
| 28685 | 1420 | |
| 1421 | instance proof | |
| 41080 | 1422 | qed auto | 
| 28685 | 1423 | |
| 15524 | 1424 | end | 
| 28685 | 1425 | |
| 1426 | lemma le_boolI: "(P \<Longrightarrow> Q) \<Longrightarrow> P \<le> Q" | |
| 41080 | 1427 | by simp | 
| 28685 | 1428 | |
| 1429 | lemma le_boolI': "P \<longrightarrow> Q \<Longrightarrow> P \<le> Q" | |
| 41080 | 1430 | by simp | 
| 28685 | 1431 | |
| 1432 | lemma le_boolE: "P \<le> Q \<Longrightarrow> P \<Longrightarrow> (Q \<Longrightarrow> R) \<Longrightarrow> R" | |
| 41080 | 1433 | by simp | 
| 28685 | 1434 | |
| 1435 | lemma le_boolD: "P \<le> Q \<Longrightarrow> P \<longrightarrow> Q" | |
| 41080 | 1436 | by simp | 
| 32899 | 1437 | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1438 | lemma bot_boolE: "\<bottom> \<Longrightarrow> P" | 
| 41080 | 1439 | by simp | 
| 32899 | 1440 | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1441 | lemma top_boolI: \<top> | 
| 41080 | 1442 | by simp | 
| 28685 | 1443 | |
| 1444 | lemma [code]: | |
| 1445 | "False \<le> b \<longleftrightarrow> True" | |
| 1446 | "True \<le> b \<longleftrightarrow> b" | |
| 1447 | "False < b \<longleftrightarrow> b" | |
| 1448 | "True < b \<longleftrightarrow> False" | |
| 41080 | 1449 | by simp_all | 
| 28685 | 1450 | |
| 1451 | ||
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1452 | subsection {* Order on @{typ "_ \<Rightarrow> _"} *}
 | 
| 28685 | 1453 | |
| 1454 | instantiation "fun" :: (type, ord) ord | |
| 1455 | begin | |
| 1456 | ||
| 1457 | definition | |
| 37767 | 1458 | le_fun_def: "f \<le> g \<longleftrightarrow> (\<forall>x. f x \<le> g x)" | 
| 28685 | 1459 | |
| 1460 | definition | |
| 41080 | 1461 | "(f\<Colon>'a \<Rightarrow> 'b) < g \<longleftrightarrow> f \<le> g \<and> \<not> (g \<le> f)" | 
| 28685 | 1462 | |
| 1463 | instance .. | |
| 1464 | ||
| 1465 | end | |
| 1466 | ||
| 1467 | instance "fun" :: (type, preorder) preorder proof | |
| 1468 | qed (auto simp add: le_fun_def less_fun_def | |
| 44921 | 1469 | intro: order_trans antisym) | 
| 28685 | 1470 | |
| 1471 | instance "fun" :: (type, order) order proof | |
| 44921 | 1472 | qed (auto simp add: le_fun_def intro: antisym) | 
| 28685 | 1473 | |
| 41082 | 1474 | instantiation "fun" :: (type, bot) bot | 
| 1475 | begin | |
| 1476 | ||
| 1477 | definition | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1478 | "\<bottom> = (\<lambda>x. \<bottom>)" | 
| 41082 | 1479 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1480 | instance .. | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1481 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1482 | end | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1483 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1484 | instantiation "fun" :: (type, order_bot) order_bot | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1485 | begin | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1486 | |
| 49769 | 1487 | lemma bot_apply [simp, code]: | 
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1488 | "\<bottom> x = \<bottom>" | 
| 41082 | 1489 | by (simp add: bot_fun_def) | 
| 1490 | ||
| 1491 | instance proof | |
| 46884 | 1492 | qed (simp add: le_fun_def) | 
| 41082 | 1493 | |
| 1494 | end | |
| 1495 | ||
| 28685 | 1496 | instantiation "fun" :: (type, top) top | 
| 1497 | begin | |
| 1498 | ||
| 1499 | definition | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1500 | [no_atp]: "\<top> = (\<lambda>x. \<top>)" | 
| 28685 | 1501 | |
| 52729 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1502 | instance .. | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1503 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1504 | end | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1505 | |
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1506 | instantiation "fun" :: (type, order_top) order_top | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1507 | begin | 
| 
412c9e0381a1
factored syntactic type classes for bot and top (by Alessandro Coglio)
 haftmann parents: 
52143diff
changeset | 1508 | |
| 49769 | 1509 | lemma top_apply [simp, code]: | 
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1510 | "\<top> x = \<top>" | 
| 41080 | 1511 | by (simp add: top_fun_def) | 
| 1512 | ||
| 28685 | 1513 | instance proof | 
| 46884 | 1514 | qed (simp add: le_fun_def) | 
| 28685 | 1515 | |
| 1516 | end | |
| 1517 | ||
| 1518 | lemma le_funI: "(\<And>x. f x \<le> g x) \<Longrightarrow> f \<le> g" | |
| 1519 | unfolding le_fun_def by simp | |
| 1520 | ||
| 1521 | lemma le_funE: "f \<le> g \<Longrightarrow> (f x \<le> g x \<Longrightarrow> P) \<Longrightarrow> P" | |
| 1522 | unfolding le_fun_def by simp | |
| 1523 | ||
| 1524 | lemma le_funD: "f \<le> g \<Longrightarrow> f x \<le> g x" | |
| 54860 | 1525 | by (rule le_funE) | 
| 28685 | 1526 | |
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1527 | |
| 46631 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1528 | subsection {* Order on unary and binary predicates *}
 | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1529 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1530 | lemma predicate1I: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1531 | assumes PQ: "\<And>x. P x \<Longrightarrow> Q x" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1532 | shows "P \<le> Q" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1533 | apply (rule le_funI) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1534 | apply (rule le_boolI) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1535 | apply (rule PQ) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1536 | apply assumption | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1537 | done | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1538 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1539 | lemma predicate1D: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1540 | "P \<le> Q \<Longrightarrow> P x \<Longrightarrow> Q x" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1541 | apply (erule le_funE) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1542 | apply (erule le_boolE) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1543 | apply assumption+ | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1544 | done | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1545 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1546 | lemma rev_predicate1D: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1547 | "P x \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1548 | by (rule predicate1D) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1549 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1550 | lemma predicate2I: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1551 | assumes PQ: "\<And>x y. P x y \<Longrightarrow> Q x y" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1552 | shows "P \<le> Q" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1553 | apply (rule le_funI)+ | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1554 | apply (rule le_boolI) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1555 | apply (rule PQ) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1556 | apply assumption | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1557 | done | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1558 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1559 | lemma predicate2D: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1560 | "P \<le> Q \<Longrightarrow> P x y \<Longrightarrow> Q x y" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1561 | apply (erule le_funE)+ | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1562 | apply (erule le_boolE) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1563 | apply assumption+ | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1564 | done | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1565 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1566 | lemma rev_predicate2D: | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1567 | "P x y \<Longrightarrow> P \<le> Q \<Longrightarrow> Q x y" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1568 | by (rule predicate2D) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1569 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1570 | lemma bot1E [no_atp]: "\<bottom> x \<Longrightarrow> P" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1571 | by (simp add: bot_fun_def) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1572 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1573 | lemma bot2E: "\<bottom> x y \<Longrightarrow> P" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1574 | by (simp add: bot_fun_def) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1575 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1576 | lemma top1I: "\<top> x" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1577 | by (simp add: top_fun_def) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1578 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1579 | lemma top2I: "\<top> x y" | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1580 | by (simp add: top_fun_def) | 
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1581 | |
| 
2c5c003cee35
moved lemmas for orderings and lattices on predicates to corresponding theories, retaining declaration order of classical rules; tuned headings; tuned syntax
 haftmann parents: 
46557diff
changeset | 1582 | |
| 34250 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1583 | subsection {* Name duplicates *}
 | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1584 | |
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1585 | lemmas order_eq_refl = preorder_class.eq_refl | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1586 | lemmas order_less_irrefl = preorder_class.less_irrefl | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1587 | lemmas order_less_imp_le = preorder_class.less_imp_le | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1588 | lemmas order_less_not_sym = preorder_class.less_not_sym | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1589 | lemmas order_less_asym = preorder_class.less_asym | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1590 | lemmas order_less_trans = preorder_class.less_trans | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1591 | lemmas order_le_less_trans = preorder_class.le_less_trans | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1592 | lemmas order_less_le_trans = preorder_class.less_le_trans | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1593 | lemmas order_less_imp_not_less = preorder_class.less_imp_not_less | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1594 | lemmas order_less_imp_triv = preorder_class.less_imp_triv | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1595 | lemmas order_less_asym' = preorder_class.less_asym' | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1596 | |
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1597 | lemmas order_less_le = order_class.less_le | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1598 | lemmas order_le_less = order_class.le_less | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1599 | lemmas order_le_imp_less_or_eq = order_class.le_imp_less_or_eq | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1600 | lemmas order_less_imp_not_eq = order_class.less_imp_not_eq | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1601 | lemmas order_less_imp_not_eq2 = order_class.less_imp_not_eq2 | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1602 | lemmas order_neq_le_trans = order_class.neq_le_trans | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1603 | lemmas order_le_neq_trans = order_class.le_neq_trans | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1604 | lemmas order_antisym = order_class.antisym | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1605 | lemmas order_eq_iff = order_class.eq_iff | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1606 | lemmas order_antisym_conv = order_class.antisym_conv | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1607 | |
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1608 | lemmas linorder_linear = linorder_class.linear | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1609 | lemmas linorder_less_linear = linorder_class.less_linear | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1610 | lemmas linorder_le_less_linear = linorder_class.le_less_linear | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1611 | lemmas linorder_le_cases = linorder_class.le_cases | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1612 | lemmas linorder_not_less = linorder_class.not_less | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1613 | lemmas linorder_not_le = linorder_class.not_le | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1614 | lemmas linorder_neq_iff = linorder_class.neq_iff | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1615 | lemmas linorder_neqE = linorder_class.neqE | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1616 | lemmas linorder_antisym_conv1 = linorder_class.antisym_conv1 | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1617 | lemmas linorder_antisym_conv2 = linorder_class.antisym_conv2 | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1618 | lemmas linorder_antisym_conv3 = linorder_class.antisym_conv3 | 
| 
3b619abaa67a
moved name duplicates to end of theory; reduced warning noise
 haftmann parents: 
34065diff
changeset | 1619 | |
| 28685 | 1620 | end | 
| 51487 | 1621 |