diff -r 7ea6b019ce24 -r 0781a2fc93f1 Graphs.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Graphs.thy Tue Jun 03 15:00:12 2014 +0100 @@ -0,0 +1,71 @@ +theory Graphs +imports Main +begin + +lemma rtrancl_eq_trancl [simp]: + assumes "x \ y" + shows "(x, y) \ r\<^sup>* \ (x, y) \ r\<^sup>+" +using assms by (metis rtrancl_eq_or_trancl) + +lemma trancl_split: + "(a, b) \ r^+ \ \ c. (a, c) \ r" +by (induct rule:trancl_induct, auto) + +lemma unique_minus: + assumes unique: "\ a b c. \(a, b) \ r; (a, c) \ r\ \ b = c" + and xy: "(x, y) \ r" + and xz: "(x, z) \ r^+" + and neq: "y \ z" + shows "(y, z) \ r^+" +by (metis converse_tranclE neq unique xy xz) + +lemma unique_base: + assumes unique: "\ a b c. \(a, b) \ r; (a, c) \ r\ \ b = c" + and xy: "(x, y) \ r" + and xz: "(x, z) \ r^+" + and neq_yz: "y \ z" + shows "(y, z) \ r^+" +by (metis neq_yz unique unique_minus xy xz) + +lemma unique_chain_star: + assumes unique: "\ a b c. \(a, b) \ r; (a, c) \ r\ \ b = c" + and xy: "(x, y) \ r^*" + and xz: "(x, z) \ r^*" + shows "(y, z) \ r^* \ (z, y) \ r^*" +thm single_valued_confluent single_valued_def unique xy xz +by (metis single_valued_confluent single_valued_def unique xy xz) + +lemma unique_chain: + assumes unique: "\ a b c. \(a, b) \ r; (a, c) \ r\ \ b = c" + and xy: "(x, y) \ r^+" + and xz: "(x, z) \ r^+" + and neq_yz: "y \ z" + shows "(y, z) \ r^+ \ (z, y) \ r^+" +proof - + have xy_star: "(x, y) \ r^*" + and xz_star: "(x, z) \ r^*" using xy xz by simp_all + from unique_chain_star[OF unique xy_star xz_star] + have "(y, z) \ r\<^sup>* \ (z, y) \ r\<^sup>*" by auto + with neq_yz + show ?thesis by(auto) +qed + +definition funof :: "[('a * 'b)set, 'a] => 'b" where + "funof r == (\x. THE y. (x, y) \ r)" + +lemma funof_eq: "[|single_valued r; (x, y) \ r|] ==> funof r x = y" +by (simp add: funof_def single_valued_def, blast) + +lemma funof_Pair_in: + "[|single_valued r; x \ Domain r|] ==> (x, funof r x) \ r" +by (force simp add: funof_eq) + +lemma funof_in: + "[|r `` {x} \ A; single_valued r; x \ Domain r|] ==> funof r x \ A" +by (force simp add: funof_eq) + +lemma single_valuedP_update: + shows "single_valuedP r \ single_valuedP (r(x := y))" +oops + +end \ No newline at end of file