273
|
1 -title: Constructing ZF Set Theory in Agda
|
|
2
|
|
3 --author: Shinji KONO
|
|
4
|
279
|
5 --ZF in Agda
|
|
6
|
|
7 zf.agda axiom of ZF
|
|
8 zfc.agda axiom of choice
|
|
9 Ordinals.agda axiom of Ordinals
|
|
10 ordinal.agda countable model of Ordinals
|
|
11 OD.agda model of ZF based on Ordinal Definable Set with assumptions
|
|
12 ODC.agda Law of exclude middle from axiom of choice assumptions
|
|
13 LEMC.agda model of choice with assumption of the Law of exclude middle
|
|
14 OPair.agda ordered pair on OD
|
|
15
|
|
16 BAlgbra.agda Boolean algebra on OD (not yet done)
|
|
17 filter.agda Filter on OD (not yet done)
|
|
18 cardinal.agda Caedinal number on OD (not yet done)
|
|
19
|
|
20 logic.agda some basics on logic
|
|
21 nat.agda some basics on Nat
|
|
22
|
273
|
23 --Programming Mathematics
|
|
24
|
|
25 Programming is processing data structure with λ terms.
|
|
26
|
|
27 We are going to handle Mathematics in intuitionistic logic with λ terms.
|
|
28
|
|
29 Mathematics is a functional programming which values are proofs.
|
|
30
|
|
31 Programming ZF Set Theory in Agda
|
|
32
|
|
33 --Target
|
|
34
|
|
35 Describe ZF axioms in Agda
|
|
36 Construction a Model of ZF Set Theory in Agda
|
|
37 Show necessary assumptions for the model
|
|
38 Show validities of ZF axioms on the model
|
|
39
|
|
40 This shows consistency of Set Theory (with some assumptions),
|
|
41 without circulating ZF Theory assumption.
|
|
42
|
|
43 <a href="https://github.com/shinji-kono/zf-in-agda">
|
|
44 ZF in Agda https://github.com/shinji-kono/zf-in-agda
|
|
45 </a>
|
|
46
|
|
47 --Why Set Theory
|
|
48
|
|
49 If we can formulate Set theory, it suppose to work on any mathematical theory.
|
|
50
|
|
51 Set Theory is a difficult point for beginners especially axiom of choice.
|
|
52
|
|
53 It has some amount of difficulty and self circulating discussion.
|
|
54
|
|
55 I'm planning to do it in my old age, but I'm enough age now.
|
|
56
|
336
|
57 if you familier with Agda, you can skip to
|
|
58 <a href="#set-theory">
|
|
59 there
|
|
60 </a>
|
273
|
61
|
|
62 --Agda and Intuitionistic Logic
|
|
63
|
|
64 Curry Howard Isomorphism
|
|
65
|
|
66 Proposition : Proof ⇔ Type : Value
|
|
67
|
|
68 which means
|
|
69
|
|
70 constructing a typed lambda calculus which corresponds a logic
|
|
71
|
|
72 Typed lambda calculus which allows complex type as a value of a variable (System FC)
|
|
73
|
|
74 First class Type / Dependent Type
|
|
75
|
|
76 Agda is a such a programming language which has similar syntax of Haskell
|
|
77
|
|
78 Coq is specialized in proof assistance such as command and tactics .
|
|
79
|
|
80 --Introduction of Agda
|
|
81
|
|
82 A length of a list of type A.
|
|
83
|
|
84 length : {A : Set } → List A → Nat
|
|
85 length [] = zero
|
|
86 length (_ ∷ t) = suc ( length t )
|
|
87
|
|
88 Simple functional programming language. Type declaration is mandatory.
|
|
89 A colon means type, an equal means value. Indentation based.
|
|
90
|
|
91 Set is a base type (which may have a level ).
|
|
92
|
|
93 {} means implicit variable which can be omitted if Agda infers its value.
|
|
94
|
|
95 --data ( Sum type )
|
|
96
|
|
97 A data type which as exclusive multiple constructors. A similar one as
|
|
98 union in C or case class in Scala.
|
|
99
|
|
100 It has a similar syntax as Haskell but it has a slight difference.
|
|
101
|
|
102 data List (A : Set ) : Set where
|
|
103 [] : List A
|
|
104 _∷_ : A → List A → List A
|
|
105
|
|
106 _∷_ means infix operator. If use explicit _, it can be used in a normal function
|
|
107 syntax.
|
|
108
|
|
109 Natural number can be defined as a usual way.
|
|
110
|
|
111 data Nat : Set where
|
|
112 zero : Nat
|
|
113 suc : Nat → Nat
|
|
114
|
|
115 -- A → B means "A implies B"
|
|
116
|
|
117 In Agda, a type can be a value of a variable, which is usually called dependent type.
|
|
118 Type has a name Set in Agda.
|
|
119
|
|
120 ex3 : {A B : Set} → Set
|
|
121 ex3 {A}{B} = A → B
|
|
122
|
|
123 ex3 is a type : A → B, which is a value of Set. It also means a formula : A implies B.
|
|
124
|
|
125 A type is a formula, the value is the proof
|
|
126
|
|
127 A value of A → B can be interpreted as an inference from the formula A to the formula B, which
|
|
128 can be a function from a proof of A to a proof of B.
|
|
129
|
|
130 --introduction と elimination
|
|
131
|
|
132 For a logical operator, there are two types of inference, an introduction and an elimination.
|
|
133
|
|
134 intro creating symbol / constructor / introduction
|
|
135 elim using symbolic / accessors / elimination
|
|
136
|
|
137 In Natural deduction, this can be written in proof schema.
|
|
138
|
|
139 A
|
|
140 :
|
|
141 B A A → B
|
|
142 ------------- →intro ------------------ →elim
|
|
143 A → B B
|
|
144
|
|
145 In Agda, this is a pair of type and value as follows. Introduction of → uses λ.
|
|
146
|
|
147 →intro : {A B : Set } → A → B → ( A → B )
|
|
148 →intro _ b = λ x → b
|
|
149
|
|
150 →elim : {A B : Set } → A → ( A → B ) → B
|
|
151 →elim a f = f a
|
|
152
|
|
153 Important
|
|
154
|
|
155 {A B : Set } → A → B → ( A → B )
|
|
156
|
|
157 is
|
|
158
|
|
159 {A B : Set } → ( A → ( B → ( A → B ) ))
|
|
160
|
|
161 This makes currying of function easy.
|
|
162
|
|
163 -- To prove A → B
|
|
164
|
|
165 Make a left type as an argument. (intros in Coq)
|
|
166
|
|
167 ex5 : {A B C : Set } → A → B → C → ?
|
|
168 ex5 a b c = ?
|
|
169
|
|
170 ? is called a hole, which is unspecified part. Agda tell us which kind type is required for the Hole.
|
|
171
|
|
172 We are going to fill the holes, and if we have no warnings nor errors such as type conflict (Red),
|
|
173 insufficient proof or instance (Yellow), Non-termination, the proof is completed.
|
|
174
|
|
175 -- A ∧ B
|
|
176
|
|
177 Well known conjunction's introduction and elimination is as follow.
|
|
178
|
|
179 A B A ∧ B A ∧ B
|
|
180 ------------- ----------- proj1 ---------- proj2
|
|
181 A ∧ B A B
|
|
182
|
|
183 We can introduce a corresponding structure in our functional programming language.
|
|
184
|
|
185 -- record
|
|
186
|
|
187 record _∧_ A B : Set
|
|
188 field
|
|
189 proj1 : A
|
|
190 proj2 : B
|
|
191
|
|
192 _∧_ means infix operator. _∧_ A B can be written as A ∧ B (Haskell uses (∧) )
|
|
193
|
|
194 This a type which constructed from type A and type B. You may think this as an object
|
|
195 or struct.
|
|
196
|
|
197 record { proj1 = x ; proj2 = y }
|
|
198
|
|
199 is a constructor of _∧_.
|
|
200
|
|
201 ex3 : {A B : Set} → A → B → ( A ∧ B )
|
|
202 ex3 a b = record { proj1 = a ; proj2 = b }
|
|
203
|
|
204 ex1 : {A B : Set} → ( A ∧ B ) → A
|
|
205 ex1 a∧b = proj1 a∧b
|
|
206
|
|
207 a∧b is a variable name. If we have no spaces in a string, it is a word even if we have symbols
|
|
208 except parenthesis or colons. A symbol requires space separation such as a type defining colon.
|
|
209
|
|
210 Defining record can be recursively, but we don't use the recursion here.
|
|
211
|
|
212 -- Mathematical structure
|
|
213
|
|
214 We have types of elements and the relationship in a mathematical structure.
|
|
215
|
|
216 logical relation has no ordering
|
|
217 there is a natural ordering in arguments and a value in a function
|
|
218
|
|
219 So we have typical definition style of mathematical structure with records.
|
|
220
|
|
221 record IsOrdinals {n : Level} (ord : Set n)
|
|
222 (_o<_ : ord → ord → Set n) : Set (suc (suc n)) where
|
|
223 field
|
|
224 Otrans : {x y z : ord } → x o< y → y o< z → x o< z
|
|
225
|
|
226 record Ordinals {n : Level} : Set (suc (suc n)) where
|
|
227 field
|
|
228 ord : Set n
|
|
229 _o<_ : ord → ord → Set n
|
|
230 isOrdinal : IsOrdinals ord _o<_
|
|
231
|
|
232 In IsOrdinals, axioms are written in flat way. In Ordinal, we may have
|
|
233 inputs and outputs are put in the field including IsOrdinal.
|
|
234
|
|
235 Fields of Ordinal is existential objects in the mathematical structure.
|
|
236
|
359
|
237 -- Limit Ordinal
|
|
238
|
|
239 If an ordinal is not a succesor of other, it is called limit ordinal. We need predicate to decide it.
|
|
240
|
|
241 not-limit-p : ( x : ord ) → Dec ( ¬ ((y : ord) → ¬ (x ≡ osuc y) ))
|
|
242
|
|
243 An ordinal may have an imeditate limit ordinal, we call it next x. Axiom of nrext is this.
|
|
244
|
|
245 record IsNext {n : Level } (ord : Set n) (o∅ : ord ) (osuc : ord → ord )
|
|
246 (_o<_ : ord → ord → Set n) (next : ord → ord ) : Set (suc (suc n)) where
|
|
247 field
|
|
248 x<nx : { y : ord } → (y o< next y )
|
|
249 osuc<nx : { x y : ord } → x o< next y → osuc x o< next y
|
|
250 ¬nx<nx : {x y : ord} → y o< x → x o< next y → ¬ ((z : ord) → ¬ (x ≡ osuc z))
|
|
251
|
|
252 We show some intresting lemma.
|
|
253
|
|
254 next< : {x y z : Ordinal} → x o< next z → y o< next x → y o< next z
|
|
255 nexto=n : {x y : Ordinal} → x o< next (osuc y) → x o< next y
|
|
256 nexto≡ : {x : Ordinal} → next x ≡ next (osuc x)
|
|
257 next-is-limit : {x y : Ordinal} → ¬ (next x ≡ osuc y)
|
|
258
|
|
259 These are proved from the axiom. Our countable ordinal satisfies these.
|
|
260
|
273
|
261 -- A Model and a theory
|
|
262
|
|
263 Agda record is a type, so we can write it in the argument, but is it really exists?
|
|
264
|
|
265 If we have a value of the record, it simply exists, that is, we need to create all the existence
|
|
266 in the record satisfies all the axioms (= field of IsOrdinal) should be valid.
|
|
267
|
|
268 type of record = theory
|
|
269 value of record = model
|
|
270
|
|
271 We call the value of the record as a model. If mathematical structure has a
|
|
272 model, it exists. Pretty Obvious.
|
|
273
|
|
274 -- postulate と module
|
|
275
|
|
276 Agda proofs are separated by modules, which are large records.
|
|
277
|
|
278 postulates are assumptions. We can assume a type without proofs.
|
|
279
|
|
280 postulate
|
|
281 sup-o : ( Ordinal → Ordinal ) → Ordinal
|
|
282 sup-o< : { ψ : Ordinal → Ordinal } → ∀ {x : Ordinal } → ψ x o< sup-o ψ
|
|
283
|
|
284 sup-o is an example of upper bound of a function and sup-o< assumes it actually
|
|
285 satisfies all the value is less than upper bound.
|
|
286
|
|
287 Writing some type in a module argument is the same as postulating a type, but
|
|
288 postulate can be written the middle of a proof.
|
|
289
|
|
290 postulate can be constructive.
|
|
291
|
336
|
292 postulate can be inconsistent, which result everything has a proof. Actualy this assumption
|
|
293 doesnot work for Ordinals, we discuss this later.
|
273
|
294
|
|
295 -- A ∨ B
|
|
296
|
|
297 data _∨_ (A B : Set) : Set where
|
|
298 case1 : A → A ∨ B
|
|
299 case2 : B → A ∨ B
|
|
300
|
|
301 As Haskell, case1/case2 are patterns.
|
|
302
|
|
303 ex3 : {A B : Set} → ( A ∨ A ) → A
|
|
304 ex3 = ?
|
|
305
|
|
306 In a case statement, Agda command C-C C-C generates possible cases in the head.
|
|
307
|
|
308 ex3 : {A B : Set} → ( A ∨ A ) → A
|
|
309 ex3 (case1 x) = ?
|
|
310 ex3 (case2 x) = ?
|
|
311
|
|
312 Proof schema of ∨ is omit due to the complexity.
|
|
313
|
|
314 -- Negation
|
|
315
|
|
316 ⊥
|
|
317 ------------- ⊥-elim
|
|
318 A
|
|
319
|
|
320 Anything can be derived from bottom, in this case a Set A. There is no introduction rule
|
|
321 in ⊥, which can be implemented as data which has no constructor.
|
|
322
|
|
323 data ⊥ : Set where
|
|
324
|
|
325 ⊥-elim can be proved like this.
|
|
326
|
|
327 ⊥-elim : {A : Set } -> ⊥ -> A
|
|
328 ⊥-elim ()
|
|
329
|
|
330 () means no match argument nor value.
|
|
331
|
|
332 A negation can be defined using ⊥ like this.
|
|
333
|
|
334 ¬_ : Set → Set
|
|
335 ¬ A = A → ⊥
|
|
336
|
|
337 --Equality
|
|
338
|
|
339 All the value in Agda are terms. If we have the same normalized form, two terms are equal.
|
|
340 If we have variables in the terms, we will perform an unification. unifiable terms are equal.
|
|
341 We don't go further on the unification.
|
|
342
|
|
343 { x : A } x ≡ y f x y
|
|
344 --------------- ≡-intro --------------------- ≡-elim
|
|
345 x ≡ x f x x
|
|
346
|
|
347 equality _≡_ can be defined as a data.
|
|
348
|
|
349 data _≡_ {A : Set } : A → A → Set where
|
|
350 refl : {x : A} → x ≡ x
|
|
351
|
|
352 The elimination of equality is a substitution in a term.
|
|
353
|
|
354 subst : {A : Set } → { x y : A } → ( f : A → Set ) → x ≡ y → f x → f y
|
|
355 subst {A} {x} {y} f refl fx = fx
|
|
356
|
|
357 ex5 : {A : Set} {x y z : A } → x ≡ y → y ≡ z → x ≡ z
|
|
358 ex5 {A} {x} {y} {z} x≡y y≡z = subst ( λ k → x ≡ k ) y≡z x≡y
|
|
359
|
|
360
|
|
361 --Equivalence relation
|
|
362
|
|
363 refl' : {A : Set} {x : A } → x ≡ x
|
|
364 refl' = ?
|
|
365 sym : {A : Set} {x y : A } → x ≡ y → y ≡ x
|
|
366 sym = ?
|
|
367 trans : {A : Set} {x y z : A } → x ≡ y → y ≡ z → x ≡ z
|
|
368 trans = ?
|
|
369 cong : {A B : Set} {x y : A } { f : A → B } → x ≡ y → f x ≡ f y
|
|
370 cong = ?
|
|
371
|
|
372 --Ordering
|
|
373
|
|
374 Relation is a predicate on two value which has a same type.
|
|
375
|
|
376 A → A → Set
|
|
377
|
|
378 Defining order is the definition of this type with predicate or a data.
|
|
379
|
|
380 data _≤_ : Rel ℕ 0ℓ where
|
|
381 z≤n : ∀ {n} → zero ≤ n
|
|
382 s≤s : ∀ {m n} (m≤n : m ≤ n) → suc m ≤ suc n
|
|
383
|
|
384
|
|
385 --Quantifier
|
|
386
|
|
387 Handling quantifier in an intuitionistic logic requires special cares.
|
|
388
|
|
389 In the input of a function, there are no restriction on it, that is, it has
|
|
390 a universal quantifier. (If we explicitly write ∀, Agda gives us a type inference on it)
|
|
391
|
|
392 There is no ∃ in agda, the one way is using negation like this.
|
|
393
|
|
394 ∃ (x : A ) → p x = ¬ ( ( x : A ) → ¬ ( p x ) )
|
|
395
|
|
396 On the another way, f : A can be used like this.
|
|
397
|
|
398 p f
|
|
399
|
|
400 If we use a function which can be defined globally which has stronger meaning the
|
|
401 usage of ∃ x in a logical expression.
|
|
402
|
|
403
|
|
404 --Can we do math in this way?
|
|
405
|
|
406 Yes, we can. Actually we have Principia Mathematica by Russell and Whitehead (with out computer support).
|
|
407
|
|
408 In some sense, this story is a reprinting of the work, (but Principia Mathematica has a different formulation than ZF).
|
|
409
|
|
410 define mathematical structure as a record
|
|
411 program inferences as if we have proofs in variables
|
|
412
|
|
413 --Things which Agda cannot prove
|
|
414
|
|
415 The infamous Internal Parametricity is a limitation of Agda, it cannot prove so called Free Theorem, which
|
|
416 leads uniqueness of a functor in Category Theory.
|
|
417
|
|
418 Functional extensionality cannot be proved.
|
|
419 (∀ x → f x ≡ g x) → f ≡ g
|
|
420
|
|
421 Agda has no law of exclude middle.
|
|
422
|
|
423 a ∨ ( ¬ a )
|
|
424
|
|
425 For example, (A → B) → ¬ B → ¬ A can be proved but, ( ¬ B → ¬ A ) → A → B cannot.
|
|
426
|
|
427 It also other problems such as termination, type inference or unification which we may overcome with
|
|
428 efforts or devices or may not.
|
|
429
|
|
430 If we cannot prove something, we can safely postulate it unless it leads a contradiction.
|
|
431
|
|
432 --Classical story of ZF Set Theory
|
|
433
|
336
|
434 <a name="set-theory">
|
273
|
435 Assuming ZF, constructing a model of ZF is a flow of classical Set Theory, which leads
|
|
436 a relative consistency proof of the Set Theory.
|
|
437 Ordinal number is used in the flow.
|
|
438
|
|
439 In Agda, first we defines Ordinal numbers (Ordinals), then introduce Ordinal Definable Set (OD).
|
|
440 We need some non constructive assumptions in the construction. A model of Set theory is
|
|
441 constructed based on these assumptions.
|
|
442
|
|
443 <center><img src="fig/set-theory.svg"></center>
|
|
444
|
|
445 --Ordinals
|
|
446
|
|
447 Ordinals are our intuition of infinite things, which has ∅ and orders on the things.
|
|
448 It also has a successor osuc.
|
|
449
|
|
450 record Ordinals {n : Level} : Set (suc (suc n)) where
|
|
451 field
|
|
452 ord : Set n
|
|
453 o∅ : ord
|
|
454 osuc : ord → ord
|
|
455 _o<_ : ord → ord → Set n
|
|
456 isOrdinal : IsOrdinals ord o∅ osuc _o<_
|
|
457
|
|
458 It is different from natural numbers in way. The order of Ordinals is not defined in terms
|
|
459 of successor. It is given from outside, which make it possible to have higher order infinity.
|
|
460
|
|
461 --Axiom of Ordinals
|
|
462
|
|
463 Properties of infinite things. We request a transfinite induction, which states that if
|
|
464 some properties are satisfied below all possible ordinals, the properties are true on all
|
|
465 ordinals.
|
|
466
|
|
467 Successor osuc has no ordinal between osuc and the base ordinal. There are some ordinals
|
|
468 which is not a successor of any ordinals. It is called limit ordinal.
|
|
469
|
|
470 Any two ordinal can be compared, that is less, equal or more, that is total order.
|
|
471
|
|
472 record IsOrdinals {n : Level} (ord : Set n) (o∅ : ord )
|
|
473 (osuc : ord → ord )
|
|
474 (_o<_ : ord → ord → Set n) : Set (suc (suc n)) where
|
|
475 field
|
|
476 Otrans : {x y z : ord } → x o< y → y o< z → x o< z
|
|
477 OTri : Trichotomous {n} _≡_ _o<_
|
|
478 ¬x<0 : { x : ord } → ¬ ( x o< o∅ )
|
|
479 <-osuc : { x : ord } → x o< osuc x
|
|
480 osuc-≡< : { a x : ord } → x o< osuc a → (x ≡ a ) ∨ (x o< a)
|
|
481 TransFinite : { ψ : ord → Set (suc n) }
|
|
482 → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x )
|
|
483 → ∀ (x : ord) → ψ x
|
|
484
|
336
|
485 --Concrete Ordinals or Countable Ordinals
|
273
|
486
|
|
487 We can define a list like structure with level, which is a kind of two dimensional infinite array.
|
|
488
|
|
489 data OrdinalD {n : Level} : (lv : Nat) → Set n where
|
|
490 Φ : (lv : Nat) → OrdinalD lv
|
|
491 OSuc : (lv : Nat) → OrdinalD {n} lv → OrdinalD lv
|
|
492
|
|
493 The order of the OrdinalD can be defined in this way.
|
|
494
|
|
495 data _d<_ {n : Level} : {lx ly : Nat} → OrdinalD {n} lx → OrdinalD {n} ly → Set n where
|
|
496 Φ< : {lx : Nat} → {x : OrdinalD {n} lx} → Φ lx d< OSuc lx x
|
|
497 s< : {lx : Nat} → {x y : OrdinalD {n} lx} → x d< y → OSuc lx x d< OSuc lx y
|
|
498
|
|
499 This is a simple data structure, it has no abstract assumptions, and it is countable many data
|
|
500 structure.
|
|
501
|
|
502 Φ 0
|
|
503 OSuc 2 ( Osuc 2 ( Osuc 2 (Φ 2)))
|
|
504 Osuc 0 (Φ 0) d< Φ 1
|
|
505
|
|
506 --Model of Ordinals
|
|
507
|
|
508 It is easy to show OrdinalD and its order satisfies the axioms of Ordinals.
|
|
509
|
|
510 So our Ordinals has a mode. This means axiom of Ordinals are consistent.
|
|
511
|
|
512 --Debugging axioms using Model
|
|
513
|
|
514 Whether axiom is correct or not can be checked by a validity on a mode.
|
|
515
|
|
516 If not, we may fix the axioms or the model, such as the definitions of the order.
|
|
517
|
|
518 We can also ask whether the inputs exist.
|
|
519
|
|
520 --Countable Ordinals can contains uncountable set?
|
|
521
|
|
522 Yes, the ordinals contains any level of infinite Set in the axioms.
|
|
523
|
|
524 If we handle real-number in the model, only countable number of real-number is used.
|
|
525
|
|
526 from the outside view point, it is countable
|
|
527 from the internal view point, it is uncountable
|
|
528
|
|
529 The definition of countable/uncountable is the same, but the properties are different
|
|
530 depending on the context.
|
|
531
|
|
532 We don't show the definition of cardinal number here.
|
|
533
|
|
534 --What is Set
|
|
535
|
|
536 The word Set in Agda is not a Set of ZF Set, but it is a type (why it is named Set?).
|
|
537
|
|
538 From naive point view, a set i a list, but in Agda, elements have all the same type.
|
|
539 A set in ZF may contain other Sets in ZF, which not easy to implement it as a list.
|
|
540
|
|
541 Finite set may be written in finite series of ∨, but ...
|
|
542
|
|
543 --We don't ask the contents of Set. It can be anything.
|
|
544
|
|
545 From empty set φ, we can think a set contains a φ, and a pair of φ and the set, and so on,
|
|
546 and all of them, and again we repeat this.
|
|
547
|
|
548 φ {φ} {φ,{φ}}, {φ,{φ},...}
|
|
549
|
|
550 It is called V.
|
|
551
|
|
552 This operation can be performed within a ZF Set theory. Classical Set Theory assumes
|
|
553 ZF, so this kind of thing is allowed.
|
|
554
|
|
555 But in our case, we have no ZF theory, so we are going to use Ordinals.
|
|
556
|
336
|
557 The idea is to use an ordinal as a pointer to a record which defines a Set.
|
|
558 If the recored defines a series of Ordinals which is a pointer to the Set.
|
|
559 This record looks like a Set.
|
273
|
560
|
|
561 --Ordinal Definable Set
|
|
562
|
|
563 We can define a sbuset of Ordinals using predicates. What is a subset?
|
|
564
|
|
565 a predicate has an Ordinal argument
|
|
566
|
|
567 is an Ordinal Definable Set (OD). In Agda, OD is defined as follows.
|
|
568
|
|
569 record OD : Set (suc n ) where
|
|
570 field
|
|
571 def : (x : Ordinal ) → Set n
|
|
572
|
|
573 Ordinals itself is not a set in a ZF Set theory but a class. In OD,
|
|
574
|
336
|
575 data One : Set n where
|
|
576 OneObj : One
|
273
|
577
|
336
|
578 record { def = λ x → One }
|
|
579
|
|
580 means it accepets all Ordinals, i.e. this is Ordinals itself, so ODs are larger than ZF Set.
|
|
581 You can say OD is a class in ZF Set Theory term.
|
273
|
582
|
|
583
|
336
|
584 --OD is not ZF Set
|
|
585
|
|
586 If we have 1 to 1 mapping between an OD and an Ordinal, OD contains several ODs and OD looks like
|
|
587 a Set. The idea is to use an ordinal as a pointer to OD.
|
|
588 Unfortunately this scheme does not work well. As we saw OD includes all Ordinals,
|
|
589 which is a maximum of OD, but Ordinals has no maximum at all. So we have a contradction like
|
273
|
590
|
425
|
591 ¬OD-order : ( & : OD → Ordinal )
|
|
592 → ( * : Ordinal → OD ) → ( { x y : OD } → def y ( & x ) → & x o< & y) → ⊥
|
|
593 ¬OD-order & * c<→o< = ?
|
336
|
594
|
|
595 Actualy we can prove this contrdction, so we need some restrctions on OD.
|
|
596
|
|
597 This is a kind of Russel paradox, that is if OD contains everything, what happens if it contains itself.
|
|
598
|
|
599 -- HOD : Hereditarily Ordinal Definable
|
|
600
|
|
601 What we need is a bounded OD, the containment is limited by an ordinal.
|
273
|
602
|
336
|
603 record HOD : Set (suc n) where
|
|
604 field
|
|
605 od : OD
|
|
606 odmax : Ordinal
|
|
607 <odmax : {y : Ordinal} → def od y → y o< odmax
|
|
608
|
|
609 In classical Set Theory, HOD stands for Hereditarily Ordinal Definable, which means
|
|
610
|
|
611 HOD = { x | TC x ⊆ OD }
|
273
|
612
|
336
|
613 TC x is all transitive closure of x, that is elements of x and following all elements of them are all OD. But
|
|
614 what is x? In this case, x is an Set which we don't have yet. In our case, HOD is a bounded OD.
|
|
615
|
|
616 --1 to 1 mapping between an HOD and an Ordinal
|
|
617
|
|
618 HOD is a predicate on Ordinals and the solution is bounded by some ordinal. If we have a mapping
|
|
619
|
425
|
620 & : HOD → Ordinal
|
|
621 * : Ordinal → HOD
|
|
622 oiso : {x : HOD } → * ( & x ) ≡ x
|
|
623 diso : {x : Ordinal } → & ( * x ) ≡ x
|
336
|
624
|
|
625 we can check an HOD is an element of the OD using def.
|
273
|
626
|
|
627 A ∋ x can be define as follows.
|
|
628
|
336
|
629 _∋_ : ( A x : HOD ) → Set n
|
425
|
630 _∋_ A x = def (od A) ( & x )
|
273
|
631
|
|
632 In ψ : Ordinal → Set, if A is a record { def = λ x → ψ x } , then
|
|
633
|
425
|
634 A x = def A ( & x ) = ψ (& x)
|
273
|
635
|
|
636 They say the existing of the mappings can be proved in Classical Set Theory, but we
|
|
637 simply assumes these non constructively.
|
|
638
|
|
639 <center><img src="fig/ord-od-mapping.svg"></center>
|
|
640
|
|
641 --Order preserving in the mapping of OD and Ordinal
|
|
642
|
336
|
643 Ordinals have the order and HOD has a natural order based on inclusion ( def / ∋ ).
|
273
|
644
|
425
|
645 def (od y) ( & x )
|
273
|
646
|
336
|
647 An elements of HOD should be defined before the HOD, that is, an ordinal corresponding an elements
|
|
648 have to be smaller than the corresponding ordinal of the containing OD.
|
|
649 We also assumes subset is always smaller. This is necessary to make a limit of Power Set.
|
273
|
650
|
425
|
651 c<→o< : {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
|
652 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z)
|
273
|
653
|
336
|
654 If wa assumes reverse order preservation,
|
273
|
655
|
425
|
656 o<→c< : {n : Level} {x y : Ordinal } → x o< y → def (* y) x
|
273
|
657
|
336
|
658 ∀ x ∋ ∅ becomes true, which manes all OD becomes Ordinals in the model.
|
273
|
659
|
|
660 <center><img src="fig/ODandOrdinals.svg"></center>
|
|
661
|
|
662 --Various Sets
|
|
663
|
|
664 In classical Set Theory, there is a hierarchy call L, which can be defined by a predicate.
|
|
665
|
|
666 Ordinal / things satisfies axiom of Ordinal / extension of natural number
|
|
667 V / hierarchical construction of Set from φ
|
|
668 L / hierarchical predicate definable construction of Set from φ
|
336
|
669 HOD / Hereditarily Ordinal Definable
|
273
|
670 OD / equational formula on Ordinals
|
|
671 Agda Set / Type / it also has a level
|
|
672
|
|
673
|
361
|
674 --Fixing ZF axom to fit intuitionistic logic
|
273
|
675
|
|
676 We use ODs as Sets in ZF, and defines record ZF, that is, we have to define
|
|
677 ZF axioms in Agda.
|
|
678
|
|
679 It may not valid in our model. We have to debug it.
|
|
680
|
|
681 Fixes are depends on axioms.
|
|
682
|
|
683 <center><img src="fig/axiom-type.svg"></center>
|
|
684
|
|
685 <a href="fig/zf-record.html">
|
|
686 ZFのrecord
|
|
687 </a>
|
|
688
|
|
689 --Pure logical axioms
|
|
690
|
279
|
691 empty, pair, select, ε-induction??infinity
|
273
|
692
|
|
693 These are logical relations among OD.
|
|
694
|
|
695 empty : ∀( x : ZFSet ) → ¬ ( ∅ ∋ x )
|
|
696 pair→ : ( x y t : ZFSet ) → (x , y) ∋ t → ( t ≈ x ) ∨ ( t ≈ y )
|
|
697 pair← : ( x y t : ZFSet ) → ( t ≈ x ) ∨ ( t ≈ y ) → (x , y) ∋ t
|
|
698 selection : { ψ : ZFSet → Set m } → ∀ { X y : ZFSet } → ( ( y ∈ X ) ∧ ψ y ) ⇔ (y ∈ Select X ψ )
|
|
699 infinity∅ : ∅ ∈ infinite
|
|
700 infinity : ∀( x : ZFSet ) → x ∈ infinite → ( x ∪ ( x , x ) ) ∈ infinite
|
|
701 ε-induction : { ψ : OD → Set (suc n)}
|
|
702 → ( {x : OD } → ({ y : OD } → x ∋ y → ψ y ) → ψ x )
|
|
703 → (x : OD ) → ψ x
|
|
704
|
|
705 finitely can be define by Agda data.
|
|
706
|
|
707 data infinite-d : ( x : Ordinal ) → Set n where
|
|
708 iφ : infinite-d o∅
|
|
709 isuc : {x : Ordinal } → infinite-d x →
|
425
|
710 infinite-d (& ( Union (* x , (* x , * x ) ) ))
|
273
|
711
|
|
712 Union (x , ( x , x )) should be an direct successor of x, but we cannot prove it in our model.
|
|
713
|
|
714 --Axiom of Pair
|
|
715
|
|
716 In the Tanaka's book, axiom of pair is as follows.
|
|
717
|
|
718 ∀ x ∀ y ∃ z ∀ t ( z ∋ t ↔ t ≈ x ∨ t ≈ y)
|
|
719
|
|
720 We have fix ∃ z, a function (x , y) is defined, which is _,_ .
|
|
721
|
|
722 _,_ : ( A B : ZFSet ) → ZFSet
|
|
723
|
|
724 using this, we can define two directions in separates axioms, like this.
|
|
725
|
|
726 pair→ : ( x y t : ZFSet ) → (x , y) ∋ t → ( t ≈ x ) ∨ ( t ≈ y )
|
|
727 pair← : ( x y t : ZFSet ) → ( t ≈ x ) ∨ ( t ≈ y ) → (x , y) ∋ t
|
|
728
|
|
729 This is already written in Agda, so we use these as axioms. All inputs have ∀.
|
|
730
|
|
731 --pair in OD
|
|
732
|
|
733 OD is an equation on Ordinals, we can simply write axiom of pair in the OD.
|
|
734
|
336
|
735 _,_ : HOD → HOD → HOD
|
425
|
736 x , y = record { od = record { def = λ t → (t ≡ & x ) ∨ ( t ≡ & y ) } ; odmax = ? ; <odmax = ? }
|
336
|
737
|
|
738 It is easy to find out odmax from odmax of x and y.
|
273
|
739
|
|
740 ≡ is an equality of λ terms, but please not that this is equality on Ordinals.
|
|
741
|
|
742 --Validity of Axiom of Pair
|
|
743
|
|
744 Assuming ZFSet is OD, we are going to prove pair→ .
|
|
745
|
|
746 pair→ : ( x y t : OD ) → (x , y) ∋ t → ( t == x ) ∨ ( t == y )
|
|
747 pair→ x y t p = ?
|
|
748
|
|
749 In this program, type of p is ( x , y ) ∋ t , that is
|
425
|
750 def ( x , y ) that is, (t ≡ & x ) ∨ ( t ≡ & y ) .
|
273
|
751
|
|
752 Since _∨_ is a data, it can be developed as (C-c C-c : agda2-make-case ).
|
|
753
|
|
754 pair→ x y t (case1 t≡x ) = ?
|
|
755 pair→ x y t (case2 t≡y ) = ?
|
|
756
|
|
757 The type of the ? is ( t == x ) ∨ ( t == y ), again it is data _∨_ .
|
|
758
|
|
759 pair→ x y t (case1 t≡x ) = case1 ?
|
|
760 pair→ x y t (case2 t≡y ) = case2 ?
|
|
761
|
|
762 The ? in case1 is t == x, so we have to create this from t≡x, which is a name of a variable
|
|
763 which type is
|
|
764
|
425
|
765 t≡x : & t ≡ & x
|
273
|
766
|
|
767 which is shown by an Agda command (C-C C-E : agda2-show-context ).
|
|
768
|
|
769 But we haven't defined == yet.
|
|
770
|
|
771 --Equality of OD and Axiom of Extensionality
|
|
772
|
|
773 OD is defined by a predicates, if we compares normal form of the predicates, even if
|
|
774 it contains the same elements, it may be different, which is no good as an equality of
|
|
775 Sets.
|
|
776
|
|
777 Axiom of Extensionality requires sets having the same elements are handled in the same way
|
|
778 each other.
|
|
779
|
|
780 ∀ z ( z ∈ x ⇔ z ∈ y ) ⇒ ∀ w ( x ∈ w ⇔ y ∈ w )
|
|
781
|
|
782 We can write this axiom in Agda as follows.
|
|
783
|
|
784 extensionality : { A B w : ZFSet } → ( (z : ZFSet) → ( A ∋ z ) ⇔ (B ∋ z) ) → ( A ∈ w ⇔ B ∈ w )
|
|
785
|
|
786 So we use ( A ∋ z ) ⇔ (B ∋ z) as an equality (_==_) of our model. We have to show
|
|
787 A ∈ w ⇔ B ∈ w from A == B.
|
|
788
|
|
789 x == y can be defined in this way.
|
|
790
|
|
791 record _==_ ( a b : OD ) : Set n where
|
|
792 field
|
|
793 eq→ : ∀ { x : Ordinal } → def a x → def b x
|
|
794 eq← : ∀ { x : Ordinal } → def b x → def a x
|
|
795
|
336
|
796 Actually, (z : HOD) → (A ∋ z) ⇔ (B ∋ z) implies od A == od B.
|
273
|
797
|
336
|
798 extensionality0 : {A B : HOD } → ((z : HOD) → (A ∋ z) ⇔ (B ∋ z)) → od A == od B
|
273
|
799 eq→ (extensionality0 {A} {B} eq ) {x} d = ?
|
|
800 eq← (extensionality0 {A} {B} eq ) {x} d = ?
|
|
801
|
|
802 ? are def B x and def A x and these are generated from eq : (z : OD) → (A ∋ z) ⇔ (B ∋ z) .
|
|
803
|
|
804 Actual proof is rather complicated.
|
|
805
|
425
|
806 eq→ (extensionality0 {A} {B} eq ) {x} d = odef-iso {A} {B} (sym diso) (proj1 (eq (* x))) d
|
|
807 eq← (extensionality0 {A} {B} eq ) {x} d = odef-iso {B} {A} (sym diso) (proj2 (eq (* x))) d
|
273
|
808
|
|
809 where
|
|
810
|
336
|
811 odef-iso : {A B : HOD } {x y : Ordinal } → x ≡ y → (def A (od y) → def (od B) y) → def (od A) x → def (od B) x
|
|
812 odef-iso refl t = t
|
273
|
813
|
363
|
814 --The uniqueness of HOD
|
|
815
|
|
816 To prove extensionality or other we need ==→o≡.
|
|
817
|
|
818 Since we have ==→o≡ , so odmax have to be unique. We should have odmaxmin in HOD.
|
|
819 We can calculate the minimum using sup if we have bound but it is tedius.
|
|
820 Only Select has non minimum odmax.
|
|
821 We have the same problem on 'def' itself, but we leave it, that is we assume the
|
|
822 assumption of predicates of Agda have a unique form, it is something like the
|
|
823 functional extensionality assumption.
|
|
824
|
273
|
825 --Validity of Axiom of Extensionality
|
|
826
|
336
|
827 If we can derive (w ∋ A) ⇔ (w ∋ B) from od A == od B, the axiom becomes valid, but it seems impossible,
|
273
|
828 so we assumes
|
|
829
|
336
|
830 ==→o≡ : { x y : HOD } → (od x == od y) → x ≡ y
|
273
|
831
|
|
832 Using this, we have
|
|
833
|
336
|
834 extensionality : {A B w : HOD } → ((z : HOD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B)
|
273
|
835 proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d
|
336
|
836 proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d
|
273
|
837
|
359
|
838 --Axiom of infinity
|
|
839
|
|
840 It means it has ω as a ZF Set. It is ususally written like this.
|
|
841
|
|
842 ∃ A ( ∅ ∈ A ∧ ∀ x ∈ A ( x ∪ { x } ∈ A ) )
|
|
843
|
|
844 x ∪ { x } is Union (x , (x , x)) in our notation. It contains existential quantifier, so we introduce a function
|
|
845
|
|
846 infinite : ZFSet
|
|
847 infinity∅ : ∅ ∈ infinite
|
|
848 infinity : ∀( x : ZFSet ) → x ∈ infinite → ( x ∪ { x }) ∈ infinite
|
|
849
|
|
850 --ω in HOD
|
|
851
|
425
|
852 To define an OD which arrows & (Union (x , (x , x))) as a predicate, we can use Agda data structure.
|
359
|
853
|
|
854 data infinite-d : ( x : Ordinal ) → Set n where
|
|
855 iφ : infinite-d o∅
|
|
856 isuc : {x : Ordinal } → infinite-d x →
|
425
|
857 infinite-d (& ( Union (* x , (* x , * x ) ) ))
|
359
|
858
|
|
859 It has simular structure as Data.Nat in Agda, and it defines a correspendence of HOD and the data structure. Now
|
|
860 we can define HOD like this.
|
|
861
|
|
862 infinite : HOD
|
|
863 infinite = record { od = record { def = λ x → infinite-d x } ; odmax = ? ; <odmax = ? }
|
|
864
|
425
|
865 So what is the bound of ω? Analyzing the definition, it depends on the value of & (x , x), which
|
|
866 cannot know the aboslute value. This is because we don't have constructive definition of & : HOD → Ordinal.
|
|
867
|
|
868 --HOD and Agda data structure
|
|
869
|
|
870 We may have
|
|
871
|
|
872 a HOD <=> Agda Data Strucure
|
|
873
|
|
874 as a data in Agda. Ex.
|
|
875
|
|
876 data ord-pair : (p : Ordinal) → Set n where
|
|
877 pair : (x y : Ordinal ) → ord-pair ( & ( < * x , * y > ) )
|
|
878
|
|
879 ZFProduct : OD
|
|
880 ZFProduct = record { def = λ x → ord-pair x }
|
|
881
|
|
882 pi1 : { p : Ordinal } → ord-pair p → Ordinal
|
|
883 pi1 ( pair x y) = x
|
|
884
|
|
885 π1 : { p : HOD } → def ZFProduct (& p) → HOD
|
|
886 π1 lt = * (pi1 lt )
|
|
887
|
|
888 p-iso : { x : HOD } → (p : def ZFProduct (& x) ) → < π1 p , π2 p > ≡ x
|
|
889 p-iso {x} p = ord≡→≡ (op-iso p)
|
|
890
|
359
|
891
|
361
|
892 --HOD Ordrinal mapping
|
|
893
|
|
894 We have large freedom on HOD. We reqest no minimality on odmax, so it may arbitrary larger.
|
|
895 The address of HOD can be larger at least it have to be larger than the content's address.
|
|
896 We only have a relative ordering such as
|
|
897
|
425
|
898 pair-xx<xy : {x y : HOD} → & (x , x) o< osuc (& (x , y) )
|
|
899 pair<y : {x y : HOD } → y ∋ x → & (x , x) o< osuc (& y)
|
361
|
900
|
|
901 Basicaly, we cannot know the concrete address of HOD other than empty set.
|
|
902
|
|
903 <center><img src="fig/address-of-HOD.svg"></center>
|
|
904
|
|
905 --Possible restriction on HOD
|
|
906
|
359
|
907 We need some restriction on the HOD-Ordinal mapping. Simple one is this.
|
|
908
|
|
909 ωmax : Ordinal
|
|
910 <ωmax : {y : Ordinal} → infinite-d y → y o< ωmax
|
|
911
|
|
912 It depends on infinite-d and put no assuption on the other similar construction. A more general one may be
|
|
913
|
|
914 hod-ord< : {x : HOD } → Set n
|
425
|
915 hod-ord< {x} = & x o< next (odmax x)
|
359
|
916
|
|
917 next : Ordinal → Ordinal means imediate next limit ordinal of x. It supress unecessary space between address of HOD and
|
|
918 its bound.
|
|
919
|
|
920 In other words, the space between address of HOD and its bound is arbitrary, it is possible to assume ω has no bound.
|
|
921 This is the reason of necessity of Axiom of infinite.
|
|
922
|
|
923 --increment pase of address of HOD
|
|
924
|
361
|
925 Assuming, hod-ord< , we have
|
359
|
926
|
425
|
927 pair-ord< : {x : HOD } → ( {y : HOD } → & y o< next (odmax y) ) → & ( x , x ) o< next (& x)
|
|
928 pair-ord< {x} ho< = subst (λ k → & (x , x) o< k ) lemmab0 lemmab1 where
|
|
929 lemmab0 : next (odmax (x , x)) ≡ next (& x)
|
359
|
930
|
361
|
931 So the address of ( x , x) and Union (x , (x , x)) is restricted in the limit ordinal. This makes ω bound. We can prove
|
|
932
|
425
|
933 infinite-bound : ({x : HOD} → & x o< next (odmax x)) → {y : Ordinal} → infinite-d y → y o< next o∅
|
359
|
934
|
425
|
935 We also notice that if we have & (x , x) ≡ osuc (& x), c<→o< can be drived from ⊆→o≤ .
|
359
|
936
|
425
|
937 ⊆→o≤→c<→o< : ({x : HOD} → & (x , x) ≡ osuc (& x) )
|
|
938 → ({y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z) )
|
|
939 → {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
359
|
940
|
273
|
941 --Non constructive assumptions so far
|
|
942
|
425
|
943 & : HOD → Ordinal
|
|
944 * : Ordinal → HOD
|
|
945 c<→o< : {x y : HOD } → def (od y) ( & x ) → & x o< & y
|
|
946 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z)
|
|
947 oiso : {x : HOD } → * ( & x ) ≡ x
|
|
948 diso : {x : Ordinal } → & ( * x ) ≡ x
|
336
|
949 ==→o≡ : {x y : HOD } → (od x == od y) → x ≡ y
|
|
950 sup-o : (A : HOD) → ( ( x : Ordinal ) → def (od A) x → Ordinal ) → Ordinal
|
|
951 sup-o< : (A : HOD) → { ψ : ( x : Ordinal ) → def (od A) x → Ordinal } → ∀ {x : Ordinal } → (lt : def (od A) x ) → ψ x lt o< sup-o A ψ
|
273
|
952
|
|
953 --Axiom which have negation form
|
|
954
|
|
955 Union, Selection
|
|
956
|
|
957 These axioms contains ∃ x as a logical relation, which can be described in ¬ ( ∀ x ( ¬ p )).
|
|
958
|
|
959 Axiom of replacement uses upper bound of function on Ordinals, which makes it non-constructive.
|
|
960
|
|
961 Power Set axiom requires double negation,
|
|
962
|
|
963 power→ : ∀( A t : ZFSet ) → Power A ∋ t → ∀ {x} → t ∋ x → ¬ ¬ ( A ∋ x )
|
|
964 power← : ∀( A t : ZFSet ) → t ⊆_ A → Power A ∋ t
|
|
965
|
|
966 If we have an assumption of law of exclude middle, we can recover the original A ∋ x form.
|
|
967
|
|
968 --Union
|
|
969
|
|
970 The original form of the Axiom of Union is
|
|
971
|
|
972 ∀ x ∃ y ∀ z (z ∈ y ⇔ ∃ u ∈ x ∧ (z ∈ u))
|
|
973
|
|
974 Union requires the existence of b in a ⊇ ∃ b ∋ x . We will use negation form of ∃.
|
|
975
|
|
976 union→ : ( X z u : ZFSet ) → ( X ∋ u ) ∧ (u ∋ z ) → Union X ∋ z
|
|
977 union← : ( X z : ZFSet ) → (X∋z : Union X ∋ z ) → ¬ ( (u : ZFSet ) → ¬ ((X ∋ u) ∧ (u ∋ z )))
|
|
978
|
359
|
979 The definition of Union in HOD is like this.
|
273
|
980
|
359
|
981 Union : HOD → HOD
|
425
|
982 Union U = record { od = record { def = λ x → ¬ (∀ (u : Ordinal ) → ¬ ((odef U u) ∧ (odef (* u) x))) }
|
|
983 ; odmax = osuc (& U) ; <odmax = ? }
|
359
|
984
|
|
985 The bound of Union is evident, but its proof is rather complicated.
|
273
|
986
|
|
987 Proof of validity is straight forward.
|
|
988
|
359
|
989 union→ : (X z u : HOD) → (X ∋ u) ∧ (u ∋ z) → Union X ∋ z
|
425
|
990 union→ X z u xx not = ⊥-elim ( not (& u) ( record { proj1 = proj1 xx
|
|
991 ; proj2 = subst ( λ k → odef k (& z)) (sym oiso) (proj2 xx) } ))
|
359
|
992 union← : (X z : HOD) (X∋z : Union X ∋ z) → ¬ ( (u : HOD ) → ¬ ((X ∋ u) ∧ (u ∋ z )))
|
273
|
993 union← X z UX∋z = FExists _ lemma UX∋z where
|
425
|
994 lemma : {y : Ordinal} → odef X y ∧ odef (* y) (& z) → ¬ ((u : HOD) → ¬ (X ∋ u) ∧ (u ∋ z))
|
|
995 lemma {y} xx not = not (* y) record { proj1 = subst ( λ k → odef X k ) (sym diso) (proj1 xx ) ; proj2 = proj2 xx }
|
273
|
996
|
|
997 where
|
|
998
|
|
999 FExists : {m l : Level} → ( ψ : Ordinal → Set m )
|
|
1000 → {p : Set l} ( P : { y : Ordinal } → ψ y → ¬ p )
|
|
1001 → (exists : ¬ (∀ y → ¬ ( ψ y ) ))
|
|
1002 → ¬ p
|
|
1003 FExists {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p )
|
|
1004
|
|
1005 which checks existence using contra-position.
|
|
1006
|
|
1007 --Axiom of replacement
|
|
1008
|
|
1009 We can replace the elements of a set by a function and it becomes a set. From the book,
|
|
1010
|
|
1011 ∀ x ∀ y ∀ z ( ( ψ ( x , y ) ∧ ψ ( x , z ) ) → y = z ) → ∀ X ∃ A ∀ y ( y ∈ A ↔ ∃ x ∈ X ψ ( x , y ) )
|
|
1012
|
|
1013 The existential quantifier can be related by a function,
|
|
1014
|
359
|
1015 Replace : HOD → (HOD → HOD ) → HOD
|
273
|
1016
|
|
1017 The axioms becomes as follows.
|
|
1018
|
|
1019 replacement← : {ψ : ZFSet → ZFSet} → ∀ ( X x : ZFSet ) → x ∈ X → ψ x ∈ Replace X ψ
|
|
1020 replacement→ : {ψ : ZFSet → ZFSet} → ∀ ( X x : ZFSet ) → ( lt : x ∈ Replace X ψ ) → ¬ ( ∀ (y : ZFSet) → ¬ ( x ≈ ψ y ) )
|
|
1021
|
|
1022 In the axiom, the existence of the original elements is necessary. In order to do that we use OD which has
|
|
1023 negation form of existential quantifier in the definition.
|
|
1024
|
|
1025 in-codomain : (X : OD ) → ( ψ : OD → OD ) → OD
|
425
|
1026 in-codomain X ψ = record { def = λ x → ¬ ( (y : Ordinal ) → ¬ ( def X y ∧ ( x ≡ & (ψ (* y ))))) }
|
273
|
1027
|
359
|
1028 in-codomain is a logical relation-ship, and it is written in OD.
|
273
|
1029
|
359
|
1030 Replace : HOD → (HOD → HOD) → HOD
|
425
|
1031 Replace X ψ = record { od = record { def = λ x → (x o< sup-o X (λ y X∋y → & (ψ (* y)))) ∧ def (in-codomain X ψ) x }
|
359
|
1032 ; odmax = rmax ; <odmax = rmax<} where
|
|
1033 rmax : Ordinal
|
425
|
1034 rmax = sup-o X (λ y X∋y → & (ψ (* y)))
|
359
|
1035 rmax< : {y : Ordinal} → (y o< rmax) ∧ def (in-codomain X ψ) y → y o< rmax
|
|
1036 rmax< lt = proj1 lt
|
273
|
1037
|
359
|
1038 The bbound of Replace is defined by supremum, that is, it is not limited in a limit ordinal of original ZF Set.
|
|
1039
|
|
1040 Once we have a bound, validity of the axiom is an easy task to check the logical relation-ship.
|
273
|
1041
|
|
1042 --Validity of Power Set Axiom
|
|
1043
|
|
1044 The original Power Set Axiom is this.
|
|
1045
|
|
1046 ∀ X ∃ A ∀ t ( t ∈ A ↔ t ⊆ X ) )
|
|
1047
|
|
1048 The existential quantifier is replaced by a function
|
|
1049
|
|
1050 Power : ( A : OD ) → OD
|
|
1051
|
|
1052 t ⊆ X is a record like this.
|
|
1053
|
|
1054 record _⊆_ ( A B : OD ) : Set (suc n) where
|
|
1055 field
|
|
1056 incl : { x : OD } → A ∋ x → B ∋ x
|
|
1057
|
|
1058 Axiom becomes likes this.
|
|
1059
|
|
1060 power→ : ( A t : OD) → Power A ∋ t → {x : OD} → t ∋ x → ¬ ¬ (A ∋ x)
|
|
1061 power← : (A t : OD) → ({x : OD} → (t ∋ x → A ∋ x)) → Power A ∋ t
|
|
1062
|
|
1063 The validity of the axioms are slight complicated, we have to define set of all subset. We define
|
|
1064 subset in a different form.
|
|
1065
|
359
|
1066 ZFSubset : (A x : HOD ) → HOD
|
|
1067 ZFSubset A x = record { od = record { def = λ y → odef A y ∧ odef x y } ; odmax = omin (odmax A) (odmax x) ; <odmax = lemma } where
|
|
1068 lemma : {y : Ordinal} → def (od A) y ∧ def (od x) y → y o< omin (odmax A) (odmax x)
|
|
1069 lemma {y} and = min1 (<odmax A (proj1 and)) (<odmax x (proj2 and))
|
273
|
1070
|
|
1071 We can prove,
|
|
1072
|
359
|
1073 ( {y : HOD } → x ∋ y → ZFSubset A x ∋ y ) ⇔ ( x ⊆ A )
|
273
|
1074
|
|
1075 We only have upper bound as an ordinal, but we have an obvious OD based on the order of Ordinals,
|
|
1076 which is an Ordinals with our Model.
|
|
1077
|
|
1078 Ord : ( a : Ordinal ) → OD
|
|
1079 Ord a = record { def = λ y → y o< a }
|
|
1080
|
|
1081 Def : (A : OD ) → OD
|
425
|
1082 Def A = Ord ( sup-o ( λ x → & ( ZFSubset A (* x )) ) )
|
273
|
1083
|
|
1084 This is slight larger than Power A, so we replace all elements x by A ∩ x (some of them may empty).
|
|
1085
|
|
1086 Power : OD → OD
|
425
|
1087 Power A = Replace (Def (Ord (& A))) ( λ x → A ∩ x )
|
273
|
1088
|
|
1089 Creating Power Set of Ordinals is rather easy, then we use replacement axiom on A ∩ x since we have this.
|
|
1090
|
359
|
1091 ∩-≡ : { a b : HOD } → ({x : HOD } → (a ∋ x → b ∋ x)) → od a == od ( b ∩ a )
|
273
|
1092
|
|
1093 In case of Ord a intro of Power Set axiom becomes valid.
|
|
1094
|
359
|
1095 ord-power← : (a : Ordinal ) (t : HOD) → ({x : HOD} → (t ∋ x → (Ord a) ∋ x)) → OPwr (Ord a) ∋ t
|
273
|
1096
|
|
1097 Using this, we can prove,
|
|
1098
|
359
|
1099 power→ : ( A t : HOD) → Power A ∋ t → {x : HOD} → t ∋ x → ¬ ¬ (A ∋ x)
|
|
1100 power← : (A t : HOD) → ({x : HOD} → (t ∋ x → A ∋ x)) → Power A ∋ t
|
273
|
1101
|
|
1102
|
|
1103 --Axiom of regularity, Axiom of choice, ε-induction
|
|
1104
|
|
1105 Axiom of regularity requires non self intersectable elements (which is called minimum), if we
|
|
1106 replace it by a function, it becomes a choice function. It makes axiom of choice valid.
|
|
1107
|
|
1108 This means we cannot prove axiom regularity form our model, and if we postulate this, axiom of
|
|
1109 choice also becomes valid.
|
|
1110
|
359
|
1111 minimal : (x : HOD ) → ¬ (x == od∅ )→ OD
|
425
|
1112 x∋minimal : (x : HOD ) → ( ne : ¬ (x == od∅ ) ) → def x ( & ( minimal x ne ) )
|
|
1113 minimal-1 : (x : HOD ) → ( ne : ¬ (x == od∅ ) ) → (y : HOD ) → ¬ ( def (minimal x ne) (& y)) ∧ (def x (& y) )
|
273
|
1114
|
|
1115 We can avoid this using ε-induction (a predicate is valid on all set if the predicate is true on some element of set).
|
|
1116 Assuming law of exclude middle, they say axiom of regularity will be proved, but we haven't check it yet.
|
|
1117
|
359
|
1118 ε-induction : { ψ : HOD → Set (suc n)}
|
|
1119 → ( {x : HOD } → ({ y : HOD } → x ∋ y → ψ y ) → ψ x )
|
|
1120 → (x : HOD ) → ψ x
|
273
|
1121
|
|
1122 In our model, we assumes the mapping between Ordinals and OD, this is actually the TransFinite induction in Ordinals.
|
|
1123
|
|
1124 The axiom of choice in the book is complicated using any pair in a set, so we use use a form in the Wikipedia.
|
|
1125
|
|
1126 ∀ X [ ∅ ∉ X → (∃ f : X → ⋃ X ) → ∀ A ∈ X ( f ( A ) ∈ A ) ]
|
|
1127
|
|
1128 We can formulate like this.
|
|
1129
|
|
1130 choice-func : (X : ZFSet ) → {x : ZFSet } → ¬ ( x ≈ ∅ ) → ( X ∋ x ) → ZFSet
|
|
1131 choice : (X : ZFSet ) → {A : ZFSet } → ( X∋A : X ∋ A ) → (not : ¬ ( A ≈ ∅ )) → A ∋ choice-func X not X∋A
|
|
1132
|
|
1133 It does not requires ∅ ∉ X .
|
|
1134
|
|
1135 --Axiom of choice and Law of Excluded Middle
|
|
1136
|
359
|
1137 In our model, since HOD has a mapping to Ordinals, it has evident order, which means well ordering theorem is valid,
|
273
|
1138 but it don't have correct form of the axiom yet. They say well ordering axiom is equivalent to the axiom of choice,
|
|
1139 but it requires law of the exclude middle.
|
|
1140
|
|
1141 Actually, it is well known to prove law of the exclude middle from axiom of choice in intuitionistic logic, and we can
|
|
1142 perform the proof in our mode. Using the definition like this, predicates and ODs are related and we can ask the
|
|
1143 set is empty or not if we have an axiom of choice, so we have the law of the exclude middle p ∨ ( ¬ p ) .
|
|
1144
|
359
|
1145 ppp : { p : Set n } { a : HOD } → record { def = λ x → p } ∋ a → p
|
273
|
1146 ppp {p} {a} d = d
|
|
1147
|
|
1148 We can prove axiom of choice from law excluded middle since we have TransFinite induction. So Axiom of choice
|
|
1149 and Law of Excluded Middle is equivalent in our mode.
|
|
1150
|
|
1151 --Relation-ship among ZF axiom
|
|
1152
|
|
1153 <center><img src="fig/axiom-dependency.svg"></center>
|
|
1154
|
|
1155 --Non constructive assumption in our model
|
|
1156
|
359
|
1157 mapping between HOD and Ordinals
|
273
|
1158
|
425
|
1159 & : HOD → Ordinal
|
|
1160 * : Ordinal → OD
|
|
1161 oiso : {x : HOD } → * ( & x ) ≡ x
|
|
1162 diso : {x : Ordinal } → & ( * x ) ≡ x
|
|
1163 c<→o< : {x y : HOD } → def y ( & x ) → & x o< & y
|
|
1164 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → & y o< osuc (& z)
|
273
|
1165
|
|
1166 Equivalence on OD
|
|
1167
|
359
|
1168 ==→o≡ : { x y : HOD } → (od x == od y) → x ≡ y
|
273
|
1169
|
|
1170 Upper bound
|
|
1171
|
359
|
1172 sup-o : (A : HOD) → ( ( x : Ordinal ) → def (od A) x → Ordinal ) → Ordinal
|
|
1173 sup-o< : (A : HOD) → { ψ : ( x : Ordinal ) → def (od A) x → Ordinal } → ∀ {x : Ordinal } → (lt : def (od A) x ) → ψ x lt o< sup-o A ψ
|
|
1174
|
|
1175 In order to have bounded ω,
|
|
1176
|
425
|
1177 hod-ord< : {x : HOD} → & x o< next (odmax x)
|
273
|
1178
|
|
1179 Axiom of choice and strong axiom of regularity.
|
|
1180
|
359
|
1181 minimal : (x : HOD ) → ¬ (x =h= od∅ )→ HOD
|
425
|
1182 x∋minimal : (x : HOD ) → ( ne : ¬ (x =h= od∅ ) ) → odef x ( & ( minimal x ne ) )
|
|
1183 minimal-1 : (x : HOD ) → ( ne : ¬ (x =h= od∅ ) ) → (y : HOD ) → ¬ ( odef (minimal x ne) (& y)) ∧ (odef x (& y) )
|
|
1184
|
|
1185 --V
|
|
1186
|
|
1187 The cumulative hierarchy
|
|
1188 V 0 := ∅
|
|
1189 V α + 1 := P ( V α )
|
|
1190 V α := ⋃ { V β | β < α }
|
|
1191
|
|
1192 Using TransFinite induction
|
|
1193
|
|
1194 V : ( β : Ordinal ) → HOD
|
|
1195 V β = TransFinite V1 β where
|
|
1196 V1 : (x : Ordinal ) → ( ( y : Ordinal) → y o< x → HOD ) → HOD
|
|
1197 V1 x V0 with trio< x o∅
|
|
1198 V1 x V0 | tri< a ¬b ¬c = ⊥-elim ( ¬x<0 a)
|
|
1199 V1 x V0 | tri≈ ¬a refl ¬c = Ord o∅
|
|
1200 V1 x V0 | tri> ¬a ¬b c with Oprev-p x
|
|
1201 V1 x V0 | tri> ¬a ¬b c | yes p = Power ( V0 (Oprev.oprev p ) (subst (λ k → _ o< k) (Oprev.oprev=x p) <-osuc ))
|
|
1202 V1 x V0 | tri> ¬a ¬b c | no ¬p =
|
|
1203 record { od = record { def = λ y → (y o< x ) ∧ ((lt : y o< x ) → odef (V0 y lt) x ) } ;
|
|
1204 odmax = x; <odmax = λ {x} lt → proj1 lt }
|
|
1205
|
|
1206 In our system, clearly V ⊆ HOD。
|
|
1207
|
|
1208 --L
|
|
1209
|
|
1210 The constructible Sets
|
|
1211 L 0 := ∅
|
|
1212 L α + 1 := Df (L α) -- Definable Power Set
|
|
1213 V α := ⋃ { L β | β < α }
|
|
1214
|
|
1215 What is Df? In our system, Power x is definable by Sup.
|
|
1216
|
|
1217 record Definitions : Set (suc n) where
|
|
1218 field
|
|
1219 Definition : HOD → HOD
|
|
1220
|
|
1221 open Definitions
|
|
1222
|
|
1223 Df : Definitions → (x : HOD) → HOD
|
|
1224 Df D x = Power x ∩ Definition D x
|
|
1225
|
|
1226 --L
|
|
1227
|
|
1228 L : ( β : Ordinal ) → Definitions → HOD
|
|
1229 L β D = TransFinite L1 β where
|
|
1230 L1 : (x : Ordinal ) → ( ( y : Ordinal) → y o< x → HOD ) → HOD
|
|
1231 L1 x L0 with trio< x o∅
|
|
1232 L1 x L0 | tri< a ¬b ¬c = ⊥-elim ( ¬x<0 a)
|
|
1233 L1 x L0 | tri≈ ¬a refl ¬c = Ord o∅
|
|
1234 L1 x L0 | tri> ¬a ¬b c with Oprev-p x
|
|
1235 L1 x L0 | tri> ¬a ¬b c | yes p = Df D ( L0 (Oprev.oprev p ) (subst (λ k → _ o< k) (Oprev.oprev=x p) <-osuc ))
|
|
1236 L1 x L0 | tri> ¬a ¬b c | no ¬p =
|
|
1237 record { od = record { def = λ y → (y o< x ) ∧ ((lt : y o< x ) → odef (L0 y lt) x ) } ;
|
|
1238 odmax = x; <odmax = λ {x} lt → proj1 lt }
|
|
1239
|
|
1240 --V=L
|
|
1241
|
|
1242 V=L0 : Set (suc n)
|
|
1243 V=L0 = (x : Ordinal) → V x ≡ L x record { Definition = λ y → y }
|
|
1244
|
|
1245 is obvious. Definitions should have some restrictions, such as it includes Nat.
|
|
1246
|
|
1247 --Some other ...
|
273
|
1248
|
|
1249 --So it this correct?
|
|
1250
|
|
1251 Our axiom are syntactically the same in the text book, but negations are slightly different.
|
|
1252
|
|
1253 If we assumes excluded middle, these are exactly same.
|
|
1254
|
|
1255 Even if we assumes excluded middle, intuitionistic logic itself remains consistent, but we cannot prove it.
|
|
1256
|
|
1257 Except the upper bound, axioms are simple logical relation.
|
|
1258
|
359
|
1259 Proof of existence of mapping between HOD and Ordinals are not obvious. We don't know we prove it or not.
|
273
|
1260
|
|
1261 Existence of the Upper bounds is a pure assumption, if we have not limit on Ordinals, it may contradicts,
|
|
1262 but we don't have explicit upper limit on Ordinals.
|
|
1263
|
|
1264 Several inference on our model or our axioms are basically parallel to the set theory text book, so it looks like correct.
|
|
1265
|
|
1266 --How to use Agda Set Theory
|
|
1267
|
|
1268 Assuming record ZF, classical set theory can be developed. If necessary, axiom of choice can be
|
|
1269 postulated or assuming law of excluded middle.
|
|
1270
|
|
1271 Instead, simply assumes non constructive assumption, various theory can be developed. We haven't check
|
|
1272 these assumptions are proved in record ZF, so we are not sure, these development is a result of ZF Set theory.
|
|
1273
|
|
1274 ZF record itself is not necessary, for example, topology theory without ZF can be possible.
|
|
1275
|
|
1276 --Topos and Set Theory
|
|
1277
|
|
1278 Topos is a mathematical structure in Category Theory, which is a Cartesian closed category which has a
|
|
1279 sub-object classifier.
|
|
1280
|
|
1281 Topos itself is model of intuitionistic logic.
|
|
1282
|
|
1283 Transitive Sets are objects of Cartesian closed category.
|
|
1284 It is possible to introduce Power Set Functor on it
|
|
1285
|
|
1286 We can use replacement A ∩ x for each element in Transitive Set,
|
|
1287 in the similar way of our power set axiom. I
|
|
1288
|
|
1289 A model of ZF Set theory can be constructed on top of the Topos which is shown in Oisus.
|
|
1290
|
|
1291 Our Agda model is a proof theoretic version of it.
|
|
1292
|
|
1293 --Cardinal number and Continuum hypothesis
|
|
1294
|
|
1295 Axiom of choice is required to define cardinal number
|
|
1296
|
|
1297 definition of cardinal number is not yet done
|
|
1298
|
|
1299 definition of filter is not yet done
|
|
1300
|
|
1301 we may have a model without axiom of choice or without continuum hypothesis
|
|
1302
|
|
1303 Possible representation of continuum hypothesis is this.
|
|
1304
|
|
1305 continuum-hyphotheis : (a : Ordinal) → Power (Ord a) ⊆ Ord (osuc a)
|
|
1306
|
|
1307 --Filter
|
|
1308
|
|
1309 filter is a dual of ideal on boolean algebra or lattice. Existence on natural number
|
|
1310 is depends on axiom of choice.
|
|
1311
|
359
|
1312 record Filter ( L : HOD ) : Set (suc n) where
|
273
|
1313 field
|
|
1314 filter : OD
|
|
1315 proper : ¬ ( filter ∋ od∅ )
|
|
1316 inL : filter ⊆ L
|
359
|
1317 filter1 : { p q : HOD } → q ⊆ L → filter ∋ p → p ⊆ q → filter ∋ q
|
|
1318 filter2 : { p q : HOD } → filter ∋ p → filter ∋ q → filter ∋ (p ∩ q)
|
273
|
1319
|
|
1320 We may construct a model of non standard analysis or set theory.
|
|
1321
|
|
1322 This may be simpler than classical forcing theory ( not yet done).
|
|
1323
|
|
1324 --Programming Mathematics
|
|
1325
|
|
1326 Mathematics is a functional programming in Agda where proof is a value of a variable. The mathematical
|
|
1327 structure are
|
|
1328
|
|
1329 record and data
|
|
1330
|
|
1331 Proof is check by type consistency not by the computation, but it may include some normalization.
|
|
1332
|
|
1333 Type inference and termination is not so clear in multi recursions.
|
|
1334
|
|
1335 Defining Agda record is a good way to understand mathematical theory, for examples,
|
|
1336
|
|
1337 Category theory ( Yoneda lemma, Floyd Adjunction functor theorem, Applicative functor )
|
|
1338 Automaton ( Subset construction、Language containment)
|
|
1339
|
|
1340 are proved in Agda.
|
|
1341
|
|
1342 --link
|
|
1343
|
|
1344 Summer school of foundation of mathematics (in Japanese)
|
|
1345 <br> <a href="https://www.sci.shizuoka.ac.jp/~math/yorioka/ss2019/">
|
|
1346 https://www.sci.shizuoka.ac.jp/~math/yorioka/ss2019/
|
|
1347 </a>
|
|
1348
|
|
1349 Foundation of axiomatic set theory (in Japanese)
|
|
1350 <br> <a href="https://www.sci.shizuoka.ac.jp/~math/yorioka/ss2019/sakai0.pdf">
|
|
1351 https://www.sci.shizuoka.ac.jp/~math/yorioka/ss2019/sakai0.pdf
|
|
1352 </a>
|
|
1353
|
|
1354 Agda
|
|
1355 <br> <a href="https://agda.readthedocs.io/en/v2.6.0.1/">
|
|
1356 https://agda.readthedocs.io/en/v2.6.0.1/
|
|
1357 </a>
|
|
1358
|
|
1359 ZF-in-Agda source
|
|
1360 <br> <a href="https://github.com/shinji-kono/zf-in-agda.git">
|
|
1361 https://github.com/shinji-kono/zf-in-agda.git
|
|
1362 </a>
|
|
1363
|
|
1364 Category theory in Agda source
|
|
1365 <br> <a href="https://github.com/shinji-kono/category-exercise-in-agda">
|
|
1366 https://github.com/shinji-kono/category-exercise-in-agda
|
|
1367 </a>
|
|
1368
|
|
1369
|
|
1370
|