src/HOL/Transitive_Closure.thy
changeset 75669 43f5dfb7fa35
parent 75652 c4a1088d0081
child 76495 a718547c3493
equal deleted inserted replaced
75668:b87b14e885af 75669:43f5dfb7fa35
   249   assumes major: "r\<^sup>*\<^sup>* x z"
   249   assumes major: "r\<^sup>*\<^sup>* x z"
   250     and cases: "x = z \<Longrightarrow> P" "\<And>y. r x y \<Longrightarrow> r\<^sup>*\<^sup>* y z \<Longrightarrow> P"
   250     and cases: "x = z \<Longrightarrow> P" "\<And>y. r x y \<Longrightarrow> r\<^sup>*\<^sup>* y z \<Longrightarrow> P"
   251   shows P
   251   shows P
   252 proof -
   252 proof -
   253   have "x = z \<or> (\<exists>y. r x y \<and> r\<^sup>*\<^sup>* y z)"
   253   have "x = z \<or> (\<exists>y. r x y \<and> r\<^sup>*\<^sup>* y z)"
   254     by (rule_tac major [THEN converse_rtranclp_induct]) iprover+
   254     by (rule major [THEN converse_rtranclp_induct]) iprover+
   255   then show ?thesis
   255   then show ?thesis
   256     by (auto intro: cases)
   256     by (auto intro: cases)
   257 qed
   257 qed
   258 
   258 
   259 lemmas converse_rtranclE = converse_rtranclpE [to_set]
   259 lemmas converse_rtranclE = converse_rtranclpE [to_set]
  1005   case 0
  1005   case 0
  1006   show ?case by auto
  1006   show ?case by auto
  1007 next
  1007 next
  1008   case (Suc n)
  1008   case (Suc n)
  1009   show ?case
  1009   show ?case
  1010   proof (simp add: relcomp_unfold Suc)
  1010   proof -
  1011     show "(\<exists>y. (\<exists>f. f 0 = a \<and> f n = y \<and> (\<forall>i<n. (f i,f(Suc i)) \<in> R)) \<and> (y,b) \<in> R) \<longleftrightarrow>
  1011     have "(\<exists>y. (\<exists>f. f 0 = a \<and> f n = y \<and> (\<forall>i<n. (f i,f(Suc i)) \<in> R)) \<and> (y,b) \<in> R) \<longleftrightarrow>
  1012       (\<exists>f. f 0 = a \<and> f(Suc n) = b \<and> (\<forall>i<Suc n. (f i, f (Suc i)) \<in> R))"
  1012       (\<exists>f. f 0 = a \<and> f(Suc n) = b \<and> (\<forall>i<Suc n. (f i, f (Suc i)) \<in> R))"
  1013     (is "?l = ?r")
  1013       (is "?l \<longleftrightarrow> ?r")
  1014     proof
  1014     proof
  1015       assume ?l
  1015       assume ?l
  1016       then obtain c f
  1016       then obtain c f
  1017         where 1: "f 0 = a"  "f n = c"  "\<And>i. i < n \<Longrightarrow> (f i, f (Suc i)) \<in> R"  "(c,b) \<in> R"
  1017         where 1: "f 0 = a"  "f n = c"  "\<And>i. i < n \<Longrightarrow> (f i, f (Suc i)) \<in> R"  "(c,b) \<in> R"
  1018         by auto
  1018         by auto
  1020       show ?r by (rule exI[of _ ?g]) (simp add: 1)
  1020       show ?r by (rule exI[of _ ?g]) (simp add: 1)
  1021     next
  1021     next
  1022       assume ?r
  1022       assume ?r
  1023       then obtain f where 1: "f 0 = a"  "b = f (Suc n)"  "\<And>i. i < Suc n \<Longrightarrow> (f i, f (Suc i)) \<in> R"
  1023       then obtain f where 1: "f 0 = a"  "b = f (Suc n)"  "\<And>i. i < Suc n \<Longrightarrow> (f i, f (Suc i)) \<in> R"
  1024         by auto
  1024         by auto
  1025       show ?l by (rule exI[of _ "f n"], rule conjI, rule exI[of _ f], insert 1, auto)
  1025       show ?l by (rule exI[of _ "f n"], rule conjI, rule exI[of _ f], auto simp add: 1)
  1026     qed
  1026     qed
       
  1027     then show ?thesis by (simp add: relcomp_unfold Suc)
  1027   qed
  1028   qed
  1028 qed
  1029 qed
  1029 
  1030 
  1030 lemma relpowp_fun_conv: "(P ^^ n) x y \<longleftrightarrow> (\<exists>f. f 0 = x \<and> f n = y \<and> (\<forall>i<n. P (f i) (f (Suc i))))"
  1031 lemma relpowp_fun_conv: "(P ^^ n) x y \<longleftrightarrow> (\<exists>f. f 0 = x \<and> f n = y \<and> (\<forall>i<n. P (f i) (f (Suc i))))"
  1031   by (fact relpow_fun_conv [to_pred])
  1032   by (fact relpow_fun_conv [to_pred])