src/ZF/mono.ML
author paulson
Mon Dec 28 16:59:28 1998 +0100 (1998-12-28)
changeset 6053 8a1059aa01f0
parent 5325 f7a5e06adea1
child 9907 473a6604da94
permissions -rw-r--r--
new inductive, datatype and primrec packages, etc.
clasohm@1461
     1
(*  Title:      ZF/mono
clasohm@0
     2
    ID:         $Id$
clasohm@1461
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
clasohm@0
     4
    Copyright   1993  University of Cambridge
clasohm@0
     5
clasohm@0
     6
Monotonicity of various operations (for lattice properties see subset.ML)
clasohm@0
     7
*)
clasohm@0
     8
clasohm@0
     9
(** Replacement, in its various formulations **)
clasohm@0
    10
clasohm@0
    11
(*Not easy to express monotonicity in P, since any "bigger" predicate
clasohm@0
    12
  would have to be single-valued*)
paulson@5137
    13
Goal "A<=B ==> Replace(A,P) <= Replace(B,P)";
wenzelm@4091
    14
by (blast_tac (claset() addSEs [ReplaceE]) 1);
clasohm@760
    15
qed "Replace_mono";
clasohm@0
    16
paulson@5137
    17
Goal "A<=B ==> {f(x). x:A} <= {f(x). x:B}";
paulson@2925
    18
by (Blast_tac 1);
clasohm@760
    19
qed "RepFun_mono";
clasohm@0
    20
paulson@5137
    21
Goal "A<=B ==> Pow(A) <= Pow(B)";
paulson@2925
    22
by (Blast_tac 1);
clasohm@760
    23
qed "Pow_mono";
clasohm@0
    24
paulson@5137
    25
Goal "A<=B ==> Union(A) <= Union(B)";
paulson@2925
    26
by (Blast_tac 1);
clasohm@760
    27
qed "Union_mono";
clasohm@0
    28
paulson@5325
    29
val prems = Goal
clasohm@0
    30
    "[| A<=C;  !!x. x:A ==> B(x)<=D(x) \
clasohm@0
    31
\    |] ==> (UN x:A. B(x)) <= (UN x:C. D(x))";
wenzelm@4091
    32
by (blast_tac (claset() addIs (prems RL [subsetD])) 1);
clasohm@760
    33
qed "UN_mono";
clasohm@0
    34
clasohm@0
    35
(*Intersection is ANTI-monotonic.  There are TWO premises! *)
paulson@5137
    36
Goal "[| A<=B;  a:A |] ==> Inter(B) <= Inter(A)";
paulson@2925
    37
by (Blast_tac 1);
clasohm@760
    38
qed "Inter_anti_mono";
clasohm@0
    39
paulson@5137
    40
Goal "C<=D ==> cons(a,C) <= cons(a,D)";
paulson@2925
    41
by (Blast_tac 1);
clasohm@760
    42
qed "cons_mono";
clasohm@0
    43
paulson@5137
    44
Goal "[| A<=C;  B<=D |] ==> A Un B <= C Un D";
paulson@2925
    45
by (Blast_tac 1);
clasohm@760
    46
qed "Un_mono";
clasohm@0
    47
paulson@5137
    48
Goal "[| A<=C;  B<=D |] ==> A Int B <= C Int D";
paulson@2925
    49
by (Blast_tac 1);
clasohm@760
    50
qed "Int_mono";
clasohm@0
    51
paulson@5137
    52
Goal "[| A<=C;  D<=B |] ==> A-B <= C-D";
paulson@2925
    53
by (Blast_tac 1);
clasohm@760
    54
qed "Diff_mono";
clasohm@0
    55
clasohm@0
    56
(** Standard products, sums and function spaces **)
clasohm@0
    57
paulson@5325
    58
Goal "[| A<=C;  ALL x:A. B(x) <= D(x) |] ==> Sigma(A,B) <= Sigma(C,D)";
paulson@2925
    59
by (Blast_tac 1);
clasohm@760
    60
qed "Sigma_mono_lemma";
clasohm@0
    61
val Sigma_mono = ballI RSN (2,Sigma_mono_lemma);
clasohm@0
    62
paulson@5137
    63
Goalw sum_defs "[| A<=C;  B<=D |] ==> A+B <= C+D";
clasohm@0
    64
by (REPEAT (ares_tac [subset_refl,Un_mono,Sigma_mono] 1));
clasohm@760
    65
qed "sum_mono";
clasohm@0
    66
clasohm@0
    67
(*Note that B->A and C->A are typically disjoint!*)
paulson@5137
    68
Goal "B<=C ==> A->B <= A->C";
wenzelm@4091
    69
by (blast_tac (claset() addIs [lam_type] addEs [Pi_lamE]) 1);
clasohm@760
    70
qed "Pi_mono";
clasohm@0
    71
paulson@5137
    72
Goalw [lam_def] "A<=B ==> Lambda(A,c) <= Lambda(B,c)";
clasohm@0
    73
by (etac RepFun_mono 1);
clasohm@760
    74
qed "lam_mono";
clasohm@0
    75
clasohm@0
    76
(** Quine-inspired ordered pairs, products, injections and sums **)
clasohm@0
    77
paulson@5137
    78
Goalw [QPair_def] "[| a<=c;  b<=d |] ==> <a;b> <= <c;d>";
clasohm@0
    79
by (REPEAT (ares_tac [sum_mono] 1));
clasohm@760
    80
qed "QPair_mono";
clasohm@0
    81
paulson@5137
    82
Goal "[| A<=C;  ALL x:A. B(x) <= D(x) |] ==>  \
clasohm@0
    83
\                          QSigma(A,B) <= QSigma(C,D)";
paulson@2925
    84
by (Blast_tac 1);
clasohm@760
    85
qed "QSigma_mono_lemma";
clasohm@0
    86
val QSigma_mono = ballI RSN (2,QSigma_mono_lemma);
clasohm@0
    87
paulson@5137
    88
Goalw [QInl_def] "a<=b ==> QInl(a) <= QInl(b)";
clasohm@0
    89
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
clasohm@760
    90
qed "QInl_mono";
clasohm@0
    91
paulson@5137
    92
Goalw [QInr_def] "a<=b ==> QInr(a) <= QInr(b)";
clasohm@0
    93
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1));
clasohm@760
    94
qed "QInr_mono";
clasohm@0
    95
paulson@5137
    96
Goal "[| A<=C;  B<=D |] ==> A <+> B <= C <+> D";
paulson@2925
    97
by (Blast_tac 1);
clasohm@760
    98
qed "qsum_mono";
clasohm@0
    99
clasohm@0
   100
clasohm@0
   101
(** Converse, domain, range, field **)
clasohm@0
   102
paulson@5137
   103
Goal "r<=s ==> converse(r) <= converse(s)";
paulson@2925
   104
by (Blast_tac 1);
clasohm@760
   105
qed "converse_mono";
clasohm@0
   106
paulson@5137
   107
Goal "r<=s ==> domain(r)<=domain(s)";
paulson@2925
   108
by (Blast_tac 1);
clasohm@760
   109
qed "domain_mono";
clasohm@0
   110
lcp@811
   111
bind_thm ("domain_rel_subset", [domain_mono, domain_subset] MRS subset_trans);
clasohm@0
   112
paulson@5137
   113
Goal "r<=s ==> range(r)<=range(s)";
paulson@2925
   114
by (Blast_tac 1);
clasohm@760
   115
qed "range_mono";
clasohm@0
   116
lcp@811
   117
bind_thm ("range_rel_subset", [range_mono, range_subset] MRS subset_trans);
clasohm@0
   118
paulson@5137
   119
Goal "r<=s ==> field(r)<=field(s)";
paulson@2925
   120
by (Blast_tac 1);
clasohm@760
   121
qed "field_mono";
clasohm@0
   122
paulson@5137
   123
Goal "r <= A*A ==> field(r) <= A";
clasohm@0
   124
by (etac (field_mono RS subset_trans) 1);
paulson@2925
   125
by (Blast_tac 1);
clasohm@760
   126
qed "field_rel_subset";
clasohm@0
   127
clasohm@0
   128
clasohm@0
   129
(** Images **)
clasohm@0
   130
paulson@5325
   131
val [prem1,prem2] = Goal
clasohm@0
   132
    "[| !! x y. <x,y>:r ==> <x,y>:s;  A<=B |] ==> r``A <= s``B";
wenzelm@4091
   133
by (blast_tac (claset() addIs [prem1, prem2 RS subsetD]) 1);
clasohm@760
   134
qed "image_pair_mono";
clasohm@0
   135
paulson@5325
   136
val [prem1,prem2] = Goal
clasohm@0
   137
    "[| !! x y. <x,y>:r ==> <x,y>:s;  A<=B |] ==> r-``A <= s-``B";
wenzelm@4091
   138
by (blast_tac (claset() addIs [prem1, prem2 RS subsetD]) 1);
clasohm@760
   139
qed "vimage_pair_mono";
clasohm@0
   140
paulson@5137
   141
Goal "[| r<=s;  A<=B |] ==> r``A <= s``B";
paulson@2925
   142
by (Blast_tac 1);
clasohm@760
   143
qed "image_mono";
clasohm@0
   144
paulson@5137
   145
Goal "[| r<=s;  A<=B |] ==> r-``A <= s-``B";
paulson@2925
   146
by (Blast_tac 1);
clasohm@760
   147
qed "vimage_mono";
clasohm@0
   148
paulson@5325
   149
val [sub,PQimp] = Goal
clasohm@0
   150
    "[| A<=B;  !!x. x:A ==> P(x) --> Q(x) |] ==> Collect(A,P) <= Collect(B,Q)";
wenzelm@4091
   151
by (blast_tac (claset() addIs [sub RS subsetD, PQimp RS mp]) 1);
clasohm@760
   152
qed "Collect_mono";
clasohm@0
   153
clasohm@0
   154
(** Monotonicity of implications -- some could go to FOL **)
clasohm@0
   155
paulson@5137
   156
Goal "A<=B ==> x:A --> x:B";
paulson@2925
   157
by (Blast_tac 1);
clasohm@760
   158
qed "in_mono";
clasohm@0
   159
clasohm@0
   160
goal IFOL.thy "!!P1 P2 Q1 Q2. [| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)";
paulson@2602
   161
by (IntPr.fast_tac 1);
clasohm@760
   162
qed "conj_mono";
clasohm@0
   163
clasohm@0
   164
goal IFOL.thy "!!P1 P2 Q1 Q2. [| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)";
paulson@2602
   165
by (IntPr.fast_tac 1);
clasohm@760
   166
qed "disj_mono";
clasohm@0
   167
clasohm@0
   168
goal IFOL.thy "!!P1 P2 Q1 Q2.[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)";
paulson@2602
   169
by (IntPr.fast_tac 1);
clasohm@760
   170
qed "imp_mono";
clasohm@0
   171
clasohm@0
   172
goal IFOL.thy "P-->P";
clasohm@0
   173
by (rtac impI 1);
clasohm@0
   174
by (assume_tac 1);
clasohm@760
   175
qed "imp_refl";
clasohm@0
   176
clasohm@0
   177
val [PQimp] = goal IFOL.thy
wenzelm@3840
   178
    "[| !!x. P(x) --> Q(x) |] ==> (EX x. P(x)) --> (EX x. Q(x))";
paulson@2803
   179
by IntPr.safe_tac;
paulson@3015
   180
by (etac (PQimp RS mp RS exI) 1);
clasohm@760
   181
qed "ex_mono";
clasohm@0
   182
clasohm@0
   183
val [PQimp] = goal IFOL.thy
wenzelm@3840
   184
    "[| !!x. P(x) --> Q(x) |] ==> (ALL x. P(x)) --> (ALL x. Q(x))";
paulson@2803
   185
by IntPr.safe_tac;
paulson@3015
   186
by (etac (spec RS (PQimp RS mp)) 1);
clasohm@760
   187
qed "all_mono";
lcp@516
   188
lcp@516
   189
(*Used in intr_elim.ML and in individual datatype definitions*)
lcp@516
   190
val basic_monos = [subset_refl, imp_refl, disj_mono, conj_mono, 
clasohm@1461
   191
                   ex_mono, Collect_mono, Part_mono, in_mono];
lcp@516
   192