src/HOL/Transitive_Closure.thy
changeset 45139 bdcaa3f3a2f4
parent 45137 6e422d180de8
child 45140 339a8b3c4791
--- a/src/HOL/Transitive_Closure.thy	Thu Oct 13 22:56:19 2011 +0200
+++ b/src/HOL/Transitive_Closure.thy	Thu Oct 13 23:02:59 2011 +0200
@@ -980,6 +980,50 @@
 apply (fast dest: single_valuedD elim: rel_pow_Suc_E)
 done
 
+subsection {* Acyclic relations *}
+
+definition acyclic :: "('a * 'a) set => bool" where
+  "acyclic r \<longleftrightarrow> (!x. (x,x) ~: r^+)"
+
+abbreviation acyclicP :: "('a => 'a => bool) => bool" where
+  "acyclicP r \<equiv> acyclic {(x, y). r x y}"
+
+lemma acyclic_irrefl:
+  "acyclic r \<longleftrightarrow> irrefl (r^+)"
+  by (simp add: acyclic_def irrefl_def)
+
+lemma acyclicI: "ALL x. (x, x) ~: r^+ ==> acyclic r"
+  by (simp add: acyclic_def)
+
+lemma acyclic_insert [iff]:
+     "acyclic(insert (y,x) r) = (acyclic r & (x,y) ~: r^*)"
+apply (simp add: acyclic_def trancl_insert)
+apply (blast intro: rtrancl_trans)
+done
+
+lemma acyclic_converse [iff]: "acyclic(r^-1) = acyclic r"
+by (simp add: acyclic_def trancl_converse)
+
+lemmas acyclicP_converse [iff] = acyclic_converse [to_pred]
+
+lemma acyclic_impl_antisym_rtrancl: "acyclic r ==> antisym(r^*)"
+apply (simp add: acyclic_def antisym_def)
+apply (blast elim: rtranclE intro: rtrancl_into_trancl1 rtrancl_trancl_trancl)
+done
+
+(* Other direction:
+acyclic = no loops
+antisym = only self loops
+Goalw [acyclic_def,antisym_def] "antisym( r^* ) ==> acyclic(r - Id)
+==> antisym( r^* ) = acyclic(r - Id)";
+*)
+
+lemma acyclic_subset: "[| acyclic s; r <= s |] ==> acyclic r"
+apply (simp add: acyclic_def)
+apply (blast intro: trancl_mono)
+done
+
+
 subsection {* Setup of transitivity reasoner *}
 
 ML {*