Mercurial > hg > Members > kono > Proof > ZF-in-agda
view cardinal.agda @ 252:8a58e2cd1f55
give up product uniquness
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 29 Aug 2019 03:03:04 +0900 |
parents | 9e0125b06e76 |
children | 0446b6c5e7bc |
line wrap: on
line source
open import Level open import Ordinals module cardinal {n : Level } (O : Ordinals {n}) where open import zf open import logic import OD open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) open import Relation.Binary.PropositionalEquality open import Data.Nat.Properties open import Data.Empty open import Relation.Nullary open import Relation.Binary open import Relation.Binary.Core open inOrdinal O open OD O open OD.OD open _∧_ open _∨_ open Bool -- we have to work on Ordinal to keep OD Level n -- since we use p∨¬p which works only on Level n <_,_> : (x y : OD) → OD < x , y > = (x , x ) , (x , y ) open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ ) open _==_ exg-pair : { x y : OD } → (x , y ) == ( y , x ) exg-pair {x} {y} = record { eq→ = left ; eq← = right } where left : {z : Ordinal} → def (x , y) z → def (y , x) z left (case1 t) = case2 t left (case2 t) = case1 t right : {z : Ordinal} → def (y , x) z → def (x , y) z right (case1 t) = case2 t right (case2 t) = case1 t ==-trans : { x y z : OD } → x == y → y == z → x == z ==-trans x=y y=z = record { eq→ = λ {m} t → eq→ y=z (eq→ x=y t) ; eq← = λ {m} t → eq← x=y (eq← y=z t) } ==-sym : { x y : OD } → x == y → y == x ==-sym x=y = record { eq→ = λ {m} t → eq← x=y t ; eq← = λ {m} t → eq→ x=y t } ord≡→≡ : { x y : OD } → od→ord x ≡ od→ord y → x ≡ y ord≡→≡ eq = subst₂ (λ j k → j ≡ k ) oiso oiso ( cong ( λ k → ord→od k ) eq ) od≡→≡ : { x y : Ordinal } → ord→od x ≡ ord→od y → x ≡ y od≡→≡ eq = subst₂ (λ j k → j ≡ k ) diso diso ( cong ( λ k → od→ord k ) eq ) eq-prod : { x x' y y' : OD } → x ≡ x' → y ≡ y' → < x , y > ≡ < x' , y' > eq-prod refl refl = refl prod-eq : { x x' y y' : OD } → < x , y > == < x' , y' > → (x ≡ x' ) ∧ ( y ≡ y' ) prod-eq {x} {x'} {y} {y'} eq = record { proj1 = lemmax ; proj2 = lemmay } where lemma0 : {x y z : OD } → ( x , x ) == ( z , y ) → x ≡ y lemma0 {x} {y} eq with trio< (od→ord x) (od→ord y) lemma0 {x} {y} eq | tri< a ¬b ¬c with eq← eq {od→ord y} (case2 refl) lemma0 {x} {y} eq | tri< a ¬b ¬c | case1 s = ⊥-elim ( o<¬≡ (sym s) a ) lemma0 {x} {y} eq | tri< a ¬b ¬c | case2 s = ⊥-elim ( o<¬≡ (sym s) a ) lemma0 {x} {y} eq | tri≈ ¬a b ¬c = ord≡→≡ b lemma0 {x} {y} eq | tri> ¬a ¬b c with eq← eq {od→ord y} (case2 refl) lemma0 {x} {y} eq | tri> ¬a ¬b c | case1 s = ⊥-elim ( o<¬≡ s c ) lemma0 {x} {y} eq | tri> ¬a ¬b c | case2 s = ⊥-elim ( o<¬≡ s c ) lemma2 : {x y z : OD } → ( x , x ) == ( z , y ) → z ≡ y lemma2 {x} {y} {z} eq = trans (sym (lemma0 lemma3 )) ( lemma0 eq ) where lemma3 : ( x , x ) == ( y , z ) lemma3 = ==-trans eq exg-pair lemma1 : {x y : OD } → ( x , x ) == ( y , y ) → x ≡ y lemma1 {x} {y} eq with eq← eq {od→ord y} (case2 refl) lemma1 {x} {y} eq | case1 s = ord≡→≡ (sym s) lemma1 {x} {y} eq | case2 s = ord≡→≡ (sym s) lemma4 : {x y z : OD } → ( x , y ) == ( x , z ) → y ≡ z lemma4 {x} {y} {z} eq with eq← eq {od→ord z} (case2 refl) lemma4 {x} {y} {z} eq | case1 s with ord≡→≡ s -- x ≡ z ... | refl with lemma2 (==-sym eq ) ... | refl = refl lemma4 {x} {y} {z} eq | case2 s = ord≡→≡ (sym s) -- y ≡ z lemmax : x ≡ x' lemmax with eq→ eq {od→ord (x , x)} (case1 refl) lemmax | case1 s = lemma1 (ord→== s ) -- (x,x)≡(x',x') lemmax | case2 s with lemma2 (ord→== s ) -- (x,x)≡(x',y') with x'≡y' ... | refl = lemma1 (ord→== s ) lemmay : y ≡ y' lemmay with lemmax ... | refl with lemma4 eq -- with (x,y)≡(x,y') ... | eq1 = lemma4 (ord→== (cong (λ k → od→ord k ) eq1 )) data ord-pair : (p : Ordinal) → Set n where pair : (x y : Ordinal ) → ord-pair ( od→ord ( < ord→od x , ord→od y > ) ) ZFProduct : OD ZFProduct = record { def = λ x → ord-pair x } eq-pair : { x x' y y' : Ordinal } → x ≡ x' → y ≡ y' → pair x y ≅ pair x' y' eq-pair refl refl = HE.refl pi1 : { p : Ordinal } → ord-pair p → Ordinal pi1 ( pair x y) = x π1 : { p : OD } → ZFProduct ∋ p → Ordinal π1 lt = pi1 lt pi2 : { p : Ordinal } → ord-pair p → Ordinal pi2 ( pair x y ) = y π2 : { p : OD } → ZFProduct ∋ p → Ordinal π2 lt = pi2 lt p-cons : ( x y : OD ) → ZFProduct ∋ < x , y > p-cons x y = def-subst {_} {_} {ZFProduct} {od→ord (< x , y >)} (pair (od→ord x) ( od→ord y )) refl ( let open ≡-Reasoning in begin od→ord < ord→od (od→ord x) , ord→od (od→ord y) > ≡⟨ cong₂ (λ j k → od→ord < j , k >) oiso oiso ⟩ od→ord < x , y > ∎ ) p-iso1 : { ox oy : Ordinal } → ZFProduct ∋ < ord→od ox , ord→od oy > p-iso1 {ox} {oy} = pair ox oy postulate p-iso : { x : OD } → (p : ZFProduct ∋ x ) → < ord→od (π1 p) , ord→od (π2 p) > ≡ x ∋-p : (A x : OD ) → Dec ( A ∋ x ) ∋-p A x with p∨¬p ( A ∋ x ) ∋-p A x | case1 t = yes t ∋-p A x | case2 t = no t _⊗_ : (A B : OD) → OD A ⊗ B = record { def = λ x → def ZFProduct x ∧ ( { x : Ordinal } → (p : def ZFProduct x ) → checkAB p ) } where checkAB : { p : Ordinal } → def ZFProduct p → Set n checkAB (pair x y) = def A x ∧ def B y func→od0 : (f : Ordinal → Ordinal ) → OD func→od0 f = record { def = λ x → def ZFProduct x ∧ ( { x : Ordinal } → (p : def ZFProduct x ) → checkfunc p ) } where checkfunc : { p : Ordinal } → def ZFProduct p → Set n checkfunc (pair x y) = f x ≡ y -- Power (Power ( A ∪ B )) ∋ ( A ⊗ B ) Func : ( A B : OD ) → OD Func A B = record { def = λ x → def (Power (A ⊗ B)) x } -- power→ : ( A t : OD) → Power A ∋ t → {x : OD} → t ∋ x → ¬ ¬ (A ∋ x) func→od : (f : Ordinal → Ordinal ) → ( dom : OD ) → OD func→od f dom = Replace dom ( λ x → < x , ord→od (f (od→ord x)) > ) record Func←cd { dom cod : OD } {f : Ordinal } : Set n where field func-1 : Ordinal → Ordinal func→od∈Func-1 : Func dom cod ∋ func→od func-1 dom od→func : { dom cod : OD } → {f : Ordinal } → def (Func dom cod ) f → Func←cd {dom} {cod} {f} od→func {dom} {cod} {f} lt = record { func-1 = λ x → sup-o ( λ y → lemma x y ) ; func→od∈Func-1 = record { proj1 = {!!} ; proj2 = {!!} } } where lemma : Ordinal → Ordinal → Ordinal lemma x y with IsZF.power→ isZF (dom ⊗ cod) (ord→od f) (subst (λ k → def (Power (dom ⊗ cod)) k ) (sym diso) lt ) | ∋-p (ord→od f) (ord→od y) lemma x y | p | no n = o∅ lemma x y | p | yes f∋y = lemma2 (proj1 (double-neg-eilm ( p {ord→od y} f∋y ))) where -- p : {y : OD} → f ∋ y → ¬ ¬ (dom ⊗ cod ∋ y) lemma2 : {p : Ordinal} → ord-pair p → Ordinal lemma2 (pair x1 y1) with decp ( x1 ≡ x) lemma2 (pair x1 y1) | yes p = y1 lemma2 (pair x1 y1) | no ¬p = o∅ fod : OD fod = Replace dom ( λ x → < x , ord→od (sup-o ( λ y → lemma (od→ord x) y )) > ) open Func←cd -- contra position of sup-o< -- -- postulate -- -- contra-position of mimimulity of supermum required in Cardinal -- sup-x : ( Ordinal → Ordinal ) → Ordinal -- sup-lb : { ψ : Ordinal → Ordinal } → {z : Ordinal } → z o< sup-o ψ → z o< osuc (ψ (sup-x ψ)) ------------ -- -- Onto map -- def X x -> xmap -- X ---------------------------> Y -- ymap <- def Y y -- record Onto (X Y : OD ) : Set n where field xmap : Ordinal ymap : Ordinal xfunc : def (Func X Y) xmap yfunc : def (Func Y X) ymap onto-iso : {y : Ordinal } → (lty : def Y y ) → func-1 ( od→func {X} {Y} {xmap} xfunc ) ( func-1 (od→func yfunc) y ) ≡ y open Onto onto-restrict : {X Y Z : OD} → Onto X Y → ({x : OD} → _⊆_ Z Y {x}) → Onto X Z onto-restrict {X} {Y} {Z} onto Z⊆Y = record { xmap = xmap1 ; ymap = zmap ; xfunc = xfunc1 ; yfunc = zfunc ; onto-iso = onto-iso1 } where xmap1 : Ordinal xmap1 = od→ord (Select (ord→od (xmap onto)) {!!} ) zmap : Ordinal zmap = {!!} xfunc1 : def (Func X Z) xmap1 xfunc1 = {!!} zfunc : def (Func Z X) zmap zfunc = {!!} onto-iso1 : {z : Ordinal } → (ltz : def Z z ) → func-1 (od→func xfunc1 ) (func-1 (od→func zfunc ) z ) ≡ z onto-iso1 = {!!} record Cardinal (X : OD ) : Set n where field cardinal : Ordinal conto : Onto X (Ord cardinal) cmax : ( y : Ordinal ) → cardinal o< y → ¬ Onto X (Ord y) cardinal : (X : OD ) → Cardinal X cardinal X = record { cardinal = sup-o ( λ x → proj1 ( cardinal-p x) ) ; conto = onto ; cmax = cmax } where cardinal-p : (x : Ordinal ) → ( Ordinal ∧ Dec (Onto X (Ord x) ) ) cardinal-p x with p∨¬p ( Onto X (Ord x) ) cardinal-p x | case1 True = record { proj1 = x ; proj2 = yes True } cardinal-p x | case2 False = record { proj1 = o∅ ; proj2 = no False } S = sup-o (λ x → proj1 (cardinal-p x)) lemma1 : (x : Ordinal) → ((y : Ordinal) → y o< x → Lift (suc n) (y o< (osuc S) → Onto X (Ord y))) → Lift (suc n) (x o< (osuc S) → Onto X (Ord x) ) lemma1 x prev with trio< x (osuc S) lemma1 x prev | tri< a ¬b ¬c with osuc-≡< a lemma1 x prev | tri< a ¬b ¬c | case1 x=S = lift ( λ lt → {!!} ) lemma1 x prev | tri< a ¬b ¬c | case2 x<S = lift ( λ lt → lemma2 ) where lemma2 : Onto X (Ord x) lemma2 with prev {!!} {!!} ... | lift t = t {!!} lemma1 x prev | tri≈ ¬a b ¬c = lift ( λ lt → ⊥-elim ( o<¬≡ b lt )) lemma1 x prev | tri> ¬a ¬b c = lift ( λ lt → ⊥-elim ( o<> c lt )) onto : Onto X (Ord S) onto with TransFinite {λ x → Lift (suc n) ( x o< osuc S → Onto X (Ord x) ) } lemma1 S ... | lift t = t <-osuc cmax : (y : Ordinal) → S o< y → ¬ Onto X (Ord y) cmax y lt ontoy = o<> lt (o<-subst {_} {_} {y} {S} (sup-o< {λ x → proj1 ( cardinal-p x)}{y} ) lemma refl ) where lemma : proj1 (cardinal-p y) ≡ y lemma with p∨¬p ( Onto X (Ord y) ) lemma | case1 x = refl lemma | case2 not = ⊥-elim ( not ontoy ) ----- -- All cardinal is ℵ0, since we are working on Countable Ordinal, -- Power ω is larger than ℵ0, so it has no cardinal.