src/HOL/Trancl.ML
author nipkow
Mon, 03 Nov 1997 09:58:06 +0100
changeset 4072 d0d32dd77440
parent 3723 034f0f5ca43f
child 4089 96fba19bcbe2
permissions -rw-r--r--
expand_option_bind -> split_option_bind
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
     1
(*  Title:      HOL/trancl
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
For trancl.thy.  Theorems about the transitive closure of a relation
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
open Trancl;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
(** The relation rtrancl **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
goal Trancl.thy "mono(%s. id Un (r O s))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
by (rtac monoI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
by (REPEAT (ares_tac [monoI, subset_refl, comp_mono, Un_mono] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
qed "rtrancl_fun_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
val rtrancl_unfold = rtrancl_fun_mono RS (rtrancl_def RS def_lfp_Tarski);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
(*Reflexivity of rtrancl*)
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    21
goal Trancl.thy "(a,a) : r^*";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
by (stac rtrancl_unfold 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
    23
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
qed "rtrancl_refl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
1921
56a77911efe4 Tidied up the proofs
paulson
parents: 1786
diff changeset
    26
Addsimps [rtrancl_refl];
56a77911efe4 Tidied up the proofs
paulson
parents: 1786
diff changeset
    27
AddSIs   [rtrancl_refl];
56a77911efe4 Tidied up the proofs
paulson
parents: 1786
diff changeset
    28
56a77911efe4 Tidied up the proofs
paulson
parents: 1786
diff changeset
    29
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
(*Closure under composition with r*)
1921
56a77911efe4 Tidied up the proofs
paulson
parents: 1786
diff changeset
    31
goal Trancl.thy "!!r. [| (a,b) : r^*;  (b,c) : r |] ==> (a,c) : r^*";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
by (stac rtrancl_unfold 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
    33
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
qed "rtrancl_into_rtrancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
(*rtrancl of r contains r*)
1301
42782316d510 Added various thms and tactics.
nipkow
parents: 1130
diff changeset
    37
goal Trancl.thy "!!p. p : r ==> p : r^*";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1496
diff changeset
    38
by (split_all_tac 1);
1301
42782316d510 Added various thms and tactics.
nipkow
parents: 1130
diff changeset
    39
by (etac (rtrancl_refl RS rtrancl_into_rtrancl) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
qed "r_into_rtrancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
(*monotonicity of rtrancl*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
goalw Trancl.thy [rtrancl_def] "!!r s. r <= s ==> r^* <= s^*";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1496
diff changeset
    44
by (REPEAT(ares_tac [lfp_mono,Un_mono,comp_mono,subset_refl] 1));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
qed "rtrancl_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
(** standard induction rule **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
val major::prems = goal Trancl.thy 
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    50
  "[| (a,b) : r^*; \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    51
\     !!x. P((x,x)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    52
\     !!x y z.[| P((x,y)); (x,y): r^*; (y,z): r |]  ==>  P((x,z)) |] \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    53
\  ==>  P((a,b))";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    54
by (rtac ([rtrancl_def, rtrancl_fun_mono, major] MRS def_induct) 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
    55
by (blast_tac (!claset addIs prems) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
qed "rtrancl_full_induct";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
(*nice induction rule*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
val major::prems = goal Trancl.thy
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    60
    "[| (a::'a,b) : r^*;    \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
\       P(a); \
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
    62
\       !!y z.[| (a,y) : r^*;  (y,z) : r;  P(y) |] ==> P(z) |]  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
\     ==> P(b)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
(*by induction on this formula*)
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    65
by (subgoal_tac "! y. (a::'a,b) = (a,y) --> P(y)" 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
(*now solve first subgoal: this formula is sufficient*)
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
    67
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
(*now do the induction*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
by (resolve_tac [major RS rtrancl_full_induct] 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
    70
by (blast_tac (!claset addIs prems) 1);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
    71
by (blast_tac (!claset addIs prems) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
qed "rtrancl_induct";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
1746
f0c6aabc6c02 Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents: 1706
diff changeset
    74
bind_thm
f0c6aabc6c02 Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents: 1706
diff changeset
    75
  ("rtrancl_induct2",
f0c6aabc6c02 Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents: 1706
diff changeset
    76
   Prod_Syntax.split_rule
f0c6aabc6c02 Moved split_rule et al from ind_syntax.ML to Prod.ML.
nipkow
parents: 1706
diff changeset
    77
     (read_instantiate [("a","(ax,ay)"), ("b","(bx,by)")] rtrancl_induct));
1706
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
    78
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
(*transitivity of transitive closure!! -- by induction.*)
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    80
goalw Trancl.thy [trans_def] "trans(r^*)";
1786
8a31d85d27b8 best_tac, deepen_tac and safe_tac now also use default claset.
berghofe
parents: 1766
diff changeset
    81
by (safe_tac (!claset));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    82
by (eres_inst_tac [("b","z")] rtrancl_induct 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
    83
by (ALLGOALS(blast_tac (!claset addIs [rtrancl_into_rtrancl])));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    84
qed "trans_rtrancl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    85
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    86
bind_thm ("rtrancl_trans", trans_rtrancl RS transD);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    87
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
(*elimination of rtrancl -- by induction on a special formula*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
val major::prems = goal Trancl.thy
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
    91
    "[| (a::'a,b) : r^*;  (a = b) ==> P;        \
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
    92
\       !!y.[| (a,y) : r^*; (y,b) : r |] ==> P  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
\    |] ==> P";
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    94
by (subgoal_tac "(a::'a) = b  | (? y. (a,y) : r^* & (y,b) : r)" 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
by (rtac (major RS rtrancl_induct) 2);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
    96
by (blast_tac (!claset addIs prems) 2);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
    97
by (blast_tac (!claset addIs prems) 2);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
qed "rtranclE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   101
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   102
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   103
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   104
(*** More r^* equations and inclusions ***)
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   105
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   106
goal Trancl.thy "(r^*)^* = r^*";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   107
by (rtac set_ext 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   108
by (res_inst_tac [("p","x")] PairE 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   109
by (hyp_subst_tac 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   110
by (rtac iffI 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1496
diff changeset
   111
by (etac rtrancl_induct 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   112
by (rtac rtrancl_refl 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   113
by (blast_tac (!claset addIs [rtrancl_trans]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   114
by (etac r_into_rtrancl 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   115
qed "rtrancl_idemp";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   116
Addsimps [rtrancl_idemp];
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   117
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   118
goal Trancl.thy "!!r s. r <= s^* ==> r^* <= s^*";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   119
by (dtac rtrancl_mono 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   120
by (Asm_full_simp_tac 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   121
qed "rtrancl_subset_rtrancl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   122
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   123
goal Trancl.thy "!!R. [| R <= S; S <= R^* |] ==> S^* = R^*";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   124
by (dtac rtrancl_mono 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   125
by (dtac rtrancl_mono 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   126
by (Asm_full_simp_tac 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   127
by (Blast_tac 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   128
qed "rtrancl_subset";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   129
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   130
goal Trancl.thy "!!R. (R^* Un S^*)^* = (R Un S)^*";
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   131
by (blast_tac (!claset addSIs [rtrancl_subset]
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   132
                       addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   133
qed "rtrancl_Un_rtrancl";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents: 1465
diff changeset
   134
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   135
goal Trancl.thy "(R^=)^* = R^*";
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   136
by (blast_tac (!claset addSIs [rtrancl_subset]
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   137
                       addIs  [rtrancl_refl, r_into_rtrancl]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   138
qed "rtrancl_reflcl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   139
Addsimps [rtrancl_reflcl];
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   140
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   141
goal Trancl.thy "!!r. (x,y) : (r^-1)^* ==> (x,y) : (r^*)^-1";
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   142
by (rtac inverseI 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   143
by (etac rtrancl_induct 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   144
by (rtac rtrancl_refl 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   145
by (blast_tac (!claset addIs [r_into_rtrancl,rtrancl_trans]) 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   146
qed "rtrancl_inverseD";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   147
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   148
goal Trancl.thy "!!r. (x,y) : (r^*)^-1 ==> (x,y) : (r^-1)^*";
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   149
by (dtac inverseD 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   150
by (etac rtrancl_induct 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   151
by (rtac rtrancl_refl 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   152
by (blast_tac (!claset addIs [r_into_rtrancl,rtrancl_trans]) 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   153
qed "rtrancl_inverseI";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   154
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   155
goal Trancl.thy "(r^-1)^* = (r^*)^-1";
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   156
by (safe_tac (!claset addSIs [rtrancl_inverseI]));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   157
by (res_inst_tac [("p","x")] PairE 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   158
by (hyp_subst_tac 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   159
by (etac rtrancl_inverseD 1);
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   160
qed "rtrancl_inverse";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   161
1706
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   162
val major::prems = goal Trancl.thy
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   163
    "[| (a,b) : r^*; P(b); \
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   164
\       !!y z.[| (y,z) : r;  (z,b) : r^*;  P(z) |] ==> P(y) |]  \
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   165
\     ==> P(a)";
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   166
by (rtac ((major RS inverseI RS rtrancl_inverseI) RS rtrancl_induct) 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   167
by (resolve_tac prems 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   168
by (blast_tac (!claset addIs prems addSDs[rtrancl_inverseD])1);
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   169
qed "inverse_rtrancl_induct";
1706
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   170
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   171
val prems = goal Trancl.thy
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   172
 "[| ((a,b),(c,d)) : r^*; P c d; \
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   173
\    !!x y z u.[| ((x,y),(z,u)) : r;  ((z,u),(c,d)) : r^*;  P z u |] ==> P x y\
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   174
\ |] ==> P a b";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   175
by (res_inst_tac[("R","P")]splitD 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   176
by (res_inst_tac[("P","split P")]inverse_rtrancl_induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   177
by (resolve_tac prems 1);
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   178
by (Simp_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   179
by (resolve_tac prems 1);
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   180
by (split_all_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   181
by (Asm_full_simp_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   182
by (REPEAT(ares_tac prems 1));
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   183
qed "inverse_rtrancl_induct2";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents: 1465
diff changeset
   184
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   185
val major::prems = goal Trancl.thy
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   186
 "[| (x,z):r^*; \
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   187
\    x=z ==> P; \
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   188
\    !!y. [| (x,y):r; (y,z):r^* |] ==> P \
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   189
\ |] ==> P";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   190
by (subgoal_tac "x = z  | (? y. (x,y) : r & (y,z) : r^*)" 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   191
by (rtac (major RS inverse_rtrancl_induct) 2);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   192
by (blast_tac (!claset addIs prems) 2);
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   193
by (blast_tac (!claset addIs prems) 2);
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   194
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   195
qed "rtranclE2";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   196
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   197
goal Trancl.thy "r O r^* = r^* O r";
3723
034f0f5ca43f Tidied proof of r_comp_rtrancl_eq
paulson
parents: 3457
diff changeset
   198
by (blast_tac (!claset addEs [rtranclE, rtranclE2] 
034f0f5ca43f Tidied proof of r_comp_rtrancl_eq
paulson
parents: 3457
diff changeset
   199
	               addIs [rtrancl_into_rtrancl, rtrancl_into_rtrancl2]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   200
qed "r_comp_rtrancl_eq";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   201
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
(**** The relation trancl ****)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   205
goalw Trancl.thy [trancl_def] "!!p.[| p:r^+; r <= s |] ==> p:s^+";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   206
by (blast_tac (!claset addIs [rtrancl_mono RS subsetD]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   207
qed "trancl_mono";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   208
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   209
(** Conversions between trancl and rtrancl **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   210
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
val [major] = goalw Trancl.thy [trancl_def]
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   212
    "(a,b) : r^+ ==> (a,b) : r^*";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   213
by (resolve_tac [major RS compEpair] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   214
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   215
qed "trancl_into_rtrancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   216
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   217
(*r^+ contains r*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   218
val [prem] = goalw Trancl.thy [trancl_def]
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   219
   "[| (a,b) : r |] ==> (a,b) : r^+";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   220
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   221
qed "r_into_trancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   222
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   223
(*intro rule by definition: from rtrancl and r*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   224
val prems = goalw Trancl.thy [trancl_def]
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   225
    "[| (a,b) : r^*;  (b,c) : r |]   ==>  (a,c) : r^+";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   226
by (REPEAT (resolve_tac ([compI]@prems) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   227
qed "rtrancl_into_trancl1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   228
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   229
(*intro rule from r and rtrancl*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   230
val prems = goal Trancl.thy
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   231
    "[| (a,b) : r;  (b,c) : r^* |]   ==>  (a,c) : r^+";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
by (resolve_tac (prems RL [rtranclE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   233
by (etac subst 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   234
by (resolve_tac (prems RL [r_into_trancl]) 1);
1122
20b708827030 renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents: 1121
diff changeset
   235
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   236
by (REPEAT (ares_tac (prems@[r_into_rtrancl]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   237
qed "rtrancl_into_trancl2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   238
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   239
(*Nice induction rule for trancl*)
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   240
val major::prems = goal Trancl.thy
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   241
  "[| (a,b) : r^+;                                      \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   242
\     !!y.  [| (a,y) : r |] ==> P(y);                   \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   243
\     !!y z.[| (a,y) : r^+;  (y,z) : r;  P(y) |] ==> P(z)       \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   244
\  |] ==> P(b)";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   245
by (rtac (rewrite_rule [trancl_def] major  RS  compEpair) 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   246
(*by induction on this formula*)
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   247
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   248
(*now solve first subgoal: this formula is sufficient*)
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   249
by (Blast_tac 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   250
by (etac rtrancl_induct 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2922
diff changeset
   251
by (ALLGOALS (blast_tac (!claset addIs (rtrancl_into_trancl1::prems))));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   252
qed "trancl_induct";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   253
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   254
(*elimination of r^+ -- NOT an induction rule*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   255
val major::prems = goal Trancl.thy
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   256
    "[| (a::'a,b) : r^+;  \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   257
\       (a,b) : r ==> P; \
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
   258
\       !!y.[| (a,y) : r^+;  (y,b) : r |] ==> P  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   259
\    |] ==> P";
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   260
by (subgoal_tac "(a::'a,b) : r | (? y. (a,y) : r^+  &  (y,b) : r)" 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   261
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   262
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   263
by (etac rtranclE 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   264
by (Blast_tac 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   265
by (blast_tac (!claset addSIs [rtrancl_into_trancl1]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   266
qed "tranclE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   267
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   268
(*Transitivity of r^+.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   269
  Proved by unfolding since it uses transitivity of rtrancl. *)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   270
goalw Trancl.thy [trancl_def] "trans(r^+)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   271
by (rtac transI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
by (REPEAT (etac compEpair 1));
1122
20b708827030 renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents: 1121
diff changeset
   273
by (rtac (rtrancl_into_rtrancl RS (rtrancl_trans RS compI)) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
by (REPEAT (assume_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   275
qed "trans_trancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   276
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   277
bind_thm ("trancl_trans", trans_trancl RS transD);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   278
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   279
goalw Trancl.thy [trancl_def]
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   280
  "!!r. [| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   281
by (blast_tac (!claset addIs [rtrancl_trans,r_into_rtrancl]) 1);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   282
qed "rtrancl_trancl_trancl";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   283
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   284
val prems = goal Trancl.thy
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   285
    "[| (a,b) : r;  (b,c) : r^+ |]   ==>  (a,c) : r^+";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   286
by (rtac (r_into_trancl RS (trans_trancl RS transD)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   287
by (resolve_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
by (resolve_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   289
qed "trancl_into_trancl2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   291
(* primitive recursion for trancl over finite relations: *)
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   292
goal Trancl.thy "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   293
by (rtac equalityI 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   294
 by (rtac subsetI 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   295
 by (split_all_tac 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   296
 by (etac trancl_induct 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   297
  by (blast_tac (!claset addIs [r_into_trancl]) 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   298
 by (blast_tac (!claset addIs
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   299
     [rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1);
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   300
by (rtac subsetI 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   301
by (blast_tac (!claset addIs
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   302
     [rtrancl_into_trancl2, rtrancl_trancl_trancl,
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   303
      impOfSubs rtrancl_mono, trancl_mono]) 1);
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   304
qed "trancl_insert";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   305
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   306
goalw Trancl.thy [trancl_def] "(r^-1)^+ = (r^+)^-1";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   307
by (simp_tac (!simpset addsimps [rtrancl_inverse,inverse_comp]) 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   308
by (simp_tac (!simpset addsimps [rtrancl_inverse RS sym,r_comp_rtrancl_eq]) 1);
3439
54785105178c converse -> ^-1
nipkow
parents: 3413
diff changeset
   309
qed "trancl_inverse";
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   310
1130
0df0df1685a8 Added trancl_cs
nipkow
parents: 1128
diff changeset
   311
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   312
val major::prems = goal Trancl.thy
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   313
    "[| (a,b) : r^*;  r <= A Times A |] ==> a=b | a:A";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   314
by (cut_facts_tac prems 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   315
by (rtac (major RS rtrancl_induct) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   316
by (rtac (refl RS disjI1) 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   317
by (Blast_tac 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   318
val lemma = result();
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   319
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   320
goalw Trancl.thy [trancl_def]
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   321
    "!!r. r <= A Times A ==> r^+ <= A Times A";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   322
by (blast_tac (!claset addSDs [lemma]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   323
qed "trancl_subset_Sigma";
1130
0df0df1685a8 Added trancl_cs
nipkow
parents: 1128
diff changeset
   324