author  haftmann 
Sat, 14 Mar 2009 12:50:29 +0100  
changeset 30531  ab3d61baf66a 
parent 30352  047f183c43b0 
child 30596  140b22f22071 
permissions  rwrr 
923  1 
(* Title: HOL/Set.thy 
12257  2 
Author: Tobias Nipkow, Lawrence C Paulson and Markus Wenzel 
923  3 
*) 
4 

11979  5 
header {* Set theory for higherorder logic *} 
6 

15131  7 
theory Set 
30304
d8e4cd2ac2a1
set operations Int, Un, INTER, UNION, Inter, Union, empty, UNIV are now proper qualified constants with authentic syntax
haftmann
parents:
29901
diff
changeset

8 
imports Lattices 
15131  9 
begin 
11979  10 

11 
text {* A set in HOL is simply a predicate. *} 

923  12 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

13 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

14 
subsection {* Basic syntax *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

15 

3947  16 
global 
17 

26800  18 
types 'a set = "'a => bool" 
3820  19 

923  20 
consts 
30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

21 
Collect :: "('a => bool) => 'a set"  "comprehension" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

22 
"op :" :: "'a => 'a set => bool"  "membership" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

23 
insert :: "'a => 'a set => 'a set" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

24 
Ball :: "'a set => ('a => bool) => bool"  "bounded universal quantifiers" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

25 
Bex :: "'a set => ('a => bool) => bool"  "bounded existential quantifiers" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

26 
Bex1 :: "'a set => ('a => bool) => bool"  "bounded unique existential quantifiers" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

27 
Pow :: "'a set => 'a set set"  "powerset" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

28 
image :: "('a => 'b) => 'a set => 'b set" (infixr "`" 90) 
30304
d8e4cd2ac2a1
set operations Int, Un, INTER, UNION, Inter, Union, empty, UNIV are now proper qualified constants with authentic syntax
haftmann
parents:
29901
diff
changeset

29 

d8e4cd2ac2a1
set operations Int, Un, INTER, UNION, Inter, Union, empty, UNIV are now proper qualified constants with authentic syntax
haftmann
parents:
29901
diff
changeset

30 
local 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

31 

21210  32 
notation 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

33 
"op :" ("op :") and 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

34 
"op :" ("(_/ : _)" [50, 51] 50) 
11979  35 

19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

36 
abbreviation 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

37 
"not_mem x A == ~ (x : A)"  "nonmembership" 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

38 

21210  39 
notation 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

40 
not_mem ("op ~:") and 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

41 
not_mem ("(_/ ~: _)" [50, 51] 50) 
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

42 

21210  43 
notation (xsymbols) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

44 
"op :" ("op \<in>") and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

45 
"op :" ("(_/ \<in> _)" [50, 51] 50) and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

46 
not_mem ("op \<notin>") and 
30304
d8e4cd2ac2a1
set operations Int, Un, INTER, UNION, Inter, Union, empty, UNIV are now proper qualified constants with authentic syntax
haftmann
parents:
29901
diff
changeset

47 
not_mem ("(_/ \<notin> _)" [50, 51] 50) 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

48 

21210  49 
notation (HTML output) 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

50 
"op :" ("op \<in>") and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

51 
"op :" ("(_/ \<in> _)" [50, 51] 50) and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

52 
not_mem ("op \<notin>") and 
19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

53 
not_mem ("(_/ \<notin> _)" [50, 51] 50) 
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

54 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

55 
syntax 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

56 
"@Coll" :: "pttrn => bool => 'a set" ("(1{_./ _})") 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

57 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

58 
translations 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

59 
"{x. P}" == "Collect (%x. P)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

60 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

61 
definition empty :: "'a set" ("{}") where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

62 
"empty \<equiv> {x. False}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

63 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

64 
definition UNIV :: "'a set" where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

65 
"UNIV \<equiv> {x. True}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

66 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

67 
syntax 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

68 
"@Finset" :: "args => 'a set" ("{(_)}") 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

69 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

70 
translations 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

71 
"{x, xs}" == "insert x {xs}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

72 
"{x}" == "insert x {}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

73 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

74 
definition Int :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "Int" 70) where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

75 
"A Int B \<equiv> {x. x \<in> A \<and> x \<in> B}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

76 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

77 
definition Un :: "'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" (infixl "Un" 65) where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

78 
"A Un B \<equiv> {x. x \<in> A \<or> x \<in> B}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

79 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

80 
notation (xsymbols) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

81 
"Int" (infixl "\<inter>" 70) and 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

82 
"Un" (infixl "\<union>" 65) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

83 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

84 
notation (HTML output) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

85 
"Int" (infixl "\<inter>" 70) and 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

86 
"Un" (infixl "\<union>" 65) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

87 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

88 
syntax 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

89 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3ALL _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

90 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3EX _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

91 
"_Bex1" :: "pttrn => 'a set => bool => bool" ("(3EX! _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

92 
"_Bleast" :: "id => 'a set => bool => 'a" ("(3LEAST _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

93 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

94 
syntax (HOL) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

95 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3! _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

96 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3? _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

97 
"_Bex1" :: "pttrn => 'a set => bool => bool" ("(3?! _:_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

98 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

99 
syntax (xsymbols) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

100 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

101 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

102 
"_Bex1" :: "pttrn => 'a set => bool => bool" ("(3\<exists>!_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

103 
"_Bleast" :: "id => 'a set => bool => 'a" ("(3LEAST_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

104 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

105 
syntax (HTML output) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

106 
"_Ball" :: "pttrn => 'a set => bool => bool" ("(3\<forall>_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

107 
"_Bex" :: "pttrn => 'a set => bool => bool" ("(3\<exists>_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

108 
"_Bex1" :: "pttrn => 'a set => bool => bool" ("(3\<exists>!_\<in>_./ _)" [0, 0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

109 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

110 
translations 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

111 
"ALL x:A. P" == "Ball A (%x. P)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

112 
"EX x:A. P" == "Bex A (%x. P)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

113 
"EX! x:A. P" == "Bex1 A (%x. P)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

114 
"LEAST x:A. P" => "LEAST x. x:A & P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

115 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

116 
definition INTER :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

117 
"INTER A B \<equiv> {y. \<forall>x\<in>A. y \<in> B x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

118 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

119 
definition UNION :: "'a set \<Rightarrow> ('a \<Rightarrow> 'b set) \<Rightarrow> 'b set" where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

120 
"UNION A B \<equiv> {y. \<exists>x\<in>A. y \<in> B x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

121 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

122 
definition Inter :: "'a set set \<Rightarrow> 'a set" where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

123 
"Inter S \<equiv> INTER S (\<lambda>x. x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

124 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

125 
definition Union :: "'a set set \<Rightarrow> 'a set" where 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

126 
"Union S \<equiv> UNION S (\<lambda>x. x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

127 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

128 
notation (xsymbols) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

129 
Inter ("\<Inter>_" [90] 90) and 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

130 
Union ("\<Union>_" [90] 90) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

131 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

132 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

133 
subsection {* Additional concrete syntax *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

134 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

135 
syntax 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

136 
"@SetCompr" :: "'a => idts => bool => 'a set" ("(1{_ /_./ _})") 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

137 
"@Collect" :: "idt => 'a set => bool => 'a set" ("(1{_ :/ _./ _})") 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

138 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3INT _./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

139 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3UN _./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

140 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3INT _:_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

141 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3UN _:_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

142 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

143 
syntax (xsymbols) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

144 
"@Collect" :: "idt => 'a set => bool => 'a set" ("(1{_ \<in>/ _./ _})") 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

145 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

146 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

147 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>_\<in>_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

148 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>_\<in>_./ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

149 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

150 
syntax (latex output) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

151 
"@INTER1" :: "pttrns => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

152 
"@UNION1" :: "pttrns => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<^esub>)/ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

153 
"@INTER" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Inter>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

154 
"@UNION" :: "pttrn => 'a set => 'b set => 'b set" ("(3\<Union>(00\<^bsub>_\<in>_\<^esub>)/ _)" [0, 10] 10) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

155 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

156 
translations 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

157 
"{x:A. P}" => "{x. x:A & P}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

158 
"INT x y. B" == "INT x. INT y. B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

159 
"INT x. B" == "CONST INTER CONST UNIV (%x. B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

160 
"INT x. B" == "INT x:CONST UNIV. B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

161 
"INT x:A. B" == "CONST INTER A (%x. B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

162 
"UN x y. B" == "UN x. UN y. B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

163 
"UN x. B" == "CONST UNION CONST UNIV (%x. B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

164 
"UN x. B" == "UN x:CONST UNIV. B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

165 
"UN x:A. B" == "CONST UNION A (%x. B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

166 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

167 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

168 
Note the difference between ordinary xsymbol syntax of indexed 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

169 
unions and intersections (e.g.\ @{text"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

170 
and their \LaTeX\ rendition: @{term"\<Union>a\<^isub>1\<in>A\<^isub>1. B"}. The 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

171 
former does not make the index expression a subscript of the 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

172 
union/intersection symbol because this leads to problems with nested 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

173 
subscripts in Proof General. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

174 
*} 
2261  175 

21333  176 
abbreviation 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

177 
subset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where 
21819  178 
"subset \<equiv> less" 
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

179 

eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

180 
abbreviation 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

181 
subset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where 
21819  182 
"subset_eq \<equiv> less_eq" 
21333  183 

184 
notation (output) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

185 
subset ("op <") and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

186 
subset ("(_/ < _)" [50, 51] 50) and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

187 
subset_eq ("op <=") and 
21333  188 
subset_eq ("(_/ <= _)" [50, 51] 50) 
189 

190 
notation (xsymbols) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

191 
subset ("op \<subset>") and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

192 
subset ("(_/ \<subset> _)" [50, 51] 50) and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

193 
subset_eq ("op \<subseteq>") and 
21333  194 
subset_eq ("(_/ \<subseteq> _)" [50, 51] 50) 
195 

196 
notation (HTML output) 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

197 
subset ("op \<subset>") and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

198 
subset ("(_/ \<subset> _)" [50, 51] 50) and 
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

199 
subset_eq ("op \<subseteq>") and 
21333  200 
subset_eq ("(_/ \<subseteq> _)" [50, 51] 50) 
201 

202 
abbreviation (input) 

21819  203 
supset :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where 
204 
"supset \<equiv> greater" 

21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

205 

eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21384
diff
changeset

206 
abbreviation (input) 
21819  207 
supset_eq :: "'a set \<Rightarrow> 'a set \<Rightarrow> bool" where 
208 
"supset_eq \<equiv> greater_eq" 

209 

210 
notation (xsymbols) 

211 
supset ("op \<supset>") and 

212 
supset ("(_/ \<supset> _)" [50, 51] 50) and 

213 
supset_eq ("op \<supseteq>") and 

214 
supset_eq ("(_/ \<supseteq> _)" [50, 51] 50) 

21333  215 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

216 
abbreviation 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

217 
range :: "('a => 'b) => 'b set" where  "of function" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

218 
"range f == f ` UNIV" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

219 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

220 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

221 
subsubsection "Bounded quantifiers" 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

222 

19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

223 
syntax (output) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

224 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

225 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3EX _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

226 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3ALL _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

227 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3EX _<=_./ _)" [0, 0, 10] 10) 
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19870
diff
changeset

228 
"_setleEx1" :: "[idt, 'a, bool] => bool" ("(3EX! _<=_./ _)" [0, 0, 10] 10) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

229 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

230 
syntax (xsymbols) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

231 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

232 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

233 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

234 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10) 
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19870
diff
changeset

235 
"_setleEx1" :: "[idt, 'a, bool] => bool" ("(3\<exists>!_\<subseteq>_./ _)" [0, 0, 10] 10) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

236 

19656
09be06943252
tuned concrete syntax  abbreviation/const_syntax;
wenzelm
parents:
19637
diff
changeset

237 
syntax (HOL output) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

238 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3! _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

239 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3? _<_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

240 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3! _<=_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

241 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3? _<=_./ _)" [0, 0, 10] 10) 
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19870
diff
changeset

242 
"_setleEx1" :: "[idt, 'a, bool] => bool" ("(3?! _<=_./ _)" [0, 0, 10] 10) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

243 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

244 
syntax (HTML output) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

245 
"_setlessAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

246 
"_setlessEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subset>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

247 
"_setleAll" :: "[idt, 'a, bool] => bool" ("(3\<forall>_\<subseteq>_./ _)" [0, 0, 10] 10) 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

248 
"_setleEx" :: "[idt, 'a, bool] => bool" ("(3\<exists>_\<subseteq>_./ _)" [0, 0, 10] 10) 
20217
25b068a99d2b
linear arithmetic splits certain operators (e.g. min, max, abs)
webertj
parents:
19870
diff
changeset

249 
"_setleEx1" :: "[idt, 'a, bool] => bool" ("(3\<exists>!_\<subseteq>_./ _)" [0, 0, 10] 10) 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

250 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

251 
translations 
30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

252 
"\<forall>A\<subset>B. P" => "ALL A. A \<subset> B > P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

253 
"\<exists>A\<subset>B. P" => "EX A. A \<subset> B & P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

254 
"\<forall>A\<subseteq>B. P" => "ALL A. A \<subseteq> B > P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

255 
"\<exists>A\<subseteq>B. P" => "EX A. A \<subseteq> B & P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

256 
"\<exists>!A\<subseteq>B. P" => "EX! A. A \<subseteq> B & P" 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

257 

8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

258 
print_translation {* 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

259 
let 
22377  260 
val Type (set_type, _) = @{typ "'a set"}; 
261 
val All_binder = Syntax.binder_name @{const_syntax "All"}; 

262 
val Ex_binder = Syntax.binder_name @{const_syntax "Ex"}; 

263 
val impl = @{const_syntax "op >"}; 

264 
val conj = @{const_syntax "op &"}; 

265 
val sbset = @{const_syntax "subset"}; 

266 
val sbset_eq = @{const_syntax "subset_eq"}; 

21819  267 

268 
val trans = 

269 
[((All_binder, impl, sbset), "_setlessAll"), 

270 
((All_binder, impl, sbset_eq), "_setleAll"), 

271 
((Ex_binder, conj, sbset), "_setlessEx"), 

272 
((Ex_binder, conj, sbset_eq), "_setleEx")]; 

273 

274 
fun mk v v' c n P = 

275 
if v = v' andalso not (Term.exists_subterm (fn Free (x, _) => x = v  _ => false) n) 

276 
then Syntax.const c $ Syntax.mark_bound v' $ n $ P else raise Match; 

277 

278 
fun tr' q = (q, 

279 
fn [Const ("_bound", _) $ Free (v, Type (T, _)), Const (c, _) $ (Const (d, _) $ (Const ("_bound", _) $ Free (v', _)) $ n) $ P] => 

280 
if T = (set_type) then case AList.lookup (op =) trans (q, c, d) 

281 
of NONE => raise Match 

282 
 SOME l => mk v v' l n P 

283 
else raise Match 

284 
 _ => raise Match); 

14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

285 
in 
21819  286 
[tr' All_binder, tr' Ex_binder] 
14804
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

287 
end 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

288 
*} 
8de39d3e8eb6
Corrected printer bug for bounded quantifiers Q x<=y. P
nipkow
parents:
14752
diff
changeset

289 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

290 

11979  291 
text {* 
292 
\medskip Translate between @{text "{e  x1...xn. P}"} and @{text 

293 
"{u. EX x1..xn. u = e & P}"}; @{text "{y. EX x1..xn. y = e & P}"} is 

294 
only translated if @{text "[0..n] subset bvs(e)"}. 

295 
*} 

296 

297 
parse_translation {* 

298 
let 

299 
val ex_tr = snd (mk_binder_tr ("EX ", "Ex")); 

3947  300 

11979  301 
fun nvars (Const ("_idts", _) $ _ $ idts) = nvars idts + 1 
302 
 nvars _ = 1; 

303 

304 
fun setcompr_tr [e, idts, b] = 

305 
let 

306 
val eq = Syntax.const "op =" $ Bound (nvars idts) $ e; 

307 
val P = Syntax.const "op &" $ eq $ b; 

308 
val exP = ex_tr [idts, P]; 

17784  309 
in Syntax.const "Collect" $ Term.absdummy (dummyT, exP) end; 
11979  310 

311 
in [("@SetCompr", setcompr_tr)] end; 

312 
*} 

923  313 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

314 
(* To avoid etacontraction of body: *) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

315 
print_translation {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

316 
let 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

317 
fun btr' syn [A, Abs abs] = 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

318 
let val (x, t) = atomic_abs_tr' abs 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

319 
in Syntax.const syn $ x $ A $ t end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

320 
in 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

321 
[(@{const_syntax Ball}, btr' "_Ball"), (@{const_syntax Bex}, btr' "_Bex"), 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

322 
(@{const_syntax UNION}, btr' "@UNION"),(@{const_syntax INTER}, btr' "@INTER")] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

323 
end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

324 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

325 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

326 
print_translation {* 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

327 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

328 
val ex_tr' = snd (mk_binder_tr' ("Ex", "DUMMY")); 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

329 

f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

330 
fun setcompr_tr' [Abs (abs as (_, _, P))] = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

331 
let 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

332 
fun check (Const ("Ex", _) $ Abs (_, _, P), n) = check (P, n + 1) 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

333 
 check (Const ("op &", _) $ (Const ("op =", _) $ Bound m $ e) $ P, n) = 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

334 
n > 0 andalso m = n andalso not (loose_bvar1 (P, n)) andalso 
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

335 
((0 upto (n  1)) subset add_loose_bnos (e, 0, [])) 
13764  336 
 check _ = false 
923  337 

11979  338 
fun tr' (_ $ abs) = 
339 
let val _ $ idts $ (_ $ (_ $ _ $ e) $ Q) = ex_tr' [abs] 

340 
in Syntax.const "@SetCompr" $ e $ idts $ Q end; 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

341 
in if check (P, 0) then tr' P 
15535  342 
else let val (x as _ $ Free(xN,_), t) = atomic_abs_tr' abs 
343 
val M = Syntax.const "@Coll" $ x $ t 

344 
in case t of 

345 
Const("op &",_) 

346 
$ (Const("op :",_) $ (Const("_bound",_) $ Free(yN,_)) $ A) 

347 
$ P => 

348 
if xN=yN then Syntax.const "@Collect" $ x $ A $ P else M 

349 
 _ => M 

350 
end 

13763
f94b569cd610
added print translations tha avoid eta contraction for important binders.
nipkow
parents:
13653
diff
changeset

351 
end; 
11979  352 
in [("Collect", setcompr_tr')] end; 
353 
*} 

354 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

355 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

356 
subsection {* Rules and definitions *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

357 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

358 
text {* Isomorphisms between predicates and sets. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

359 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

360 
defs 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

361 
mem_def [code]: "x : S == S x" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

362 
Collect_def [code]: "Collect P == P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

363 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

364 
defs 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

365 
Ball_def: "Ball A P == ALL x. x:A > P(x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

366 
Bex_def: "Bex A P == EX x. x:A & P(x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

367 
Bex1_def: "Bex1 A P == EX! x. x:A & P(x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

368 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

369 
instantiation "fun" :: (type, minus) minus 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

370 
begin 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

371 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

372 
definition 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

373 
fun_diff_def: "A  B = (%x. A x  B x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

374 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

375 
instance .. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

376 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

377 
end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

378 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

379 
instantiation bool :: minus 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

380 
begin 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

381 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

382 
definition 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

383 
bool_diff_def: "A  B = (A & ~ B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

384 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

385 
instance .. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

386 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

387 
end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

388 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

389 
instantiation "fun" :: (type, uminus) uminus 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

390 
begin 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

391 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

392 
definition 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

393 
fun_Compl_def: " A = (%x.  A x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

394 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

395 
instance .. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

396 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

397 
end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

398 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

399 
instantiation bool :: uminus 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

400 
begin 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

401 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

402 
definition 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

403 
bool_Compl_def: " A = (~ A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

404 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

405 
instance .. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

406 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

407 
end 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

408 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

409 
defs 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

410 
Pow_def: "Pow A == {B. B <= A}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

411 
insert_def: "insert a B == {x. x=a} Un B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

412 
image_def: "f`A == {y. EX x:A. y = f(x)}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

413 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

414 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

415 
subsection {* Lemmas and proof tool setup *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

416 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

417 
subsubsection {* Relating predicates and sets *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

418 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

419 
lemma mem_Collect_eq [iff]: "(a : {x. P(x)}) = P(a)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

420 
by (simp add: Collect_def mem_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

421 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

422 
lemma Collect_mem_eq [simp]: "{x. x:A} = A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

423 
by (simp add: Collect_def mem_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

424 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

425 
lemma CollectI: "P(a) ==> a : {x. P(x)}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

426 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

427 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

428 
lemma CollectD: "a : {x. P(x)} ==> P(a)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

429 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

430 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

431 
lemma Collect_cong: "(!!x. P x = Q x) ==> {x. P(x)} = {x. Q(x)}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

432 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

433 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

434 
lemmas CollectE = CollectD [elim_format] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

435 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

436 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

437 
subsubsection {* Bounded quantifiers *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

438 

11979  439 
lemma ballI [intro!]: "(!!x. x:A ==> P x) ==> ALL x:A. P x" 
440 
by (simp add: Ball_def) 

441 

442 
lemmas strip = impI allI ballI 

443 

444 
lemma bspec [dest?]: "ALL x:A. P x ==> x:A ==> P x" 

445 
by (simp add: Ball_def) 

446 

447 
lemma ballE [elim]: "ALL x:A. P x ==> (P x ==> Q) ==> (x ~: A ==> Q) ==> Q" 

448 
by (unfold Ball_def) blast 

22139  449 

450 
ML {* bind_thm ("rev_ballE", permute_prems 1 1 @{thm ballE}) *} 

11979  451 

452 
text {* 

453 
\medskip This tactic takes assumptions @{prop "ALL x:A. P x"} and 

454 
@{prop "a:A"}; creates assumption @{prop "P a"}. 

455 
*} 

456 

457 
ML {* 

22139  458 
fun ball_tac i = etac @{thm ballE} i THEN contr_tac (i + 1) 
11979  459 
*} 
460 

461 
text {* 

462 
Gives better instantiation for bound: 

463 
*} 

464 

26339  465 
declaration {* fn _ => 
466 
Classical.map_cs (fn cs => cs addbefore ("bspec", datac @{thm bspec} 1)) 

11979  467 
*} 
468 

469 
lemma bexI [intro]: "P x ==> x:A ==> EX x:A. P x" 

470 
 {* Normally the best argument order: @{prop "P x"} constrains the 

471 
choice of @{prop "x:A"}. *} 

472 
by (unfold Bex_def) blast 

473 

13113  474 
lemma rev_bexI [intro?]: "x:A ==> P x ==> EX x:A. P x" 
11979  475 
 {* The best argument order when there is only one @{prop "x:A"}. *} 
476 
by (unfold Bex_def) blast 

477 

478 
lemma bexCI: "(ALL x:A. ~P x ==> P a) ==> a:A ==> EX x:A. P x" 

479 
by (unfold Bex_def) blast 

480 

481 
lemma bexE [elim!]: "EX x:A. P x ==> (!!x. x:A ==> P x ==> Q) ==> Q" 

482 
by (unfold Bex_def) blast 

483 

484 
lemma ball_triv [simp]: "(ALL x:A. P) = ((EX x. x:A) > P)" 

485 
 {* Trival rewrite rule. *} 

486 
by (simp add: Ball_def) 

487 

488 
lemma bex_triv [simp]: "(EX x:A. P) = ((EX x. x:A) & P)" 

489 
 {* Dual form for existentials. *} 

490 
by (simp add: Bex_def) 

491 

492 
lemma bex_triv_one_point1 [simp]: "(EX x:A. x = a) = (a:A)" 

493 
by blast 

494 

495 
lemma bex_triv_one_point2 [simp]: "(EX x:A. a = x) = (a:A)" 

496 
by blast 

497 

498 
lemma bex_one_point1 [simp]: "(EX x:A. x = a & P x) = (a:A & P a)" 

499 
by blast 

500 

501 
lemma bex_one_point2 [simp]: "(EX x:A. a = x & P x) = (a:A & P a)" 

502 
by blast 

503 

504 
lemma ball_one_point1 [simp]: "(ALL x:A. x = a > P x) = (a:A > P a)" 

505 
by blast 

506 

507 
lemma ball_one_point2 [simp]: "(ALL x:A. a = x > P x) = (a:A > P a)" 

508 
by blast 

509 

26480  510 
ML {* 
13462  511 
local 
22139  512 
val unfold_bex_tac = unfold_tac @{thms "Bex_def"}; 
18328  513 
fun prove_bex_tac ss = unfold_bex_tac ss THEN Quantifier1.prove_one_point_ex_tac; 
11979  514 
val rearrange_bex = Quantifier1.rearrange_bex prove_bex_tac; 
515 

22139  516 
val unfold_ball_tac = unfold_tac @{thms "Ball_def"}; 
18328  517 
fun prove_ball_tac ss = unfold_ball_tac ss THEN Quantifier1.prove_one_point_all_tac; 
11979  518 
val rearrange_ball = Quantifier1.rearrange_ball prove_ball_tac; 
519 
in 

18328  520 
val defBEX_regroup = Simplifier.simproc (the_context ()) 
13462  521 
"defined BEX" ["EX x:A. P x & Q x"] rearrange_bex; 
18328  522 
val defBALL_regroup = Simplifier.simproc (the_context ()) 
13462  523 
"defined BALL" ["ALL x:A. P x > Q x"] rearrange_ball; 
11979  524 
end; 
13462  525 

526 
Addsimprocs [defBALL_regroup, defBEX_regroup]; 

11979  527 
*} 
528 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

529 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

530 
subsubsection {* Congruence rules *} 
11979  531 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

532 
lemma ball_cong: 
11979  533 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 
534 
(ALL x:A. P x) = (ALL x:B. Q x)" 

535 
by (simp add: Ball_def) 

536 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

537 
lemma strong_ball_cong [cong]: 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

538 
"A = B ==> (!!x. x:B =simp=> P x = Q x) ==> 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

539 
(ALL x:A. P x) = (ALL x:B. Q x)" 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

540 
by (simp add: simp_implies_def Ball_def) 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

541 

1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

542 
lemma bex_cong: 
11979  543 
"A = B ==> (!!x. x:B ==> P x = Q x) ==> 
544 
(EX x:A. P x) = (EX x:B. Q x)" 

545 
by (simp add: Bex_def cong: conj_cong) 

1273  546 

16636
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

547 
lemma strong_bex_cong [cong]: 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

548 
"A = B ==> (!!x. x:B =simp=> P x = Q x) ==> 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

549 
(EX x:A. P x) = (EX x:B. Q x)" 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

550 
by (simp add: simp_implies_def Bex_def cong: conj_cong) 
1ed737a98198
Added strong_ball_cong and strong_bex_cong (these are now the standard
berghofe
parents:
15950
diff
changeset

551 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

552 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

553 
subsubsection {* Subsets *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

554 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

555 
lemma subsetI [atp,intro!]: "(!!x. x:A ==> x:B) ==> A \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

556 
by (auto simp add: mem_def intro: predicate1I) 
30352  557 

11979  558 
text {* 
30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

559 
\medskip Map the type @{text "'a set => anything"} to just @{typ 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

560 
'a}; for overloading constants whose first argument has type @{typ 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

561 
"'a set"}. 
11979  562 
*} 
563 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

564 
lemma subsetD [elim]: "A \<subseteq> B ==> c \<in> A ==> c \<in> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

565 
 {* Rule in Modus Ponens style. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

566 
by (unfold mem_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

567 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

568 
declare subsetD [intro?]  FIXME 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

569 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

570 
lemma rev_subsetD: "c \<in> A ==> A \<subseteq> B ==> c \<in> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

571 
 {* The same, with reversed premises for use with @{text erule}  
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

572 
cf @{text rev_mp}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

573 
by (rule subsetD) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

574 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

575 
declare rev_subsetD [intro?]  FIXME 
11979  576 

577 
text {* 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

578 
\medskip Converts @{prop "A \<subseteq> B"} to @{prop "x \<in> A ==> x \<in> B"}. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

579 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

580 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

581 
ML {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

582 
fun impOfSubs th = th RSN (2, @{thm rev_subsetD}) 
11979  583 
*} 
584 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

585 
lemma subsetCE [elim]: "A \<subseteq> B ==> (c \<notin> A ==> P) ==> (c \<in> B ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

586 
 {* Classical elimination rule. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

587 
by (unfold mem_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

588 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

589 
lemma subset_eq: "A \<le> B = (\<forall>x\<in>A. x \<in> B)" by blast 
2388  590 

11979  591 
text {* 
30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

592 
\medskip Takes assumptions @{prop "A \<subseteq> B"}; @{prop "c \<in> A"} and 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

593 
creates the assumption @{prop "c \<in> B"}. 
30352  594 
*} 
595 

596 
ML {* 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

597 
fun set_mp_tac i = etac @{thm subsetCE} i THEN mp_tac i 
11979  598 
*} 
599 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

600 
lemma contra_subsetD: "A \<subseteq> B ==> c \<notin> B ==> c \<notin> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

601 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

602 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

603 
lemma subset_refl [simp,atp]: "A \<subseteq> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

604 
by fast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

605 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

606 
lemma subset_trans: "A \<subseteq> B ==> B \<subseteq> C ==> A \<subseteq> C" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

607 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

608 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

609 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

610 
subsubsection {* Equality *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

611 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

612 
lemma set_ext: assumes prem: "(!!x. (x:A) = (x:B))" shows "A = B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

613 
apply (rule prem [THEN ext, THEN arg_cong, THEN box_equals]) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

614 
apply (rule Collect_mem_eq) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

615 
apply (rule Collect_mem_eq) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

616 
done 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

617 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

618 
(* Due to Brian Huffman *) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

619 
lemma expand_set_eq: "(A = B) = (ALL x. (x:A) = (x:B))" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

620 
by(auto intro:set_ext) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

621 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

622 
lemma subset_antisym [intro!]: "A \<subseteq> B ==> B \<subseteq> A ==> A = B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

623 
 {* Antisymmetry of the subset relation. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

624 
by (iprover intro: set_ext subsetD) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

625 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

626 
lemmas equalityI [intro!] = subset_antisym 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

627 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

628 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

629 
\medskip Equality rules from ZF set theory  are they appropriate 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

630 
here? 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

631 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

632 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

633 
lemma equalityD1: "A = B ==> A \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

634 
by (simp add: subset_refl) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

635 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

636 
lemma equalityD2: "A = B ==> B \<subseteq> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

637 
by (simp add: subset_refl) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

638 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

639 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

640 
\medskip Be careful when adding this to the claset as @{text 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

641 
subset_empty} is in the simpset: @{prop "A = {}"} goes to @{prop "{} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

642 
\<subseteq> A"} and @{prop "A \<subseteq> {}"} and then back to @{prop "A = {}"}! 
30352  643 
*} 
644 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

645 
lemma equalityE: "A = B ==> (A \<subseteq> B ==> B \<subseteq> A ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

646 
by (simp add: subset_refl) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

647 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

648 
lemma equalityCE [elim]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

649 
"A = B ==> (c \<in> A ==> c \<in> B ==> P) ==> (c \<notin> A ==> c \<notin> B ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

650 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

651 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

652 
lemma eqset_imp_iff: "A = B ==> (x : A) = (x : B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

653 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

654 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

655 
lemma eqelem_imp_iff: "x = y ==> (x : A) = (y : A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

656 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

657 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

658 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

659 
subsubsection {* The universal set  UNIV *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

660 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

661 
lemma UNIV_I [simp]: "x : UNIV" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

662 
by (simp add: UNIV_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

663 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

664 
declare UNIV_I [intro]  {* unsafe makes it less likely to cause problems *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

665 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

666 
lemma UNIV_witness [intro?]: "EX x. x : UNIV" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

667 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

668 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

669 
lemma subset_UNIV [simp]: "A \<subseteq> UNIV" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

670 
by (rule subsetI) (rule UNIV_I) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

671 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

672 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

673 
\medskip Etacontracting these two rules (to remove @{text P}) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

674 
causes them to be ignored because of their interaction with 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

675 
congruence rules. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

676 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

677 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

678 
lemma ball_UNIV [simp]: "Ball UNIV P = All P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

679 
by (simp add: Ball_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

680 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

681 
lemma bex_UNIV [simp]: "Bex UNIV P = Ex P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

682 
by (simp add: Bex_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

683 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

684 
lemma UNIV_eq_I: "(\<And>x. x \<in> A) \<Longrightarrow> UNIV = A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

685 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

686 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

687 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

688 
subsubsection {* The empty set *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

689 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

690 
lemma empty_iff [simp]: "(c : {}) = False" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

691 
by (simp add: empty_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

692 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

693 
lemma emptyE [elim!]: "a : {} ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

694 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

695 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

696 
lemma empty_subsetI [iff]: "{} \<subseteq> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

697 
 {* One effect is to delete the ASSUMPTION @{prop "{} <= A"} *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

698 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

699 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

700 
lemma equals0I: "(!!y. y \<in> A ==> False) ==> A = {}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

701 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

702 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

703 
lemma equals0D: "A = {} ==> a \<notin> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

704 
 {* Use for reasoning about disjointness: @{prop "A Int B = {}"} *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

705 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

706 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

707 
lemma ball_empty [simp]: "Ball {} P = True" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

708 
by (simp add: Ball_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

709 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

710 
lemma bex_empty [simp]: "Bex {} P = False" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

711 
by (simp add: Bex_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

712 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

713 
lemma UNIV_not_empty [iff]: "UNIV ~= {}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

714 
by (blast elim: equalityE) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

715 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

716 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

717 
subsubsection {* The Powerset operator  Pow *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

718 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

719 
lemma Pow_iff [iff]: "(A \<in> Pow B) = (A \<subseteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

720 
by (simp add: Pow_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

721 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

722 
lemma PowI: "A \<subseteq> B ==> A \<in> Pow B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

723 
by (simp add: Pow_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

724 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

725 
lemma PowD: "A \<in> Pow B ==> A \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

726 
by (simp add: Pow_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

727 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

728 
lemma Pow_bottom: "{} \<in> Pow B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

729 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

730 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

731 
lemma Pow_top: "A \<in> Pow A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

732 
by (simp add: subset_refl) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

733 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

734 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

735 
subsubsection {* Set complement *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

736 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

737 
lemma Compl_iff [simp]: "(c \<in> A) = (c \<notin> A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

738 
by (simp add: mem_def fun_Compl_def bool_Compl_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

739 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

740 
lemma ComplI [intro!]: "(c \<in> A ==> False) ==> c \<in> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

741 
by (unfold mem_def fun_Compl_def bool_Compl_def) blast 
923  742 

11979  743 
text {* 
30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

744 
\medskip This form, with negated conclusion, works well with the 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

745 
Classical prover. Negated assumptions behave like formulae on the 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

746 
right side of the notional turnstile ... *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

747 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

748 
lemma ComplD [dest!]: "c : A ==> c~:A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

749 
by (simp add: mem_def fun_Compl_def bool_Compl_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

750 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

751 
lemmas ComplE = ComplD [elim_format] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

752 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

753 
lemma Compl_eq: " A = {x. ~ x : A}" by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

754 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

755 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

756 
subsubsection {* Binary union  Un *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

757 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

758 
lemma Un_iff [simp]: "(c : A Un B) = (c:A  c:B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

759 
by (unfold Un_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

760 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

761 
lemma UnI1 [elim?]: "c:A ==> c : A Un B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

762 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

763 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

764 
lemma UnI2 [elim?]: "c:B ==> c : A Un B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

765 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

766 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

767 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

768 
\medskip Classical introduction rule: no commitment to @{prop A} vs 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

769 
@{prop B}. 
11979  770 
*} 
771 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

772 
lemma UnCI [intro!]: "(c~:B ==> c:A) ==> c : A Un B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

773 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

774 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

775 
lemma UnE [elim!]: "c : A Un B ==> (c:A ==> P) ==> (c:B ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

776 
by (unfold Un_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

777 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

778 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

779 
subsubsection {* Binary intersection  Int *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

780 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

781 
lemma Int_iff [simp]: "(c : A Int B) = (c:A & c:B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

782 
by (unfold Int_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

783 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

784 
lemma IntI [intro!]: "c:A ==> c:B ==> c : A Int B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

785 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

786 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

787 
lemma IntD1: "c : A Int B ==> c:A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

788 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

789 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

790 
lemma IntD2: "c : A Int B ==> c:B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

791 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

792 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

793 
lemma IntE [elim!]: "c : A Int B ==> (c:A ==> c:B ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

794 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

795 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

796 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

797 
subsubsection {* Set difference *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

798 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

799 
lemma Diff_iff [simp]: "(c : A  B) = (c:A & c~:B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

800 
by (simp add: mem_def fun_diff_def bool_diff_def) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

801 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

802 
lemma DiffI [intro!]: "c : A ==> c ~: B ==> c : A  B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

803 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

804 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

805 
lemma DiffD1: "c : A  B ==> c : A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

806 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

807 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

808 
lemma DiffD2: "c : A  B ==> c : B ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

809 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

810 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

811 
lemma DiffE [elim!]: "c : A  B ==> (c:A ==> c~:B ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

812 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

813 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

814 
lemma set_diff_eq: "A  B = {x. x : A & ~ x : B}" by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

815 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

816 
lemma Compl_eq_Diff_UNIV: "A = (UNIV  A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

817 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

818 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

819 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

820 
subsubsection {* Augmenting a set  insert *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

821 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

822 
lemma insert_iff [simp]: "(a : insert b A) = (a = b  a:A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

823 
by (unfold insert_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

824 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

825 
lemma insertI1: "a : insert a B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

826 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

827 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

828 
lemma insertI2: "a : B ==> a : insert b B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

829 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

830 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

831 
lemma insertE [elim!]: "a : insert b A ==> (a = b ==> P) ==> (a:A ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

832 
by (unfold insert_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

833 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

834 
lemma insertCI [intro!]: "(a~:B ==> a = b) ==> a: insert b B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

835 
 {* Classical introduction rule. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

836 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

837 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

838 
lemma subset_insert_iff: "(A \<subseteq> insert x B) = (if x:A then A  {x} \<subseteq> B else A \<subseteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

839 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

840 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

841 
lemma set_insert: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

842 
assumes "x \<in> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

843 
obtains B where "A = insert x B" and "x \<notin> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

844 
proof 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

845 
from assms show "A = insert x (A  {x})" by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

846 
next 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

847 
show "x \<notin> A  {x}" by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

848 
qed 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

849 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

850 
lemma insert_ident: "x ~: A ==> x ~: B ==> (insert x A = insert x B) = (A = B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

851 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

852 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

853 
subsubsection {* Singletons, using insert *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

854 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

855 
lemma singletonI [intro!,noatp]: "a : {a}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

856 
 {* Redundant? But unlike @{text insertCI}, it proves the subgoal immediately! *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

857 
by (rule insertI1) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

858 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

859 
lemma singletonD [dest!,noatp]: "b : {a} ==> b = a" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

860 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

861 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

862 
lemmas singletonE = singletonD [elim_format] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

863 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

864 
lemma singleton_iff: "(b : {a}) = (b = a)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

865 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

866 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

867 
lemma singleton_inject [dest!]: "{a} = {b} ==> a = b" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

868 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

869 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

870 
lemma singleton_insert_inj_eq [iff,noatp]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

871 
"({b} = insert a A) = (a = b & A \<subseteq> {b})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

872 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

873 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

874 
lemma singleton_insert_inj_eq' [iff,noatp]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

875 
"(insert a A = {b}) = (a = b & A \<subseteq> {b})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

876 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

877 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

878 
lemma subset_singletonD: "A \<subseteq> {x} ==> A = {}  A = {x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

879 
by fast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

880 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

881 
lemma singleton_conv [simp]: "{x. x = a} = {a}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

882 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

883 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

884 
lemma singleton_conv2 [simp]: "{x. a = x} = {a}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

885 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

886 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

887 
lemma diff_single_insert: "A  {x} \<subseteq> B ==> x \<in> A ==> A \<subseteq> insert x B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

888 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

889 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

890 
lemma doubleton_eq_iff: "({a,b} = {c,d}) = (a=c & b=d  a=d & b=c)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

891 
by (blast elim: equalityE) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

892 

11979  893 

894 
subsubsection {* Unions of families *} 

895 

896 
text {* 

897 
@{term [source] "UN x:A. B x"} is @{term "Union (B`A)"}. 

898 
*} 

899 

24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

900 
declare UNION_def [noatp] 
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

901 

11979  902 
lemma UN_iff [simp]: "(b: (UN x:A. B x)) = (EX x:A. b: B x)" 
903 
by (unfold UNION_def) blast 

904 

905 
lemma UN_I [intro]: "a:A ==> b: B a ==> b: (UN x:A. B x)" 

906 
 {* The order of the premises presupposes that @{term A} is rigid; 

907 
@{term b} may be flexible. *} 

908 
by auto 

909 

910 
lemma UN_E [elim!]: "b : (UN x:A. B x) ==> (!!x. x:A ==> b: B x ==> R) ==> R" 

911 
by (unfold UNION_def) blast 

923  912 

11979  913 
lemma UN_cong [cong]: 
914 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)" 

915 
by (simp add: UNION_def) 

916 

29691  917 
lemma strong_UN_cong: 
918 
"A = B ==> (!!x. x:B =simp=> C x = D x) ==> (UN x:A. C x) = (UN x:B. D x)" 

919 
by (simp add: UNION_def simp_implies_def) 

920 

11979  921 

922 
subsubsection {* Intersections of families *} 

923 

924 
text {* @{term [source] "INT x:A. B x"} is @{term "Inter (B`A)"}. *} 

925 

926 
lemma INT_iff [simp]: "(b: (INT x:A. B x)) = (ALL x:A. b: B x)" 

927 
by (unfold INTER_def) blast 

923  928 

11979  929 
lemma INT_I [intro!]: "(!!x. x:A ==> b: B x) ==> b : (INT x:A. B x)" 
930 
by (unfold INTER_def) blast 

931 

932 
lemma INT_D [elim]: "b : (INT x:A. B x) ==> a:A ==> b: B a" 

933 
by auto 

934 

935 
lemma INT_E [elim]: "b : (INT x:A. B x) ==> (b: B a ==> R) ==> (a~:A ==> R) ==> R" 

936 
 {* "Classical" elimination  by the Excluded Middle on @{prop "a:A"}. *} 

937 
by (unfold INTER_def) blast 

938 

939 
lemma INT_cong [cong]: 

940 
"A = B ==> (!!x. x:B ==> C x = D x) ==> (INT x:A. C x) = (INT x:B. D x)" 

941 
by (simp add: INTER_def) 

7238
36e58620ffc8
replaced HOL_quantifiers flag by "HOL" print mode;
wenzelm
parents:
5931
diff
changeset

942 

923  943 

11979  944 
subsubsection {* Union *} 
945 

24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

946 
lemma Union_iff [simp,noatp]: "(A : Union C) = (EX X:C. A:X)" 
11979  947 
by (unfold Union_def) blast 
948 

949 
lemma UnionI [intro]: "X:C ==> A:X ==> A : Union C" 

950 
 {* The order of the premises presupposes that @{term C} is rigid; 

951 
@{term A} may be flexible. *} 

952 
by auto 

953 

954 
lemma UnionE [elim!]: "A : Union C ==> (!!X. A:X ==> X:C ==> R) ==> R" 

955 
by (unfold Union_def) blast 

956 

957 

958 
subsubsection {* Inter *} 

959 

24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

960 
lemma Inter_iff [simp,noatp]: "(A : Inter C) = (ALL X:C. A:X)" 
11979  961 
by (unfold Inter_def) blast 
962 

963 
lemma InterI [intro!]: "(!!X. X:C ==> A:X) ==> A : Inter C" 

964 
by (simp add: Inter_def) 

965 

966 
text {* 

967 
\medskip A ``destruct'' rule  every @{term X} in @{term C} 

968 
contains @{term A} as an element, but @{prop "A:X"} can hold when 

969 
@{prop "X:C"} does not! This rule is analogous to @{text spec}. 

970 
*} 

971 

972 
lemma InterD [elim]: "A : Inter C ==> X:C ==> A:X" 

973 
by auto 

974 

975 
lemma InterE [elim]: "A : Inter C ==> (X~:C ==> R) ==> (A:X ==> R) ==> R" 

976 
 {* ``Classical'' elimination rule  does not require proving 

977 
@{prop "X:C"}. *} 

978 
by (unfold Inter_def) blast 

979 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

980 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

981 
\medskip Image of a set under a function. Frequently @{term b} does 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

982 
not have the syntactic form of @{term "f x"}. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

983 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

984 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

985 
declare image_def [noatp] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

986 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

987 
lemma image_eqI [simp, intro]: "b = f x ==> x:A ==> b : f`A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

988 
by (unfold image_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

989 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

990 
lemma imageI: "x : A ==> f x : f ` A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

991 
by (rule image_eqI) (rule refl) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

992 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

993 
lemma rev_image_eqI: "x:A ==> b = f x ==> b : f`A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

994 
 {* This version's more effective when we already have the 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

995 
required @{term x}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

996 
by (unfold image_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

997 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

998 
lemma imageE [elim!]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

999 
"b : (%x. f x)`A ==> (!!x. b = f x ==> x:A ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1000 
 {* The etaexpansion gives variablename preservation. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1001 
by (unfold image_def) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1002 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1003 
lemma image_Un: "f`(A Un B) = f`A Un f`B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1004 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1005 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1006 
lemma image_eq_UN: "f`A = (UN x:A. {f x})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1007 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1008 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1009 
lemma image_iff: "(z : f`A) = (EX x:A. z = f x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1010 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1011 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1012 
lemma image_subset_iff: "(f`A \<subseteq> B) = (\<forall>x\<in>A. f x \<in> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1013 
 {* This rewrite rule would confuse users if made default. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1014 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1015 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1016 
lemma subset_image_iff: "(B \<subseteq> f`A) = (EX AA. AA \<subseteq> A & B = f`AA)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1017 
apply safe 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1018 
prefer 2 apply fast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1019 
apply (rule_tac x = "{a. a : A & f a : B}" in exI, fast) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1020 
done 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1021 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1022 
lemma image_subsetI: "(!!x. x \<in> A ==> f x \<in> B) ==> f`A \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1023 
 {* Replaces the three steps @{text subsetI}, @{text imageE}, 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1024 
@{text hypsubst}, but breaks too many existing proofs. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1025 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1026 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1027 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1028 
\medskip Range of a function  just a translation for image! 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1029 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1030 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1031 
lemma range_eqI: "b = f x ==> b \<in> range f" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1032 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1033 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1034 
lemma rangeI: "f x \<in> range f" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1035 
by simp 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1036 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1037 
lemma rangeE [elim?]: "b \<in> range (\<lambda>x. f x) ==> (!!x. b = f x ==> P) ==> P" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1038 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1039 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1040 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1041 
subsubsection {* Set reasoning tools *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1042 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1043 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1044 
Rewrite rules for boolean casesplitting: faster than @{text 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1045 
"split_if [split]"}. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1046 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1047 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1048 
lemma split_if_eq1: "((if Q then x else y) = b) = ((Q > x = b) & (~ Q > y = b))" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1049 
by (rule split_if) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1050 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1051 
lemma split_if_eq2: "(a = (if Q then x else y)) = ((Q > a = x) & (~ Q > a = y))" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1052 
by (rule split_if) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1053 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1054 
text {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1055 
Split ifs on either side of the membership relation. Not for @{text 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1056 
"[simp]"}  can cause goals to blow up! 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1057 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1058 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1059 
lemma split_if_mem1: "((if Q then x else y) : b) = ((Q > x : b) & (~ Q > y : b))" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1060 
by (rule split_if) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1061 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1062 
lemma split_if_mem2: "(a : (if Q then x else y)) = ((Q > a : x) & (~ Q > a : y))" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1063 
by (rule split_if [where P="%S. a : S"]) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1064 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1065 
lemmas split_ifs = if_bool_eq_conj split_if_eq1 split_if_eq2 split_if_mem1 split_if_mem2 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1066 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1067 
lemmas mem_simps = 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1068 
insert_iff empty_iff Un_iff Int_iff Compl_iff Diff_iff 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1069 
mem_Collect_eq UN_iff Union_iff INT_iff Inter_iff 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1070 
 {* Each of these has ALREADY been added @{text "[simp]"} above. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1071 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1072 
(*Would like to add these, but the existing code only searches for the 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1073 
outerlevel constant, which in this case is just "op :"; we instead need 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1074 
to use termnets to associate patterns with rules. Also, if a rule fails to 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1075 
apply, then the formula should be kept. 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1076 
[("HOL.uminus", Compl_iff RS iffD1), ("HOL.minus", [Diff_iff RS iffD1]), 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1077 
("Int", [IntD1,IntD2]), 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1078 
("Collect", [CollectD]), ("Inter", [InterD]), ("INTER", [INT_D])] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1079 
*) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1080 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1081 
ML {* 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1082 
val mksimps_pairs = [(@{const_name Ball}, @{thms bspec})] @ mksimps_pairs; 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1083 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1084 
declaration {* fn _ => 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1085 
Simplifier.map_ss (fn ss => ss setmksimps (mksimps mksimps_pairs)) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1086 
*} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1087 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1088 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1089 
subsubsection {* The ``proper subset'' relation *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1090 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1091 
lemma psubsetI [intro!,noatp]: "A \<subseteq> B ==> A \<noteq> B ==> A \<subset> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1092 
by (unfold less_le) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1093 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1094 
lemma psubsetE [elim!,noatp]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1095 
"[A \<subset> B; [A \<subseteq> B; ~ (B\<subseteq>A)] ==> R] ==> R" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1096 
by (unfold less_le) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1097 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1098 
lemma psubset_insert_iff: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1099 
"(A \<subset> insert x B) = (if x \<in> B then A \<subset> B else if x \<in> A then A  {x} \<subset> B else A \<subseteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1100 
by (auto simp add: less_le subset_insert_iff) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1101 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1102 
lemma psubset_eq: "(A \<subset> B) = (A \<subseteq> B & A \<noteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1103 
by (simp only: less_le) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1104 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1105 
lemma psubset_imp_subset: "A \<subset> B ==> A \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1106 
by (simp add: psubset_eq) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1107 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1108 
lemma psubset_trans: "[ A \<subset> B; B \<subset> C ] ==> A \<subset> C" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1109 
apply (unfold less_le) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1110 
apply (auto dest: subset_antisym) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1111 
done 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1112 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1113 
lemma psubsetD: "[ A \<subset> B; c \<in> A ] ==> c \<in> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1114 
apply (unfold less_le) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1115 
apply (auto dest: subsetD) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1116 
done 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1117 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1118 
lemma psubset_subset_trans: "A \<subset> B ==> B \<subseteq> C ==> A \<subset> C" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1119 
by (auto simp add: psubset_eq) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1120 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1121 
lemma subset_psubset_trans: "A \<subseteq> B ==> B \<subset> C ==> A \<subset> C" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1122 
by (auto simp add: psubset_eq) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1123 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1124 
lemma psubset_imp_ex_mem: "A \<subset> B ==> \<exists>b. b \<in> (B  A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1125 
by (unfold less_le) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1126 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1127 
lemma atomize_ball: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1128 
"(!!x. x \<in> A ==> P x) == Trueprop (\<forall>x\<in>A. P x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1129 
by (simp only: Ball_def atomize_all atomize_imp) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1130 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1131 
lemmas [symmetric, rulify] = atomize_ball 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1132 
and [symmetric, defn] = atomize_ball 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1133 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1134 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1135 
subsection {* Further settheory lemmas *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1136 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1137 
subsubsection {* Derived rules involving subsets. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1138 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1139 
text {* @{text insert}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1140 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1141 
lemma subset_insertI: "B \<subseteq> insert a B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1142 
by (rule subsetI) (erule insertI2) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1143 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1144 
lemma subset_insertI2: "A \<subseteq> B \<Longrightarrow> A \<subseteq> insert b B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1145 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1146 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1147 
lemma subset_insert: "x \<notin> A ==> (A \<subseteq> insert x B) = (A \<subseteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1148 
by blast 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1149 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1150 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1151 
text {* \medskip Big Union  least upper bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1152 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1153 
lemma Union_upper: "B \<in> A ==> B \<subseteq> Union A" 
17589  1154 
by (iprover intro: subsetI UnionI) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1155 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1156 
lemma Union_least: "(!!X. X \<in> A ==> X \<subseteq> C) ==> Union A \<subseteq> C" 
17589  1157 
by (iprover intro: subsetI elim: UnionE dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1158 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1159 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1160 
text {* \medskip General union. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1161 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1162 
lemma UN_upper: "a \<in> A ==> B a \<subseteq> (\<Union>x\<in>A. B x)" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1163 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1164 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1165 
lemma UN_least: "(!!x. x \<in> A ==> B x \<subseteq> C) ==> (\<Union>x\<in>A. B x) \<subseteq> C" 
17589  1166 
by (iprover intro: subsetI elim: UN_E dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1167 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1168 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1169 
text {* \medskip Big Intersection  greatest lower bound of a set. *} 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1170 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1171 
lemma Inter_lower: "B \<in> A ==> Inter A \<subseteq> B" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1172 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1173 

14551  1174 
lemma Inter_subset: 
1175 
"[ !!X. X \<in> A ==> X \<subseteq> B; A ~= {} ] ==> \<Inter>A \<subseteq> B" 

1176 
by blast 

1177 

12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1178 
lemma Inter_greatest: "(!!X. X \<in> A ==> C \<subseteq> X) ==> C \<subseteq> Inter A" 
17589  1179 
by (iprover intro: InterI subsetI dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1180 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1181 
lemma INT_lower: "a \<in> A ==> (\<Inter>x\<in>A. B x) \<subseteq> B a" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1182 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1183 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1184 
lemma INT_greatest: "(!!x. x \<in> A ==> C \<subseteq> B x) ==> C \<subseteq> (\<Inter>x\<in>A. B x)" 
17589  1185 
by (iprover intro: INT_I subsetI dest: subsetD) 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1186 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1187 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1188 
text {* \medskip Finite Union  the least upper bound of two sets. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1189 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1190 
lemma Un_upper1: "A \<subseteq> A \<union> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1191 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1192 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1193 
lemma Un_upper2: "B \<subseteq> A \<union> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1194 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1195 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1196 
lemma Un_least: "A \<subseteq> C ==> B \<subseteq> C ==> A \<union> B \<subseteq> C" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1197 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1198 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1199 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1200 
text {* \medskip Finite Intersection  the greatest lower bound of two sets. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1201 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1202 
lemma Int_lower1: "A \<inter> B \<subseteq> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1203 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1204 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1205 
lemma Int_lower2: "A \<inter> B \<subseteq> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1206 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1207 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1208 
lemma Int_greatest: "C \<subseteq> A ==> C \<subseteq> B ==> C \<subseteq> A \<inter> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1209 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1210 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1211 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1212 
text {* \medskip Set difference. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1213 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1214 
lemma Diff_subset: "A  B \<subseteq> A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1215 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1216 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1217 
lemma Diff_subset_conv: "(A  B \<subseteq> C) = (A \<subseteq> B \<union> C)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1218 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1219 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1220 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1221 
subsubsection {* Equalities involving union, intersection, inclusion, etc. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1222 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1223 
text {* @{text "{}"}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1224 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1225 
lemma Collect_const [simp]: "{s. P} = (if P then UNIV else {})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1226 
 {* supersedes @{text "Collect_False_empty"} *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1227 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1228 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1229 
lemma subset_empty [simp]: "(A \<subseteq> {}) = (A = {})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1230 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1231 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1232 
lemma not_psubset_empty [iff]: "\<not> (A < {})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1233 
by (unfold less_le) blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1234 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1235 
lemma Collect_empty_eq [simp]: "(Collect P = {}) = (\<forall>x. \<not> P x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1236 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1237 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1238 
lemma empty_Collect_eq [simp]: "({} = Collect P) = (\<forall>x. \<not> P x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1239 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1240 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1241 
lemma Collect_neg_eq: "{x. \<not> P x} =  {x. P x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1242 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1243 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1244 
lemma Collect_disj_eq: "{x. P x  Q x} = {x. P x} \<union> {x. Q x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1245 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1246 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1247 
lemma Collect_imp_eq: "{x. P x > Q x} = {x. P x} \<union> {x. Q x}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1248 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1249 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1250 
lemma Collect_conj_eq: "{x. P x & Q x} = {x. P x} \<inter> {x. Q x}" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1251 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1252 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1253 
lemma Collect_all_eq: "{x. \<forall>y. P x y} = (\<Inter>y. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1254 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1255 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1256 
lemma Collect_ball_eq: "{x. \<forall>y\<in>A. P x y} = (\<Inter>y\<in>A. {x. P x y})" 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1257 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1258 

24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

1259 
lemma Collect_ex_eq [noatp]: "{x. \<exists>y. P x y} = (\<Union>y. {x. P x y})" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1260 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1261 

24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
24280
diff
changeset

1262 
lemma Collect_bex_eq [noatp]: "{x. \<exists>y\<in>A. P x y} = (\<Union>y\<in>A. {x. P x y})" 
12897
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1263 
by blast 
f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1264 

f4d10ad0ea7b
converted/deleted equalities.ML, mono.ML, subset.ML (see Set.thy);
wenzelm
parents:
12633
diff
changeset

1265 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1266 
text {* \medskip @{text insert}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1267 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1268 
lemma insert_is_Un: "insert a A = {a} Un A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1269 
 {* NOT SUITABLE FOR REWRITING since @{text "{a} == insert a {}"} *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1270 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1271 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1272 
lemma insert_not_empty [simp]: "insert a A \<noteq> {}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1273 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1274 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1275 
lemmas empty_not_insert = insert_not_empty [symmetric, standard] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1276 
declare empty_not_insert [simp] 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1277 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1278 
lemma insert_absorb: "a \<in> A ==> insert a A = A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1279 
 {* @{text "[simp]"} causes recursive calls when there are nested inserts *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1280 
 {* with \emph{quadratic} running time *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1281 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1282 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1283 
lemma insert_absorb2 [simp]: "insert x (insert x A) = insert x A" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1284 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1285 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1286 
lemma insert_commute: "insert x (insert y A) = insert y (insert x A)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1287 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1288 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1289 
lemma insert_subset [simp]: "(insert x A \<subseteq> B) = (x \<in> B & A \<subseteq> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1290 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1291 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1292 
lemma mk_disjoint_insert: "a \<in> A ==> \<exists>B. A = insert a B & a \<notin> B" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1293 
 {* use new @{text B} rather than @{text "A  {a}"} to avoid infinite unfolding *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1294 
apply (rule_tac x = "A  {a}" in exI, blast) 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1295 
done 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1296 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1297 
lemma insert_Collect: "insert a (Collect P) = {u. u \<noteq> a > P u}" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1298 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1299 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1300 
lemma UN_insert_distrib: "u \<in> A ==> (\<Union>x\<in>A. insert a (B x)) = insert a (\<Union>x\<in>A. B x)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1301 
by blast 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1302 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1303 
lemma insert_inter_insert[simp]: "insert a A \<inter> insert a B = insert a (A \<inter> B)" 
14742  1304 
by blast 
14302  1305 

30531
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1306 
lemma insert_disjoint [simp,noatp]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1307 
"(insert a A \<inter> B = {}) = (a \<notin> B \<and> A \<inter> B = {})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1308 
"({} = insert a A \<inter> B) = (a \<notin> B \<and> {} = A \<inter> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1309 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1310 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1311 
lemma disjoint_insert [simp,noatp]: 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1312 
"(B \<inter> insert a A = {}) = (a \<notin> B \<and> B \<inter> A = {})" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1313 
"({} = A \<inter> insert b B) = (b \<notin> A \<and> {} = A \<inter> B)" 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1314 
by auto 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1315 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1316 
text {* \medskip @{text image}. *} 
ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1317 

ab3d61baf66a
reverted to old version of Set.thy  strange effects have to be traced first
haftmann
parents:
30352
diff
changeset

1318 
lemma image_empty [simp]: "f`{} = {}" 