| 1465 |      1 | (*  Title:      HOL/mono.ML
 | 
| 923 |      2 |     ID:         $Id$
 | 
| 1465 |      3 |     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
 | 
| 923 |      4 |     Copyright   1991  University of Cambridge
 | 
|  |      5 | 
 | 
|  |      6 | Monotonicity of various operations
 | 
|  |      7 | *)
 | 
|  |      8 | 
 | 
|  |      9 | goal Set.thy "!!A B. A<=B ==> f``A <= f``B";
 | 
|  |     10 | by (fast_tac set_cs 1);
 | 
|  |     11 | qed "image_mono";
 | 
|  |     12 | 
 | 
|  |     13 | goal Set.thy "!!A B. A<=B ==> Pow(A) <= Pow(B)";
 | 
|  |     14 | by (fast_tac set_cs 1);
 | 
|  |     15 | qed "Pow_mono";
 | 
|  |     16 | 
 | 
|  |     17 | goal Set.thy "!!A B. A<=B ==> Union(A) <= Union(B)";
 | 
|  |     18 | by (fast_tac set_cs 1);
 | 
|  |     19 | qed "Union_mono";
 | 
|  |     20 | 
 | 
|  |     21 | goal Set.thy "!!A B. B<=A ==> Inter(A) <= Inter(B)";
 | 
|  |     22 | by (fast_tac set_cs 1);
 | 
|  |     23 | qed "Inter_anti_mono";
 | 
|  |     24 | 
 | 
|  |     25 | val prems = goal Set.thy
 | 
|  |     26 |     "[| A<=B;  !!x. x:A ==> f(x)<=g(x) |] ==> \
 | 
|  |     27 | \    (UN x:A. f(x)) <= (UN x:B. g(x))";
 | 
|  |     28 | by (fast_tac (set_cs addIs (prems RL [subsetD])) 1);
 | 
|  |     29 | qed "UN_mono";
 | 
|  |     30 | 
 | 
|  |     31 | val [prem] = goal Set.thy
 | 
|  |     32 |     "[| !!x. f(x)<=g(x) |] ==> (UN x. f(x)) <= (UN x. g(x))";
 | 
|  |     33 | by (fast_tac (set_cs addIs [prem RS subsetD]) 1);
 | 
|  |     34 | qed "UN1_mono";
 | 
|  |     35 | 
 | 
|  |     36 | val prems = goal Set.thy
 | 
|  |     37 |     "[| B<=A;  !!x. x:A ==> f(x)<=g(x) |] ==> \
 | 
|  |     38 | \    (INT x:A. f(x)) <= (INT x:A. g(x))";
 | 
|  |     39 | by (fast_tac (set_cs addIs (prems RL [subsetD])) 1);
 | 
|  |     40 | qed "INT_anti_mono";
 | 
|  |     41 | 
 | 
|  |     42 | (*The inclusion is POSITIVE! *)
 | 
|  |     43 | val [prem] = goal Set.thy
 | 
|  |     44 |     "[| !!x. f(x)<=g(x) |] ==> (INT x. f(x)) <= (INT x. g(x))";
 | 
|  |     45 | by (fast_tac (set_cs addIs [prem RS subsetD]) 1);
 | 
|  |     46 | qed "INT1_mono";
 | 
|  |     47 | 
 | 
|  |     48 | goal Set.thy "!!A B. [| A<=C;  B<=D |] ==> A Un B <= C Un D";
 | 
|  |     49 | by (fast_tac set_cs 1);
 | 
|  |     50 | qed "Un_mono";
 | 
|  |     51 | 
 | 
|  |     52 | goal Set.thy "!!A B. [| A<=C;  B<=D |] ==> A Int B <= C Int D";
 | 
|  |     53 | by (fast_tac set_cs 1);
 | 
|  |     54 | qed "Int_mono";
 | 
|  |     55 | 
 | 
|  |     56 | goal Set.thy "!!A::'a set. [| A<=C;  D<=B |] ==> A-B <= C-D";
 | 
|  |     57 | by (fast_tac set_cs 1);
 | 
|  |     58 | qed "Diff_mono";
 | 
|  |     59 | 
 | 
|  |     60 | goal Set.thy "!!A B. A<=B ==> Compl(B) <= Compl(A)";
 | 
|  |     61 | by (fast_tac set_cs 1);
 | 
|  |     62 | qed "Compl_anti_mono";
 | 
|  |     63 | 
 | 
|  |     64 | (** Monotonicity of implications.  For inductive definitions **)
 | 
|  |     65 | 
 | 
|  |     66 | goal Set.thy "!!A B x. A<=B ==> x:A --> x:B";
 | 
|  |     67 | by (rtac impI 1);
 | 
|  |     68 | by (etac subsetD 1);
 | 
|  |     69 | by (assume_tac 1);
 | 
|  |     70 | qed "in_mono";
 | 
|  |     71 | 
 | 
|  |     72 | goal HOL.thy "!!P1 P2 Q1 Q2. [| P1-->Q1; P2-->Q2 |] ==> (P1&P2) --> (Q1&Q2)";
 | 
|  |     73 | by (fast_tac HOL_cs 1);
 | 
|  |     74 | qed "conj_mono";
 | 
|  |     75 | 
 | 
|  |     76 | goal HOL.thy "!!P1 P2 Q1 Q2. [| P1-->Q1; P2-->Q2 |] ==> (P1|P2) --> (Q1|Q2)";
 | 
|  |     77 | by (fast_tac HOL_cs 1);
 | 
|  |     78 | qed "disj_mono";
 | 
|  |     79 | 
 | 
|  |     80 | goal HOL.thy "!!P1 P2 Q1 Q2.[| Q1-->P1; P2-->Q2 |] ==> (P1-->P2)-->(Q1-->Q2)";
 | 
|  |     81 | by (fast_tac HOL_cs 1);
 | 
|  |     82 | qed "imp_mono";
 | 
|  |     83 | 
 | 
|  |     84 | goal HOL.thy "P-->P";
 | 
|  |     85 | by (rtac impI 1);
 | 
|  |     86 | by (assume_tac 1);
 | 
|  |     87 | qed "imp_refl";
 | 
|  |     88 | 
 | 
|  |     89 | val [PQimp] = goal HOL.thy
 | 
|  |     90 |     "[| !!x. P(x) --> Q(x) |] ==> (EX x.P(x)) --> (EX x.Q(x))";
 | 
|  |     91 | by (fast_tac (HOL_cs addIs [PQimp RS mp]) 1);
 | 
|  |     92 | qed "ex_mono";
 | 
|  |     93 | 
 | 
|  |     94 | val [PQimp] = goal HOL.thy
 | 
|  |     95 |     "[| !!x. P(x) --> Q(x) |] ==> (ALL x.P(x)) --> (ALL x.Q(x))";
 | 
|  |     96 | by (fast_tac (HOL_cs addIs [PQimp RS mp]) 1);
 | 
|  |     97 | qed "all_mono";
 | 
|  |     98 | 
 | 
|  |     99 | val [PQimp] = goal Set.thy
 | 
|  |    100 |     "[| !!x. P(x) --> Q(x) |] ==> Collect(P) <= Collect(Q)";
 | 
|  |    101 | by (fast_tac (set_cs addIs [PQimp RS mp]) 1);
 | 
|  |    102 | qed "Collect_mono";
 | 
|  |    103 | 
 | 
|  |    104 | (*Used in indrule.ML*)
 | 
|  |    105 | val [subs,PQimp] = goal Set.thy
 | 
|  |    106 |     "[| A<=B;  !!x. x:A ==> P(x) --> Q(x) \
 | 
|  |    107 | \    |] ==> A Int Collect(P) <= B Int Collect(Q)";
 | 
|  |    108 | by (fast_tac (set_cs addIs [subs RS subsetD, PQimp RS mp]) 1);
 | 
|  |    109 | qed "Int_Collect_mono";
 | 
|  |    110 | 
 | 
|  |    111 | (*Used in intr_elim.ML and in individual datatype definitions*)
 | 
|  |    112 | val basic_monos = [subset_refl, imp_refl, disj_mono, conj_mono, 
 | 
| 1515 |    113 |                    ex_mono, Collect_mono, in_mono];
 | 
| 923 |    114 | 
 |