-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compactness.thy
374 lines (350 loc) Β· 13.6 KB
/
Compactness.thy
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
(* Formalization adapted from:
FabiΓ‘n Fernando Serrano SuΓ‘rez, "FormalizaciΓ³n en Isar de la
Meta-LΓ³gica de Primer Orden." PhD thesis,
Departamento de Ciencias de la ComputaciΓ³n e Inteligencia Artificial,
Universidad de Sevilla, Spain, 2012.
https://idus.us.es/handle/11441/57780. In Spanish *)
theory Compactness
imports Main
"HOL-Library.Countable_Set"
"ModelExistence/ModelExistence"
begin
lemma UnsatisfiableAtom:
shows "Β¬(satisfiable {F, Β¬.F})"
proof (rule notI)
assume hip: "satisfiable {F, Β¬.F}"
show "False"
proof -
have "βI. I model {F, Β¬.F}" using hip by(unfold satisfiable_def, auto)
then obtain I where I: "(t_v_evaluation I F) = Ttrue"
and "(t_v_evaluation I (Β¬.F)) = Ttrue"
by(unfold model_def, auto)
thus "False" by(auto simp add: v_negation_def)
qed
qed
lemma consistenceP_Prop1:
assumes "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
shows "(βP. Β¬ (Atom P β W β§ (Β¬. Atom P) β W))"
proof (rule allI notI)+
fix P
assume h1: "Atom P β W β§ (Β¬.Atom P) β W"
show "False"
proof -
have "{Atom P, (Β¬.Atom P)} β W" using h1 by simp
moreover
have "finite {Atom P, (Β¬.Atom P)}" by simp
ultimately
have "{Atom P, (Β¬.Atom P)} β W β§ finite {Atom P, (Β¬.Atom P)}" by simp
moreover
have "({Atom P, (Β¬.Atom P)}β W β§ finite {Atom P, (Β¬.Atom P)}) βΆ
satisfiable {Atom P, (Β¬.Atom P)}"
using assms by(rule_tac x = "{Atom P, (Β¬.Atom P)}" in allE, auto)
ultimately
have "satisfiable {Atom P, (Β¬.Atom P)}" by simp
thus "False" using UnsatisfiableAtom by auto
qed
qed
lemma UnsatisfiableFF:
shows "Β¬ (satisfiable {FF})"
proof -
have "β I. t_v_evaluation I FF = Ffalse" by simp
hence "β I. Β¬ (I model {FF})" by(unfold model_def, auto)
thus ?thesis by(unfold satisfiable_def, auto)
qed
lemma consistenceP_Prop2:
assumes "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
shows "FF β W"
proof (rule notI)
assume hip: "FF β W"
show "False"
proof -
have "{FF} β W" using hip by simp
moreover
have "finite {FF}" by simp
ultimately
have "{FF} β W β§ finite {FF}" by simp
moreover
have "({FF::'b formula} β W β§ finite {FF}) βΆ
satisfiable {FF::'b formula}"
using assms by(rule_tac x = "{FF::'b formula}" in allE, auto)
ultimately
have "satisfiable {FF::'b formula}" by simp
thus "False" using UnsatisfiableFF by auto
qed
qed
lemma UnsatisfiableFFa:
shows "Β¬ (satisfiable {Β¬.TT})"
proof -
have "β I. t_v_evaluation I TT = Ttrue" by simp
have "β I. t_v_evaluation I (Β¬.TT) = Ffalse" by(auto simp add:v_negation_def)
hence "β I. Β¬ (I model {Β¬.TT})" by(unfold model_def, auto)
thus ?thesis by(unfold satisfiable_def, auto)
qed
lemma consistenceP_Prop3:
assumes "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
shows "Β¬.TT β W"
proof (rule notI)
assume hip: "Β¬.TT β W"
show "False"
proof -
have "{Β¬.TT} β W" using hip by simp
moreover
have "finite {Β¬.TT}" by simp
ultimately
have "{Β¬.TT} β W β§ finite {Β¬.TT}" by simp
moreover
have "({Β¬.TT::'b formula} β W β§ finite {Β¬.TT}) βΆ
satisfiable {Β¬.TT::'b formula}"
using assms by(rule_tac x = "{Β¬.TT::'b formula}" in allE, auto)
ultimately
have "satisfiable {Β¬.TT::'b formula}" by simp
thus "False" using UnsatisfiableFFa by auto
qed
qed
lemma Subset_Sat:
assumes hip1: "satisfiable S" and hip2: "S'β S"
shows "satisfiable S'"
proof -
have "βI. β F β S. t_v_evaluation I F = Ttrue" using hip1
by (unfold satisfiable_def, unfold model_def, auto)
hence "βI. β F β S'. t_v_evaluation I F = Ttrue" using hip2 by auto
thus ?thesis by(unfold satisfiable_def, unfold model_def, auto)
qed
textβΉ βΊ
lemma satisfiableUnion1:
assumes "satisfiable (A βͺ {Β¬.Β¬.F})"
shows "satisfiable (A βͺ {F})"
proof -
have "βI. β G β (A βͺ {Β¬.Β¬.F}). t_v_evaluation I G = Ttrue"
using assms by(unfold satisfiable_def, unfold model_def, auto)
then obtain I where I: "β G β (A βͺ {Β¬.Β¬.F}). t_v_evaluation I G = Ttrue"
by auto
hence 1: "β G β A. t_v_evaluation I G = Ttrue"
and 2: "t_v_evaluation I (Β¬.Β¬.F) = Ttrue"
by auto
have "typeFormula (Β¬.Β¬.F) = NoNo" by auto
hence "t_v_evaluation I F = Ttrue" using EquivNoNoComp[of "Β¬.Β¬.F"] 2
by (unfold equivalent_def, unfold Comp1_def, auto)
hence "β G β A βͺ {F}. t_v_evaluation I G = Ttrue" using 1 by auto
thus "satisfiable (A βͺ {F})"
by(unfold satisfiable_def, unfold model_def, auto)
qed
lemma consistenceP_Prop4:
assumes hip1: "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
and hip2: "Β¬.Β¬.F β W"
shows "β (A::'b formula set). (Aβ W βͺ {F} β§ finite A) βΆ satisfiable A"
proof (rule allI, rule impI)+
fix A
assume hip: "A β W βͺ {F} β§ finite A"
show "satisfiable A"
proof -
have "A-{F} β W β§ finite (A-{F})" using hip by auto
hence "(A-{F}) βͺ {Β¬.Β¬.F} β W β§ finite ((A-{F}) βͺ {Β¬.Β¬.F})"
using hip2 by auto
hence "satisfiable ((A-{F}) βͺ {Β¬.Β¬.F})" using hip1 by auto
hence "satisfiable ((A-{F}) βͺ {F})" using satisfiableUnion1 by blast
moreover
have "Aβ (A-{F}) βͺ {F}" by auto
ultimately
show "satisfiable A" using Subset_Sat by auto
qed
qed
lemma satisfiableUnion2:
assumes hip1: "FormulaAlfa F" and hip2: "satisfiable (A βͺ {F})"
shows "satisfiable (A βͺ {Comp1 F,Comp2 F})"
proof -
have "βI.β G β A βͺ {F}. t_v_evaluation I G = Ttrue"
using hip2 by(unfold satisfiable_def, unfold model_def, auto)
then obtain I where I: "β G β A βͺ {F}. t_v_evaluation I G = Ttrue" by auto
hence 1: "β G β A. t_v_evaluation I G = Ttrue" and 2: "t_v_evaluation I F = Ttrue" by auto
have "typeFormula F = Alfa" using hip1 noAlfaBeta noAlfaNoNo by auto
hence "equivalent F (Comp1 F β§. Comp2 F)"
using 2 EquivAlfaComp[of F] by auto
hence "t_v_evaluation I (Comp1 F β§. Comp2 F) = Ttrue"
using 2 by( unfold equivalent_def, auto)
hence "t_v_evaluation I (Comp1 F) = Ttrue β§ t_v_evaluation I (Comp2 F) = Ttrue"
using ConjunctionValues by auto
hence "β G β A βͺ {Comp1 F, Comp2 F} . t_v_evaluation I G = Ttrue" using 1 by auto
thus "satisfiable (A βͺ {Comp1 F,Comp2 F})"
by (unfold satisfiable_def, unfold model_def, auto)
qed
lemma consistenceP_Prop5:
assumes hip0: "FormulaAlfa F"
and hip1: "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
and hip2: "F β W"
shows "β (A::'b formula set). (Aβ W βͺ {Comp1 F, Comp2 F} β§ finite A) βΆ
satisfiable A"
proof (rule allI, rule impI)+
fix A
assume hip: "A β W βͺ {Comp1 F, Comp2 F} β§ finite A"
show "satisfiable A"
proof -
have "A-{Comp1 F, Comp2 F} β W β§ finite (A-{Comp1 F, Comp2 F})"
using hip by auto
hence "(A-{Comp1 F, Comp2 F}) βͺ {F} β W β§
finite ((A-{Comp1 F, Comp2 F}) βͺ {F})"
using hip2 by auto
hence "satisfiable ((A-{Comp1 F, Comp2 F}) βͺ {F})"
using hip1 by auto
hence "satisfiable ((A-{Comp1 F, Comp2 F}) βͺ {Comp1 F, Comp2 F})"
using hip0 satisfiableUnion2 by auto
moreover
have "A β (A-{Comp1 F, Comp2 F}) βͺ {Comp1 F, Comp2 F}" by auto
ultimately
show "satisfiable A" using Subset_Sat by auto
qed
qed
lemma satisfiableUnion3:
assumes hip1: "FormulaBeta F" and hip2: "satisfiable (A βͺ {F})"
shows "satisfiable (A βͺ {Comp1 F}) β¨ satisfiable (A βͺ {Comp2 F})"
proof -
obtain I where I: "βG β (A βͺ {F}). t_v_evaluation I G = Ttrue"
using hip2 by(unfold satisfiable_def, unfold model_def, auto)
hence S1: "βG β A. t_v_evaluation I G = Ttrue"
and S2: " t_v_evaluation I F = Ttrue"
by auto
have V: "t_v_evaluation I (Comp1 F) = Ttrue β¨ t_v_evaluation I (Comp2 F) = Ttrue"
using hip1 S2 EquivBetaComp[of F] DisjunctionValues
by (unfold equivalent_def, auto)
have "((βG β A. t_v_evaluation I G = Ttrue) β§ t_v_evaluation I (Comp1 F) = Ttrue) β¨
((βG β A. t_v_evaluation I G = Ttrue) β§ t_v_evaluation I (Comp2 F) = Ttrue)"
using V
proof (rule disjE)
assume "t_v_evaluation I (Comp1 F) = Ttrue"
hence "(βG β A. t_v_evaluation I G = Ttrue) β§ t_v_evaluation I (Comp1 F) = Ttrue"
using S1 by auto
thus ?thesis by simp
next
assume "t_v_evaluation I (Comp2 F) = Ttrue"
hence "(βG β A. t_v_evaluation I G = Ttrue) β§ t_v_evaluation I (Comp2 F) = Ttrue"
using S1 by auto
thus ?thesis by simp
qed
hence "(βG β A βͺ {Comp1 F}. t_v_evaluation I G = Ttrue) β¨
(βG β A βͺ {Comp2 F}. t_v_evaluation I G = Ttrue)"
by auto
hence "(βI.βG β A βͺ {Comp1 F}. t_v_evaluation I G = Ttrue) β¨
(βI.βG β A βͺ {Comp2 F}. t_v_evaluation I G = Ttrue)"
by auto
thus "satisfiable (A βͺ {Comp1 F}) β¨ satisfiable (A βͺ {Comp2 F})"
by (unfold satisfiable_def, unfold model_def, auto)
qed
lemma consistenceP_Prop6:
assumes hip0: "FormulaBeta F"
and hip1: "β (A::'b formula set). (Aβ W β§ finite A) βΆ satisfiable A"
and hip2: "F β W"
shows "(β (A::'b formula set). (Aβ W βͺ {Comp1 F} β§ finite A) βΆ
satisfiable A) β¨
(β (A::'b formula set). (Aβ W βͺ {Comp2 F} β§ finite A) βΆ
satisfiable A)"
proof -
{ assume hip3:"Β¬((β (A::'b formula set). (Aβ W βͺ {Comp1 F} β§ finite A) βΆ
satisfiable A) β¨
(β (A::'b formula set). (Aβ W βͺ {Comp2 F} β§ finite A) βΆ
satisfiable A))"
have "False"
proof -
obtain A B where A1: "A β W βͺ {Comp1 F}"
and A2: "finite A"
and A3:" Β¬ satisfiable A"
and B1: "B β W βͺ {Comp2 F}"
and B2: "finite B"
and B3: "Β¬ satisfiable B"
using hip3 by auto
have a1: "A - {Comp1 F} β W"
and a2: "finite (A - {Comp1 F})"
using A1 and A2 by auto
hence "satisfiable (A - {Comp1 F})" using hip1 by simp
have b1: "B - {Comp2 F} β W"
and b2: "finite (B - {Comp2 F})"
using B1 and B2 by auto
hence "satisfiable (B - {Comp2 F})" using hip1 by simp
moreover
have "(A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {F} β W"
and "finite ((A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {F})"
using a1 a2 b1 b2 hip2 by auto
hence "satisfiable ((A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {F})"
using hip1 by simp
hence "satisfiable ((A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {Comp1 F})
β¨ satisfiable ((A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {Comp2 F})"
using hip0 satisfiableUnion3 by auto
moreover
have "A β (A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {Comp1 F}"
and "B β (A - {Comp1 F}) βͺ (B - {Comp2 F}) βͺ {Comp2 F}"
by auto
ultimately
have "satisfiable A β¨ satisfiable B" using Subset_Sat by auto
thus "False" using A3 B3 by simp
qed }
thus ?thesis by auto
qed
lemma ConsistenceCompactness:
shows "consistenceP{W::'b formula set. βA. (Aβ W β§ finite A) βΆ
satisfiable A}"
proof (unfold consistenceP_def, rule allI, rule impI)
let ?C = "{W::'b formula set. βA. (Aβ W β§ finite A) βΆ satisfiable A}"
fix W ::" 'b formula set"
assume "W β ?C"
hence hip: "βA. (Aβ W β§ finite A) βΆ satisfiable A" by simp
show "(βP. Β¬ (atom P β W β§ (Β¬.atom P ) β W)) β§
FF β W β§
Β¬.TT β W β§
(βF. Β¬.Β¬.F β W βΆ W βͺ {F} β ?C) β§
(βF. (FormulaAlfa F) β§ F β W βΆ
(W βͺ {Comp1 F, Comp2 F} β ?C)) β§
(βF. (FormulaBeta F) β§ F β W βΆ
(W βͺ {Comp1 F} β ?C β¨ W βͺ {Comp2 F} β ?C))"
proof -
have "(βP. Β¬ (atom P β W β§ (Β¬. atom P) β W))"
using hip consistenceP_Prop1 by simp
moreover
have "FF β W" using hip consistenceP_Prop2 by auto
moreover
have "Β¬. TT β W" using hip consistenceP_Prop3 by auto
moreover
have "βF. (Β¬.Β¬.F) β W βΆ W βͺ {F} β ?C"
proof (rule allI impI)+
fix F
assume hip1: "Β¬.Β¬.F β W"
show "W βͺ {F} β ?C" using hip hip1 consistenceP_Prop4 by simp
qed
moreover
have
"βF. (FormulaAlfa F) β§ F β W βΆ (W βͺ {Comp1 F, Comp2 F} β ?C)"
proof (rule allI impI)+
fix F
assume "FormulaAlfa F β§ F β W"
thus "W βͺ {Comp1 F, Comp2 F} β ?C" using hip consistenceP_Prop5[of F] by blast
qed
moreover
have "βF. (FormulaBeta F) β§ F β W βΆ
(W βͺ {Comp1 F} β ?C β¨ W βͺ {Comp2 F} β ?C)"
proof (rule allI impI)+
fix F
assume "(FormulaBeta F) β§ F β W"
thus "W βͺ {Comp1 F} β ?C β¨ W βͺ {Comp2 F} β ?C"
using hip consistenceP_Prop6[of F] by blast
qed
ultimately
show ?thesis by auto
qed
qed
lemma countable_enumeration_formula:
shows "βf. enumeration (f:: nat β'a::countable formula)"
by (metis(full_types) EnumerationFormulasP1
enumeration_def surj_def surj_from_nat)
theorem Compacteness_Theorem:
assumes "βA. (A β (S:: 'a::countable formula set) β§ finite A) βΆ satisfiable A"
shows "satisfiable S"
proof -
have enum: "βg. enumeration (g:: nat β 'a formula)"
using countable_enumeration_formula by auto
let ?C = "{W:: 'a formula set. βA. (A β W β§ finite A) βΆ satisfiable A}"
have "consistenceP ?C"
using ConsistenceCompactness by simp
moreover
have "S β ?C" using assms by simp
ultimately
show "satisfiable S" using enum and Theo_ExistenceModels[of ?C S] by auto
qed
end