src/HOL/RelPow.ML
author wenzelm
Thu Mar 11 13:20:35 1999 +0100 (1999-03-11)
changeset 6349 f7750d816c21
parent 5316 7a8975451a89
child 8268 722074b93cdd
permissions -rw-r--r--
removed foo_build_completed -- now handled by session management (via usedir);
     1 (*  Title:      HOL/RelPow.ML
     2     ID:         $Id$
     3     Author:     Tobias Nipkow
     4     Copyright   1996  TU Muenchen
     5 *)
     6 
     7 open RelPow;
     8 
     9 Goal "!!R:: ('a*'a)set. R^1 = R";
    10 by (Simp_tac 1);
    11 qed "rel_pow_1";
    12 Addsimps [rel_pow_1];
    13 
    14 Goal "(x,x) : R^0";
    15 by (Simp_tac 1);
    16 qed "rel_pow_0_I";
    17 
    18 Goal "[| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)";
    19 by (Simp_tac  1);
    20 by (Blast_tac 1);
    21 qed "rel_pow_Suc_I";
    22 
    23 Goal "!z. (x,y) : R --> (y,z):R^n -->  (x,z):R^(Suc n)";
    24 by (nat_ind_tac "n" 1);
    25 by (Simp_tac  1);
    26 by (Asm_full_simp_tac 1);
    27 by (Blast_tac 1);
    28 qed_spec_mp "rel_pow_Suc_I2";
    29 
    30 Goal "!!R. [| (x,y) : R^0; x=y ==> P |] ==> P";
    31 by (Asm_full_simp_tac 1);
    32 qed "rel_pow_0_E";
    33 
    34 val [major,minor] = Goal
    35   "[| (x,z) : R^(Suc n);  !!y. [| (x,y) : R^n; (y,z) : R |] ==> P |] ==> P";
    36 by (cut_facts_tac [major] 1);
    37 by (Asm_full_simp_tac  1);
    38 by (blast_tac (claset() addIs [minor]) 1);
    39 qed "rel_pow_Suc_E";
    40 
    41 val [p1,p2,p3] = Goal
    42     "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
    43 \       !!y m. [| n = Suc m; (x,y) : R^m; (y,z) : R |] ==> P  \
    44 \    |] ==> P";
    45 by (cut_facts_tac [p1] 1);
    46 by (exhaust_tac "n" 1);
    47 by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
    48 by (Asm_full_simp_tac 1);
    49 by (etac compEpair 1);
    50 by (REPEAT(ares_tac [p3] 1));
    51 qed "rel_pow_E";
    52 
    53 Goal "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)";
    54 by (nat_ind_tac "n" 1);
    55 by (blast_tac (claset() addIs [rel_pow_0_I] 
    56 	                addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
    57 by (blast_tac (claset() addIs [rel_pow_Suc_I]  
    58 	                addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
    59 qed_spec_mp "rel_pow_Suc_D2";
    60 
    61 
    62 Goal "!x y z. (x,y) : R^n & (y,z) : R --> (? w. (x,w) : R & (w,z) : R^n)";
    63 by (nat_ind_tac "n" 1);
    64 by (ALLGOALS Asm_simp_tac);
    65 by (Blast_tac 1);
    66 qed_spec_mp "rel_pow_Suc_D2'";
    67 
    68 val [p1,p2,p3] = Goal
    69     "[| (x,z) : R^n;  [| n=0; x = z |] ==> P;        \
    70 \       !!y m. [| n = Suc m; (x,y) : R; (y,z) : R^m |] ==> P  \
    71 \    |] ==> P";
    72 by (cut_facts_tac [p1] 1);
    73 by (exhaust_tac "n" 1);
    74 by (asm_full_simp_tac (simpset() addsimps [p2]) 1);
    75 by (Asm_full_simp_tac 1);
    76 by (etac compEpair 1);
    77 by (dtac (conjI RS rel_pow_Suc_D2') 1);
    78 by (assume_tac 1);
    79 by (etac exE 1);
    80 by (etac p3 1);
    81 by (etac conjunct1 1);
    82 by (etac conjunct2 1);
    83 qed "rel_pow_E2";
    84 
    85 Goal "!!p. p:R^* ==> p : (UN n. R^n)";
    86 by (split_all_tac 1);
    87 by (etac rtrancl_induct 1);
    88 by (ALLGOALS (blast_tac (claset() addIs [rel_pow_0_I,rel_pow_Suc_I])));
    89 qed "rtrancl_imp_UN_rel_pow";
    90 
    91 Goal "!y. (x,y):R^n --> (x,y):R^*";
    92 by (nat_ind_tac "n" 1);
    93 by (blast_tac (claset() addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1);
    94 by (blast_tac (claset() addEs [rel_pow_Suc_E]
    95                        addIs [rtrancl_into_rtrancl]) 1);
    96 val lemma = result() RS spec RS mp;
    97 
    98 Goal "!!p. p:R^n ==> p:R^*";
    99 by (split_all_tac 1);
   100 by (etac lemma 1);
   101 qed "rel_pow_imp_rtrancl";
   102 
   103 Goal "R^* = (UN n. R^n)";
   104 by (blast_tac (claset() addIs [rtrancl_imp_UN_rel_pow, rel_pow_imp_rtrancl]) 1);
   105 qed "rtrancl_is_UN_rel_pow";
   106 
   107 
   108 Goal "!!r::('a * 'a)set. Univalent r ==> Univalent (r^n)";
   109 by (rtac UnivalentI 1);
   110 by (induct_tac "n" 1);
   111  by (Simp_tac 1);
   112 by (fast_tac (claset() addDs [UnivalentD] addEs [rel_pow_Suc_E]) 1);
   113 qed_spec_mp "Univalent_rel_pow";
   114 
   115 
   116 
   117