src/HOL/Relation.thy
changeset 82275 c17902fcf5e7
parent 82273 365917fc6e31
child 82279 d260714c4f8e
equal deleted inserted replaced
82274:c61367ada9bb 82275:c17902fcf5e7
   830   where "single_valued r \<longleftrightarrow> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (\<forall>z. (x, z) \<in> r \<longrightarrow> y = z))"
   830   where "single_valued r \<longleftrightarrow> (\<forall>x y. (x, y) \<in> r \<longrightarrow> (\<forall>z. (x, z) \<in> r \<longrightarrow> y = z))"
   831 
   831 
   832 definition single_valuedp :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
   832 definition single_valuedp :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool"
   833   where "single_valuedp r \<longleftrightarrow> (\<forall>x y. r x y \<longrightarrow> (\<forall>z. r x z \<longrightarrow> y = z))"
   833   where "single_valuedp r \<longleftrightarrow> (\<forall>x y. r x y \<longrightarrow> (\<forall>z. r x z \<longrightarrow> y = z))"
   834 
   834 
       
   835 definition right_unique :: "('a \<Rightarrow> 'b \<Rightarrow> bool) \<Rightarrow> bool" where
       
   836   "right_unique R \<longleftrightarrow> (\<forall>x y z. R x y \<longrightarrow> R x z \<longrightarrow> y = z)"
       
   837 
       
   838 lemma single_valuedp_eq_right_unique: "single_valuedp = right_unique"
       
   839   by (rule ext) (simp add: single_valuedp_def right_unique_def)
       
   840 
   835 lemma single_valuedp_single_valued_eq [pred_set_conv]:
   841 lemma single_valuedp_single_valued_eq [pred_set_conv]:
   836   "single_valuedp (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> single_valued r"
   842   "single_valuedp (\<lambda>x y. (x, y) \<in> r) \<longleftrightarrow> single_valued r"
   837   by (simp add: single_valued_def single_valuedp_def)
   843   by (simp add: single_valued_def single_valuedp_def)
   838 
   844 
   839 lemma single_valuedp_iff_Uniq:
   845 lemma single_valuedp_iff_Uniq:
   846 
   852 
   847 lemma single_valuedpI:
   853 lemma single_valuedpI:
   848   "(\<And>x y. r x y \<Longrightarrow> (\<And>z. r x z \<Longrightarrow> y = z)) \<Longrightarrow> single_valuedp r"
   854   "(\<And>x y. r x y \<Longrightarrow> (\<And>z. r x z \<Longrightarrow> y = z)) \<Longrightarrow> single_valuedp r"
   849   by (fact single_valuedI [to_pred])
   855   by (fact single_valuedI [to_pred])
   850 
   856 
       
   857 lemma right_uniqueI: "(\<And>x y z. R x y \<Longrightarrow> R x z \<Longrightarrow> y = z) \<Longrightarrow> right_unique R"
       
   858   unfolding right_unique_def by fast
       
   859 
   851 lemma single_valuedD:
   860 lemma single_valuedD:
   852   "single_valued r \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> (x, z) \<in> r \<Longrightarrow> y = z"
   861   "single_valued r \<Longrightarrow> (x, y) \<in> r \<Longrightarrow> (x, z) \<in> r \<Longrightarrow> y = z"
   853   by (simp add: single_valued_def)
   862   by (simp add: single_valued_def)
   854 
   863 
   855 lemma single_valuedpD:
   864 lemma single_valuedpD:
   856   "single_valuedp r \<Longrightarrow> r x y \<Longrightarrow> r x z \<Longrightarrow> y = z"
   865   "single_valuedp r \<Longrightarrow> r x y \<Longrightarrow> r x z \<Longrightarrow> y = z"
   857   by (fact single_valuedD [to_pred])
   866   by (fact single_valuedD [to_pred])
       
   867 
       
   868 lemma right_uniqueD: "right_unique R \<Longrightarrow> R x y \<Longrightarrow> R x z \<Longrightarrow> y = z"
       
   869   unfolding right_unique_def by fast
   858 
   870 
   859 lemma single_valued_empty [simp]:
   871 lemma single_valued_empty [simp]:
   860   "single_valued {}"
   872   "single_valued {}"
   861   by (simp add: single_valued_def)
   873   by (simp add: single_valued_def)
   862 
   874