src/HOL/Orderings.thy
author haftmann
Tue Sep 26 13:34:17 2006 +0200 (2006-09-26)
changeset 20714 6a122dba034c
parent 20588 c847c56edf0c
child 21044 9690be52ee5d
permissions -rw-r--r--
tuned syntax for <= <
nipkow@15524
     1
(*  Title:      HOL/Orderings.thy
nipkow@15524
     2
    ID:         $Id$
nipkow@15524
     3
    Author:     Tobias Nipkow, Markus Wenzel, and Larry Paulson
nipkow@15524
     4
nipkow@15524
     5
FIXME: derive more of the min/max laws generically via semilattices
nipkow@15524
     6
*)
nipkow@15524
     7
nipkow@15524
     8
header {* Type classes for $\le$ *}
nipkow@15524
     9
nipkow@15524
    10
theory Orderings
haftmann@20588
    11
imports OperationalEquality Lattice_Locales
haftmann@16417
    12
uses ("antisym_setup.ML")
nipkow@15524
    13
begin
nipkow@15524
    14
nipkow@15524
    15
subsection {* Order signatures and orders *}
nipkow@15524
    16
haftmann@20588
    17
class ord = eq +
haftmann@20714
    18
  constrains eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool" (*FIXME: class_package should do the job*)
haftmann@20588
    19
  fixes less_eq :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
haftmann@20588
    20
  fixes less    :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
nipkow@15524
    21
wenzelm@19656
    22
const_syntax
wenzelm@19656
    23
  less  ("op <")
wenzelm@19656
    24
  less  ("(_/ < _)"  [50, 51] 50)
wenzelm@19656
    25
  less_eq  ("op <=")
wenzelm@19656
    26
  less_eq  ("(_/ <= _)" [50, 51] 50)
nipkow@15524
    27
wenzelm@19656
    28
const_syntax (xsymbols)
wenzelm@19656
    29
  less_eq  ("op \<le>")
wenzelm@19656
    30
  less_eq  ("(_/ \<le> _)"  [50, 51] 50)
wenzelm@19656
    31
wenzelm@19656
    32
const_syntax (HTML output)
wenzelm@19656
    33
  less_eq  ("op \<le>")
wenzelm@19656
    34
  less_eq  ("(_/ \<le> _)"  [50, 51] 50)
nipkow@15524
    35
haftmann@20714
    36
haftmann@20714
    37
abbreviation (in ord)
haftmann@20714
    38
  "less_eq_syn \<equiv> less_eq"
haftmann@20714
    39
  "less_syn \<equiv> less"
haftmann@20714
    40
haftmann@20714
    41
const_syntax (in ord) 
haftmann@20714
    42
  less_eq_syn  ("op \<^loc><=")
haftmann@20714
    43
  less_eq_syn  ("(_/ \<^loc><= _)" [50, 51] 50)
haftmann@20714
    44
  less_syn  ("op \<^loc><")
haftmann@20714
    45
  less_syn  ("(_/ \<^loc>< _)"  [50, 51] 50)
haftmann@20714
    46
  
haftmann@20714
    47
const_syntax (in ord) (xsymbols)
haftmann@20714
    48
  less_eq_syn  ("op \<^loc>\<le>")
haftmann@20714
    49
  less_eq_syn  ("(_/ \<^loc>\<le> _)"  [50, 51] 50)
haftmann@20714
    50
haftmann@20714
    51
const_syntax (in ord) (HTML output)
haftmann@20714
    52
  less_eq_syn  ("op \<^loc>\<le>")
haftmann@20714
    53
  less_eq_syn  ("(_/ \<^loc>\<le> _)"  [50, 51] 50)
haftmann@20714
    54
haftmann@20714
    55
wenzelm@19536
    56
abbreviation (input)
wenzelm@19536
    57
  greater  (infixl ">" 50)
haftmann@20714
    58
  "x > y \<equiv> y < x"
wenzelm@19536
    59
  greater_eq  (infixl ">=" 50)
haftmann@20714
    60
  "x >= y \<equiv> y <= x"
haftmann@20714
    61
  
wenzelm@19656
    62
const_syntax (xsymbols)
wenzelm@19656
    63
  greater_eq  (infixl "\<ge>" 50)
nipkow@15524
    64
haftmann@20714
    65
abbreviation (in ord) (input)
haftmann@20714
    66
  greater  (infix "\<^loc>>" 50)
haftmann@20714
    67
  "x \<^loc>> y \<equiv> y \<^loc>< x"
haftmann@20714
    68
  greater_eq  (infix "\<^loc>>=" 50)
haftmann@20714
    69
  "x \<^loc>>= y \<equiv> y \<^loc><= x"
haftmann@20714
    70
haftmann@20714
    71
const_syntax (in ord) (xsymbols)
haftmann@20714
    72
  greater_eq  (infixl "\<^loc>\<ge>" 50)
haftmann@20714
    73
nipkow@15524
    74
nipkow@15524
    75
subsection {* Monotonicity *}
nipkow@15524
    76
nipkow@15524
    77
locale mono =
nipkow@15524
    78
  fixes f
nipkow@15524
    79
  assumes mono: "A <= B ==> f A <= f B"
nipkow@15524
    80
nipkow@15524
    81
lemmas monoI [intro?] = mono.intro
nipkow@15524
    82
  and monoD [dest?] = mono.mono
nipkow@15524
    83
nipkow@15524
    84
constdefs
nipkow@15524
    85
  min :: "['a::ord, 'a] => 'a"
nipkow@15524
    86
  "min a b == (if a <= b then a else b)"
nipkow@15524
    87
  max :: "['a::ord, 'a] => 'a"
nipkow@15524
    88
  "max a b == (if a <= b then b else a)"
nipkow@15524
    89
nipkow@15524
    90
lemma min_leastL: "(!!x. least <= x) ==> min least x = least"
nipkow@15524
    91
  by (simp add: min_def)
nipkow@15524
    92
nipkow@15524
    93
lemma min_of_mono:
paulson@19527
    94
    "(!!x y. (f x <= f y) = (x <= y)) ==> min (f m) (f n) = f (min m n)"
nipkow@15524
    95
  by (simp add: min_def)
nipkow@15524
    96
nipkow@15524
    97
lemma max_leastL: "(!!x. least <= x) ==> max least x = x"
nipkow@15524
    98
  by (simp add: max_def)
nipkow@15524
    99
nipkow@15524
   100
lemma max_of_mono:
paulson@19527
   101
    "(!!x y. (f x <= f y) = (x <= y)) ==> max (f m) (f n) = f (max m n)"
nipkow@15524
   102
  by (simp add: max_def)
nipkow@15524
   103
nipkow@15524
   104
nipkow@15524
   105
subsection "Orders"
nipkow@15524
   106
nipkow@15524
   107
axclass order < ord
nipkow@15524
   108
  order_refl [iff]: "x <= x"
nipkow@15524
   109
  order_trans: "x <= y ==> y <= z ==> x <= z"
nipkow@15524
   110
  order_antisym: "x <= y ==> y <= x ==> x = y"
nipkow@15524
   111
  order_less_le: "(x < y) = (x <= y & x ~= y)"
nipkow@15524
   112
nipkow@15524
   113
text{* Connection to locale: *}
nipkow@15524
   114
ballarin@15837
   115
interpretation order:
nipkow@15780
   116
  partial_order["op \<le> :: 'a::order \<Rightarrow> 'a \<Rightarrow> bool"]
nipkow@15524
   117
apply(rule partial_order.intro)
nipkow@15524
   118
apply(rule order_refl, erule (1) order_trans, erule (1) order_antisym)
nipkow@15524
   119
done
nipkow@15524
   120
nipkow@15524
   121
text {* Reflexivity. *}
nipkow@15524
   122
nipkow@15524
   123
lemma order_eq_refl: "!!x::'a::order. x = y ==> x <= y"
nipkow@15524
   124
    -- {* This form is useful with the classical reasoner. *}
nipkow@15524
   125
  apply (erule ssubst)
nipkow@15524
   126
  apply (rule order_refl)
nipkow@15524
   127
  done
nipkow@15524
   128
nipkow@15524
   129
lemma order_less_irrefl [iff]: "~ x < (x::'a::order)"
nipkow@15524
   130
  by (simp add: order_less_le)
nipkow@15524
   131
nipkow@15524
   132
lemma order_le_less: "((x::'a::order) <= y) = (x < y | x = y)"
nipkow@15524
   133
    -- {* NOT suitable for iff, since it can cause PROOF FAILED. *}
nipkow@15524
   134
  apply (simp add: order_less_le, blast)
nipkow@15524
   135
  done
nipkow@15524
   136
nipkow@15524
   137
lemmas order_le_imp_less_or_eq = order_le_less [THEN iffD1, standard]
nipkow@15524
   138
nipkow@15524
   139
lemma order_less_imp_le: "!!x::'a::order. x < y ==> x <= y"
nipkow@15524
   140
  by (simp add: order_less_le)
nipkow@15524
   141
nipkow@15524
   142
nipkow@15524
   143
text {* Asymmetry. *}
nipkow@15524
   144
nipkow@15524
   145
lemma order_less_not_sym: "(x::'a::order) < y ==> ~ (y < x)"
nipkow@15524
   146
  by (simp add: order_less_le order_antisym)
nipkow@15524
   147
nipkow@15524
   148
lemma order_less_asym: "x < (y::'a::order) ==> (~P ==> y < x) ==> P"
nipkow@15524
   149
  apply (drule order_less_not_sym)
nipkow@15524
   150
  apply (erule contrapos_np, simp)
nipkow@15524
   151
  done
nipkow@15524
   152
nipkow@15524
   153
lemma order_eq_iff: "!!x::'a::order. (x = y) = (x \<le> y & y \<le> x)"
nipkow@15524
   154
by (blast intro: order_antisym)
nipkow@15524
   155
nipkow@15524
   156
lemma order_antisym_conv: "(y::'a::order) <= x ==> (x <= y) = (x = y)"
nipkow@15524
   157
by(blast intro:order_antisym)
nipkow@15524
   158
nipkow@15524
   159
text {* Transitivity. *}
nipkow@15524
   160
nipkow@15524
   161
lemma order_less_trans: "!!x::'a::order. [| x < y; y < z |] ==> x < z"
nipkow@15524
   162
  apply (simp add: order_less_le)
nipkow@15524
   163
  apply (blast intro: order_trans order_antisym)
nipkow@15524
   164
  done
nipkow@15524
   165
nipkow@15524
   166
lemma order_le_less_trans: "!!x::'a::order. [| x <= y; y < z |] ==> x < z"
nipkow@15524
   167
  apply (simp add: order_less_le)
nipkow@15524
   168
  apply (blast intro: order_trans order_antisym)
nipkow@15524
   169
  done
nipkow@15524
   170
nipkow@15524
   171
lemma order_less_le_trans: "!!x::'a::order. [| x < y; y <= z |] ==> x < z"
nipkow@15524
   172
  apply (simp add: order_less_le)
nipkow@15524
   173
  apply (blast intro: order_trans order_antisym)
nipkow@15524
   174
  done
nipkow@15524
   175
nipkow@15524
   176
nipkow@15524
   177
text {* Useful for simplification, but too risky to include by default. *}
nipkow@15524
   178
nipkow@15524
   179
lemma order_less_imp_not_less: "(x::'a::order) < y ==>  (~ y < x) = True"
nipkow@15524
   180
  by (blast elim: order_less_asym)
nipkow@15524
   181
nipkow@15524
   182
lemma order_less_imp_triv: "(x::'a::order) < y ==>  (y < x --> P) = True"
nipkow@15524
   183
  by (blast elim: order_less_asym)
nipkow@15524
   184
nipkow@15524
   185
lemma order_less_imp_not_eq: "(x::'a::order) < y ==>  (x = y) = False"
nipkow@15524
   186
  by auto
nipkow@15524
   187
nipkow@15524
   188
lemma order_less_imp_not_eq2: "(x::'a::order) < y ==>  (y = x) = False"
nipkow@15524
   189
  by auto
nipkow@15524
   190
nipkow@15524
   191
nipkow@15524
   192
text {* Other operators. *}
nipkow@15524
   193
nipkow@15524
   194
lemma min_leastR: "(!!x::'a::order. least <= x) ==> min x least = least"
nipkow@15524
   195
  apply (simp add: min_def)
nipkow@15524
   196
  apply (blast intro: order_antisym)
nipkow@15524
   197
  done
nipkow@15524
   198
nipkow@15524
   199
lemma max_leastR: "(!!x::'a::order. least <= x) ==> max x least = x"
nipkow@15524
   200
  apply (simp add: max_def)
nipkow@15524
   201
  apply (blast intro: order_antisym)
nipkow@15524
   202
  done
nipkow@15524
   203
nipkow@15524
   204
nipkow@15524
   205
subsection {* Transitivity rules for calculational reasoning *}
nipkow@15524
   206
nipkow@15524
   207
nipkow@15524
   208
lemma order_neq_le_trans: "a ~= b ==> (a::'a::order) <= b ==> a < b"
nipkow@15524
   209
  by (simp add: order_less_le)
nipkow@15524
   210
nipkow@15524
   211
lemma order_le_neq_trans: "(a::'a::order) <= b ==> a ~= b ==> a < b"
nipkow@15524
   212
  by (simp add: order_less_le)
nipkow@15524
   213
nipkow@15524
   214
lemma order_less_asym': "(a::'a::order) < b ==> b < a ==> P"
nipkow@15524
   215
  by (rule order_less_asym)
nipkow@15524
   216
nipkow@15524
   217
nipkow@15524
   218
subsection {* Least value operator *}
nipkow@15524
   219
nipkow@15524
   220
constdefs
nipkow@15524
   221
  Least :: "('a::ord => bool) => 'a"               (binder "LEAST " 10)
nipkow@15524
   222
  "Least P == THE x. P x & (ALL y. P y --> x <= y)"
nipkow@15524
   223
    -- {* We can no longer use LeastM because the latter requires Hilbert-AC. *}
nipkow@15524
   224
nipkow@15950
   225
lemma LeastI2_order:
nipkow@15524
   226
  "[| P (x::'a::order);
nipkow@15524
   227
      !!y. P y ==> x <= y;
nipkow@15524
   228
      !!x. [| P x; ALL y. P y --> x \<le> y |] ==> Q x |]
nipkow@15524
   229
   ==> Q (Least P)"
nipkow@15524
   230
  apply (unfold Least_def)
nipkow@15524
   231
  apply (rule theI2)
nipkow@15524
   232
    apply (blast intro: order_antisym)+
nipkow@15524
   233
  done
nipkow@15524
   234
nipkow@15524
   235
lemma Least_equality:
nipkow@15524
   236
    "[| P (k::'a::order); !!x. P x ==> k <= x |] ==> (LEAST x. P x) = k"
nipkow@15524
   237
  apply (simp add: Least_def)
nipkow@15524
   238
  apply (rule the_equality)
nipkow@15524
   239
  apply (auto intro!: order_antisym)
nipkow@15524
   240
  done
nipkow@15524
   241
nipkow@15524
   242
nipkow@15524
   243
subsection "Linear / total orders"
nipkow@15524
   244
nipkow@15524
   245
axclass linorder < order
nipkow@15524
   246
  linorder_linear: "x <= y | y <= x"
nipkow@15524
   247
nipkow@15524
   248
lemma linorder_less_linear: "!!x::'a::linorder. x<y | x=y | y<x"
nipkow@15524
   249
  apply (simp add: order_less_le)
nipkow@15524
   250
  apply (insert linorder_linear, blast)
nipkow@15524
   251
  done
nipkow@15524
   252
nipkow@15524
   253
lemma linorder_le_less_linear: "!!x::'a::linorder. x\<le>y | y<x"
nipkow@15524
   254
  by (simp add: order_le_less linorder_less_linear)
nipkow@15524
   255
nipkow@15524
   256
lemma linorder_le_cases [case_names le ge]:
nipkow@15524
   257
    "((x::'a::linorder) \<le> y ==> P) ==> (y \<le> x ==> P) ==> P"
nipkow@15524
   258
  by (insert linorder_linear, blast)
nipkow@15524
   259
nipkow@15524
   260
lemma linorder_cases [case_names less equal greater]:
nipkow@15524
   261
    "((x::'a::linorder) < y ==> P) ==> (x = y ==> P) ==> (y < x ==> P) ==> P"
nipkow@15524
   262
  by (insert linorder_less_linear, blast)
nipkow@15524
   263
nipkow@15524
   264
lemma linorder_not_less: "!!x::'a::linorder. (~ x < y) = (y <= x)"
nipkow@15524
   265
  apply (simp add: order_less_le)
nipkow@15524
   266
  apply (insert linorder_linear)
nipkow@15524
   267
  apply (blast intro: order_antisym)
nipkow@15524
   268
  done
nipkow@15524
   269
nipkow@15524
   270
lemma linorder_not_le: "!!x::'a::linorder. (~ x <= y) = (y < x)"
nipkow@15524
   271
  apply (simp add: order_less_le)
nipkow@15524
   272
  apply (insert linorder_linear)
nipkow@15524
   273
  apply (blast intro: order_antisym)
nipkow@15524
   274
  done
nipkow@15524
   275
nipkow@15524
   276
lemma linorder_neq_iff: "!!x::'a::linorder. (x ~= y) = (x<y | y<x)"
nipkow@15524
   277
by (cut_tac x = x and y = y in linorder_less_linear, auto)
nipkow@15524
   278
nipkow@15524
   279
lemma linorder_neqE: "x ~= (y::'a::linorder) ==> (x < y ==> R) ==> (y < x ==> R) ==> R"
nipkow@15524
   280
by (simp add: linorder_neq_iff, blast)
nipkow@15524
   281
nipkow@15524
   282
lemma linorder_antisym_conv1: "~ (x::'a::linorder) < y ==> (x <= y) = (x = y)"
nipkow@15524
   283
by(blast intro:order_antisym dest:linorder_not_less[THEN iffD1])
nipkow@15524
   284
nipkow@15524
   285
lemma linorder_antisym_conv2: "(x::'a::linorder) <= y ==> (~ x < y) = (x = y)"
nipkow@15524
   286
by(blast intro:order_antisym dest:linorder_not_less[THEN iffD1])
nipkow@15524
   287
nipkow@15524
   288
lemma linorder_antisym_conv3: "~ (y::'a::linorder) < x ==> (~ x < y) = (x = y)"
nipkow@15524
   289
by(blast intro:order_antisym dest:linorder_not_less[THEN iffD1])
nipkow@15524
   290
paulson@16796
   291
text{*Replacing the old Nat.leI*}
paulson@16796
   292
lemma leI: "~ x < y ==> y <= (x::'a::linorder)"
paulson@16796
   293
  by (simp only: linorder_not_less)
paulson@16796
   294
paulson@16796
   295
lemma leD: "y <= (x::'a::linorder) ==> ~ x < y"
paulson@16796
   296
  by (simp only: linorder_not_less)
paulson@16796
   297
paulson@16796
   298
(*FIXME inappropriate name (or delete altogether)*)
paulson@16796
   299
lemma not_leE: "~ y <= (x::'a::linorder) ==> x < y"
paulson@16796
   300
  by (simp only: linorder_not_le)
paulson@16796
   301
nipkow@15524
   302
use "antisym_setup.ML";
nipkow@15524
   303
setup antisym_setup
nipkow@15524
   304
nipkow@15524
   305
subsection {* Setup of transitivity reasoner as Solver *}
nipkow@15524
   306
nipkow@15524
   307
lemma less_imp_neq: "[| (x::'a::order) < y |] ==> x ~= y"
nipkow@15524
   308
  by (erule contrapos_pn, erule subst, rule order_less_irrefl)
nipkow@15524
   309
nipkow@15524
   310
lemma eq_neq_eq_imp_neq: "[| x = a ; a ~= b; b = y |] ==> x ~= y"
nipkow@15524
   311
  by (erule subst, erule ssubst, assumption)
nipkow@15524
   312
nipkow@15524
   313
ML_setup {*
nipkow@15524
   314
nipkow@15524
   315
(* The setting up of Quasi_Tac serves as a demo.  Since there is no
nipkow@15524
   316
   class for quasi orders, the tactics Quasi_Tac.trans_tac and
nipkow@15524
   317
   Quasi_Tac.quasi_tac are not of much use. *)
nipkow@15524
   318
nipkow@15524
   319
fun decomp_gen sort sign (Trueprop $ t) =
ballarin@15622
   320
  let fun of_sort t = let val T = type_of t in
ballarin@15622
   321
        (* exclude numeric types: linear arithmetic subsumes transitivity *)
ballarin@15622
   322
        T <> HOLogic.natT andalso T <> HOLogic.intT andalso
ballarin@15622
   323
        T <> HOLogic.realT andalso Sign.of_sort sign (T, sort) end
nipkow@15524
   324
  fun dec (Const ("Not", _) $ t) = (
nipkow@15524
   325
	  case dec t of
skalberg@15531
   326
	    NONE => NONE
skalberg@15531
   327
	  | SOME (t1, rel, t2) => SOME (t1, "~" ^ rel, t2))
nipkow@15524
   328
	| dec (Const ("op =",  _) $ t1 $ t2) =
nipkow@15524
   329
	    if of_sort t1
skalberg@15531
   330
	    then SOME (t1, "=", t2)
skalberg@15531
   331
	    else NONE
haftmann@19277
   332
	| dec (Const ("Orderings.less_eq",  _) $ t1 $ t2) =
nipkow@15524
   333
	    if of_sort t1
skalberg@15531
   334
	    then SOME (t1, "<=", t2)
skalberg@15531
   335
	    else NONE
haftmann@19277
   336
	| dec (Const ("Orderings.less",  _) $ t1 $ t2) =
nipkow@15524
   337
	    if of_sort t1
skalberg@15531
   338
	    then SOME (t1, "<", t2)
skalberg@15531
   339
	    else NONE
skalberg@15531
   340
	| dec _ = NONE
nipkow@15524
   341
  in dec t end;
nipkow@15524
   342
nipkow@15524
   343
structure Quasi_Tac = Quasi_Tac_Fun (
nipkow@15524
   344
  struct
nipkow@15524
   345
    val le_trans = thm "order_trans";
nipkow@15524
   346
    val le_refl = thm "order_refl";
nipkow@15524
   347
    val eqD1 = thm "order_eq_refl";
nipkow@15524
   348
    val eqD2 = thm "sym" RS thm "order_eq_refl";
nipkow@15524
   349
    val less_reflE = thm "order_less_irrefl" RS thm "notE";
nipkow@15524
   350
    val less_imp_le = thm "order_less_imp_le";
nipkow@15524
   351
    val le_neq_trans = thm "order_le_neq_trans";
nipkow@15524
   352
    val neq_le_trans = thm "order_neq_le_trans";
nipkow@15524
   353
    val less_imp_neq = thm "less_imp_neq";
nipkow@15524
   354
    val decomp_trans = decomp_gen ["Orderings.order"];
nipkow@15524
   355
    val decomp_quasi = decomp_gen ["Orderings.order"];
nipkow@15524
   356
nipkow@15524
   357
  end);  (* struct *)
nipkow@15524
   358
nipkow@15524
   359
structure Order_Tac = Order_Tac_Fun (
nipkow@15524
   360
  struct
nipkow@15524
   361
    val less_reflE = thm "order_less_irrefl" RS thm "notE";
nipkow@15524
   362
    val le_refl = thm "order_refl";
nipkow@15524
   363
    val less_imp_le = thm "order_less_imp_le";
nipkow@15524
   364
    val not_lessI = thm "linorder_not_less" RS thm "iffD2";
nipkow@15524
   365
    val not_leI = thm "linorder_not_le" RS thm "iffD2";
nipkow@15524
   366
    val not_lessD = thm "linorder_not_less" RS thm "iffD1";
nipkow@15524
   367
    val not_leD = thm "linorder_not_le" RS thm "iffD1";
nipkow@15524
   368
    val eqI = thm "order_antisym";
nipkow@15524
   369
    val eqD1 = thm "order_eq_refl";
nipkow@15524
   370
    val eqD2 = thm "sym" RS thm "order_eq_refl";
nipkow@15524
   371
    val less_trans = thm "order_less_trans";
nipkow@15524
   372
    val less_le_trans = thm "order_less_le_trans";
nipkow@15524
   373
    val le_less_trans = thm "order_le_less_trans";
nipkow@15524
   374
    val le_trans = thm "order_trans";
nipkow@15524
   375
    val le_neq_trans = thm "order_le_neq_trans";
nipkow@15524
   376
    val neq_le_trans = thm "order_neq_le_trans";
nipkow@15524
   377
    val less_imp_neq = thm "less_imp_neq";
nipkow@15524
   378
    val eq_neq_eq_imp_neq = thm "eq_neq_eq_imp_neq";
obua@16743
   379
    val not_sym = thm "not_sym";
nipkow@15524
   380
    val decomp_part = decomp_gen ["Orderings.order"];
nipkow@15524
   381
    val decomp_lin = decomp_gen ["Orderings.linorder"];
nipkow@15524
   382
nipkow@15524
   383
  end);  (* struct *)
nipkow@15524
   384
wenzelm@17876
   385
change_simpset (fn ss => ss
nipkow@15524
   386
    addSolver (mk_solver "Trans_linear" (fn _ => Order_Tac.linear_tac))
wenzelm@17876
   387
    addSolver (mk_solver "Trans_partial" (fn _ => Order_Tac.partial_tac)));
nipkow@15524
   388
  (* Adding the transitivity reasoners also as safe solvers showed a slight
nipkow@15524
   389
     speed up, but the reasoning strength appears to be not higher (at least
nipkow@15524
   390
     no breaking of additional proofs in the entire HOL distribution, as
nipkow@15524
   391
     of 5 March 2004, was observed). *)
nipkow@15524
   392
*}
nipkow@15524
   393
nipkow@15524
   394
(* Optional setup of methods *)
nipkow@15524
   395
nipkow@15524
   396
(*
nipkow@15524
   397
method_setup trans_partial =
nipkow@15524
   398
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (Order_Tac.partial_tac)) *}
nipkow@15524
   399
  {* transitivity reasoner for partial orders *}	
nipkow@15524
   400
method_setup trans_linear =
nipkow@15524
   401
  {* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (Order_Tac.linear_tac)) *}
nipkow@15524
   402
  {* transitivity reasoner for linear orders *}
nipkow@15524
   403
*)
nipkow@15524
   404
nipkow@15524
   405
(*
nipkow@15524
   406
declare order.order_refl [simp del] order_less_irrefl [simp del]
nipkow@15524
   407
nipkow@15524
   408
can currently not be removed, abel_cancel relies on it.
nipkow@15524
   409
*)
nipkow@15524
   410
nipkow@15524
   411
nipkow@15524
   412
subsection "Min and max on (linear) orders"
nipkow@15524
   413
nipkow@15524
   414
text{* Instantiate locales: *}
nipkow@15524
   415
ballarin@15837
   416
interpretation min_max:
nipkow@15780
   417
  lower_semilattice["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a"]
ballarin@19984
   418
apply unfold_locales
nipkow@15524
   419
apply(simp add:min_def linorder_not_le order_less_imp_le)
nipkow@15524
   420
apply(simp add:min_def linorder_not_le order_less_imp_le)
nipkow@15524
   421
apply(simp add:min_def linorder_not_le order_less_imp_le)
nipkow@15524
   422
done
nipkow@15524
   423
ballarin@15837
   424
interpretation min_max:
nipkow@15780
   425
  upper_semilattice["op \<le>" "max :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a"]
ballarin@19984
   426
apply unfold_locales
nipkow@15524
   427
apply(simp add: max_def linorder_not_le order_less_imp_le)
nipkow@15524
   428
apply(simp add: max_def linorder_not_le order_less_imp_le)
nipkow@15524
   429
apply(simp add: max_def linorder_not_le order_less_imp_le)
nipkow@15524
   430
done
nipkow@15524
   431
ballarin@15837
   432
interpretation min_max:
nipkow@15780
   433
  lattice["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max"]
ballarin@19984
   434
  by unfold_locales
nipkow@15524
   435
ballarin@15837
   436
interpretation min_max:
nipkow@15780
   437
  distrib_lattice["op \<le>" "min :: 'a::linorder \<Rightarrow> 'a \<Rightarrow> 'a" "max"]
ballarin@19984
   438
apply unfold_locales
nipkow@15524
   439
apply(rule_tac x=x and y=y in linorder_le_cases)
nipkow@15524
   440
apply(rule_tac x=x and y=z in linorder_le_cases)
nipkow@15524
   441
apply(rule_tac x=y and y=z in linorder_le_cases)
nipkow@15524
   442
apply(simp add:min_def max_def)
nipkow@15524
   443
apply(simp add:min_def max_def)
nipkow@15524
   444
apply(rule_tac x=y and y=z in linorder_le_cases)
nipkow@15524
   445
apply(simp add:min_def max_def)
nipkow@15524
   446
apply(simp add:min_def max_def)
nipkow@15524
   447
apply(rule_tac x=x and y=z in linorder_le_cases)
nipkow@15524
   448
apply(rule_tac x=y and y=z in linorder_le_cases)
nipkow@15524
   449
apply(simp add:min_def max_def)
nipkow@15524
   450
apply(simp add:min_def max_def)
nipkow@15524
   451
apply(rule_tac x=y and y=z in linorder_le_cases)
nipkow@15524
   452
apply(simp add:min_def max_def)
nipkow@15524
   453
apply(simp add:min_def max_def)
nipkow@15524
   454
done
nipkow@15524
   455
nipkow@15524
   456
lemma le_max_iff_disj: "!!z::'a::linorder. (z <= max x y) = (z <= x | z <= y)"
nipkow@15524
   457
  apply(simp add:max_def)
nipkow@15524
   458
  apply (insert linorder_linear)
nipkow@15524
   459
  apply (blast intro: order_trans)
nipkow@15524
   460
  done
nipkow@15524
   461
nipkow@15780
   462
lemmas le_maxI1 = min_max.sup_ge1
nipkow@15780
   463
lemmas le_maxI2 = min_max.sup_ge2
nipkow@15524
   464
nipkow@15524
   465
lemma less_max_iff_disj: "!!z::'a::linorder. (z < max x y) = (z < x | z < y)"
nipkow@15524
   466
  apply (simp add: max_def order_le_less)
nipkow@15524
   467
  apply (insert linorder_less_linear)
nipkow@15524
   468
  apply (blast intro: order_less_trans)
nipkow@15524
   469
  done
nipkow@15524
   470
nipkow@15524
   471
lemma max_less_iff_conj [simp]:
nipkow@15524
   472
    "!!z::'a::linorder. (max x y < z) = (x < z & y < z)"
nipkow@15524
   473
  apply (simp add: order_le_less max_def)
nipkow@15524
   474
  apply (insert linorder_less_linear)
nipkow@15524
   475
  apply (blast intro: order_less_trans)
nipkow@15524
   476
  done
nipkow@15791
   477
nipkow@15524
   478
lemma min_less_iff_conj [simp]:
nipkow@15524
   479
    "!!z::'a::linorder. (z < min x y) = (z < x & z < y)"
nipkow@15524
   480
  apply (simp add: order_le_less min_def)
nipkow@15524
   481
  apply (insert linorder_less_linear)
nipkow@15524
   482
  apply (blast intro: order_less_trans)
nipkow@15524
   483
  done
nipkow@15524
   484
nipkow@15524
   485
lemma min_le_iff_disj: "!!z::'a::linorder. (min x y <= z) = (x <= z | y <= z)"
nipkow@15524
   486
  apply (simp add: min_def)
nipkow@15524
   487
  apply (insert linorder_linear)
nipkow@15524
   488
  apply (blast intro: order_trans)
nipkow@15524
   489
  done
nipkow@15524
   490
nipkow@15524
   491
lemma min_less_iff_disj: "!!z::'a::linorder. (min x y < z) = (x < z | y < z)"
nipkow@15524
   492
  apply (simp add: min_def order_le_less)
nipkow@15524
   493
  apply (insert linorder_less_linear)
nipkow@15524
   494
  apply (blast intro: order_less_trans)
nipkow@15524
   495
  done
nipkow@15524
   496
nipkow@15780
   497
lemmas max_ac = min_max.sup_assoc min_max.sup_commute
nipkow@15780
   498
               mk_left_commute[of max,OF min_max.sup_assoc min_max.sup_commute]
nipkow@15524
   499
nipkow@15780
   500
lemmas min_ac = min_max.inf_assoc min_max.inf_commute
nipkow@15780
   501
               mk_left_commute[of min,OF min_max.inf_assoc min_max.inf_commute]
nipkow@15524
   502
nipkow@15524
   503
lemma split_min:
nipkow@15524
   504
    "P (min (i::'a::linorder) j) = ((i <= j --> P(i)) & (~ i <= j --> P(j)))"
nipkow@15524
   505
  by (simp add: min_def)
nipkow@15524
   506
nipkow@15524
   507
lemma split_max:
nipkow@15524
   508
    "P (max (i::'a::linorder) j) = ((i <= j --> P(j)) & (~ i <= j --> P(i)))"
nipkow@15524
   509
  by (simp add: max_def)
nipkow@15524
   510
nipkow@15524
   511
nipkow@15524
   512
subsection "Bounded quantifiers"
nipkow@15524
   513
nipkow@15524
   514
syntax
nipkow@15524
   515
  "_lessAll" :: "[idt, 'a, bool] => bool"   ("(3ALL _<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   516
  "_lessEx"  :: "[idt, 'a, bool] => bool"   ("(3EX _<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   517
  "_leAll"   :: "[idt, 'a, bool] => bool"   ("(3ALL _<=_./ _)" [0, 0, 10] 10)
nipkow@15524
   518
  "_leEx"    :: "[idt, 'a, bool] => bool"   ("(3EX _<=_./ _)" [0, 0, 10] 10)
nipkow@15524
   519
nipkow@15524
   520
  "_gtAll" :: "[idt, 'a, bool] => bool"   ("(3ALL _>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   521
  "_gtEx"  :: "[idt, 'a, bool] => bool"   ("(3EX _>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   522
  "_geAll"   :: "[idt, 'a, bool] => bool"   ("(3ALL _>=_./ _)" [0, 0, 10] 10)
nipkow@15524
   523
  "_geEx"    :: "[idt, 'a, bool] => bool"   ("(3EX _>=_./ _)" [0, 0, 10] 10)
nipkow@15524
   524
nipkow@15524
   525
syntax (xsymbols)
nipkow@15524
   526
  "_lessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   527
  "_lessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   528
  "_leAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10)
nipkow@15524
   529
  "_leEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10)
nipkow@15524
   530
nipkow@15524
   531
  "_gtAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   532
  "_gtEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   533
  "_geAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<ge>_./ _)" [0, 0, 10] 10)
nipkow@15524
   534
  "_geEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<ge>_./ _)" [0, 0, 10] 10)
nipkow@15524
   535
nipkow@15524
   536
syntax (HOL)
nipkow@15524
   537
  "_lessAll" :: "[idt, 'a, bool] => bool"   ("(3! _<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   538
  "_lessEx"  :: "[idt, 'a, bool] => bool"   ("(3? _<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   539
  "_leAll"   :: "[idt, 'a, bool] => bool"   ("(3! _<=_./ _)" [0, 0, 10] 10)
nipkow@15524
   540
  "_leEx"    :: "[idt, 'a, bool] => bool"   ("(3? _<=_./ _)" [0, 0, 10] 10)
nipkow@15524
   541
nipkow@15524
   542
syntax (HTML output)
nipkow@15524
   543
  "_lessAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   544
  "_lessEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_<_./ _)"  [0, 0, 10] 10)
nipkow@15524
   545
  "_leAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<le>_./ _)" [0, 0, 10] 10)
nipkow@15524
   546
  "_leEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<le>_./ _)" [0, 0, 10] 10)
nipkow@15524
   547
nipkow@15524
   548
  "_gtAll" :: "[idt, 'a, bool] => bool"   ("(3\<forall>_>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   549
  "_gtEx"  :: "[idt, 'a, bool] => bool"   ("(3\<exists>_>_./ _)"  [0, 0, 10] 10)
nipkow@15524
   550
  "_geAll"   :: "[idt, 'a, bool] => bool"   ("(3\<forall>_\<ge>_./ _)" [0, 0, 10] 10)
nipkow@15524
   551
  "_geEx"    :: "[idt, 'a, bool] => bool"   ("(3\<exists>_\<ge>_./ _)" [0, 0, 10] 10)
nipkow@15524
   552
nipkow@15524
   553
translations
nipkow@15524
   554
 "ALL x<y. P"   =>  "ALL x. x < y --> P"
nipkow@15524
   555
 "EX x<y. P"    =>  "EX x. x < y  & P"
nipkow@15524
   556
 "ALL x<=y. P"  =>  "ALL x. x <= y --> P"
nipkow@15524
   557
 "EX x<=y. P"   =>  "EX x. x <= y & P"
nipkow@15524
   558
 "ALL x>y. P"   =>  "ALL x. x > y --> P"
nipkow@15524
   559
 "EX x>y. P"    =>  "EX x. x > y  & P"
nipkow@15524
   560
 "ALL x>=y. P"  =>  "ALL x. x >= y --> P"
nipkow@15524
   561
 "EX x>=y. P"   =>  "EX x. x >= y & P"
nipkow@15524
   562
nipkow@15524
   563
print_translation {*
nipkow@15524
   564
let
nipkow@15524
   565
  fun mk v v' q n P =
wenzelm@16861
   566
    if v=v' andalso not (v mem (map fst (Term.add_frees n [])))
nipkow@15524
   567
    then Syntax.const q $ Syntax.mark_bound v' $ n $ P else raise Match;
nipkow@15524
   568
  fun all_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   569
               Const("op -->",_) $ (Const ("less",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] =
nipkow@15524
   570
    mk v v' "_lessAll" n P
nipkow@15524
   571
nipkow@15524
   572
  | all_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   573
               Const("op -->",_) $ (Const ("less_eq",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] =
nipkow@15524
   574
    mk v v' "_leAll" n P
nipkow@15524
   575
nipkow@15524
   576
  | all_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   577
               Const("op -->",_) $ (Const ("less",_) $ n $ (Const ("_bound",_) $ Free (v',_))) $ P] =
nipkow@15524
   578
    mk v v' "_gtAll" n P
nipkow@15524
   579
nipkow@15524
   580
  | all_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   581
               Const("op -->",_) $ (Const ("less_eq",_) $ n $ (Const ("_bound",_) $ Free (v',_))) $ P] =
nipkow@15524
   582
    mk v v' "_geAll" n P;
nipkow@15524
   583
nipkow@15524
   584
  fun ex_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   585
               Const("op &",_) $ (Const ("less",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] =
nipkow@15524
   586
    mk v v' "_lessEx" n P
nipkow@15524
   587
nipkow@15524
   588
  | ex_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   589
               Const("op &",_) $ (Const ("less_eq",_) $ (Const ("_bound",_) $ Free (v',_)) $ n ) $ P] =
nipkow@15524
   590
    mk v v' "_leEx" n P
nipkow@15524
   591
nipkow@15524
   592
  | ex_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   593
               Const("op &",_) $ (Const ("less",_) $ n $ (Const ("_bound",_) $ Free (v',_))) $ P] =
nipkow@15524
   594
    mk v v' "_gtEx" n P
nipkow@15524
   595
nipkow@15524
   596
  | ex_tr' [Const ("_bound",_) $ Free (v,_),
wenzelm@19637
   597
               Const("op &",_) $ (Const ("less_eq",_) $ n $ (Const ("_bound",_) $ Free (v',_))) $ P] =
nipkow@15524
   598
    mk v v' "_geEx" n P
nipkow@15524
   599
in
nipkow@15524
   600
[("ALL ", all_tr'), ("EX ", ex_tr')]
nipkow@15524
   601
end
nipkow@15524
   602
*}
nipkow@15524
   603
avigad@17012
   604
subsection {* Extra transitivity rules *}
avigad@17012
   605
avigad@17012
   606
text {* These support proving chains of decreasing inequalities
avigad@17012
   607
    a >= b >= c ... in Isar proofs. *}
avigad@17012
   608
avigad@17012
   609
lemma xt1: "a = b ==> b > c ==> a > c"
avigad@17012
   610
by simp
avigad@17012
   611
avigad@17012
   612
lemma xt2: "a > b ==> b = c ==> a > c"
avigad@17012
   613
by simp
avigad@17012
   614
avigad@17012
   615
lemma xt3: "a = b ==> b >= c ==> a >= c"
avigad@17012
   616
by simp
avigad@17012
   617
avigad@17012
   618
lemma xt4: "a >= b ==> b = c ==> a >= c"
avigad@17012
   619
by simp
avigad@17012
   620
avigad@17012
   621
lemma xt5: "(x::'a::order) >= y ==> y >= x ==> x = y"
avigad@17012
   622
by simp
avigad@17012
   623
avigad@17012
   624
lemma xt6: "(x::'a::order) >= y ==> y >= z ==> x >= z"
avigad@17012
   625
by simp
avigad@17012
   626
avigad@17012
   627
lemma xt7: "(x::'a::order) > y ==> y >= z ==> x > z"
avigad@17012
   628
by simp
avigad@17012
   629
avigad@17012
   630
lemma xt8: "(x::'a::order) >= y ==> y > z ==> x > z"
avigad@17012
   631
by simp
avigad@17012
   632
avigad@17012
   633
lemma xt9: "(a::'a::order) > b ==> b > a ==> ?P"
avigad@17012
   634
by simp
avigad@17012
   635
avigad@17012
   636
lemma xt10: "(x::'a::order) > y ==> y > z ==> x > z"
avigad@17012
   637
by simp
avigad@17012
   638
avigad@17012
   639
lemma xt11: "(a::'a::order) >= b ==> a ~= b ==> a > b"
avigad@17012
   640
by simp
avigad@17012
   641
avigad@17012
   642
lemma xt12: "(a::'a::order) ~= b ==> a >= b ==> a > b"
avigad@17012
   643
by simp
avigad@17012
   644
avigad@17012
   645
lemma xt13: "a = f b ==> b > c ==> (!!x y. x > y ==> f x > f y) ==>
avigad@17012
   646
    a > f c" 
avigad@17012
   647
by simp
avigad@17012
   648
avigad@17012
   649
lemma xt14: "a > b ==> f b = c ==> (!!x y. x > y ==> f x > f y) ==>
avigad@17012
   650
    f a > c"
avigad@17012
   651
by auto
avigad@17012
   652
avigad@17012
   653
lemma xt15: "a = f b ==> b >= c ==> (!!x y. x >= y ==> f x >= f y) ==>
avigad@17012
   654
    a >= f c"
avigad@17012
   655
by simp
avigad@17012
   656
avigad@17012
   657
lemma xt16: "a >= b ==> f b = c ==> (!! x y. x >= y ==> f x >= f y) ==>
avigad@17012
   658
    f a >= c"
avigad@17012
   659
by auto
avigad@17012
   660
avigad@17012
   661
lemma xt17: "(a::'a::order) >= f b ==> b >= c ==> 
avigad@17012
   662
    (!!x y. x >= y ==> f x >= f y) ==> a >= f c"
avigad@17012
   663
by (subgoal_tac "f b >= f c", force, force)
avigad@17012
   664
avigad@17012
   665
lemma xt18: "(a::'a::order) >= b ==> (f b::'b::order) >= c ==> 
avigad@17012
   666
    (!!x y. x >= y ==> f x >= f y) ==> f a >= c"
avigad@17012
   667
by (subgoal_tac "f a >= f b", force, force)
avigad@17012
   668
avigad@17012
   669
lemma xt19: "(a::'a::order) > f b ==> (b::'b::order) >= c ==>
avigad@17012
   670
  (!!x y. x >= y ==> f x >= f y) ==> a > f c"
avigad@17012
   671
by (subgoal_tac "f b >= f c", force, force)
avigad@17012
   672
avigad@17012
   673
lemma xt20: "(a::'a::order) > b ==> (f b::'b::order) >= c==>
avigad@17012
   674
    (!!x y. x > y ==> f x > f y) ==> f a > c"
avigad@17012
   675
by (subgoal_tac "f a > f b", force, force)
avigad@17012
   676
avigad@17012
   677
lemma xt21: "(a::'a::order) >= f b ==> b > c ==>
avigad@17012
   678
    (!!x y. x > y ==> f x > f y) ==> a > f c"
avigad@17012
   679
by (subgoal_tac "f b > f c", force, force)
avigad@17012
   680
avigad@17012
   681
lemma xt22: "(a::'a::order) >= b ==> (f b::'b::order) > c ==>
avigad@17012
   682
    (!!x y. x >= y ==> f x >= f y) ==> f a > c"
avigad@17012
   683
by (subgoal_tac "f a >= f b", force, force)
avigad@17012
   684
avigad@17012
   685
lemma xt23: "(a::'a::order) > f b ==> (b::'b::order) > c ==>
avigad@17012
   686
    (!!x y. x > y ==> f x > f y) ==> a > f c"
avigad@17012
   687
by (subgoal_tac "f b > f c", force, force)
avigad@17012
   688
avigad@17012
   689
lemma xt24: "(a::'a::order) > b ==> (f b::'b::order) > c ==>
avigad@17012
   690
    (!!x y. x > y ==> f x > f y) ==> f a > c"
avigad@17012
   691
by (subgoal_tac "f a > f b", force, force)
avigad@17012
   692
avigad@17012
   693
avigad@17012
   694
lemmas xtrans = xt1 xt2 xt3 xt4 xt5 xt6 xt7 xt8 xt9 xt10 xt11 xt12
avigad@17012
   695
    xt13 xt14 xt15 xt15 xt17 xt18 xt19 xt20 xt21 xt22 xt23 xt24
avigad@17012
   696
avigad@17012
   697
(* 
avigad@17012
   698
  Since "a >= b" abbreviates "b <= a", the abbreviation "..." stands
avigad@17012
   699
  for the wrong thing in an Isar proof.
avigad@17012
   700
avigad@17012
   701
  The extra transitivity rules can be used as follows: 
avigad@17012
   702
avigad@17012
   703
lemma "(a::'a::order) > z"
avigad@17012
   704
proof -
avigad@17012
   705
  have "a >= b" (is "_ >= ?rhs")
avigad@17012
   706
    sorry
avigad@17012
   707
  also have "?rhs >= c" (is "_ >= ?rhs")
avigad@17012
   708
    sorry
avigad@17012
   709
  also (xtrans) have "?rhs = d" (is "_ = ?rhs")
avigad@17012
   710
    sorry
avigad@17012
   711
  also (xtrans) have "?rhs >= e" (is "_ >= ?rhs")
avigad@17012
   712
    sorry
avigad@17012
   713
  also (xtrans) have "?rhs > f" (is "_ > ?rhs")
avigad@17012
   714
    sorry
avigad@17012
   715
  also (xtrans) have "?rhs > z"
avigad@17012
   716
    sorry
avigad@17012
   717
  finally (xtrans) show ?thesis .
avigad@17012
   718
qed
avigad@17012
   719
avigad@17012
   720
  Alternatively, one can use "declare xtrans [trans]" and then
avigad@17012
   721
  leave out the "(xtrans)" above.
avigad@17012
   722
*)
avigad@17012
   723
nipkow@15524
   724
end