src/ZF/Trancl.thy
author berghofe
Fri, 11 Jul 2003 14:55:17 +0200
changeset 14102 8af7334af4b3
parent 13784 b9f6154427a4
child 14653 0848ab6fe5fc
permissions -rw-r--r--
- Installed specific code generator for equality enforcing that arguments do not have function types, which would result in an error message during compilation. - Added test case generators for basic types.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13269
diff changeset
     1
(*  Title:      ZF/Trancl.thy
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1478
2b8c2a7547ab expanded tabs
clasohm
parents: 1401
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13269
diff changeset
     8
header{*Relations: Their General Properties and Transitive Closure*}
c9cfe1638bf2 improved presentation markup
paulson
parents: 13269
diff changeset
     9
13357
6f54e992777e Removal of mono.thy
paulson
parents: 13356
diff changeset
    10
theory Trancl = Fixedpt + Perm:
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    11
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    12
constdefs
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    13
  refl     :: "[i,i]=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    14
    "refl(A,r) == (ALL x: A. <x,x> : r)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    15
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    16
  irrefl   :: "[i,i]=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    17
    "irrefl(A,r) == ALL x: A. <x,x> ~: r"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    18
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    19
  equiv    :: "[i,i]=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    20
    "equiv(A,r) == r <= A*A & refl(A,r) & sym(r) & trans(r)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    21
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    22
  sym      :: "i=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    23
    "sym(r) == ALL x y. <x,y>: r --> <y,x>: r"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    24
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    25
  asym     :: "i=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    26
    "asym(r) == ALL x y. <x,y>:r --> ~ <y,x>:r"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    27
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    28
  antisym  :: "i=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    29
    "antisym(r) == ALL x y.<x,y>:r --> <y,x>:r --> x=y"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    30
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    31
  trans    :: "i=>o"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    32
    "trans(r) == ALL x y z. <x,y>: r --> <y,z>: r --> <x,z>: r"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    33
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    34
  trans_on :: "[i,i]=>o"  ("trans[_]'(_')")
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    35
    "trans[A](r) == ALL x:A. ALL y:A. ALL z:A.       
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    36
                          <x,y>: r --> <y,z>: r --> <x,z>: r"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    37
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    38
  rtrancl :: "i=>i"  ("(_^*)" [100] 100)  (*refl/transitive closure*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    39
    "r^* == lfp(field(r)*field(r), %s. id(field(r)) Un (r O s))"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    40
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    41
  trancl  :: "i=>i"  ("(_^+)" [100] 100)  (*transitive closure*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    42
    "r^+ == r O r^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    43
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    44
subsection{*General properties of relations*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    45
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    46
subsubsection{*irreflexivity*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    47
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    48
lemma irreflI:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    49
    "[| !!x. x:A ==> <x,x> ~: r |] ==> irrefl(A,r)"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    50
by (simp add: irrefl_def) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    51
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
    52
lemma irreflE: "[| irrefl(A,r);  x:A |] ==>  <x,x> ~: r"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    53
by (simp add: irrefl_def)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    54
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    55
subsubsection{*symmetry*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    56
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    57
lemma symI:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    58
     "[| !!x y.<x,y>: r ==> <y,x>: r |] ==> sym(r)"
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13269
diff changeset
    59
by (unfold sym_def, blast) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    60
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
    61
lemma symE: "[| sym(r); <x,y>: r |]  ==>  <y,x>: r"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    62
by (unfold sym_def, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    63
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    64
subsubsection{*antisymmetry*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    65
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    66
lemma antisymI:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    67
     "[| !!x y.[| <x,y>: r;  <y,x>: r |] ==> x=y |] ==> antisym(r)"
13356
c9cfe1638bf2 improved presentation markup
paulson
parents: 13269
diff changeset
    68
by (simp add: antisym_def, blast) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    69
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    70
lemma antisymE: "[| antisym(r); <x,y>: r;  <y,x>: r |]  ==>  x=y"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    71
by (simp add: antisym_def, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    72
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    73
subsubsection{*transitivity*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    74
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    75
lemma transD: "[| trans(r);  <a,b>:r;  <b,c>:r |] ==> <a,c>:r"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    76
by (unfold trans_def, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    77
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    78
lemma trans_onD: 
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    79
    "[| trans[A](r);  <a,b>:r;  <b,c>:r;  a:A;  b:A;  c:A |] ==> <a,c>:r"
13243
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
    80
by (unfold trans_on_def, blast)
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
    81
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
    82
lemma trans_imp_trans_on: "trans(r) ==> trans[A](r)"
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
    83
by (unfold trans_def trans_on_def, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    84
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
    85
lemma trans_on_imp_trans: "[|trans[A](r); r <= A*A|] ==> trans(r)";
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
    86
by (simp add: trans_on_def trans_def, blast)
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
    87
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
    88
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    89
subsection{*Transitive closure of a relation*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    90
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    91
lemma rtrancl_bnd_mono:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    92
     "bnd_mono(field(r)*field(r), %s. id(field(r)) Un (r O s))"
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
    93
by (rule bnd_monoI, blast+)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    94
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    95
lemma rtrancl_mono: "r<=s ==> r^* <= s^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    96
apply (unfold rtrancl_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    97
apply (rule lfp_mono)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
    98
apply (rule rtrancl_bnd_mono)+
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
    99
apply blast 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   100
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   101
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   102
(* r^* = id(field(r)) Un ( r O r^* )    *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   103
lemmas rtrancl_unfold =
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   104
     rtrancl_bnd_mono [THEN rtrancl_def [THEN def_lfp_unfold], standard]
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   105
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   106
(** The relation rtrancl **)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   107
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   108
(*  r^* <= field(r) * field(r)  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   109
lemmas rtrancl_type = rtrancl_def [THEN def_lfp_subset, standard]
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   110
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   111
lemma relation_rtrancl: "relation(r^*)"
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   112
apply (simp add: relation_def) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   113
apply (blast dest: rtrancl_type [THEN subsetD]) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   114
done
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   115
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   116
(*Reflexivity of rtrancl*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   117
lemma rtrancl_refl: "[| a: field(r) |] ==> <a,a> : r^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   118
apply (rule rtrancl_unfold [THEN ssubst])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   119
apply (erule idI [THEN UnI1])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   120
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   121
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   122
(*Closure under composition with r  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   123
lemma rtrancl_into_rtrancl: "[| <a,b> : r^*;  <b,c> : r |] ==> <a,c> : r^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   124
apply (rule rtrancl_unfold [THEN ssubst])
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13248
diff changeset
   125
apply (rule compI [THEN UnI2], assumption, assumption)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   126
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   127
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   128
(*rtrancl of r contains all pairs in r  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   129
lemma r_into_rtrancl: "<a,b> : r ==> <a,b> : r^*"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   130
by (rule rtrancl_refl [THEN rtrancl_into_rtrancl], blast+)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   131
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   132
(*The premise ensures that r consists entirely of pairs*)
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   133
lemma r_subset_rtrancl: "relation(r) ==> r <= r^*"
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   134
by (simp add: relation_def, blast intro: r_into_rtrancl)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   135
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   136
lemma rtrancl_field: "field(r^*) = field(r)"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   137
by (blast intro: r_into_rtrancl dest!: rtrancl_type [THEN subsetD])
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   138
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   139
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   140
(** standard induction rule **)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   141
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
   142
lemma rtrancl_full_induct [case_names initial step, consumes 1]:
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   143
  "[| <a,b> : r^*;  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   144
      !!x. x: field(r) ==> P(<x,x>);  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   145
      !!x y z.[| P(<x,y>); <x,y>: r^*; <y,z>: r |]  ==>  P(<x,z>) |]  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   146
   ==>  P(<a,b>)"
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   147
by (erule def_induct [OF rtrancl_def rtrancl_bnd_mono], blast) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   148
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   149
(*nice induction rule.
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   150
  Tried adding the typing hypotheses y,z:field(r), but these
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   151
  caused expensive case splits!*)
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
   152
lemma rtrancl_induct [case_names initial step, induct set: rtrancl]:
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   153
  "[| <a,b> : r^*;                                               
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   154
      P(a);                                                      
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   155
      !!y z.[| <a,y> : r^*;  <y,z> : r;  P(y) |] ==> P(z)        
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   156
   |] ==> P(b)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   157
(*by induction on this formula*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   158
apply (subgoal_tac "ALL y. <a,b> = <a,y> --> P (y) ")
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   159
(*now solve first subgoal: this formula is sufficient*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   160
apply (erule spec [THEN mp], rule refl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   161
(*now do the induction*)
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   162
apply (erule rtrancl_full_induct, blast+)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   163
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   164
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   165
(*transitivity of transitive closure!! -- by induction.*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   166
lemma trans_rtrancl: "trans(r^*)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   167
apply (unfold trans_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   168
apply (intro allI impI)
13784
b9f6154427a4 tidying (by script)
paulson
parents: 13534
diff changeset
   169
apply (erule_tac b = z in rtrancl_induct, assumption)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   170
apply (blast intro: rtrancl_into_rtrancl) 
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   171
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   172
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   173
lemmas rtrancl_trans = trans_rtrancl [THEN transD, standard]
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   174
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   175
(*elimination of rtrancl -- by induction on a special formula*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   176
lemma rtranclE:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   177
    "[| <a,b> : r^*;  (a=b) ==> P;                        
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   178
        !!y.[| <a,y> : r^*;   <y,b> : r |] ==> P |]       
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   179
     ==> P"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   180
apply (subgoal_tac "a = b | (EX y. <a,y> : r^* & <y,b> : r) ")
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   181
(*see HOL/trancl*)
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   182
apply blast 
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   183
apply (erule rtrancl_induct, blast+)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   184
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   185
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   186
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   187
(**** The relation trancl ****)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   188
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   189
(*Transitivity of r^+ is proved by transitivity of r^*  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   190
lemma trans_trancl: "trans(r^+)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   191
apply (unfold trans_def trancl_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   192
apply (blast intro: rtrancl_into_rtrancl
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   193
                    trans_rtrancl [THEN transD, THEN compI])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   194
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   195
13243
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
   196
lemmas trans_on_trancl = trans_trancl [THEN trans_imp_trans_on]
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
   197
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   198
lemmas trancl_trans = trans_trancl [THEN transD, standard]
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   199
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   200
(** Conversions between trancl and rtrancl **)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   201
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   202
lemma trancl_into_rtrancl: "<a,b> : r^+ ==> <a,b> : r^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   203
apply (unfold trancl_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   204
apply (blast intro: rtrancl_into_rtrancl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   205
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   206
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   207
(*r^+ contains all pairs in r  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   208
lemma r_into_trancl: "<a,b> : r ==> <a,b> : r^+"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   209
apply (unfold trancl_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   210
apply (blast intro!: rtrancl_refl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   211
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   212
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   213
(*The premise ensures that r consists entirely of pairs*)
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   214
lemma r_subset_trancl: "relation(r) ==> r <= r^+"
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   215
by (simp add: relation_def, blast intro: r_into_trancl)
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   216
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   217
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   218
(*intro rule by definition: from r^* and r  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   219
lemma rtrancl_into_trancl1: "[| <a,b> : r^*;  <b,c> : r |]   ==>  <a,c> : r^+"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   220
by (unfold trancl_def, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   221
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   222
(*intro rule from r and r^*  *)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   223
lemma rtrancl_into_trancl2:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   224
    "[| <a,b> : r;  <b,c> : r^* |]   ==>  <a,c> : r^+"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   225
apply (erule rtrancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   226
 apply (erule r_into_trancl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   227
apply (blast intro: r_into_trancl trancl_trans) 
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   228
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   229
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   230
(*Nice induction rule for trancl*)
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
   231
lemma trancl_induct [case_names initial step, induct set: trancl]:
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   232
  "[| <a,b> : r^+;                                       
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   233
      !!y.  [| <a,y> : r |] ==> P(y);                    
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   234
      !!y z.[| <a,y> : r^+;  <y,z> : r;  P(y) |] ==> P(z)        
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   235
   |] ==> P(b)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   236
apply (rule compEpair)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   237
apply (unfold trancl_def, assumption)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   238
(*by induction on this formula*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   239
apply (subgoal_tac "ALL z. <y,z> : r --> P (z) ")
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   240
(*now solve first subgoal: this formula is sufficient*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   241
 apply blast
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   242
apply (erule rtrancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   243
apply (blast intro: rtrancl_into_trancl1)+
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   244
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   245
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   246
(*elimination of r^+ -- NOT an induction rule*)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   247
lemma tranclE:
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   248
    "[| <a,b> : r^+;   
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   249
        <a,b> : r ==> P;  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   250
        !!y.[| <a,y> : r^+; <y,b> : r |] ==> P   
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   251
     |] ==> P"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   252
apply (subgoal_tac "<a,b> : r | (EX y. <a,y> : r^+ & <y,b> : r) ")
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   253
apply blast 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   254
apply (rule compEpair)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   255
apply (unfold trancl_def, assumption)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   256
apply (erule rtranclE)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   257
apply (blast intro: rtrancl_into_trancl1)+
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   258
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   259
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   260
lemma trancl_type: "r^+ <= field(r)*field(r)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   261
apply (unfold trancl_def)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   262
apply (blast elim: rtrancl_type [THEN subsetD, THEN SigmaE2])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   263
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   264
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   265
lemma relation_trancl: "relation(r^+)"
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   266
apply (simp add: relation_def) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   267
apply (blast dest: trancl_type [THEN subsetD]) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   268
done
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   269
13243
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
   270
lemma trancl_subset_times: "r \<subseteq> A * A ==> r^+ \<subseteq> A * A"
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
   271
by (insert trancl_type [of r], blast)
ba53d07d32d5 new lemmas
paulson
parents: 13240
diff changeset
   272
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   273
lemma trancl_mono: "r<=s ==> r^+ <= s^+"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   274
by (unfold trancl_def, intro comp_mono rtrancl_mono)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   275
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   276
lemma trancl_eq_r: "[|relation(r); trans(r)|] ==> r^+ = r"
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   277
apply (rule equalityI)
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   278
 prefer 2 apply (erule r_subset_trancl, clarify) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   279
apply (frule trancl_type [THEN subsetD], clarify) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   280
apply (erule trancl_induct, assumption)
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   281
apply (blast dest: transD) 
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   282
done
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   283
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   284
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   285
(** Suggested by Sidi Ould Ehmety **)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   286
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   287
lemma rtrancl_idemp [simp]: "(r^*)^* = r^*"
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   288
apply (rule equalityI, auto)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   289
 prefer 2
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   290
 apply (frule rtrancl_type [THEN subsetD])
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   291
 apply (blast intro: r_into_rtrancl ) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   292
txt{*converse direction*}
13240
bb5f4faea1f3 conversion of Sum, pair to Isar script
paulson
parents: 13239
diff changeset
   293
apply (frule rtrancl_type [THEN subsetD], clarify) 
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   294
apply (erule rtrancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   295
apply (simp add: rtrancl_refl rtrancl_field)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   296
apply (blast intro: rtrancl_trans)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   297
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   298
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   299
lemma rtrancl_subset: "[| R <= S; S <= R^* |] ==> S^* = R^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   300
apply (drule rtrancl_mono)
13269
3ba9be497c33 Tidying and introduction of various new theorems
paulson
parents: 13248
diff changeset
   301
apply (drule rtrancl_mono, simp_all, blast)
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   302
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   303
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   304
lemma rtrancl_Un_rtrancl:
13248
ae66c22ed52e new theorems
paulson
parents: 13243
diff changeset
   305
     "[| relation(r); relation(s) |] ==> (r^* Un s^*)^* = (r Un s)^*"
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   306
apply (rule rtrancl_subset)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   307
apply (blast dest: r_subset_rtrancl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   308
apply (blast intro: rtrancl_mono [THEN subsetD])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   309
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   310
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   311
(*** "converse" laws by Sidi Ould Ehmety ***)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   312
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   313
(** rtrancl **)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   314
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   315
lemma rtrancl_converseD: "<x,y>:converse(r)^* ==> <x,y>:converse(r^*)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   316
apply (rule converseI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   317
apply (frule rtrancl_type [THEN subsetD])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   318
apply (erule rtrancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   319
apply (blast intro: rtrancl_refl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   320
apply (blast intro: r_into_rtrancl rtrancl_trans)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   321
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   322
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   323
lemma rtrancl_converseI: "<x,y>:converse(r^*) ==> <x,y>:converse(r)^*"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   324
apply (drule converseD)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   325
apply (frule rtrancl_type [THEN subsetD])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   326
apply (erule rtrancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   327
apply (blast intro: rtrancl_refl)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   328
apply (blast intro: r_into_rtrancl rtrancl_trans)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   329
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   330
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   331
lemma rtrancl_converse: "converse(r)^* = converse(r^*)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   332
apply (safe intro!: equalityI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   333
apply (frule rtrancl_type [THEN subsetD])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   334
apply (safe dest!: rtrancl_converseD intro!: rtrancl_converseI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   335
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   336
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   337
(** trancl **)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   338
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   339
lemma trancl_converseD: "<a, b>:converse(r)^+ ==> <a, b>:converse(r^+)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   340
apply (erule trancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   341
apply (auto intro: r_into_trancl trancl_trans)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   342
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   343
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   344
lemma trancl_converseI: "<x,y>:converse(r^+) ==> <x,y>:converse(r)^+"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   345
apply (drule converseD)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   346
apply (erule trancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   347
apply (auto intro: r_into_trancl trancl_trans)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   348
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   349
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   350
lemma trancl_converse: "converse(r)^+ = converse(r^+)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   351
apply (safe intro!: equalityI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   352
apply (frule trancl_type [THEN subsetD])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   353
apply (safe dest!: trancl_converseD intro!: trancl_converseI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   354
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   355
13534
ca6debb89d77 avoid duplicate fact bindings;
wenzelm
parents: 13357
diff changeset
   356
lemma converse_trancl_induct [case_names initial step, consumes 1]:
13239
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   357
"[| <a, b>:r^+; !!y. <y, b> :r ==> P(y);  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   358
      !!y z. [| <y, z> : r; <z, b> : r^+; P(z) |] ==> P(y) |]  
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   359
       ==> P(a)"
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   360
apply (drule converseI)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   361
apply (simp (no_asm_use) add: trancl_converse [symmetric])
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   362
apply (erule trancl_induct)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   363
apply (auto simp add: trancl_converse)
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   364
done
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   365
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   366
ML
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   367
{*
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   368
val refl_def = thm "refl_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   369
val irrefl_def = thm "irrefl_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   370
val equiv_def = thm "equiv_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   371
val sym_def = thm "sym_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   372
val asym_def = thm "asym_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   373
val antisym_def = thm "antisym_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   374
val trans_def = thm "trans_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   375
val trans_on_def = thm "trans_on_def";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   376
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   377
val irreflI = thm "irreflI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   378
val symI = thm "symI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   379
val symI = thm "symI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   380
val antisymI = thm "antisymI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   381
val antisymE = thm "antisymE";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   382
val transD = thm "transD";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   383
val trans_onD = thm "trans_onD";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   384
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   385
val rtrancl_bnd_mono = thm "rtrancl_bnd_mono";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   386
val rtrancl_mono = thm "rtrancl_mono";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   387
val rtrancl_unfold = thm "rtrancl_unfold";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   388
val rtrancl_type = thm "rtrancl_type";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   389
val rtrancl_refl = thm "rtrancl_refl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   390
val rtrancl_into_rtrancl = thm "rtrancl_into_rtrancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   391
val r_into_rtrancl = thm "r_into_rtrancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   392
val r_subset_rtrancl = thm "r_subset_rtrancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   393
val rtrancl_field = thm "rtrancl_field";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   394
val rtrancl_full_induct = thm "rtrancl_full_induct";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   395
val rtrancl_induct = thm "rtrancl_induct";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   396
val trans_rtrancl = thm "trans_rtrancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   397
val rtrancl_trans = thm "rtrancl_trans";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   398
val rtranclE = thm "rtranclE";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   399
val trans_trancl = thm "trans_trancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   400
val trancl_trans = thm "trancl_trans";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   401
val trancl_into_rtrancl = thm "trancl_into_rtrancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   402
val r_into_trancl = thm "r_into_trancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   403
val r_subset_trancl = thm "r_subset_trancl";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   404
val rtrancl_into_trancl1 = thm "rtrancl_into_trancl1";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   405
val rtrancl_into_trancl2 = thm "rtrancl_into_trancl2";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   406
val trancl_induct = thm "trancl_induct";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   407
val tranclE = thm "tranclE";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   408
val trancl_type = thm "trancl_type";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   409
val trancl_mono = thm "trancl_mono";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   410
val rtrancl_idemp = thm "rtrancl_idemp";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   411
val rtrancl_subset = thm "rtrancl_subset";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   412
val rtrancl_converseD = thm "rtrancl_converseD";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   413
val rtrancl_converseI = thm "rtrancl_converseI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   414
val rtrancl_converse = thm "rtrancl_converse";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   415
val trancl_converseD = thm "trancl_converseD";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   416
val trancl_converseI = thm "trancl_converseI";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   417
val trancl_converse = thm "trancl_converse";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   418
val converse_trancl_induct = thm "converse_trancl_induct";
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   419
*}
f599984ec4c2 converted Bool, Trancl, Rel to Isar format
paulson
parents: 13220
diff changeset
   420
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   421
end