src/HOL/Transitive_Closure.thy
author nipkow
Mon Jan 29 23:02:21 2001 +0100 (2001-01-29)
changeset 10996 74e970389def
parent 10980 0a45f2efaaec
child 11084 32c1deea5bcd
permissions -rw-r--r--
Moved some thms from Transitive_ClosureTr.ML to Transitive_Closure.thy
nipkow@10213
     1
(*  Title:      HOL/Transitive_Closure.thy
nipkow@10213
     2
    ID:         $Id$
nipkow@10213
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
nipkow@10213
     4
    Copyright   1992  University of Cambridge
nipkow@10213
     5
nipkow@10213
     6
Relfexive and Transitive closure of a relation
nipkow@10213
     7
nipkow@10213
     8
rtrancl is reflexive/transitive closure;
nipkow@10213
     9
trancl  is transitive closure
nipkow@10213
    10
reflcl  is reflexive closure
nipkow@10213
    11
wenzelm@10331
    12
These postfix operators have MAXIMUM PRIORITY, forcing their operands
wenzelm@10331
    13
to be atomic.
nipkow@10213
    14
*)
nipkow@10213
    15
wenzelm@10980
    16
theory Transitive_Closure = Lfp + Relation
wenzelm@10980
    17
files ("Transitive_Closure_lemmas.ML"):
nipkow@10213
    18
nipkow@10213
    19
constdefs
wenzelm@10331
    20
  rtrancl :: "('a * 'a) set => ('a * 'a) set"    ("(_^*)" [1000] 999)
wenzelm@10331
    21
  "r^* == lfp (%s. Id Un (r O s))"
nipkow@10213
    22
wenzelm@10331
    23
  trancl :: "('a * 'a) set => ('a * 'a) set"    ("(_^+)" [1000] 999)
wenzelm@10331
    24
  "r^+ ==  r O rtrancl r"
nipkow@10213
    25
nipkow@10213
    26
syntax
wenzelm@10331
    27
  "_reflcl" :: "('a * 'a) set => ('a * 'a) set"    ("(_^=)" [1000] 999)
nipkow@10213
    28
translations
nipkow@10213
    29
  "r^=" == "r Un Id"
nipkow@10213
    30
wenzelm@10827
    31
syntax (xsymbols)
wenzelm@10331
    32
  rtrancl :: "('a * 'a) set => ('a * 'a) set"    ("(_\\<^sup>*)" [1000] 999)
wenzelm@10331
    33
  trancl :: "('a * 'a) set => ('a * 'a) set"    ("(_\\<^sup>+)" [1000] 999)
wenzelm@10331
    34
  "_reflcl" :: "('a * 'a) set => ('a * 'a) set"    ("(_\\<^sup>=)" [1000] 999)
wenzelm@10331
    35
wenzelm@10980
    36
use "Transitive_Closure_lemmas.ML"
wenzelm@10980
    37
nipkow@10996
    38
nipkow@10996
    39
lemma reflcl_trancl[simp]: "(r\<^sup>+)\<^sup>= = r\<^sup>*"
nipkow@10996
    40
apply safe;
nipkow@10996
    41
apply (erule trancl_into_rtrancl);
nipkow@10996
    42
by (blast elim:rtranclE dest:rtrancl_into_trancl1)
nipkow@10996
    43
nipkow@10996
    44
lemma trancl_reflcl[simp]: "(r\<^sup>=)\<^sup>+ = r\<^sup>*"
nipkow@10996
    45
apply safe
nipkow@10996
    46
 apply (drule trancl_into_rtrancl)
nipkow@10996
    47
 apply simp;
nipkow@10996
    48
apply (erule rtranclE)
nipkow@10996
    49
 apply safe
nipkow@10996
    50
 apply(rule r_into_trancl)
nipkow@10996
    51
 apply simp
nipkow@10996
    52
apply(rule rtrancl_into_trancl1)
nipkow@10996
    53
 apply(erule rtrancl_reflcl[THEN equalityD2, THEN subsetD])
nipkow@10996
    54
apply fast
nipkow@10996
    55
done
nipkow@10996
    56
nipkow@10996
    57
lemma trancl_empty[simp]: "{}\<^sup>+ = {}"
nipkow@10996
    58
by (auto elim:trancl_induct)
nipkow@10996
    59
nipkow@10996
    60
lemma rtrancl_empty[simp]: "{}\<^sup>* = Id"
nipkow@10996
    61
by(rule subst[OF reflcl_trancl], simp)
nipkow@10996
    62
nipkow@10996
    63
lemma rtranclD: "(a,b) \<in> R\<^sup>* \<Longrightarrow> a=b \<or> a\<noteq>b \<and> (a,b) \<in> R\<^sup>+"
nipkow@10996
    64
by(force simp add: reflcl_trancl[THEN sym] simp del: reflcl_trancl)
nipkow@10996
    65
nipkow@10996
    66
(* should be merged with the main body of lemmas: *)
nipkow@10996
    67
nipkow@10996
    68
lemma Domain_rtrancl[simp]: "Domain(R\<^sup>*) = UNIV"
nipkow@10996
    69
by blast
nipkow@10996
    70
nipkow@10996
    71
lemma Range_rtrancl[simp]: "Range(R\<^sup>*) = UNIV"
nipkow@10996
    72
by blast
nipkow@10996
    73
nipkow@10996
    74
lemma rtrancl_Un_subset: "(R\<^sup>* \<union> S\<^sup>*) \<subseteq> (R Un S)\<^sup>*"
nipkow@10996
    75
by(rule rtrancl_Un_rtrancl[THEN subst], fast)
nipkow@10996
    76
nipkow@10996
    77
lemma in_rtrancl_UnI: "x \<in> R\<^sup>* \<or> x \<in> S\<^sup>* \<Longrightarrow> x \<in> (R \<union> S)\<^sup>*"
nipkow@10996
    78
by (blast intro: subsetD[OF rtrancl_Un_subset])
nipkow@10996
    79
nipkow@10996
    80
lemma trancl_domain [simp]: "Domain (r\<^sup>+) = Domain r"
nipkow@10996
    81
by (unfold Domain_def, blast dest:tranclD)
nipkow@10996
    82
nipkow@10996
    83
lemma trancl_range [simp]: "Range (r\<^sup>+) = Range r"
nipkow@10996
    84
by (simp add:Range_def trancl_converse[THEN sym])
nipkow@10996
    85
nipkow@10213
    86
end