src/HOL/Order_Relation.thy
changeset 82252 8a7620fe0e83
parent 82251 8cf503824ccf
equal deleted inserted replaced
82251:8cf503824ccf 82252:8a7620fe0e83
   151 subsection\<open>Relations given by a predicate and the field\<close>
   151 subsection\<open>Relations given by a predicate and the field\<close>
   152 
   152 
   153 definition relation_of :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> ('a \<times> 'a) set"
   153 definition relation_of :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a set \<Rightarrow> ('a \<times> 'a) set"
   154   where "relation_of P A \<equiv> { (a, b) \<in> A \<times> A. P a b }"
   154   where "relation_of P A \<equiv> { (a, b) \<in> A \<times> A. P a b }"
   155 
   155 
       
   156 lemma refl_relation_ofD: "refl (relation_of R S) \<Longrightarrow> reflp_on S R"
       
   157   by (auto simp: relation_of_def intro: reflp_onI dest: reflD)
       
   158 
       
   159 lemma irrefl_relation_ofD: "irrefl (relation_of R S) \<Longrightarrow> irreflp_on S R"
       
   160   by (auto simp: relation_of_def intro: irreflp_onI dest: irreflD)
       
   161 
   156 lemma sym_relation_of[simp]: "sym (relation_of R S) \<longleftrightarrow> symp_on S R"
   162 lemma sym_relation_of[simp]: "sym (relation_of R S) \<longleftrightarrow> symp_on S R"
   157 proof (rule iffI)
   163 proof (rule iffI)
   158   show "sym (relation_of R S) \<Longrightarrow> symp_on S R"
   164   show "sym (relation_of R S) \<Longrightarrow> symp_on S R"
   159     by (auto simp: relation_of_def intro: symp_onI dest: symD)
   165     by (auto simp: relation_of_def intro: symp_onI dest: symD)
   160 next
   166 next
   186     by (auto simp: relation_of_def intro: transp_onI dest: transD)
   192     by (auto simp: relation_of_def intro: transp_onI dest: transD)
   187 next
   193 next
   188   show "transp_on S R \<Longrightarrow> trans (relation_of R S)"
   194   show "transp_on S R \<Longrightarrow> trans (relation_of R S)"
   189     by (auto simp: relation_of_def intro: transI dest: transp_onD)
   195     by (auto simp: relation_of_def intro: transI dest: transp_onD)
   190 qed
   196 qed
       
   197 
       
   198 lemma total_relation_ofD: "total (relation_of R S) \<Longrightarrow> totalp_on S R"
       
   199   by (auto simp: relation_of_def total_on_def intro: totalp_onI)
   191 
   200 
   192 lemma Field_relation_of:
   201 lemma Field_relation_of:
   193   assumes "relation_of P A \<subseteq> A \<times> A" and "refl_on A (relation_of P A)"
   202   assumes "relation_of P A \<subseteq> A \<times> A" and "refl_on A (relation_of P A)"
   194   shows "Field (relation_of P A) = A"
   203   shows "Field (relation_of P A) = A"
   195   using assms unfolding refl_on_def Field_def by auto
   204   using assms unfolding refl_on_def Field_def by auto