src/CCL/Set.ML
 author oheimb Fri Jun 02 20:38:28 2000 +0200 (2000-06-02) changeset 9028 8a1ec8f05f14 parent 5143 b94cd208f073 child 17456 bcf7544875b2 permissions -rw-r--r--
 clasohm@1459 ` 1` ```(* Title: set/set ``` clasohm@0 ` 2` ``` ID: \$Id\$ ``` clasohm@0 ` 3` clasohm@0 ` 4` ```For set.thy. ``` clasohm@0 ` 5` clasohm@0 ` 6` ```Modified version of ``` clasohm@1459 ` 7` ``` Title: HOL/set ``` clasohm@1459 ` 8` ``` Author: Lawrence C Paulson, Cambridge University Computer Laboratory ``` clasohm@0 ` 9` ``` Copyright 1991 University of Cambridge ``` clasohm@0 ` 10` clasohm@0 ` 11` ```For set.thy. Set theory for higher-order logic. A set is simply a predicate. ``` clasohm@0 ` 12` ```*) ``` clasohm@0 ` 13` clasohm@0 ` 14` ```open Set; ``` clasohm@0 ` 15` wenzelm@3837 ` 16` ```val [prem] = goal Set.thy "[| P(a) |] ==> a : {x. P(x)}"; ``` clasohm@0 ` 17` ```by (rtac (mem_Collect_iff RS iffD2) 1); ``` clasohm@0 ` 18` ```by (rtac prem 1); ``` clasohm@757 ` 19` ```qed "CollectI"; ``` clasohm@0 ` 20` wenzelm@3837 ` 21` ```val prems = goal Set.thy "[| a : {x. P(x)} |] ==> P(a)"; ``` clasohm@0 ` 22` ```by (resolve_tac (prems RL [mem_Collect_iff RS iffD1]) 1); ``` clasohm@757 ` 23` ```qed "CollectD"; ``` clasohm@0 ` 24` lcp@8 ` 25` ```val CollectE = make_elim CollectD; ``` lcp@8 ` 26` clasohm@0 ` 27` ```val [prem] = goal Set.thy "[| !!x. x:A <-> x:B |] ==> A = B"; ``` clasohm@0 ` 28` ```by (rtac (set_extension RS iffD2) 1); ``` clasohm@0 ` 29` ```by (rtac (prem RS allI) 1); ``` clasohm@757 ` 30` ```qed "set_ext"; ``` clasohm@0 ` 31` clasohm@0 ` 32` ```(*** Bounded quantifiers ***) ``` clasohm@0 ` 33` clasohm@0 ` 34` ```val prems = goalw Set.thy [Ball_def] ``` clasohm@0 ` 35` ``` "[| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)"; ``` clasohm@0 ` 36` ```by (REPEAT (ares_tac (prems @ [allI,impI]) 1)); ``` clasohm@757 ` 37` ```qed "ballI"; ``` clasohm@0 ` 38` clasohm@0 ` 39` ```val [major,minor] = goalw Set.thy [Ball_def] ``` clasohm@0 ` 40` ``` "[| ALL x:A. P(x); x:A |] ==> P(x)"; ``` clasohm@0 ` 41` ```by (rtac (minor RS (major RS spec RS mp)) 1); ``` clasohm@757 ` 42` ```qed "bspec"; ``` clasohm@0 ` 43` clasohm@0 ` 44` ```val major::prems = goalw Set.thy [Ball_def] ``` clasohm@0 ` 45` ``` "[| ALL x:A. P(x); P(x) ==> Q; ~ x:A ==> Q |] ==> Q"; ``` clasohm@0 ` 46` ```by (rtac (major RS spec RS impCE) 1); ``` clasohm@0 ` 47` ```by (REPEAT (eresolve_tac prems 1)); ``` clasohm@757 ` 48` ```qed "ballE"; ``` clasohm@0 ` 49` clasohm@0 ` 50` ```(*Takes assumptions ALL x:A.P(x) and a:A; creates assumption P(a)*) ``` clasohm@0 ` 51` ```fun ball_tac i = etac ballE i THEN contr_tac (i+1); ``` clasohm@0 ` 52` clasohm@0 ` 53` ```val prems = goalw Set.thy [Bex_def] ``` clasohm@0 ` 54` ``` "[| P(x); x:A |] ==> EX x:A. P(x)"; ``` clasohm@0 ` 55` ```by (REPEAT (ares_tac (prems @ [exI,conjI]) 1)); ``` clasohm@757 ` 56` ```qed "bexI"; ``` clasohm@0 ` 57` clasohm@757 ` 58` ```qed_goal "bexCI" Set.thy ``` wenzelm@3837 ` 59` ``` "[| EX x:A. ~P(x) ==> P(a); a:A |] ==> EX x:A. P(x)" ``` clasohm@0 ` 60` ``` (fn prems=> ``` clasohm@0 ` 61` ``` [ (rtac classical 1), ``` clasohm@0 ` 62` ``` (REPEAT (ares_tac (prems@[bexI,ballI,notI,notE]) 1)) ]); ``` clasohm@0 ` 63` clasohm@0 ` 64` ```val major::prems = goalw Set.thy [Bex_def] ``` clasohm@0 ` 65` ``` "[| EX x:A. P(x); !!x. [| x:A; P(x) |] ==> Q |] ==> Q"; ``` clasohm@0 ` 66` ```by (rtac (major RS exE) 1); ``` clasohm@0 ` 67` ```by (REPEAT (eresolve_tac (prems @ [asm_rl,conjE]) 1)); ``` clasohm@757 ` 68` ```qed "bexE"; ``` clasohm@0 ` 69` clasohm@0 ` 70` ```(*Trival rewrite rule; (! x:A.P)=P holds only if A is nonempty!*) ``` clasohm@0 ` 71` ```val prems = goal Set.thy ``` clasohm@0 ` 72` ``` "(ALL x:A. True) <-> True"; ``` clasohm@0 ` 73` ```by (REPEAT (ares_tac [TrueI,ballI,iffI] 1)); ``` clasohm@757 ` 74` ```qed "ball_rew"; ``` clasohm@0 ` 75` clasohm@0 ` 76` ```(** Congruence rules **) ``` clasohm@0 ` 77` clasohm@0 ` 78` ```val prems = goal Set.thy ``` clasohm@0 ` 79` ``` "[| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==> \ ``` clasohm@0 ` 80` ```\ (ALL x:A. P(x)) <-> (ALL x:A'. P'(x))"; ``` clasohm@0 ` 81` ```by (resolve_tac (prems RL [ssubst,iffD2]) 1); ``` clasohm@0 ` 82` ```by (REPEAT (ares_tac [ballI,iffI] 1 ``` clasohm@0 ` 83` ``` ORELSE eresolve_tac ([make_elim bspec, mp] @ (prems RL [iffE])) 1)); ``` clasohm@757 ` 84` ```qed "ball_cong"; ``` clasohm@0 ` 85` clasohm@0 ` 86` ```val prems = goal Set.thy ``` clasohm@0 ` 87` ``` "[| A=A'; !!x. x:A' ==> P(x) <-> P'(x) |] ==> \ ``` clasohm@0 ` 88` ```\ (EX x:A. P(x)) <-> (EX x:A'. P'(x))"; ``` clasohm@0 ` 89` ```by (resolve_tac (prems RL [ssubst,iffD2]) 1); ``` clasohm@0 ` 90` ```by (REPEAT (etac bexE 1 ``` clasohm@0 ` 91` ``` ORELSE ares_tac ([bexI,iffI] @ (prems RL [iffD1,iffD2])) 1)); ``` clasohm@757 ` 92` ```qed "bex_cong"; ``` clasohm@0 ` 93` clasohm@0 ` 94` ```(*** Rules for subsets ***) ``` clasohm@0 ` 95` wenzelm@3837 ` 96` ```val prems = goalw Set.thy [subset_def] "(!!x. x:A ==> x:B) ==> A <= B"; ``` clasohm@0 ` 97` ```by (REPEAT (ares_tac (prems @ [ballI]) 1)); ``` clasohm@757 ` 98` ```qed "subsetI"; ``` clasohm@0 ` 99` clasohm@0 ` 100` ```(*Rule in Modus Ponens style*) ``` clasohm@0 ` 101` ```val major::prems = goalw Set.thy [subset_def] "[| A <= B; c:A |] ==> c:B"; ``` clasohm@0 ` 102` ```by (rtac (major RS bspec) 1); ``` clasohm@0 ` 103` ```by (resolve_tac prems 1); ``` clasohm@757 ` 104` ```qed "subsetD"; ``` clasohm@0 ` 105` clasohm@0 ` 106` ```(*Classical elimination rule*) ``` clasohm@0 ` 107` ```val major::prems = goalw Set.thy [subset_def] ``` clasohm@0 ` 108` ``` "[| A <= B; ~(c:A) ==> P; c:B ==> P |] ==> P"; ``` clasohm@0 ` 109` ```by (rtac (major RS ballE) 1); ``` clasohm@0 ` 110` ```by (REPEAT (eresolve_tac prems 1)); ``` clasohm@757 ` 111` ```qed "subsetCE"; ``` clasohm@0 ` 112` clasohm@0 ` 113` ```(*Takes assumptions A<=B; c:A and creates the assumption c:B *) ``` clasohm@0 ` 114` ```fun set_mp_tac i = etac subsetCE i THEN mp_tac i; ``` clasohm@0 ` 115` clasohm@757 ` 116` ```qed_goal "subset_refl" Set.thy "A <= A" ``` clasohm@0 ` 117` ``` (fn _=> [ (REPEAT (ares_tac [subsetI] 1)) ]); ``` clasohm@0 ` 118` paulson@5143 ` 119` ```Goal "[| A<=B; B<=C |] ==> A<=C"; ``` lcp@642 ` 120` ```by (rtac subsetI 1); ``` clasohm@0 ` 121` ```by (REPEAT (eresolve_tac [asm_rl, subsetD] 1)); ``` clasohm@757 ` 122` ```qed "subset_trans"; ``` clasohm@0 ` 123` clasohm@0 ` 124` clasohm@0 ` 125` ```(*** Rules for equality ***) ``` clasohm@0 ` 126` clasohm@0 ` 127` ```(*Anti-symmetry of the subset relation*) ``` clasohm@0 ` 128` ```val prems = goal Set.thy "[| A <= B; B <= A |] ==> A = B"; ``` clasohm@0 ` 129` ```by (rtac (iffI RS set_ext) 1); ``` clasohm@0 ` 130` ```by (REPEAT (ares_tac (prems RL [subsetD]) 1)); ``` clasohm@757 ` 131` ```qed "subset_antisym"; ``` clasohm@0 ` 132` ```val equalityI = subset_antisym; ``` clasohm@0 ` 133` clasohm@0 ` 134` ```(* Equality rules from ZF set theory -- are they appropriate here? *) ``` clasohm@0 ` 135` ```val prems = goal Set.thy "A = B ==> A<=B"; ``` clasohm@0 ` 136` ```by (resolve_tac (prems RL [subst]) 1); ``` clasohm@0 ` 137` ```by (rtac subset_refl 1); ``` clasohm@757 ` 138` ```qed "equalityD1"; ``` clasohm@0 ` 139` clasohm@0 ` 140` ```val prems = goal Set.thy "A = B ==> B<=A"; ``` clasohm@0 ` 141` ```by (resolve_tac (prems RL [subst]) 1); ``` clasohm@0 ` 142` ```by (rtac subset_refl 1); ``` clasohm@757 ` 143` ```qed "equalityD2"; ``` clasohm@0 ` 144` clasohm@0 ` 145` ```val prems = goal Set.thy ``` clasohm@0 ` 146` ``` "[| A = B; [| A<=B; B<=A |] ==> P |] ==> P"; ``` clasohm@0 ` 147` ```by (resolve_tac prems 1); ``` clasohm@0 ` 148` ```by (REPEAT (resolve_tac (prems RL [equalityD1,equalityD2]) 1)); ``` clasohm@757 ` 149` ```qed "equalityE"; ``` clasohm@0 ` 150` clasohm@0 ` 151` ```val major::prems = goal Set.thy ``` clasohm@0 ` 152` ``` "[| A = B; [| c:A; c:B |] ==> P; [| ~ c:A; ~ c:B |] ==> P |] ==> P"; ``` clasohm@0 ` 153` ```by (rtac (major RS equalityE) 1); ``` clasohm@0 ` 154` ```by (REPEAT (contr_tac 1 ORELSE eresolve_tac ([asm_rl,subsetCE]@prems) 1)); ``` clasohm@757 ` 155` ```qed "equalityCE"; ``` clasohm@0 ` 156` clasohm@0 ` 157` ```(*Lemma for creating induction formulae -- for "pattern matching" on p ``` clasohm@0 ` 158` ``` To make the induction hypotheses usable, apply "spec" or "bspec" to ``` clasohm@0 ` 159` ``` put universal quantifiers over the free variables in p. *) ``` clasohm@0 ` 160` ```val prems = goal Set.thy ``` clasohm@0 ` 161` ``` "[| p:A; !!z. z:A ==> p=z --> R |] ==> R"; ``` clasohm@0 ` 162` ```by (rtac mp 1); ``` clasohm@0 ` 163` ```by (REPEAT (resolve_tac (refl::prems) 1)); ``` clasohm@757 ` 164` ```qed "setup_induction"; ``` clasohm@0 ` 165` wenzelm@5062 ` 166` ```Goal "{x. x:A} = A"; ``` lcp@642 ` 167` ```by (REPEAT (ares_tac [equalityI,subsetI,CollectI] 1 ORELSE etac CollectD 1)); ``` clasohm@757 ` 168` ```qed "trivial_set"; ``` clasohm@0 ` 169` clasohm@0 ` 170` ```(*** Rules for binary union -- Un ***) ``` clasohm@0 ` 171` clasohm@0 ` 172` ```val prems = goalw Set.thy [Un_def] "c:A ==> c : A Un B"; ``` clasohm@0 ` 173` ```by (REPEAT (resolve_tac (prems @ [CollectI,disjI1]) 1)); ``` clasohm@757 ` 174` ```qed "UnI1"; ``` clasohm@0 ` 175` clasohm@0 ` 176` ```val prems = goalw Set.thy [Un_def] "c:B ==> c : A Un B"; ``` clasohm@0 ` 177` ```by (REPEAT (resolve_tac (prems @ [CollectI,disjI2]) 1)); ``` clasohm@757 ` 178` ```qed "UnI2"; ``` clasohm@0 ` 179` clasohm@0 ` 180` ```(*Classical introduction rule: no commitment to A vs B*) ``` clasohm@757 ` 181` ```qed_goal "UnCI" Set.thy "(~c:B ==> c:A) ==> c : A Un B" ``` clasohm@0 ` 182` ``` (fn prems=> ``` clasohm@0 ` 183` ``` [ (rtac classical 1), ``` clasohm@0 ` 184` ``` (REPEAT (ares_tac (prems@[UnI1,notI]) 1)), ``` clasohm@0 ` 185` ``` (REPEAT (ares_tac (prems@[UnI2,notE]) 1)) ]); ``` clasohm@0 ` 186` clasohm@0 ` 187` ```val major::prems = goalw Set.thy [Un_def] ``` clasohm@0 ` 188` ``` "[| c : A Un B; c:A ==> P; c:B ==> P |] ==> P"; ``` clasohm@0 ` 189` ```by (rtac (major RS CollectD RS disjE) 1); ``` clasohm@0 ` 190` ```by (REPEAT (eresolve_tac prems 1)); ``` clasohm@757 ` 191` ```qed "UnE"; ``` clasohm@0 ` 192` clasohm@0 ` 193` clasohm@0 ` 194` ```(*** Rules for small intersection -- Int ***) ``` clasohm@0 ` 195` clasohm@0 ` 196` ```val prems = goalw Set.thy [Int_def] ``` clasohm@0 ` 197` ``` "[| c:A; c:B |] ==> c : A Int B"; ``` clasohm@0 ` 198` ```by (REPEAT (resolve_tac (prems @ [CollectI,conjI]) 1)); ``` clasohm@757 ` 199` ```qed "IntI"; ``` clasohm@0 ` 200` clasohm@0 ` 201` ```val [major] = goalw Set.thy [Int_def] "c : A Int B ==> c:A"; ``` clasohm@0 ` 202` ```by (rtac (major RS CollectD RS conjunct1) 1); ``` clasohm@757 ` 203` ```qed "IntD1"; ``` clasohm@0 ` 204` clasohm@0 ` 205` ```val [major] = goalw Set.thy [Int_def] "c : A Int B ==> c:B"; ``` clasohm@0 ` 206` ```by (rtac (major RS CollectD RS conjunct2) 1); ``` clasohm@757 ` 207` ```qed "IntD2"; ``` clasohm@0 ` 208` clasohm@0 ` 209` ```val [major,minor] = goal Set.thy ``` clasohm@0 ` 210` ``` "[| c : A Int B; [| c:A; c:B |] ==> P |] ==> P"; ``` clasohm@0 ` 211` ```by (rtac minor 1); ``` clasohm@0 ` 212` ```by (rtac (major RS IntD1) 1); ``` clasohm@0 ` 213` ```by (rtac (major RS IntD2) 1); ``` clasohm@757 ` 214` ```qed "IntE"; ``` clasohm@0 ` 215` clasohm@0 ` 216` clasohm@0 ` 217` ```(*** Rules for set complement -- Compl ***) ``` clasohm@0 ` 218` clasohm@0 ` 219` ```val prems = goalw Set.thy [Compl_def] ``` clasohm@0 ` 220` ``` "[| c:A ==> False |] ==> c : Compl(A)"; ``` clasohm@0 ` 221` ```by (REPEAT (ares_tac (prems @ [CollectI,notI]) 1)); ``` clasohm@757 ` 222` ```qed "ComplI"; ``` clasohm@0 ` 223` clasohm@0 ` 224` ```(*This form, with negated conclusion, works well with the Classical prover. ``` clasohm@0 ` 225` ``` Negated assumptions behave like formulae on the right side of the notional ``` clasohm@0 ` 226` ``` turnstile...*) ``` clasohm@0 ` 227` ```val major::prems = goalw Set.thy [Compl_def] ``` clasohm@0 ` 228` ``` "[| c : Compl(A) |] ==> ~c:A"; ``` clasohm@0 ` 229` ```by (rtac (major RS CollectD) 1); ``` clasohm@757 ` 230` ```qed "ComplD"; ``` clasohm@0 ` 231` clasohm@0 ` 232` ```val ComplE = make_elim ComplD; ``` clasohm@0 ` 233` clasohm@0 ` 234` clasohm@0 ` 235` ```(*** Empty sets ***) ``` clasohm@0 ` 236` wenzelm@5062 ` 237` ```Goalw [empty_def] "{x. False} = {}"; ``` lcp@642 ` 238` ```by (rtac refl 1); ``` clasohm@757 ` 239` ```qed "empty_eq"; ``` clasohm@0 ` 240` clasohm@0 ` 241` ```val [prem] = goalw Set.thy [empty_def] "a : {} ==> P"; ``` clasohm@0 ` 242` ```by (rtac (prem RS CollectD RS FalseE) 1); ``` clasohm@757 ` 243` ```qed "emptyD"; ``` clasohm@0 ` 244` clasohm@0 ` 245` ```val emptyE = make_elim emptyD; ``` clasohm@0 ` 246` wenzelm@3837 ` 247` ```val [prem] = goal Set.thy "~ A={} ==> (EX x. x:A)"; ``` lcp@642 ` 248` ```by (rtac (prem RS swap) 1); ``` lcp@642 ` 249` ```by (rtac equalityI 1); ``` clasohm@0 ` 250` ```by (ALLGOALS (fast_tac (FOL_cs addSIs [subsetI] addSEs [emptyD]))); ``` clasohm@757 ` 251` ```qed "not_emptyD"; ``` clasohm@0 ` 252` clasohm@0 ` 253` ```(*** Singleton sets ***) ``` clasohm@0 ` 254` wenzelm@5062 ` 255` ```Goalw [singleton_def] "a : {a}"; ``` clasohm@0 ` 256` ```by (rtac CollectI 1); ``` clasohm@0 ` 257` ```by (rtac refl 1); ``` clasohm@757 ` 258` ```qed "singletonI"; ``` clasohm@0 ` 259` clasohm@0 ` 260` ```val [major] = goalw Set.thy [singleton_def] "b : {a} ==> b=a"; ``` clasohm@0 ` 261` ```by (rtac (major RS CollectD) 1); ``` clasohm@757 ` 262` ```qed "singletonD"; ``` clasohm@0 ` 263` clasohm@0 ` 264` ```val singletonE = make_elim singletonD; ``` clasohm@0 ` 265` clasohm@0 ` 266` ```(*** Unions of families ***) ``` clasohm@0 ` 267` clasohm@0 ` 268` ```(*The order of the premises presupposes that A is rigid; b may be flexible*) ``` clasohm@0 ` 269` ```val prems = goalw Set.thy [UNION_def] ``` clasohm@0 ` 270` ``` "[| a:A; b: B(a) |] ==> b: (UN x:A. B(x))"; ``` clasohm@0 ` 271` ```by (REPEAT (resolve_tac (prems @ [bexI,CollectI]) 1)); ``` clasohm@757 ` 272` ```qed "UN_I"; ``` clasohm@0 ` 273` clasohm@0 ` 274` ```val major::prems = goalw Set.thy [UNION_def] ``` clasohm@0 ` 275` ``` "[| b : (UN x:A. B(x)); !!x.[| x:A; b: B(x) |] ==> R |] ==> R"; ``` clasohm@0 ` 276` ```by (rtac (major RS CollectD RS bexE) 1); ``` clasohm@0 ` 277` ```by (REPEAT (ares_tac prems 1)); ``` clasohm@757 ` 278` ```qed "UN_E"; ``` clasohm@0 ` 279` clasohm@0 ` 280` ```val prems = goal Set.thy ``` clasohm@0 ` 281` ``` "[| A=B; !!x. x:B ==> C(x) = D(x) |] ==> \ ``` clasohm@0 ` 282` ```\ (UN x:A. C(x)) = (UN x:B. D(x))"; ``` clasohm@0 ` 283` ```by (REPEAT (etac UN_E 1 ``` clasohm@0 ` 284` ``` ORELSE ares_tac ([UN_I,equalityI,subsetI] @ ``` clasohm@1459 ` 285` ``` (prems RL [equalityD1,equalityD2] RL [subsetD])) 1)); ``` clasohm@757 ` 286` ```qed "UN_cong"; ``` clasohm@0 ` 287` clasohm@0 ` 288` ```(*** Intersections of families -- INTER x:A. B(x) is Inter(B)``A ) *) ``` clasohm@0 ` 289` clasohm@0 ` 290` ```val prems = goalw Set.thy [INTER_def] ``` clasohm@0 ` 291` ``` "(!!x. x:A ==> b: B(x)) ==> b : (INT x:A. B(x))"; ``` clasohm@0 ` 292` ```by (REPEAT (ares_tac ([CollectI,ballI] @ prems) 1)); ``` clasohm@757 ` 293` ```qed "INT_I"; ``` clasohm@0 ` 294` clasohm@0 ` 295` ```val major::prems = goalw Set.thy [INTER_def] ``` clasohm@0 ` 296` ``` "[| b : (INT x:A. B(x)); a:A |] ==> b: B(a)"; ``` clasohm@0 ` 297` ```by (rtac (major RS CollectD RS bspec) 1); ``` clasohm@0 ` 298` ```by (resolve_tac prems 1); ``` clasohm@757 ` 299` ```qed "INT_D"; ``` clasohm@0 ` 300` clasohm@0 ` 301` ```(*"Classical" elimination rule -- does not require proving X:C *) ``` clasohm@0 ` 302` ```val major::prems = goalw Set.thy [INTER_def] ``` clasohm@0 ` 303` ``` "[| b : (INT x:A. B(x)); b: B(a) ==> R; ~ a:A ==> R |] ==> R"; ``` clasohm@0 ` 304` ```by (rtac (major RS CollectD RS ballE) 1); ``` clasohm@0 ` 305` ```by (REPEAT (eresolve_tac prems 1)); ``` clasohm@757 ` 306` ```qed "INT_E"; ``` clasohm@0 ` 307` clasohm@0 ` 308` ```val prems = goal Set.thy ``` clasohm@0 ` 309` ``` "[| A=B; !!x. x:B ==> C(x) = D(x) |] ==> \ ``` clasohm@0 ` 310` ```\ (INT x:A. C(x)) = (INT x:B. D(x))"; ``` clasohm@0 ` 311` ```by (REPEAT_FIRST (resolve_tac [INT_I,equalityI,subsetI])); ``` clasohm@0 ` 312` ```by (REPEAT (dtac INT_D 1 ``` clasohm@0 ` 313` ``` ORELSE ares_tac (prems RL [equalityD1,equalityD2] RL [subsetD]) 1)); ``` clasohm@757 ` 314` ```qed "INT_cong"; ``` clasohm@0 ` 315` clasohm@0 ` 316` ```(*** Rules for Unions ***) ``` clasohm@0 ` 317` clasohm@0 ` 318` ```(*The order of the premises presupposes that C is rigid; A may be flexible*) ``` clasohm@0 ` 319` ```val prems = goalw Set.thy [Union_def] ``` clasohm@0 ` 320` ``` "[| X:C; A:X |] ==> A : Union(C)"; ``` clasohm@0 ` 321` ```by (REPEAT (resolve_tac (prems @ [UN_I]) 1)); ``` clasohm@757 ` 322` ```qed "UnionI"; ``` clasohm@0 ` 323` clasohm@0 ` 324` ```val major::prems = goalw Set.thy [Union_def] ``` clasohm@0 ` 325` ``` "[| A : Union(C); !!X.[| A:X; X:C |] ==> R |] ==> R"; ``` clasohm@0 ` 326` ```by (rtac (major RS UN_E) 1); ``` clasohm@0 ` 327` ```by (REPEAT (ares_tac prems 1)); ``` clasohm@757 ` 328` ```qed "UnionE"; ``` clasohm@0 ` 329` clasohm@0 ` 330` ```(*** Rules for Inter ***) ``` clasohm@0 ` 331` clasohm@0 ` 332` ```val prems = goalw Set.thy [Inter_def] ``` clasohm@0 ` 333` ``` "[| !!X. X:C ==> A:X |] ==> A : Inter(C)"; ``` clasohm@0 ` 334` ```by (REPEAT (ares_tac ([INT_I] @ prems) 1)); ``` clasohm@757 ` 335` ```qed "InterI"; ``` clasohm@0 ` 336` clasohm@0 ` 337` ```(*A "destruct" rule -- every X in C contains A as an element, but ``` clasohm@0 ` 338` ``` A:X can hold when X:C does not! This rule is analogous to "spec". *) ``` clasohm@0 ` 339` ```val major::prems = goalw Set.thy [Inter_def] ``` clasohm@0 ` 340` ``` "[| A : Inter(C); X:C |] ==> A:X"; ``` clasohm@0 ` 341` ```by (rtac (major RS INT_D) 1); ``` clasohm@0 ` 342` ```by (resolve_tac prems 1); ``` clasohm@757 ` 343` ```qed "InterD"; ``` clasohm@0 ` 344` clasohm@0 ` 345` ```(*"Classical" elimination rule -- does not require proving X:C *) ``` clasohm@0 ` 346` ```val major::prems = goalw Set.thy [Inter_def] ``` clasohm@0 ` 347` ``` "[| A : Inter(C); A:X ==> R; ~ X:C ==> R |] ==> R"; ``` clasohm@0 ` 348` ```by (rtac (major RS INT_E) 1); ``` clasohm@0 ` 349` ```by (REPEAT (eresolve_tac prems 1)); ``` clasohm@757 ` 350` ```qed "InterE"; ```