src/HOL/Ord.ML
author oheimb
Thu, 01 Feb 2001 20:51:48 +0100
changeset 11025 a70b796d9af8
parent 10753 e43e017df8c1
permissions -rw-r--r--
converted to Isar therory, adding attributes complete_split and split_format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
     1
(*  Title:      HOL/Ord.ML
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 923
diff changeset
     3
    Author:     Tobias Nipkow, Cambridge University Computer Laboratory
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
The type class for ordered types
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
5449
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
     9
(*Tell Blast_tac about overloading of < and <= to reduce the risk of
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    10
  its applying a rule for the wrong type*)
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    11
Blast.overloaded ("op <", domain_type); 
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    12
Blast.overloaded ("op <=", domain_type);
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    13
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    14
(** mono **)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5143
diff changeset
    16
val [prem] = Goalw [mono_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
    "[| !!A B. A <= B ==> f(A) <= f(B) |] ==> mono(f)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
by (REPEAT (ares_tac [allI, impI, prem] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
qed "monoI";
6956
18c0457efd3d mono: AddXI/Es;
wenzelm
parents: 6814
diff changeset
    20
AddXIs [monoI];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5143
diff changeset
    22
Goalw [mono_def] "[| mono(f);  A <= B |] ==> f(A) <= f(B)";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5143
diff changeset
    23
by (Fast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
qed "monoD";
6956
18c0457efd3d mono: AddXI/Es;
wenzelm
parents: 6814
diff changeset
    25
AddXDs [monoD];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    27
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    28
section "Orders";
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    29
5538
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    30
(** Reflexivity **)
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    31
6115
c70bce7deb0f Refined arithmetic.
nipkow
parents: 6109
diff changeset
    32
AddIffs [order_refl];
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    33
4600
e3e7e901ce6c New theorem order_eq_refl
paulson
parents: 4089
diff changeset
    34
(*This form is useful with the classical reasoner*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    35
Goal "!!x::'a::order. x = y ==> x <= y";
4600
e3e7e901ce6c New theorem order_eq_refl
paulson
parents: 4089
diff changeset
    36
by (etac ssubst 1);
e3e7e901ce6c New theorem order_eq_refl
paulson
parents: 4089
diff changeset
    37
by (rtac order_refl 1);
e3e7e901ce6c New theorem order_eq_refl
paulson
parents: 4089
diff changeset
    38
qed "order_eq_refl";
e3e7e901ce6c New theorem order_eq_refl
paulson
parents: 4089
diff changeset
    39
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    40
Goal "~ x < (x::'a::order)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 2935
diff changeset
    41
by (simp_tac (simpset() addsimps [order_less_le]) 1);
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    42
qed "order_less_irrefl";
5449
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    43
Addsimps [order_less_irrefl];
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    44
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
    45
Goal "(x::'a::order) <= y = (x < y | x = y)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 2935
diff changeset
    46
by (simp_tac (simpset() addsimps [order_less_le]) 1);
5449
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    47
   (*NOT suitable for AddIffs, since it can cause PROOF FAILED*)
d853d1ac85a3 Adds order_refl, order_less_irrefl as simps, not as Iffs, to avoid PROOF FAILED
paulson
parents: 5316
diff changeset
    48
by (blast_tac (claset() addSIs [order_refl]) 1);
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    49
qed "order_le_less";
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
    50
10753
e43e017df8c1 a generic ordering theorem used in Real
paulson
parents: 10231
diff changeset
    51
bind_thm ("order_le_imp_less_or_eq", order_le_less RS iffD1);
e43e017df8c1 a generic ordering theorem used in Real
paulson
parents: 10231
diff changeset
    52
8214
d612354445b6 new thm order_less_imp_le
paulson
parents: 8024
diff changeset
    53
Goal "!!x::'a::order. x < y ==> x <= y";
d612354445b6 new thm order_less_imp_le
paulson
parents: 8024
diff changeset
    54
by (asm_full_simp_tac (simpset() addsimps [order_less_le]) 1);
d612354445b6 new thm order_less_imp_le
paulson
parents: 8024
diff changeset
    55
qed "order_less_imp_le";
d612354445b6 new thm order_less_imp_le
paulson
parents: 8024
diff changeset
    56
5538
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    57
(** Asymmetry **)
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    58
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    59
Goal "(x::'a::order) < y ==> ~ (y<x)";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    60
by (asm_full_simp_tac (simpset() addsimps [order_less_le, order_antisym]) 1);
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    61
qed "order_less_not_sym";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    62
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    63
(* [| n<m;  ~P ==> m<n |] ==> P *)
10231
178a272bceeb renaming of contrapos rules
paulson
parents: 9969
diff changeset
    64
bind_thm ("order_less_asym", order_less_not_sym RS contrapos_np);
5538
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    65
6073
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    66
(* Transitivity *)
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    67
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    68
Goal "!!x::'a::order. [| x < y; y < z |] ==> x < z";
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    69
by (asm_full_simp_tac (simpset() addsimps [order_less_le]) 1);
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    70
by (blast_tac (claset() addIs [order_trans,order_antisym]) 1);
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    71
qed "order_less_trans";
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
    72
6780
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    73
Goal "!!x::'a::order. [| x <= y; y < z |] ==> x < z";
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    74
by (asm_full_simp_tac (simpset() addsimps [order_less_le]) 1);
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    75
by (blast_tac (claset() addIs [order_trans,order_antisym]) 1);
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    76
qed "order_le_less_trans";
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    77
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    78
Goal "!!x::'a::order. [| x < y; y <= z |] ==> x < z";
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    79
by (asm_full_simp_tac (simpset() addsimps [order_less_le]) 1);
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    80
by (blast_tac (claset() addIs [order_trans,order_antisym]) 1);
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    81
qed "order_less_le_trans";
769cea1985e4 added order_le_less_trans, order_less_le_trans;
wenzelm
parents: 6433
diff changeset
    82
5538
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    83
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    84
(** Useful for simplification, but too risky to include by default. **)
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    85
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    86
Goal "(x::'a::order) < y ==>  (~ y < x) = True";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    87
by (blast_tac (claset() addEs [order_less_asym]) 1);
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    88
qed "order_less_imp_not_less";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    89
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    90
Goal "(x::'a::order) < y ==>  (y < x --> P) = True";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    91
by (blast_tac (claset() addEs [order_less_asym]) 1);
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    92
qed "order_less_imp_triv";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    93
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    94
Goal "(x::'a::order) < y ==>  (x = y) = False";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    95
by Auto_tac;
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    96
qed "order_less_imp_not_eq";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    97
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    98
Goal "(x::'a::order) < y ==>  (y = x) = False";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
    99
by Auto_tac;
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
   100
qed "order_less_imp_not_eq2";
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
   101
c55bf0487abe a few new theorems
paulson
parents: 5449
diff changeset
   102
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   103
(** min **)
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   104
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   105
val prems = Goalw [min_def] "(!!x. least <= x) ==> min least x = least";
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   106
by (simp_tac (simpset() addsimps prems) 1);
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   107
qed "min_leastL";
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   108
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5143
diff changeset
   109
val prems = Goalw [min_def]
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   110
 "(!!x::'a::order. least <= x) ==> min x least = least";
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2608
diff changeset
   111
by (cut_facts_tac prems 1);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2608
diff changeset
   112
by (Asm_simp_tac 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 2935
diff changeset
   113
by (blast_tac (claset() addIs [order_antisym]) 1);
2608
450c9b682a92 New class "order" and accompanying changes.
nipkow
parents: 1465
diff changeset
   114
qed "min_leastR";
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   115
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   116
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   117
section "Linear/Total Orders";
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   118
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   119
Goal "!!x::'a::linorder. x<y | x=y | y<x";
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   120
by (simp_tac (simpset() addsimps [order_less_le]) 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   121
by (cut_facts_tac [linorder_linear] 1);
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   122
by (Blast_tac 1);
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   123
qed "linorder_less_linear";
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   124
9969
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9422
diff changeset
   125
val prems = Goal "[| (x::'a::linorder)<y ==> P; x=y ==> P; y<x ==> P |] ==> P";
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9422
diff changeset
   126
by (cut_facts_tac [linorder_less_linear] 1);
4753185f1dd2 renamed (most of...) the select rules
paulson
parents: 9422
diff changeset
   127
by (REPEAT(eresolve_tac (prems@[disjE]) 1));
8024
199721f2eb2d Added linord_less_split
nipkow
parents: 7617
diff changeset
   128
qed "linorder_less_split";
199721f2eb2d Added linord_less_split
nipkow
parents: 7617
diff changeset
   129
6128
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   130
Goal "!!x::'a::linorder. (~ x < y) = (y <= x)";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   131
by (simp_tac (simpset() addsimps [order_less_le]) 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   132
by (cut_facts_tac [linorder_linear] 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   133
by (blast_tac (claset() addIs [order_antisym]) 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   134
qed "linorder_not_less";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   135
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   136
Goal "!!x::'a::linorder. (~ x <= y) = (y < x)";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   137
by (simp_tac (simpset() addsimps [order_less_le]) 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   138
by (cut_facts_tac [linorder_linear] 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   139
by (blast_tac (claset() addIs [order_antisym]) 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   140
qed "linorder_not_le";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   141
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   142
Goal "!!x::'a::linorder. (x ~= y) = (x<y | y<x)";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   143
by (cut_inst_tac [("x","x"),("y","y")] linorder_less_linear 1);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   144
by Auto_tac;
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   145
qed "linorder_neq_iff";
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   146
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   147
(* eliminates ~= in premises *)
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   148
bind_thm("linorder_neqE", linorder_neq_iff RS iffD1 RS disjE);
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   149
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   150
(** min & max **)
2acc5d36610c More arith refinements.
nipkow
parents: 6115
diff changeset
   151
6433
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   152
Goalw [min_def] "min (x::'a::order) x = x";
6814
d96d4977f94e expandshort
paulson
parents: 6780
diff changeset
   153
by (Simp_tac 1);
6433
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   154
qed "min_same";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   155
Addsimps [min_same];
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   156
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   157
Goalw [max_def] "max (x::'a::order) x = x";
6814
d96d4977f94e expandshort
paulson
parents: 6780
diff changeset
   158
by (Simp_tac 1);
6433
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   159
qed "max_same";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   160
Addsimps [max_same];
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   161
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   162
Goalw [max_def] "!!z::'a::linorder. (z <= max x y) = (z <= x | z <= y)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4640
diff changeset
   163
by (Simp_tac 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   164
by (cut_facts_tac [linorder_linear] 1);
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   165
by (blast_tac (claset() addIs [order_trans]) 1);
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   166
qed "le_max_iff_disj";
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   167
8529
paulson
parents: 8214
diff changeset
   168
Goal "(x::'a::linorder) <= max x y";
paulson
parents: 8214
diff changeset
   169
by (simp_tac (simpset() addsimps [le_max_iff_disj]) 1);
paulson
parents: 8214
diff changeset
   170
qed "le_maxI1";
paulson
parents: 8214
diff changeset
   171
paulson
parents: 8214
diff changeset
   172
Goal "(y::'a::linorder) <= max x y";
paulson
parents: 8214
diff changeset
   173
by (simp_tac (simpset() addsimps [le_max_iff_disj]) 1);
paulson
parents: 8214
diff changeset
   174
qed "le_maxI2";
7617
e783adccf39e removed order-sorted theorems from the default claset
paulson
parents: 7494
diff changeset
   175
(*CANNOT use with AddSIs because blast_tac will give PROOF FAILED.*)
7494
45905028bb1d added theorems le_maxI1 and le_maxI2, also in claset
oheimb
parents: 6956
diff changeset
   176
6073
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   177
Goalw [max_def] "!!z::'a::linorder. (z < max x y) = (z < x | z < y)";
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   178
by (simp_tac (simpset() addsimps [order_le_less]) 1);
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   179
by (cut_facts_tac [linorder_less_linear] 1);
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   180
by (blast_tac (claset() addIs [order_less_trans]) 1);
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   181
qed "less_max_iff_disj";
fba734ba6894 Refined arith tactic.
nipkow
parents: 5673
diff changeset
   182
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   183
Goalw [max_def] "!!z::'a::linorder. (max x y <= z) = (x <= z & y <= z)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4640
diff changeset
   184
by (Simp_tac 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   185
by (cut_facts_tac [linorder_linear] 1);
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   186
by (blast_tac (claset() addIs [order_trans]) 1);
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   187
qed "max_le_iff_conj";
5673
5dc45f449198 Addsimps [max_le_iff_conj];
nipkow
parents: 5625
diff changeset
   188
Addsimps [max_le_iff_conj];
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   189
6433
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   190
Goalw [max_def] "!!z::'a::linorder. (max x y < z) = (x < z & y < z)";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   191
by (simp_tac (simpset() addsimps [order_le_less]) 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   192
by (cut_facts_tac [linorder_less_linear] 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   193
by (blast_tac (claset() addIs [order_less_trans]) 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   194
qed "max_less_iff_conj";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   195
Addsimps [max_less_iff_conj];
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   196
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   197
Goalw [min_def] "!!z::'a::linorder. (z <= min x y) = (z <= x & z <= y)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4640
diff changeset
   198
by (Simp_tac 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   199
by (cut_facts_tac [linorder_linear] 1);
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   200
by (blast_tac (claset() addIs [order_trans]) 1);
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   201
qed "le_min_iff_conj";
5673
5dc45f449198 Addsimps [max_le_iff_conj];
nipkow
parents: 5625
diff changeset
   202
Addsimps [le_min_iff_conj];
5dc45f449198 Addsimps [max_le_iff_conj];
nipkow
parents: 5625
diff changeset
   203
(* AddIffs screws up a blast_tac in MiniML *)
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   204
6433
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   205
Goalw [min_def] "!!z::'a::linorder. (z < min x y) = (z < x & z < y)";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   206
by (simp_tac (simpset() addsimps [order_le_less]) 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   207
by (cut_facts_tac [linorder_less_linear] 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   208
by (blast_tac (claset() addIs [order_less_trans]) 1);
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   209
qed "min_less_iff_conj";
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   210
Addsimps [min_less_iff_conj];
228237ec56e5 Added new thms.
nipkow
parents: 6301
diff changeset
   211
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4686
diff changeset
   212
Goalw [min_def] "!!z::'a::linorder. (min x y <= z) = (x <= z | y <= z)";
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4640
diff changeset
   213
by (Simp_tac 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5069
diff changeset
   214
by (cut_facts_tac [linorder_linear] 1);
4640
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   215
by (blast_tac (claset() addIs [order_trans]) 1);
ac6cf9f18653 Congruence rules use == in premises now.
nipkow
parents: 4600
diff changeset
   216
qed "min_le_iff_disj";
6157
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   217
9242
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   218
Goalw [min_def] "!!z::'a::linorder. (min x y < z) = (x < z | y < z)";
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   219
by (simp_tac (simpset() addsimps [order_le_less]) 1);
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   220
by (cut_facts_tac [linorder_less_linear] 1);
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   221
by (blast_tac (claset() addIs [order_less_trans]) 1);
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   222
qed "min_less_iff_disj";
c472ed4edded added a thm.
nipkow
parents: 8529
diff changeset
   223
6157
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   224
Goalw [min_def]
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   225
 "P(min (i::'a::linorder) j) = ((i <= j --> P(i)) & (~ i <= j --> P(j)))";
6301
08245f5a436d expandshort
paulson
parents: 6157
diff changeset
   226
by (Simp_tac 1);
6157
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   227
qed "split_min";
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   228
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   229
Goalw [max_def]
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   230
 "P(max (i::'a::linorder) j) = ((i <= j --> P(j)) & (~ i <= j --> P(i)))";
6301
08245f5a436d expandshort
paulson
parents: 6157
diff changeset
   231
by (Simp_tac 1);
6157
29942d3a1818 arith_tac for min/max
nipkow
parents: 6128
diff changeset
   232
qed "split_max";