src/HOL/Trancl.ML
author paulson
Thu, 08 Jul 1999 13:37:40 +0200
changeset 6914 ad689270a265
parent 6856 0364007b4bb3
child 7007 b46ccfee8e59
permissions -rw-r--r--
new theory IntDiv.thy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
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
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
     6
Theorems about the transitive closure of a relation
923
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
5771
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
     9
(** The relation rtrancl **)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
5771
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
    11
section "^*";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
5608
a82a038a3e7a id <-> Id
nipkow
parents: 5479
diff changeset
    13
Goal "mono(%s. Id Un (r O s))";
923
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*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
    21
Goal "(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*)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
    31
Goal "[| (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*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
    37
Goal "!!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*)
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
    43
Goalw [rtrancl_def] "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
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    49
val major::prems = Goal 
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);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
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*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    59
val major::prems = Goal
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);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
    70
by (blast_tac (claset() addIs prems) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
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
5098
48e70d9fe05f Removed structure Prod_Syntax.
berghofe
parents: 5069
diff changeset
    74
bind_thm ("rtrancl_induct2", split_rule
48e70d9fe05f Removed structure Prod_Syntax.
berghofe
parents: 5069
diff changeset
    75
  (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
    76
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
(*transitivity of transitive closure!! -- by induction.*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
    78
Goalw [trans_def] "trans(r^*)";
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
    79
by Safe_tac;
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    80
by (eres_inst_tac [("b","z")] rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
    81
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_into_rtrancl])));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    82
qed "trans_rtrancl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    83
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    84
bind_thm ("rtrancl_trans", trans_rtrancl RS transD);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    85
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
(*elimination of rtrancl -- by induction on a special formula*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
    88
val major::prems = Goal
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
    89
    "[| (a::'a,b) : r^*;  (a = b) ==> P;        \
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
    90
\       !!y.[| (a,y) : r^*; (y,b) : r |] ==> P  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
\    |] ==> P";
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    92
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
    93
by (rtac (major RS rtrancl_induct) 2);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
    94
by (blast_tac (claset() addIs prems) 2);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
    95
by (blast_tac (claset() addIs prems) 2);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
qed "rtranclE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
    99
bind_thm ("rtrancl_into_rtrancl2", r_into_rtrancl RS rtrancl_trans);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   100
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   101
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   102
(*** More r^* equations and inclusions ***)
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   103
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   104
Goal "(r^*)^* = r^*";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   105
by (rtac set_ext 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   106
by (res_inst_tac [("p","x")] PairE 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   107
by (hyp_subst_tac 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   108
by (rtac iffI 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1496
diff changeset
   109
by (etac rtrancl_induct 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   110
by (rtac rtrancl_refl 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   111
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   112
by (etac r_into_rtrancl 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   113
qed "rtrancl_idemp";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   114
Addsimps [rtrancl_idemp];
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   115
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   116
Goal "R^* O R^* = R^*";
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5098
diff changeset
   117
by (rtac set_ext 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5098
diff changeset
   118
by (split_all_tac 1);
24f992a25adc isatool expandshort;
wenzelm
parents: 5098
diff changeset
   119
by (blast_tac (claset() addIs [rtrancl_trans]) 1);
4830
bd73675adbed Added a few lemmas.
nipkow
parents: 4799
diff changeset
   120
qed "rtrancl_idemp_self_comp";
bd73675adbed Added a few lemmas.
nipkow
parents: 4799
diff changeset
   121
Addsimps [rtrancl_idemp_self_comp];
bd73675adbed Added a few lemmas.
nipkow
parents: 4799
diff changeset
   122
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   123
Goal "r <= s^* ==> r^* <= s^*";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   124
by (dtac rtrancl_mono 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   125
by (Asm_full_simp_tac 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   126
qed "rtrancl_subset_rtrancl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   127
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   128
Goal "[| R <= S; S <= R^* |] ==> S^* = R^*";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   129
by (dtac rtrancl_mono 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   130
by (dtac rtrancl_mono 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   131
by (Asm_full_simp_tac 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   132
by (Blast_tac 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   133
qed "rtrancl_subset";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   134
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   135
Goal "(R^* Un S^*)^* = (R Un S)^*";
5479
5a5dfb0f0d7d fixed PROOF FAILED
paulson
parents: 5451
diff changeset
   136
by (blast_tac (claset() addSIs [rtrancl_subset]
5a5dfb0f0d7d fixed PROOF FAILED
paulson
parents: 5451
diff changeset
   137
                        addIs [r_into_rtrancl, rtrancl_mono RS subsetD]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   138
qed "rtrancl_Un_rtrancl";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents: 1465
diff changeset
   139
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   140
Goal "(R^=)^* = R^*";
5281
f4d16517b360 List now contains some lexicographic orderings.
nipkow
parents: 5255
diff changeset
   141
by (blast_tac (claset() addSIs [rtrancl_subset] addIs [r_into_rtrancl]) 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   142
qed "rtrancl_reflcl";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   143
Addsimps [rtrancl_reflcl];
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   144
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   145
Goal "(x,y) : (r^-1)^* ==> (x,y) : (r^*)^-1";
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   146
by (rtac converseI 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   147
by (etac rtrancl_induct 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   148
by (rtac rtrancl_refl 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   149
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   150
qed "rtrancl_converseD";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   151
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   152
Goal "(x,y) : (r^*)^-1 ==> (x,y) : (r^-1)^*";
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   153
by (dtac converseD 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   154
by (etac rtrancl_induct 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   155
by (rtac rtrancl_refl 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   156
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_trans]) 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   157
qed "rtrancl_converseI";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   158
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   159
Goal "(r^-1)^* = (r^*)^-1";
4838
196100237656 cleanup for split_all_tac as wrapper in claset()
oheimb
parents: 4830
diff changeset
   160
by (safe_tac (claset() addSDs [rtrancl_converseD] addSIs [rtrancl_converseI]));
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   161
qed "rtrancl_converse";
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   162
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   163
val major::prems = Goal
1706
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   164
    "[| (a,b) : r^*; P(b); \
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   165
\       !!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
   166
\     ==> P(a)";
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   167
by (rtac ((major RS converseI RS rtrancl_converseI) RS rtrancl_induct) 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1985
diff changeset
   168
by (resolve_tac prems 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   169
by (blast_tac (claset() addIs prems addSDs[rtrancl_converseD])1);
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   170
qed "converse_rtrancl_induct";
1706
4e0d5c7f57fa Added backwards rtrancl_induct and special versions for pairs.
nipkow
parents: 1642
diff changeset
   171
5347
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   172
bind_thm ("converse_rtrancl_induct2", split_rule
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   173
  (read_instantiate [("a","(ax,ay)"),("b","(bx,by)")]converse_rtrancl_induct));
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents: 1465
diff changeset
   174
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   175
val major::prems = Goal
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   176
 "[| (x,z):r^*; \
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   177
\    x=z ==> P; \
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   178
\    !!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
   179
\ |] ==> P";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   180
by (subgoal_tac "x = z  | (? y. (x,y) : r & (y,z) : r^*)" 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   181
by (rtac (major RS converse_rtrancl_induct) 2);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   182
by (blast_tac (claset() addIs prems) 2);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   183
by (blast_tac (claset() addIs prems) 2);
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   184
by (REPEAT (eresolve_tac ([asm_rl,exE,disjE,conjE]@prems) 1));
5347
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   185
qed "converse_rtranclE";
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   186
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   187
bind_thm ("converse_rtranclE2", split_rule
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   188
  (read_instantiate [("x","(xa,xb)"), ("z","(za,zb)")] converse_rtranclE));
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   189
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   190
Goal "r O r^* = r^* O r";
5347
d014d7e57337 Added converse_rtranclE(2)
nipkow
parents: 5316
diff changeset
   191
by (blast_tac (claset() addEs [rtranclE, converse_rtranclE] 
3723
034f0f5ca43f Tidied proof of r_comp_rtrancl_eq
paulson
parents: 3457
diff changeset
   192
	               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
   193
qed "r_comp_rtrancl_eq";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   194
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   195
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   196
(**** The relation trancl ****)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   197
5771
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   198
section "^+";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   199
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5132
diff changeset
   200
Goalw [trancl_def] "[| p:r^+; r <= s |] ==> p:s^+";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   201
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
   202
qed "trancl_mono";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   203
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
(** Conversions between trancl and rtrancl **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   205
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   206
Goalw [trancl_def]
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   207
    "!!p. p : r^+ ==> p : r^*";
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   208
by (split_all_tac 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   209
by (etac compEpair 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   210
by (REPEAT (ares_tac [rtrancl_into_rtrancl] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
qed "trancl_into_rtrancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   212
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   213
(*r^+ contains r*)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   214
Goalw [trancl_def]
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   215
   "!!p. p : r ==> p : r^+";
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   216
by (split_all_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   217
by (REPEAT (ares_tac [prem,compI,rtrancl_refl] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   218
qed "r_into_trancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   219
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   220
(*intro rule by definition: from rtrancl and r*)
5255
paulson
parents: 5148
diff changeset
   221
Goalw [trancl_def] "[| (a,b) : r^*;  (b,c) : r |]   ==>  (a,c) : r^+";
paulson
parents: 5148
diff changeset
   222
by Auto_tac;
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   223
qed "rtrancl_into_trancl1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   224
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   225
(*intro rule from r and rtrancl*)
5255
paulson
parents: 5148
diff changeset
   226
Goal "[| (a,b) : r;  (b,c) : r^* |]   ==>  (a,c) : r^+";
paulson
parents: 5148
diff changeset
   227
by (etac rtranclE 1);
paulson
parents: 5148
diff changeset
   228
by (blast_tac (claset() addIs [r_into_trancl]) 1);
1122
20b708827030 renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents: 1121
diff changeset
   229
by (rtac (rtrancl_trans RS rtrancl_into_trancl1) 1);
5255
paulson
parents: 5148
diff changeset
   230
by (REPEAT (ares_tac [r_into_rtrancl] 1));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   231
qed "rtrancl_into_trancl2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   233
(*Nice induction rule for trancl*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   234
val major::prems = Goal
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   235
  "[| (a,b) : r^+;                                      \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   236
\     !!y.  [| (a,y) : r |] ==> P(y);                   \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   237
\     !!y z.[| (a,y) : r^+;  (y,z) : r;  P(y) |] ==> P(z)       \
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   238
\  |] ==> P(b)";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   239
by (rtac (rewrite_rule [trancl_def] major  RS  compEpair) 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   240
(*by induction on this formula*)
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   241
by (subgoal_tac "ALL z. (y,z) : r --> P(z)" 1);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   242
(*now solve first subgoal: this formula is sufficient*)
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   243
by (Blast_tac 1);
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   244
by (etac rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   245
by (ALLGOALS (blast_tac (claset() addIs (rtrancl_into_trancl1::prems))));
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   246
qed "trancl_induct";
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   247
6856
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   248
(*Another induction rule for trancl, incorporating transitivity.*)
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   249
val major::prems = goal thy
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   250
 "[| (x,y) : r^+; \
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   251
\    !!x y. (x,y) : r ==> P x y; \
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   252
\    !!x y z. [| (x,y) : r^+; P x y; (y,z) : r^+; P y z |] ==> P x z \
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   253
\ |] ==> P x y";
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   254
by(blast_tac (claset() addIs ([r_into_trancl,major RS trancl_induct]@prems))1);
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   255
qed "trancl_trans_induct";
0364007b4bb3 New thm trancl_trans_induct
nipkow
parents: 6162
diff changeset
   256
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   257
(*elimination of r^+ -- NOT an induction rule*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5281
diff changeset
   258
val major::prems = Goal
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   259
    "[| (a::'a,b) : r^+;  \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   260
\       (a,b) : r ==> P; \
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1301
diff changeset
   261
\       !!y.[| (a,y) : r^+;  (y,b) : r |] ==> P  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   262
\    |] ==> P";
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   263
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
   264
by (REPEAT (eresolve_tac ([asm_rl,disjE,exE,conjE]@prems) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   265
by (rtac (rewrite_rule [trancl_def] major RS compEpair) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   266
by (etac rtranclE 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2031
diff changeset
   267
by (Blast_tac 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   268
by (blast_tac (claset() addSIs [rtrancl_into_trancl1]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   269
qed "tranclE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   270
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   271
(*Transitivity of r^+.
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
  Proved by unfolding since it uses transitivity of rtrancl. *)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   273
Goalw [trancl_def] "trans(r^+)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
by (rtac transI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   275
by (REPEAT (etac compEpair 1));
1122
20b708827030 renamed trans_rtrancl to rtrancl_trans and modified it by expanding trans.
nipkow
parents: 1121
diff changeset
   276
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
   277
by (REPEAT (assume_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   278
qed "trans_trancl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   279
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   280
bind_thm ("trancl_trans", trans_trancl RS transD);
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   281
5255
paulson
parents: 5148
diff changeset
   282
Goalw [trancl_def] "[| (x,y):r^*; (y,z):r^+ |] ==> (x,z):r^+";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   283
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
   284
qed "rtrancl_trancl_trancl";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   285
5255
paulson
parents: 5148
diff changeset
   286
(* "[| (a,b) : r;  (b,c) : r^+ |]   ==>  (a,c) : r^+" *)
paulson
parents: 5148
diff changeset
   287
bind_thm ("trancl_into_trancl2", [trans_trancl, r_into_trancl] MRS transD);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   289
(* primitive recursion for trancl over finite relations: *)
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   290
Goal "(insert (y,x) r)^+ = r^+ Un {(a,b). (a,y):r^* & (x,b):r^*}";
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   291
by (rtac equalityI 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   292
 by (rtac subsetI 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   293
 by (split_all_tac 1);
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   294
 by (etac trancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   295
  by (blast_tac (claset() addIs [r_into_trancl]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   296
 by (blast_tac (claset() addIs
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   297
     [rtrancl_into_trancl1,trancl_into_rtrancl,r_into_trancl,trancl_trans]) 1);
3457
a8ab7c64817c Ran expandshort
paulson
parents: 3439
diff changeset
   298
by (rtac subsetI 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   299
by (blast_tac (claset() addIs
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   300
     [rtrancl_into_trancl2, rtrancl_trancl_trancl,
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   301
      impOfSubs rtrancl_mono, trancl_mono]) 1);
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   302
qed "trancl_insert";
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   303
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   304
Goalw [trancl_def] "(r^-1)^+ = (r^+)^-1";
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   305
by (simp_tac (simpset() addsimps [rtrancl_converse,converse_comp]) 1);
5451
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   306
by (simp_tac (simpset() addsimps [rtrancl_converse RS sym,
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   307
				  r_comp_rtrancl_eq]) 1);
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4153
diff changeset
   308
qed "trancl_converse";
3413
c1f63cc3a768 Finite.ML Finite.thy: Replaced `finite subset of' by mere `finite'.
nipkow
parents: 2935
diff changeset
   309
5771
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   310
Goal "(x,y) : (r^+)^-1 ==> (x,y) : (r^-1)^+";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   311
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   312
qed "trancl_converseI";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   313
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   314
Goal "(x,y) : (r^-1)^+ ==> (x,y) : (r^+)^-1";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   315
by (asm_full_simp_tac (simpset() addsimps [trancl_converse]) 1);
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   316
qed "trancl_converseD";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   317
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   318
val major::prems = Goal
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   319
    "[| (a,b) : r^+; !!y. (y,b) : r ==> P(y); \
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   320
\       !!y z.[| (y,z) : r;  (z,b) : r^+;  P(z) |] ==> P(y) |]  \
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   321
\     ==> P(a)";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   322
by (rtac ((major RS converseI RS trancl_converseI) RS trancl_induct) 1);
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   323
 by (resolve_tac prems 1);
6162
484adda70b65 expandshort
paulson
parents: 5771
diff changeset
   324
 by (etac converseD 1);
5771
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   325
by (blast_tac (claset() addIs prems addSDs [trancl_converseD])1);
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   326
qed "converse_trancl_induct";
7c2c8cf20221 added nat_diff_split and a few lemmas in Trancl.
nipkow
parents: 5608
diff changeset
   327
5451
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   328
(*Unused*)
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   329
qed_goal "irrefl_tranclI" Trancl.thy 
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   330
   "!!r. r^-1 Int r^+ = {} ==> (x, x) ~: r^+" 
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   331
 (K [subgoal_tac "!y. (x, y) : r^+ --> x~=y" 1,
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   332
     Fast_tac 1,
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   333
     strip_tac 1,
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   334
     etac trancl_induct 1,
08ca6e067ee6 tided the unused rule irrefl_tranclI
paulson
parents: 5347
diff changeset
   335
     auto_tac (claset() addIs [r_into_trancl], simpset())]);
1130
0df0df1685a8 Added trancl_cs
nipkow
parents: 1128
diff changeset
   336
5255
paulson
parents: 5148
diff changeset
   337
Goal "[| (a,b) : r^*;  r <= A Times A |] ==> a=b | a:A";
paulson
parents: 5148
diff changeset
   338
by (etac rtrancl_induct 1);
paulson
parents: 5148
diff changeset
   339
by Auto_tac;
1642
21db0cf9a1a4 Using new "Times" infix
paulson
parents: 1552
diff changeset
   340
val lemma = result();
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   341
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   342
Goalw [trancl_def] "r <= A Times A ==> r^+ <= A Times A";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3723
diff changeset
   343
by (blast_tac (claset() addSDs [lemma]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   344
qed "trancl_subset_Sigma";
1130
0df0df1685a8 Added trancl_cs
nipkow
parents: 1128
diff changeset
   345
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   346
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   347
Goal "(r^+)^= = r^*";
4838
196100237656 cleanup for split_all_tac as wrapper in claset()
oheimb
parents: 4830
diff changeset
   348
by Safe_tac;
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   349
by  (etac trancl_into_rtrancl 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   350
by (etac rtranclE 1);
4772
8c7e7eaffbdf split_all_tac now fails if there is nothing to split
oheimb
parents: 4764
diff changeset
   351
by  (Auto_tac );
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   352
by (etac rtrancl_into_trancl1 1);
5132
24f992a25adc isatool expandshort;
wenzelm
parents: 5098
diff changeset
   353
by (assume_tac 1);
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   354
qed "reflcl_trancl";
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   355
Addsimps[reflcl_trancl];
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   356
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4838
diff changeset
   357
Goal "(r^=)^+ = r^*";
4838
196100237656 cleanup for split_all_tac as wrapper in claset()
oheimb
parents: 4830
diff changeset
   358
by Safe_tac;
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   359
by  (dtac trancl_into_rtrancl 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   360
by  (Asm_full_simp_tac 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   361
by (etac rtranclE 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   362
by  Safe_tac;
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   363
by  (rtac r_into_trancl 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   364
by  (Simp_tac 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   365
by (rtac rtrancl_into_trancl1 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   366
by (etac (rtrancl_reflcl RS equalityD2 RS subsetD) 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   367
by (Fast_tac 1);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   368
qed "trancl_reflcl";
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   369
Addsimps[trancl_reflcl];
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   370
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   371
qed_goal "trancl_empty" Trancl.thy "{}^+ = {}" 
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   372
  (K [auto_tac (claset() addEs [trancl_induct], simpset())]);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   373
Addsimps[trancl_empty];
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   374
5608
a82a038a3e7a id <-> Id
nipkow
parents: 5479
diff changeset
   375
qed_goal "rtrancl_empty" Trancl.thy "{}^* = Id" 
4764
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   376
  (K [rtac (reflcl_trancl RS subst) 1, Simp_tac 1]);
9b3293646b5d generalized appearance of trancl_into_rtrancl and r_into_trancl
oheimb
parents: 4746
diff changeset
   377
Addsimps[rtrancl_empty];