-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChapter_11.v
294 lines (243 loc) · 5.63 KB
/
Chapter_11.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
Require Import Coqingbird.Chapter_9.
Definition bluebird B := forall x y z, B $ x $ y $ z = x $ (y $ z).
Theorem Problem_1 :
forall B, bluebird B ->
forall C D, exists E, composes C D E.
Proof.
intros.
exists (B $ C $ D).
congruence.
Qed.
Theorem Problem_2 :
forall B, bluebird B ->
forall M, mockingbird M ->
forall x, exists Yx, fond x Yx.
Proof.
(*Yx = M(x.M) = M(BxM)*)
intros.
exists (M $ (B $ x $ M)).
congruence.
Qed.
Theorem Problem_3 :
forall B, bluebird B -> forall M, mockingbird M ->
exists E, egocentric E.
Proof.
(*E = M(M.M) = M(BMM)*)
intros.
exists (M $ (B $ M $ M)).
congruence.
Qed.
Theorem Problem_4 :
forall B, bluebird B -> forall M, mockingbird M -> forall K, kestrel K ->
exists HE, hopelessly_egocentric HE.
Proof.
intros.
exists (M $ (B $ K $ M)).
congruence.
Qed.
Definition dove D := forall x y z w, D $ x $ y $ z $ w = x $ y $ (z $ w).
Theorem Problem_5 :
forall B, bluebird B -> exists D, dove D.
Proof.
intros.
exists (B $ B).
congruence.
Qed.
Definition blackbird B1 := forall x y z w, B1 $ x $ y $ z $ w = x $ (y $ z $ w).
Theorem Problem_6 :
forall B, bluebird B -> exists B1, blackbird B1.
Proof.
intros.
exists (B $ B $ B).
congruence.
Qed.
Definition eagle E := forall x y z w v, E $ x $ y $ z $ w $ v = x $ y $ (z $ w $ v).
Theorem Problem_7 :
forall B, bluebird B -> exists E, eagle E.
Proof.
intros.
exists (B $ (B $ B $ B)).
congruence.
Qed.
Definition bunting B2 := forall x y z w v, B2 $ x $ y $ z $ w $ v = x $ (y $ z $ w $ v).
Theorem Problem_8 :
forall B, bluebird B -> exists B2, bunting B2.
Proof.
intros.
exists (B $ B $ (B $ B $ B)).
congruence.
Qed.
Definition bunting' B2' := forall x y z w v u, B2' $ x $ y $ z $ w $ v $ u = x $ (y $ z $ w $ v $ u).
Theorem generalized_bunting :
forall B, bluebird B -> exists B2', bunting' B2'.
Proof.
intros.
exists (B $ B $ (B $ B $ (B $ B $ B))).
congruence.
Qed.
Definition dickcissel D1 := forall x y z w v, D1 $ x $ y $ z $ w $ v = x $ y $ z $ (w $ v).
Theorem Problem_9 :
forall B, bluebird B -> exists D1, dickcissel D1.
Proof.
intros.
exists (B $ (B $ B)).
congruence.
Qed.
Definition becard B3 := forall x y z w, B3 $ x $ y $ z $ w = x $ (y $ (z $ w)).
Theorem Problem_10 :
forall B, bluebird B -> exists B3, becard B3.
Proof.
intros.
exists (B $ (B $ B) $ B).
congruence.
Qed.
Definition dovekie D2 := forall x y z w v, D2 $ x $ y $ z $ w $ v = x $ (y $ z) $ (w $ v).
Theorem Problem_11 :
forall B, bluebird B -> exists D2, dovekie D2.
Proof.
intros.
exists (B $ (B $ (B $ B)) $ B).
congruence.
Qed.
Definition bald_eagle Ê := forall x y1 y2 y3 z1 z2 z3, Ê $ x $ y1 $ y2 $ y3 $ z1 $ z2 $ z3 = x $ (y1 $ y2 $ y3) $ (z1 $ z2 $ z3).
Lemma compose0 a b c :
a = b ->
a $ c = b $ c.
Proof.
congruence.
Qed.
Lemma compose1 B a b c d :
bluebird B ->
a = B $ b $ c $ d ->
a = b $ (c $ d).
Proof.
congruence.
Qed.
Hint Resolve compose0 : compositor.
Hint Resolve compose1 : compositor.
Theorem Problem_12 :
forall B, bluebird B -> exists Ê, bald_eagle Ê.
Proof.
unfold bald_eagle.
eauto 15 with compositor.
Qed.
Definition warbler W := forall x y, W $ x $ y = x $ y $ y.
Theorem Problem_14 :
forall W I, warbler W -> identity I -> exists M, mockingbird M.
Proof.
intros.
exists (W $ I).
congruence.
Qed.
Theorem Problem_15 :
forall W K, warbler W -> kestrel K -> exists I, identity I.
Proof.
intros.
exists (W $ K).
congruence.
Qed.
Theorem Problem_13 :
forall W K, warbler W -> kestrel K -> exists M, mockingbird M.
Proof.
(*Yes, the proof of this comes after Problems 14 and 15.*)
intros.
assert (exists I, identity I).
eapply Problem_15.
eassumption.
eassumption.
inversion H1.
eapply Problem_14.
eassumption.
eassumption.
Qed.
Definition cardinal C := forall x y z, C $ x $ y $ z = x $ z $ y.
Theorem Problem_16 :
forall C K, cardinal C -> kestrel K -> exists I, identity I.
Proof.
intros.
exists (C $ K $ K).
congruence.
Qed.
Definition thrush T := forall x y, T $ x $ y = y $ x.
Lemma identity_hint I a b :
identity I ->
a = I $ b ->
a = b.
Proof.
congruence.
Qed.
Lemma identity_hint2 I a b c :
identity I ->
a = I $ b $ c ->
a = b $ c.
Proof.
congruence.
Qed.
Lemma kestrel_hint K a b c :
kestrel K ->
a = K $ b $ c ->
a = b.
Proof.
congruence.
Qed.
Lemma cardinal_hint C a b c d:
cardinal C ->
a = C $ b $ c $ d ->
a = b $ d $ c.
Proof.
congruence.
Qed.
Lemma apply_hint a b c d :
a = b ->
c = d ->
a $ c = b $ d.
Proof.
congruence.
Qed.
Hint Resolve identity_hint : bird_hints.
Hint Resolve identity_hint2 : bird_hints.
Hint Resolve kestrel_hint : bird_hints.
Hint Resolve cardinal_hint : bird_hints.
Hint Resolve apply_hint : bird_hints.
Theorem Problem_17 :
forall C I, cardinal C -> identity I -> exists T, thrush T.
Proof.
unfold thrush.
eauto with bird_hints.
Qed.
(*Print Problem_17.*)
Theorem Problem_18 :
forall T, thrush T -> (forall B, exists B', fond B B') -> exists A, forall x, A $ x = x $ A.
Proof.
intros.
destruct H0 with T as [E].
exists E.
congruence.
Qed.
Lemma mockingbird_hint M x x' a :
mockingbird M ->
a = M $ x ->
x = x' ->
a = x' $ x.
Proof.
congruence.
Qed.
Lemma thrush_hint T x y a :
thrush T ->
a = T $ x $ y ->
a = y $ x.
Proof.
congruence.
Qed.
Hint Resolve mockingbird_hint : bird_hints.
Hint Resolve thrush_hint : bird_hints.
Hint Resolve compose1 : bird_hints.
Theorem Problem_19 :
forall B T M, bluebird B -> thrush T -> mockingbird M ->
exists A, forall x, A $ x = x $ A.
Proof.
intros.
exists (M $ (B $ T $ M)).
congruence.
Qed.
(*end*)