src/HOL/Lambda/Commutation.ML
author paulson
Thu, 18 Jan 1996 10:38:29 +0100
changeset 1444 23ceb1dc9755
parent 1431 be7c6d77e19c
child 1465 5d7a7e439cec
permissions -rw-r--r--
trivial updates
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]
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    18
  "!!R. [| square R S T U; T <= T' |] ==> square R S T' U";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    19
by(fast_tac set_cs 1);
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    20
qed "square_subset";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    21
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    22
goalw Commutation.thy [square_def]
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    23
  "!!R. [| square R S T (R^=); S <= T |] ==> square (R^=) S T (R^=)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    24
by(fast_tac rel_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    25
qed "square_reflcl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    26
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    27
goalw Commutation.thy [square_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    28
  "!!R. square R S S T ==> square (R^*) S S (T^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    29
by(strip_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    30
be rtrancl_induct 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    31
by(fast_tac trancl_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    32
by(fast_tac (HOL_cs addSEs [rtrancl_into_rtrancl]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    33
qed "square_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    34
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    35
goalw Commutation.thy [commute_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    36
 "!!R. square R S (S^*) (R^=) ==> commute (R^*) (S^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    37
bd square_reflcl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    38
br subsetI 1;
1302
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
    39
be r_into_rtrancl 1;
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    40
bd square_sym 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    41
bd square_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    42
by(Asm_full_simp_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    43
bd square_sym 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    44
bd square_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    45
by(Asm_full_simp_tac 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    46
qed "square_rtrancl_reflcl_commute";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    47
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    48
(*** commute ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    49
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    50
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute S R";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    51
by(fast_tac (HOL_cs addIs [square_sym]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    52
qed "commute_sym";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    53
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    54
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute (R^*) (S^*)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    55
by(fast_tac (HOL_cs addIs [square_rtrancl,square_sym]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    56
qed "commute_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    57
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    58
goalw Commutation.thy [commute_def,square_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    59
  "!!R. [| commute R T; commute S T |] ==> commute (R Un S) T";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    60
by(fast_tac set_cs 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    61
qed "commute_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    62
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    63
(*** diamond, confluence and union ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    64
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    65
goalw Commutation.thy [diamond_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    66
  "!!R. [| diamond R; diamond S; commute R S |] ==> diamond (R Un S)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    67
by(REPEAT(ares_tac [commute_Un,commute_sym] 1));
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    68
qed "diamond_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    69
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    70
goalw Commutation.thy [diamond_def] "!!R. diamond R ==> confluent (R)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    71
be commute_rtrancl 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    72
qed "diamond_confluent";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    73
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    74
goalw Commutation.thy [diamond_def]
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    75
  "!!R. square R R (R^=) (R^=) ==> confluent R";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    76
by(fast_tac (trancl_cs addIs [square_rtrancl_reflcl_commute,r_into_rtrancl]
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    77
                       addEs [square_subset]) 1);
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    78
qed "square_reflcl_confluent";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    79
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    80
goal Commutation.thy
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    81
 "!!R. [| confluent R; confluent S; commute (R^*) (S^*) |] \
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    82
\      ==> confluent(R Un S)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    83
br(trancl_Un_trancl RS subst) 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    84
by(fast_tac (HOL_cs addDs [diamond_Un] addIs [diamond_confluent]) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    85
qed "confluent_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    86
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    87
goal Commutation.thy
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    88
  "!!R.[| diamond(R); T <= R; R <= T^* |] ==> confluent(T)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    89
by(fast_tac (HOL_cs addIs [diamond_confluent]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    90
                    addDs [rtrancl_subset RS sym] addss HOL_ss) 1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    91
qed "diamond_to_confluence";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    92
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    93
(*** Church_Rosser ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    94
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    95
goalw Commutation.thy [square_def,commute_def,diamond_def,Church_Rosser_def]
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    96
  "Church_Rosser(R) = confluent(R)";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    97
br iffI 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    98
 by(fast_tac (HOL_cs addIs
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    99
      [Un_upper2 RS rtrancl_mono RS subsetD RS rtrancl_trans,
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   100
       rtrancl_converseI, converseI, Un_upper1 RS rtrancl_mono RS subsetD])1);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   101
by(safe_tac HOL_cs);
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   102
be rtrancl_induct 1;
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   103
 by(fast_tac trancl_cs 1);
1302
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
   104
by(slow_tac (rel_cs addIs [r_into_rtrancl]
ddfdcc9ce667 Moved some thms to Arith and to Trancl.
nipkow
parents: 1278
diff changeset
   105
                    addEs [rtrancl_trans,r_into_rtrancl RS rtrancl_trans]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   106
qed "Church_Rosser_confluent";