rtrancl and trancl are now defined using inductive_set.
authorberghofe
Wed Jul 11 11:10:37 2007 +0200 (2007-07-11)
changeset 2374352fbc991039f
parent 23742 d6349ac8b153
child 23744 7c9e6e2fe249
rtrancl and trancl are now defined using inductive_set.
src/HOL/Transitive_Closure.thy
     1.1 --- a/src/HOL/Transitive_Closure.thy	Wed Jul 11 11:09:15 2007 +0200
     1.2 +++ b/src/HOL/Transitive_Closure.thy	Wed Jul 11 11:10:37 2007 +0200
     1.3 @@ -20,83 +20,74 @@
     1.4    operands to be atomic.
     1.5  *}
     1.6  
     1.7 -inductive2
     1.8 -  rtrancl :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"   ("(_^**)" [1000] 1000)
     1.9 -  for r :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    1.10 +inductive_set
    1.11 +  rtrancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set"   ("(_^*)" [1000] 999)
    1.12 +  for r :: "('a \<times> 'a) set"
    1.13  where
    1.14 -    rtrancl_refl [intro!, Pure.intro!, simp]: "r^** a a"
    1.15 -  | rtrancl_into_rtrancl [Pure.intro]: "r^** a b ==> r b c ==> r^** a c"
    1.16 +    rtrancl_refl [intro!, Pure.intro!, simp]: "(a, a) : r^*"
    1.17 +  | rtrancl_into_rtrancl [Pure.intro]: "(a, b) : r^* ==> (b, c) : r ==> (a, c) : r^*"
    1.18  
    1.19 -inductive2
    1.20 -  trancl :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool"  ("(_^++)" [1000] 1000)
    1.21 -  for r :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
    1.22 +inductive_set
    1.23 +  trancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set"  ("(_^+)" [1000] 999)
    1.24 +  for r :: "('a \<times> 'a) set"
    1.25  where
    1.26 -    r_into_trancl [intro, Pure.intro]: "r a b ==> r^++ a b"
    1.27 -  | trancl_into_trancl [Pure.intro]: "r^++ a b ==> r b c ==> r^++ a c"
    1.28 +    r_into_trancl [intro, Pure.intro]: "(a, b) : r ==> (a, b) : r^+"
    1.29 +  | trancl_into_trancl [Pure.intro]: "(a, b) : r^+ ==> (b, c) : r ==> (a, c) : r^+"
    1.30  
    1.31 -constdefs
    1.32 -  rtrancl_set :: "('a \<times> 'a) set => ('a \<times> 'a) set"    ("(_^*)" [1000] 999)
    1.33 -  "r^* == Collect2 (member2 r)^**"
    1.34 -
    1.35 -  trancl_set :: "('a \<times> 'a) set => ('a \<times> 'a) set"    ("(_^+)" [1000] 999)
    1.36 -  "r^+ == Collect2 (member2 r)^++"
    1.37 +notation
    1.38 +  rtranclp  ("(_^**)" [1000] 1000) and
    1.39 +  tranclp  ("(_^++)" [1000] 1000)
    1.40  
    1.41  abbreviation
    1.42 -  reflcl :: "('a => 'a => bool) => 'a => 'a => bool"  ("(_^==)" [1000] 1000) where
    1.43 +  reflclp :: "('a => 'a => bool) => 'a => 'a => bool"  ("(_^==)" [1000] 1000) where
    1.44    "r^== == sup r op ="
    1.45  
    1.46  abbreviation
    1.47 -  reflcl_set :: "('a \<times> 'a) set => ('a \<times> 'a) set"  ("(_^=)" [1000] 999) where
    1.48 +  reflcl :: "('a \<times> 'a) set => ('a \<times> 'a) set"  ("(_^=)" [1000] 999) where
    1.49    "r^= == r \<union> Id"
    1.50  
    1.51  notation (xsymbols)
    1.52 -  rtrancl  ("(_\<^sup>*\<^sup>*)" [1000] 1000) and
    1.53 -  trancl  ("(_\<^sup>+\<^sup>+)" [1000] 1000) and
    1.54 -  reflcl  ("(_\<^sup>=\<^sup>=)" [1000] 1000) and
    1.55 -  rtrancl_set  ("(_\<^sup>*)" [1000] 999) and
    1.56 -  trancl_set  ("(_\<^sup>+)" [1000] 999) and
    1.57 -  reflcl_set  ("(_\<^sup>=)" [1000] 999)
    1.58 +  rtranclp  ("(_\<^sup>*\<^sup>*)" [1000] 1000) and
    1.59 +  tranclp  ("(_\<^sup>+\<^sup>+)" [1000] 1000) and
    1.60 +  reflclp  ("(_\<^sup>=\<^sup>=)" [1000] 1000) and
    1.61 +  rtrancl  ("(_\<^sup>*)" [1000] 999) and
    1.62 +  trancl  ("(_\<^sup>+)" [1000] 999) and
    1.63 +  reflcl  ("(_\<^sup>=)" [1000] 999)
    1.64  
    1.65  notation (HTML output)
    1.66 -  rtrancl  ("(_\<^sup>*\<^sup>*)" [1000] 1000) and
    1.67 -  trancl  ("(_\<^sup>+\<^sup>+)" [1000] 1000) and
    1.68 -  reflcl  ("(_\<^sup>=\<^sup>=)" [1000] 1000) and
    1.69 -  rtrancl_set  ("(_\<^sup>*)" [1000] 999) and
    1.70 -  trancl_set  ("(_\<^sup>+)" [1000] 999) and
    1.71 -  reflcl_set  ("(_\<^sup>=)" [1000] 999)
    1.72 +  rtranclp  ("(_\<^sup>*\<^sup>*)" [1000] 1000) and
    1.73 +  tranclp  ("(_\<^sup>+\<^sup>+)" [1000] 1000) and
    1.74 +  reflclp  ("(_\<^sup>=\<^sup>=)" [1000] 1000) and
    1.75 +  rtrancl  ("(_\<^sup>*)" [1000] 999) and
    1.76 +  trancl  ("(_\<^sup>+)" [1000] 999) and
    1.77 +  reflcl  ("(_\<^sup>=)" [1000] 999)
    1.78  
    1.79  
    1.80  subsection {* Reflexive-transitive closure *}
    1.81  
    1.82 -lemma rtrancl_set_eq [pred_set_conv]: "(member2 r)^** = member2 (r^*)"
    1.83 -  by (simp add: rtrancl_set_def)
    1.84 -
    1.85 -lemma reflcl_set_eq [pred_set_conv]: "(sup (member2 r) op =) = member2 (r Un Id)"
    1.86 +lemma reflcl_set_eq [pred_set_conv]: "(sup (\<lambda>x y. (x, y) \<in> r) op =) = (\<lambda>x y. (x, y) \<in> r Un Id)"
    1.87    by (simp add: expand_fun_eq)
    1.88  
    1.89 -lemmas rtrancl_refl [intro!, Pure.intro!, simp] = rtrancl_refl [to_set]
    1.90 -lemmas rtrancl_into_rtrancl [Pure.intro] = rtrancl_into_rtrancl [to_set]
    1.91 -
    1.92  lemma r_into_rtrancl [intro]: "!!p. p \<in> r ==> p \<in> r^*"
    1.93    -- {* @{text rtrancl} of @{text r} contains @{text r} *}
    1.94    apply (simp only: split_tupled_all)
    1.95    apply (erule rtrancl_refl [THEN rtrancl_into_rtrancl])
    1.96    done
    1.97  
    1.98 -lemma r_into_rtrancl' [intro]: "r x y ==> r^** x y"
    1.99 +lemma r_into_rtranclp [intro]: "r x y ==> r^** x y"
   1.100    -- {* @{text rtrancl} of @{text r} contains @{text r} *}
   1.101 -  by (erule rtrancl.rtrancl_refl [THEN rtrancl.rtrancl_into_rtrancl])
   1.102 +  by (erule rtranclp.rtrancl_refl [THEN rtranclp.rtrancl_into_rtrancl])
   1.103  
   1.104 -lemma rtrancl_mono': "r \<le> s ==> r^** \<le> s^**"
   1.105 +lemma rtranclp_mono: "r \<le> s ==> r^** \<le> s^**"
   1.106    -- {* monotonicity of @{text rtrancl} *}
   1.107    apply (rule predicate2I)
   1.108 -  apply (erule rtrancl.induct)
   1.109 -   apply (rule_tac [2] rtrancl.rtrancl_into_rtrancl, blast+)
   1.110 +  apply (erule rtranclp.induct)
   1.111 +   apply (rule_tac [2] rtranclp.rtrancl_into_rtrancl, blast+)
   1.112    done
   1.113  
   1.114 -lemmas rtrancl_mono = rtrancl_mono' [to_set]
   1.115 +lemmas rtrancl_mono = rtranclp_mono [to_set]
   1.116  
   1.117 -theorem rtrancl_induct' [consumes 1, induct set: rtrancl]:
   1.118 +theorem rtranclp_induct [consumes 1, induct set: rtranclp]:
   1.119    assumes a: "r^** a b"
   1.120      and cases: "P a" "!!y z. [| r^** a y; r y z; P y |] ==> P z"
   1.121    shows "P b"
   1.122 @@ -106,10 +97,10 @@
   1.123    thus ?thesis by iprover
   1.124  qed
   1.125  
   1.126 -lemmas rtrancl_induct [consumes 1, induct set: rtrancl_set] = rtrancl_induct' [to_set]
   1.127 +lemmas rtrancl_induct [consumes 1, induct set: rtrancl] = rtranclp_induct [to_set]
   1.128  
   1.129 -lemmas rtrancl_induct2' =
   1.130 -  rtrancl_induct'[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.131 +lemmas rtranclp_induct2 =
   1.132 +  rtranclp_induct[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.133                   consumes 1, case_names refl step]
   1.134  
   1.135  lemmas rtrancl_induct2 =
   1.136 @@ -130,7 +121,7 @@
   1.137  
   1.138  lemmas rtrancl_trans = trans_rtrancl [THEN transD, standard]
   1.139  
   1.140 -lemma rtrancl_trans':
   1.141 +lemma rtranclp_trans:
   1.142    assumes xy: "r^** x y"
   1.143    and yz: "r^** y z"
   1.144    shows "r^** x z" using yz xy
   1.145 @@ -155,24 +146,24 @@
   1.146    apply (erule rtrancl_induct, auto) 
   1.147    done
   1.148  
   1.149 -lemma converse_rtrancl_into_rtrancl':
   1.150 +lemma converse_rtranclp_into_rtranclp:
   1.151    "r a b \<Longrightarrow> r\<^sup>*\<^sup>* b c \<Longrightarrow> r\<^sup>*\<^sup>* a c"
   1.152 -  by (rule rtrancl_trans') iprover+
   1.153 +  by (rule rtranclp_trans) iprover+
   1.154  
   1.155 -lemmas converse_rtrancl_into_rtrancl = converse_rtrancl_into_rtrancl' [to_set]
   1.156 +lemmas converse_rtrancl_into_rtrancl = converse_rtranclp_into_rtranclp [to_set]
   1.157  
   1.158  text {*
   1.159    \medskip More @{term "r^*"} equations and inclusions.
   1.160  *}
   1.161  
   1.162 -lemma rtrancl_idemp' [simp]: "(r^**)^** = r^**"
   1.163 +lemma rtranclp_idemp [simp]: "(r^**)^** = r^**"
   1.164    apply (auto intro!: order_antisym)
   1.165 -  apply (erule rtrancl_induct')
   1.166 -   apply (rule rtrancl.rtrancl_refl)
   1.167 -  apply (blast intro: rtrancl_trans')
   1.168 +  apply (erule rtranclp_induct)
   1.169 +   apply (rule rtranclp.rtrancl_refl)
   1.170 +  apply (blast intro: rtranclp_trans)
   1.171    done
   1.172  
   1.173 -lemmas rtrancl_idemp [simp] = rtrancl_idemp' [to_set]
   1.174 +lemmas rtrancl_idemp [simp] = rtranclp_idemp [to_set]
   1.175  
   1.176  lemma rtrancl_idemp_self_comp [simp]: "R^* O R^* = R^*"
   1.177    apply (rule set_ext)
   1.178 @@ -183,22 +174,22 @@
   1.179  lemma rtrancl_subset_rtrancl: "r \<subseteq> s^* ==> r^* \<subseteq> s^*"
   1.180  by (drule rtrancl_mono, simp)
   1.181  
   1.182 -lemma rtrancl_subset': "R \<le> S ==> S \<le> R^** ==> S^** = R^**"
   1.183 -  apply (drule rtrancl_mono')
   1.184 -  apply (drule rtrancl_mono', simp)
   1.185 +lemma rtranclp_subset: "R \<le> S ==> S \<le> R^** ==> S^** = R^**"
   1.186 +  apply (drule rtranclp_mono)
   1.187 +  apply (drule rtranclp_mono, simp)
   1.188    done
   1.189  
   1.190 -lemmas rtrancl_subset = rtrancl_subset' [to_set]
   1.191 +lemmas rtrancl_subset = rtranclp_subset [to_set]
   1.192  
   1.193 -lemma rtrancl_Un_rtrancl': "(sup (R^**) (S^**))^** = (sup R S)^**"
   1.194 -  by (blast intro!: rtrancl_subset' intro: rtrancl_mono' [THEN predicate2D])
   1.195 +lemma rtranclp_sup_rtranclp: "(sup (R^**) (S^**))^** = (sup R S)^**"
   1.196 +  by (blast intro!: rtranclp_subset intro: rtranclp_mono [THEN predicate2D])
   1.197  
   1.198 -lemmas rtrancl_Un_rtrancl = rtrancl_Un_rtrancl' [to_set]
   1.199 +lemmas rtrancl_Un_rtrancl = rtranclp_sup_rtranclp [to_set]
   1.200  
   1.201 -lemma rtrancl_reflcl' [simp]: "(R^==)^** = R^**"
   1.202 -  by (blast intro!: rtrancl_subset')
   1.203 +lemma rtranclp_reflcl [simp]: "(R^==)^** = R^**"
   1.204 +  by (blast intro!: rtranclp_subset)
   1.205  
   1.206 -lemmas rtrancl_reflcl [simp] = rtrancl_reflcl' [to_set]
   1.207 +lemmas rtrancl_reflcl [simp] = rtranclp_reflcl [to_set]
   1.208  
   1.209  lemma rtrancl_r_diff_Id: "(r - Id)^* = r^*"
   1.210    apply (rule sym)
   1.211 @@ -208,31 +199,31 @@
   1.212    apply (blast intro!: r_into_rtrancl)
   1.213    done
   1.214  
   1.215 -lemma rtrancl_r_diff_Id': "(inf r op ~=)^** = r^**"
   1.216 +lemma rtranclp_r_diff_Id: "(inf r op ~=)^** = r^**"
   1.217    apply (rule sym)
   1.218 -  apply (rule rtrancl_subset')
   1.219 +  apply (rule rtranclp_subset)
   1.220    apply blast+
   1.221    done
   1.222  
   1.223 -theorem rtrancl_converseD':
   1.224 +theorem rtranclp_converseD:
   1.225    assumes r: "(r^--1)^** x y"
   1.226    shows "r^** y x"
   1.227  proof -
   1.228    from r show ?thesis
   1.229 -    by induct (iprover intro: rtrancl_trans' dest!: conversepD)+
   1.230 +    by induct (iprover intro: rtranclp_trans dest!: conversepD)+
   1.231  qed
   1.232  
   1.233 -lemmas rtrancl_converseD = rtrancl_converseD' [to_set]
   1.234 +lemmas rtrancl_converseD = rtranclp_converseD [to_set]
   1.235  
   1.236 -theorem rtrancl_converseI':
   1.237 +theorem rtranclp_converseI:
   1.238    assumes r: "r^** y x"
   1.239    shows "(r^--1)^** x y"
   1.240  proof -
   1.241    from r show ?thesis
   1.242 -    by induct (iprover intro: rtrancl_trans' conversepI)+
   1.243 +    by induct (iprover intro: rtranclp_trans conversepI)+
   1.244  qed
   1.245  
   1.246 -lemmas rtrancl_converseI = rtrancl_converseI' [to_set]
   1.247 +lemmas rtrancl_converseI = rtranclp_converseI [to_set]
   1.248  
   1.249  lemma rtrancl_converse: "(r^-1)^* = (r^*)^-1"
   1.250    by (fast dest!: rtrancl_converseD intro!: rtrancl_converseI)
   1.251 @@ -240,41 +231,41 @@
   1.252  lemma sym_rtrancl: "sym r ==> sym (r^*)"
   1.253    by (simp only: sym_conv_converse_eq rtrancl_converse [symmetric])
   1.254  
   1.255 -theorem converse_rtrancl_induct'[consumes 1]:
   1.256 +theorem converse_rtranclp_induct[consumes 1]:
   1.257    assumes major: "r^** a b"
   1.258      and cases: "P b" "!!y z. [| r y z; r^** z b; P z |] ==> P y"
   1.259    shows "P a"
   1.260  proof -
   1.261 -  from rtrancl_converseI' [OF major]
   1.262 +  from rtranclp_converseI [OF major]
   1.263    show ?thesis
   1.264 -    by induct (iprover intro: cases dest!: conversepD rtrancl_converseD')+
   1.265 +    by induct (iprover intro: cases dest!: conversepD rtranclp_converseD)+
   1.266  qed
   1.267  
   1.268 -lemmas converse_rtrancl_induct[consumes 1] = converse_rtrancl_induct' [to_set]
   1.269 +lemmas converse_rtrancl_induct[consumes 1] = converse_rtranclp_induct [to_set]
   1.270  
   1.271 -lemmas converse_rtrancl_induct2' =
   1.272 -  converse_rtrancl_induct'[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.273 +lemmas converse_rtranclp_induct2 =
   1.274 +  converse_rtranclp_induct[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.275                   consumes 1, case_names refl step]
   1.276  
   1.277  lemmas converse_rtrancl_induct2 =
   1.278    converse_rtrancl_induct[of "(ax,ay)" "(bx,by)", split_format (complete),
   1.279                   consumes 1, case_names refl step]
   1.280  
   1.281 -lemma converse_rtranclE':
   1.282 +lemma converse_rtranclpE:
   1.283    assumes major: "r^** x z"
   1.284      and cases: "x=z ==> P"
   1.285        "!!y. [| r x y; r^** y z |] ==> P"
   1.286    shows P
   1.287    apply (subgoal_tac "x = z | (EX y. r x y & r^** y z)")
   1.288 -   apply (rule_tac [2] major [THEN converse_rtrancl_induct'])
   1.289 +   apply (rule_tac [2] major [THEN converse_rtranclp_induct])
   1.290      prefer 2 apply iprover
   1.291     prefer 2 apply iprover
   1.292    apply (erule asm_rl exE disjE conjE cases)+
   1.293    done
   1.294  
   1.295 -lemmas converse_rtranclE = converse_rtranclE' [to_set]
   1.296 +lemmas converse_rtranclE = converse_rtranclpE [to_set]
   1.297  
   1.298 -lemmas converse_rtranclE2' = converse_rtranclE' [of _ "(xa,xb)" "(za,zb)", split_rule]
   1.299 +lemmas converse_rtranclpE2 = converse_rtranclpE [of _ "(xa,xb)" "(za,zb)", split_rule]
   1.300  
   1.301  lemmas converse_rtranclE2 = converse_rtranclE [of "(xa,xb)" "(za,zb)", split_rule]
   1.302  
   1.303 @@ -288,14 +279,8 @@
   1.304  
   1.305  subsection {* Transitive closure *}
   1.306  
   1.307 -lemma trancl_set_eq [pred_set_conv]: "(member2 r)^++ = member2 (r^+)"
   1.308 -  by (simp add: trancl_set_def)
   1.309 -
   1.310 -lemmas r_into_trancl [intro, Pure.intro] = r_into_trancl [to_set]
   1.311 -lemmas trancl_into_trancl [Pure.intro] = trancl_into_trancl [to_set]
   1.312 -
   1.313  lemma trancl_mono: "!!p. p \<in> r^+ ==> r \<subseteq> s ==> p \<in> s^+"
   1.314 -  apply (simp add: split_tupled_all trancl_set_def)
   1.315 +  apply (simp add: split_tupled_all)
   1.316    apply (erule trancl.induct)
   1.317    apply (iprover dest: subsetD)+
   1.318    done
   1.319 @@ -307,27 +292,27 @@
   1.320    \medskip Conversions between @{text trancl} and @{text rtrancl}.
   1.321  *}
   1.322  
   1.323 -lemma trancl_into_rtrancl': "r^++ a b ==> r^** a b"
   1.324 -  by (erule trancl.induct) iprover+
   1.325 +lemma tranclp_into_rtranclp: "r^++ a b ==> r^** a b"
   1.326 +  by (erule tranclp.induct) iprover+
   1.327  
   1.328 -lemmas trancl_into_rtrancl = trancl_into_rtrancl' [to_set]
   1.329 +lemmas trancl_into_rtrancl = tranclp_into_rtranclp [to_set]
   1.330  
   1.331 -lemma rtrancl_into_trancl1': assumes r: "r^** a b"
   1.332 +lemma rtranclp_into_tranclp1: assumes r: "r^** a b"
   1.333    shows "!!c. r b c ==> r^++ a c" using r
   1.334    by induct iprover+
   1.335  
   1.336 -lemmas rtrancl_into_trancl1 = rtrancl_into_trancl1' [to_set]
   1.337 +lemmas rtrancl_into_trancl1 = rtranclp_into_tranclp1 [to_set]
   1.338  
   1.339 -lemma rtrancl_into_trancl2': "[| r a b; r^** b c |] ==> r^++ a c"
   1.340 +lemma rtranclp_into_tranclp2: "[| r a b; r^** b c |] ==> r^++ a c"
   1.341    -- {* intro rule from @{text r} and @{text rtrancl} *}
   1.342 -  apply (erule rtrancl.cases, iprover)
   1.343 -  apply (rule rtrancl_trans' [THEN rtrancl_into_trancl1'])
   1.344 -   apply (simp | rule r_into_rtrancl')+
   1.345 +  apply (erule rtranclp.cases, iprover)
   1.346 +  apply (rule rtranclp_trans [THEN rtranclp_into_tranclp1])
   1.347 +   apply (simp | rule r_into_rtranclp)+
   1.348    done
   1.349  
   1.350 -lemmas rtrancl_into_trancl2 = rtrancl_into_trancl2' [to_set]
   1.351 +lemmas rtrancl_into_trancl2 = rtranclp_into_tranclp2 [to_set]
   1.352  
   1.353 -lemma trancl_induct' [consumes 1, induct set: trancl]:
   1.354 +lemma tranclp_induct [consumes 1, induct set: tranclp]:
   1.355    assumes a: "r^++ a b"
   1.356    and cases: "!!y. r a y ==> P y"
   1.357      "!!y z. r^++ a y ==> r y z ==> P y ==> P z"
   1.358 @@ -339,32 +324,27 @@
   1.359    thus ?thesis by iprover
   1.360  qed
   1.361  
   1.362 -lemmas trancl_induct [consumes 1, induct set: trancl_set] = trancl_induct' [to_set]
   1.363 +lemmas trancl_induct [consumes 1, induct set: trancl] = tranclp_induct [to_set]
   1.364  
   1.365 -lemmas trancl_induct2' =
   1.366 -  trancl_induct'[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.367 +lemmas tranclp_induct2 =
   1.368 +  tranclp_induct[of _ "(ax,ay)" "(bx,by)", split_rule,
   1.369                   consumes 1, case_names base step]
   1.370  
   1.371  lemmas trancl_induct2 =
   1.372    trancl_induct[of "(ax,ay)" "(bx,by)", split_format (complete),
   1.373                   consumes 1, case_names base step]
   1.374  
   1.375 -lemma trancl_trans_induct':
   1.376 +lemma tranclp_trans_induct:
   1.377    assumes major: "r^++ x y"
   1.378      and cases: "!!x y. r x y ==> P x y"
   1.379        "!!x y z. [| r^++ x y; P x y; r^++ y z; P y z |] ==> P x z"
   1.380    shows "P x y"
   1.381    -- {* Another induction rule for trancl, incorporating transitivity *}
   1.382 -  by (iprover intro: major [THEN trancl_induct'] cases)
   1.383 -
   1.384 -lemmas trancl_trans_induct = trancl_trans_induct' [to_set]
   1.385 +  by (iprover intro: major [THEN tranclp_induct] cases)
   1.386  
   1.387 -lemma tranclE:
   1.388 -  assumes H: "(a, b) : r^+"
   1.389 -  and cases: "(a, b) : r ==> P" "\<And>c. (a, c) : r^+ ==> (c, b) : r ==> P"
   1.390 -  shows P
   1.391 -  using H [simplified trancl_set_def, simplified]
   1.392 -  by cases (auto intro: cases [simplified trancl_set_def, simplified])
   1.393 +lemmas trancl_trans_induct = tranclp_trans_induct [to_set]
   1.394 +
   1.395 +inductive_cases tranclE: "(a, b) : r^+"
   1.396  
   1.397  lemma trancl_Int_subset: "[| r \<subseteq> s; r O (r^+ \<inter> s) \<subseteq> s|] ==> r^+ \<subseteq> s"
   1.398    apply (rule subsetI)
   1.399 @@ -386,7 +366,7 @@
   1.400  
   1.401  lemmas trancl_trans = trans_trancl [THEN transD, standard]
   1.402  
   1.403 -lemma trancl_trans':
   1.404 +lemma tranclp_trans:
   1.405    assumes xy: "r^++ x y"
   1.406    and yz: "r^++ y z"
   1.407    shows "r^++ x z" using yz xy
   1.408 @@ -400,16 +380,16 @@
   1.409  apply(blast)
   1.410  done
   1.411  
   1.412 -lemma rtrancl_trancl_trancl': assumes r: "r^** x y"
   1.413 +lemma rtranclp_tranclp_tranclp: assumes r: "r^** x y"
   1.414    shows "!!z. r^++ y z ==> r^++ x z" using r
   1.415 -  by induct (iprover intro: trancl_trans')+
   1.416 +  by induct (iprover intro: tranclp_trans)+
   1.417  
   1.418 -lemmas rtrancl_trancl_trancl = rtrancl_trancl_trancl' [to_set]
   1.419 +lemmas rtrancl_trancl_trancl = rtranclp_tranclp_tranclp [to_set]
   1.420  
   1.421 -lemma trancl_into_trancl2': "r a b ==> r^++ b c ==> r^++ a c"
   1.422 -  by (erule trancl_trans' [OF trancl.r_into_trancl])
   1.423 +lemma tranclp_into_tranclp2: "r a b ==> r^++ b c ==> r^++ a c"
   1.424 +  by (erule tranclp_trans [OF tranclp.r_into_trancl])
   1.425  
   1.426 -lemmas trancl_into_trancl2 = trancl_into_trancl2' [to_set]
   1.427 +lemmas trancl_into_trancl2 = tranclp_into_tranclp2 [to_set]
   1.428  
   1.429  lemma trancl_insert:
   1.430    "(insert (y, x) r)^+ = r^+ \<union> {(a, b). (a, y) \<in> r^* \<and> (x, b) \<in> r^*}"
   1.431 @@ -424,50 +404,50 @@
   1.432      [THEN [2] rev_subsetD] rtrancl_trancl_trancl rtrancl_into_trancl2)
   1.433    done
   1.434  
   1.435 -lemma trancl_converseI': "(r^++)^--1 x y ==> (r^--1)^++ x y"
   1.436 +lemma tranclp_converseI: "(r^++)^--1 x y ==> (r^--1)^++ x y"
   1.437    apply (drule conversepD)
   1.438 -  apply (erule trancl_induct')
   1.439 -  apply (iprover intro: conversepI trancl_trans')+
   1.440 +  apply (erule tranclp_induct)
   1.441 +  apply (iprover intro: conversepI tranclp_trans)+
   1.442    done
   1.443  
   1.444 -lemmas trancl_converseI = trancl_converseI' [to_set]
   1.445 +lemmas trancl_converseI = tranclp_converseI [to_set]
   1.446  
   1.447 -lemma trancl_converseD': "(r^--1)^++ x y ==> (r^++)^--1 x y"
   1.448 +lemma tranclp_converseD: "(r^--1)^++ x y ==> (r^++)^--1 x y"
   1.449    apply (rule conversepI)
   1.450 -  apply (erule trancl_induct')
   1.451 -  apply (iprover dest: conversepD intro: trancl_trans')+
   1.452 +  apply (erule tranclp_induct)
   1.453 +  apply (iprover dest: conversepD intro: tranclp_trans)+
   1.454    done
   1.455  
   1.456 -lemmas trancl_converseD = trancl_converseD' [to_set]
   1.457 +lemmas trancl_converseD = tranclp_converseD [to_set]
   1.458  
   1.459 -lemma trancl_converse': "(r^--1)^++ = (r^++)^--1"
   1.460 +lemma tranclp_converse: "(r^--1)^++ = (r^++)^--1"
   1.461    by (fastsimp simp add: expand_fun_eq
   1.462 -    intro!: trancl_converseI' dest!: trancl_converseD')
   1.463 +    intro!: tranclp_converseI dest!: tranclp_converseD)
   1.464  
   1.465 -lemmas trancl_converse = trancl_converse' [to_set]
   1.466 +lemmas trancl_converse = tranclp_converse [to_set]
   1.467  
   1.468  lemma sym_trancl: "sym r ==> sym (r^+)"
   1.469    by (simp only: sym_conv_converse_eq trancl_converse [symmetric])
   1.470  
   1.471 -lemma converse_trancl_induct':
   1.472 +lemma converse_tranclp_induct:
   1.473    assumes major: "r^++ a b"
   1.474      and cases: "!!y. r y b ==> P(y)"
   1.475        "!!y z.[| r y z;  r^++ z b;  P(z) |] ==> P(y)"
   1.476    shows "P a"
   1.477 -  apply (rule trancl_induct' [OF trancl_converseI', OF conversepI, OF major])
   1.478 +  apply (rule tranclp_induct [OF tranclp_converseI, OF conversepI, OF major])
   1.479     apply (rule cases)
   1.480     apply (erule conversepD)
   1.481 -  apply (blast intro: prems dest!: trancl_converseD' conversepD)
   1.482 +  apply (blast intro: prems dest!: tranclp_converseD conversepD)
   1.483    done
   1.484  
   1.485 -lemmas converse_trancl_induct = converse_trancl_induct' [to_set]
   1.486 +lemmas converse_trancl_induct = converse_tranclp_induct [to_set]
   1.487  
   1.488 -lemma tranclD': "R^++ x y ==> EX z. R x z \<and> R^** z y"
   1.489 -  apply (erule converse_trancl_induct', auto)
   1.490 -  apply (blast intro: rtrancl_trans')
   1.491 +lemma tranclpD: "R^++ x y ==> EX z. R x z \<and> R^** z y"
   1.492 +  apply (erule converse_tranclp_induct, auto)
   1.493 +  apply (blast intro: rtranclp_trans)
   1.494    done
   1.495  
   1.496 -lemmas tranclD = tranclD' [to_set]
   1.497 +lemmas tranclD = tranclpD [to_set]
   1.498  
   1.499  lemma irrefl_tranclI: "r^-1 \<inter> r^* = {} ==> (x, x) \<notin> r^+"
   1.500    by (blast elim: tranclE dest: trancl_into_rtrancl)
   1.501 @@ -486,13 +466,13 @@
   1.502    apply (blast dest!: trancl_into_rtrancl trancl_subset_Sigma_aux)+
   1.503    done
   1.504  
   1.505 -lemma reflcl_trancl' [simp]: "(r^++)^== = r^**"
   1.506 +lemma reflcl_tranclp [simp]: "(r^++)^== = r^**"
   1.507    apply (safe intro!: order_antisym)
   1.508 -   apply (erule trancl_into_rtrancl')
   1.509 -  apply (blast elim: rtrancl.cases dest: rtrancl_into_trancl1')
   1.510 +   apply (erule tranclp_into_rtranclp)
   1.511 +  apply (blast elim: rtranclp.cases dest: rtranclp_into_tranclp1)
   1.512    done
   1.513  
   1.514 -lemmas reflcl_trancl [simp] = reflcl_trancl' [to_set]
   1.515 +lemmas reflcl_trancl [simp] = reflcl_tranclp [to_set]
   1.516  
   1.517  lemma trancl_reflcl [simp]: "(r^=)^+ = r^*"
   1.518    apply safe
   1.519 @@ -509,10 +489,10 @@
   1.520  lemma rtrancl_empty [simp]: "{}^* = Id"
   1.521    by (rule subst [OF reflcl_trancl]) simp
   1.522  
   1.523 -lemma rtranclD': "R^** a b ==> a = b \<or> a \<noteq> b \<and> R^++ a b"
   1.524 -  by (force simp add: reflcl_trancl' [symmetric] simp del: reflcl_trancl')
   1.525 +lemma rtranclpD: "R^** a b ==> a = b \<or> a \<noteq> b \<and> R^++ a b"
   1.526 +  by (force simp add: reflcl_tranclp [symmetric] simp del: reflcl_tranclp)
   1.527  
   1.528 -lemmas rtranclD = rtranclD' [to_set]
   1.529 +lemmas rtranclD = rtranclpD [to_set]
   1.530  
   1.531  lemma rtrancl_eq_or_trancl:
   1.532    "(x,y) \<in> R\<^sup>* = (x=y \<or> x\<noteq>y \<and> (x,y) \<in> R\<^sup>+)"
   1.533 @@ -567,32 +547,32 @@
   1.534    apply (fast intro: r_r_into_trancl trancl_trans)
   1.535    done
   1.536  
   1.537 -lemma trancl_rtrancl_trancl':
   1.538 +lemma tranclp_rtranclp_tranclp:
   1.539      "r\<^sup>+\<^sup>+ a b ==> r\<^sup>*\<^sup>* b c ==> r\<^sup>+\<^sup>+ a c"
   1.540 -  apply (drule tranclD')
   1.541 +  apply (drule tranclpD)
   1.542    apply (erule exE, erule conjE)
   1.543 -  apply (drule rtrancl_trans', assumption)
   1.544 -  apply (drule rtrancl_into_trancl2', assumption, assumption)
   1.545 +  apply (drule rtranclp_trans, assumption)
   1.546 +  apply (drule rtranclp_into_tranclp2, assumption, assumption)
   1.547    done
   1.548  
   1.549 -lemmas trancl_rtrancl_trancl = trancl_rtrancl_trancl' [to_set]
   1.550 +lemmas trancl_rtrancl_trancl = tranclp_rtranclp_tranclp [to_set]
   1.551  
   1.552  lemmas transitive_closure_trans [trans] =
   1.553    r_r_into_trancl trancl_trans rtrancl_trans
   1.554 -  trancl_into_trancl trancl_into_trancl2
   1.555 -  rtrancl_into_rtrancl converse_rtrancl_into_rtrancl
   1.556 +  trancl.trancl_into_trancl trancl_into_trancl2
   1.557 +  rtrancl.rtrancl_into_rtrancl converse_rtrancl_into_rtrancl
   1.558    rtrancl_trancl_trancl trancl_rtrancl_trancl
   1.559  
   1.560 -lemmas transitive_closure_trans' [trans] =
   1.561 -  trancl_trans' rtrancl_trans'
   1.562 -  trancl.trancl_into_trancl trancl_into_trancl2'
   1.563 -  rtrancl.rtrancl_into_rtrancl converse_rtrancl_into_rtrancl'
   1.564 -  rtrancl_trancl_trancl' trancl_rtrancl_trancl'
   1.565 +lemmas transitive_closurep_trans' [trans] =
   1.566 +  tranclp_trans rtranclp_trans
   1.567 +  tranclp.trancl_into_trancl tranclp_into_tranclp2
   1.568 +  rtranclp.rtrancl_into_rtrancl converse_rtranclp_into_rtranclp
   1.569 +  rtranclp_tranclp_tranclp tranclp_rtranclp_tranclp
   1.570  
   1.571  declare trancl_into_rtrancl [elim]
   1.572  
   1.573 -declare rtranclE [cases set: rtrancl_set]
   1.574 -declare tranclE [cases set: trancl_set]
   1.575 +declare rtranclE [cases set: rtrancl]
   1.576 +declare tranclE [cases set: trancl]
   1.577  
   1.578  
   1.579  
   1.580 @@ -604,9 +584,9 @@
   1.581  
   1.582  structure Trancl_Tac = Trancl_Tac_Fun (
   1.583    struct
   1.584 -    val r_into_trancl = thm "r_into_trancl";
   1.585 +    val r_into_trancl = thm "trancl.r_into_trancl";
   1.586      val trancl_trans  = thm "trancl_trans";
   1.587 -    val rtrancl_refl = thm "rtrancl_refl";
   1.588 +    val rtrancl_refl = thm "rtrancl.rtrancl_refl";
   1.589      val r_into_rtrancl = thm "r_into_rtrancl";
   1.590      val trancl_into_rtrancl = thm "trancl_into_rtrancl";
   1.591      val rtrancl_trancl_trancl = thm "rtrancl_trancl_trancl";
   1.592 @@ -615,8 +595,8 @@
   1.593  
   1.594    fun decomp (Trueprop $ t) =
   1.595      let fun dec (Const ("op :", _) $ (Const ("Pair", _) $ a $ b) $ rel ) =
   1.596 -        let fun decr (Const ("Transitive_Closure.rtrancl_set", _ ) $ r) = (r,"r*")
   1.597 -              | decr (Const ("Transitive_Closure.trancl_set", _ ) $ r)  = (r,"r+")
   1.598 +        let fun decr (Const ("Transitive_Closure.rtrancl", _ ) $ r) = (r,"r*")
   1.599 +              | decr (Const ("Transitive_Closure.trancl", _ ) $ r)  = (r,"r+")
   1.600                | decr r = (r,"r");
   1.601              val (rel,r) = decr rel;
   1.602          in SOME (a,b,rel,r) end
   1.603 @@ -627,19 +607,19 @@
   1.604  
   1.605  structure Tranclp_Tac = Trancl_Tac_Fun (
   1.606    struct
   1.607 -    val r_into_trancl = thm "trancl.r_into_trancl";
   1.608 -    val trancl_trans  = thm "trancl_trans'";
   1.609 -    val rtrancl_refl = thm "rtrancl.rtrancl_refl";
   1.610 -    val r_into_rtrancl = thm "r_into_rtrancl'";
   1.611 -    val trancl_into_rtrancl = thm "trancl_into_rtrancl'";
   1.612 -    val rtrancl_trancl_trancl = thm "rtrancl_trancl_trancl'";
   1.613 -    val trancl_rtrancl_trancl = thm "trancl_rtrancl_trancl'";
   1.614 -    val rtrancl_trans = thm "rtrancl_trans'";
   1.615 +    val r_into_trancl = thm "tranclp.r_into_trancl";
   1.616 +    val trancl_trans  = thm "tranclp_trans";
   1.617 +    val rtrancl_refl = thm "rtranclp.rtrancl_refl";
   1.618 +    val r_into_rtrancl = thm "r_into_rtranclp";
   1.619 +    val trancl_into_rtrancl = thm "tranclp_into_rtranclp";
   1.620 +    val rtrancl_trancl_trancl = thm "rtranclp_tranclp_tranclp";
   1.621 +    val trancl_rtrancl_trancl = thm "tranclp_rtranclp_tranclp";
   1.622 +    val rtrancl_trans = thm "rtranclp_trans";
   1.623  
   1.624    fun decomp (Trueprop $ t) =
   1.625      let fun dec (rel $ a $ b) =
   1.626 -        let fun decr (Const ("Transitive_Closure.rtrancl", _ ) $ r) = (r,"r*")
   1.627 -              | decr (Const ("Transitive_Closure.trancl", _ ) $ r)  = (r,"r+")
   1.628 +        let fun decr (Const ("Transitive_Closure.rtranclp", _ ) $ r) = (r,"r*")
   1.629 +              | decr (Const ("Transitive_Closure.tranclp", _ ) $ r)  = (r,"r+")
   1.630                | decr r = (r,"r");
   1.631              val (rel,r) = decr rel;
   1.632          in SOME (a, b, Envir.beta_eta_contract rel, r) end