author  paulson 
Wed, 23 Apr 1997 10:52:49 +0200  
changeset 3015  65778b9d865f 
parent 2925  b0ae2e13db93 
child 3840  e0baea4d485a 
permissions  rwrr 
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 singlevalued*) 

2469  15 
goal thy "!!A B. A<=B ==> Replace(A,P) <= Replace(B,P)"; 
2925  16 
by (blast_tac (!claset addSEs [ReplaceE]) 1); 
760  17 
qed "Replace_mono"; 
0  18 

2469  19 
goal thy "!!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 

2469  23 
goal thy "!!A B. A<=B ==> Pow(A) <= Pow(B)"; 
2925  24 
by (Blast_tac 1); 
760  25 
qed "Pow_mono"; 
0  26 

2469  27 
goal thy "!!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))"; 

2925  34 
by (blast_tac (!claset addIs (prems RL [subsetD])) 1); 
760  35 
qed "UN_mono"; 
0  36 

37 
(*Intersection is ANTImonotonic. There are TWO premises! *) 

2469  38 
goal thy "!!A B. [ A<=B; a:A ] ==> Inter(B) <= Inter(A)"; 
2925  39 
by (Blast_tac 1); 
760  40 
qed "Inter_anti_mono"; 
0  41 

2469  42 
goal thy "!!C D. C<=D ==> cons(a,C) <= cons(a,D)"; 
2925  43 
by (Blast_tac 1); 
760  44 
qed "cons_mono"; 
0  45 

2469  46 
goal thy "!!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 

2469  50 
goal thy "!!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 

2469  54 
goal thy "!!A B C D. [ A<=C; D<=B ] ==> AB <= CD"; 
2925  55 
by (Blast_tac 1); 
760  56 
qed "Diff_mono"; 
0  57 

58 
(** Standard products, sums and function spaces **) 

59 

2469  60 
goal thy "!!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 

2469  66 
goalw thy 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!*) 

2469  71 
goal thy "!!A B C. B<=C ==> A>B <= A>C"; 
2925  72 
by (blast_tac (!claset addIs [lam_type] addEs [Pi_lamE]) 1); 
760  73 
qed "Pi_mono"; 
0  74 

2469  75 
goalw thy [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 
(** Quineinspired ordered pairs, products, injections and sums **) 

80 

81 
goalw QPair.thy [QPair_def] "!!a b c d. [ a<=c; b<=d ] ==> <a;b> <= <c;d>"; 

82 
by (REPEAT (ares_tac [sum_mono] 1)); 

760  83 
qed "QPair_mono"; 
0  84 

85 
goal QPair.thy "!!A B C D. [ A<=C; ALL x:A. B(x) <= D(x) ] ==> \ 

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 

91 
goalw QPair.thy [QInl_def] "!!a b. a<=b ==> QInl(a) <= QInl(b)"; 

92 
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1)); 

760  93 
qed "QInl_mono"; 
0  94 

95 
goalw QPair.thy [QInr_def] "!!a b. a<=b ==> QInr(a) <= QInr(b)"; 

96 
by (REPEAT (ares_tac [subset_refl RS QPair_mono] 1)); 

760  97 
qed "QInr_mono"; 
0  98 

99 
goal QPair.thy "!!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 

2469  106 
goal thy "!!r s. r<=s ==> converse(r) <= converse(s)"; 
2925  107 
by (Blast_tac 1); 
760  108 
qed "converse_mono"; 
0  109 

2469  110 
goal thy "!!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 

2469  116 
goal thy "!!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 

2469  122 
goal thy "!!r s. r<=s ==> field(r)<=field(s)"; 
2925  123 
by (Blast_tac 1); 
760  124 
qed "field_mono"; 
0  125 

2469  126 
goal thy "!!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"; 
2925  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"; 
2925  141 
by (blast_tac (!claset addIs [prem1, prem2 RS subsetD]) 1); 
760  142 
qed "vimage_pair_mono"; 
0  143 

2469  144 
goal thy "!!r s. [ r<=s; A<=B ] ==> r``A <= s``B"; 
2925  145 
by (Blast_tac 1); 
760  146 
qed "image_mono"; 
0  147 

2469  148 
goal thy "!!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)"; 
2925  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 

2469  159 
goal thy "!!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 ] ==> (P1P2) > (Q1Q2)"; 

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 

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 

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 