src/HOL/RelPow.ML
author oheimb
Tue, 04 Nov 1997 20:48:38 +0100
changeset 4133 0a08c2b9b1ed
parent 4089 96fba19bcbe2
child 4759 33a03e70e641
permissions -rw-r--r--
added the, option_map, and case analysis theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/RelPow.ML
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     4
    Copyright   1996  TU Muenchen
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     5
*)
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     6
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     7
open RelPow;
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
     8
3371
80f0d0b2f404 Overloading of "^" requires a type constraint
paulson
parents: 3023
diff changeset
     9
goal RelPow.thy "!!R:: ('a*'a)set. R^1 = R";
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    10
by (Simp_tac 1);
1693
7083f6b05423 Added R^1 = R
nipkow
parents: 1552
diff changeset
    11
qed "rel_pow_1";
7083f6b05423 Added R^1 = R
nipkow
parents: 1552
diff changeset
    12
Addsimps [rel_pow_1];
7083f6b05423 Added R^1 = R
nipkow
parents: 1552
diff changeset
    13
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    14
goal RelPow.thy "(x,x) : R^0";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    15
by (Simp_tac 1);
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    16
qed "rel_pow_0_I";
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    17
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    18
goal RelPow.thy "!!R. [| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)";
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    19
by (Simp_tac  1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2741
diff changeset
    20
by (Blast_tac 1);
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    21
qed "rel_pow_Suc_I";
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    22
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    23
goal RelPow.thy "!z. (x,y) : R --> (y,z):R^n -->  (x,z):R^(Suc n)";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    24
by (nat_ind_tac "n" 1);
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    25
by (Simp_tac  1);
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    26
by (Asm_full_simp_tac 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2741
diff changeset
    27
by (Blast_tac 1);
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    28
qed_spec_mp "rel_pow_Suc_I2";
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    29
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    30
goal RelPow.thy "!!R. [| (x,y) : R^0; x=y ==> P |] ==> P";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    31
by (Asm_full_simp_tac 1);
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    32
qed "rel_pow_0_E";
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    33
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    34
val [major,minor] = goal RelPow.thy
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    35
  "[| (x,z) : R^(Suc n);  !!y. [| (x,y) : R^n; (y,z) : R |] ==> P |] ==> P";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    36
by (cut_facts_tac [major] 1);
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    37
by (Asm_full_simp_tac  1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    38
by (blast_tac (claset() addIs [minor]) 1);
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    39
qed "rel_pow_Suc_E";
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    40
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    41
val [p1,p2,p3] = goal RelPow.thy
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    42
    "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    43
\       !!y m. [| n = Suc m; (x,y) : R^m; (y,z) : R |] ==> P  \
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    44
\    |] ==> P";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    45
by (res_inst_tac [("n","n")] natE 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    46
by (cut_facts_tac [p1] 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    47
by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    48
by (cut_facts_tac [p1] 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    49
by (Asm_full_simp_tac 1);
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    50
by (etac compEpair 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    51
by (REPEAT(ares_tac [p3] 1));
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    52
qed "rel_pow_E";
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    53
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    54
goal RelPow.thy "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    55
by (nat_ind_tac "n" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    56
by (blast_tac (claset() addIs [rel_pow_0_I] addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    57
by (blast_tac (claset() addIs [rel_pow_Suc_I] addEs[rel_pow_0_E,rel_pow_Suc_E]) 1);
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    58
qed_spec_mp "rel_pow_Suc_D2";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    59
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    60
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    61
goal RelPow.thy
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    62
"!x y z. (x,y) : R^n & (y,z) : R --> (? w. (x,w) : R & (w,z) : R^n)";
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    63
by (nat_ind_tac "n" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    64
by (fast_tac (claset() addss (simpset())) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    65
by (fast_tac (claset() addss (simpset())) 1);
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    66
qed_spec_mp "rel_pow_Suc_D2'";
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    67
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    68
val [p1,p2,p3] = goal RelPow.thy
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    69
    "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    70
\       !!y m. [| n = Suc m; (x,y) : R; (y,z) : R^m |] ==> P  \
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    71
\    |] ==> P";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    72
by (res_inst_tac [("n","n")] natE 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    73
by (cut_facts_tac [p1] 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    74
by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    75
by (cut_facts_tac [p1] 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    76
by (Asm_full_simp_tac 1);
3023
01364e2f30ad Ran expandshort
paulson
parents: 2935
diff changeset
    77
by (etac compEpair 1);
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
    78
by (dtac (conjI RS rel_pow_Suc_D2') 1);
3023
01364e2f30ad Ran expandshort
paulson
parents: 2935
diff changeset
    79
by (assume_tac 1);
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    80
by (etac exE 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    81
by (etac p3 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    82
by (etac conjunct1 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    83
by (etac conjunct2 1);
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
    84
qed "rel_pow_E2";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    85
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    86
goal RelPow.thy "!!p. p:R^* ==> p : (UN n. R^n)";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    87
by (split_all_tac 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    88
by (etac rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    89
by (ALLGOALS (blast_tac (claset() addIs [rel_pow_0_I,rel_pow_Suc_I])));
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    90
qed "rtrancl_imp_UN_rel_pow";
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    91
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    92
goal RelPow.thy "!y. (x,y):R^n --> (x,y):R^*";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
    93
by (nat_ind_tac "n" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    94
by (blast_tac (claset() addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
    95
by (blast_tac (claset() addEs [rel_pow_Suc_E]
3023
01364e2f30ad Ran expandshort
paulson
parents: 2935
diff changeset
    96
                       addIs [rtrancl_into_rtrancl]) 1);
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    97
val lemma = result() RS spec RS mp;
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    98
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
    99
goal RelPow.thy "!!p. p:R^n ==> p:R^*";
1552
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
   100
by (split_all_tac 1);
6f71b5d46700 Ran expandshort
paulson
parents: 1515
diff changeset
   101
by (etac lemma 1);
1515
4ed79ebab64d Introduced normalize_thm into HOL.ML
nipkow
parents: 1496
diff changeset
   102
qed "rel_pow_imp_rtrancl";
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
   103
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
   104
goal RelPow.thy "R^* = (UN n. R^n)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 4059
diff changeset
   105
by (blast_tac (claset() addIs [rtrancl_imp_UN_rel_pow, rel_pow_imp_rtrancl]) 1);
1496
c443b2adaf52 Added a few thms and the new theory RelPow.
nipkow
parents:
diff changeset
   106
qed "rtrancl_is_UN_rel_pow";
2741
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
   107
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
   108
2b7f72cbe51f Minor changes due to primrec definition for ^
pusch
parents: 2056
diff changeset
   109