Mercurial > hg > Members > kono > Proof > ZF-in-agda
comparison zf-in-agda.ind @ 336:231deb255e74
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 06 Jul 2020 17:14:46 +0900 |
parents | 197e0b3d39dc |
children | 5e22b23ee3fd |
comparison
equal
deleted
inserted
replaced
335:daafa2213dd2 | 336:231deb255e74 |
---|---|
52 | 52 |
53 It has some amount of difficulty and self circulating discussion. | 53 It has some amount of difficulty and self circulating discussion. |
54 | 54 |
55 I'm planning to do it in my old age, but I'm enough age now. | 55 I'm planning to do it in my old age, but I'm enough age now. |
56 | 56 |
57 This is done during from May to September. | 57 if you familier with Agda, you can skip to |
58 <a href="#set-theory"> | |
59 there | |
60 </a> | |
58 | 61 |
59 --Agda and Intuitionistic Logic | 62 --Agda and Intuitionistic Logic |
60 | 63 |
61 Curry Howard Isomorphism | 64 Curry Howard Isomorphism |
62 | 65 |
260 Writing some type in a module argument is the same as postulating a type, but | 263 Writing some type in a module argument is the same as postulating a type, but |
261 postulate can be written the middle of a proof. | 264 postulate can be written the middle of a proof. |
262 | 265 |
263 postulate can be constructive. | 266 postulate can be constructive. |
264 | 267 |
265 postulate can be inconsistent, which result everything has a proof. | 268 postulate can be inconsistent, which result everything has a proof. Actualy this assumption |
269 doesnot work for Ordinals, we discuss this later. | |
266 | 270 |
267 -- A ∨ B | 271 -- A ∨ B |
268 | 272 |
269 data _∨_ (A B : Set) : Set where | 273 data _∨_ (A B : Set) : Set where |
270 case1 : A → A ∨ B | 274 case1 : A → A ∨ B |
401 | 405 |
402 If we cannot prove something, we can safely postulate it unless it leads a contradiction. | 406 If we cannot prove something, we can safely postulate it unless it leads a contradiction. |
403 | 407 |
404 --Classical story of ZF Set Theory | 408 --Classical story of ZF Set Theory |
405 | 409 |
410 <a name="set-theory"> | |
406 Assuming ZF, constructing a model of ZF is a flow of classical Set Theory, which leads | 411 Assuming ZF, constructing a model of ZF is a flow of classical Set Theory, which leads |
407 a relative consistency proof of the Set Theory. | 412 a relative consistency proof of the Set Theory. |
408 Ordinal number is used in the flow. | 413 Ordinal number is used in the flow. |
409 | 414 |
410 In Agda, first we defines Ordinal numbers (Ordinals), then introduce Ordinal Definable Set (OD). | 415 In Agda, first we defines Ordinal numbers (Ordinals), then introduce Ordinal Definable Set (OD). |
451 osuc-≡< : { a x : ord } → x o< osuc a → (x ≡ a ) ∨ (x o< a) | 456 osuc-≡< : { a x : ord } → x o< osuc a → (x ≡ a ) ∨ (x o< a) |
452 TransFinite : { ψ : ord → Set (suc n) } | 457 TransFinite : { ψ : ord → Set (suc n) } |
453 → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x ) | 458 → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x ) |
454 → ∀ (x : ord) → ψ x | 459 → ∀ (x : ord) → ψ x |
455 | 460 |
456 --Concrete Ordinals | 461 --Concrete Ordinals or Countable Ordinals |
457 | 462 |
458 We can define a list like structure with level, which is a kind of two dimensional infinite array. | 463 We can define a list like structure with level, which is a kind of two dimensional infinite array. |
459 | 464 |
460 data OrdinalD {n : Level} : (lv : Nat) → Set n where | 465 data OrdinalD {n : Level} : (lv : Nat) → Set n where |
461 Φ : (lv : Nat) → OrdinalD lv | 466 Φ : (lv : Nat) → OrdinalD lv |
523 This operation can be performed within a ZF Set theory. Classical Set Theory assumes | 528 This operation can be performed within a ZF Set theory. Classical Set Theory assumes |
524 ZF, so this kind of thing is allowed. | 529 ZF, so this kind of thing is allowed. |
525 | 530 |
526 But in our case, we have no ZF theory, so we are going to use Ordinals. | 531 But in our case, we have no ZF theory, so we are going to use Ordinals. |
527 | 532 |
533 The idea is to use an ordinal as a pointer to a record which defines a Set. | |
534 If the recored defines a series of Ordinals which is a pointer to the Set. | |
535 This record looks like a Set. | |
528 | 536 |
529 --Ordinal Definable Set | 537 --Ordinal Definable Set |
530 | 538 |
531 We can define a sbuset of Ordinals using predicates. What is a subset? | 539 We can define a sbuset of Ordinals using predicates. What is a subset? |
532 | 540 |
538 field | 546 field |
539 def : (x : Ordinal ) → Set n | 547 def : (x : Ordinal ) → Set n |
540 | 548 |
541 Ordinals itself is not a set in a ZF Set theory but a class. In OD, | 549 Ordinals itself is not a set in a ZF Set theory but a class. In OD, |
542 | 550 |
543 record { def = λ x → true } | 551 data One : Set n where |
544 | 552 OneObj : One |
545 means Ordinals itself, so ODs are larger than a notion of ZF Set Theory, | 553 |
546 but we don't care about it. | 554 record { def = λ x → One } |
547 | 555 |
548 | 556 means it accepets all Ordinals, i.e. this is Ordinals itself, so ODs are larger than ZF Set. |
549 --∋ in OD | 557 You can say OD is a class in ZF Set Theory term. |
550 | 558 |
551 OD is a predicate on Ordinals and it does not contains OD directly. If we have a mapping | 559 |
552 | 560 --OD is not ZF Set |
553 od→ord : OD → Ordinal | 561 |
554 | 562 If we have 1 to 1 mapping between an OD and an Ordinal, OD contains several ODs and OD looks like |
555 we may check an OD is an element of the OD using def. | 563 a Set. The idea is to use an ordinal as a pointer to OD. |
564 Unfortunately this scheme does not work well. As we saw OD includes all Ordinals, | |
565 which is a maximum of OD, but Ordinals has no maximum at all. So we have a contradction like | |
566 | |
567 ¬OD-order : ( od→ord : OD → Ordinal ) | |
568 → ( ord→od : Ordinal → OD ) → ( { x y : OD } → def y ( od→ord x ) → od→ord x o< od→ord y) → ⊥ | |
569 ¬OD-order od→ord ord→od c<→o< = ? | |
570 | |
571 Actualy we can prove this contrdction, so we need some restrctions on OD. | |
572 | |
573 This is a kind of Russel paradox, that is if OD contains everything, what happens if it contains itself. | |
574 | |
575 -- HOD : Hereditarily Ordinal Definable | |
576 | |
577 What we need is a bounded OD, the containment is limited by an ordinal. | |
578 | |
579 record HOD : Set (suc n) where | |
580 field | |
581 od : OD | |
582 odmax : Ordinal | |
583 <odmax : {y : Ordinal} → def od y → y o< odmax | |
584 | |
585 In classical Set Theory, HOD stands for Hereditarily Ordinal Definable, which means | |
586 | |
587 HOD = { x | TC x ⊆ OD } | |
588 | |
589 TC x is all transitive closure of x, that is elements of x and following all elements of them are all OD. But | |
590 what is x? In this case, x is an Set which we don't have yet. In our case, HOD is a bounded OD. | |
591 | |
592 --1 to 1 mapping between an HOD and an Ordinal | |
593 | |
594 HOD is a predicate on Ordinals and the solution is bounded by some ordinal. If we have a mapping | |
595 | |
596 od→ord : HOD → Ordinal | |
597 ord→od : Ordinal → HOD | |
598 oiso : {x : HOD } → ord→od ( od→ord x ) ≡ x | |
599 diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x | |
600 | |
601 we can check an HOD is an element of the OD using def. | |
556 | 602 |
557 A ∋ x can be define as follows. | 603 A ∋ x can be define as follows. |
558 | 604 |
559 _∋_ : ( A x : OD ) → Set n | 605 _∋_ : ( A x : HOD ) → Set n |
560 _∋_ A x = def A ( od→ord x ) | 606 _∋_ A x = def (od A) ( od→ord x ) |
561 | 607 |
562 In ψ : Ordinal → Set, if A is a record { def = λ x → ψ x } , then | 608 In ψ : Ordinal → Set, if A is a record { def = λ x → ψ x } , then |
563 | 609 |
564 A x = def A ( od→ord x ) = ψ (od→ord x) | 610 A x = def A ( od→ord x ) = ψ (od→ord x) |
565 | |
566 --1 to 1 mapping between an OD and an Ordinal | |
567 | |
568 od→ord : OD → Ordinal | |
569 ord→od : Ordinal → OD | |
570 oiso : {x : OD } → ord→od ( od→ord x ) ≡ x | |
571 diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x | |
572 | 611 |
573 They say the existing of the mappings can be proved in Classical Set Theory, but we | 612 They say the existing of the mappings can be proved in Classical Set Theory, but we |
574 simply assumes these non constructively. | 613 simply assumes these non constructively. |
575 | 614 |
576 We use postulate, it may contains additional restrictions which are not clear now. | |
577 It look like the mapping should be a subset of Ordinals, but we don't explicitly | |
578 state it. | |
579 | |
580 <center><img src="fig/ord-od-mapping.svg"></center> | 615 <center><img src="fig/ord-od-mapping.svg"></center> |
581 | 616 |
582 --Order preserving in the mapping of OD and Ordinal | 617 --Order preserving in the mapping of OD and Ordinal |
583 | 618 |
584 Ordinals have the order and OD has a natural order based on inclusion ( def / ∋ ). | 619 Ordinals have the order and HOD has a natural order based on inclusion ( def / ∋ ). |
585 | 620 |
586 def y ( od→ord x ) | 621 def (od y) ( od→ord x ) |
587 | 622 |
588 An elements of OD should be defined before the OD, that is, an ordinal corresponding an elements | 623 An elements of HOD should be defined before the HOD, that is, an ordinal corresponding an elements |
589 have to be smaller than the corresponding ordinal of the containing OD. | 624 have to be smaller than the corresponding ordinal of the containing OD. |
590 | 625 We also assumes subset is always smaller. This is necessary to make a limit of Power Set. |
591 c<→o< : {x y : OD } → def y ( od→ord x ) → od→ord x o< od→ord y | 626 |
592 | 627 c<→o< : {x y : HOD } → def (od y) ( od→ord x ) → od→ord x o< od→ord y |
593 This is also said to be provable in classical Set Theory, but we simply assumes it. | 628 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → od→ord y o< osuc (od→ord z) |
594 | 629 |
595 OD has an order based on the corresponding ordinal, but it may not have corresponding def / ∋ | 630 If wa assumes reverse order preservation, |
596 relation. This means the reverse order preservation, | |
597 | 631 |
598 o<→c< : {n : Level} {x y : Ordinal } → x o< y → def (ord→od y) x | 632 o<→c< : {n : Level} {x y : Ordinal } → x o< y → def (ord→od y) x |
599 | 633 |
600 is not valid. If we assumes it, ∀ x ∋ ∅ becomes true, which manes all OD becomes Ordinals in | 634 ∀ x ∋ ∅ becomes true, which manes all OD becomes Ordinals in the model. |
601 the model. | |
602 | 635 |
603 <center><img src="fig/ODandOrdinals.svg"></center> | 636 <center><img src="fig/ODandOrdinals.svg"></center> |
604 | |
605 --ISO | |
606 | |
607 It also requires isomorphisms, | |
608 | |
609 oiso : {x : OD } → ord→od ( od→ord x ) ≡ x | |
610 diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x | |
611 | |
612 | 637 |
613 --Various Sets | 638 --Various Sets |
614 | 639 |
615 In classical Set Theory, there is a hierarchy call L, which can be defined by a predicate. | 640 In classical Set Theory, there is a hierarchy call L, which can be defined by a predicate. |
616 | 641 |
617 Ordinal / things satisfies axiom of Ordinal / extension of natural number | 642 Ordinal / things satisfies axiom of Ordinal / extension of natural number |
618 V / hierarchical construction of Set from φ | 643 V / hierarchical construction of Set from φ |
619 L / hierarchical predicate definable construction of Set from φ | 644 L / hierarchical predicate definable construction of Set from φ |
645 HOD / Hereditarily Ordinal Definable | |
620 OD / equational formula on Ordinals | 646 OD / equational formula on Ordinals |
621 Agda Set / Type / it also has a level | 647 Agda Set / Type / it also has a level |
622 | 648 |
623 | 649 |
624 --Fixes on ZF to intuitionistic logic | 650 --Fixes on ZF to intuitionistic logic |
680 | 706 |
681 --pair in OD | 707 --pair in OD |
682 | 708 |
683 OD is an equation on Ordinals, we can simply write axiom of pair in the OD. | 709 OD is an equation on Ordinals, we can simply write axiom of pair in the OD. |
684 | 710 |
685 _,_ : OD → OD → OD | 711 _,_ : HOD → HOD → HOD |
686 x , y = record { def = λ t → (t ≡ od→ord x ) ∨ ( t ≡ od→ord y ) } | 712 x , y = record { od = record { def = λ t → (t ≡ od→ord x ) ∨ ( t ≡ od→ord y ) } ; odmax = ? ; <odmax = ? } |
713 | |
714 It is easy to find out odmax from odmax of x and y. | |
687 | 715 |
688 ≡ is an equality of λ terms, but please not that this is equality on Ordinals. | 716 ≡ is an equality of λ terms, but please not that this is equality on Ordinals. |
689 | 717 |
690 --Validity of Axiom of Pair | 718 --Validity of Axiom of Pair |
691 | 719 |
739 record _==_ ( a b : OD ) : Set n where | 767 record _==_ ( a b : OD ) : Set n where |
740 field | 768 field |
741 eq→ : ∀ { x : Ordinal } → def a x → def b x | 769 eq→ : ∀ { x : Ordinal } → def a x → def b x |
742 eq← : ∀ { x : Ordinal } → def b x → def a x | 770 eq← : ∀ { x : Ordinal } → def b x → def a x |
743 | 771 |
744 Actually, (z : OD) → (A ∋ z) ⇔ (B ∋ z) implies A == B. | 772 Actually, (z : HOD) → (A ∋ z) ⇔ (B ∋ z) implies od A == od B. |
745 | 773 |
746 extensionality0 : {A B : OD } → ((z : OD) → (A ∋ z) ⇔ (B ∋ z)) → A == B | 774 extensionality0 : {A B : HOD } → ((z : HOD) → (A ∋ z) ⇔ (B ∋ z)) → od A == od B |
747 eq→ (extensionality0 {A} {B} eq ) {x} d = ? | 775 eq→ (extensionality0 {A} {B} eq ) {x} d = ? |
748 eq← (extensionality0 {A} {B} eq ) {x} d = ? | 776 eq← (extensionality0 {A} {B} eq ) {x} d = ? |
749 | 777 |
750 ? are def B x and def A x and these are generated from eq : (z : OD) → (A ∋ z) ⇔ (B ∋ z) . | 778 ? are def B x and def A x and these are generated from eq : (z : OD) → (A ∋ z) ⇔ (B ∋ z) . |
751 | 779 |
752 Actual proof is rather complicated. | 780 Actual proof is rather complicated. |
753 | 781 |
754 eq→ (extensionality0 {A} {B} eq ) {x} d = def-iso {A} {B} (sym diso) (proj1 (eq (ord→od x))) d | 782 eq→ (extensionality0 {A} {B} eq ) {x} d = odef-iso {A} {B} (sym diso) (proj1 (eq (ord→od x))) d |
755 eq← (extensionality0 {A} {B} eq ) {x} d = def-iso {B} {A} (sym diso) (proj2 (eq (ord→od x))) d | 783 eq← (extensionality0 {A} {B} eq ) {x} d = odef-iso {B} {A} (sym diso) (proj2 (eq (ord→od x))) d |
756 | 784 |
757 where | 785 where |
758 | 786 |
759 def-iso : {A B : OD } {x y : Ordinal } → x ≡ y → (def A y → def B y) → def A x → def B x | 787 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 |
760 def-iso refl t = t | 788 odef-iso refl t = t |
761 | 789 |
762 --Validity of Axiom of Extensionality | 790 --Validity of Axiom of Extensionality |
763 | 791 |
764 If we can derive (w ∋ A) ⇔ (w ∋ B) from A == B, the axiom becomes valid, but it seems impossible, | 792 If we can derive (w ∋ A) ⇔ (w ∋ B) from od A == od B, the axiom becomes valid, but it seems impossible, |
765 so we assumes | 793 so we assumes |
766 | 794 |
767 ==→o≡ : { x y : OD } → (x == y) → x ≡ y | 795 ==→o≡ : { x y : HOD } → (od x == od y) → x ≡ y |
768 | 796 |
769 Using this, we have | 797 Using this, we have |
770 | 798 |
771 extensionality : {A B w : OD } → ((z : OD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B) | 799 extensionality : {A B w : HOD } → ((z : HOD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B) |
772 proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d | 800 proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d |
773 proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d | 801 proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d |
774 | |
775 This assumption means we may have an equivalence set on any predicates. | |
776 | 802 |
777 --Non constructive assumptions so far | 803 --Non constructive assumptions so far |
778 | 804 |
779 We have correspondence between OD and Ordinals and one directional order preserving. | 805 od→ord : HOD → Ordinal |
780 | 806 ord→od : Ordinal → HOD |
781 We also have equality assumption. | 807 c<→o< : {x y : HOD } → def (od y) ( od→ord x ) → od→ord x o< od→ord y |
782 | 808 ⊆→o≤ : {y z : HOD } → ({x : Ordinal} → def (od y) x → def (od z) x ) → od→ord y o< osuc (od→ord z) |
783 od→ord : OD → Ordinal | 809 oiso : {x : HOD } → ord→od ( od→ord x ) ≡ x |
784 ord→od : Ordinal → OD | 810 diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x |
785 oiso : {x : OD } → ord→od ( od→ord x ) ≡ x | 811 ==→o≡ : {x y : HOD } → (od x == od y) → x ≡ y |
786 diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x | 812 sup-o : (A : HOD) → ( ( x : Ordinal ) → def (od A) x → Ordinal ) → Ordinal |
787 c<→o< : {x y : OD } → def y ( od→ord x ) → od→ord x o< od→ord y | 813 sup-o< : (A : HOD) → { ψ : ( x : Ordinal ) → def (od A) x → Ordinal } → ∀ {x : Ordinal } → (lt : def (od A) x ) → ψ x lt o< sup-o A ψ |
788 ==→o≡ : { x y : OD } → (x == y) → x ≡ y | |
789 | 814 |
790 | 815 |
791 --Axiom which have negation form | 816 --Axiom which have negation form |
792 | 817 |
793 Union, Selection | 818 Union, Selection |