1278
|
1 |
(* Title: HOL/Lambda/Commutation.thy
|
|
2 |
ID: $Id$
|
|
3 |
Author: Tobias Nipkow
|
|
4 |
Copyright 1995 TU Muenchen
|
|
5 |
|
|
6 |
Basic commutation lemmas.
|
|
7 |
*)
|
|
8 |
|
|
9 |
open Commutation;
|
|
10 |
|
|
11 |
(* FIXME: move to Trancl *)
|
|
12 |
(* FIXME: add rtrancl_idemp globally *)
|
|
13 |
Addsimps [rtrancl_idemp];
|
|
14 |
|
|
15 |
goal Trancl.thy "!!R. [| R <= S; S <= R^* |] ==> S^* = R^*";
|
|
16 |
bd rtrancl_mono 1;
|
|
17 |
bd rtrancl_mono 1;
|
|
18 |
by(Asm_full_simp_tac 1);
|
|
19 |
by(fast_tac eq_cs 1);
|
|
20 |
qed "rtrancl_subset";
|
|
21 |
|
|
22 |
(* FIXME: move to Trancl *)
|
|
23 |
goal Trancl.thy "!!R. p:R ==> p:R^*";
|
|
24 |
by(res_inst_tac [("p","p")] PairE 1);
|
|
25 |
by(fast_tac (HOL_cs addIs [r_into_rtrancl]) 1);
|
|
26 |
qed "r_into_rtrancl1";
|
|
27 |
|
|
28 |
(* FIXME: move to Trancl *)
|
|
29 |
goal Trancl.thy "!!R. (R^* Un S^*)^* = (R Un S)^*";
|
|
30 |
by(best_tac (set_cs addIs [rtrancl_subset,r_into_rtrancl1,
|
|
31 |
rtrancl_mono RS subsetD]) 1);
|
|
32 |
qed "trancl_Un_trancl";
|
|
33 |
|
|
34 |
(* FIXME: move to Trancl *)
|
|
35 |
goal Commutation.thy "(R^=)^* = R^*";
|
|
36 |
by(fast_tac (trancl_cs addIs [rtrancl_subset,r_into_rtrancl1]) 1);
|
|
37 |
qed "rtrancl_reflcl";
|
|
38 |
Addsimps [rtrancl_reflcl];
|
|
39 |
|
|
40 |
(*** square ***)
|
|
41 |
|
|
42 |
goalw Commutation.thy [square_def] "!!R. square R S T U ==> square S R U T";
|
|
43 |
by(fast_tac HOL_cs 1);
|
|
44 |
qed "square_sym";
|
|
45 |
|
|
46 |
goalw Commutation.thy [square_def]
|
|
47 |
"!!R. [| square R S T (R^=); S <= T |] ==> square (R^=) S T (R^=)";
|
|
48 |
by(fast_tac rel_cs 1);
|
|
49 |
qed "square_reflcl";
|
|
50 |
|
|
51 |
goalw Commutation.thy [square_def]
|
|
52 |
"!!R. square R S S T ==> square (R^*) S S (T^*)";
|
|
53 |
by(strip_tac 1);
|
|
54 |
be rtrancl_induct 1;
|
|
55 |
by(fast_tac trancl_cs 1);
|
|
56 |
by(fast_tac (HOL_cs addSEs [rtrancl_into_rtrancl]) 1);
|
|
57 |
qed "square_rtrancl";
|
|
58 |
|
|
59 |
(* A big fast_tac runs out of store. Search space too large? *)
|
|
60 |
goalw Commutation.thy [commute_def]
|
|
61 |
"!!R. square R S (S^*) (R^=) ==> commute (R^*) (S^*)";
|
|
62 |
bd square_reflcl 1;
|
|
63 |
br subsetI 1;
|
|
64 |
be r_into_rtrancl1 1;
|
|
65 |
bd square_sym 1;
|
|
66 |
bd square_rtrancl 1;
|
|
67 |
by(Asm_full_simp_tac 1);
|
|
68 |
bd square_sym 1;
|
|
69 |
bd square_rtrancl 1;
|
|
70 |
by(Asm_full_simp_tac 1);
|
|
71 |
qed "square_rtrancl_reflcl_commute";
|
|
72 |
|
|
73 |
(*** commute ***)
|
|
74 |
|
|
75 |
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute S R";
|
|
76 |
by(fast_tac (HOL_cs addIs [square_sym]) 1);
|
|
77 |
qed "commute_sym";
|
|
78 |
|
|
79 |
goalw Commutation.thy [commute_def] "!!R. commute R S ==> commute (R^*) (S^*)";
|
|
80 |
by(fast_tac (HOL_cs addIs [square_rtrancl,square_sym]) 1);
|
|
81 |
qed "commute_rtrancl";
|
|
82 |
|
|
83 |
goalw Commutation.thy [commute_def,square_def]
|
|
84 |
"!!R. [| commute R T; commute S T |] ==> commute (R Un S) T";
|
|
85 |
by(fast_tac set_cs 1);
|
|
86 |
qed "commute_Un";
|
|
87 |
|
|
88 |
(*** diamond, confluence and union ***)
|
|
89 |
|
|
90 |
goalw Commutation.thy [diamond_def]
|
|
91 |
"!!R. [| diamond R; diamond S; commute R S |] ==> diamond (R Un S)";
|
|
92 |
by(REPEAT(ares_tac [commute_Un,commute_sym] 1));
|
|
93 |
qed "diamond_Un";
|
|
94 |
|
|
95 |
goalw Commutation.thy [diamond_def] "!!R. diamond R ==> confluent (R)";
|
|
96 |
be commute_rtrancl 1;
|
|
97 |
qed "diamond_confluent";
|
|
98 |
|
|
99 |
goal Commutation.thy
|
|
100 |
"!!R. [| confluent R; confluent S; commute (R^*) (S^*) |] \
|
|
101 |
\ ==> confluent(R Un S)";
|
|
102 |
br(trancl_Un_trancl RS subst) 1;
|
|
103 |
by(fast_tac (HOL_cs addDs [diamond_Un] addIs [diamond_confluent]) 1);
|
|
104 |
qed "confluent_Un";
|
|
105 |
|
|
106 |
goal Commutation.thy
|
|
107 |
"!!R.[| diamond(R); T <= R; R <= T^* |] ==> confluent(T)";
|
|
108 |
by(fast_tac (HOL_cs addIs [diamond_confluent]
|
|
109 |
addDs [rtrancl_subset RS sym] addss HOL_ss) 1);
|
|
110 |
qed "diamond_to_confluence";
|
|
111 |
|
|
112 |
(*** Church_Rosser ***)
|
|
113 |
|
|
114 |
goalw Commutation.thy [square_def,commute_def,diamond_def,Church_Rosser_def]
|
|
115 |
"Church_Rosser(R) = confluent(R)";
|
|
116 |
br iffI 1;
|
|
117 |
by(fast_tac (HOL_cs addIs
|
|
118 |
[Un_upper2 RS rtrancl_mono RS subsetD RS rtrancl_trans,
|
|
119 |
rtrancl_converseI, converseI, Un_upper1 RS rtrancl_mono RS subsetD])1);
|
|
120 |
by(safe_tac HOL_cs);
|
|
121 |
be rtrancl_induct 1;
|
|
122 |
by(fast_tac trancl_cs 1);
|
|
123 |
by(slow_tac (rel_cs addIs [r_into_rtrancl]
|
|
124 |
addEs [rtrancl_trans,r_into_rtrancl RS rtrancl_trans]) 1);
|
|
125 |
qed "Church_Rosser_confluent";
|