src/HOL/Equiv_Relations.thy
changeset 19323 ec5cd5b1804c
parent 18493 343da052b961
child 19363 667b5ea637dd
equal deleted inserted replaced
19322:bf84bdf05f14 19323:ec5cd5b1804c
   161 text{*A congruence-preserving function*}
   161 text{*A congruence-preserving function*}
   162 locale congruent =
   162 locale congruent =
   163   fixes r and f
   163   fixes r and f
   164   assumes congruent: "(y,z) \<in> r ==> f y = f z"
   164   assumes congruent: "(y,z) \<in> r ==> f y = f z"
   165 
   165 
   166 syntax
   166 abbreviation (output)
   167   RESPECTS ::"['a => 'b, ('a * 'a) set] => bool"  (infixr "respects" 80)
   167   RESPECTS :: "('a => 'b) => ('a * 'a) set => bool"  (infixr "respects" 80)
   168 
   168   "f respects r = congruent r f"
   169 translations
       
   170   "f respects r" == "congruent r f"
       
   171 
   169 
   172 
   170 
   173 lemma UN_constant_eq: "a \<in> A ==> \<forall>y \<in> A. f y = c ==> (\<Union>y \<in> A. f(y))=c"
   171 lemma UN_constant_eq: "a \<in> A ==> \<forall>y \<in> A. f y = c ==> (\<Union>y \<in> A. f(y))=c"
   174   -- {* lemma required to prove @{text UN_equiv_class} *}
   172   -- {* lemma required to prove @{text UN_equiv_class} *}
   175   by auto
   173   by auto
   223     "(y1,z1) \<in> r1 ==> (y2,z2) \<in> r2 ==> f y1 y2 = f z1 z2"
   221     "(y1,z1) \<in> r1 ==> (y2,z2) \<in> r2 ==> f y1 y2 = f z1 z2"
   224 
   222 
   225 text{*Abbreviation for the common case where the relations are identical*}
   223 text{*Abbreviation for the common case where the relations are identical*}
   226 syntax
   224 syntax
   227   RESPECTS2 ::"['a => 'b, ('a * 'a) set] => bool"  (infixr "respects2 " 80)
   225   RESPECTS2 ::"['a => 'b, ('a * 'a) set] => bool"  (infixr "respects2 " 80)
   228 
       
   229 translations
   226 translations
   230   "f respects2 r" => "congruent2 r r f"
   227   "f respects2 r" => "congruent2 r r f"
       
   228 (*
       
   229 Warning: cannot use "abbreviation" here because the two occurrences of
       
   230 r may need to be of different type (see Hyperreal/StarDef).
       
   231 *)
   231 
   232 
   232 lemma congruent2_implies_congruent:
   233 lemma congruent2_implies_congruent:
   233     "equiv A r1 ==> congruent2 r1 r2 f ==> a \<in> A ==> congruent r2 (f a)"
   234     "equiv A r1 ==> congruent2 r1 r2 f ==> a \<in> A ==> congruent r2 (f a)"
   234   by (unfold congruent_def congruent2_def equiv_def refl_def) blast
   235   by (unfold congruent_def congruent2_def equiv_def refl_def) blast
   235 
   236 
   331    apply assumption
   332    apply assumption
   332   apply simp
   333   apply simp
   333  apply(fastsimp simp add:inj_on_def)
   334  apply(fastsimp simp add:inj_on_def)
   334 apply (simp add:setsum_constant)
   335 apply (simp add:setsum_constant)
   335 done
   336 done
   336 
   337 (*
   337 ML
   338 ML
   338 {*
   339 {*
   339 val UN_UN_split_split_eq = thm "UN_UN_split_split_eq";
   340 val UN_UN_split_split_eq = thm "UN_UN_split_split_eq";
   340 val UN_constant_eq = thm "UN_constant_eq";
   341 val UN_constant_eq = thm "UN_constant_eq";
   341 val UN_equiv_class = thm "UN_equiv_class";
   342 val UN_equiv_class = thm "UN_equiv_class";
   369 val quotient_disj = thm "quotient_disj";
   370 val quotient_disj = thm "quotient_disj";
   370 val refl_comp_subset = thm "refl_comp_subset";
   371 val refl_comp_subset = thm "refl_comp_subset";
   371 val subset_equiv_class = thm "subset_equiv_class";
   372 val subset_equiv_class = thm "subset_equiv_class";
   372 val sym_trans_comp_subset = thm "sym_trans_comp_subset";
   373 val sym_trans_comp_subset = thm "sym_trans_comp_subset";
   373 *}
   374 *}
   374 
   375 *)
   375 end
   376 end