author  haftmann 
Thu, 01 Mar 2012 19:34:52 +0100  
changeset 46752  e9e7209eb375 
parent 46696  28a01ea3523a 
child 46767  807a5d219c23 
permissions  rwrr 
10358  1 
(* Title: HOL/Relation.thy 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

2 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory; Stefan Berghofer, TU Muenchen 
1128
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset

3 
*) 
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset

4 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

5 
header {* Relations – as sets of pairs, and binary predicates *} 
12905  6 

15131  7 
theory Relation 
32850  8 
imports Datatype Finite_Set 
15131  9 
begin 
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset

10 

46694  11 
text {* A preliminary: classical rules for reasoning on predicates *} 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

12 

46689  13 
(* CANDIDATE declare predicate1I [Pure.intro!, intro!] *) 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

14 
declare predicate1D [Pure.dest?, dest?] 
46689  15 
(* CANDIDATE declare predicate1D [Pure.dest, dest] *) 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

16 
declare predicate2I [Pure.intro!, intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

17 
declare predicate2D [Pure.dest, dest] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

18 
declare bot1E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

19 
declare bot2E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

20 
declare top1I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

21 
declare top2I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

22 
declare inf1I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

23 
declare inf2I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

24 
declare inf1E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

25 
declare inf2E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

26 
declare sup1I1 [intro?] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

27 
declare sup2I1 [intro?] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

28 
declare sup1I2 [intro?] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

29 
declare sup2I2 [intro?] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

30 
declare sup1E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

31 
declare sup2E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

32 
declare sup1CI [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

33 
declare sup2CI [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

34 
declare INF1_I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

35 
declare INF2_I [intro!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

36 
declare INF1_D [elim] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

37 
declare INF2_D [elim] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

38 
declare INF1_E [elim] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

39 
declare INF2_E [elim] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

40 
declare SUP1_I [intro] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

41 
declare SUP2_I [intro] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

42 
declare SUP1_E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

43 
declare SUP2_E [elim!] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

44 

46694  45 
subsection {* Fundamental *} 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

46 

46694  47 
subsubsection {* Relations as sets of pairs *} 
48 

49 
type_synonym 'a rel = "('a * 'a) set" 

50 

51 
lemma subrelI:  {* Version of @{thm [source] subsetI} for binary relations *} 

52 
"(\<And>x y. (x, y) \<in> r \<Longrightarrow> (x, y) \<in> s) \<Longrightarrow> r \<subseteq> s" 

53 
by auto 

54 

55 
lemma lfp_induct2:  {* Version of @{thm [source] lfp_induct} for binary relations *} 

56 
"(a, b) \<in> lfp f \<Longrightarrow> mono f \<Longrightarrow> 

57 
(\<And>a b. (a, b) \<in> f (lfp f \<inter> {(x, y). P x y}) \<Longrightarrow> P a b) \<Longrightarrow> P a b" 

58 
using lfp_induct_set [of "(a, b)" f "prod_case P"] by auto 

59 

60 

61 
subsubsection {* Conversions between set and predicate relations *} 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

62 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

63 
lemma pred_equals_eq [pred_set_conv]: "((\<lambda>x. x \<in> R) = (\<lambda>x. x \<in> S)) \<longleftrightarrow> (R = S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

64 
by (simp add: set_eq_iff fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

65 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

66 
lemma pred_equals_eq2 [pred_set_conv]: "((\<lambda>x y. (x, y) \<in> R) = (\<lambda>x y. (x, y) \<in> S)) \<longleftrightarrow> (R = S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

67 
by (simp add: set_eq_iff fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

68 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

69 
lemma pred_subset_eq [pred_set_conv]: "((\<lambda>x. x \<in> R) \<le> (\<lambda>x. x \<in> S)) \<longleftrightarrow> (R \<subseteq> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

70 
by (simp add: subset_iff le_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

71 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

72 
lemma pred_subset_eq2 [pred_set_conv]: "((\<lambda>x y. (x, y) \<in> R) \<le> (\<lambda>x y. (x, y) \<in> S)) \<longleftrightarrow> (R \<subseteq> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

73 
by (simp add: subset_iff le_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

74 

46689  75 
lemma bot_empty_eq (* CANDIDATE [pred_set_conv] *): "\<bottom> = (\<lambda>x. x \<in> {})" 
76 
by (auto simp add: fun_eq_iff) 

77 

78 
lemma bot_empty_eq2 (* CANDIDATE [pred_set_conv] *): "\<bottom> = (\<lambda>x y. (x, y) \<in> {})" 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

79 
by (auto simp add: fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

80 

46689  81 
(* CANDIDATE lemma top_empty_eq [pred_set_conv]: "\<top> = (\<lambda>x. x \<in> UNIV)" 
82 
by (auto simp add: fun_eq_iff) *) 

83 

84 
(* CANDIDATE lemma top_empty_eq2 [pred_set_conv]: "\<top> = (\<lambda>x y. (x, y) \<in> UNIV)" 

85 
by (auto simp add: fun_eq_iff) *) 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

86 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

87 
lemma inf_Int_eq [pred_set_conv]: "(\<lambda>x. x \<in> R) \<sqinter> (\<lambda>x. x \<in> S) = (\<lambda>x. x \<in> R \<inter> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

88 
by (simp add: inf_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

89 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

90 
lemma inf_Int_eq2 [pred_set_conv]: "(\<lambda>x y. (x, y) \<in> R) \<sqinter> (\<lambda>x y. (x, y) \<in> S) = (\<lambda>x y. (x, y) \<in> R \<inter> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

91 
by (simp add: inf_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

92 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

93 
lemma sup_Un_eq [pred_set_conv]: "(\<lambda>x. x \<in> R) \<squnion> (\<lambda>x. x \<in> S) = (\<lambda>x. x \<in> R \<union> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

94 
by (simp add: sup_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

95 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

96 
lemma sup_Un_eq2 [pred_set_conv]: "(\<lambda>x y. (x, y) \<in> R) \<squnion> (\<lambda>x y. (x, y) \<in> S) = (\<lambda>x y. (x, y) \<in> R \<union> S)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

97 
by (simp add: sup_fun_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

98 

46689  99 
lemma INF_INT_eq (* CANDIDATE [pred_set_conv] *): "(\<Sqinter>i. (\<lambda>x. x \<in> r i)) = (\<lambda>x. x \<in> (\<Inter>i. r i))" 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

100 
by (simp add: INF_apply fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

101 

46689  102 
lemma INF_INT_eq2 (* CANDIDATE [pred_set_conv] *): "(\<Sqinter>i. (\<lambda>x y. (x, y) \<in> r i)) = (\<lambda>x y. (x, y) \<in> (\<Inter>i. r i))" 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

103 
by (simp add: INF_apply fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

104 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

105 
lemma SUP_UN_eq [pred_set_conv]: "(\<Squnion>i. (\<lambda>x. x \<in> r i)) = (\<lambda>x. x \<in> (\<Union>i. r i))" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

106 
by (simp add: SUP_apply fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

107 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

108 
lemma SUP_UN_eq2 [pred_set_conv]: "(\<Squnion>i. (\<lambda>x y. (x, y) \<in> r i)) = (\<lambda>x y. (x, y) \<in> (\<Union>i. r i))" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

109 
by (simp add: SUP_apply fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

110 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

111 

46694  112 
subsection {* Properties of relations *} 
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset

113 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

114 
subsubsection {* Reflexivity *} 
10786  115 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

116 
definition refl_on :: "'a set \<Rightarrow> 'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

117 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

118 
"refl_on A r \<longleftrightarrow> r \<subseteq> A \<times> A \<and> (\<forall>x\<in>A. (x, x) \<in> r)" 
6806
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents:
5978
diff
changeset

119 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

120 
abbreviation refl :: "'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

121 
where  {* reflexivity over a type *} 
45137  122 
"refl \<equiv> refl_on UNIV" 
26297  123 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

124 
definition reflp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

125 
where 
46694  126 
"reflp r \<longleftrightarrow> refl {(x, y). r x y}" 
127 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

128 
lemma reflp_refl_eq [pred_set_conv]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

129 
"reflp (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> refl r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

130 
by (simp add: refl_on_def reflp_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

131 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

132 
lemma refl_onI: "r \<subseteq> A \<times> A ==> (!!x. x : A ==> (x, x) : r) ==> refl_on A r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

133 
by (unfold refl_on_def) (iprover intro!: ballI) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

134 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

135 
lemma refl_onD: "refl_on A r ==> a : A ==> (a, a) : r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

136 
by (unfold refl_on_def) blast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

137 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

138 
lemma refl_onD1: "refl_on A r ==> (x, y) : r ==> x : A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

139 
by (unfold refl_on_def) blast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

140 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

141 
lemma refl_onD2: "refl_on A r ==> (x, y) : r ==> y : A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

142 
by (unfold refl_on_def) blast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

143 

46694  144 
lemma reflpI: 
145 
"(\<And>x. r x x) \<Longrightarrow> reflp r" 

146 
by (auto intro: refl_onI simp add: reflp_def) 

147 

148 
lemma reflpE: 

149 
assumes "reflp r" 

150 
obtains "r x x" 

151 
using assms by (auto dest: refl_onD simp add: reflp_def) 

152 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

153 
lemma refl_on_Int: "refl_on A r ==> refl_on B s ==> refl_on (A \<inter> B) (r \<inter> s)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

154 
by (unfold refl_on_def) blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

155 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

156 
lemma reflp_inf: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

157 
"reflp r \<Longrightarrow> reflp s \<Longrightarrow> reflp (r \<sqinter> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

158 
by (auto intro: reflpI elim: reflpE) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

159 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

160 
lemma refl_on_Un: "refl_on A r ==> refl_on B s ==> refl_on (A \<union> B) (r \<union> s)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

161 
by (unfold refl_on_def) blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

162 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

163 
lemma reflp_sup: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

164 
"reflp r \<Longrightarrow> reflp s \<Longrightarrow> reflp (r \<squnion> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

165 
by (auto intro: reflpI elim: reflpE) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

166 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

167 
lemma refl_on_INTER: 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

168 
"ALL x:S. refl_on (A x) (r x) ==> refl_on (INTER S A) (INTER S r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

169 
by (unfold refl_on_def) fast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

170 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

171 
lemma refl_on_UNION: 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

172 
"ALL x:S. refl_on (A x) (r x) \<Longrightarrow> refl_on (UNION S A) (UNION S r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

173 
by (unfold refl_on_def) blast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

174 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

175 
lemma refl_on_empty [simp]: "refl_on {} {}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

176 
by (simp add:refl_on_def) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

177 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

178 
lemma refl_on_def' [nitpick_unfold, code]: 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

179 
"refl_on A r \<longleftrightarrow> (\<forall>(x, y) \<in> r. x \<in> A \<and> y \<in> A) \<and> (\<forall>x \<in> A. (x, x) \<in> r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

180 
by (auto intro: refl_onI dest: refl_onD refl_onD1 refl_onD2) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

181 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

182 

46694  183 
subsubsection {* Irreflexivity *} 
6806
43c081a0858d
new preficates refl, sym [from Integ/Equiv], antisym
paulson
parents:
5978
diff
changeset

184 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

185 
definition irrefl :: "'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

186 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

187 
"irrefl r \<longleftrightarrow> (\<forall>x. (x, x) \<notin> r)" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

188 

46694  189 
lemma irrefl_distinct [code]: 
190 
"irrefl r \<longleftrightarrow> (\<forall>(x, y) \<in> r. x \<noteq> y)" 

191 
by (auto simp add: irrefl_def) 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

192 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

193 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

194 
subsubsection {* Symmetry *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

195 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

196 
definition sym :: "'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

197 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

198 
"sym r \<longleftrightarrow> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

199 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

200 
definition symp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

201 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

202 
"symp r \<longleftrightarrow> (\<forall>x y. r x y \<longrightarrow> r y x)" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

203 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

204 
lemma symp_sym_eq [pred_set_conv]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

205 
"symp (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> sym r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

206 
by (simp add: sym_def symp_def) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

207 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

208 
lemma symI: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

209 
"(\<And>a b. (a, b) \<in> r \<Longrightarrow> (b, a) \<in> r) \<Longrightarrow> sym r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

210 
by (unfold sym_def) iprover 
46694  211 

212 
lemma sympI: 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

213 
"(\<And>a b. r a b \<Longrightarrow> r b a) \<Longrightarrow> symp r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

214 
by (fact symI [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

215 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

216 
lemma symE: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

217 
assumes "sym r" and "(b, a) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

218 
obtains "(a, b) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

219 
using assms by (simp add: sym_def) 
46694  220 

221 
lemma sympE: 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

222 
assumes "symp r" and "r b a" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

223 
obtains "r a b" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

224 
using assms by (rule symE [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

225 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

226 
lemma symD: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

227 
assumes "sym r" and "(b, a) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

228 
shows "(a, b) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

229 
using assms by (rule symE) 
46694  230 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

231 
lemma sympD: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

232 
assumes "symp r" and "r b a" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

233 
shows "r a b" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

234 
using assms by (rule symD [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

235 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

236 
lemma sym_Int: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

237 
"sym r \<Longrightarrow> sym s \<Longrightarrow> sym (r \<inter> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

238 
by (fast intro: symI elim: symE) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

239 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

240 
lemma symp_inf: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

241 
"symp r \<Longrightarrow> symp s \<Longrightarrow> symp (r \<sqinter> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

242 
by (fact sym_Int [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

243 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

244 
lemma sym_Un: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

245 
"sym r \<Longrightarrow> sym s \<Longrightarrow> sym (r \<union> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

246 
by (fast intro: symI elim: symE) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

247 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

248 
lemma symp_sup: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

249 
"symp r \<Longrightarrow> symp s \<Longrightarrow> symp (r \<squnion> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

250 
by (fact sym_Un [to_pred]) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

251 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

252 
lemma sym_INTER: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

253 
"\<forall>x\<in>S. sym (r x) \<Longrightarrow> sym (INTER S r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

254 
by (fast intro: symI elim: symE) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

255 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

256 
(* FIXME thm sym_INTER [to_pred] *) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

257 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

258 
lemma sym_UNION: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

259 
"\<forall>x\<in>S. sym (r x) \<Longrightarrow> sym (UNION S r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

260 
by (fast intro: symI elim: symE) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

261 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

262 
(* FIXME thm sym_UNION [to_pred] *) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

263 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

264 

46694  265 
subsubsection {* Antisymmetry *} 
266 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

267 
definition antisym :: "'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

268 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

269 
"antisym r \<longleftrightarrow> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r \<longrightarrow> x = y)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

270 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

271 
abbreviation antisymP :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

272 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

273 
"antisymP r \<equiv> antisym {(x, y). r x y}" 
46694  274 

275 
lemma antisymI: 

276 
"(!!x y. (x, y) : r ==> (y, x) : r ==> x=y) ==> antisym r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

277 
by (unfold antisym_def) iprover 
46694  278 

279 
lemma antisymD: "antisym r ==> (a, b) : r ==> (b, a) : r ==> a = b" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

280 
by (unfold antisym_def) iprover 
46694  281 

282 
lemma antisym_subset: "r \<subseteq> s ==> antisym s ==> antisym r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

283 
by (unfold antisym_def) blast 
46694  284 

285 
lemma antisym_empty [simp]: "antisym {}" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

286 
by (unfold antisym_def) blast 
46694  287 

288 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

289 
subsubsection {* Transitivity *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

290 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

291 
definition trans :: "'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

292 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

293 
"trans r \<longleftrightarrow> (\<forall>x y z. (x, y) \<in> r \<longrightarrow> (y, z) \<in> r \<longrightarrow> (x, z) \<in> r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

294 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

295 
definition transp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

296 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

297 
"transp r \<longleftrightarrow> (\<forall>x y z. r x y \<longrightarrow> r y z \<longrightarrow> r x z)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

298 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

299 
lemma transp_trans_eq [pred_set_conv]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

300 
"transp (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> trans r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

301 
by (simp add: trans_def transp_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

302 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

303 
abbreviation transP :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

304 
where  {* FIXME drop *} 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

305 
"transP r \<equiv> trans {(x, y). r x y}" 
5978
fa2c2dd74f8c
moved diag (diagonal relation) from Univ to Relation
paulson
parents:
5608
diff
changeset

306 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

307 
lemma transI: 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

308 
"(\<And>x y z. (x, y) \<in> r \<Longrightarrow> (y, z) \<in> r \<Longrightarrow> (x, z) \<in> r) \<Longrightarrow> trans r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

309 
by (unfold trans_def) iprover 
46694  310 

311 
lemma transpI: 

312 
"(\<And>x y z. r x y \<Longrightarrow> r y z \<Longrightarrow> r x z) \<Longrightarrow> transp r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

313 
by (fact transI [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

314 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

315 
lemma transE: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

316 
assumes "trans r" and "(x, y) \<in> r" and "(y, z) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

317 
obtains "(x, z) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

318 
using assms by (unfold trans_def) iprover 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

319 

46694  320 
lemma transpE: 
321 
assumes "transp r" and "r x y" and "r y z" 

322 
obtains "r x z" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

323 
using assms by (rule transE [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

324 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

325 
lemma transD: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

326 
assumes "trans r" and "(x, y) \<in> r" and "(y, z) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

327 
shows "(x, z) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

328 
using assms by (rule transE) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

329 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

330 
lemma transpD: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

331 
assumes "transp r" and "r x y" and "r y z" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

332 
shows "r x z" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

333 
using assms by (rule transD [to_pred]) 
46694  334 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

335 
lemma trans_Int: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

336 
"trans r \<Longrightarrow> trans s \<Longrightarrow> trans (r \<inter> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

337 
by (fast intro: transI elim: transE) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

338 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

339 
lemma transp_inf: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

340 
"transp r \<Longrightarrow> transp s \<Longrightarrow> transp (r \<sqinter> s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

341 
by (fact trans_Int [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

342 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

343 
lemma trans_INTER: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

344 
"\<forall>x\<in>S. trans (r x) \<Longrightarrow> trans (INTER S r)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

345 
by (fast intro: transI elim: transD) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

346 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

347 
(* FIXME thm trans_INTER [to_pred] *) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

348 

46694  349 
lemma trans_join [code]: 
350 
"trans r \<longleftrightarrow> (\<forall>(x, y1) \<in> r. \<forall>(y2, z) \<in> r. y1 = y2 \<longrightarrow> (x, z) \<in> r)" 

351 
by (auto simp add: trans_def) 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

352 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

353 
lemma transp_trans: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

354 
"transp r \<longleftrightarrow> trans {(x, y). r x y}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

355 
by (simp add: trans_def transp_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

356 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

357 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

358 
subsubsection {* Totality *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

359 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

360 
definition total_on :: "'a set \<Rightarrow> 'a rel \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

361 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

362 
"total_on A r \<longleftrightarrow> (\<forall>x\<in>A. \<forall>y\<in>A. x \<noteq> y \<longrightarrow> (x, y) \<in> r \<or> (y, x) \<in> r)" 
29859
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset

363 

33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset

364 
abbreviation "total \<equiv> total_on UNIV" 
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset

365 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

366 
lemma total_on_empty [simp]: "total_on {} r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

367 
by (simp add: total_on_def) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

368 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

369 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

370 
subsubsection {* Single valued relations *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

371 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

372 
definition single_valued :: "('a \<times> 'b) set \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

373 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

374 
"single_valued r \<longleftrightarrow> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (\<forall>z. (x, z) \<in> r \<longrightarrow> y = z))" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

375 

46694  376 
abbreviation single_valuedP :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" where 
377 
"single_valuedP r \<equiv> single_valued {(x, y). r x y}" 

378 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

379 
lemma single_valuedI: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

380 
"ALL x y. (x,y):r > (ALL z. (x,z):r > y=z) ==> single_valued r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

381 
by (unfold single_valued_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

382 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

383 
lemma single_valuedD: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

384 
"single_valued r ==> (x, y) : r ==> (x, z) : r ==> y = z" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

385 
by (simp add: single_valued_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

386 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

387 
lemma single_valued_subset: 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

388 
"r \<subseteq> s ==> single_valued s ==> single_valued r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

389 
by (unfold single_valued_def) blast 
11136  390 

12905  391 

46694  392 
subsection {* Relation operations *} 
393 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

394 
subsubsection {* The identity relation *} 
12905  395 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

396 
definition Id :: "'a rel" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

397 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

398 
"Id = {p. \<exists>x. p = (x, x)}" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

399 

12905  400 
lemma IdI [intro]: "(a, a) : Id" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

401 
by (simp add: Id_def) 
12905  402 

403 
lemma IdE [elim!]: "p : Id ==> (!!x. p = (x, x) ==> P) ==> P" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

404 
by (unfold Id_def) (iprover elim: CollectE) 
12905  405 

406 
lemma pair_in_Id_conv [iff]: "((a, b) : Id) = (a = b)" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

407 
by (unfold Id_def) blast 
12905  408 

30198  409 
lemma refl_Id: "refl Id" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

410 
by (simp add: refl_on_def) 
12905  411 

412 
lemma antisym_Id: "antisym Id" 

413 
 {* A strange result, since @{text Id} is also symmetric. *} 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

414 
by (simp add: antisym_def) 
12905  415 

19228  416 
lemma sym_Id: "sym Id" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

417 
by (simp add: sym_def) 
19228  418 

12905  419 
lemma trans_Id: "trans Id" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

420 
by (simp add: trans_def) 
12905  421 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

422 
lemma single_valued_Id [simp]: "single_valued Id" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

423 
by (unfold single_valued_def) blast 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

424 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

425 
lemma irrefl_diff_Id [simp]: "irrefl (r  Id)" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

426 
by (simp add:irrefl_def) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

427 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

428 
lemma trans_diff_Id: "trans r \<Longrightarrow> antisym r \<Longrightarrow> trans (r  Id)" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

429 
unfolding antisym_def trans_def by blast 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

430 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

431 
lemma total_on_diff_Id [simp]: "total_on A (r  Id) = total_on A r" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

432 
by (simp add: total_on_def) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

433 

12905  434 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

435 
subsubsection {* Diagonal: identity over a set *} 
12905  436 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

437 
definition Id_on :: "'a set \<Rightarrow> 'a rel" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

438 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

439 
"Id_on A = (\<Union>x\<in>A. {(x, x)})" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

440 

30198  441 
lemma Id_on_empty [simp]: "Id_on {} = {}" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

442 
by (simp add: Id_on_def) 
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset

443 

30198  444 
lemma Id_on_eqI: "a = b ==> a : A ==> (a, b) : Id_on A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

445 
by (simp add: Id_on_def) 
12905  446 

35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset

447 
lemma Id_onI [intro!,no_atp]: "a : A ==> (a, a) : Id_on A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

448 
by (rule Id_on_eqI) (rule refl) 
12905  449 

30198  450 
lemma Id_onE [elim!]: 
451 
"c : Id_on A ==> (!!x. x : A ==> c = (x, x) ==> P) ==> P" 

12913  452 
 {* The general elimination rule. *} 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

453 
by (unfold Id_on_def) (iprover elim!: UN_E singletonE) 
12905  454 

30198  455 
lemma Id_on_iff: "((x, y) : Id_on A) = (x = y & x : A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

456 
by blast 
12905  457 

45967  458 
lemma Id_on_def' [nitpick_unfold]: 
44278
1220ecb81e8f
observe distinction between sets and predicates more properly
haftmann
parents:
41792
diff
changeset

459 
"Id_on {x. A x} = Collect (\<lambda>(x, y). x = y \<and> A x)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

460 
by auto 
40923
be80c93ac0a2
adding a nice definition of Id_on for quickcheck and nitpick
bulwahn
parents:
36772
diff
changeset

461 

30198  462 
lemma Id_on_subset_Times: "Id_on A \<subseteq> A \<times> A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

463 
by blast 
12905  464 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

465 
lemma refl_on_Id_on: "refl_on A (Id_on A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

466 
by (rule refl_onI [OF Id_on_subset_Times Id_onI]) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

467 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

468 
lemma antisym_Id_on [simp]: "antisym (Id_on A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

469 
by (unfold antisym_def) blast 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

470 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

471 
lemma sym_Id_on [simp]: "sym (Id_on A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

472 
by (rule symI) clarify 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

473 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

474 
lemma trans_Id_on [simp]: "trans (Id_on A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

475 
by (fast intro: transI elim: transD) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

476 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

477 
lemma single_valued_Id_on [simp]: "single_valued (Id_on A)" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

478 
by (unfold single_valued_def) blast 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

479 

12905  480 

46694  481 
subsubsection {* Composition *} 
12905  482 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

483 
inductive_set rel_comp :: "('a \<times> 'b) set \<Rightarrow> ('b \<times> 'c) set \<Rightarrow> ('a \<times> 'c) set" (infixr "O" 75) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

484 
for r :: "('a \<times> 'b) set" and s :: "('b \<times> 'c) set" 
46694  485 
where 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

486 
rel_compI [intro]: "(a, b) \<in> r \<Longrightarrow> (b, c) \<in> s \<Longrightarrow> (a, c) \<in> r O s" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

487 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

488 
abbreviation pred_comp (infixr "OO" 75) where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

489 
"pred_comp \<equiv> rel_compp" 
12905  490 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

491 
lemmas pred_compI = rel_compp.intros 
12905  492 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

493 
text {* 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

494 
For historic reasons, the elimination rules are not wholly corresponding. 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

495 
Feel free to consolidate this. 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

496 
*} 
46694  497 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

498 
inductive_cases rel_compEpair: "(a, c) \<in> r O s" 
46694  499 
inductive_cases pred_compE [elim!]: "(r OO s) a c" 
500 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

501 
lemma rel_compE [elim!]: "xz \<in> r O s \<Longrightarrow> 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

502 
(\<And>x y z. xz = (x, z) \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> (y, z) \<in> s \<Longrightarrow> P) \<Longrightarrow> P" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

503 
by (cases xz) (simp, erule rel_compEpair, iprover) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

504 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

505 
lemmas pred_comp_rel_comp_eq = rel_compp_rel_comp_eq 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

506 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

507 
lemma R_O_Id [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

508 
"R O Id = R" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

509 
by fast 
46694  510 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

511 
lemma Id_O_R [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

512 
"Id O R = R" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

513 
by fast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

514 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

515 
lemma rel_comp_empty1 [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

516 
"{} O R = {}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

517 
by blast 
12905  518 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

519 
(* CANDIDATE lemma pred_comp_bot1 [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

520 
"" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

521 
by (fact rel_comp_empty1 [to_pred]) *) 
12905  522 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

523 
lemma rel_comp_empty2 [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

524 
"R O {} = {}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

525 
by blast 
12905  526 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

527 
(* CANDIDATE lemma pred_comp_bot2 [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

528 
"" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

529 
by (fact rel_comp_empty2 [to_pred]) *) 
23185  530 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

531 
lemma O_assoc: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

532 
"(R O S) O T = R O (S O T)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

533 
by blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

534 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

535 
lemma pred_comp_assoc: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

536 
"(r OO s) OO t = r OO (s OO t)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

537 
by (fact O_assoc [to_pred]) 
23185  538 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

539 
lemma trans_O_subset: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

540 
"trans r \<Longrightarrow> r O r \<subseteq> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

541 
by (unfold trans_def) blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

542 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

543 
lemma transp_pred_comp_less_eq: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

544 
"transp r \<Longrightarrow> r OO r \<le> r " 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

545 
by (fact trans_O_subset [to_pred]) 
12905  546 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

547 
lemma rel_comp_mono: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

548 
"r' \<subseteq> r \<Longrightarrow> s' \<subseteq> s \<Longrightarrow> r' O s' \<subseteq> r O s" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

549 
by blast 
12905  550 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

551 
lemma pred_comp_mono: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

552 
"r' \<le> r \<Longrightarrow> s' \<le> s \<Longrightarrow> r' OO s' \<le> r OO s " 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

553 
by (fact rel_comp_mono [to_pred]) 
12905  554 

555 
lemma rel_comp_subset_Sigma: 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

556 
"r \<subseteq> A \<times> B \<Longrightarrow> s \<subseteq> B \<times> C \<Longrightarrow> r O s \<subseteq> A \<times> C" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

557 
by blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

558 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

559 
lemma rel_comp_distrib [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

560 
"R O (S \<union> T) = (R O S) \<union> (R O T)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

561 
by auto 
12905  562 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

563 
lemma pred_comp_distrib (* CANDIDATE [simp] *): 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

564 
"R OO (S \<squnion> T) = R OO S \<squnion> R OO T" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

565 
by (fact rel_comp_distrib [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

566 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

567 
lemma rel_comp_distrib2 [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

568 
"(S \<union> T) O R = (S O R) \<union> (T O R)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

569 
by auto 
28008
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset

570 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

571 
lemma pred_comp_distrib2 (* CANDIDATE [simp] *): 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

572 
"(S \<squnion> T) OO R = S OO R \<squnion> T OO R" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

573 
by (fact rel_comp_distrib2 [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

574 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

575 
lemma rel_comp_UNION_distrib: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

576 
"s O UNION I r = (\<Union>i\<in>I. s O r i) " 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

577 
by auto 
28008
f945f8d9ad4d
added distributivity of relation composition over union [simp]
krauss
parents:
26297
diff
changeset

578 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

579 
(* FIXME thm rel_comp_UNION_distrib [to_pred] *) 
36772  580 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

581 
lemma rel_comp_UNION_distrib2: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

582 
"UNION I r O s = (\<Union>i\<in>I. r i O s) " 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

583 
by auto 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

584 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

585 
(* FIXME thm rel_comp_UNION_distrib2 [to_pred] *) 
36772  586 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

587 
lemma single_valued_rel_comp: 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

588 
"single_valued r \<Longrightarrow> single_valued s \<Longrightarrow> single_valued (r O s)" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

589 
by (unfold single_valued_def) blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

590 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

591 
lemma rel_comp_unfold: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

592 
"r O s = {(x, z). \<exists>y. (x, y) \<in> r \<and> (y, z) \<in> s}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

593 
by (auto simp add: set_eq_iff) 
12905  594 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

595 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

596 
subsubsection {* Converse *} 
12913  597 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

598 
inductive_set converse :: "('a \<times> 'b) set \<Rightarrow> ('b \<times> 'a) set" ("(_^1)" [1000] 999) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

599 
for r :: "('a \<times> 'b) set" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

600 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

601 
"(a, b) \<in> r \<Longrightarrow> (b, a) \<in> r^1" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

602 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

603 
notation (xsymbols) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

604 
converse ("(_\<inverse>)" [1000] 999) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

605 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

606 
notation 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

607 
conversep ("(_^1)" [1000] 1000) 
46694  608 

609 
notation (xsymbols) 

610 
conversep ("(_\<inverse>\<inverse>)" [1000] 1000) 

611 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

612 
lemma converseI [sym]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

613 
"(a, b) \<in> r \<Longrightarrow> (b, a) \<in> r\<inverse>" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

614 
by (fact converse.intros) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

615 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

616 
lemma conversepI (* CANDIDATE [sym] *): 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

617 
"r a b \<Longrightarrow> r\<inverse>\<inverse> b a" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

618 
by (fact conversep.intros) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

619 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

620 
lemma converseD [sym]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

621 
"(a, b) \<in> r\<inverse> \<Longrightarrow> (b, a) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

622 
by (erule converse.cases) iprover 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

623 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

624 
lemma conversepD (* CANDIDATE [sym] *): 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

625 
"r\<inverse>\<inverse> b a \<Longrightarrow> r a b" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

626 
by (fact converseD [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

627 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

628 
lemma converseE [elim!]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

629 
 {* More general than @{text converseD}, as it ``splits'' the member of the relation. *} 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

630 
"yx \<in> r\<inverse> \<Longrightarrow> (\<And>x y. yx = (y, x) \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> P) \<Longrightarrow> P" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

631 
by (cases yx) (simp, erule converse.cases, iprover) 
46694  632 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

633 
lemmas conversepE (* CANDIDATE [elim!] *) = conversep.cases 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

634 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

635 
lemma converse_iff [iff]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

636 
"(a, b) \<in> r\<inverse> \<longleftrightarrow> (b, a) \<in> r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

637 
by (auto intro: converseI) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

638 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

639 
lemma conversep_iff [iff]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

640 
"r\<inverse>\<inverse> a b = r b a" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

641 
by (fact converse_iff [to_pred]) 
46694  642 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

643 
lemma converse_converse [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

644 
"(r\<inverse>)\<inverse> = r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

645 
by (simp add: set_eq_iff) 
46694  646 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

647 
lemma conversep_conversep [simp]: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

648 
"(r\<inverse>\<inverse>)\<inverse>\<inverse> = r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

649 
by (fact converse_converse [to_pred]) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

650 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

651 
lemma converse_rel_comp: "(r O s)^1 = s^1 O r^1" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

652 
by blast 
46694  653 

654 
lemma converse_pred_comp: "(r OO s)^1 = s^1 OO r^1" 

655 
by (iprover intro: order_antisym conversepI pred_compI 

656 
elim: pred_compE dest: conversepD) 

657 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

658 
lemma converse_Int: "(r \<inter> s)^1 = r^1 \<inter> s^1" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

659 
by blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

660 

46694  661 
lemma converse_meet: "(r \<sqinter> s)^1 = r^1 \<sqinter> s^1" 
662 
by (simp add: inf_fun_def) (iprover intro: conversepI ext dest: conversepD) 

663 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

664 
lemma converse_Un: "(r \<union> s)^1 = r^1 \<union> s^1" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

665 
by blast 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

666 

46694  667 
lemma converse_join: "(r \<squnion> s)^1 = r^1 \<squnion> s^1" 
668 
by (simp add: sup_fun_def) (iprover intro: conversepI ext dest: conversepD) 

669 

19228  670 
lemma converse_INTER: "(INTER S r)^1 = (INT x:S. (r x)^1)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

671 
by fast 
19228  672 

673 
lemma converse_UNION: "(UNION S r)^1 = (UN x:S. (r x)^1)" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

674 
by blast 
19228  675 

12905  676 
lemma converse_Id [simp]: "Id^1 = Id" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

677 
by blast 
12905  678 

30198  679 
lemma converse_Id_on [simp]: "(Id_on A)^1 = Id_on A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

680 
by blast 
12905  681 

30198  682 
lemma refl_on_converse [simp]: "refl_on A (converse r) = refl_on A r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

683 
by (unfold refl_on_def) auto 
12905  684 

19228  685 
lemma sym_converse [simp]: "sym (converse r) = sym r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

686 
by (unfold sym_def) blast 
19228  687 

688 
lemma antisym_converse [simp]: "antisym (converse r) = antisym r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

689 
by (unfold antisym_def) blast 
12905  690 

19228  691 
lemma trans_converse [simp]: "trans (converse r) = trans r" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

692 
by (unfold trans_def) blast 
12905  693 

19228  694 
lemma sym_conv_converse_eq: "sym r = (r^1 = r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

695 
by (unfold sym_def) fast 
19228  696 

697 
lemma sym_Un_converse: "sym (r \<union> r^1)" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

698 
by (unfold sym_def) blast 
19228  699 

700 
lemma sym_Int_converse: "sym (r \<inter> r^1)" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

701 
by (unfold sym_def) blast 
19228  702 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

703 
lemma total_on_converse [simp]: "total_on A (r^1) = total_on A r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

704 
by (auto simp: total_on_def) 
29859
33bff35f1335
Moved Order_Relation into Library and moved some of it into Relation.
nipkow
parents:
29609
diff
changeset

705 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

706 
lemma finite_converse [iff]: "finite (r^1) = finite r" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

707 
apply (subgoal_tac "r^1 = (%(x,y). (y,x))`r") 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

708 
apply simp 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

709 
apply (rule iffI) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

710 
apply (erule finite_imageD [unfolded inj_on_def]) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

711 
apply (simp split add: split_split) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

712 
apply (erule finite_imageI) 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

713 
apply (simp add: set_eq_iff image_def, auto) 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

714 
apply (rule bexI) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

715 
prefer 2 apply assumption 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

716 
apply simp 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

717 
done 
12913  718 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

719 
lemma conversep_noteq [simp]: "(op \<noteq>)^1 = op \<noteq>" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

720 
by (auto simp add: fun_eq_iff) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

721 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

722 
lemma conversep_eq [simp]: "(op =)^1 = op =" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

723 
by (auto simp add: fun_eq_iff) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

724 

e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

725 
lemma converse_unfold: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

726 
"r\<inverse> = {(y, x). (x, y) \<in> r}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

727 
by (simp add: set_eq_iff) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

728 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

729 

1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

730 
subsubsection {* Domain, range and field *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

731 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

732 
definition Domain :: "('a \<times> 'b) set \<Rightarrow> 'a set" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

733 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

734 
"Domain r = {x. \<exists>y. (x, y) \<in> r}" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

735 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

736 
definition Range :: "('a \<times> 'b) set \<Rightarrow> 'b set" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

737 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

738 
"Range r = Domain (r\<inverse>)" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

739 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

740 
definition Field :: "'a rel \<Rightarrow> 'a set" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

741 
where 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

742 
"Field r = Domain r \<union> Range r" 
12905  743 

35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset

744 
declare Domain_def [no_atp] 
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23709
diff
changeset

745 

12905  746 
lemma Domain_iff: "(a : Domain r) = (EX y. (a, y) : r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

747 
by (unfold Domain_def) blast 
12905  748 

749 
lemma DomainI [intro]: "(a, b) : r ==> a : Domain r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

750 
by (iprover intro!: iffD2 [OF Domain_iff]) 
12905  751 

752 
lemma DomainE [elim!]: 

753 
"a : Domain r ==> (!!y. (a, y) : r ==> P) ==> P" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

754 
by (iprover dest!: iffD1 [OF Domain_iff]) 
12905  755 

756 
lemma Range_iff: "(a : Range r) = (EX y. (y, a) : r)" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

757 
by (simp add: Domain_def Range_def) 
12905  758 

759 
lemma RangeI [intro]: "(a, b) : r ==> b : Range r" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

760 
by (unfold Range_def) (iprover intro!: converseI DomainI) 
12905  761 

762 
lemma RangeE [elim!]: "b : Range r ==> (!!x. (x, b) : r ==> P) ==> P" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

763 
by (unfold Range_def) (iprover elim!: DomainE dest!: converseD) 
12905  764 

46694  765 
inductive DomainP :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> bool" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

766 
for r :: "'a \<Rightarrow> 'b \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

767 
where 
46694  768 
DomainPI [intro]: "r a b \<Longrightarrow> DomainP r a" 
769 

770 
inductive_cases DomainPE [elim!]: "DomainP r a" 

771 

772 
lemma DomainP_Domain_eq [pred_set_conv]: "DomainP (\<lambda>x y. (x, y) \<in> r) = (\<lambda>x. x \<in> Domain r)" 

773 
by (blast intro!: Orderings.order_antisym predicate1I) 

774 

775 
inductive RangeP :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> 'b \<Rightarrow> bool" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

776 
for r :: "'a \<Rightarrow> 'b \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

777 
where 
46694  778 
RangePI [intro]: "r a b \<Longrightarrow> RangeP r b" 
779 

780 
inductive_cases RangePE [elim!]: "RangeP r b" 

781 

782 
lemma RangeP_Range_eq [pred_set_conv]: "RangeP (\<lambda>x y. (x, y) \<in> r) = (\<lambda>x. x \<in> Range r)" 

783 
by (auto intro!: Orderings.order_antisym predicate1I) 

784 

785 
lemma Domain_fst [code]: 

786 
"Domain r = fst ` r" 

787 
by (auto simp add: image_def Bex_def) 

788 

789 
lemma Domain_empty [simp]: "Domain {} = {}" 

790 
by blast 

791 

792 
lemma Domain_empty_iff: "Domain r = {} \<longleftrightarrow> r = {}" 

793 
by auto 

794 

795 
lemma Domain_insert: "Domain (insert (a, b) r) = insert a (Domain r)" 

796 
by blast 

797 

798 
lemma Domain_Id [simp]: "Domain Id = UNIV" 

799 
by blast 

800 

801 
lemma Domain_Id_on [simp]: "Domain (Id_on A) = A" 

802 
by blast 

803 

804 
lemma Domain_Un_eq: "Domain(A \<union> B) = Domain(A) \<union> Domain(B)" 

805 
by blast 

806 

807 
lemma Domain_Int_subset: "Domain(A \<inter> B) \<subseteq> Domain(A) \<inter> Domain(B)" 

808 
by blast 

809 

810 
lemma Domain_Diff_subset: "Domain(A)  Domain(B) \<subseteq> Domain(A  B)" 

811 
by blast 

812 

813 
lemma Domain_Union: "Domain (Union S) = (\<Union>A\<in>S. Domain A)" 

814 
by blast 

815 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

816 
lemma Domain_converse [simp]: "Domain (r\<inverse>) = Range r" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

817 
by auto 
46694  818 

819 
lemma Domain_mono: "r \<subseteq> s ==> Domain r \<subseteq> Domain s" 

820 
by blast 

821 

822 
lemma fst_eq_Domain: "fst ` R = Domain R" 

823 
by force 

824 

825 
lemma Domain_dprod [simp]: "Domain (dprod r s) = uprod (Domain r) (Domain s)" 

826 
by auto 

827 

828 
lemma Domain_dsum [simp]: "Domain (dsum r s) = usum (Domain r) (Domain s)" 

829 
by auto 

830 

831 
lemma Domain_Collect_split [simp]: "Domain {(x, y). P x y} = {x. EX y. P x y}" 

832 
by auto 

833 

834 
lemma finite_Domain: "finite r ==> finite (Domain r)" 

835 
by (induct set: finite) (auto simp add: Domain_insert) 

836 

46127  837 
lemma Range_snd [code]: 
45012
060f76635bfe
tuned specification and lemma distribution among theories; tuned proofs
haftmann
parents:
44921
diff
changeset

838 
"Range r = snd ` r" 
060f76635bfe
tuned specification and lemma distribution among theories; tuned proofs
haftmann
parents:
44921
diff
changeset

839 
by (auto simp add: image_def Bex_def) 
060f76635bfe
tuned specification and lemma distribution among theories; tuned proofs
haftmann
parents:
44921
diff
changeset

840 

12905  841 
lemma Range_empty [simp]: "Range {} = {}" 
46694  842 
by blast 
12905  843 

32876  844 
lemma Range_empty_iff: "Range r = {} \<longleftrightarrow> r = {}" 
845 
by auto 

846 

12905  847 
lemma Range_insert: "Range (insert (a, b) r) = insert b (Range r)" 
46694  848 
by blast 
12905  849 

850 
lemma Range_Id [simp]: "Range Id = UNIV" 

46694  851 
by blast 
12905  852 

30198  853 
lemma Range_Id_on [simp]: "Range (Id_on A) = A" 
46694  854 
by auto 
12905  855 

13830  856 
lemma Range_Un_eq: "Range(A \<union> B) = Range(A) \<union> Range(B)" 
46694  857 
by blast 
12905  858 

13830  859 
lemma Range_Int_subset: "Range(A \<inter> B) \<subseteq> Range(A) \<inter> Range(B)" 
46694  860 
by blast 
12905  861 

12913  862 
lemma Range_Diff_subset: "Range(A)  Range(B) \<subseteq> Range(A  B)" 
46694  863 
by blast 
12905  864 

13830  865 
lemma Range_Union: "Range (Union S) = (\<Union>A\<in>S. Range A)" 
46694  866 
by blast 
26271  867 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

868 
lemma Range_converse [simp]: "Range (r\<inverse>) = Domain r" 
46694  869 
by blast 
12905  870 

36729  871 
lemma snd_eq_Range: "snd ` R = Range R" 
44921  872 
by force 
26271  873 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

874 
lemma Range_Collect_split [simp]: "Range {(x, y). P x y} = {y. EX x. P x y}" 
46694  875 
by auto 
26271  876 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

877 
lemma finite_Range: "finite r ==> finite (Range r)" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

878 
by (induct set: finite) (auto simp add: Range_insert) 
26271  879 

880 
lemma mono_Field: "r \<subseteq> s \<Longrightarrow> Field r \<subseteq> Field s" 

46694  881 
by (auto simp: Field_def Domain_def Range_def) 
26271  882 

883 
lemma Field_empty[simp]: "Field {} = {}" 

46694  884 
by (auto simp: Field_def) 
26271  885 

46694  886 
lemma Field_insert [simp]: "Field (insert (a, b) r) = {a, b} \<union> Field r" 
887 
by (auto simp: Field_def) 

26271  888 

46694  889 
lemma Field_Un [simp]: "Field (r \<union> s) = Field r \<union> Field s" 
890 
by (auto simp: Field_def) 

26271  891 

46694  892 
lemma Field_Union [simp]: "Field (\<Union>R) = \<Union>(Field ` R)" 
893 
by (auto simp: Field_def) 

26271  894 

46694  895 
lemma Field_converse [simp]: "Field(r^1) = Field r" 
896 
by (auto simp: Field_def) 

22172  897 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

898 
lemma finite_Field: "finite r ==> finite (Field r)" 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

899 
 {* A finite relation has a finite field (@{text "= domain \<union> range"}. *} 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

900 
apply (induct set: finite) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

901 
apply (auto simp add: Field_def Domain_insert Range_insert) 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

902 
done 
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

903 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

904 
lemma Domain_unfold: 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

905 
"Domain r = {x. \<exists>y. (x, y) \<in> r}" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

906 
by (fact Domain_def) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

907 

12905  908 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

909 
subsubsection {* Image of a set under a relation *} 
12905  910 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

911 
definition Image :: "('a \<times> 'b) set \<Rightarrow> 'a set \<Rightarrow> 'b set" (infixl "``" 90) 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

912 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

913 
"r `` s = {y. \<exists>x\<in>s. (x, y) \<in> r}" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

914 

35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset

915 
declare Image_def [no_atp] 
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23709
diff
changeset

916 

12913  917 
lemma Image_iff: "(b : r``A) = (EX x:A. (x, b) : r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

918 
by (simp add: Image_def) 
12905  919 

12913  920 
lemma Image_singleton: "r``{a} = {b. (a, b) : r}" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

921 
by (simp add: Image_def) 
12905  922 

12913  923 
lemma Image_singleton_iff [iff]: "(b : r``{a}) = ((a, b) : r)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

924 
by (rule Image_iff [THEN trans]) simp 
12905  925 

35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
33218
diff
changeset

926 
lemma ImageI [intro,no_atp]: "(a, b) : r ==> a : A ==> b : r``A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

927 
by (unfold Image_def) blast 
12905  928 

929 
lemma ImageE [elim!]: 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

930 
"b : r `` A ==> (!!x. (x, b) : r ==> x : A ==> P) ==> P" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

931 
by (unfold Image_def) (iprover elim!: CollectE bexE) 
12905  932 

933 
lemma rev_ImageI: "a : A ==> (a, b) : r ==> b : r `` A" 

934 
 {* This version's more effective when we already have the required @{text a} *} 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

935 
by blast 
12905  936 

937 
lemma Image_empty [simp]: "R``{} = {}" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

938 
by blast 
12905  939 

940 
lemma Image_Id [simp]: "Id `` A = A" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

941 
by blast 
12905  942 

30198  943 
lemma Image_Id_on [simp]: "Id_on A `` B = A \<inter> B" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

944 
by blast 
13830  945 

946 
lemma Image_Int_subset: "R `` (A \<inter> B) \<subseteq> R `` A \<inter> R `` B" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

947 
by blast 
12905  948 

13830  949 
lemma Image_Int_eq: 
950 
"single_valued (converse R) ==> R `` (A \<inter> B) = R `` A \<inter> R `` B" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

951 
by (simp add: single_valued_def, blast) 
12905  952 

13830  953 
lemma Image_Un: "R `` (A \<union> B) = R `` A \<union> R `` B" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

954 
by blast 
12905  955 

13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset

956 
lemma Un_Image: "(R \<union> S) `` A = R `` A \<union> S `` A" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

957 
by blast 
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13639
diff
changeset

958 

12913  959 
lemma Image_subset: "r \<subseteq> A \<times> B ==> r``C \<subseteq> B" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

960 
by (iprover intro!: subsetI elim!: ImageE dest!: subsetD SigmaD2) 
12905  961 

13830  962 
lemma Image_eq_UN: "r``B = (\<Union>y\<in> B. r``{y})" 
12905  963 
 {* NOT suitable for rewriting *} 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

964 
by blast 
12905  965 

12913  966 
lemma Image_mono: "r' \<subseteq> r ==> A' \<subseteq> A ==> (r' `` A') \<subseteq> (r `` A)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

967 
by blast 
12905  968 

13830  969 
lemma Image_UN: "(r `` (UNION A B)) = (\<Union>x\<in>A. r `` (B x))" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

970 
by blast 
13830  971 

972 
lemma Image_INT_subset: "(r `` INTER A B) \<subseteq> (\<Inter>x\<in>A. r `` (B x))" 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

973 
by blast 
12905  974 

13830  975 
text{*Converse inclusion requires some assumptions*} 
976 
lemma Image_INT_eq: 

977 
"[single_valued (r\<inverse>); A\<noteq>{}] ==> r `` INTER A B = (\<Inter>x\<in>A. r `` B x)" 

978 
apply (rule equalityI) 

979 
apply (rule Image_INT_subset) 

980 
apply (simp add: single_valued_def, blast) 

981 
done 

12905  982 

12913  983 
lemma Image_subset_eq: "(r``A \<subseteq> B) = (A \<subseteq>  ((r^1) `` (B)))" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

984 
by blast 
12905  985 

46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

986 
lemma Image_Collect_split [simp]: "{(x, y). P x y} `` A = {y. EX x:A. P x y}" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

987 
by auto 
12905  988 

989 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

990 
subsubsection {* Inverse image *} 
12905  991 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

992 
definition inv_image :: "'b rel \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a rel" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

993 
where 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

994 
"inv_image r f = {(x, y). (f x, f y) \<in> r}" 
46692
1f8b766224f6
tuned structure; dropped already existing syntax declarations
haftmann
parents:
46691
diff
changeset

995 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

996 
definition inv_imagep :: "('b \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

997 
where 
46694  998 
"inv_imagep r f = (\<lambda>x y. r (f x) (f y))" 
999 

1000 
lemma [pred_set_conv]: "inv_imagep (\<lambda>x y. (x, y) \<in> r) f = (\<lambda>x y. (x, y) \<in> inv_image r f)" 

1001 
by (simp add: inv_image_def inv_imagep_def) 

1002 

19228  1003 
lemma sym_inv_image: "sym r ==> sym (inv_image r f)" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

1004 
by (unfold sym_def inv_image_def) blast 
19228  1005 

12913  1006 
lemma trans_inv_image: "trans r ==> trans (inv_image r f)" 
12905  1007 
apply (unfold trans_def inv_image_def) 
1008 
apply (simp (no_asm)) 

1009 
apply blast 

1010 
done 

1011 

32463
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset

1012 
lemma in_inv_image[simp]: "((x,y) : inv_image r f) = ((f x, f y) : r)" 
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset

1013 
by (auto simp:inv_image_def) 
3a0a65ca2261
moved lemma Wellfounded.in_inv_image to Relation.thy
krauss
parents:
32235
diff
changeset

1014 

33218  1015 
lemma converse_inv_image[simp]: "(inv_image R f)^1 = inv_image (R^1) f" 
46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

1016 
unfolding inv_image_def converse_unfold by auto 
33218  1017 

46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1018 
lemma in_inv_imagep [simp]: "inv_imagep r f x y = r (f x) (f y)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1019 
by (simp add: inv_imagep_def) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1020 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1021 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1022 
subsubsection {* Powerset *} 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1023 

46752
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

1024 
definition Powp :: "('a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> bool" 
e9e7209eb375
more fundamental predtoset conversions, particularly by means of inductive_set; associated consolidation of some theorem names (c.f. NEWS)
haftmann
parents:
46696
diff
changeset

1025 
where 
46664
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1026 
"Powp A = (\<lambda>B. \<forall>x \<in> B. A x)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1027 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1028 
lemma Powp_Pow_eq [pred_set_conv]: "Powp (\<lambda>x. x \<in> A) = (\<lambda>x. x \<in> Pow A)" 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1029 
by (auto simp add: Powp_def fun_eq_iff) 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1030 

1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1031 
lemmas Powp_mono [mono] = Pow_mono [to_pred] 
1f6c140f9c72
moved predicate relations and conversion rules between set and predicate relations from Predicate.thy to Relation.thy; moved Predicate.thy upwards in theory hierarchy
haftmann
parents:
46638
diff
changeset

1032 

1128
64b30e3cc6d4
Trancl is now based on Relation which used to be in Integ.
nipkow
parents:
diff
changeset

1033 
end 
46689  1034 