author | blanchet |
Sun, 13 Nov 2011 20:28:22 +0100 | |
changeset 45478 | 8e299034eab4 |
parent 44011 | f67c93f52d13 |
child 45694 | 4a8743618257 |
permissions | -rw-r--r-- |
41777 | 1 |
(* Title: HOL/ZF/Games.thy |
19203 | 2 |
Author: Steven Obua |
3 |
||
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
4 |
An application of HOLZF: Partizan Games. See "Partizan Games in |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
5 |
Isabelle/HOLZF", available from http://www4.in.tum.de/~obua/partizan |
19203 | 6 |
*) |
7 |
||
8 |
theory Games |
|
9 |
imports MainZF |
|
10 |
begin |
|
11 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
12 |
definition fixgames :: "ZF set \<Rightarrow> ZF set" where |
19203 | 13 |
"fixgames A \<equiv> { Opair l r | l r. explode l \<subseteq> A & explode r \<subseteq> A}" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
14 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
15 |
definition games_lfp :: "ZF set" where |
19203 | 16 |
"games_lfp \<equiv> lfp fixgames" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
17 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
18 |
definition games_gfp :: "ZF set" where |
19203 | 19 |
"games_gfp \<equiv> gfp fixgames" |
20 |
||
21 |
lemma mono_fixgames: "mono (fixgames)" |
|
22 |
apply (auto simp add: mono_def fixgames_def) |
|
23 |
apply (rule_tac x=l in exI) |
|
24 |
apply (rule_tac x=r in exI) |
|
25 |
apply auto |
|
26 |
done |
|
27 |
||
28 |
lemma games_lfp_unfold: "games_lfp = fixgames games_lfp" |
|
29 |
by (auto simp add: def_lfp_unfold games_lfp_def mono_fixgames) |
|
30 |
||
31 |
lemma games_gfp_unfold: "games_gfp = fixgames games_gfp" |
|
32 |
by (auto simp add: def_gfp_unfold games_gfp_def mono_fixgames) |
|
33 |
||
34 |
lemma games_lfp_nonempty: "Opair Empty Empty \<in> games_lfp" |
|
35 |
proof - |
|
36 |
have "fixgames {} \<subseteq> games_lfp" |
|
37 |
apply (subst games_lfp_unfold) |
|
38 |
apply (simp add: mono_fixgames[simplified mono_def, rule_format]) |
|
39 |
done |
|
40 |
moreover have "fixgames {} = {Opair Empty Empty}" |
|
41 |
by (simp add: fixgames_def explode_Empty) |
|
42 |
finally show ?thesis |
|
43 |
by auto |
|
44 |
qed |
|
45 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
46 |
definition left_option :: "ZF \<Rightarrow> ZF \<Rightarrow> bool" where |
19203 | 47 |
"left_option g opt \<equiv> (Elem opt (Fst g))" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
48 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
49 |
definition right_option :: "ZF \<Rightarrow> ZF \<Rightarrow> bool" where |
19203 | 50 |
"right_option g opt \<equiv> (Elem opt (Snd g))" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
51 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
52 |
definition is_option_of :: "(ZF * ZF) set" where |
19203 | 53 |
"is_option_of \<equiv> { (opt, g) | opt g. g \<in> games_gfp \<and> (left_option g opt \<or> right_option g opt) }" |
54 |
||
55 |
lemma games_lfp_subset_gfp: "games_lfp \<subseteq> games_gfp" |
|
56 |
proof - |
|
57 |
have "games_lfp \<subseteq> fixgames games_lfp" |
|
58 |
by (simp add: games_lfp_unfold[symmetric]) |
|
59 |
then show ?thesis |
|
60 |
by (simp add: games_gfp_def gfp_upperbound) |
|
61 |
qed |
|
62 |
||
63 |
lemma games_option_stable: |
|
64 |
assumes fixgames: "games = fixgames games" |
|
65 |
and g: "g \<in> games" |
|
66 |
and opt: "left_option g opt \<or> right_option g opt" |
|
67 |
shows "opt \<in> games" |
|
68 |
proof - |
|
69 |
from g fixgames have "g \<in> fixgames games" by auto |
|
70 |
then have "\<exists> l r. g = Opair l r \<and> explode l \<subseteq> games \<and> explode r \<subseteq> games" |
|
71 |
by (simp add: fixgames_def) |
|
72 |
then obtain l where "\<exists> r. g = Opair l r \<and> explode l \<subseteq> games \<and> explode r \<subseteq> games" .. |
|
73 |
then obtain r where lr: "g = Opair l r \<and> explode l \<subseteq> games \<and> explode r \<subseteq> games" .. |
|
74 |
with opt show ?thesis |
|
75 |
by (auto intro: Elem_explode_in simp add: left_option_def right_option_def Fst Snd) |
|
76 |
qed |
|
77 |
||
78 |
lemma option2elem: "(opt,g) \<in> is_option_of \<Longrightarrow> \<exists> u v. Elem opt u \<and> Elem u v \<and> Elem v g" |
|
79 |
apply (simp add: is_option_of_def) |
|
80 |
apply (subgoal_tac "(g \<in> games_gfp) = (g \<in> (fixgames games_gfp))") |
|
81 |
prefer 2 |
|
82 |
apply (simp add: games_gfp_unfold[symmetric]) |
|
83 |
apply (auto simp add: fixgames_def left_option_def right_option_def Fst Snd) |
|
84 |
apply (rule_tac x=l in exI, insert Elem_Opair_exists, blast) |
|
85 |
apply (rule_tac x=r in exI, insert Elem_Opair_exists, blast) |
|
86 |
done |
|
87 |
||
88 |
lemma is_option_of_subset_is_Elem_of: "is_option_of \<subseteq> (is_Elem_of^+)" |
|
89 |
proof - |
|
90 |
{ |
|
91 |
fix opt |
|
92 |
fix g |
|
93 |
assume "(opt, g) \<in> is_option_of" |
|
94 |
then have "\<exists> u v. (opt, u) \<in> (is_Elem_of^+) \<and> (u,v) \<in> (is_Elem_of^+) \<and> (v,g) \<in> (is_Elem_of^+)" |
|
95 |
apply - |
|
96 |
apply (drule option2elem) |
|
97 |
apply (auto simp add: r_into_trancl' is_Elem_of_def) |
|
98 |
done |
|
99 |
then have "(opt, g) \<in> (is_Elem_of^+)" |
|
100 |
by (blast intro: trancl_into_rtrancl trancl_rtrancl_trancl) |
|
101 |
} |
|
102 |
then show ?thesis by auto |
|
103 |
qed |
|
104 |
||
105 |
lemma wfzf_is_option_of: "wfzf is_option_of" |
|
106 |
proof - |
|
107 |
have "wfzf (is_Elem_of^+)" by (simp add: wfzf_trancl wfzf_is_Elem_of) |
|
108 |
then show ?thesis |
|
109 |
apply (rule wfzf_subset) |
|
110 |
apply (rule is_option_of_subset_is_Elem_of) |
|
111 |
done |
|
112 |
qed |
|
113 |
||
114 |
lemma games_gfp_imp_lfp: "g \<in> games_gfp \<longrightarrow> g \<in> games_lfp" |
|
115 |
proof - |
|
116 |
have unfold_gfp: "\<And> x. x \<in> games_gfp \<Longrightarrow> x \<in> (fixgames games_gfp)" |
|
117 |
by (simp add: games_gfp_unfold[symmetric]) |
|
118 |
have unfold_lfp: "\<And> x. (x \<in> games_lfp) = (x \<in> (fixgames games_lfp))" |
|
119 |
by (simp add: games_lfp_unfold[symmetric]) |
|
120 |
show ?thesis |
|
121 |
apply (rule wf_induct[OF wfzf_implies_wf[OF wfzf_is_option_of]]) |
|
122 |
apply (auto simp add: is_option_of_def) |
|
123 |
apply (drule_tac unfold_gfp) |
|
124 |
apply (simp add: fixgames_def) |
|
125 |
apply (auto simp add: left_option_def Fst right_option_def Snd) |
|
126 |
apply (subgoal_tac "explode l \<subseteq> games_lfp") |
|
127 |
apply (subgoal_tac "explode r \<subseteq> games_lfp") |
|
128 |
apply (subst unfold_lfp) |
|
129 |
apply (auto simp add: fixgames_def) |
|
130 |
apply (simp_all add: explode_Elem Elem_explode_in) |
|
131 |
done |
|
132 |
qed |
|
133 |
||
134 |
theorem games_lfp_eq_gfp: "games_lfp = games_gfp" |
|
135 |
apply (auto simp add: games_gfp_imp_lfp) |
|
136 |
apply (insert games_lfp_subset_gfp) |
|
137 |
apply auto |
|
138 |
done |
|
139 |
||
140 |
theorem unique_games: "(g = fixgames g) = (g = games_lfp)" |
|
141 |
proof - |
|
142 |
{ |
|
143 |
fix g |
|
144 |
assume g: "g = fixgames g" |
|
145 |
from g have "fixgames g \<subseteq> g" by auto |
|
146 |
then have l:"games_lfp \<subseteq> g" |
|
147 |
by (simp add: games_lfp_def lfp_lowerbound) |
|
148 |
from g have "g \<subseteq> fixgames g" by auto |
|
149 |
then have u:"g \<subseteq> games_gfp" |
|
150 |
by (simp add: games_gfp_def gfp_upperbound) |
|
151 |
from l u games_lfp_eq_gfp[symmetric] have "g = games_lfp" |
|
152 |
by auto |
|
153 |
} |
|
154 |
note games = this |
|
155 |
show ?thesis |
|
156 |
apply (rule iff[rule_format]) |
|
157 |
apply (erule games) |
|
158 |
apply (simp add: games_lfp_unfold[symmetric]) |
|
159 |
done |
|
160 |
qed |
|
161 |
||
162 |
lemma games_lfp_option_stable: |
|
163 |
assumes g: "g \<in> games_lfp" |
|
164 |
and opt: "left_option g opt \<or> right_option g opt" |
|
165 |
shows "opt \<in> games_lfp" |
|
166 |
apply (rule games_option_stable[where g=g]) |
|
167 |
apply (simp add: games_lfp_unfold[symmetric]) |
|
41528 | 168 |
apply (simp_all add: assms) |
19203 | 169 |
done |
170 |
||
171 |
lemma is_option_of_imp_games: |
|
172 |
assumes hyp: "(opt, g) \<in> is_option_of" |
|
173 |
shows "opt \<in> games_lfp \<and> g \<in> games_lfp" |
|
174 |
proof - |
|
175 |
from hyp have g_game: "g \<in> games_lfp" |
|
176 |
by (simp add: is_option_of_def games_lfp_eq_gfp) |
|
177 |
from hyp have "left_option g opt \<or> right_option g opt" |
|
178 |
by (auto simp add: is_option_of_def) |
|
179 |
with g_game games_lfp_option_stable[OF g_game, OF this] show ?thesis |
|
180 |
by auto |
|
181 |
qed |
|
182 |
||
183 |
lemma games_lfp_represent: "x \<in> games_lfp \<Longrightarrow> \<exists> l r. x = Opair l r" |
|
184 |
apply (rule exI[where x="Fst x"]) |
|
185 |
apply (rule exI[where x="Snd x"]) |
|
186 |
apply (subgoal_tac "x \<in> (fixgames games_lfp)") |
|
187 |
apply (simp add: fixgames_def) |
|
188 |
apply (auto simp add: Fst Snd) |
|
189 |
apply (simp add: games_lfp_unfold[symmetric]) |
|
190 |
done |
|
191 |
||
192 |
typedef game = games_lfp |
|
193 |
by (blast intro: games_lfp_nonempty) |
|
194 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
195 |
definition left_options :: "game \<Rightarrow> game zet" where |
19203 | 196 |
"left_options g \<equiv> zimage Abs_game (zexplode (Fst (Rep_game g)))" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
197 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
198 |
definition right_options :: "game \<Rightarrow> game zet" where |
19203 | 199 |
"right_options g \<equiv> zimage Abs_game (zexplode (Snd (Rep_game g)))" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
200 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
201 |
definition options :: "game \<Rightarrow> game zet" where |
19203 | 202 |
"options g \<equiv> zunion (left_options g) (right_options g)" |
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
203 |
|
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
204 |
definition Game :: "game zet \<Rightarrow> game zet \<Rightarrow> game" where |
19203 | 205 |
"Game L R \<equiv> Abs_game (Opair (zimplode (zimage Rep_game L)) (zimplode (zimage Rep_game R)))" |
206 |
||
207 |
lemma Repl_Rep_game_Abs_game: "\<forall> e. Elem e z \<longrightarrow> e \<in> games_lfp \<Longrightarrow> Repl z (Rep_game o Abs_game) = z" |
|
208 |
apply (subst Ext) |
|
209 |
apply (simp add: Repl) |
|
210 |
apply auto |
|
211 |
apply (subst Abs_game_inverse, simp_all add: game_def) |
|
212 |
apply (rule_tac x=za in exI) |
|
213 |
apply (subst Abs_game_inverse, simp_all add: game_def) |
|
214 |
done |
|
215 |
||
216 |
lemma game_split: "g = Game (left_options g) (right_options g)" |
|
217 |
proof - |
|
218 |
have "\<exists> l r. Rep_game g = Opair l r" |
|
219 |
apply (insert Rep_game[of g]) |
|
220 |
apply (simp add: game_def games_lfp_represent) |
|
221 |
done |
|
222 |
then obtain l r where lr: "Rep_game g = Opair l r" by auto |
|
223 |
have partizan_g: "Rep_game g \<in> games_lfp" |
|
224 |
apply (insert Rep_game[of g]) |
|
225 |
apply (simp add: game_def) |
|
226 |
done |
|
227 |
have "\<forall> e. Elem e l \<longrightarrow> left_option (Rep_game g) e" |
|
228 |
by (simp add: lr left_option_def Fst) |
|
229 |
then have partizan_l: "\<forall> e. Elem e l \<longrightarrow> e \<in> games_lfp" |
|
230 |
apply auto |
|
231 |
apply (rule games_lfp_option_stable[where g="Rep_game g", OF partizan_g]) |
|
232 |
apply auto |
|
233 |
done |
|
234 |
have "\<forall> e. Elem e r \<longrightarrow> right_option (Rep_game g) e" |
|
235 |
by (simp add: lr right_option_def Snd) |
|
236 |
then have partizan_r: "\<forall> e. Elem e r \<longrightarrow> e \<in> games_lfp" |
|
237 |
apply auto |
|
238 |
apply (rule games_lfp_option_stable[where g="Rep_game g", OF partizan_g]) |
|
239 |
apply auto |
|
240 |
done |
|
241 |
let ?L = "zimage (Abs_game) (zexplode l)" |
|
242 |
let ?R = "zimage (Abs_game) (zexplode r)" |
|
243 |
have L:"?L = left_options g" |
|
244 |
by (simp add: left_options_def lr Fst) |
|
245 |
have R:"?R = right_options g" |
|
246 |
by (simp add: right_options_def lr Snd) |
|
247 |
have "g = Game ?L ?R" |
|
248 |
apply (simp add: Game_def Rep_game_inject[symmetric] comp_zimage_eq zimage_zexplode_eq zimplode_zexplode) |
|
249 |
apply (simp add: Repl_Rep_game_Abs_game partizan_l partizan_r) |
|
250 |
apply (subst Abs_game_inverse) |
|
251 |
apply (simp_all add: lr[symmetric] Rep_game) |
|
252 |
done |
|
253 |
then show ?thesis |
|
254 |
by (simp add: L R) |
|
255 |
qed |
|
256 |
||
257 |
lemma Opair_in_games_lfp: |
|
258 |
assumes l: "explode l \<subseteq> games_lfp" |
|
259 |
and r: "explode r \<subseteq> games_lfp" |
|
260 |
shows "Opair l r \<in> games_lfp" |
|
261 |
proof - |
|
262 |
note f = unique_games[of games_lfp, simplified] |
|
263 |
show ?thesis |
|
264 |
apply (subst f) |
|
265 |
apply (simp add: fixgames_def) |
|
266 |
apply (rule exI[where x=l]) |
|
267 |
apply (rule exI[where x=r]) |
|
268 |
apply (auto simp add: l r) |
|
269 |
done |
|
270 |
qed |
|
271 |
||
272 |
lemma left_options[simp]: "left_options (Game l r) = l" |
|
273 |
apply (simp add: left_options_def Game_def) |
|
274 |
apply (subst Abs_game_inverse) |
|
275 |
apply (simp add: game_def) |
|
276 |
apply (rule Opair_in_games_lfp) |
|
277 |
apply (auto simp add: explode_Elem Elem_zimplode zimage_iff Rep_game[simplified game_def]) |
|
278 |
apply (simp add: Fst zexplode_zimplode comp_zimage_eq) |
|
279 |
apply (simp add: zet_ext_eq zimage_iff Rep_game_inverse) |
|
280 |
done |
|
281 |
||
282 |
lemma right_options[simp]: "right_options (Game l r) = r" |
|
283 |
apply (simp add: right_options_def Game_def) |
|
284 |
apply (subst Abs_game_inverse) |
|
285 |
apply (simp add: game_def) |
|
286 |
apply (rule Opair_in_games_lfp) |
|
287 |
apply (auto simp add: explode_Elem Elem_zimplode zimage_iff Rep_game[simplified game_def]) |
|
288 |
apply (simp add: Snd zexplode_zimplode comp_zimage_eq) |
|
289 |
apply (simp add: zet_ext_eq zimage_iff Rep_game_inverse) |
|
290 |
done |
|
291 |
||
292 |
lemma Game_ext: "(Game l1 r1 = Game l2 r2) = ((l1 = l2) \<and> (r1 = r2))" |
|
293 |
apply auto |
|
294 |
apply (subst left_options[where l=l1 and r=r1,symmetric]) |
|
295 |
apply (subst left_options[where l=l2 and r=r2,symmetric]) |
|
296 |
apply simp |
|
297 |
apply (subst right_options[where l=l1 and r=r1,symmetric]) |
|
298 |
apply (subst right_options[where l=l2 and r=r2,symmetric]) |
|
299 |
apply simp |
|
300 |
done |
|
301 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
302 |
definition option_of :: "(game * game) set" where |
19203 | 303 |
"option_of \<equiv> image (\<lambda> (option, g). (Abs_game option, Abs_game g)) is_option_of" |
304 |
||
305 |
lemma option_to_is_option_of: "((option, g) \<in> option_of) = ((Rep_game option, Rep_game g) \<in> is_option_of)" |
|
306 |
apply (auto simp add: option_of_def) |
|
307 |
apply (subst Abs_game_inverse) |
|
308 |
apply (simp add: is_option_of_imp_games game_def) |
|
309 |
apply (subst Abs_game_inverse) |
|
310 |
apply (simp add: is_option_of_imp_games game_def) |
|
311 |
apply simp |
|
312 |
apply (auto simp add: Bex_def image_def) |
|
313 |
apply (rule exI[where x="Rep_game option"]) |
|
314 |
apply (rule exI[where x="Rep_game g"]) |
|
315 |
apply (simp add: Rep_game_inverse) |
|
316 |
done |
|
317 |
||
318 |
lemma wf_is_option_of: "wf is_option_of" |
|
319 |
apply (rule wfzf_implies_wf) |
|
320 |
apply (simp add: wfzf_is_option_of) |
|
321 |
done |
|
322 |
||
44011
f67c93f52d13
eliminated obsolete recdef/wfrec related declarations
krauss
parents:
41777
diff
changeset
|
323 |
lemma wf_option_of[simp, intro]: "wf option_of" |
19203 | 324 |
proof - |
325 |
have option_of: "option_of = inv_image is_option_of Rep_game" |
|
39302
d7728f65b353
renamed lemmas: ext_iff -> fun_eq_iff, set_ext_iff -> set_eq_iff, set_ext -> set_eqI
nipkow
parents:
35440
diff
changeset
|
326 |
apply (rule set_eqI) |
19203 | 327 |
apply (case_tac "x") |
19769
c40ce2de2020
Added [simp]-lemmas "in_inv_image" and "in_lex_prod" in the spirit of "in_measure".
krauss
parents:
19203
diff
changeset
|
328 |
by (simp add: option_to_is_option_of) |
19203 | 329 |
show ?thesis |
330 |
apply (simp add: option_of) |
|
331 |
apply (auto intro: wf_inv_image wf_is_option_of) |
|
332 |
done |
|
333 |
qed |
|
334 |
||
335 |
lemma right_option_is_option[simp, intro]: "zin x (right_options g) \<Longrightarrow> zin x (options g)" |
|
336 |
by (simp add: options_def zunion) |
|
337 |
||
338 |
lemma left_option_is_option[simp, intro]: "zin x (left_options g) \<Longrightarrow> zin x (options g)" |
|
339 |
by (simp add: options_def zunion) |
|
340 |
||
341 |
lemma zin_options[simp, intro]: "zin x (options g) \<Longrightarrow> (x, g) \<in> option_of" |
|
342 |
apply (simp add: options_def zunion left_options_def right_options_def option_of_def |
|
343 |
image_def is_option_of_def zimage_iff zin_zexplode_eq) |
|
344 |
apply (cases g) |
|
345 |
apply (cases x) |
|
346 |
apply (auto simp add: Abs_game_inverse games_lfp_eq_gfp[symmetric] game_def |
|
347 |
right_option_def[symmetric] left_option_def[symmetric]) |
|
348 |
done |
|
349 |
||
35440 | 350 |
function |
19203 | 351 |
neg_game :: "game \<Rightarrow> game" |
35440 | 352 |
where |
353 |
[simp del]: "neg_game g = Game (zimage neg_game (right_options g)) (zimage neg_game (left_options g))" |
|
354 |
by auto |
|
355 |
termination by (relation "option_of") auto |
|
19203 | 356 |
|
357 |
lemma "neg_game (neg_game g) = g" |
|
358 |
apply (induct g rule: neg_game.induct) |
|
359 |
apply (subst neg_game.simps)+ |
|
360 |
apply (simp add: right_options left_options comp_zimage_eq) |
|
361 |
apply (subgoal_tac "zimage (neg_game o neg_game) (left_options g) = left_options g") |
|
362 |
apply (subgoal_tac "zimage (neg_game o neg_game) (right_options g) = right_options g") |
|
363 |
apply (auto simp add: game_split[symmetric]) |
|
364 |
apply (auto simp add: zet_ext_eq zimage_iff) |
|
365 |
done |
|
366 |
||
35440 | 367 |
function |
19203 | 368 |
ge_game :: "(game * game) \<Rightarrow> bool" |
35440 | 369 |
where |
370 |
[simp del]: "ge_game (G, H) = (\<forall> x. if zin x (right_options G) then ( |
|
19203 | 371 |
if zin x (left_options H) then \<not> (ge_game (H, x) \<or> (ge_game (x, G))) |
372 |
else \<not> (ge_game (H, x))) |
|
373 |
else (if zin x (left_options H) then \<not> (ge_game (x, G)) else True))" |
|
35440 | 374 |
by auto |
375 |
termination by (relation "(gprod_2_1 option_of)") |
|
376 |
(simp, auto simp: gprod_2_1_def) |
|
19203 | 377 |
|
26304 | 378 |
lemma ge_game_eq: "ge_game (G, H) = (\<forall> x. (zin x (right_options G) \<longrightarrow> \<not> ge_game (H, x)) \<and> (zin x (left_options H) \<longrightarrow> \<not> ge_game (x, G)))" |
19203 | 379 |
apply (subst ge_game.simps[where G=G and H=H]) |
380 |
apply (auto) |
|
381 |
done |
|
382 |
||
383 |
lemma ge_game_leftright_refl[rule_format]: |
|
384 |
"\<forall> y. (zin y (right_options x) \<longrightarrow> \<not> ge_game (x, y)) \<and> (zin y (left_options x) \<longrightarrow> \<not> (ge_game (y, x))) \<and> ge_game (x, x)" |
|
385 |
proof (induct x rule: wf_induct[OF wf_option_of]) |
|
386 |
case (1 "g") |
|
387 |
{ |
|
388 |
fix y |
|
389 |
assume y: "zin y (right_options g)" |
|
390 |
have "\<not> ge_game (g, y)" |
|
391 |
proof - |
|
392 |
have "(y, g) \<in> option_of" by (auto intro: y) |
|
393 |
with 1 have "ge_game (y, y)" by auto |
|
26304 | 394 |
with y show ?thesis by (subst ge_game_eq, auto) |
19203 | 395 |
qed |
396 |
} |
|
397 |
note right = this |
|
398 |
{ |
|
399 |
fix y |
|
400 |
assume y: "zin y (left_options g)" |
|
401 |
have "\<not> ge_game (y, g)" |
|
402 |
proof - |
|
403 |
have "(y, g) \<in> option_of" by (auto intro: y) |
|
404 |
with 1 have "ge_game (y, y)" by auto |
|
26304 | 405 |
with y show ?thesis by (subst ge_game_eq, auto) |
19203 | 406 |
qed |
407 |
} |
|
408 |
note left = this |
|
409 |
from left right show ?case |
|
26304 | 410 |
by (auto, subst ge_game_eq, auto) |
19203 | 411 |
qed |
412 |
||
413 |
lemma ge_game_refl: "ge_game (x,x)" by (simp add: ge_game_leftright_refl) |
|
414 |
||
415 |
lemma "\<forall> y. (zin y (right_options x) \<longrightarrow> \<not> ge_game (x, y)) \<and> (zin y (left_options x) \<longrightarrow> \<not> (ge_game (y, x))) \<and> ge_game (x, x)" |
|
416 |
proof (induct x rule: wf_induct[OF wf_option_of]) |
|
417 |
case (1 "g") |
|
418 |
show ?case |
|
419 |
proof (auto) |
|
420 |
{case (goal1 y) |
|
421 |
from goal1 have "(y, g) \<in> option_of" by (auto) |
|
422 |
with 1 have "ge_game (y, y)" by auto |
|
423 |
with goal1 have "\<not> ge_game (g, y)" |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
424 |
by (subst ge_game_eq, auto) |
19203 | 425 |
with goal1 show ?case by auto} |
426 |
note right = this |
|
427 |
{case (goal2 y) |
|
428 |
from goal2 have "(y, g) \<in> option_of" by (auto) |
|
429 |
with 1 have "ge_game (y, y)" by auto |
|
430 |
with goal2 have "\<not> ge_game (y, g)" |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
431 |
by (subst ge_game_eq, auto) |
19203 | 432 |
with goal2 show ?case by auto} |
433 |
note left = this |
|
434 |
{case goal3 |
|
435 |
from left right show ?case |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
436 |
by (subst ge_game_eq, auto) |
19203 | 437 |
} |
438 |
qed |
|
439 |
qed |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
440 |
|
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
441 |
definition eq_game :: "game \<Rightarrow> game \<Rightarrow> bool" where |
19203 | 442 |
"eq_game G H \<equiv> ge_game (G, H) \<and> ge_game (H, G)" |
443 |
||
444 |
lemma eq_game_sym: "(eq_game G H) = (eq_game H G)" |
|
445 |
by (auto simp add: eq_game_def) |
|
446 |
||
447 |
lemma eq_game_refl: "eq_game G G" |
|
448 |
by (simp add: ge_game_refl eq_game_def) |
|
449 |
||
23771 | 450 |
lemma induct_game: "(\<And>x. \<forall>y. (y, x) \<in> lprod option_of \<longrightarrow> P y \<Longrightarrow> P x) \<Longrightarrow> P a" |
451 |
by (erule wf_induct[OF wf_lprod[OF wf_option_of]]) |
|
19203 | 452 |
|
453 |
lemma ge_game_trans: |
|
454 |
assumes "ge_game (x, y)" "ge_game (y, z)" |
|
455 |
shows "ge_game (x, z)" |
|
456 |
proof - |
|
457 |
{ |
|
458 |
fix a |
|
459 |
have "\<forall> x y z. a = [x,y,z] \<longrightarrow> ge_game (x,y) \<longrightarrow> ge_game (y,z) \<longrightarrow> ge_game (x, z)" |
|
460 |
proof (induct a rule: induct_game) |
|
461 |
case (1 a) |
|
462 |
show ?case |
|
463 |
proof (rule allI | rule impI)+ |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
464 |
case (goal1 x y z) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
465 |
show ?case |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
466 |
proof - |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
467 |
{ fix xr |
19203 | 468 |
assume xr:"zin xr (right_options x)" |
41528 | 469 |
assume a: "ge_game (z, xr)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
470 |
have "ge_game (y, xr)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
471 |
apply (rule 1[rule_format, where y="[y,z,xr]"]) |
41528 | 472 |
apply (auto intro: xr lprod_3_1 simp add: goal1 a) |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
473 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
474 |
moreover from xr have "\<not> ge_game (y, xr)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
475 |
by (simp add: goal1(2)[simplified ge_game_eq[of x y], rule_format, of xr, simplified xr]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
476 |
ultimately have "False" by auto |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
477 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
478 |
note xr = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
479 |
{ fix zl |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
480 |
assume zl:"zin zl (left_options z)" |
41528 | 481 |
assume a: "ge_game (zl, x)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
482 |
have "ge_game (zl, y)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
483 |
apply (rule 1[rule_format, where y="[zl,x,y]"]) |
41528 | 484 |
apply (auto intro: zl lprod_3_2 simp add: goal1 a) |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
485 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
486 |
moreover from zl have "\<not> ge_game (zl, y)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
487 |
by (simp add: goal1(3)[simplified ge_game_eq[of y z], rule_format, of zl, simplified zl]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
488 |
ultimately have "False" by auto |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
489 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
490 |
note zl = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
491 |
show ?thesis |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
492 |
by (auto simp add: ge_game_eq[of x z] intro: xr zl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
493 |
qed |
19203 | 494 |
qed |
495 |
qed |
|
496 |
} |
|
497 |
note trans = this[of "[x, y, z]", simplified, rule_format] |
|
41528 | 498 |
with assms show ?thesis by blast |
19203 | 499 |
qed |
500 |
||
501 |
lemma eq_game_trans: "eq_game a b \<Longrightarrow> eq_game b c \<Longrightarrow> eq_game a c" |
|
502 |
by (auto simp add: eq_game_def intro: ge_game_trans) |
|
503 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
504 |
definition zero_game :: game |
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
505 |
where "zero_game \<equiv> Game zempty zempty" |
19203 | 506 |
|
35440 | 507 |
function |
508 |
plus_game :: "game \<Rightarrow> game \<Rightarrow> game" |
|
509 |
where |
|
510 |
[simp del]: "plus_game G H = Game (zunion (zimage (\<lambda> g. plus_game g H) (left_options G)) |
|
511 |
(zimage (\<lambda> h. plus_game G h) (left_options H))) |
|
512 |
(zunion (zimage (\<lambda> g. plus_game g H) (right_options G)) |
|
513 |
(zimage (\<lambda> h. plus_game G h) (right_options H)))" |
|
514 |
by auto |
|
515 |
termination by (relation "gprod_2_2 option_of") |
|
516 |
(simp, auto simp: gprod_2_2_def) |
|
19203 | 517 |
|
35440 | 518 |
lemma plus_game_comm: "plus_game G H = plus_game H G" |
19203 | 519 |
proof (induct G H rule: plus_game.induct) |
520 |
case (1 G H) |
|
521 |
show ?case |
|
522 |
by (auto simp add: |
|
523 |
plus_game.simps[where G=G and H=H] |
|
524 |
plus_game.simps[where G=H and H=G] |
|
41528 | 525 |
Game_ext zet_ext_eq zunion zimage_iff 1) |
19203 | 526 |
qed |
527 |
||
528 |
lemma game_ext_eq: "(G = H) = (left_options G = left_options H \<and> right_options G = right_options H)" |
|
529 |
proof - |
|
530 |
have "(G = H) = (Game (left_options G) (right_options G) = Game (left_options H) (right_options H))" |
|
531 |
by (simp add: game_split[symmetric]) |
|
532 |
then show ?thesis by auto |
|
533 |
qed |
|
534 |
||
535 |
lemma left_zero_game[simp]: "left_options (zero_game) = zempty" |
|
536 |
by (simp add: zero_game_def) |
|
537 |
||
538 |
lemma right_zero_game[simp]: "right_options (zero_game) = zempty" |
|
539 |
by (simp add: zero_game_def) |
|
540 |
||
35440 | 541 |
lemma plus_game_zero_right[simp]: "plus_game G zero_game = G" |
19203 | 542 |
proof - |
543 |
{ |
|
544 |
fix G H |
|
35440 | 545 |
have "H = zero_game \<longrightarrow> plus_game G H = G " |
19203 | 546 |
proof (induct G H rule: plus_game.induct, rule impI) |
547 |
case (goal1 G H) |
|
41528 | 548 |
note induct_hyp = this[simplified goal1, simplified] and this |
19203 | 549 |
show ?case |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
550 |
apply (simp only: plus_game.simps[where G=G and H=H]) |
41528 | 551 |
apply (simp add: game_ext_eq goal1) |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
552 |
apply (auto simp add: |
35440 | 553 |
zimage_cong[where f = "\<lambda> g. plus_game g zero_game" and g = "id"] |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
554 |
induct_hyp) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
555 |
done |
19203 | 556 |
qed |
557 |
} |
|
558 |
then show ?thesis by auto |
|
559 |
qed |
|
560 |
||
35440 | 561 |
lemma plus_game_zero_left: "plus_game zero_game G = G" |
19203 | 562 |
by (simp add: plus_game_comm) |
563 |
||
564 |
lemma left_imp_options[simp]: "zin opt (left_options g) \<Longrightarrow> zin opt (options g)" |
|
565 |
by (simp add: options_def zunion) |
|
566 |
||
567 |
lemma right_imp_options[simp]: "zin opt (right_options g) \<Longrightarrow> zin opt (options g)" |
|
568 |
by (simp add: options_def zunion) |
|
569 |
||
570 |
lemma left_options_plus: |
|
35440 | 571 |
"left_options (plus_game u v) = zunion (zimage (\<lambda>g. plus_game g v) (left_options u)) (zimage (\<lambda>h. plus_game u h) (left_options v))" |
19203 | 572 |
by (subst plus_game.simps, simp) |
573 |
||
574 |
lemma right_options_plus: |
|
35440 | 575 |
"right_options (plus_game u v) = zunion (zimage (\<lambda>g. plus_game g v) (right_options u)) (zimage (\<lambda>h. plus_game u h) (right_options v))" |
19203 | 576 |
by (subst plus_game.simps, simp) |
577 |
||
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
578 |
lemma left_options_neg: "left_options (neg_game u) = zimage neg_game (right_options u)" |
19203 | 579 |
by (subst neg_game.simps, simp) |
580 |
||
581 |
lemma right_options_neg: "right_options (neg_game u) = zimage neg_game (left_options u)" |
|
582 |
by (subst neg_game.simps, simp) |
|
583 |
||
35440 | 584 |
lemma plus_game_assoc: "plus_game (plus_game F G) H = plus_game F (plus_game G H)" |
19203 | 585 |
proof - |
586 |
{ |
|
587 |
fix a |
|
35440 | 588 |
have "\<forall> F G H. a = [F, G, H] \<longrightarrow> plus_game (plus_game F G) H = plus_game F (plus_game G H)" |
19203 | 589 |
proof (induct a rule: induct_game, (rule impI | rule allI)+) |
590 |
case (goal1 x F G H) |
|
35440 | 591 |
let ?L = "plus_game (plus_game F G) H" |
592 |
let ?R = "plus_game F (plus_game G H)" |
|
19203 | 593 |
note options_plus = left_options_plus right_options_plus |
594 |
{ |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
595 |
fix opt |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
596 |
note hyp = goal1(1)[simplified goal1(2), rule_format] |
35440 | 597 |
have F: "zin opt (options F) \<Longrightarrow> plus_game (plus_game opt G) H = plus_game opt (plus_game G H)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
598 |
by (blast intro: hyp lprod_3_3) |
35440 | 599 |
have G: "zin opt (options G) \<Longrightarrow> plus_game (plus_game F opt) H = plus_game F (plus_game opt H)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
600 |
by (blast intro: hyp lprod_3_4) |
35440 | 601 |
have H: "zin opt (options H) \<Longrightarrow> plus_game (plus_game F G) opt = plus_game F (plus_game G opt)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
602 |
by (blast intro: hyp lprod_3_5) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
603 |
note F and G and H |
19203 | 604 |
} |
605 |
note induct_hyp = this |
|
606 |
have "left_options ?L = left_options ?R \<and> right_options ?L = right_options ?R" |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
607 |
by (auto simp add: |
35440 | 608 |
plus_game.simps[where G="plus_game F G" and H=H] |
609 |
plus_game.simps[where G="F" and H="plus_game G H"] |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
610 |
zet_ext_eq zunion zimage_iff options_plus |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
611 |
induct_hyp left_imp_options right_imp_options) |
19203 | 612 |
then show ?case |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
613 |
by (simp add: game_ext_eq) |
19203 | 614 |
qed |
615 |
} |
|
616 |
then show ?thesis by auto |
|
617 |
qed |
|
618 |
||
35440 | 619 |
lemma neg_plus_game: "neg_game (plus_game G H) = plus_game (neg_game G) (neg_game H)" |
19203 | 620 |
proof (induct G H rule: plus_game.induct) |
621 |
case (1 G H) |
|
622 |
note opt_ops = |
|
623 |
left_options_plus right_options_plus |
|
624 |
left_options_neg right_options_neg |
|
625 |
show ?case |
|
626 |
by (auto simp add: opt_ops |
|
35440 | 627 |
neg_game.simps[of "plus_game G H"] |
19203 | 628 |
plus_game.simps[of "neg_game G" "neg_game H"] |
41528 | 629 |
Game_ext zet_ext_eq zunion zimage_iff 1) |
19203 | 630 |
qed |
631 |
||
35440 | 632 |
lemma eq_game_plus_inverse: "eq_game (plus_game x (neg_game x)) zero_game" |
19203 | 633 |
proof (induct x rule: wf_induct[OF wf_option_of]) |
634 |
case (goal1 x) |
|
635 |
{ fix y |
|
636 |
assume "zin y (options x)" |
|
35440 | 637 |
then have "eq_game (plus_game y (neg_game y)) zero_game" |
41528 | 638 |
by (auto simp add: goal1) |
19203 | 639 |
} |
640 |
note ihyp = this |
|
641 |
{ |
|
642 |
fix y |
|
643 |
assume y: "zin y (right_options x)" |
|
35440 | 644 |
have "\<not> (ge_game (zero_game, plus_game y (neg_game x)))" |
19203 | 645 |
apply (subst ge_game.simps, simp) |
35440 | 646 |
apply (rule exI[where x="plus_game y (neg_game y)"]) |
19203 | 647 |
apply (auto simp add: ihyp[of y, simplified y right_imp_options eq_game_def]) |
41528 | 648 |
apply (auto simp add: left_options_plus left_options_neg zunion zimage_iff intro: y) |
19203 | 649 |
done |
650 |
} |
|
651 |
note case1 = this |
|
652 |
{ |
|
653 |
fix y |
|
654 |
assume y: "zin y (left_options x)" |
|
35440 | 655 |
have "\<not> (ge_game (zero_game, plus_game x (neg_game y)))" |
19203 | 656 |
apply (subst ge_game.simps, simp) |
35440 | 657 |
apply (rule exI[where x="plus_game y (neg_game y)"]) |
19203 | 658 |
apply (auto simp add: ihyp[of y, simplified y left_imp_options eq_game_def]) |
41528 | 659 |
apply (auto simp add: left_options_plus zunion zimage_iff intro: y) |
19203 | 660 |
done |
661 |
} |
|
662 |
note case2 = this |
|
663 |
{ |
|
664 |
fix y |
|
665 |
assume y: "zin y (left_options x)" |
|
35440 | 666 |
have "\<not> (ge_game (plus_game y (neg_game x), zero_game))" |
19203 | 667 |
apply (subst ge_game.simps, simp) |
35440 | 668 |
apply (rule exI[where x="plus_game y (neg_game y)"]) |
19203 | 669 |
apply (auto simp add: ihyp[of y, simplified y left_imp_options eq_game_def]) |
41528 | 670 |
apply (auto simp add: right_options_plus right_options_neg zunion zimage_iff intro: y) |
19203 | 671 |
done |
672 |
} |
|
673 |
note case3 = this |
|
674 |
{ |
|
675 |
fix y |
|
676 |
assume y: "zin y (right_options x)" |
|
35440 | 677 |
have "\<not> (ge_game (plus_game x (neg_game y), zero_game))" |
19203 | 678 |
apply (subst ge_game.simps, simp) |
35440 | 679 |
apply (rule exI[where x="plus_game y (neg_game y)"]) |
19203 | 680 |
apply (auto simp add: ihyp[of y, simplified y right_imp_options eq_game_def]) |
41528 | 681 |
apply (auto simp add: right_options_plus zunion zimage_iff intro: y) |
19203 | 682 |
done |
683 |
} |
|
684 |
note case4 = this |
|
685 |
show ?case |
|
686 |
apply (simp add: eq_game_def) |
|
35440 | 687 |
apply (simp add: ge_game.simps[of "plus_game x (neg_game x)" "zero_game"]) |
688 |
apply (simp add: ge_game.simps[of "zero_game" "plus_game x (neg_game x)"]) |
|
19203 | 689 |
apply (simp add: right_options_plus left_options_plus right_options_neg left_options_neg zunion zimage_iff) |
690 |
apply (auto simp add: case1 case2 case3 case4) |
|
691 |
done |
|
692 |
qed |
|
693 |
||
35440 | 694 |
lemma ge_plus_game_left: "ge_game (y,z) = ge_game (plus_game x y, plus_game x z)" |
19203 | 695 |
proof - |
696 |
{ fix a |
|
35440 | 697 |
have "\<forall> x y z. a = [x,y,z] \<longrightarrow> ge_game (y,z) = ge_game (plus_game x y, plus_game x z)" |
19203 | 698 |
proof (induct a rule: induct_game, (rule impI | rule allI)+) |
699 |
case (goal1 a x y z) |
|
700 |
note induct_hyp = goal1(1)[rule_format, simplified goal1(2)] |
|
701 |
{ |
|
35440 | 702 |
assume hyp: "ge_game(plus_game x y, plus_game x z)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
703 |
have "ge_game (y, z)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
704 |
proof - |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
705 |
{ fix yr |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
706 |
assume yr: "zin yr (right_options y)" |
35440 | 707 |
from hyp have "\<not> (ge_game (plus_game x z, plus_game x yr))" |
708 |
by (auto simp add: ge_game_eq[of "plus_game x y" "plus_game x z"] |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
709 |
right_options_plus zunion zimage_iff intro: yr) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
710 |
then have "\<not> (ge_game (z, yr))" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
711 |
apply (subst induct_hyp[where y="[x, z, yr]", of "x" "z" "yr"]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
712 |
apply (simp_all add: yr lprod_3_6) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
713 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
714 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
715 |
note yr = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
716 |
{ fix zl |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
717 |
assume zl: "zin zl (left_options z)" |
35440 | 718 |
from hyp have "\<not> (ge_game (plus_game x zl, plus_game x y))" |
719 |
by (auto simp add: ge_game_eq[of "plus_game x y" "plus_game x z"] |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
720 |
left_options_plus zunion zimage_iff intro: zl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
721 |
then have "\<not> (ge_game (zl, y))" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
722 |
apply (subst goal1(1)[rule_format, where y="[x, zl, y]", of "x" "zl" "y"]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
723 |
apply (simp_all add: goal1(2) zl lprod_3_7) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
724 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
725 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
726 |
note zl = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
727 |
show "ge_game (y, z)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
728 |
apply (subst ge_game_eq) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
729 |
apply (auto simp add: yr zl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
730 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
731 |
qed |
19203 | 732 |
} |
733 |
note right_imp_left = this |
|
734 |
{ |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
735 |
assume yz: "ge_game (y, z)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
736 |
{ |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
737 |
fix x' |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
738 |
assume x': "zin x' (right_options x)" |
35440 | 739 |
assume hyp: "ge_game (plus_game x z, plus_game x' y)" |
740 |
then have n: "\<not> (ge_game (plus_game x' y, plus_game x' z))" |
|
741 |
by (auto simp add: ge_game_eq[of "plus_game x z" "plus_game x' y"] |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
742 |
right_options_plus zunion zimage_iff intro: x') |
35440 | 743 |
have t: "ge_game (plus_game x' y, plus_game x' z)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
744 |
apply (subst induct_hyp[symmetric]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
745 |
apply (auto intro: lprod_3_3 x' yz) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
746 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
747 |
from n t have "False" by blast |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
748 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
749 |
note case1 = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
750 |
{ |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
751 |
fix x' |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
752 |
assume x': "zin x' (left_options x)" |
35440 | 753 |
assume hyp: "ge_game (plus_game x' z, plus_game x y)" |
754 |
then have n: "\<not> (ge_game (plus_game x' y, plus_game x' z))" |
|
755 |
by (auto simp add: ge_game_eq[of "plus_game x' z" "plus_game x y"] |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
756 |
left_options_plus zunion zimage_iff intro: x') |
35440 | 757 |
have t: "ge_game (plus_game x' y, plus_game x' z)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
758 |
apply (subst induct_hyp[symmetric]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
759 |
apply (auto intro: lprod_3_3 x' yz) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
760 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
761 |
from n t have "False" by blast |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
762 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
763 |
note case3 = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
764 |
{ |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
765 |
fix y' |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
766 |
assume y': "zin y' (right_options y)" |
35440 | 767 |
assume hyp: "ge_game (plus_game x z, plus_game x y')" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
768 |
then have "ge_game(z, y')" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
769 |
apply (subst induct_hyp[of "[x, z, y']" "x" "z" "y'"]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
770 |
apply (auto simp add: hyp lprod_3_6 y') |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
771 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
772 |
with yz have "ge_game (y, y')" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
773 |
by (blast intro: ge_game_trans) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
774 |
with y' have "False" by (auto simp add: ge_game_leftright_refl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
775 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
776 |
note case2 = this |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
777 |
{ |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
778 |
fix z' |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
779 |
assume z': "zin z' (left_options z)" |
35440 | 780 |
assume hyp: "ge_game (plus_game x z', plus_game x y)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
781 |
then have "ge_game(z', y)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
782 |
apply (subst induct_hyp[of "[x, z', y]" "x" "z'" "y"]) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
783 |
apply (auto simp add: hyp lprod_3_7 z') |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
784 |
done |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
785 |
with yz have "ge_game (z', z)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
786 |
by (blast intro: ge_game_trans) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
787 |
with z' have "False" by (auto simp add: ge_game_leftright_refl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
788 |
} |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
789 |
note case4 = this |
35440 | 790 |
have "ge_game(plus_game x y, plus_game x z)" |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
791 |
apply (subst ge_game_eq) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
792 |
apply (auto simp add: right_options_plus left_options_plus zunion zimage_iff) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
793 |
apply (auto intro: case1 case2 case3 case4) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
794 |
done |
19203 | 795 |
} |
796 |
note left_imp_right = this |
|
797 |
show ?case by (auto intro: right_imp_left left_imp_right) |
|
798 |
qed |
|
799 |
} |
|
800 |
note a = this[of "[x, y, z]"] |
|
801 |
then show ?thesis by blast |
|
802 |
qed |
|
803 |
||
35440 | 804 |
lemma ge_plus_game_right: "ge_game (y,z) = ge_game(plus_game y x, plus_game z x)" |
19203 | 805 |
by (simp add: ge_plus_game_left plus_game_comm) |
806 |
||
807 |
lemma ge_neg_game: "ge_game (neg_game x, neg_game y) = ge_game (y, x)" |
|
808 |
proof - |
|
809 |
{ fix a |
|
810 |
have "\<forall> x y. a = [x, y] \<longrightarrow> ge_game (neg_game x, neg_game y) = ge_game (y, x)" |
|
811 |
proof (induct a rule: induct_game, (rule impI | rule allI)+) |
|
812 |
case (goal1 a x y) |
|
813 |
note ihyp = goal1(1)[rule_format, simplified goal1(2)] |
|
814 |
{ fix xl |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
815 |
assume xl: "zin xl (left_options x)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
816 |
have "ge_game (neg_game y, neg_game xl) = ge_game (xl, y)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
817 |
apply (subst ihyp) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
818 |
apply (auto simp add: lprod_2_1 xl) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
819 |
done |
19203 | 820 |
} |
821 |
note xl = this |
|
822 |
{ fix yr |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
823 |
assume yr: "zin yr (right_options y)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
824 |
have "ge_game (neg_game yr, neg_game x) = ge_game (x, yr)" |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
825 |
apply (subst ihyp) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
826 |
apply (auto simp add: lprod_2_2 yr) |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
827 |
done |
19203 | 828 |
} |
829 |
note yr = this |
|
830 |
show ?case |
|
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
831 |
by (auto simp add: ge_game_eq[of "neg_game x" "neg_game y"] ge_game_eq[of "y" "x"] |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30198
diff
changeset
|
832 |
right_options_neg left_options_neg zimage_iff xl yr) |
19203 | 833 |
qed |
834 |
} |
|
835 |
note a = this[of "[x,y]"] |
|
836 |
then show ?thesis by blast |
|
837 |
qed |
|
838 |
||
35416
d8d7d1b785af
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents:
35028
diff
changeset
|
839 |
definition eq_game_rel :: "(game * game) set" where |
19203 | 840 |
"eq_game_rel \<equiv> { (p, q) . eq_game p q }" |
841 |
||
842 |
typedef Pg = "UNIV//eq_game_rel" |
|
843 |
by (auto simp add: quotient_def) |
|
844 |
||
845 |
lemma equiv_eq_game[simp]: "equiv UNIV eq_game_rel" |
|
30198 | 846 |
by (auto simp add: equiv_def refl_on_def sym_def trans_def eq_game_rel_def |
19203 | 847 |
eq_game_sym intro: eq_game_refl eq_game_trans) |
848 |
||
25764 | 849 |
instantiation Pg :: "{ord, zero, plus, minus, uminus}" |
850 |
begin |
|
851 |
||
852 |
definition |
|
853 |
Pg_zero_def: "0 = Abs_Pg (eq_game_rel `` {zero_game})" |
|
854 |
||
855 |
definition |
|
856 |
Pg_le_def: "G \<le> H \<longleftrightarrow> (\<exists> g h. g \<in> Rep_Pg G \<and> h \<in> Rep_Pg H \<and> ge_game (h, g))" |
|
857 |
||
858 |
definition |
|
859 |
Pg_less_def: "G < H \<longleftrightarrow> G \<le> H \<and> G \<noteq> (H::Pg)" |
|
19203 | 860 |
|
25764 | 861 |
definition |
39910 | 862 |
Pg_minus_def: "- G = the_elem (\<Union> g \<in> Rep_Pg G. {Abs_Pg (eq_game_rel `` {neg_game g})})" |
25764 | 863 |
|
864 |
definition |
|
39910 | 865 |
Pg_plus_def: "G + H = the_elem (\<Union> g \<in> Rep_Pg G. \<Union> h \<in> Rep_Pg H. {Abs_Pg (eq_game_rel `` {plus_game g h})})" |
25764 | 866 |
|
867 |
definition |
|
868 |
Pg_diff_def: "G - H = G + (- (H::Pg))" |
|
869 |
||
870 |
instance .. |
|
871 |
||
872 |
end |
|
19203 | 873 |
|
874 |
lemma Rep_Abs_eq_Pg[simp]: "Rep_Pg (Abs_Pg (eq_game_rel `` {g})) = eq_game_rel `` {g}" |
|
875 |
apply (subst Abs_Pg_inverse) |
|
876 |
apply (auto simp add: Pg_def quotient_def) |
|
877 |
done |
|
878 |
||
879 |
lemma char_Pg_le[simp]: "(Abs_Pg (eq_game_rel `` {g}) \<le> Abs_Pg (eq_game_rel `` {h})) = (ge_game (h, g))" |
|
880 |
apply (simp add: Pg_le_def) |
|
881 |
apply (auto simp add: eq_game_rel_def eq_game_def intro: ge_game_trans ge_game_refl) |
|
882 |
done |
|
883 |
||
884 |
lemma char_Pg_eq[simp]: "(Abs_Pg (eq_game_rel `` {g}) = Abs_Pg (eq_game_rel `` {h})) = (eq_game g h)" |
|
885 |
apply (simp add: Rep_Pg_inject [symmetric]) |
|
886 |
apply (subst eq_equiv_class_iff[of UNIV]) |
|
887 |
apply (simp_all) |
|
888 |
apply (simp add: eq_game_rel_def) |
|
889 |
done |
|
890 |
||
35440 | 891 |
lemma char_Pg_plus[simp]: "Abs_Pg (eq_game_rel `` {g}) + Abs_Pg (eq_game_rel `` {h}) = Abs_Pg (eq_game_rel `` {plus_game g h})" |
19203 | 892 |
proof - |
35440 | 893 |
have "(\<lambda> g h. {Abs_Pg (eq_game_rel `` {plus_game g h})}) respects2 eq_game_rel" |
19203 | 894 |
apply (simp add: congruent2_def) |
895 |
apply (auto simp add: eq_game_rel_def eq_game_def) |
|
40824 | 896 |
apply (rule_tac y="plus_game a ba" in ge_game_trans) |
19203 | 897 |
apply (simp add: ge_plus_game_left[symmetric] ge_plus_game_right[symmetric])+ |
40824 | 898 |
apply (rule_tac y="plus_game b aa" in ge_game_trans) |
19203 | 899 |
apply (simp add: ge_plus_game_left[symmetric] ge_plus_game_right[symmetric])+ |
900 |
done |
|
901 |
then show ?thesis |
|
902 |
by (simp add: Pg_plus_def UN_equiv_class2[OF equiv_eq_game equiv_eq_game]) |
|
903 |
qed |
|
904 |
||
905 |
lemma char_Pg_minus[simp]: "- Abs_Pg (eq_game_rel `` {g}) = Abs_Pg (eq_game_rel `` {neg_game g})" |
|
906 |
proof - |
|
907 |
have "(\<lambda> g. {Abs_Pg (eq_game_rel `` {neg_game g})}) respects eq_game_rel" |
|
908 |
apply (simp add: congruent_def) |
|
909 |
apply (auto simp add: eq_game_rel_def eq_game_def ge_neg_game) |
|
910 |
done |
|
911 |
then show ?thesis |
|
912 |
by (simp add: Pg_minus_def UN_equiv_class[OF equiv_eq_game]) |
|
913 |
qed |
|
914 |
||
915 |
lemma eq_Abs_Pg[rule_format, cases type: Pg]: "(\<forall> g. z = Abs_Pg (eq_game_rel `` {g}) \<longrightarrow> P) \<longrightarrow> P" |
|
916 |
apply (cases z, simp) |
|
917 |
apply (simp add: Rep_Pg_inject[symmetric]) |
|
918 |
apply (subst Abs_Pg_inverse, simp) |
|
919 |
apply (auto simp add: Pg_def quotient_def) |
|
920 |
done |
|
921 |
||
35028
108662d50512
more consistent naming of type classes involving orderings (and lattices) -- c.f. NEWS
haftmann
parents:
32960
diff
changeset
|
922 |
instance Pg :: ordered_ab_group_add |
19203 | 923 |
proof |
924 |
fix a b c :: Pg |
|
925 |
show "a - b = a + (- b)" by (simp add: Pg_diff_def) |
|
926 |
{ |
|
927 |
assume ab: "a \<le> b" |
|
928 |
assume ba: "b \<le> a" |
|
929 |
from ab ba show "a = b" |
|
930 |
apply (cases a, cases b) |
|
931 |
apply (simp add: eq_game_def) |
|
932 |
done |
|
933 |
} |
|
27679 | 934 |
then show "(a < b) = (a \<le> b \<and> \<not> b \<le> a)" by (auto simp add: Pg_less_def) |
19203 | 935 |
show "a + b = b + a" |
936 |
apply (cases a, cases b) |
|
937 |
apply (simp add: eq_game_def plus_game_comm) |
|
938 |
done |
|
939 |
show "a + b + c = a + (b + c)" |
|
940 |
apply (cases a, cases b, cases c) |
|
941 |
apply (simp add: eq_game_def plus_game_assoc) |
|
942 |
done |
|
943 |
show "0 + a = a" |
|
944 |
apply (cases a) |
|
945 |
apply (simp add: Pg_zero_def plus_game_zero_left) |
|
946 |
done |
|
947 |
show "- a + a = 0" |
|
948 |
apply (cases a) |
|
949 |
apply (simp add: Pg_zero_def eq_game_plus_inverse plus_game_comm) |
|
950 |
done |
|
951 |
show "a \<le> a" |
|
952 |
apply (cases a) |
|
953 |
apply (simp add: ge_game_refl) |
|
954 |
done |
|
955 |
{ |
|
956 |
assume ab: "a \<le> b" |
|
957 |
assume bc: "b \<le> c" |
|
958 |
from ab bc show "a \<le> c" |
|
959 |
apply (cases a, cases b, cases c) |
|
960 |
apply (auto intro: ge_game_trans) |
|
961 |
done |
|
962 |
} |
|
963 |
{ |
|
964 |
assume ab: "a \<le> b" |
|
965 |
from ab show "c + a \<le> c + b" |
|
966 |
apply (cases a, cases b, cases c) |
|
967 |
apply (simp add: ge_plus_game_left[symmetric]) |
|
968 |
done |
|
969 |
} |
|
970 |
qed |
|
971 |
||
972 |
end |