misc tuning and modernization;
authorwenzelm
Wed Aug 10 22:05:00 2016 +0200 (2016-08-10)
changeset 636534453cfb745e5
parent 63652 804b80a80016
child 63654 f90e3926e627
misc tuning and modernization;
src/HOL/Equiv_Relations.thy
     1.1 --- a/src/HOL/Equiv_Relations.thy	Wed Aug 10 22:03:58 2016 +0200
     1.2 +++ b/src/HOL/Equiv_Relations.thy	Wed Aug 10 22:05:00 2016 +0200
     1.3 @@ -1,20 +1,19 @@
     1.4 -(*  Authors:    Lawrence C Paulson, Cambridge University Computer Laboratory
     1.5 -    Copyright   1996  University of Cambridge
     1.6 +(*  Title:      HOL/Equiv_Relations.thy
     1.7 +    Author:     Lawrence C Paulson, 1996 Cambridge University Computer Laboratory
     1.8  *)
     1.9  
    1.10  section \<open>Equivalence Relations in Higher-Order Set Theory\<close>
    1.11  
    1.12  theory Equiv_Relations
    1.13 -imports Groups_Big Relation
    1.14 +  imports Groups_Big Relation
    1.15  begin
    1.16  
    1.17  subsection \<open>Equivalence relations -- set version\<close>
    1.18  
    1.19 -definition equiv :: "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool" where
    1.20 -  "equiv A r \<longleftrightarrow> refl_on A r \<and> sym r \<and> trans r"
    1.21 +definition equiv :: "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool"
    1.22 +  where "equiv A r \<longleftrightarrow> refl_on A r \<and> sym r \<and> trans r"
    1.23  
    1.24 -lemma equivI:
    1.25 -  "refl_on A r \<Longrightarrow> sym r \<Longrightarrow> trans r \<Longrightarrow> equiv A r"
    1.26 +lemma equivI: "refl_on A r \<Longrightarrow> sym r \<Longrightarrow> trans r \<Longrightarrow> equiv A r"
    1.27    by (simp add: equiv_def)
    1.28  
    1.29  lemma equivE:
    1.30 @@ -23,20 +22,18 @@
    1.31    using assms by (simp add: equiv_def)
    1.32  
    1.33  text \<open>
    1.34 -  Suppes, Theorem 70: \<open>r\<close> is an equiv relation iff \<open>r\<inverse> O
    1.35 -  r = r\<close>.
    1.36 +  Suppes, Theorem 70: \<open>r\<close> is an equiv relation iff \<open>r\<inverse> O r = r\<close>.
    1.37  
    1.38 -  First half: \<open>equiv A r ==> r\<inverse> O r = r\<close>.
    1.39 +  First half: \<open>equiv A r \<Longrightarrow> r\<inverse> O r = r\<close>.
    1.40  \<close>
    1.41  
    1.42 -lemma sym_trans_comp_subset:
    1.43 -    "sym r ==> trans r ==> r\<inverse> O r \<subseteq> r"
    1.44 -  by (unfold trans_def sym_def converse_unfold) blast
    1.45 +lemma sym_trans_comp_subset: "sym r \<Longrightarrow> trans r \<Longrightarrow> r\<inverse> O r \<subseteq> r"
    1.46 +  unfolding trans_def sym_def converse_unfold by blast
    1.47  
    1.48 -lemma refl_on_comp_subset: "refl_on A r ==> r \<subseteq> r\<inverse> O r"
    1.49 -  by (unfold refl_on_def) blast
    1.50 +lemma refl_on_comp_subset: "refl_on A r \<Longrightarrow> r \<subseteq> r\<inverse> O r"
    1.51 +  unfolding refl_on_def by blast
    1.52  
    1.53 -lemma equiv_comp_eq: "equiv A r ==> r\<inverse> O r = r"
    1.54 +lemma equiv_comp_eq: "equiv A r \<Longrightarrow> r\<inverse> O r = r"
    1.55    apply (unfold equiv_def)
    1.56    apply clarify
    1.57    apply (rule equalityI)
    1.58 @@ -45,11 +42,10 @@
    1.59  
    1.60  text \<open>Second half.\<close>
    1.61  
    1.62 -lemma comp_equivI:
    1.63 -    "r\<inverse> O r = r ==> Domain r = A ==> equiv A r"
    1.64 +lemma comp_equivI: "r\<inverse> O r = r \<Longrightarrow> Domain r = A \<Longrightarrow> equiv A r"
    1.65    apply (unfold equiv_def refl_on_def sym_def trans_def)
    1.66    apply (erule equalityE)
    1.67 -  apply (subgoal_tac "\<forall>x y. (x, y) \<in> r --> (y, x) \<in> r")
    1.68 +  apply (subgoal_tac "\<forall>x y. (x, y) \<in> r \<longrightarrow> (y, x) \<in> r")
    1.69     apply fast
    1.70    apply fast
    1.71    done
    1.72 @@ -57,62 +53,54 @@
    1.73  
    1.74  subsection \<open>Equivalence classes\<close>
    1.75  
    1.76 -lemma equiv_class_subset:
    1.77 -  "equiv A r ==> (a, b) \<in> r ==> r``{a} \<subseteq> r``{b}"
    1.78 +lemma equiv_class_subset: "equiv A r \<Longrightarrow> (a, b) \<in> r \<Longrightarrow> r``{a} \<subseteq> r``{b}"
    1.79    \<comment> \<open>lemma for the next result\<close>
    1.80 -  by (unfold equiv_def trans_def sym_def) blast
    1.81 +  unfolding equiv_def trans_def sym_def by blast
    1.82  
    1.83 -theorem equiv_class_eq: "equiv A r ==> (a, b) \<in> r ==> r``{a} = r``{b}"
    1.84 +theorem equiv_class_eq: "equiv A r \<Longrightarrow> (a, b) \<in> r \<Longrightarrow> r``{a} = r``{b}"
    1.85    apply (assumption | rule equalityI equiv_class_subset)+
    1.86    apply (unfold equiv_def sym_def)
    1.87    apply blast
    1.88    done
    1.89  
    1.90 -lemma equiv_class_self: "equiv A r ==> a \<in> A ==> a \<in> r``{a}"
    1.91 -  by (unfold equiv_def refl_on_def) blast
    1.92 +lemma equiv_class_self: "equiv A r \<Longrightarrow> a \<in> A \<Longrightarrow> a \<in> r``{a}"
    1.93 +  unfolding equiv_def refl_on_def by blast
    1.94  
    1.95 -lemma subset_equiv_class:
    1.96 -    "equiv A r ==> r``{b} \<subseteq> r``{a} ==> b \<in> A ==> (a,b) \<in> r"
    1.97 +lemma subset_equiv_class: "equiv A r \<Longrightarrow> r``{b} \<subseteq> r``{a} \<Longrightarrow> b \<in> A \<Longrightarrow> (a, b) \<in> r"
    1.98    \<comment> \<open>lemma for the next result\<close>
    1.99 -  by (unfold equiv_def refl_on_def) blast
   1.100 +  unfolding equiv_def refl_on_def by blast
   1.101  
   1.102 -lemma eq_equiv_class:
   1.103 -    "r``{a} = r``{b} ==> equiv A r ==> b \<in> A ==> (a, b) \<in> r"
   1.104 +lemma eq_equiv_class: "r``{a} = r``{b} \<Longrightarrow> equiv A r \<Longrightarrow> b \<in> A \<Longrightarrow> (a, b) \<in> r"
   1.105    by (iprover intro: equalityD2 subset_equiv_class)
   1.106  
   1.107 -lemma equiv_class_nondisjoint:
   1.108 -    "equiv A r ==> x \<in> (r``{a} \<inter> r``{b}) ==> (a, b) \<in> r"
   1.109 -  by (unfold equiv_def trans_def sym_def) blast
   1.110 +lemma equiv_class_nondisjoint: "equiv A r \<Longrightarrow> x \<in> (r``{a} \<inter> r``{b}) \<Longrightarrow> (a, b) \<in> r"
   1.111 +  unfolding equiv_def trans_def sym_def by blast
   1.112  
   1.113 -lemma equiv_type: "equiv A r ==> r \<subseteq> A \<times> A"
   1.114 -  by (unfold equiv_def refl_on_def) blast
   1.115 +lemma equiv_type: "equiv A r \<Longrightarrow> r \<subseteq> A \<times> A"
   1.116 +  unfolding equiv_def refl_on_def by blast
   1.117  
   1.118 -theorem equiv_class_eq_iff:
   1.119 -  "equiv A r ==> ((x, y) \<in> r) = (r``{x} = r``{y} & x \<in> A & y \<in> A)"
   1.120 +lemma equiv_class_eq_iff: "equiv A r \<Longrightarrow> (x, y) \<in> r \<longleftrightarrow> r``{x} = r``{y} \<and> x \<in> A \<and> y \<in> A"
   1.121    by (blast intro!: equiv_class_eq dest: eq_equiv_class equiv_type)
   1.122  
   1.123 -theorem eq_equiv_class_iff:
   1.124 -  "equiv A r ==> x \<in> A ==> y \<in> A ==> (r``{x} = r``{y}) = ((x, y) \<in> r)"
   1.125 +lemma eq_equiv_class_iff: "equiv A r \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> r``{x} = r``{y} \<longleftrightarrow> (x, y) \<in> r"
   1.126    by (blast intro!: equiv_class_eq dest: eq_equiv_class equiv_type)
   1.127  
   1.128  
   1.129  subsection \<open>Quotients\<close>
   1.130  
   1.131 -definition quotient :: "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set set"  (infixl "'/'/" 90) where
   1.132 -  "A//r = (\<Union>x \<in> A. {r``{x}})"  \<comment> \<open>set of equiv classes\<close>
   1.133 +definition quotient :: "'a set \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> 'a set set"  (infixl "'/'/" 90)
   1.134 +  where "A//r = (\<Union>x \<in> A. {r``{x}})"  \<comment> \<open>set of equiv classes\<close>
   1.135  
   1.136  lemma quotientI: "x \<in> A ==> r``{x} \<in> A//r"
   1.137 -  by (unfold quotient_def) blast
   1.138 +  unfolding quotient_def by blast
   1.139  
   1.140 -lemma quotientE:
   1.141 -  "X \<in> A//r ==> (!!x. X = r``{x} ==> x \<in> A ==> P) ==> P"
   1.142 -  by (unfold quotient_def) blast
   1.143 +lemma quotientE: "X \<in> A//r \<Longrightarrow> (\<And>x. X = r``{x} \<Longrightarrow> x \<in> A \<Longrightarrow> P) \<Longrightarrow> P"
   1.144 +  unfolding quotient_def by blast
   1.145  
   1.146 -lemma Union_quotient: "equiv A r ==> \<Union>(A//r) = A"
   1.147 -  by (unfold equiv_def refl_on_def quotient_def) blast
   1.148 +lemma Union_quotient: "equiv A r \<Longrightarrow> \<Union>(A//r) = A"
   1.149 +  unfolding equiv_def refl_on_def quotient_def by blast
   1.150  
   1.151 -lemma quotient_disj:
   1.152 -  "equiv A r ==> X \<in> A//r ==> Y \<in> A//r ==> X = Y | (X \<inter> Y = {})"
   1.153 +lemma quotient_disj: "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> Y \<in> A//r \<Longrightarrow> X = Y \<or> X \<inter> Y = {}"
   1.154    apply (unfold quotient_def)
   1.155    apply clarify
   1.156    apply (rule equiv_class_eq)
   1.157 @@ -122,108 +110,96 @@
   1.158    done
   1.159  
   1.160  lemma quotient_eqI:
   1.161 -  "[|equiv A r; X \<in> A//r; Y \<in> A//r; x \<in> X; y \<in> Y; (x,y) \<in> r|] ==> X = Y" 
   1.162 +  "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> Y \<in> A//r \<Longrightarrow> x \<in> X \<Longrightarrow> y \<in> Y \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> X = Y"
   1.163    apply (clarify elim!: quotientE)
   1.164 -  apply (rule equiv_class_eq, assumption)
   1.165 -  apply (unfold equiv_def sym_def trans_def, blast)
   1.166 +  apply (rule equiv_class_eq)
   1.167 +   apply assumption
   1.168 +  apply (unfold equiv_def sym_def trans_def)
   1.169 +  apply blast
   1.170    done
   1.171  
   1.172  lemma quotient_eq_iff:
   1.173 -  "[|equiv A r; X \<in> A//r; Y \<in> A//r; x \<in> X; y \<in> Y|] ==> (X = Y) = ((x,y) \<in> r)" 
   1.174 -  apply (rule iffI)  
   1.175 -   prefer 2 apply (blast del: equalityI intro: quotient_eqI) 
   1.176 +  "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> Y \<in> A//r \<Longrightarrow> x \<in> X \<Longrightarrow> y \<in> Y \<Longrightarrow> X = Y \<longleftrightarrow> (x, y) \<in> r"
   1.177 +  apply (rule iffI)
   1.178 +   prefer 2
   1.179 +   apply (blast del: equalityI intro: quotient_eqI)
   1.180    apply (clarify elim!: quotientE)
   1.181 -  apply (unfold equiv_def sym_def trans_def, blast)
   1.182 +  apply (unfold equiv_def sym_def trans_def)
   1.183 +  apply blast
   1.184    done
   1.185  
   1.186 -lemma eq_equiv_class_iff2:
   1.187 -  "\<lbrakk> equiv A r; x \<in> A; y \<in> A \<rbrakk> \<Longrightarrow> ({x}//r = {y}//r) = ((x,y) : r)"
   1.188 -by(simp add:quotient_def eq_equiv_class_iff)
   1.189 -
   1.190 +lemma eq_equiv_class_iff2: "equiv A r \<Longrightarrow> x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> {x}//r = {y}//r \<longleftrightarrow> (x, y) \<in> r"
   1.191 +  by (simp add: quotient_def eq_equiv_class_iff)
   1.192  
   1.193  lemma quotient_empty [simp]: "{}//r = {}"
   1.194 -by(simp add: quotient_def)
   1.195 +  by (simp add: quotient_def)
   1.196  
   1.197 -lemma quotient_is_empty [iff]: "(A//r = {}) = (A = {})"
   1.198 -by(simp add: quotient_def)
   1.199 +lemma quotient_is_empty [iff]: "A//r = {} \<longleftrightarrow> A = {}"
   1.200 +  by (simp add: quotient_def)
   1.201  
   1.202 -lemma quotient_is_empty2 [iff]: "({} = A//r) = (A = {})"
   1.203 -by(simp add: quotient_def)
   1.204 -
   1.205 +lemma quotient_is_empty2 [iff]: "{} = A//r \<longleftrightarrow> A = {}"
   1.206 +  by (simp add: quotient_def)
   1.207  
   1.208  lemma singleton_quotient: "{x}//r = {r `` {x}}"
   1.209 -by(simp add:quotient_def)
   1.210 +  by (simp add: quotient_def)
   1.211  
   1.212 -lemma quotient_diff1:
   1.213 -  "\<lbrakk> inj_on (%a. {a}//r) A; a \<in> A \<rbrakk> \<Longrightarrow> (A - {a})//r = A//r - {a}//r"
   1.214 -apply(simp add:quotient_def inj_on_def)
   1.215 -apply blast
   1.216 -done
   1.217 +lemma quotient_diff1: "inj_on (\<lambda>a. {a}//r) A \<Longrightarrow> a \<in> A \<Longrightarrow> (A - {a})//r = A//r - {a}//r"
   1.218 +  unfolding quotient_def inj_on_def by blast
   1.219 +
   1.220  
   1.221  subsection \<open>Refinement of one equivalence relation WRT another\<close>
   1.222  
   1.223 -lemma refines_equiv_class_eq:
   1.224 -   "\<lbrakk>R \<subseteq> S; equiv A R; equiv A S\<rbrakk> \<Longrightarrow> R``(S``{a}) = S``{a}"
   1.225 +lemma refines_equiv_class_eq: "R \<subseteq> S \<Longrightarrow> equiv A R \<Longrightarrow> equiv A S \<Longrightarrow> R``(S``{a}) = S``{a}"
   1.226    by (auto simp: equiv_class_eq_iff)
   1.227  
   1.228 -lemma refines_equiv_class_eq2:
   1.229 -   "\<lbrakk>R \<subseteq> S; equiv A R; equiv A S\<rbrakk> \<Longrightarrow> S``(R``{a}) = S``{a}"
   1.230 +lemma refines_equiv_class_eq2: "R \<subseteq> S \<Longrightarrow> equiv A R \<Longrightarrow> equiv A S \<Longrightarrow> S``(R``{a}) = S``{a}"
   1.231    by (auto simp: equiv_class_eq_iff)
   1.232  
   1.233 -lemma refines_equiv_image_eq:
   1.234 -   "\<lbrakk>R \<subseteq> S; equiv A R; equiv A S\<rbrakk> \<Longrightarrow> (\<lambda>X. S``X) ` (A//R) = A//S"
   1.235 +lemma refines_equiv_image_eq: "R \<subseteq> S \<Longrightarrow> equiv A R \<Longrightarrow> equiv A S \<Longrightarrow> (\<lambda>X. S``X) ` (A//R) = A//S"
   1.236     by (auto simp: quotient_def image_UN refines_equiv_class_eq2)
   1.237  
   1.238  lemma finite_refines_finite:
   1.239 -   "\<lbrakk>finite (A//R); R \<subseteq> S; equiv A R; equiv A S\<rbrakk> \<Longrightarrow> finite (A//S)"
   1.240 -    apply (erule finite_surj [where f = "\<lambda>X. S``X"])
   1.241 -    apply (simp add: refines_equiv_image_eq)
   1.242 -    done
   1.243 +  "finite (A//R) \<Longrightarrow> R \<subseteq> S \<Longrightarrow> equiv A R \<Longrightarrow> equiv A S \<Longrightarrow> finite (A//S)"
   1.244 +  by (erule finite_surj [where f = "\<lambda>X. S``X"]) (simp add: refines_equiv_image_eq)
   1.245  
   1.246  lemma finite_refines_card_le:
   1.247 -   "\<lbrakk>finite (A//R); R \<subseteq> S; equiv A R; equiv A S\<rbrakk> \<Longrightarrow> card (A//S) \<le> card (A//R)"
   1.248 -  apply (subst refines_equiv_image_eq [of R S A, symmetric])
   1.249 -  apply (auto simp: card_image_le [where f = "\<lambda>X. S``X"])
   1.250 -  done
   1.251 +  "finite (A//R) \<Longrightarrow> R \<subseteq> S \<Longrightarrow> equiv A R \<Longrightarrow> equiv A S \<Longrightarrow> card (A//S) \<le> card (A//R)"
   1.252 +  by (subst refines_equiv_image_eq [of R S A, symmetric])
   1.253 +    (auto simp: card_image_le [where f = "\<lambda>X. S``X"])
   1.254  
   1.255  
   1.256  subsection \<open>Defining unary operations upon equivalence classes\<close>
   1.257  
   1.258 -text\<open>A congruence-preserving function\<close>
   1.259 +text \<open>A congruence-preserving function.\<close>
   1.260  
   1.261 -definition congruent :: "('a \<times> 'a) set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"  where
   1.262 -  "congruent r f \<longleftrightarrow> (\<forall>(y, z) \<in> r. f y = f z)"
   1.263 +definition congruent :: "('a \<times> 'a) set \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
   1.264 +  where "congruent r f \<longleftrightarrow> (\<forall>(y, z) \<in> r. f y = f z)"
   1.265  
   1.266 -lemma congruentI:
   1.267 -  "(\<And>y z. (y, z) \<in> r \<Longrightarrow> f y = f z) \<Longrightarrow> congruent r f"
   1.268 +lemma congruentI: "(\<And>y z. (y, z) \<in> r \<Longrightarrow> f y = f z) \<Longrightarrow> congruent r f"
   1.269    by (auto simp add: congruent_def)
   1.270  
   1.271 -lemma congruentD:
   1.272 -  "congruent r f \<Longrightarrow> (y, z) \<in> r \<Longrightarrow> f y = f z"
   1.273 +lemma congruentD: "congruent r f \<Longrightarrow> (y, z) \<in> r \<Longrightarrow> f y = f z"
   1.274    by (auto simp add: congruent_def)
   1.275  
   1.276 -abbreviation
   1.277 -  RESPECTS :: "('a => 'b) => ('a * 'a) set => bool"
   1.278 -    (infixr "respects" 80) where
   1.279 -  "f respects r == congruent r f"
   1.280 +abbreviation RESPECTS :: "('a \<Rightarrow> 'b) \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool"  (infixr "respects" 80)
   1.281 +  where "f respects r \<equiv> congruent r f"
   1.282  
   1.283  
   1.284 -lemma UN_constant_eq: "a \<in> A ==> \<forall>y \<in> A. f y = c ==> (\<Union>y \<in> A. f(y))=c"
   1.285 +lemma UN_constant_eq: "a \<in> A \<Longrightarrow> \<forall>y \<in> A. f y = c \<Longrightarrow> (\<Union>y \<in> A. f y) = c"
   1.286    \<comment> \<open>lemma required to prove \<open>UN_equiv_class\<close>\<close>
   1.287    by auto
   1.288  
   1.289 -lemma UN_equiv_class:
   1.290 -  "equiv A r ==> f respects r ==> a \<in> A
   1.291 -    ==> (\<Union>x \<in> r``{a}. f x) = f a"
   1.292 +lemma UN_equiv_class: "equiv A r \<Longrightarrow> f respects r \<Longrightarrow> a \<in> A \<Longrightarrow> (\<Union>x \<in> r``{a}. f x) = f a"
   1.293    \<comment> \<open>Conversion rule\<close>
   1.294 -  apply (rule equiv_class_self [THEN UN_constant_eq], assumption+)
   1.295 +  apply (rule equiv_class_self [THEN UN_constant_eq])
   1.296 +    apply assumption
   1.297 +   apply assumption
   1.298    apply (unfold equiv_def congruent_def sym_def)
   1.299    apply (blast del: equalityI)
   1.300    done
   1.301  
   1.302  lemma UN_equiv_class_type:
   1.303 -  "equiv A r ==> f respects r ==> X \<in> A//r ==>
   1.304 -    (!!x. x \<in> A ==> f x \<in> B) ==> (\<Union>x \<in> X. f x) \<in> B"
   1.305 +  "equiv A r \<Longrightarrow> f respects r \<Longrightarrow> X \<in> A//r \<Longrightarrow> (\<And>x. x \<in> A \<Longrightarrow> f x \<in> B) \<Longrightarrow> (\<Union>x \<in> X. f x) \<in> B"
   1.306    apply (unfold quotient_def)
   1.307    apply clarify
   1.308    apply (subst UN_equiv_class)
   1.309 @@ -232,15 +208,15 @@
   1.310  
   1.311  text \<open>
   1.312    Sufficient conditions for injectiveness.  Could weaken premises!
   1.313 -  major premise could be an inclusion; bcong could be \<open>!!y. y \<in>
   1.314 -  A ==> f y \<in> B\<close>.
   1.315 +  major premise could be an inclusion; \<open>bcong\<close> could be
   1.316 +  \<open>\<And>y. y \<in> A \<Longrightarrow> f y \<in> B\<close>.
   1.317  \<close>
   1.318  
   1.319  lemma UN_equiv_class_inject:
   1.320 -  "equiv A r ==> f respects r ==>
   1.321 -    (\<Union>x \<in> X. f x) = (\<Union>y \<in> Y. f y) ==> X \<in> A//r ==> Y \<in> A//r
   1.322 -    ==> (!!x y. x \<in> A ==> y \<in> A ==> f x = f y ==> (x, y) \<in> r)
   1.323 -    ==> X = Y"
   1.324 +  "equiv A r \<Longrightarrow> f respects r \<Longrightarrow>
   1.325 +    (\<Union>x \<in> X. f x) = (\<Union>y \<in> Y. f y) \<Longrightarrow> X \<in> A//r ==> Y \<in> A//r
   1.326 +    \<Longrightarrow> (\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> f x = f y \<Longrightarrow> (x, y) \<in> r)
   1.327 +    \<Longrightarrow> X = Y"
   1.328    apply (unfold quotient_def)
   1.329    apply clarify
   1.330    apply (rule equiv_class_eq)
   1.331 @@ -254,33 +230,30 @@
   1.332  
   1.333  subsection \<open>Defining binary operations upon equivalence classes\<close>
   1.334  
   1.335 -text\<open>A congruence-preserving function of two arguments\<close>
   1.336 +text \<open>A congruence-preserving function of two arguments.\<close>
   1.337  
   1.338 -definition congruent2 :: "('a \<times> 'a) set \<Rightarrow> ('b \<times> 'b) set \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> bool" where
   1.339 -  "congruent2 r1 r2 f \<longleftrightarrow> (\<forall>(y1, z1) \<in> r1. \<forall>(y2, z2) \<in> r2. f y1 y2 = f z1 z2)"
   1.340 +definition congruent2 :: "('a \<times> 'a) set \<Rightarrow> ('b \<times> 'b) set \<Rightarrow> ('a \<Rightarrow> 'b \<Rightarrow> 'c) \<Rightarrow> bool"
   1.341 +  where "congruent2 r1 r2 f \<longleftrightarrow> (\<forall>(y1, z1) \<in> r1. \<forall>(y2, z2) \<in> r2. f y1 y2 = f z1 z2)"
   1.342  
   1.343  lemma congruent2I':
   1.344    assumes "\<And>y1 z1 y2 z2. (y1, z1) \<in> r1 \<Longrightarrow> (y2, z2) \<in> r2 \<Longrightarrow> f y1 y2 = f z1 z2"
   1.345    shows "congruent2 r1 r2 f"
   1.346    using assms by (auto simp add: congruent2_def)
   1.347  
   1.348 -lemma congruent2D:
   1.349 -  "congruent2 r1 r2 f \<Longrightarrow> (y1, z1) \<in> r1 \<Longrightarrow> (y2, z2) \<in> r2 \<Longrightarrow> f y1 y2 = f z1 z2"
   1.350 +lemma congruent2D: "congruent2 r1 r2 f \<Longrightarrow> (y1, z1) \<in> r1 \<Longrightarrow> (y2, z2) \<in> r2 \<Longrightarrow> f y1 y2 = f z1 z2"
   1.351    by (auto simp add: congruent2_def)
   1.352  
   1.353 -text\<open>Abbreviation for the common case where the relations are identical\<close>
   1.354 -abbreviation
   1.355 -  RESPECTS2:: "['a => 'a => 'b, ('a * 'a) set] => bool"
   1.356 -    (infixr "respects2" 80) where
   1.357 -  "f respects2 r == congruent2 r r f"
   1.358 +text \<open>Abbreviation for the common case where the relations are identical.\<close>
   1.359 +abbreviation RESPECTS2:: "('a \<Rightarrow> 'a \<Rightarrow> 'b) \<Rightarrow> ('a \<times> 'a) set \<Rightarrow> bool"  (infixr "respects2" 80)
   1.360 +  where "f respects2 r \<equiv> congruent2 r r f"
   1.361  
   1.362  
   1.363  lemma congruent2_implies_congruent:
   1.364 -    "equiv A r1 ==> congruent2 r1 r2 f ==> a \<in> A ==> congruent r2 (f a)"
   1.365 -  by (unfold congruent_def congruent2_def equiv_def refl_on_def) blast
   1.366 +  "equiv A r1 \<Longrightarrow> congruent2 r1 r2 f \<Longrightarrow> a \<in> A \<Longrightarrow> congruent r2 (f a)"
   1.367 +  unfolding congruent_def congruent2_def equiv_def refl_on_def by blast
   1.368  
   1.369  lemma congruent2_implies_congruent_UN:
   1.370 -  "equiv A1 r1 ==> equiv A2 r2 ==> congruent2 r1 r2 f ==> a \<in> A2 ==>
   1.371 +  "equiv A1 r1 \<Longrightarrow> equiv A2 r2 \<Longrightarrow> congruent2 r1 r2 f \<Longrightarrow> a \<in> A2 \<Longrightarrow>
   1.372      congruent r1 (\<lambda>x1. \<Union>x2 \<in> r2``{a}. f x1 x2)"
   1.373    apply (unfold congruent_def)
   1.374    apply clarify
   1.375 @@ -291,20 +264,19 @@
   1.376    done
   1.377  
   1.378  lemma UN_equiv_class2:
   1.379 -  "equiv A1 r1 ==> equiv A2 r2 ==> congruent2 r1 r2 f ==> a1 \<in> A1 ==> a2 \<in> A2
   1.380 -    ==> (\<Union>x1 \<in> r1``{a1}. \<Union>x2 \<in> r2``{a2}. f x1 x2) = f a1 a2"
   1.381 -  by (simp add: UN_equiv_class congruent2_implies_congruent
   1.382 -    congruent2_implies_congruent_UN)
   1.383 +  "equiv A1 r1 \<Longrightarrow> equiv A2 r2 \<Longrightarrow> congruent2 r1 r2 f \<Longrightarrow> a1 \<in> A1 \<Longrightarrow> a2 \<in> A2 \<Longrightarrow>
   1.384 +    (\<Union>x1 \<in> r1``{a1}. \<Union>x2 \<in> r2``{a2}. f x1 x2) = f a1 a2"
   1.385 +  by (simp add: UN_equiv_class congruent2_implies_congruent congruent2_implies_congruent_UN)
   1.386  
   1.387  lemma UN_equiv_class_type2:
   1.388 -  "equiv A1 r1 ==> equiv A2 r2 ==> congruent2 r1 r2 f
   1.389 -    ==> X1 \<in> A1//r1 ==> X2 \<in> A2//r2
   1.390 -    ==> (!!x1 x2. x1 \<in> A1 ==> x2 \<in> A2 ==> f x1 x2 \<in> B)
   1.391 -    ==> (\<Union>x1 \<in> X1. \<Union>x2 \<in> X2. f x1 x2) \<in> B"
   1.392 +  "equiv A1 r1 \<Longrightarrow> equiv A2 r2 \<Longrightarrow> congruent2 r1 r2 f
   1.393 +    \<Longrightarrow> X1 \<in> A1//r1 \<Longrightarrow> X2 \<in> A2//r2
   1.394 +    \<Longrightarrow> (\<And>x1 x2. x1 \<in> A1 \<Longrightarrow> x2 \<in> A2 \<Longrightarrow> f x1 x2 \<in> B)
   1.395 +    \<Longrightarrow> (\<Union>x1 \<in> X1. \<Union>x2 \<in> X2. f x1 x2) \<in> B"
   1.396    apply (unfold quotient_def)
   1.397    apply clarify
   1.398    apply (blast intro: UN_equiv_class_type congruent2_implies_congruent_UN
   1.399 -    congruent2_implies_congruent quotientI)
   1.400 +      congruent2_implies_congruent quotientI)
   1.401    done
   1.402  
   1.403  lemma UN_UN_split_split_eq:
   1.404 @@ -315,12 +287,12 @@
   1.405    by auto
   1.406  
   1.407  lemma congruent2I:
   1.408 -  "equiv A1 r1 ==> equiv A2 r2
   1.409 -    ==> (!!y z w. w \<in> A2 ==> (y,z) \<in> r1 ==> f y w = f z w)
   1.410 -    ==> (!!y z w. w \<in> A1 ==> (y,z) \<in> r2 ==> f w y = f w z)
   1.411 -    ==> congruent2 r1 r2 f"
   1.412 +  "equiv A1 r1 \<Longrightarrow> equiv A2 r2
   1.413 +    \<Longrightarrow> (\<And>y z w. w \<in> A2 \<Longrightarrow> (y,z) \<in> r1 \<Longrightarrow> f y w = f z w)
   1.414 +    \<Longrightarrow> (\<And>y z w. w \<in> A1 \<Longrightarrow> (y,z) \<in> r2 \<Longrightarrow> f w y = f w z)
   1.415 +    \<Longrightarrow> congruent2 r1 r2 f"
   1.416    \<comment> \<open>Suggested by John Harrison -- the two subproofs may be\<close>
   1.417 -  \<comment> \<open>\emph{much} simpler than the direct proof.\<close>
   1.418 +  \<comment> \<open>\<^emph>\<open>much\<close> simpler than the direct proof.\<close>
   1.419    apply (unfold congruent2_def equiv_def refl_on_def)
   1.420    apply clarify
   1.421    apply (blast intro: trans)
   1.422 @@ -328,8 +300,8 @@
   1.423  
   1.424  lemma congruent2_commuteI:
   1.425    assumes equivA: "equiv A r"
   1.426 -    and commute: "!!y z. y \<in> A ==> z \<in> A ==> f y z = f z y"
   1.427 -    and congt: "!!y z w. w \<in> A ==> (y,z) \<in> r ==> f w y = f w z"
   1.428 +    and commute: "\<And>y z. y \<in> A \<Longrightarrow> z \<in> A \<Longrightarrow> f y z = f z y"
   1.429 +    and congt: "\<And>y z w. w \<in> A \<Longrightarrow> (y,z) \<in> r \<Longrightarrow> f w y = f w z"
   1.430    shows "f respects2 r"
   1.431    apply (rule congruent2I [OF equivA equivA])
   1.432     apply (rule commute [THEN trans])
   1.433 @@ -344,7 +316,7 @@
   1.434  
   1.435  text \<open>Suggested by Florian Kammüller\<close>
   1.436  
   1.437 -lemma finite_quotient: "finite A ==> r \<subseteq> A \<times> A ==> finite (A//r)"
   1.438 +lemma finite_quotient: "finite A \<Longrightarrow> r \<subseteq> A \<times> A \<Longrightarrow> finite (A//r)"
   1.439    \<comment> \<open>recall @{thm equiv_type}\<close>
   1.440    apply (rule finite_subset)
   1.441     apply (erule_tac [2] finite_Pow_iff [THEN iffD2])
   1.442 @@ -352,93 +324,94 @@
   1.443    apply blast
   1.444    done
   1.445  
   1.446 -lemma finite_equiv_class:
   1.447 -  "finite A ==> r \<subseteq> A \<times> A ==> X \<in> A//r ==> finite X"
   1.448 +lemma finite_equiv_class: "finite A \<Longrightarrow> r \<subseteq> A \<times> A \<Longrightarrow> X \<in> A//r \<Longrightarrow> finite X"
   1.449    apply (unfold quotient_def)
   1.450    apply (rule finite_subset)
   1.451     prefer 2 apply assumption
   1.452    apply blast
   1.453    done
   1.454  
   1.455 -lemma equiv_imp_dvd_card:
   1.456 -  "finite A ==> equiv A r ==> \<forall>X \<in> A//r. k dvd card X
   1.457 -    ==> k dvd card A"
   1.458 +lemma equiv_imp_dvd_card: "finite A \<Longrightarrow> equiv A r \<Longrightarrow> \<forall>X \<in> A//r. k dvd card X \<Longrightarrow> k dvd card A"
   1.459    apply (rule Union_quotient [THEN subst [where P="\<lambda>A. k dvd card A"]])
   1.460     apply assumption
   1.461    apply (rule dvd_partition)
   1.462 -     prefer 3 apply (blast dest: quotient_disj)
   1.463 -    apply (simp_all add: Union_quotient equiv_type)
   1.464 +    prefer 3 apply (blast dest: quotient_disj)
   1.465 +   apply (simp_all add: Union_quotient equiv_type)
   1.466    done
   1.467  
   1.468 -lemma card_quotient_disjoint:
   1.469 - "\<lbrakk> finite A; inj_on (\<lambda>x. {x} // r) A \<rbrakk> \<Longrightarrow> card(A//r) = card A"
   1.470 -apply(simp add:quotient_def)
   1.471 -apply(subst card_UN_disjoint)
   1.472 -   apply assumption
   1.473 +lemma card_quotient_disjoint: "finite A \<Longrightarrow> inj_on (\<lambda>x. {x} // r) A \<Longrightarrow> card (A//r) = card A"
   1.474 +  apply (simp add:quotient_def)
   1.475 +  apply (subst card_UN_disjoint)
   1.476 +     apply assumption
   1.477 +    apply simp
   1.478 +   apply (fastforce simp add:inj_on_def)
   1.479    apply simp
   1.480 - apply(fastforce simp add:inj_on_def)
   1.481 -apply simp
   1.482 -done
   1.483 +  done
   1.484  
   1.485  
   1.486  subsection \<open>Projection\<close>
   1.487  
   1.488 -definition proj where "proj r x = r `` {x}"
   1.489 +definition proj :: "('b \<times> 'a) set \<Rightarrow> 'b \<Rightarrow> 'a set"
   1.490 +  where "proj r x = r `` {x}"
   1.491  
   1.492 -lemma proj_preserves:
   1.493 -"x \<in> A \<Longrightarrow> proj r x \<in> A//r"
   1.494 -unfolding proj_def by (rule quotientI)
   1.495 +lemma proj_preserves: "x \<in> A \<Longrightarrow> proj r x \<in> A//r"
   1.496 +  unfolding proj_def by (rule quotientI)
   1.497  
   1.498  lemma proj_in_iff:
   1.499 -assumes "equiv A r"
   1.500 -shows "(proj r x \<in> A//r) = (x \<in> A)"
   1.501 -apply(rule iffI, auto simp add: proj_preserves)
   1.502 -unfolding proj_def quotient_def proof clarsimp
   1.503 -  fix y assume y: "y \<in> A" and "r `` {x} = r `` {y}"
   1.504 -  moreover have "y \<in> r `` {y}" using assms y unfolding equiv_def refl_on_def by blast
   1.505 -  ultimately have "(x,y) \<in> r" by blast
   1.506 -  thus "x \<in> A" using assms unfolding equiv_def refl_on_def by blast
   1.507 +  assumes "equiv A r"
   1.508 +  shows "proj r x \<in> A//r \<longleftrightarrow> x \<in> A"
   1.509 +    (is "?lhs \<longleftrightarrow> ?rhs")
   1.510 +proof
   1.511 +  assume ?rhs
   1.512 +  then show ?lhs by (simp add: proj_preserves)
   1.513 +next
   1.514 +  assume ?lhs
   1.515 +  then show ?rhs
   1.516 +    unfolding proj_def quotient_def
   1.517 +  proof clarsimp
   1.518 +    fix y
   1.519 +    assume y: "y \<in> A" and "r `` {x} = r `` {y}"
   1.520 +    moreover have "y \<in> r `` {y}"
   1.521 +      using assms y unfolding equiv_def refl_on_def by blast
   1.522 +    ultimately have "(x, y) \<in> r" by blast
   1.523 +    then show "x \<in> A"
   1.524 +      using assms unfolding equiv_def refl_on_def by blast
   1.525 +  qed
   1.526  qed
   1.527  
   1.528 -lemma proj_iff:
   1.529 -"\<lbrakk>equiv A r; {x,y} \<subseteq> A\<rbrakk> \<Longrightarrow> (proj r x = proj r y) = ((x,y) \<in> r)"
   1.530 -by (simp add: proj_def eq_equiv_class_iff)
   1.531 +lemma proj_iff: "equiv A r \<Longrightarrow> {x, y} \<subseteq> A \<Longrightarrow> proj r x = proj r y \<longleftrightarrow> (x, y) \<in> r"
   1.532 +  by (simp add: proj_def eq_equiv_class_iff)
   1.533  
   1.534  (*
   1.535  lemma in_proj: "\<lbrakk>equiv A r; x \<in> A\<rbrakk> \<Longrightarrow> x \<in> proj r x"
   1.536  unfolding proj_def equiv_def refl_on_def by blast
   1.537  *)
   1.538  
   1.539 -lemma proj_image: "(proj r) ` A = A//r"
   1.540 -unfolding proj_def[abs_def] quotient_def by blast
   1.541 +lemma proj_image: "proj r ` A = A//r"
   1.542 +  unfolding proj_def[abs_def] quotient_def by blast
   1.543  
   1.544 -lemma in_quotient_imp_non_empty:
   1.545 -"\<lbrakk>equiv A r; X \<in> A//r\<rbrakk> \<Longrightarrow> X \<noteq> {}"
   1.546 -unfolding quotient_def using equiv_class_self by fast
   1.547 +lemma in_quotient_imp_non_empty: "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> X \<noteq> {}"
   1.548 +  unfolding quotient_def using equiv_class_self by fast
   1.549  
   1.550 -lemma in_quotient_imp_in_rel:
   1.551 -"\<lbrakk>equiv A r; X \<in> A//r; {x,y} \<subseteq> X\<rbrakk> \<Longrightarrow> (x,y) \<in> r"
   1.552 -using quotient_eq_iff[THEN iffD1] by fastforce
   1.553 +lemma in_quotient_imp_in_rel: "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> {x, y} \<subseteq> X \<Longrightarrow> (x, y) \<in> r"
   1.554 +  using quotient_eq_iff[THEN iffD1] by fastforce
   1.555  
   1.556 -lemma in_quotient_imp_closed:
   1.557 -"\<lbrakk>equiv A r; X \<in> A//r; x \<in> X; (x,y) \<in> r\<rbrakk> \<Longrightarrow> y \<in> X"
   1.558 -unfolding quotient_def equiv_def trans_def by blast
   1.559 +lemma in_quotient_imp_closed: "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> x \<in> X \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> y \<in> X"
   1.560 +  unfolding quotient_def equiv_def trans_def by blast
   1.561  
   1.562 -lemma in_quotient_imp_subset:
   1.563 -"\<lbrakk>equiv A r; X \<in> A//r\<rbrakk> \<Longrightarrow> X \<subseteq> A"
   1.564 -using in_quotient_imp_in_rel equiv_type by fastforce
   1.565 +lemma in_quotient_imp_subset: "equiv A r \<Longrightarrow> X \<in> A//r \<Longrightarrow> X \<subseteq> A"
   1.566 +  using in_quotient_imp_in_rel equiv_type by fastforce
   1.567  
   1.568  
   1.569  subsection \<open>Equivalence relations -- predicate version\<close>
   1.570  
   1.571 -text \<open>Partial equivalences\<close>
   1.572 +text \<open>Partial equivalences.\<close>
   1.573  
   1.574 -definition part_equivp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where
   1.575 -  "part_equivp R \<longleftrightarrow> (\<exists>x. R x x) \<and> (\<forall>x y. R x y \<longleftrightarrow> R x x \<and> R y y \<and> R x = R y)"
   1.576 +definition part_equivp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
   1.577 +  where "part_equivp R \<longleftrightarrow> (\<exists>x. R x x) \<and> (\<forall>x y. R x y \<longleftrightarrow> R x x \<and> R y y \<and> R x = R y)"
   1.578      \<comment> \<open>John-Harrison-style characterization\<close>
   1.579  
   1.580 -lemma part_equivpI:
   1.581 -  "(\<exists>x. R x x) \<Longrightarrow> symp R \<Longrightarrow> transp R \<Longrightarrow> part_equivp R"
   1.582 +lemma part_equivpI: "\<exists>x. R x x \<Longrightarrow> symp R \<Longrightarrow> transp R \<Longrightarrow> part_equivp R"
   1.583    by (auto simp add: part_equivp_def) (auto elim: sympE transpE)
   1.584  
   1.585  lemma part_equivpE:
   1.586 @@ -447,7 +420,7 @@
   1.587  proof -
   1.588    from assms have 1: "\<exists>x. R x x"
   1.589      and 2: "\<And>x y. R x y \<longleftrightarrow> R x x \<and> R y y \<and> R x = R y"
   1.590 -    by (unfold part_equivp_def) blast+
   1.591 +    unfolding part_equivp_def by blast+
   1.592    from 1 obtain x where "R x x" ..
   1.593    moreover have "symp R"
   1.594    proof (rule sympI)
   1.595 @@ -464,30 +437,25 @@
   1.596    ultimately show thesis by (rule that)
   1.597  qed
   1.598  
   1.599 -lemma part_equivp_refl_symp_transp:
   1.600 -  "part_equivp R \<longleftrightarrow> (\<exists>x. R x x) \<and> symp R \<and> transp R"
   1.601 +lemma part_equivp_refl_symp_transp: "part_equivp R \<longleftrightarrow> (\<exists>x. R x x) \<and> symp R \<and> transp R"
   1.602    by (auto intro: part_equivpI elim: part_equivpE)
   1.603  
   1.604 -lemma part_equivp_symp:
   1.605 -  "part_equivp R \<Longrightarrow> R x y \<Longrightarrow> R y x"
   1.606 +lemma part_equivp_symp: "part_equivp R \<Longrightarrow> R x y \<Longrightarrow> R y x"
   1.607    by (erule part_equivpE, erule sympE)
   1.608  
   1.609 -lemma part_equivp_transp:
   1.610 -  "part_equivp R \<Longrightarrow> R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
   1.611 +lemma part_equivp_transp: "part_equivp R \<Longrightarrow> R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
   1.612    by (erule part_equivpE, erule transpE)
   1.613  
   1.614 -lemma part_equivp_typedef:
   1.615 -  "part_equivp R \<Longrightarrow> \<exists>d. d \<in> {c. \<exists>x. R x x \<and> c = Collect (R x)}"
   1.616 +lemma part_equivp_typedef: "part_equivp R \<Longrightarrow> \<exists>d. d \<in> {c. \<exists>x. R x x \<and> c = Collect (R x)}"
   1.617    by (auto elim: part_equivpE)
   1.618  
   1.619  
   1.620 -text \<open>Total equivalences\<close>
   1.621 +text \<open>Total equivalences.\<close>
   1.622  
   1.623 -definition equivp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool" where
   1.624 -  "equivp R \<longleftrightarrow> (\<forall>x y. R x y = (R x = R y))" \<comment> \<open>John-Harrison-style characterization\<close>
   1.625 +definition equivp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> bool"
   1.626 +  where "equivp R \<longleftrightarrow> (\<forall>x y. R x y = (R x = R y))" \<comment> \<open>John-Harrison-style characterization\<close>
   1.627  
   1.628 -lemma equivpI:
   1.629 -  "reflp R \<Longrightarrow> symp R \<Longrightarrow> transp R \<Longrightarrow> equivp R"
   1.630 +lemma equivpI: "reflp R \<Longrightarrow> symp R \<Longrightarrow> transp R \<Longrightarrow> equivp R"
   1.631    by (auto elim: reflpE sympE transpE simp add: equivp_def)
   1.632  
   1.633  lemma equivpE:
   1.634 @@ -495,32 +463,25 @@
   1.635    obtains "reflp R" and "symp R" and "transp R"
   1.636    using assms by (auto intro!: that reflpI sympI transpI simp add: equivp_def)
   1.637  
   1.638 -lemma equivp_implies_part_equivp:
   1.639 -  "equivp R \<Longrightarrow> part_equivp R"
   1.640 +lemma equivp_implies_part_equivp: "equivp R \<Longrightarrow> part_equivp R"
   1.641    by (auto intro: part_equivpI elim: equivpE reflpE)
   1.642  
   1.643 -lemma equivp_equiv:
   1.644 -  "equiv UNIV A \<longleftrightarrow> equivp (\<lambda>x y. (x, y) \<in> A)"
   1.645 +lemma equivp_equiv: "equiv UNIV A \<longleftrightarrow> equivp (\<lambda>x y. (x, y) \<in> A)"
   1.646    by (auto intro!: equivI equivpI [to_set] elim!: equivE equivpE [to_set])
   1.647  
   1.648 -lemma equivp_reflp_symp_transp:
   1.649 -  shows "equivp R \<longleftrightarrow> reflp R \<and> symp R \<and> transp R"
   1.650 +lemma equivp_reflp_symp_transp: "equivp R \<longleftrightarrow> reflp R \<and> symp R \<and> transp R"
   1.651    by (auto intro: equivpI elim: equivpE)
   1.652  
   1.653 -lemma identity_equivp:
   1.654 -  "equivp (op =)"
   1.655 +lemma identity_equivp: "equivp (op =)"
   1.656    by (auto intro: equivpI reflpI sympI transpI)
   1.657  
   1.658 -lemma equivp_reflp:
   1.659 -  "equivp R \<Longrightarrow> R x x"
   1.660 +lemma equivp_reflp: "equivp R \<Longrightarrow> R x x"
   1.661    by (erule equivpE, erule reflpE)
   1.662  
   1.663 -lemma equivp_symp:
   1.664 -  "equivp R \<Longrightarrow> R x y \<Longrightarrow> R y x"
   1.665 +lemma equivp_symp: "equivp R \<Longrightarrow> R x y \<Longrightarrow> R y x"
   1.666    by (erule equivpE, erule sympE)
   1.667  
   1.668 -lemma equivp_transp:
   1.669 -  "equivp R \<Longrightarrow> R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
   1.670 +lemma equivp_transp: "equivp R \<Longrightarrow> R x y \<Longrightarrow> R y z \<Longrightarrow> R x z"
   1.671    by (erule equivpE, erule transpE)
   1.672  
   1.673  hide_const (open) proj