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
     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 RelPow.thy "R^1 = R";
    10 by (Simp_tac 1);
    11 qed "rel_pow_1";
    12 Addsimps [rel_pow_1];
    13 
    14 goal RelPow.thy "(x,x) : R^0";
    15 by (Simp_tac 1);
    16 qed "rel_pow_0_I";
    17 
    18 goal RelPow.thy "!!R. [| (x,y) : R^n; (y,z):R |] ==> (x,z):R^(Suc n)";
    19 by (Simp_tac  1);
    20 by (Fast_tac 1);
    21 qed "rel_pow_Suc_I";
    22 
    23 goal RelPow.thy "!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 (Fast_tac 1);
    28 qed_spec_mp "rel_pow_Suc_I2";
    29 
    30 goal RelPow.thy "!!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 RelPow.thy
    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 (fast_tac (!claset addIs [minor]) 1);
    39 qed "rel_pow_Suc_E";
    40 
    41 val [p1,p2,p3] = goal RelPow.thy
    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 (res_inst_tac [("n","n")] natE 1);
    46 by (cut_facts_tac [p1] 1);
    47 by (asm_full_simp_tac (!simpset addsimps [p2]) 1);
    48 by (cut_facts_tac [p1] 1);
    49 by (Asm_full_simp_tac 1);
    50 by (etac compEpair 1);
    51 by (REPEAT(ares_tac [p3] 1));
    52 qed "rel_pow_E";
    53 
    54 goal RelPow.thy "!x z. (x,z):R^(Suc n) --> (? y. (x,y):R & (y,z):R^n)";
    55 by (nat_ind_tac "n" 1);
    56 by (fast_tac (!claset addIs [rel_pow_0_I] addEs [rel_pow_0_E,rel_pow_Suc_E]) 1);
    57 by (fast_tac (!claset addIs [rel_pow_Suc_I] addEs[rel_pow_0_E,rel_pow_Suc_E]) 1);
    58 qed_spec_mp "rel_pow_Suc_D2";
    59 
    60 
    61 goal RelPow.thy
    62 "!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 (fast_tac (!claset addss (!simpset)) 1);
    65 by (fast_tac (!claset addss (!simpset)) 1);
    66 qed_spec_mp "rel_pow_Suc_D2'";
    67 
    68 val [p1,p2,p3] = goal RelPow.thy
    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 (res_inst_tac [("n","n")] natE 1);
    73 by (cut_facts_tac [p1] 1);
    74 by (asm_full_simp_tac (!simpset addsimps [p2]) 1);
    75 by (cut_facts_tac [p1] 1);
    76 by (Asm_full_simp_tac 1);
    77 be compEpair 1;
    78 by (dtac (conjI RS rel_pow_Suc_D2') 1);
    79 ba 1;
    80 by (etac exE 1);
    81 by (etac p3 1);
    82 by (etac conjunct1 1);
    83 by (etac conjunct2 1);
    84 qed "rel_pow_E2";
    85 
    86 goal RelPow.thy "!!p. p:R^* ==> p : (UN n. R^n)";
    87 by (split_all_tac 1);
    88 by (etac rtrancl_induct 1);
    89 by (ALLGOALS (fast_tac (!claset addIs [rel_pow_0_I,rel_pow_Suc_I])));
    90 qed "rtrancl_imp_UN_rel_pow";
    91 
    92 goal RelPow.thy "!y. (x,y):R^n --> (x,y):R^*";
    93 by (nat_ind_tac "n" 1);
    94 by (fast_tac (!claset addIs [rtrancl_refl] addEs [rel_pow_0_E]) 1);
    95 by (fast_tac (!claset addEs [rel_pow_Suc_E,rtrancl_into_rtrancl]) 1);
    96 val lemma = result() RS spec RS mp;
    97 
    98 goal RelPow.thy "!!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 RelPow.thy "R^* = (UN n. R^n)";
   104 by (fast_tac (!claset addIs [rtrancl_imp_UN_rel_pow,rel_pow_imp_rtrancl]) 1);
   105 qed "rtrancl_is_UN_rel_pow";
   106 
   107 
   108