2113
|
1 |
(* Title: Substitutions/setplus.ML
|
|
2 |
Author: Martin Coen, Cambridge University Computer Laboratory
|
|
3 |
Copyright 1993 University of Cambridge
|
|
4 |
|
|
5 |
For setplus.thy.
|
|
6 |
Properties of subsets and empty sets.
|
|
7 |
*)
|
|
8 |
|
|
9 |
open Setplus;
|
|
10 |
val eq_cs = claset_of "equalities";
|
|
11 |
|
|
12 |
(*********)
|
|
13 |
|
|
14 |
(*** Rules for subsets ***)
|
|
15 |
|
|
16 |
goal Set.thy "A <= B = (! t.t:A --> t:B)";
|
|
17 |
by (fast_tac set_cs 1);
|
|
18 |
qed "subset_iff";
|
|
19 |
|
|
20 |
goalw Setplus.thy [ssubset_def] "A < B = ((A <= B) & ~(A=B))";
|
|
21 |
by (rtac refl 1);
|
|
22 |
qed "ssubset_iff";
|
|
23 |
|
|
24 |
goal Setplus.thy "((A::'a set) <= B) = ((A < B) | (A=B))";
|
|
25 |
by (simp_tac (simpset_of "Fun" addsimps [ssubset_iff]) 1);
|
|
26 |
by (fast_tac set_cs 1);
|
|
27 |
qed "subseteq_iff_subset_eq";
|
|
28 |
|
|
29 |
(*Rule in Modus Ponens style*)
|
|
30 |
goal Setplus.thy "A < B --> c:A --> c:B";
|
|
31 |
by (simp_tac (simpset_of "Fun" addsimps [ssubset_iff]) 1);
|
|
32 |
by (fast_tac set_cs 1);
|
|
33 |
qed "ssubsetD";
|
|
34 |
|
|
35 |
(*********)
|
|
36 |
|
|
37 |
goalw Setplus.thy [empty_def] "~ a : {}";
|
|
38 |
by (fast_tac set_cs 1);
|
|
39 |
qed "not_in_empty";
|
|
40 |
|
|
41 |
goalw Setplus.thy [empty_def] "(A = {}) = (ALL a.~ a:A)";
|
|
42 |
by (fast_tac (set_cs addIs [set_ext]) 1);
|
|
43 |
qed "empty_iff";
|
|
44 |
|
|
45 |
|
|
46 |
(*********)
|
|
47 |
|
|
48 |
goal Set.thy "(~A=B) = ((? x.x:A & ~x:B) | (? x.~x:A & x:B))";
|
|
49 |
by (fast_tac (set_cs addIs [set_ext]) 1);
|
|
50 |
qed "not_equal_iff";
|
|
51 |
|
|
52 |
(*********)
|
|
53 |
|
|
54 |
val setplus_rews = [ssubset_iff,not_in_empty,empty_iff];
|
|
55 |
|
|
56 |
(*********)
|
|
57 |
|
|
58 |
(*Case analysis for rewriting; P also gets rewritten*)
|
|
59 |
val [prem1,prem2] = goal HOL.thy "[| P-->Q; ~P-->Q |] ==> Q";
|
|
60 |
by (rtac (excluded_middle RS disjE) 1);
|
|
61 |
by (etac (prem2 RS mp) 1);
|
|
62 |
by (etac (prem1 RS mp) 1);
|
|
63 |
qed "imp_excluded_middle";
|
|
64 |
|
|
65 |
fun imp_excluded_middle_tac s = res_inst_tac [("P",s)] imp_excluded_middle;
|
|
66 |
|
|
67 |
|
|
68 |
goal Set.thy "(insert a A ~= insert a B) --> A ~= B";
|
|
69 |
by (fast_tac set_cs 1);
|
|
70 |
val insert_lim = result() RS mp;
|
|
71 |
|
|
72 |
goal Set.thy "x~:A --> (A-{x} = A)";
|
|
73 |
by (fast_tac eq_cs 1);
|
|
74 |
val lem = result() RS mp;
|
|
75 |
|
|
76 |
goal Nat.thy "B<=A --> B = Suc A --> P";
|
|
77 |
by (strip_tac 1);
|
|
78 |
by (hyp_subst_tac 1);
|
|
79 |
by (Asm_full_simp_tac 1);
|
|
80 |
val leq_lem = standard(result() RS mp RS mp);
|
|
81 |
|
|
82 |
goal Nat.thy "A<=B --> (A ~= Suc B)";
|
|
83 |
by (strip_tac 1);
|
|
84 |
by (rtac notI 1);
|
|
85 |
by (rtac leq_lem 1);
|
|
86 |
by (REPEAT (atac 1));
|
|
87 |
val leq_lem1 = standard(result() RS mp);
|
|
88 |
|
|
89 |
(* The following is an adaptation of the proof for the "<=" version
|
|
90 |
* in Finite. *)
|
|
91 |
|
|
92 |
goalw Setplus.thy [ssubset_def]
|
|
93 |
"!!B. finite B ==> !A. A < B --> card(A) < card(B)";
|
|
94 |
by (etac finite_induct 1);
|
|
95 |
by (Simp_tac 1);
|
|
96 |
by (fast_tac set_cs 1);
|
|
97 |
by (strip_tac 1);
|
|
98 |
by (etac conjE 1);
|
|
99 |
by (case_tac "x:A" 1);
|
|
100 |
(*1*)
|
|
101 |
by (dtac mk_disjoint_insert 1);
|
|
102 |
by (etac exE 1);
|
|
103 |
by (etac conjE 1);
|
|
104 |
by (hyp_subst_tac 1);
|
|
105 |
by (rotate_tac ~1 1);
|
|
106 |
by (asm_full_simp_tac (!simpset addsimps
|
|
107 |
[subset_insert_iff,finite_subset,lem]) 1);
|
|
108 |
by (dtac insert_lim 1);
|
|
109 |
by (Asm_full_simp_tac 1);
|
|
110 |
(*2*)
|
|
111 |
by (rotate_tac ~1 1);
|
|
112 |
by (asm_full_simp_tac (!simpset addsimps
|
|
113 |
[subset_insert_iff,finite_subset,lem]) 1);
|
|
114 |
by (case_tac "A=F" 1);
|
|
115 |
by (Asm_simp_tac 1);
|
|
116 |
by (Asm_simp_tac 1);
|
|
117 |
by (rtac leq_lem1 1);
|
|
118 |
by (Asm_simp_tac 1);
|
|
119 |
val ssubset_card = result() ;
|
|
120 |
|
|
121 |
|
|
122 |
goal Set.thy "(A = B) = ((A <= (B::'a set)) & (B<=A))";
|
|
123 |
by (rtac iffI 1);
|
|
124 |
by (simp_tac (HOL_ss addsimps [subset_iff]) 1);
|
|
125 |
by (fast_tac set_cs 1);
|
|
126 |
by (rtac subset_antisym 1);
|
|
127 |
by (ALLGOALS Asm_simp_tac);
|
|
128 |
val set_eq_subset = result();
|
|
129 |
|
|
130 |
|