Trancl.ML
author lcp
Thu, 06 Apr 1995 11:49:42 +0200
changeset 246 0f9230a24164
parent 184 d8a5435732cf
permissions -rw-r--r--
Deleted extra space in clos_mk.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/trancl
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     5
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     6
For trancl.thy.  Theorems about the transitive closure of a relation
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     7
*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     8
7949f97df77a Initial revision
clasohm
parents:
diff changeset
     9
open Trancl;
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    10
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    11
(** Natural deduction for trans(r) **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    12
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    13
val prems = goalw Trancl.thy [trans_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    14
    "(!! x y z. [| <x,y>:r;  <y,z>:r |] ==> <x,z>:r) ==> trans(r)";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    15
by (REPEAT (ares_tac (prems@[allI,impI]) 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    16
qed "transI";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    17
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    18
val major::prems = goalw Trancl.thy [trans_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    19
    "[| trans(r);  <a,b>:r;  <b,c>:r |] ==> <a,c>:r";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    20
by (cut_facts_tac [major] 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    21
by (fast_tac (HOL_cs addIs prems) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    22
qed "transD";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    23
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    24
(** Identity relation **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    25
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    26
goalw Trancl.thy [id_def] "<a,a> : id";  
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    27
by (rtac CollectI 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    28
by (rtac exI 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    29
by (rtac refl 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    30
qed "idI";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    31
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    32
val major::prems = goalw Trancl.thy [id_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    33
    "[| p: id;  !!x.[| p = <x,x> |] ==> P  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    34
\    |] ==>  P";  
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    35
by (rtac (major RS CollectE) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    36
by (etac exE 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    37
by (eresolve_tac prems 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    38
qed "idE";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    39
184
d8a5435732cf added id_in_pair_conv
nipkow
parents: 171
diff changeset
    40
goalw Trancl.thy [id_def] "<a,b>:id = (a=b)";
d8a5435732cf added id_in_pair_conv
nipkow
parents: 171
diff changeset
    41
by(fast_tac prod_cs 1);
d8a5435732cf added id_in_pair_conv
nipkow
parents: 171
diff changeset
    42
qed "pair_in_id_conv";
d8a5435732cf added id_in_pair_conv
nipkow
parents: 171
diff changeset
    43
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    44
(** Composition of two relations **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    45
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    46
val prems = goalw Trancl.thy [comp_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    47
    "[| <a,b>:s; <b,c>:r |] ==> <a,c> : r O s";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    48
by (fast_tac (set_cs addIs prems) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    49
qed "compI";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    50
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    51
(*proof requires higher-level assumptions or a delaying of hyp_subst_tac*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    52
val prems = goalw Trancl.thy [comp_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    53
    "[| xz : r O s;  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    54
\       !!x y z. [| xz = <x,z>;  <x,y>:s;  <y,z>:r |] ==> P \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    55
\    |] ==> P";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    56
by (cut_facts_tac prems 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    57
by (REPEAT (eresolve_tac [CollectE, exE, conjE] 1 ORELSE ares_tac prems 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    58
qed "compE";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    59
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    60
val prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    61
    "[| <a,c> : r O s;  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    62
\       !!y. [| <a,y>:s;  <y,c>:r |] ==> P \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    63
\    |] ==> P";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    64
by (rtac compE 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    65
by (REPEAT (ares_tac prems 1 ORELSE eresolve_tac [Pair_inject,ssubst] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    66
qed "compEpair";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    67
108
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    68
val comp_cs = prod_cs addIs [compI, idI] addSEs [compE, idE];
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    69
108
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    70
goal Trancl.thy "!!r s. [| r'<=r; s'<=s |] ==> (r' O s') <= (r O s)";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    71
by (fast_tac comp_cs 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    72
qed "comp_mono";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    73
108
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    74
goal Trancl.thy
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    75
    "!!r s. [| s <= Sigma(A,%x.B);  r <= Sigma(B,%x.C) |] ==> \
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    76
\           (r O s) <= Sigma(A,%x.C)";
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
    77
by (fast_tac comp_cs 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    78
qed "comp_subset_Sigma";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    79
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    80
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    81
(** The relation rtrancl **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    82
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    83
goal Trancl.thy "mono(%s. id Un (r O s))";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    84
by (rtac monoI 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    85
by (REPEAT (ares_tac [monoI, subset_refl, comp_mono, Un_mono] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    86
qed "rtrancl_fun_mono";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    87
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    88
val rtrancl_unfold = rtrancl_fun_mono RS (rtrancl_def RS def_lfp_Tarski);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    89
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    90
(*Reflexivity of rtrancl*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    91
goal Trancl.thy "<a,a> : r^*";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    92
by (stac rtrancl_unfold 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    93
by (fast_tac comp_cs 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
    94
qed "rtrancl_refl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    95
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    96
(*Closure under composition with r*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    97
val prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    98
    "[| <a,b> : r^*;  <b,c> : r |] ==> <a,c> : r^*";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
    99
by (stac rtrancl_unfold 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   100
by (fast_tac (comp_cs addIs prems) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   101
qed "rtrancl_into_rtrancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   102
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   103
(*rtrancl of r contains r*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   104
val [prem] = goal Trancl.thy "[| <a,b> : r |] ==> <a,b> : r^*";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   105
by (rtac (rtrancl_refl RS rtrancl_into_rtrancl) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   106
by (rtac prem 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   107
qed "r_into_rtrancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   108
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   109
(*monotonicity of rtrancl*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   110
goalw Trancl.thy [rtrancl_def] "!!r s. r <= s ==> r^* <= s^*";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   111
by(REPEAT(ares_tac [lfp_mono,Un_mono,comp_mono,subset_refl] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   112
qed "rtrancl_mono";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   113
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   114
(** standard induction rule **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   115
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   116
val major::prems = goal Trancl.thy 
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   117
  "[| <a,b> : r^*; \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   118
\     !!x. P(<x,x>); \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   119
\     !!x y z.[| P(<x,y>); <x,y>: r^*; <y,z>: r |]  ==>  P(<x,z>) |] \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   120
\  ==>  P(<a,b>)";
128
89669c58e506 INSTALLATION OF INDUCTIVE DEFINITIONS
lcp
parents: 108
diff changeset
   121
by (rtac ([rtrancl_def, rtrancl_fun_mono, major] MRS def_induct) 1);
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   122
by (fast_tac (comp_cs addIs prems) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   123
qed "rtrancl_full_induct";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   124
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   125
(*nice induction rule*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   126
val major::prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   127
    "[| <a::'a,b> : r^*;    \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   128
\       P(a); \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   129
\	!!y z.[| <a,y> : r^*;  <y,z> : r;  P(y) |] ==> P(z) |]  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   130
\     ==> P(b)";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   131
(*by induction on this formula*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   132
by (subgoal_tac "! y. <a::'a,b> = <a,y> --> P(y)" 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   133
(*now solve first subgoal: this formula is sufficient*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   134
by (fast_tac HOL_cs 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   135
(*now do the induction*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   136
by (resolve_tac [major RS rtrancl_full_induct] 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   137
by (fast_tac (comp_cs addIs prems) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   138
by (fast_tac (comp_cs addIs prems) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   139
qed "rtrancl_induct";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   140
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   141
(*transitivity of transitive closure!! -- by induction.*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   142
goal Trancl.thy "trans(r^*)";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   143
by (rtac transI 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   144
by (res_inst_tac [("b","z")] rtrancl_induct 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   145
by (DEPTH_SOLVE (eresolve_tac [asm_rl, rtrancl_into_rtrancl] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   146
qed "trans_rtrancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   147
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   148
(*elimination of rtrancl -- by induction on a special formula*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   149
val major::prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   150
    "[| <a::'a,b> : r^*;  (a = b) ==> P; 	\
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   151
\	!!y.[| <a,y> : r^*; <y,b> : r |] ==> P 	\
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   152
\    |] ==> P";
90
5c7a69cef18b added parentheses made necessary by change of constrain's precedence
clasohm
parents: 0
diff changeset
   153
by (subgoal_tac "(a::'a) = b  | (? y. <a,y> : r^* & <y,b> : r)" 1);
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   154
by (rtac (major RS rtrancl_induct) 2);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   155
by (fast_tac (set_cs addIs prems) 2);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   156
by (fast_tac (set_cs addIs prems) 2);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   157
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   158
qed "rtranclE";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   159
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   160
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   161
(**** The relation trancl ****)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   162
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   163
(** Conversions between trancl and rtrancl **)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   164
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   165
val [major] = goalw Trancl.thy [trancl_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   166
    "<a,b> : r^+ ==> <a,b> : r^*";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   167
by (resolve_tac [major RS compEpair] 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   168
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   169
qed "trancl_into_rtrancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   170
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   171
(*r^+ contains r*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   172
val [prem] = goalw Trancl.thy [trancl_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   173
   "[| <a,b> : r |] ==> <a,b> : r^+";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   174
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   175
qed "r_into_trancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   176
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   177
(*intro rule by definition: from rtrancl and r*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   178
val prems = goalw Trancl.thy [trancl_def]
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   179
    "[| <a,b> : r^*;  <b,c> : r |]   ==>  <a,c> : r^+";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   180
by (REPEAT (resolve_tac ([compI]@prems) 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   181
qed "rtrancl_into_trancl1";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   182
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   183
(*intro rule from r and rtrancl*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   184
val prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   185
    "[| <a,b> : r;  <b,c> : r^* |]   ==>  <a,c> : r^+";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   186
by (resolve_tac (prems RL [rtranclE]) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   187
by (etac subst 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   188
by (resolve_tac (prems RL [r_into_trancl]) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   189
by (rtac (trans_rtrancl RS transD RS rtrancl_into_trancl1) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   190
by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   191
qed "rtrancl_into_trancl2";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   192
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   193
(*elimination of r^+ -- NOT an induction rule*)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   194
val major::prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   195
    "[| <a::'a,b> : r^+;  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   196
\       <a,b> : r ==> P; \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   197
\	!!y.[| <a,y> : r^+;  <y,b> : r |] ==> P  \
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   198
\    |] ==> P";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   199
by (subgoal_tac "<a::'a,b> : r | (? y. <a,y> : r^+  &  <y,b> : r)" 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   200
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1));
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   201
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   202
by (etac rtranclE 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   203
by (fast_tac comp_cs 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   204
by (fast_tac (comp_cs addSIs [rtrancl_into_trancl1]) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   205
qed "tranclE";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   206
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   207
(*Transitivity of r^+.
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   208
  Proved by unfolding since it uses transitivity of rtrancl. *)
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   209
goalw Trancl.thy [trancl_def] "trans(r^+)";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   210
by (rtac transI 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   211
by (REPEAT (etac compEpair 1));
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   212
by (rtac (rtrancl_into_rtrancl RS (trans_rtrancl RS transD RS compI)) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   213
by (REPEAT (assume_tac 1));
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   214
qed "trans_trancl";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   215
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   216
val prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   217
    "[| <a,b> : r;  <b,c> : r^+ |]   ==>  <a,c> : r^+";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   218
by (rtac (r_into_trancl RS (trans_trancl RS transD)) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   219
by (resolve_tac prems 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   220
by (resolve_tac prems 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   221
qed "trancl_into_trancl2";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   222
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   223
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   224
val major::prems = goal Trancl.thy
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   225
    "[| <a,b> : r^*;  r <= Sigma(A,%x.A) |] ==> a=b | a:A";
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   226
by (cut_facts_tac prems 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   227
by (rtac (major RS rtrancl_induct) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   228
by (rtac (refl RS disjI1) 1);
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   229
by (fast_tac (comp_cs addSEs [SigmaE2]) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   230
qed "trancl_subset_Sigma_lemma";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   231
108
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
   232
goalw Trancl.thy [trancl_def]
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
   233
    "!!r. r <= Sigma(A,%x.A) ==> trancl(r) <= Sigma(A,%x.A)";
82c4117aff7f HOL/Trancl: comp_cs is based upon prod_cs; tidied proofs
lcp
parents: 90
diff changeset
   234
by (fast_tac (comp_cs addSDs [trancl_subset_Sigma_lemma]) 1);
171
16c4ea954511 replaced 'val ... = result()' by 'qed "..."'
clasohm
parents: 128
diff changeset
   235
qed "trancl_subset_Sigma";
0
7949f97df77a Initial revision
clasohm
parents:
diff changeset
   236
184
d8a5435732cf added id_in_pair_conv
nipkow
parents: 171
diff changeset
   237
val prod_ss = prod_ss addsimps [pair_in_id_conv];