src/HOL/Lambda/Commutation.ML
author paulson
Fri, 26 May 2000 18:05:34 +0200
changeset 8984 b71c460c6f97
parent 5117 7b5efef2ca74
permissions -rw-r--r--
addss -> force_tac
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
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    13
Goalw [square_def] "square R S T U ==> square S R U T";
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    14
by (Blast_tac 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    15
qed "square_sym";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    16
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    17
Goalw [square_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    18
  "[| square R S T U; T <= T' |] ==> square R S T' U";
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    19
by (Blast_tac 1);
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    20
qed "square_subset";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    21
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    22
Goalw [square_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    23
  "[| square R S T (R^=); S <= T |] ==> square (R^=) S T (R^=)";
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    24
by (Blast_tac 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    25
qed "square_reflcl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    26
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    27
Goalw [square_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    28
  "square R S S T ==> square (R^*) S S (T^*)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    29
by (strip_tac 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    30
by (etac rtrancl_induct 1);
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    31
by (Blast_tac 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    32
by (blast_tac (claset() addIs [rtrancl_into_rtrancl]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    33
qed "square_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    34
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    35
Goalw [commute_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    36
 "square R S (S^*) (R^=) ==> commute (R^*) (S^*)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    37
by (fast_tac (claset() addDs [square_reflcl,square_sym RS square_rtrancl]
4474
3a43a694d53b Tidied. Also better proof using new blast_tac
paulson
parents: 4089
diff changeset
    38
                       addEs [r_into_rtrancl]
3a43a694d53b Tidied. Also better proof using new blast_tac
paulson
parents: 4089
diff changeset
    39
                       addss simpset()) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    40
qed "square_rtrancl_reflcl_commute";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    41
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    42
(*** commute ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    43
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    44
Goalw [commute_def] "commute R S ==> commute S R";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    45
by (blast_tac (claset() addIs [square_sym]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    46
qed "commute_sym";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    47
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    48
Goalw [commute_def] "commute R S ==> commute (R^*) (S^*)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    49
by (blast_tac (claset() addIs [square_rtrancl,square_sym]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    50
qed "commute_rtrancl";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    51
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    52
Goalw [commute_def,square_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    53
  "[| commute R T; commute S T |] ==> commute (R Un S) T";
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    54
by (Blast_tac 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    55
qed "commute_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    56
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    57
(*** diamond, confluence and union ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    58
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    59
Goalw [diamond_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    60
  "[| diamond R; diamond S; commute R S |] ==> diamond (R Un S)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    61
by (REPEAT(ares_tac [commute_Un,commute_sym] 1));
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    62
qed "diamond_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    63
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    64
Goalw [diamond_def] "diamond R ==> confluent (R)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    65
by (etac commute_rtrancl 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    66
qed "diamond_confluent";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    67
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    68
Goalw [diamond_def]
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    69
  "square R R (R^=) (R^=) ==> confluent R";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    70
by (fast_tac (claset() addIs [square_rtrancl_reflcl_commute, r_into_rtrancl]
4474
3a43a694d53b Tidied. Also better proof using new blast_tac
paulson
parents: 4089
diff changeset
    71
                       addEs [square_subset]) 1);
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    72
qed "square_reflcl_confluent";
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    73
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    74
Goal
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    75
 "[| confluent R; confluent S; commute (R^*) (S^*) |] ==> confluent(R Un S)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    76
by (rtac (rtrancl_Un_rtrancl RS subst) 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3439
diff changeset
    77
by (blast_tac (claset() addDs [diamond_Un] addIs [diamond_confluent]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    78
qed "confluent_Un";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    79
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    80
Goal "[| diamond(R); T <= R; R <= T^* |] ==> confluent(T)";
8984
b71c460c6f97 addss -> force_tac
paulson
parents: 5117
diff changeset
    81
by (force_tac (claset() addIs [diamond_confluent] 
b71c460c6f97 addss -> force_tac
paulson
parents: 5117
diff changeset
    82
                        addDs [rtrancl_subset RS sym], simpset()) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    83
qed "diamond_to_confluence";
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    84
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    85
(*** Church_Rosser ***)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    86
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4746
diff changeset
    87
Goalw [square_def,commute_def,diamond_def,Church_Rosser_def]
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    88
  "Church_Rosser(R) = confluent(R)";
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    89
by (safe_tac HOL_cs);
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    90
 by (blast_tac (HOL_cs addIs
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    91
      [Un_upper2 RS rtrancl_mono RS subsetD RS rtrancl_trans,
4746
a5dcd7e4a37d inverse -> converse
paulson
parents: 4474
diff changeset
    92
       rtrancl_converseI, converseI, Un_upper1 RS rtrancl_mono RS subsetD])1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    93
by (etac rtrancl_induct 1);
2897
27dc4862751b Now calls blast_tac
paulson
parents: 2057
diff changeset
    94
 by (Blast_tac 1);
4474
3a43a694d53b Tidied. Also better proof using new blast_tac
paulson
parents: 4089
diff changeset
    95
by (blast_tac (claset() delrules [rtrancl_refl] 
3a43a694d53b Tidied. Also better proof using new blast_tac
paulson
parents: 4089
diff changeset
    96
                        addIs [r_into_rtrancl, rtrancl_trans]) 1);
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    97
qed "Church_Rosser_confluent";