src/HOL/RelPow.ML
author paulson
Thu Aug 06 15:48:13 1998 +0200 (1998-08-06)
changeset 5278 a903b66822e2
parent 5183 89f162de39cf
child 5316 7a8975451a89
permissions -rw-r--r--
even more tidying of Goal commands
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
wenzelm@5069
     9
Goal "!!R:: ('a*'a)set. 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
wenzelm@5069
    14
Goal "(x,x) : R^0";
paulson@1552
    15
by (Simp_tac 1);
nipkow@1496
    16
qed "rel_pow_0_I";
nipkow@1496
    17
paulson@5143
    18
Goal "[| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)";
pusch@2741
    19
by (Simp_tac  1);
paulson@2922
    20
by (Blast_tac 1);
nipkow@1496
    21
qed "rel_pow_Suc_I";
nipkow@1496
    22
wenzelm@5069
    23
Goal "!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);
paulson@2922
    27
by (Blast_tac 1);
nipkow@1496
    28
qed_spec_mp "rel_pow_Suc_I2";
nipkow@1496
    29
wenzelm@5069
    30
Goal "!!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);
wenzelm@4089
    38
by (blast_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 (cut_facts_tac [p1] 1);
berghofe@5183
    46
by (exhaust_tac "n" 1);
wenzelm@4089
    47
by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
paulson@1552
    48
by (Asm_full_simp_tac 1);
pusch@2741
    49
by (etac compEpair 1);
paulson@1552
    50
by (REPEAT(ares_tac [p3] 1));
nipkow@1515
    51
qed "rel_pow_E";
nipkow@1515
    52
wenzelm@5069
    53
Goal "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)";
paulson@1552
    54
by (nat_ind_tac "n" 1);
wenzelm@4089
    55
by (blast_tac (claset() addIs [rel_pow_0_I] addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
wenzelm@4089
    56
by (blast_tac (claset() addIs [rel_pow_Suc_I] addEs[rel_pow_0_E,rel_pow_Suc_E]) 1);
nipkow@1515
    57
qed_spec_mp "rel_pow_Suc_D2";
nipkow@1496
    58
pusch@2741
    59
paulson@5278
    60
Goal "!x y z. (x,y) : R^n & (y,z) : R --> (? w. (x,w) : R & (w,z) : R^n)";
pusch@2741
    61
by (nat_ind_tac "n" 1);
wenzelm@4089
    62
by (fast_tac (claset() addss (simpset())) 1);
wenzelm@4089
    63
by (fast_tac (claset() addss (simpset())) 1);
pusch@2741
    64
qed_spec_mp "rel_pow_Suc_D2'";
pusch@2741
    65
nipkow@1496
    66
val [p1,p2,p3] = goal RelPow.thy
nipkow@1496
    67
    "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
nipkow@1496
    68
\       !!y m. [| n = Suc m; (x,y) : R; (y,z) : R^m |] ==> P  \
nipkow@1496
    69
\    |] ==> P";
paulson@1552
    70
by (cut_facts_tac [p1] 1);
berghofe@5183
    71
by (exhaust_tac "n" 1);
wenzelm@4089
    72
by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
paulson@1552
    73
by (Asm_full_simp_tac 1);
paulson@3023
    74
by (etac compEpair 1);
pusch@2741
    75
by (dtac (conjI RS rel_pow_Suc_D2') 1);
paulson@3023
    76
by (assume_tac 1);
paulson@1552
    77
by (etac exE 1);
paulson@1552
    78
by (etac p3 1);
paulson@1552
    79
by (etac conjunct1 1);
paulson@1552
    80
by (etac conjunct2 1);
nipkow@1515
    81
qed "rel_pow_E2";
nipkow@1496
    82
wenzelm@5069
    83
Goal "!!p. p:R^* ==> p : (UN n. R^n)";
paulson@1552
    84
by (split_all_tac 1);
paulson@1552
    85
by (etac rtrancl_induct 1);
wenzelm@4089
    86
by (ALLGOALS (blast_tac (claset() addIs [rel_pow_0_I,rel_pow_Suc_I])));
nipkow@1496
    87
qed "rtrancl_imp_UN_rel_pow";
nipkow@1496
    88
wenzelm@5069
    89
Goal "!y. (x,y):R^n --> (x,y):R^*";
paulson@1552
    90
by (nat_ind_tac "n" 1);
wenzelm@4089
    91
by (blast_tac (claset() addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1);
wenzelm@4089
    92
by (blast_tac (claset() addEs [rel_pow_Suc_E]
paulson@3023
    93
                       addIs [rtrancl_into_rtrancl]) 1);
nipkow@1496
    94
val lemma = result() RS spec RS mp;
nipkow@1496
    95
wenzelm@5069
    96
Goal "!!p. p:R^n ==> p:R^*";
paulson@1552
    97
by (split_all_tac 1);
paulson@1552
    98
by (etac lemma 1);
nipkow@1515
    99
qed "rel_pow_imp_rtrancl";
nipkow@1496
   100
wenzelm@5069
   101
Goal "R^* = (UN n. R^n)";
wenzelm@4089
   102
by (blast_tac (claset() addIs [rtrancl_imp_UN_rel_pow, rel_pow_imp_rtrancl]) 1);
nipkow@1496
   103
qed "rtrancl_is_UN_rel_pow";
pusch@2741
   104
pusch@2741
   105
wenzelm@5069
   106
Goal "!!r::('a * 'a)set. Univalent r ==> Univalent (r^n)";
oheimb@4759
   107
by (rtac UnivalentI 1);
oheimb@4759
   108
by (induct_tac "n" 1);
oheimb@4759
   109
 by (Simp_tac 1);
oheimb@4759
   110
by (fast_tac (claset() addDs [UnivalentD] addEs [rel_pow_Suc_E]) 1);
oheimb@4759
   111
qed_spec_mp "Univalent_rel_pow";
pusch@2741
   112
oheimb@4759
   113
oheimb@4759
   114
oheimb@4759
   115