src/HOL/Lambda/Commutation.ML
author nipkow
Wed, 25 Oct 1995 09:49:35 +0100
changeset 1302 ddfdcc9ce667
parent 1278 7e6189fc833c
child 1431 be7c6d77e19c
permissions -rw-r--r--
Moved some thms to Arith and to Trancl.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Lambda/Commutation.thy
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     2
    ID:         $Id$
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     4
    Copyright   1995 TU Muenchen
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     5
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     6
Basic commutation lemmas.
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     7
*)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     8
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     9
open Commutation;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    10
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    11
(*** square ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    12
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    13
goalw Commutation.thy [square_def] "!!R. square R S T U ==> square S R U T";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    14
by(fast_tac HOL_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    15
qed "square_sym";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    16
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    17
goalw Commutation.thy [square_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    18
  "!!R. [| square R S T (R^=); S <= T |] ==> square (R^=) S T (R^=)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    19
by(fast_tac rel_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    20
qed "square_reflcl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    21
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    22
goalw Commutation.thy [square_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    23
  "!!R. square R S S T ==> square (R^*) S S (T^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    24
by(strip_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    25
be rtrancl_induct 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    26
by(fast_tac trancl_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    27
by(fast_tac (HOL_cs addSEs [rtrancl_into_rtrancl]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    28
qed "square_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    29
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    30
goalw Commutation.thy [commute_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    31
 "!!R. square R S (S^*) (R^=) ==> commute (R^*) (S^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    32
bd square_reflcl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    33
br subsetI 1;
1302
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
    34
be r_into_rtrancl 1;
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    35
bd square_sym 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    36
bd square_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    37
by(Asm_full_simp_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    38
bd square_sym 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    39
bd square_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    40
by(Asm_full_simp_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    41
qed "square_rtrancl_reflcl_commute";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    42
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    43
(*** commute ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    44
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    45
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute S R";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    46
by(fast_tac (HOL_cs addIs [square_sym]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    47
qed "commute_sym";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    48
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    49
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute (R^*) (S^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    50
by(fast_tac (HOL_cs addIs [square_rtrancl,square_sym]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    51
qed "commute_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    52
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    53
goalw Commutation.thy [commute_def,square_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    54
  "!!R. [| commute R T; commute S T |] ==> commute (R Un S) T";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    55
by(fast_tac set_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    56
qed "commute_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    57
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    58
(*** diamond, confluence and union ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    59
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    60
goalw Commutation.thy [diamond_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    61
  "!!R. [| diamond R; diamond S; commute R S |] ==> diamond (R Un S)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    62
by(REPEAT(ares_tac [commute_Un,commute_sym] 1));
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    63
qed "diamond_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    64
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    65
goalw Commutation.thy [diamond_def] "!!R. diamond R ==> confluent (R)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    66
be commute_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    67
qed "diamond_confluent";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    68
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    69
goal Commutation.thy
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    70
 "!!R. [| confluent R; confluent S; commute (R^*) (S^*) |] \
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    71
\      ==> confluent(R Un S)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    72
br(trancl_Un_trancl RS subst) 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    73
by(fast_tac (HOL_cs addDs [diamond_Un] addIs [diamond_confluent]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    74
qed "confluent_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    75
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    76
goal Commutation.thy
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    77
  "!!R.[| diamond(R); T <= R; R <= T^* |] ==> confluent(T)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    78
by(fast_tac (HOL_cs addIs [diamond_confluent]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    79
                    addDs [rtrancl_subset RS sym] addss HOL_ss) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    80
qed "diamond_to_confluence";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    81
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    82
(*** Church_Rosser ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    83
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    84
goalw Commutation.thy [square_def,commute_def,diamond_def,Church_Rosser_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    85
  "Church_Rosser(R) = confluent(R)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    86
br iffI 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    87
 by(fast_tac (HOL_cs addIs
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    88
      [Un_upper2 RS rtrancl_mono RS subsetD RS rtrancl_trans,
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    89
       rtrancl_converseI, converseI, Un_upper1 RS rtrancl_mono RS subsetD])1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    90
by(safe_tac HOL_cs);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    91
be rtrancl_induct 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    92
 by(fast_tac trancl_cs 1);
1302
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
    93
by(slow_tac (rel_cs addIs [r_into_rtrancl]
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
    94
                    addEs [rtrancl_trans,r_into_rtrancl RS rtrancl_trans]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    95
qed "Church_Rosser_confluent";