src/HOL/RelPow.ML
author nipkow
Tue Apr 08 10:48:42 1997 +0200 (1997-04-08)
changeset 2919 953a47dc0519
parent 2741 2b7f72cbe51f
child 2922 580647a879cf
permissions -rw-r--r--
Dep. on Provers/nat_transitive
nipkow@1496
     1
(*  Title:      HOL/RelPow.ML
nipkow@1496
     2
    ID:         $Id$
nipkow@1496
     3
    Author:     Tobias Nipkow
nipkow@1496
     4
    Copyright   1996  TU Muenchen
nipkow@1496
     5
*)
nipkow@1496
     6
nipkow@1496
     7
open RelPow;
nipkow@1496
     8
nipkow@1693
     9
goal RelPow.thy "R^1 = R";
pusch@2741
    10
by (Simp_tac 1);
nipkow@1693
    11
qed "rel_pow_1";
nipkow@1693
    12
Addsimps [rel_pow_1];
nipkow@1693
    13
nipkow@1496
    14
goal RelPow.thy "(x,x) : R^0";
paulson@1552
    15
by (Simp_tac 1);
nipkow@1496
    16
qed "rel_pow_0_I";
nipkow@1496
    17
nipkow@1496
    18
goal RelPow.thy "!!R. [| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)";
pusch@2741
    19
by (Simp_tac  1);
berghofe@1760
    20
by (Fast_tac 1);
nipkow@1496
    21
qed "rel_pow_Suc_I";
nipkow@1496
    22
nipkow@1496
    23
goal RelPow.thy "!z. (x,y) : R --> (y,z):R^n -->  (x,z):R^(Suc n)";
paulson@1552
    24
by (nat_ind_tac "n" 1);
pusch@2741
    25
by (Simp_tac  1);
pusch@2741
    26
by (Asm_full_simp_tac 1);
berghofe@1760
    27
by (Fast_tac 1);
nipkow@1496
    28
qed_spec_mp "rel_pow_Suc_I2";
nipkow@1496
    29
nipkow@1515
    30
goal RelPow.thy "!!R. [| (x,y) : R^0; x=y ==> P |] ==> P";
paulson@1552
    31
by (Asm_full_simp_tac 1);
nipkow@1515
    32
qed "rel_pow_0_E";
nipkow@1515
    33
nipkow@1515
    34
val [major,minor] = goal RelPow.thy
nipkow@1515
    35
  "[| (x,z) : R^(Suc n);  !!y. [| (x,y) : R^n; (y,z) : R |] ==> P |] ==> P";
paulson@1552
    36
by (cut_facts_tac [major] 1);
pusch@2741
    37
by (Asm_full_simp_tac  1);
berghofe@1760
    38
by (fast_tac (!claset addIs [minor]) 1);
nipkow@1515
    39
qed "rel_pow_Suc_E";
nipkow@1515
    40
nipkow@1515
    41
val [p1,p2,p3] = goal RelPow.thy
nipkow@1515
    42
    "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
nipkow@1515
    43
\       !!y m. [| n = Suc m; (x,y) : R^m; (y,z) : R |] ==> P  \
nipkow@1515
    44
\    |] ==> P";
paulson@1552
    45
by (res_inst_tac [("n","n")] natE 1);
paulson@1552
    46
by (cut_facts_tac [p1] 1);
paulson@1552
    47
by (asm_full_simp_tac (!simpset addsimps [p2]) 1);
paulson@1552
    48
by (cut_facts_tac [p1] 1);
paulson@1552
    49
by (Asm_full_simp_tac 1);
pusch@2741
    50
by (etac compEpair 1);
paulson@1552
    51
by (REPEAT(ares_tac [p3] 1));
nipkow@1515
    52
qed "rel_pow_E";
nipkow@1515
    53
nipkow@1496
    54
goal RelPow.thy "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)";
paulson@1552
    55
by (nat_ind_tac "n" 1);
berghofe@1760
    56
by (fast_tac (!claset addIs [rel_pow_0_I] addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
berghofe@1760
    57
by (fast_tac (!claset addIs [rel_pow_Suc_I] addEs[rel_pow_0_E,rel_pow_Suc_E]) 1);
nipkow@1515
    58
qed_spec_mp "rel_pow_Suc_D2";
nipkow@1496
    59
pusch@2741
    60
pusch@2741
    61
goal RelPow.thy
pusch@2741
    62
"!x y z. (x,y) : R^n & (y,z) : R --> (? w. (x,w) : R & (w,z) : R^n)";
pusch@2741
    63
by (nat_ind_tac "n" 1);
pusch@2741
    64
by (fast_tac (!claset addss (!simpset)) 1);
pusch@2741
    65
by (fast_tac (!claset addss (!simpset)) 1);
pusch@2741
    66
qed_spec_mp "rel_pow_Suc_D2'";
pusch@2741
    67
nipkow@1496
    68
val [p1,p2,p3] = goal RelPow.thy
nipkow@1496
    69
    "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
nipkow@1496
    70
\       !!y m. [| n = Suc m; (x,y) : R; (y,z) : R^m |] ==> P  \
nipkow@1496
    71
\    |] ==> P";
paulson@1552
    72
by (res_inst_tac [("n","n")] natE 1);
paulson@1552
    73
by (cut_facts_tac [p1] 1);
paulson@1552
    74
by (asm_full_simp_tac (!simpset addsimps [p2]) 1);
paulson@1552
    75
by (cut_facts_tac [p1] 1);
paulson@1552
    76
by (Asm_full_simp_tac 1);
pusch@2741
    77
be compEpair 1;
pusch@2741
    78
by (dtac (conjI RS rel_pow_Suc_D2') 1);
pusch@2741
    79
ba 1;
paulson@1552
    80
by (etac exE 1);
paulson@1552
    81
by (etac p3 1);
paulson@1552
    82
by (etac conjunct1 1);
paulson@1552
    83
by (etac conjunct2 1);
nipkow@1515
    84
qed "rel_pow_E2";
nipkow@1496
    85
nipkow@1496
    86
goal RelPow.thy "!!p. p:R^* ==> p : (UN n. R^n)";
paulson@1552
    87
by (split_all_tac 1);
paulson@1552
    88
by (etac rtrancl_induct 1);
berghofe@1760
    89
by (ALLGOALS (fast_tac (!claset addIs [rel_pow_0_I,rel_pow_Suc_I])));
nipkow@1496
    90
qed "rtrancl_imp_UN_rel_pow";
nipkow@1496
    91
nipkow@1496
    92
goal RelPow.thy "!y. (x,y):R^n --> (x,y):R^*";
paulson@1552
    93
by (nat_ind_tac "n" 1);
berghofe@1760
    94
by (fast_tac (!claset addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1);
berghofe@1760
    95
by (fast_tac (!claset addEs [rel_pow_Suc_E,rtrancl_into_rtrancl]) 1);
nipkow@1496
    96
val lemma = result() RS spec RS mp;
nipkow@1496
    97
nipkow@1496
    98
goal RelPow.thy "!!p. p:R^n ==> p:R^*";
paulson@1552
    99
by (split_all_tac 1);
paulson@1552
   100
by (etac lemma 1);
nipkow@1515
   101
qed "rel_pow_imp_rtrancl";
nipkow@1496
   102
nipkow@1496
   103
goal RelPow.thy "R^* = (UN n. R^n)";
berghofe@1760
   104
by (fast_tac (!claset addIs [rtrancl_imp_UN_rel_pow,rel_pow_imp_rtrancl]) 1);
nipkow@1496
   105
qed "rtrancl_is_UN_rel_pow";
pusch@2741
   106
pusch@2741
   107
pusch@2741
   108