17456
|
1 |
(* Title: CCL/Trancl.thy
|
1474
|
2 |
Author: Martin Coen, Cambridge University Computer Laboratory
|
0
|
3 |
Copyright 1993 University of Cambridge
|
|
4 |
*)
|
|
5 |
|
60770
|
6 |
section \<open>Transitive closure of a relation\<close>
|
17456
|
7 |
|
|
8 |
theory Trancl
|
|
9 |
imports CCL
|
|
10 |
begin
|
0
|
11 |
|
58977
|
12 |
definition trans :: "i set \<Rightarrow> o" (*transitivity predicate*)
|
|
13 |
where "trans(r) == (ALL x y z. <x,y>:r \<longrightarrow> <y,z>:r \<longrightarrow> <x,z>:r)"
|
42156
|
14 |
|
|
15 |
definition id :: "i set" (*the identity relation*)
|
|
16 |
where "id == {p. EX x. p = <x,x>}"
|
0
|
17 |
|
58977
|
18 |
definition relcomp :: "[i set,i set] \<Rightarrow> i set" (infixr "O" 60) (*composition of relations*)
|
|
19 |
where "r O s == {xz. EX x y z. xz = <x,z> \<and> <x,y>:s \<and> <y,z>:r}"
|
42156
|
20 |
|
58977
|
21 |
definition rtrancl :: "i set \<Rightarrow> i set" ("(_^*)" [100] 100)
|
|
22 |
where "r^* == lfp(\<lambda>s. id Un (r O s))"
|
42156
|
23 |
|
58977
|
24 |
definition trancl :: "i set \<Rightarrow> i set" ("(_^+)" [100] 100)
|
42156
|
25 |
where "r^+ == r O rtrancl(r)"
|
17456
|
26 |
|
20140
|
27 |
|
62020
|
28 |
subsection \<open>Natural deduction for \<open>trans(r)\<close>\<close>
|
20140
|
29 |
|
58977
|
30 |
lemma transI: "(\<And>x y z. \<lbrakk><x,y>:r; <y,z>:r\<rbrakk> \<Longrightarrow> <x,z>:r) \<Longrightarrow> trans(r)"
|
20140
|
31 |
unfolding trans_def by blast
|
|
32 |
|
58977
|
33 |
lemma transD: "\<lbrakk>trans(r); <a,b>:r; <b,c>:r\<rbrakk> \<Longrightarrow> <a,c>:r"
|
20140
|
34 |
unfolding trans_def by blast
|
|
35 |
|
|