src/HOL/Ord.ML
author paulson
Thu Aug 13 18:14:26 1998 +0200 (1998-08-13)
changeset 5316 7a8975451a89
parent 5143 b94cd208f073
child 5449 d853d1ac85a3
permissions -rw-r--r--
even more tidying of Goal commands
clasohm@1465
     1
(*  Title:      HOL/Ord.ML
clasohm@923
     2
    ID:         $Id$
clasohm@1465
     3
    Author:     Tobias Nipkow, Cambridge University Computer Laboratory
clasohm@923
     4
    Copyright   1993  University of Cambridge
clasohm@923
     5
clasohm@923
     6
The type class for ordered types
clasohm@923
     7
*)
clasohm@923
     8
nipkow@2608
     9
(** mono **)
clasohm@923
    10
paulson@5316
    11
val [prem] = Goalw [mono_def]
clasohm@923
    12
    "[| !!A B. A <= B ==> f(A) <= f(B) |] ==> mono(f)";
clasohm@923
    13
by (REPEAT (ares_tac [allI, impI, prem] 1));
clasohm@923
    14
qed "monoI";
clasohm@923
    15
paulson@5316
    16
Goalw [mono_def] "[| mono(f);  A <= B |] ==> f(A) <= f(B)";
paulson@5316
    17
by (Fast_tac 1);
clasohm@923
    18
qed "monoD";
clasohm@923
    19
nipkow@2608
    20
nipkow@2608
    21
section "Orders";
nipkow@2608
    22
nipkow@2608
    23
AddIffs [order_refl];
nipkow@2608
    24
paulson@4600
    25
(*This form is useful with the classical reasoner*)
wenzelm@5069
    26
Goal "!!x::'a::order. x = y ==> x <= y";
paulson@4600
    27
by (etac ssubst 1);
paulson@4600
    28
by (rtac order_refl 1);
paulson@4600
    29
qed "order_eq_refl";
paulson@4600
    30
wenzelm@5069
    31
Goal "~ x < (x::'a::order)";
wenzelm@4089
    32
by (simp_tac (simpset() addsimps [order_less_le]) 1);
nipkow@2608
    33
qed "order_less_irrefl";
nipkow@2608
    34
AddIffs [order_less_irrefl];
nipkow@2608
    35
wenzelm@5069
    36
Goal "(x::'a::order) <= y = (x < y | x = y)";
wenzelm@4089
    37
by (simp_tac (simpset() addsimps [order_less_le]) 1);
paulson@2935
    38
by (Blast_tac 1);
nipkow@2608
    39
qed "order_le_less";
nipkow@2608
    40
nipkow@2608
    41
(** min **)
nipkow@2608
    42
paulson@5143
    43
val prems = Goalw [min_def] "(!!x. least <= x) ==> min least x = least";
paulson@5143
    44
by (simp_tac (simpset() addsimps prems) 1);
nipkow@2608
    45
qed "min_leastL";
nipkow@2608
    46
paulson@5316
    47
val prems = Goalw [min_def]
nipkow@2608
    48
 "(!!x::'a::order. least <= x) ==> min x least = least";
paulson@2935
    49
by (cut_facts_tac prems 1);
paulson@2935
    50
by (Asm_simp_tac 1);
wenzelm@4089
    51
by (blast_tac (claset() addIs [order_antisym]) 1);
nipkow@2608
    52
qed "min_leastR";
nipkow@4640
    53
nipkow@4640
    54
nipkow@4640
    55
section "Linear/Total Orders";
nipkow@4640
    56
wenzelm@5069
    57
Goal "!!x::'a::linorder. x<y | x=y | y<x";
nipkow@4640
    58
by (simp_tac (simpset() addsimps [order_less_le]) 1);
wenzelm@5132
    59
by (cut_facts_tac [linorder_linear] 1);
nipkow@4640
    60
by (Blast_tac 1);
nipkow@4640
    61
qed "linorder_less_linear";
nipkow@4640
    62
wenzelm@5069
    63
Goalw [max_def] "!!z::'a::linorder. (z <= max x y) = (z <= x | z <= y)";
nipkow@4686
    64
by (Simp_tac 1);
wenzelm@5132
    65
by (cut_facts_tac [linorder_linear] 1);
nipkow@4640
    66
by (blast_tac (claset() addIs [order_trans]) 1);
nipkow@4640
    67
qed "le_max_iff_disj";
nipkow@4640
    68
wenzelm@5069
    69
Goalw [max_def] "!!z::'a::linorder. (max x y <= z) = (x <= z & y <= z)";
nipkow@4686
    70
by (Simp_tac 1);
wenzelm@5132
    71
by (cut_facts_tac [linorder_linear] 1);
nipkow@4640
    72
by (blast_tac (claset() addIs [order_trans]) 1);
nipkow@4640
    73
qed "max_le_iff_conj";
nipkow@4640
    74
wenzelm@5069
    75
Goalw [min_def] "!!z::'a::linorder. (z <= min x y) = (z <= x & z <= y)";
nipkow@4686
    76
by (Simp_tac 1);
wenzelm@5132
    77
by (cut_facts_tac [linorder_linear] 1);
nipkow@4640
    78
by (blast_tac (claset() addIs [order_trans]) 1);
nipkow@4640
    79
qed "le_min_iff_conj";
nipkow@4640
    80
wenzelm@5069
    81
Goalw [min_def] "!!z::'a::linorder. (min x y <= z) = (x <= z | y <= z)";
nipkow@4686
    82
by (Simp_tac 1);
wenzelm@5132
    83
by (cut_facts_tac [linorder_linear] 1);
nipkow@4640
    84
by (blast_tac (claset() addIs [order_trans]) 1);
nipkow@4640
    85
qed "min_le_iff_disj";
nipkow@4640
    86
nipkow@4640
    87