src/HOL/UNITY/LessThan.ML
author wenzelm
Mon, 22 Jun 1998 17:26:46 +0200
changeset 5069 3ea049f7979d
parent 4776 1f9362e769c1
child 5232 e5a7cdd07ea5
permissions -rw-r--r--
isatool fixgoal;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     1
(*  Title:      HOL/LessThan/LessThan
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     2
    ID:         $Id$
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     4
    Copyright   1998  University of Cambridge
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     5
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     6
lessThan, greaterThan, atLeast, atMost
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     7
*)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     8
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
     9
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    10
open LessThan;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    11
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    12
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    13
(*** lessThan ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    14
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    15
Goalw [lessThan_def] "(i: lessThan k) = (i<k)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    16
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    17
qed "lessThan_iff";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    18
AddIffs [lessThan_iff];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    19
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    20
Goalw [lessThan_def] "lessThan 0 = {}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    21
by (Simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    22
qed "lessThan_0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    23
Addsimps [lessThan_0];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    24
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    25
Goalw [lessThan_def] "lessThan (Suc k) = insert k (lessThan k)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    26
by (simp_tac (simpset() addsimps [less_Suc_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    27
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    28
qed "lessThan_Suc";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    29
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    30
Goal "(UN m. lessThan m) = UNIV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    31
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    32
qed "UN_lessThan_UNIV";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    33
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    34
Goalw [lessThan_def, atLeast_def, le_def]
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    35
    "Compl(lessThan k) = atLeast k";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    36
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    37
qed "Compl_lessThan";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    38
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    39
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    40
(*** greaterThan ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    41
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    42
Goalw [greaterThan_def] "(i: greaterThan k) = (k<i)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    43
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    44
qed "greaterThan_iff";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    45
AddIffs [greaterThan_iff];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    46
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    47
Goalw [greaterThan_def] "greaterThan 0 = range Suc";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    48
by (blast_tac (claset() addIs [Suc_pred RS sym]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    49
qed "greaterThan_0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    50
Addsimps [greaterThan_0];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    51
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    52
Goalw [greaterThan_def] "greaterThan (Suc k) = greaterThan k - {Suc k}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    53
by Safe_tac;
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    54
by (blast_tac (claset() addIs [less_trans]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    55
by (asm_simp_tac (simpset() addsimps [le_Suc_eq, not_le_iff_less RS sym]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    56
by (asm_simp_tac (simpset() addsimps [not_le_iff_less]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    57
qed "greaterThan_Suc";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    58
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    59
Goal "(INT m. greaterThan m) = {}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    60
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    61
qed "INT_greaterThan_UNIV";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    62
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    63
Goalw [greaterThan_def, atMost_def, le_def]
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    64
    "Compl(greaterThan k) = atMost k";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    65
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    66
qed "Compl_greaterThan";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    67
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    68
Goalw [greaterThan_def, atMost_def, le_def]
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    69
    "Compl(atMost k) = greaterThan k";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    70
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    71
qed "Compl_atMost";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    72
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    73
Goal "less_than ^^ {k} = greaterThan k";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    74
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    75
qed "Image_less_than";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    76
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    77
Addsimps [Compl_greaterThan, Compl_atMost, Image_less_than];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    78
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    79
(*** atLeast ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    80
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    81
Goalw [atLeast_def] "(i: atLeast k) = (k<=i)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    82
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    83
qed "atLeast_iff";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    84
AddIffs [atLeast_iff];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    85
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    86
Goalw [atLeast_def, UNIV_def] "atLeast 0 = UNIV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    87
by (Simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    88
qed "atLeast_0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    89
Addsimps [atLeast_0];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    90
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    91
Goalw [atLeast_def] "atLeast (Suc k) = atLeast k - {k}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    92
by (simp_tac (simpset() addsimps [Suc_le_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    93
by (simp_tac (simpset() addsimps [le_eq_less_or_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    94
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    95
qed "atLeast_Suc";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    96
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
    97
Goal "(UN m. atLeast m) = UNIV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    98
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
    99
qed "UN_atLeast_UNIV";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   100
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   101
Goalw [lessThan_def, atLeast_def, le_def]
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   102
    "Compl(atLeast k) = lessThan k";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   103
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   104
qed "Compl_atLeast";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   105
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   106
Goal "less_than^-1 ^^ {k} = lessThan k";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   107
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   108
qed "Image_inverse_less_than";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   109
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   110
Addsimps [Compl_lessThan, Compl_atLeast, Image_inverse_less_than];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   111
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   112
(*** atMost ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   113
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   114
Goalw [atMost_def] "(i: atMost k) = (i<=k)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   115
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   116
qed "atMost_iff";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   117
AddIffs [atMost_iff];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   118
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   119
Goalw [atMost_def] "atMost 0 = {0}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   120
by (Simp_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   121
qed "atMost_0";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   122
Addsimps [atMost_0];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   123
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   124
Goalw [atMost_def] "atMost (Suc k) = insert (Suc k) (atMost k)";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   125
by (simp_tac (simpset() addsimps [less_Suc_eq, le_eq_less_or_eq]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   126
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   127
qed "atMost_Suc";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   128
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   129
Goal "(UN m. atMost m) = UNIV";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   130
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   131
qed "UN_atMost_UNIV";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   132
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   133
Goalw [atMost_def, le_def]
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   134
    "Compl(atMost k) = greaterThan k";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   135
by (Blast_tac 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   136
qed "Compl_atMost";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   137
Addsimps [Compl_atMost];
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   138
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   139
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   140
(*** Combined properties ***)
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   141
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4776
diff changeset
   142
Goal "atMost n Int atLeast n = {n}";
4776
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   143
by (blast_tac (claset() addIs [le_anti_sym]) 1);
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   144
qed "atMost_Int_atLeast";
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   145
1f9362e769c1 New UNITY theory
paulson
parents:
diff changeset
   146