10 |
10 |
11 abbreviation |
11 abbreviation |
12 "residuals(u,v,w) == <u,v,w> \<in> Sres" |
12 "residuals(u,v,w) == <u,v,w> \<in> Sres" |
13 |
13 |
14 inductive |
14 inductive |
15 domains "Sres" <= "redexes*redexes*redexes" |
15 domains "Sres" \<subseteq> "redexes*redexes*redexes" |
16 intros |
16 intros |
17 Res_Var: "n \<in> nat ==> residuals(Var(n),Var(n),Var(n))" |
17 Res_Var: "n \<in> nat ==> residuals(Var(n),Var(n),Var(n))" |
18 Res_Fun: "[|residuals(u,v,w)|]==> |
18 Res_Fun: "[|residuals(u,v,w)|]==> |
19 residuals(Fun(u),Fun(v),Fun(w))" |
19 residuals(Fun(u),Fun(v),Fun(w))" |
20 Res_App: "[|residuals(u1,v1,w1); |
20 Res_App: "[|residuals(u1,v1,w1); |
62 declare Sres.intros [simp] |
62 declare Sres.intros [simp] |
63 |
63 |
64 subsection{*residuals is a partial function*} |
64 subsection{*residuals is a partial function*} |
65 |
65 |
66 lemma residuals_function [rule_format]: |
66 lemma residuals_function [rule_format]: |
67 "residuals(u,v,w) ==> \<forall>w1. residuals(u,v,w1) --> w1 = w" |
67 "residuals(u,v,w) ==> \<forall>w1. residuals(u,v,w1) \<longrightarrow> w1 = w" |
68 by (erule Sres.induct, force+) |
68 by (erule Sres.induct, force+) |
69 |
69 |
70 lemma residuals_intro [rule_format]: |
70 lemma residuals_intro [rule_format]: |
71 "u~v ==> regular(v) --> (\<exists>w. residuals(u,v,w))" |
71 "u~v ==> regular(v) \<longrightarrow> (\<exists>w. residuals(u,v,w))" |
72 by (erule Scomp.induct, force+) |
72 by (erule Scomp.induct, force+) |
73 |
73 |
74 lemma comp_resfuncD: |
74 lemma comp_resfuncD: |
75 "[| u~v; regular(v) |] ==> residuals(u, v, THE w. residuals(u, v, w))" |
75 "[| u~v; regular(v) |] ==> residuals(u, v, THE w. residuals(u, v, w))" |
76 apply (frule residuals_intro, assumption, clarify) |
76 apply (frule residuals_intro, assumption, clarify) |
103 apply (blast elim!: redexes.free_elims dest!: comp_resfuncD |
103 apply (blast elim!: redexes.free_elims dest!: comp_resfuncD |
104 intro: residuals_function) |
104 intro: residuals_function) |
105 done |
105 done |
106 |
106 |
107 lemma resfunc_type [simp]: |
107 lemma resfunc_type [simp]: |
108 "[|s~t; regular(t)|]==> regular(t) --> s |> t \<in> redexes" |
108 "[|s~t; regular(t)|]==> regular(t) \<longrightarrow> s |> t \<in> redexes" |
109 by (erule Scomp.induct, auto) |
109 by (erule Scomp.induct, auto) |
110 |
110 |
111 subsection{*Commutation theorem*} |
111 subsection{*Commutation theorem*} |
112 |
112 |
113 lemma sub_comp [simp]: "u<==v ==> u~v" |
113 lemma sub_comp [simp]: "u<==v ==> u~v" |
114 by (erule Ssub.induct, simp_all) |
114 by (erule Ssub.induct, simp_all) |
115 |
115 |
116 lemma sub_preserve_reg [rule_format, simp]: |
116 lemma sub_preserve_reg [rule_format, simp]: |
117 "u<==v ==> regular(v) --> regular(u)" |
117 "u<==v ==> regular(v) \<longrightarrow> regular(u)" |
118 by (erule Ssub.induct, auto) |
118 by (erule Ssub.induct, auto) |
119 |
119 |
120 lemma residuals_lift_rec: "[|u~v; k \<in> nat|]==> regular(v)--> (\<forall>n \<in> nat. |
120 lemma residuals_lift_rec: "[|u~v; k \<in> nat|]==> regular(v)\<longrightarrow> (\<forall>n \<in> nat. |
121 lift_rec(u,n) |> lift_rec(v,n) = lift_rec(u |> v,n))" |
121 lift_rec(u,n) |> lift_rec(v,n) = lift_rec(u |> v,n))" |
122 apply (erule Scomp.induct, safe) |
122 apply (erule Scomp.induct, safe) |
123 apply (simp_all add: lift_rec_Var subst_Var lift_subst) |
123 apply (simp_all add: lift_rec_Var subst_Var lift_subst) |
124 done |
124 done |
125 |
125 |
126 lemma residuals_subst_rec: |
126 lemma residuals_subst_rec: |
127 "u1~u2 ==> \<forall>v1 v2. v1~v2 --> regular(v2) --> regular(u2) --> |
127 "u1~u2 ==> \<forall>v1 v2. v1~v2 \<longrightarrow> regular(v2) \<longrightarrow> regular(u2) \<longrightarrow> |
128 (\<forall>n \<in> nat. subst_rec(v1,u1,n) |> subst_rec(v2,u2,n) = |
128 (\<forall>n \<in> nat. subst_rec(v1,u1,n) |> subst_rec(v2,u2,n) = |
129 subst_rec(v1 |> v2, u1 |> u2,n))" |
129 subst_rec(v1 |> v2, u1 |> u2,n))" |
130 apply (erule Scomp.induct, safe) |
130 apply (erule Scomp.induct, safe) |
131 apply (simp_all add: lift_rec_Var subst_Var residuals_lift_rec) |
131 apply (simp_all add: lift_rec_Var subst_Var residuals_lift_rec) |
132 apply (drule_tac psi = "\<forall>x.?P (x) " in asm_rl) |
132 apply (drule_tac psi = "\<forall>x.?P (x) " in asm_rl) |
141 |
141 |
142 |
142 |
143 subsection{*Residuals are comp and regular*} |
143 subsection{*Residuals are comp and regular*} |
144 |
144 |
145 lemma residuals_preserve_comp [rule_format, simp]: |
145 lemma residuals_preserve_comp [rule_format, simp]: |
146 "u~v ==> \<forall>w. u~w --> v~w --> regular(w) --> (u|>w) ~ (v|>w)" |
146 "u~v ==> \<forall>w. u~w \<longrightarrow> v~w \<longrightarrow> regular(w) \<longrightarrow> (u|>w) ~ (v|>w)" |
147 by (erule Scomp.induct, force+) |
147 by (erule Scomp.induct, force+) |
148 |
148 |
149 lemma residuals_preserve_reg [rule_format, simp]: |
149 lemma residuals_preserve_reg [rule_format, simp]: |
150 "u~v ==> regular(u) --> regular(v) --> regular(u|>v)" |
150 "u~v ==> regular(u) \<longrightarrow> regular(v) \<longrightarrow> regular(u|>v)" |
151 apply (erule Scomp.induct, auto) |
151 apply (erule Scomp.induct, auto) |
152 done |
152 done |
153 |
153 |
154 subsection{*Preservation lemma*} |
154 subsection{*Preservation lemma*} |
155 |
155 |
156 lemma union_preserve_comp: "u~v ==> v ~ (u un v)" |
156 lemma union_preserve_comp: "u~v ==> v ~ (u un v)" |
157 by (erule Scomp.induct, simp_all) |
157 by (erule Scomp.induct, simp_all) |
158 |
158 |
159 lemma preservation [rule_format]: |
159 lemma preservation [rule_format]: |
160 "u ~ v ==> regular(v) --> u|>v = (u un v)|>v" |
160 "u ~ v ==> regular(v) \<longrightarrow> u|>v = (u un v)|>v" |
161 apply (erule Scomp.induct, safe) |
161 apply (erule Scomp.induct, safe) |
162 apply (drule_tac [3] psi = "Fun (?u) |> ?v = ?w" in asm_rl) |
162 apply (drule_tac [3] psi = "Fun (?u) |> ?v = ?w" in asm_rl) |
163 apply (auto simp add: union_preserve_comp comp_sym_iff) |
163 apply (auto simp add: union_preserve_comp comp_sym_iff) |
164 done |
164 done |
165 |
165 |
169 subsection{*Prism theorem*} |
169 subsection{*Prism theorem*} |
170 |
170 |
171 (* Having more assumptions than needed -- removed below *) |
171 (* Having more assumptions than needed -- removed below *) |
172 lemma prism_l [rule_format]: |
172 lemma prism_l [rule_format]: |
173 "v<==u ==> |
173 "v<==u ==> |
174 regular(u) --> (\<forall>w. w~v --> w~u --> |
174 regular(u) \<longrightarrow> (\<forall>w. w~v \<longrightarrow> w~u \<longrightarrow> |
175 w |> u = (w|>v) |> (u|>v))" |
175 w |> u = (w|>v) |> (u|>v))" |
176 by (erule Ssub.induct, force+) |
176 by (erule Ssub.induct, force+) |
177 |
177 |
178 lemma prism: "[|v <== u; regular(u); w~v|] ==> w |> u = (w|>v) |> (u|>v)" |
178 lemma prism: "[|v <== u; regular(u); w~v|] ==> w |> u = (w|>v) |> (u|>v)" |
179 apply (rule prism_l) |
179 apply (rule prism_l) |