24 \<close> |
24 \<close> |
25 |
25 |
26 context notes [[inductive_internals]] |
26 context notes [[inductive_internals]] |
27 begin |
27 begin |
28 |
28 |
29 inductive_set rtrancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(_\<^sup>*)\<close> [1000] 999) |
29 inductive_set rtrancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(\<open>notation=\<open>postfix *\<close>\<close>_\<^sup>*)\<close> [1000] 999) |
30 for r :: "('a \<times> 'a) set" |
30 for r :: "('a \<times> 'a) set" |
31 where |
31 where |
32 rtrancl_refl [intro!, Pure.intro!, simp]: "(a, a) \<in> r\<^sup>*" |
32 rtrancl_refl [intro!, Pure.intro!, simp]: "(a, a) \<in> r\<^sup>*" |
33 | rtrancl_into_rtrancl [Pure.intro]: "(a, b) \<in> r\<^sup>* \<Longrightarrow> (b, c) \<in> r \<Longrightarrow> (a, c) \<in> r\<^sup>*" |
33 | rtrancl_into_rtrancl [Pure.intro]: "(a, b) \<in> r\<^sup>* \<Longrightarrow> (b, c) \<in> r \<Longrightarrow> (a, c) \<in> r\<^sup>*" |
34 |
34 |
35 inductive_set trancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(_\<^sup>+)\<close> [1000] 999) |
35 inductive_set trancl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(\<open>notation=\<open>postfix +\<close>\<close>_\<^sup>+)\<close> [1000] 999) |
36 for r :: "('a \<times> 'a) set" |
36 for r :: "('a \<times> 'a) set" |
37 where |
37 where |
38 r_into_trancl [intro, Pure.intro]: "(a, b) \<in> r \<Longrightarrow> (a, b) \<in> r\<^sup>+" |
38 r_into_trancl [intro, Pure.intro]: "(a, b) \<in> r \<Longrightarrow> (a, b) \<in> r\<^sup>+" |
39 | trancl_into_trancl [Pure.intro]: "(a, b) \<in> r\<^sup>+ \<Longrightarrow> (b, c) \<in> r \<Longrightarrow> (a, c) \<in> r\<^sup>+" |
39 | trancl_into_trancl [Pure.intro]: "(a, b) \<in> r\<^sup>+ \<Longrightarrow> (b, c) \<in> r \<Longrightarrow> (a, c) \<in> r\<^sup>+" |
40 |
40 |
41 notation |
41 notation |
42 rtranclp (\<open>(_\<^sup>*\<^sup>*)\<close> [1000] 1000) and |
42 rtranclp (\<open>(\<open>notation=\<open>postfix **\<close>\<close>_\<^sup>*\<^sup>*)\<close> [1000] 1000) and |
43 tranclp (\<open>(_\<^sup>+\<^sup>+)\<close> [1000] 1000) |
43 tranclp (\<open>(\<open>notation=\<open>postfix ++\<close>\<close>_\<^sup>+\<^sup>+)\<close> [1000] 1000) |
44 |
44 |
45 declare |
45 declare |
46 rtrancl_def [nitpick_unfold del] |
46 rtrancl_def [nitpick_unfold del] |
47 rtranclp_def [nitpick_unfold del] |
47 rtranclp_def [nitpick_unfold del] |
48 trancl_def [nitpick_unfold del] |
48 trancl_def [nitpick_unfold del] |
49 tranclp_def [nitpick_unfold del] |
49 tranclp_def [nitpick_unfold del] |
50 |
50 |
51 end |
51 end |
52 |
52 |
53 abbreviation reflcl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(_\<^sup>=)\<close> [1000] 999) |
53 abbreviation reflcl :: "('a \<times> 'a) set \<Rightarrow> ('a \<times> 'a) set" (\<open>(\<open>notation=\<open>postfix =\<close>\<close>_\<^sup>=)\<close> [1000] 999) |
54 where "r\<^sup>= \<equiv> r \<union> Id" |
54 where "r\<^sup>= \<equiv> r \<union> Id" |
55 |
55 |
56 abbreviation reflclp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" (\<open>(_\<^sup>=\<^sup>=)\<close> [1000] 1000) |
56 abbreviation reflclp :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> bool" (\<open>(\<open>notation=\<open>postfix ==\<close>\<close>_\<^sup>=\<^sup>=)\<close> [1000] 1000) |
57 where "r\<^sup>=\<^sup>= \<equiv> sup r (=)" |
57 where "r\<^sup>=\<^sup>= \<equiv> sup r (=)" |
58 |
58 |
59 notation (ASCII) |
59 notation (ASCII) |
60 rtrancl (\<open>(_^*)\<close> [1000] 999) and |
60 rtrancl (\<open>(\<open>notation=\<open>postfix *\<close>\<close>_^*)\<close> [1000] 999) and |
61 trancl (\<open>(_^+)\<close> [1000] 999) and |
61 trancl (\<open>(\<open>notation=\<open>postfix +\<close>\<close>_^+)\<close> [1000] 999) and |
62 reflcl (\<open>(_^=)\<close> [1000] 999) and |
62 reflcl (\<open>(\<open>notation=\<open>postfix =\<close>\<close>_^=)\<close> [1000] 999) and |
63 rtranclp (\<open>(_^**)\<close> [1000] 1000) and |
63 rtranclp (\<open>(\<open>notation=\<open>postfix **\<close>\<close>_^**)\<close> [1000] 1000) and |
64 tranclp (\<open>(_^++)\<close> [1000] 1000) and |
64 tranclp (\<open>(\<open>notation=\<open>postfix ++\<close>\<close>_^++)\<close> [1000] 1000) and |
65 reflclp (\<open>(_^==)\<close> [1000] 1000) |
65 reflclp (\<open>(\<open>notation=\<open>postfix ==\<close>\<close>_^==)\<close> [1000] 1000) |
66 |
66 |
67 |
67 |
68 subsection \<open>Reflexive closure\<close> |
68 subsection \<open>Reflexive closure\<close> |
69 |
69 |
70 lemma reflcl_set_eq [pred_set_conv]: "(sup (\<lambda>x y. (x, y) \<in> r) (=)) = (\<lambda>x y. (x, y) \<in> r \<union> Id)" |
70 lemma reflcl_set_eq [pred_set_conv]: "(sup (\<lambda>x y. (x, y) \<in> r) (=)) = (\<lambda>x y. (x, y) \<in> r \<union> Id)" |