forked from PierreLescanne/DependentTypesForExtensiveGames
-
Notifications
You must be signed in to change notification settings - Fork 0
/
games_Ut_Ch_Dependent.v
349 lines (288 loc) · 10.6 KB
/
games_Ut_Ch_Dependent.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
(* Time-stamp: "2018-02-08 15:51:22 pierre" *)
(****************************************************************)
(* games.v *)
(* *)
(** © Pierre Lescanne (December 2015) *)
(* *)
(* LIP (ENS-Lyon, CNRS, INRIA) *)
(* *)
(* *)
(* Developed in V8.6 January 2016 *)
(****************************************************************)
Require Import List.
Require Import Relations.
Section Games.
(* Agents, Choices and Utilities *)
Variable Agent : Set.
Variable Choice Utility: Agent -> Set.
(* Finiteness of Choice *)
Variable finite: Set -> Prop.
(* preference on Utility *)
Variable pref : forall a: Agent, relation (Utility a).
Hypothesis pref_is_preorder: forall a: Agent, preorder (Utility a) (pref a).
(* Strategy profiles *)
CoInductive StratProf : Set :=
| sLeaf : (forall a:Agent, Utility a) -> StratProf
| sNode : forall (a:Agent),
Choice a -> (Choice a -> StratProf) -> StratProf.
Notation "<< f >>" := (sLeaf f).
Notation "<< a , c , next >>" := (sNode a c next).
Definition StratProf_identity (s:StratProf): StratProf :=
match (s:StratProf) return StratProf with
| <<f>> => <<f>>
| <<a,c,next>> => <<a,c,next>>
end.
Lemma StratProf_decomposition :
forall s:StratProf, StratProf_identity s = s.
Proof.
destruct s; reflexivity.
Qed.
(* Games *)
CoInductive Game : Set :=
| gLeaf : (forall a:Agent, Utility a) -> Game
| gNode : forall (a:Agent), (Choice a -> Game) -> Game.
Notation "<| f |>" := (gLeaf f).
Notation "<| a , next |>" := (gNode a next).
Definition Game_identity (g:Game): Game :=
match g with
| <|f|> => <|f|>
| <|a,next|> => <|a,next|>
end.
Lemma Game_decomposition :
forall g:Game, Game_identity g = g.
Proof.
destruct g; reflexivity.
Qed.
(** - Equality of Games *)
CoInductive gEqual: Game -> Game -> Prop :=
| gEqualLeaf: forall f, gEqual (<| f |>) (<| f |>)
| gEqualNode: forall (a:Agent)(next next':Choice a->Game),
(forall (c:Choice a), gEqual (next c) (next' c)) ->
gEqual (<|a,next|>) (<|a,next'|>).
Lemma refGEqual: forall g, gEqual g g.
Proof.
cofix refGEqual.
destruct g.
apply gEqualLeaf.
apply gEqualNode.
intros.
apply refGEqual.
Qed.
Notation "g == g'" := (gEqual g g') (at level 80).
Definition game : StratProf -> Game :=
cofix game_co (s : StratProf) : Game :=
match s with
| << f >> => <| f |>
| << a, _, next >> => <| a, fun c : Choice a => game_co (next c) |>
end.
Lemma gameLeaf: forall f, game <<f>> = <|f|>.
Proof.
intro.
rewrite <- Game_decomposition with (g:= game <<f>>).
simpl.
reflexivity.
Qed.
Lemma gameNode: forall a c next, game <<a,c,next>> = <|a,fun c => game(next c)|>.
Proof.
intros.
rewrite <- Game_decomposition with (g:= game <<a,c,next>>).
simpl.
reflexivity.
Qed.
Inductive Convergent: StratProf -> Prop :=
| ConvLeaf: forall f, Convergent <<f>>
| ConvNode: forall (a:Agent) (c:Choice a)(next: Choice a -> StratProf),
Convergent (next c) ->
Convergent <<a,c,next>>.
Notation "↓ s " := (Convergent s) (at level 5).
Inductive convergent : StratProf -> Set :=
| convLeaf: forall f, convergent <<f>>
| convNode: forall (a:Agent)(c:Choice a)(next: Choice a -> StratProf),
convergent (next c) ->
convergent <<a,c,next>>.
Notation "↓↓ s " := (convergent s) (at level 5).
(* Always *)
CoInductive Always (P:StratProf -> Prop) : StratProf -> Prop :=
| AlwaysLeaf : forall f, Always P (<<f>>)
| AlwaysNode : forall (a:Agent)(c:Choice a)
(next:Choice a->StratProf),
P (<<a,c,next>>) -> (forall c', Always P (next c')) ->
Always P (<<a,c,next>>).
Notation "□ P" := (Always P) (at level 30).
Definition AlwaysConvergent := □ (fun s:StratProf => (↓ (s))).
Notation "⇓ s" := (AlwaysConvergent s)
(at level 15).
(* Along P, means that the predicate P is fulfiled
along the path given by the choices *)
CoInductive Along
(P:StratProf -> Prop) : StratProf -> Prop :=
| AlongLeaf : forall f, Along P (<<f>>)
| AlongNode : forall (a:Agent)(c:Choice a)
(next:Choice a->StratProf),
P (<<a,c,next>>) -> Along P (next c) ->
Along P (<<a,c,next>>).
(* Utility assignment *)
Definition UAssignment (s:StratProf)(H:↓↓ s): forall a:Agent, Utility a.
induction H; assumption.
Defined.
Definition UAssignment': forall s : StratProf, convergent s -> (forall a:Agent, Utility a) :=
fun (s : StratProf) (H : convergent s) =>
convergent_rec (fun (s0 : StratProf) (_ : convergent s0) => (forall a:Agent, Utility a))
(fun f : (forall a:Agent, Utility a) => f)
(fun (a : Agent) (c : Choice a) (next : Choice a -> StratProf)
(_ : ↓↓ (next c)) (IHconvergent : (forall a:Agent, Utility a)) => IHconvergent) s H.
(* Utility assignment as a relation*)
Inductive Uassign : StratProf -> (forall a:Agent, Utility a) -> Prop :=
| UassignLeaf: forall f, Uassign (<<f>>) f
| UassignNode: forall (a:Agent)(c:Choice a)
(ua: forall a',Utility a')
(next:Choice a -> StratProf),
Uassign (next c) ua -> Uassign (<<a,c,next>>) ua.
Lemma Uassign_Uassignment:
forall (s:StratProf) (H: ↓↓ s), Uassign s (UAssignment s H).
Proof.
intros.
elim H.
simpl.
apply UassignLeaf.
intros.
simpl.
apply UassignNode.
assumption.
Qed.
(* == Inversion of Uassign == *)
(* Chlipala's solution *)
Lemma UassignNode_inv': forall (s:StratProf) (ua:forall a,Utility a),
Uassign s ua
-> match s with
| << a', c, next >> => Uassign (next c) ua
| _ => True
end.
Proof.
destruct 1; auto.
Qed.
Lemma UassignNode_inv: forall (a:Agent) (ua:forall a,Utility a)
(next:Choice a -> StratProf)
(c:Choice a),
Uassign (<<a,c,next>>) ua -> Uassign (next c) ua.
Proof.
intros.
apply UassignNode_inv' in H.
assumption.
Qed.
(* Monin's solution *)
Definition pr_Uassign {s} {ua} (x: Uassign s ua) :=
let diag s ua0 :=
match s with
| << f >> =>
forall X: (forall a, Utility a) -> Prop,
X f -> X ua0
| << a' , c , next >> =>
forall X: (forall a, Utility a) -> Prop,
(forall ua, Uassign (next c) ua -> X ua) -> X ua0
end in
match x in Uassign s ua return diag s ua with
| UassignLeaf f => fun X k => k
| UassignNode a c ut next ua => fun X k => k ut ua
end.
Lemma UassignNode_inv_Monin:
forall (a':Agent) (ua:forall a, Utility a) (next:Choice a' -> StratProf) (c:Choice a'),
Uassign (<<a',c,next>>) ua -> Uassign (next c) ua.
intros until c. intro H. apply (pr_Uassign H). trivial.
Qed.
Lemma UassignLeaf_inv:
forall (f ua:forall a, Utility a), Uassign << f >> ua -> ua = f.
intros f ua H. apply (pr_Uassign H). trivial.
Qed.
Lemma UniquenessUassign:
forall s ua ua', Uassign s ua -> Uassign s ua' -> ua=ua'.
Proof.
intros until ua'.
intros UassignU UassignV.
induction UassignV.
intros; apply UassignLeaf_inv; auto.
apply IHUassignV. apply UassignNode_inv_Monin. assumption.
Qed.
Lemma ExistenceUassign:
forall (s:StratProf),
(↓ s) -> exists (ua: forall a, Utility a), Uassign s ua.
Proof.
intros s ConvS.
elim ConvS.
intro.
exists f.
apply UassignLeaf.
intros a0 c next ConvNextS Exu.
elim Exu.
intro u. exists u.
apply UassignNode.
assumption.
Qed.
(* Finite Game *)
Inductive Finite : Game -> Set :=
| finGLeaf: forall f, Finite <|f|>
| finGNode: forall (a:Agent)(next: Choice a -> Game),
finite (Choice a) ->
(forall c:Choice a, Finite (next c)) ->
Finite <|a,next|>.
(* Finite Strategy Profile *)
Inductive FiniteStratProf : StratProf -> Prop :=
| finSLeaf: forall f, FiniteStratProf <<f>>
| finSNode: forall (a:Agent)(c:Choice a)(next: Choice a -> StratProf),
finite (Choice a) ->
(forall c':Choice a, FiniteStratProf (next c')) ->
FiniteStratProf <<a,c,next>>.
(* Finitely broad game *)
Definition FinitelyBroad (g:Game): Prop :=
exists (l: list StratProf), forall (s:StratProf),
game s == g <-> In s l.
(* Finite History Game *)
Inductive FiniteHistoryGame : Game -> Prop :=
| finHorGLeaf: forall f, FiniteHistoryGame <|f|>
| finHorGNode: forall (a:Agent)(next: Choice a -> Game),
(forall c:Choice a, FiniteHistoryGame (next c)) ->
FiniteHistoryGame <|a,next|>.
(* Finite Horizon Strategy Profile *)
Inductive FiniteHistoryStratProf : StratProf -> Prop :=
| finHorSLeaf: forall f, FiniteHistoryStratProf <<f>>
| finHorSNode: forall (a:Agent) (c:Choice a)
(next: Choice a -> StratProf),
(forall c':Choice a, FiniteHistoryStratProf (next c')) ->
FiniteHistoryStratProf <<a,c,next>>.
(* == Subgame Perfect Equilibrium == *)
CoInductive SPE : StratProf -> Prop :=
| SPELeaf : forall (f: forall a:Agent, Utility a), SPE <<f>>
| SPENode : forall (a:Agent)
(c c':Choice a)
(next:Choice a->StratProf)
(ua ua':forall a':Agent, Utility a'),
⇓ <<a,c,next>> ->
Uassign (next c') ua' -> Uassign (next c) ua ->
(pref a (ua' a) (ua a)) -> SPE (next c') ->
SPE <<a,c,next>>.
End Games.
Section Divergence.
(* Agents and Choices *)
Variable Agent : Set.
Variable Choice : Agent -> Set.
(* Utilities *)
Variable Utility: Agent -> Set.
Definition StPr := StratProf Agent Choice Utility.
(* preference on Utility *)
Variable pref: forall a: Agent, relation (Utility a).
Arguments game [Agent Choice Utility] s.
Arguments SPE [Agent Choice Utility] pref s.
Notation "<< f >>" := (sLeaf Agent Choice Utility f).
Notation "<< a , c , next >>" := (sNode Agent Choice Utility a c next).
Notation "g == g'" := (gEqual Agent Choice Utility g g') (at level 80).
CoInductive Divergent : StratProf Agent Choice Utility -> Prop :=
| divNode : forall (a:Agent)(c:Choice a)(next:Choice a->StPr),
Divergent (next c) -> Divergent (<<a,c,next>>).
CoInductive good : StratProf Agent Choice Utility -> Prop :=
| goodNode :forall (a:Agent)(c:Choice a)
(next next':Choice a -> StPr),
game (<<a,c,next>>) == game (<<a,c,next'>>) ->
SPE pref (<<a,c,next'>>) ->
good(<<a,c,next>>).
Definition AlongGood := Along Agent Choice Utility good.
End Divergence.