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