Mercurial > hg > Members > kono > Proof > ZF-in-agda
changeset 232:fe8392f527eb release
axiomaized ordinals. filter and cardinal are incomplete
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 12 Aug 2019 09:04:16 +0900 |
parents | 6bb5d57c9561 (current diff) cb6f025a991e (diff) |
children | 6e1c60866788 |
files | |
diffstat | 8 files changed, 804 insertions(+), 525 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Thu Aug 01 12:24:26 2019 +0900 +++ b/.hgtags Mon Aug 12 09:04:16 2019 +0900 @@ -9,3 +9,7 @@ b06f5d2f34b1a16ff39aae15680a1c0d640e6b93 current b06f5d2f34b1a16ff39aae15680a1c0d640e6b93 current ecb329ba38ac904913313f2dd03ae2329039ffa6 current +ecb329ba38ac904913313f2dd03ae2329039ffa6 current +2c7d45734e3be59a06d272a07fecdbf77ab8ce10 current +2c7d45734e3be59a06d272a07fecdbf77ab8ce10 current +1b1620e2053cfc340a4df0d63de65b9059b19b6f current
--- a/OD.agda Thu Aug 01 12:24:26 2019 +0900 +++ b/OD.agda Mon Aug 12 09:04:16 2019 +0900 @@ -1,8 +1,8 @@ open import Level -module OD where +open import Ordinals +module OD {n : Level } (O : Ordinals {n} ) where open import zf -open import ordinal 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 @@ -11,272 +11,247 @@ open import Relation.Binary open import Relation.Binary.Core +open import logic +open import nat + +open inOrdinal O + -- Ordinal Definable Set -record OD {n : Level} : Set (suc n) where +record OD : Set (suc n ) where field - def : (x : Ordinal {n} ) → Set n + def : (x : Ordinal ) → Set n open OD -open Ordinal open _∧_ +open _∨_ +open Bool -record _==_ {n : Level} ( a b : OD {n} ) : Set n where +record _==_ ( a b : OD ) : Set n where field - eq→ : ∀ { x : Ordinal {n} } → def a x → def b x - eq← : ∀ { x : Ordinal {n} } → def b x → def a x + eq→ : ∀ { x : Ordinal } → def a x → def b x + eq← : ∀ { x : Ordinal } → def b x → def a x id : {n : Level} {A : Set n} → A → A id x = x -eq-refl : {n : Level} { x : OD {n} } → x == x -eq-refl {n} {x} = record { eq→ = id ; eq← = id } +eq-refl : { x : OD } → x == x +eq-refl {x} = record { eq→ = id ; eq← = id } open _==_ -eq-sym : {n : Level} { x y : OD {n} } → x == y → y == x +eq-sym : { x y : OD } → x == y → y == x eq-sym eq = record { eq→ = eq← eq ; eq← = eq→ eq } -eq-trans : {n : Level} { x y z : OD {n} } → x == y → y == z → x == z +eq-trans : { x y z : OD } → x == y → y == z → x == z eq-trans x=y y=z = record { eq→ = λ t → eq→ y=z ( eq→ x=y t) ; eq← = λ t → eq← x=y ( eq← y=z t) } -⇔→== : {n : Level} { x y : OD {suc n} } → ( {z : Ordinal {suc n}} → def x z ⇔ def y z) → x == y -eq→ ( ⇔→== {n} {x} {y} eq ) {z} m = proj1 eq m -eq← ( ⇔→== {n} {x} {y} eq ) {z} m = proj2 eq m +⇔→== : { x y : OD } → ( {z : Ordinal } → def x z ⇔ def y z) → x == y +eq→ ( ⇔→== {x} {y} eq ) {z} m = proj1 eq m +eq← ( ⇔→== {x} {y} eq ) {z} m = proj2 eq m -- Ordinal in OD ( and ZFSet ) Transitive Set -Ord : { n : Level } → ( a : Ordinal {n} ) → OD {n} -Ord {n} a = record { def = λ y → y o< a } +Ord : ( a : Ordinal ) → OD +Ord a = record { def = λ y → y o< a } -od∅ : {n : Level} → OD {n} -od∅ {n} = Ord o∅ +od∅ : OD +od∅ = Ord o∅ postulate -- OD can be iso to a subset of Ordinal ( by means of Godel Set ) - od→ord : {n : Level} → OD {n} → Ordinal {n} - ord→od : {n : Level} → Ordinal {n} → OD {n} - c<→o< : {n : Level} {x y : OD {n} } → def y ( od→ord x ) → od→ord x o< od→ord y - oiso : {n : Level} {x : OD {n}} → ord→od ( od→ord x ) ≡ x - diso : {n : Level} {x : Ordinal {n}} → od→ord ( ord→od x ) ≡ x + od→ord : OD → Ordinal + ord→od : Ordinal → OD + c<→o< : {x y : OD } → def y ( od→ord x ) → od→ord x o< od→ord y + oiso : {x : OD } → ord→od ( od→ord x ) ≡ x + diso : {x : Ordinal } → od→ord ( ord→od x ) ≡ x -- we should prove this in agda, but simply put here - ==→o≡ : {n : Level} → { x y : OD {suc n} } → (x == y) → x ≡ y + ==→o≡ : { x y : OD } → (x == y) → x ≡ y -- next assumption causes ∀ x ∋ ∅ . It menas only an ordinal becomes a set - -- o<→c< : {n : Level} {x y : Ordinal {n} } → x o< y → def (ord→od y) x + -- o<→c< : {n : Level} {x y : Ordinal } → x o< y → def (ord→od y) x -- ord→od x ≡ Ord x results the same -- supermum as Replacement Axiom - sup-o : {n : Level } → ( Ordinal {n} → Ordinal {n}) → Ordinal {n} - sup-o< : {n : Level } → { ψ : Ordinal {n} → Ordinal {n}} → ∀ {x : Ordinal {n}} → ψ x o< sup-o ψ + sup-o : ( Ordinal → Ordinal ) → Ordinal + sup-o< : { ψ : Ordinal → Ordinal } → ∀ {x : Ordinal } → ψ x o< sup-o ψ -- contra-position of mimimulity of supermum required in Power Set Axiom - -- sup-x : {n : Level } → ( Ordinal {n} → Ordinal {n}) → Ordinal {n} - -- sup-lb : {n : Level } → { ψ : Ordinal {n} → Ordinal {n}} → {z : Ordinal {n}} → z o< sup-o ψ → z o< osuc (ψ (sup-x ψ)) + -- sup-x : {n : Level } → ( Ordinal → Ordinal ) → Ordinal + -- sup-lb : {n : Level } → { ψ : Ordinal → Ordinal } → {z : Ordinal } → z o< sup-o ψ → z o< osuc (ψ (sup-x ψ)) -- mimimul and x∋minimul is an Axiom of choice - minimul : {n : Level } → (x : OD {suc n} ) → ¬ (x == od∅ )→ OD {suc n} + minimul : (x : OD ) → ¬ (x == od∅ )→ OD -- this should be ¬ (x == od∅ )→ ∃ ox → x ∋ Ord ox ( minimum of x ) - x∋minimul : {n : Level } → (x : OD {suc n} ) → ( ne : ¬ (x == od∅ ) ) → def x ( od→ord ( minimul x ne ) ) + x∋minimul : (x : OD ) → ( ne : ¬ (x == od∅ ) ) → def x ( od→ord ( minimul x ne ) ) -- minimulity (may proved by ε-induction ) - minimul-1 : {n : Level } → (x : OD {suc n} ) → ( ne : ¬ (x == od∅ ) ) → (y : OD {suc n}) → ¬ ( def (minimul x ne) (od→ord y)) ∧ (def x (od→ord y) ) + minimul-1 : (x : OD ) → ( ne : ¬ (x == od∅ ) ) → (y : OD ) → ¬ ( def (minimul x ne) (od→ord y)) ∧ (def x (od→ord y) ) -_∋_ : { n : Level } → ( a x : OD {n} ) → Set n -_∋_ {n} a x = def a ( od→ord x ) +_∋_ : ( a x : OD ) → Set n +_∋_ a x = def a ( od→ord x ) -_c<_ : { n : Level } → ( x a : OD {n} ) → Set n +_c<_ : ( x a : OD ) → Set n x c< a = a ∋ x -_c≤_ : {n : Level} → OD {n} → OD {n} → Set (suc n) +_c≤_ : OD → OD → Set (suc n) a c≤ b = (a ≡ b) ∨ ( b ∋ a ) -cseq : {n : Level} → OD {n} → OD {n} +cseq : {n : Level} → OD → OD cseq x = record { def = λ y → def x (osuc y) } where -def-subst : {n : Level } {Z : OD {n}} {X : Ordinal {n} }{z : OD {n}} {x : Ordinal {n} }→ def Z X → Z ≡ z → X ≡ x → def z x +def-subst : {Z : OD } {X : Ordinal }{z : OD } {x : Ordinal }→ def Z X → Z ≡ z → X ≡ x → def z x def-subst df refl refl = df -sup-od : {n : Level } → ( OD {n} → OD {n}) → OD {n} +sup-od : ( OD → OD ) → OD sup-od ψ = Ord ( sup-o ( λ x → od→ord (ψ (ord→od x ))) ) -sup-c< : {n : Level } → ( ψ : OD {n} → OD {n}) → ∀ {x : OD {n}} → def ( sup-od ψ ) (od→ord ( ψ x )) -sup-c< {n} ψ {x} = def-subst {n} {_} {_} {Ord ( sup-o ( λ x → od→ord (ψ (ord→od x ))) )} {od→ord ( ψ x )} +sup-c< : ( ψ : OD → OD ) → ∀ {x : OD } → def ( sup-od ψ ) (od→ord ( ψ x )) +sup-c< ψ {x} = def-subst {_} {_} {Ord ( sup-o ( λ x → od→ord (ψ (ord→od x ))) )} {od→ord ( ψ x )} lemma refl (cong ( λ k → od→ord (ψ k) ) oiso) where lemma : od→ord (ψ (ord→od (od→ord x))) o< sup-o (λ x → od→ord (ψ (ord→od x))) lemma = subst₂ (λ j k → j o< k ) refl diso (o<-subst sup-o< refl (sym diso) ) -otrans : {n : Level} {a x y : Ordinal {n} } → def (Ord a) x → def (Ord x) y → def (Ord a) y +otrans : {n : Level} {a x y : Ordinal } → def (Ord a) x → def (Ord x) y → def (Ord a) y otrans x<a y<x = ordtrans y<x x<a -def→o< : {n : Level } {X : OD {suc n}} → {x : Ordinal {suc n}} → def X x → x o< od→ord X -def→o< {n} {X} {x} lt = o<-subst {suc n} {_} {_} {x} {od→ord X} ( c<→o< ( def-subst {suc n} {X} {x} lt (sym oiso) (sym diso) )) diso diso - -∅3 : {n : Level} → { x : Ordinal {suc n}} → ( ∀(y : Ordinal {suc n}) → ¬ (y o< x ) ) → x ≡ o∅ {suc n} -∅3 {n} {x} = TransFinite {n} c2 c3 x where - c0 : Nat → Ordinal {suc n} → Set (suc n) - c0 lx x = (∀(y : Ordinal {suc n}) → ¬ (y o< x)) → x ≡ o∅ {suc n} - c2 : (lx : Nat) → ((x₁ : Ordinal) → x₁ o< ordinal lx (Φ lx) → c0 (lv x₁) (record { lv = lv x₁ ; ord = ord x₁ }))→ c0 lx (record { lv = lx ; ord = Φ lx } ) - c2 Zero _ not = refl - c2 (Suc lx) _ not with not ( record { lv = lx ; ord = Φ lx } ) - ... | t with t (case1 ≤-refl ) - c2 (Suc lx) _ not | t | () - c3 : (lx : Nat) (x₁ : OrdinalD lx) → c0 lx (record { lv = lx ; ord = x₁ }) → c0 lx (record { lv = lx ; ord = OSuc lx x₁ }) - c3 lx (Φ .lx) d not with not ( record { lv = lx ; ord = Φ lx } ) - ... | t with t (case2 Φ< ) - c3 lx (Φ .lx) d not | t | () - c3 lx (OSuc .lx x₁) d not with not ( record { lv = lx ; ord = OSuc lx x₁ } ) - ... | t with t (case2 (s< s<refl ) ) - c3 lx (OSuc .lx x₁) d not | t | () - -∅5 : {n : Level} → { x : Ordinal {n} } → ¬ ( x ≡ o∅ {n} ) → o∅ {n} o< x -∅5 {n} {record { lv = Zero ; ord = (Φ .0) }} not = ⊥-elim (not refl) -∅5 {n} {record { lv = Zero ; ord = (OSuc .0 ord) }} not = case2 Φ< -∅5 {n} {record { lv = (Suc lv) ; ord = ord }} not = case1 (s≤s z≤n) - -ord-iso : {n : Level} {y : Ordinal {n} } → record { lv = lv (od→ord (ord→od y)) ; ord = ord (od→ord (ord→od y)) } ≡ record { lv = lv y ; ord = ord y } -ord-iso = cong ( λ k → record { lv = lv k ; ord = ord k } ) diso +def→o< : {X : OD } → {x : Ordinal } → def X x → x o< od→ord X +def→o< {X} {x} lt = o<-subst {_} {_} {x} {od→ord X} ( c<→o< ( def-subst {X} {x} lt (sym oiso) (sym diso) )) diso diso -- avoiding lv != Zero error -orefl : {n : Level} → { x : OD {n} } → { y : Ordinal {n} } → od→ord x ≡ y → od→ord x ≡ y +orefl : { x : OD } → { y : Ordinal } → od→ord x ≡ y → od→ord x ≡ y orefl refl = refl -==-iso : {n : Level} → { x y : OD {n} } → ord→od (od→ord x) == ord→od (od→ord y) → x == y -==-iso {n} {x} {y} eq = record { +==-iso : { x y : OD } → ord→od (od→ord x) == ord→od (od→ord y) → x == y +==-iso {x} {y} eq = record { eq→ = λ d → lemma ( eq→ eq (def-subst d (sym oiso) refl )) ; eq← = λ d → lemma ( eq← eq (def-subst d (sym oiso) refl )) } where - lemma : {x : OD {n} } {z : Ordinal {n}} → def (ord→od (od→ord x)) z → def x z + lemma : {x : OD } {z : Ordinal } → def (ord→od (od→ord x)) z → def x z lemma {x} {z} d = def-subst d oiso refl -=-iso : {n : Level } {x y : OD {suc n} } → (x == y) ≡ (ord→od (od→ord x) == y) -=-iso {_} {_} {y} = cong ( λ k → k == y ) (sym oiso) +=-iso : {x y : OD } → (x == y) ≡ (ord→od (od→ord x) == y) +=-iso {_} {y} = cong ( λ k → k == y ) (sym oiso) -ord→== : {n : Level} → { x y : OD {n} } → od→ord x ≡ od→ord y → x == y -ord→== {n} {x} {y} eq = ==-iso (lemma (od→ord x) (od→ord y) (orefl eq)) where - lemma : ( ox oy : Ordinal {n} ) → ox ≡ oy → (ord→od ox) == (ord→od oy) +ord→== : { x y : OD } → od→ord x ≡ od→ord y → x == y +ord→== {x} {y} eq = ==-iso (lemma (od→ord x) (od→ord y) (orefl eq)) where + lemma : ( ox oy : Ordinal ) → ox ≡ oy → (ord→od ox) == (ord→od oy) lemma ox ox refl = eq-refl -o≡→== : {n : Level} → { x y : Ordinal {n} } → x ≡ y → ord→od x == ord→od y -o≡→== {n} {x} {.x} refl = eq-refl +o≡→== : { x y : Ordinal } → x ≡ y → ord→od x == ord→od y +o≡→== {x} {.x} refl = eq-refl ->→¬< : {x y : Nat } → (x < y ) → ¬ ( y < x ) ->→¬< (s≤s x<y) (s≤s y<x) = >→¬< x<y y<x - -c≤-refl : {n : Level} → ( x : OD {n} ) → x c≤ x +c≤-refl : {n : Level} → ( x : OD ) → x c≤ x c≤-refl x = case1 refl -o∅≡od∅ : {n : Level} → ord→od (o∅ {suc n}) ≡ od∅ {suc n} -o∅≡od∅ {n} = ==→o≡ lemma where +o∅≡od∅ : ord→od (o∅ ) ≡ od∅ +o∅≡od∅ = ==→o≡ lemma where lemma0 : {x : Ordinal} → def (ord→od o∅) x → def od∅ x - lemma0 {x} lt = o<-subst (c<→o< {suc n} {ord→od x} {ord→od o∅} (def-subst {suc n} {ord→od o∅} {x} lt refl (sym diso)) ) diso diso + lemma0 {x} lt = o<-subst (c<→o< {ord→od x} {ord→od o∅} (def-subst {ord→od o∅} {x} lt refl (sym diso)) ) diso diso lemma1 : {x : Ordinal} → def od∅ x → def (ord→od o∅) x - lemma1 (case1 ()) - lemma1 (case2 ()) + lemma1 {x} lt = ⊥-elim (¬x<0 lt) lemma : ord→od o∅ == od∅ lemma = record { eq→ = lemma0 ; eq← = lemma1 } -ord-od∅ : {n : Level} → od→ord (od∅ {suc n}) ≡ o∅ {suc n} -ord-od∅ {n} = sym ( subst (λ k → k ≡ od→ord (od∅ {suc n}) ) diso (cong ( λ k → od→ord k ) o∅≡od∅ ) ) +ord-od∅ : od→ord (od∅ ) ≡ o∅ +ord-od∅ = sym ( subst (λ k → k ≡ od→ord (od∅ ) ) diso (cong ( λ k → od→ord k ) o∅≡od∅ ) ) -∅0 : {n : Level} → record { def = λ x → Lift n ⊥ } == od∅ {n} +∅0 : record { def = λ x → Lift n ⊥ } == od∅ eq→ ∅0 {w} (lift ()) -eq← ∅0 {w} (case1 ()) -eq← ∅0 {w} (case2 ()) +eq← ∅0 {w} lt = lift (¬x<0 lt) -∅< : {n : Level} → { x y : OD {n} } → def x (od→ord y ) → ¬ ( x == od∅ {n} ) -∅< {n} {x} {y} d eq with eq→ (eq-trans eq (eq-sym ∅0) ) d -∅< {n} {x} {y} d eq | lift () +∅< : { x y : OD } → def x (od→ord y ) → ¬ ( x == od∅ ) +∅< {x} {y} d eq with eq→ (eq-trans eq (eq-sym ∅0) ) d +∅< {x} {y} d eq | lift () -∅6 : {n : Level} → { x : OD {suc n} } → ¬ ( x ∋ x ) -- no Russel paradox -∅6 {n} {x} x∋x = o<¬≡ refl ( c<→o< {suc n} {x} {x} x∋x ) +∅6 : { x : OD } → ¬ ( x ∋ x ) -- no Russel paradox +∅6 {x} x∋x = o<¬≡ refl ( c<→o< {x} {x} x∋x ) -def-iso : {n : Level} {A B : OD {n}} {x y : Ordinal {n}} → x ≡ y → (def A y → def B y) → def A x → def B x +def-iso : {A B : OD } {x y : Ordinal } → x ≡ y → (def A y → def B y) → def A x → def B x def-iso refl t = t -is-o∅ : {n : Level} → ( x : Ordinal {suc n} ) → Dec ( x ≡ o∅ {suc n} ) -is-o∅ {n} record { lv = Zero ; ord = (Φ .0) } = yes refl -is-o∅ {n} record { lv = Zero ; ord = (OSuc .0 ord₁) } = no ( λ () ) -is-o∅ {n} record { lv = (Suc lv₁) ; ord = ord } = no (λ()) +is-o∅ : ( x : Ordinal ) → Dec ( x ≡ o∅ ) +is-o∅ x with trio< x o∅ +is-o∅ x | tri< a ¬b ¬c = no ¬b +is-o∅ x | tri≈ ¬a b ¬c = yes b +is-o∅ x | tri> ¬a ¬b c = no ¬b -ppp : { n : Level } → { p : Set (suc n) } { a : OD {suc n} } → record { def = λ x → p } ∋ a → p -ppp {n} {p} {a} d = d +ppp : { p : Set n } { a : OD } → record { def = λ x → p } ∋ a → p +ppp {p} {a} d = d -- -- Axiom of choice in intutionistic logic implies the exclude middle -- https://plato.stanford.edu/entries/axiom-choice/#AxiChoLog -- -p∨¬p : { n : Level } → ( p : Set (suc n) ) → p ∨ ( ¬ p ) -- assuming axiom of choice -p∨¬p {n} p with is-o∅ ( od→ord ( record { def = λ x → p } )) -p∨¬p {n} p | yes eq = case2 (¬p eq) where +p∨¬p : ( p : Set n ) → p ∨ ( ¬ p ) -- assuming axiom of choice +p∨¬p p with is-o∅ ( od→ord ( record { def = λ x → p } )) +p∨¬p p | yes eq = case2 (¬p eq) where ps = record { def = λ x → p } lemma : ps == od∅ → p → ⊥ - lemma eq p0 = ¬x<0 {n} {od→ord ps} (eq→ eq p0 ) + lemma eq p0 = ¬x<0 {od→ord ps} (eq→ eq p0 ) ¬p : (od→ord ps ≡ o∅) → p → ⊥ ¬p eq = lemma ( subst₂ (λ j k → j == k ) oiso o∅≡od∅ ( o≡→== eq )) -p∨¬p {n} p | no ¬p = case1 (ppp {n} {p} {minimul ps (λ eq → ¬p (eqo∅ eq))} lemma) where +p∨¬p p | no ¬p = case1 (ppp {p} {minimul ps (λ eq → ¬p (eqo∅ eq))} lemma) where ps = record { def = λ x → p } - eqo∅ : ps == od∅ {suc n} → od→ord ps ≡ o∅ {suc n} + eqo∅ : ps == od∅ → od→ord ps ≡ o∅ eqo∅ eq = subst (λ k → od→ord ps ≡ k) ord-od∅ ( cong (λ k → od→ord k ) (==→o≡ eq)) lemma : ps ∋ minimul ps (λ eq → ¬p (eqo∅ eq)) lemma = x∋minimul ps (λ eq → ¬p (eqo∅ eq)) -∋-p : { n : Level } → ( p : Set (suc n) ) → Dec p -- assuming axiom of choice -∋-p {n} p with p∨¬p p -∋-p {n} p | case1 x = yes x -∋-p {n} p | case2 x = no x +∋-p : ( p : Set n ) → Dec p -- assuming axiom of choice +∋-p p with p∨¬p p +∋-p p | case1 x = yes x +∋-p p | case2 x = no x -double-neg-eilm : {n : Level } {A : Set (suc n)} → ¬ ¬ A → A -- we don't have this in intutionistic logic -double-neg-eilm {n} {A} notnot with ∋-p A -- assuming axiom of choice +double-neg-eilm : {A : Set n} → ¬ ¬ A → A -- we don't have this in intutionistic logic +double-neg-eilm {A} notnot with ∋-p A -- assuming axiom of choice ... | yes p = p ... | no ¬p = ⊥-elim ( notnot ¬p ) -OrdP : {n : Level} → ( x : Ordinal {suc n} ) ( y : OD {suc n} ) → Dec ( Ord x ∋ y ) -OrdP {n} x y with trio< x (od→ord y) -OrdP {n} x y | tri< a ¬b ¬c = no ¬c -OrdP {n} x y | tri≈ ¬a refl ¬c = no ( o<¬≡ refl ) -OrdP {n} x y | tri> ¬a ¬b c = yes c +OrdP : ( x : Ordinal ) ( y : OD ) → Dec ( Ord x ∋ y ) +OrdP x y with trio< x (od→ord y) +OrdP x y | tri< a ¬b ¬c = no ¬c +OrdP x y | tri≈ ¬a refl ¬c = no ( o<¬≡ refl ) +OrdP x y | tri> ¬a ¬b c = yes c -- open import Relation.Binary.HeterogeneousEquality as HE using (_≅_ ) --- postulate f-extensionality : { n : Level} → Relation.Binary.PropositionalEquality.Extensionality (suc n) (suc (suc n)) +-- postulate f-extensionality : { n : Level} → Relation.Binary.PropositionalEquality.Extensionality n (suc n) -in-codomain : {n : Level} → (X : OD {suc n} ) → ( ψ : OD {suc n} → OD {suc n} ) → OD {suc n} -in-codomain {n} X ψ = record { def = λ x → ¬ ( (y : Ordinal {suc n}) → ¬ ( def X y ∧ ( x ≡ od→ord (ψ (ord→od y ))))) } +in-codomain : (X : OD ) → ( ψ : OD → OD ) → OD +in-codomain X ψ = record { def = λ x → ¬ ( (y : Ordinal ) → ¬ ( def X y ∧ ( x ≡ od→ord (ψ (ord→od y ))))) } -- Power Set of X ( or constructible by λ y → def X (od→ord y ) -ZFSubset : {n : Level} → (A x : OD {suc n} ) → OD {suc n} +ZFSubset : (A x : OD ) → OD ZFSubset A x = record { def = λ y → def A y ∧ def x y } -- roughly x = A → Set -Def : {n : Level} → (A : OD {suc n}) → OD {suc n} -Def {n} A = Ord ( sup-o ( λ x → od→ord ( ZFSubset A (ord→od x )) ) ) +Def : (A : OD ) → OD +Def A = Ord ( sup-o ( λ x → od→ord ( ZFSubset A (ord→od x )) ) ) -_⊆_ : {n : Level} ( A B : OD {suc n} ) → ∀{ x : OD {suc n} } → Set (suc n) +_⊆_ : ( A B : OD ) → ∀{ x : OD } → Set n _⊆_ A B {x} = A ∋ x → B ∋ x infixr 220 _⊆_ -subset-lemma : {n : Level} → {A x y : OD {suc n} } → ( x ∋ y → ZFSubset A x ∋ y ) ⇔ ( _⊆_ x A {y} ) -subset-lemma {n} {A} {x} {y} = record { +subset-lemma : {A x y : OD } → ( x ∋ y → ZFSubset A x ∋ y ) ⇔ ( _⊆_ x A {y} ) +subset-lemma {A} {x} {y} = record { proj1 = λ z lt → proj1 (z lt) ; proj2 = λ x⊆A lt → record { proj1 = x⊆A lt ; proj2 = lt } } - -- Constructible Set on α -- Def X = record { def = λ y → ∀ (x : OD ) → y < X ∧ y < od→ord x } -- L (Φ 0) = Φ -- L (OSuc lv n) = { Def ( L n ) } -- L (Φ (Suc n)) = Union (L α) (α < Φ (Suc n) ) -L : {n : Level} → (α : Ordinal {suc n}) → OD {suc n} -L {n} record { lv = Zero ; ord = (Φ .0) } = od∅ -L {n} record { lv = lx ; ord = (OSuc lv ox) } = Def ( L {n} ( record { lv = lx ; ord = ox } ) ) -L {n} record { lv = (Suc lx) ; ord = (Φ (Suc lx)) } = -- Union ( L α ) - cseq ( Ord (od→ord (L {n} (record { lv = lx ; ord = Φ lx })))) +-- L : {n : Level} → (α : Ordinal ) → OD +-- L record { lv = Zero ; ord = (Φ .0) } = od∅ +-- L record { lv = lx ; ord = (OSuc lv ox) } = Def ( L ( record { lv = lx ; ord = ox } ) ) +-- L record { lv = (Suc lx) ; ord = (Φ (Suc lx)) } = -- Union ( L α ) +-- cseq ( Ord (od→ord (L (record { lv = lx ; ord = Φ lx })))) --- L0 : {n : Level} → (α : Ordinal {suc n}) → L (osuc α) ∋ L α --- L1 : {n : Level} → (α β : Ordinal {suc n}) → α o< β → ∀ (x : OD {suc n}) → L α ∋ x → L β ∋ x - +-- L0 : {n : Level} → (α : Ordinal ) → L (osuc α) ∋ L α +-- L1 : {n : Level} → (α β : Ordinal ) → α o< β → ∀ (x : OD ) → L α ∋ x → L β ∋ x -OD→ZF : {n : Level} → ZF {suc (suc n)} {suc n} -OD→ZF {n} = record { - ZFSet = OD {suc n} +OD→ZF : ZF +OD→ZF = record { + ZFSet = OD ; _∋_ = _∋_ ; _≈_ = _==_ ; ∅ = od∅ @@ -288,35 +263,35 @@ ; infinite = infinite ; isZF = isZF } where - ZFSet = OD {suc n} - Select : (X : OD {suc n} ) → ((x : OD {suc n} ) → Set (suc n) ) → OD {suc n} + ZFSet = OD + Select : (X : OD ) → ((x : OD ) → Set n ) → OD Select X ψ = record { def = λ x → ( def X x ∧ ψ ( ord→od x )) } - Replace : OD {suc n} → (OD {suc n} → OD {suc n} ) → OD {suc n} + Replace : OD → (OD → OD ) → OD Replace X ψ = record { def = λ x → (x o< sup-o ( λ x → od→ord (ψ (ord→od x )))) ∧ def (in-codomain X ψ) x } - _,_ : OD {suc n} → OD {suc n} → OD {suc n} + _,_ : OD → OD → OD x , y = Ord (omax (od→ord x) (od→ord y)) _∩_ : ( A B : ZFSet ) → ZFSet A ∩ B = record { def = λ x → def A x ∧ def B x } - Union : OD {suc n} → OD {suc n} + Union : OD → OD Union U = record { def = λ x → ¬ (∀ (u : Ordinal ) → ¬ ((def U u) ∧ (def (ord→od u) x))) } - _∈_ : ( A B : ZFSet ) → Set (suc n) + _∈_ : ( A B : ZFSet ) → Set n A ∈ B = B ∋ A - Power : OD {suc n} → OD {suc n} + Power : OD → OD Power A = Replace (Def (Ord (od→ord A))) ( λ x → A ∩ x ) {_} : ZFSet → ZFSet { x } = ( x , x ) - data infinite-d : ( x : Ordinal {suc n} ) → Set (suc n) where + data infinite-d : ( x : Ordinal ) → Set n where iφ : infinite-d o∅ - isuc : {x : Ordinal {suc n} } → infinite-d x → + isuc : {x : Ordinal } → infinite-d x → infinite-d (od→ord ( Union (ord→od x , (ord→od x , ord→od x ) ) )) - infinite : OD {suc n} + infinite : OD infinite = record { def = λ x → infinite-d x } infixr 200 _∈_ -- infixr 230 _∩_ _∪_ - isZF : IsZF (OD {suc n}) _∋_ _==_ od∅ _,_ Union Power Select Replace infinite + isZF : IsZF (OD ) _∋_ _==_ od∅ _,_ Union Power Select Replace infinite isZF = record { isEquivalence = record { refl = eq-refl ; sym = eq-sym; trans = eq-trans } ; pair = pair @@ -326,7 +301,7 @@ ; power→ = power→ ; power← = power← ; extensionality = λ {A} {B} {w} → extensionality {A} {B} {w} - ; ε-induction = ε-induction + -- ; ε-induction = {!!} ; infinity∅ = infinity∅ ; infinity = infinity ; selection = λ {X} {ψ} {y} → selection {X} {ψ} {y} @@ -336,18 +311,17 @@ ; choice = choice } where - pair : (A B : OD {suc n} ) → ((A , B) ∋ A) ∧ ((A , B) ∋ B) - proj1 (pair A B ) = omax-x {n} (od→ord A) (od→ord B) - proj2 (pair A B ) = omax-y {n} (od→ord A) (od→ord B) + pair : (A B : OD ) → ((A , B) ∋ A) ∧ ((A , B) ∋ B) + proj1 (pair A B ) = omax-x (od→ord A) (od→ord B) + proj2 (pair A B ) = omax-y (od→ord A) (od→ord B) - empty : {n : Level } (x : OD {suc n} ) → ¬ (od∅ ∋ x) - empty x (case1 ()) - empty x (case2 ()) + empty : (x : OD ) → ¬ (od∅ ∋ x) + empty x = ¬x<0 - o<→c< : {x y : Ordinal {suc n}} {z : OD {suc n}}→ x o< y → _⊆_ (Ord x) (Ord y) {z} + o<→c< : {x y : Ordinal } {z : OD }→ x o< y → _⊆_ (Ord x) (Ord y) {z} o<→c< lt lt1 = ordtrans lt1 lt - ⊆→o< : {x y : Ordinal {suc n}} → (∀ (z : OD) → _⊆_ (Ord x) (Ord y) {z} ) → x o< osuc y + ⊆→o< : {x y : Ordinal } → (∀ (z : OD) → _⊆_ (Ord x) (Ord y) {z} ) → x o< osuc y ⊆→o< {x} {y} lt with trio< x y ⊆→o< {x} {y} lt | tri< a ¬b ¬c = ordtrans a <-osuc ⊆→o< {x} {y} lt | tri≈ ¬a b ¬c = subst ( λ k → k o< osuc y) (sym b) <-osuc @@ -362,9 +336,9 @@ lemma : {y : Ordinal} → def X y ∧ def (ord→od y) (od→ord z) → ¬ ((u : OD) → ¬ (X ∋ u) ∧ (u ∋ z)) lemma {y} xx not = not (ord→od y) record { proj1 = subst ( λ k → def X k ) (sym diso) (proj1 xx ) ; proj2 = proj2 xx } - ψiso : {ψ : OD {suc n} → Set (suc n)} {x y : OD {suc n}} → ψ x → x ≡ y → ψ y + ψiso : {ψ : OD → Set n} {x y : OD } → ψ x → x ≡ y → ψ y ψiso {ψ} t refl = t - selection : {ψ : OD → Set (suc n)} {X y : OD} → ((X ∋ y) ∧ ψ y) ⇔ (Select X ψ ∋ y) + selection : {ψ : OD → Set n} {X y : OD} → ((X ∋ y) ∧ ψ y) ⇔ (Select X ψ ∋ y) selection {ψ} {X} {y} = record { proj1 = λ cond → record { proj1 = proj1 cond ; proj2 = ψiso {ψ} (proj2 cond) (sym oiso) } ; proj2 = λ select → record { proj1 = proj1 select ; proj2 = ψiso {ψ} (proj2 select) oiso } @@ -392,26 +366,26 @@ --- Power X = ord→od ( sup-o ( λ x → od→ord ( ZFSubset A (ord→od x )) ) ) Power X is a sup of all subset of A -- -- - ∩-≡ : { a b : OD {suc n} } → ({x : OD {suc n} } → (a ∋ x → b ∋ x)) → a == ( b ∩ a ) + ∩-≡ : { a b : OD } → ({x : OD } → (a ∋ x → b ∋ x)) → a == ( b ∩ a ) ∩-≡ {a} {b} inc = record { eq→ = λ {x} x<a → record { proj2 = x<a ; - proj1 = def-subst {suc n} {_} {_} {b} {x} (inc (def-subst {suc n} {_} {_} {a} {_} x<a refl (sym diso) )) refl diso } ; + proj1 = def-subst {_} {_} {b} {x} (inc (def-subst {_} {_} {a} {_} x<a refl (sym diso) )) refl diso } ; eq← = λ {x} x<a∩b → proj2 x<a∩b } -- -- we have t ∋ x → A ∋ x means t is a subset of A, that is ZFSubset A t == t -- Power A is a sup of ZFSubset A t, so Power A ∋ t -- ord-power← : (a : Ordinal ) (t : OD) → ({x : OD} → (t ∋ x → (Ord a) ∋ x)) → Def (Ord a) ∋ t - ord-power← a t t→A = def-subst {suc n} {_} {_} {Def (Ord a)} {od→ord t} + ord-power← a t t→A = def-subst {_} {_} {Def (Ord a)} {od→ord t} lemma refl (lemma1 lemma-eq )where lemma-eq : ZFSubset (Ord a) t == t eq→ lemma-eq {z} w = proj2 w eq← lemma-eq {z} w = record { proj2 = w ; - proj1 = def-subst {suc n} {_} {_} {(Ord a)} {z} - ( t→A (def-subst {suc n} {_} {_} {t} {od→ord (ord→od z)} w refl (sym diso) )) refl diso } - lemma1 : {n : Level } {a : Ordinal {suc n}} { t : OD {suc n}} + proj1 = def-subst {_} {_} {(Ord a)} {z} + ( t→A (def-subst {_} {_} {t} {od→ord (ord→od z)} w refl (sym diso) )) refl diso } + lemma1 : {a : Ordinal } { t : OD } → (eq : ZFSubset (Ord a) t == t) → od→ord (ZFSubset (Ord a) (ord→od (od→ord t))) ≡ od→ord t - lemma1 {n} {a} {t} eq = subst (λ k → od→ord (ZFSubset (Ord a) k) ≡ od→ord t ) (sym oiso) (cong (λ k → od→ord k ) (==→o≡ eq )) + lemma1 {a} {t} eq = subst (λ k → od→ord (ZFSubset (Ord a) k) ≡ od→ord t ) (sym oiso) (cong (λ k → od→ord k ) (==→o≡ eq )) lemma : od→ord (ZFSubset (Ord a) (ord→od (od→ord t)) ) o< sup-o (λ x → od→ord (ZFSubset (Ord a) (ord→od x))) lemma = sup-o< @@ -442,7 +416,7 @@ lemma3 : Def (Ord a) ∋ t lemma3 = ord-power← a t lemma0 lt1 : od→ord (A ∩ ord→od (od→ord t)) o< sup-o (λ x → od→ord (A ∩ ord→od x)) - lt1 = sup-o< {suc n} {λ x → od→ord (A ∩ ord→od x)} {od→ord t} + lt1 = sup-o< {λ x → od→ord (A ∩ ord→od x)} {od→ord t} lemma4 : (A ∩ ord→od (od→ord t)) ≡ t lemma4 = let open ≡-Reasoning in begin A ∩ ord→od (od→ord t) @@ -453,7 +427,7 @@ ∎ lemma1 : od→ord t o< sup-o (λ x → od→ord (A ∩ ord→od x)) lemma1 = subst (λ k → od→ord k o< sup-o (λ x → od→ord (A ∩ ord→od x))) - lemma4 (sup-o< {suc n} {λ x → od→ord (A ∩ ord→od x)} {od→ord t}) + lemma4 (sup-o< {λ x → od→ord (A ∩ ord→od x)} {od→ord t}) lemma2 : def (in-codomain (Def (Ord (od→ord A))) (_∩_ A)) (od→ord t) lemma2 not = ⊥-elim ( not (od→ord t) (record { proj1 = lemma3 ; proj2 = lemma6 }) ) where lemma6 : od→ord t ≡ od→ord (A ∩ ord→od (od→ord t)) @@ -467,21 +441,21 @@ lemma1 : {x₁ : Ordinal} → def (Select (minimul x not) (λ x₂ → (minimul x not ∋ x₂) ∧ (x ∋ x₂))) x₁ → def od∅ x₁ lemma1 {x₁} s = ⊥-elim ( minimul-1 x not (ord→od x₁) lemma3 ) where lemma3 : def (minimul x not) (od→ord (ord→od x₁)) ∧ def x (od→ord (ord→od x₁)) - lemma3 = record { proj1 = def-subst {suc n} {_} {_} {minimul x not} {_} (proj1 s) refl (sym diso) + lemma3 = record { proj1 = def-subst {_} {_} {minimul x not} {_} (proj1 s) refl (sym diso) ; proj2 = proj2 (proj2 s) } lemma2 : {x₁ : Ordinal} → def od∅ x₁ → def (Select (minimul x not) (λ x₂ → (minimul x not ∋ x₂) ∧ (x ∋ x₂))) x₁ - lemma2 {y} d = ⊥-elim (empty (ord→od y) (def-subst {suc n} {_} {_} {od∅} {od→ord (ord→od y)} d refl (sym diso) )) + lemma2 {y} d = ⊥-elim (empty (ord→od y) (def-subst {_} {_} {od∅} {od→ord (ord→od y)} d refl (sym diso) )) - extensionality0 : {A B : OD {suc n}} → ((z : OD) → (A ∋ z) ⇔ (B ∋ z)) → A == B - eq→ (extensionality0 {A} {B} eq ) {x} d = def-iso {suc n} {A} {B} (sym diso) (proj1 (eq (ord→od x))) d - eq← (extensionality0 {A} {B} eq ) {x} d = def-iso {suc n} {B} {A} (sym diso) (proj2 (eq (ord→od x))) d + extensionality0 : {A B : OD } → ((z : OD) → (A ∋ z) ⇔ (B ∋ z)) → A == B + eq→ (extensionality0 {A} {B} eq ) {x} d = def-iso {A} {B} (sym diso) (proj1 (eq (ord→od x))) d + eq← (extensionality0 {A} {B} eq ) {x} d = def-iso {B} {A} (sym diso) (proj2 (eq (ord→od x))) d - extensionality : {A B w : OD {suc n} } → ((z : OD {suc n}) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B) + extensionality : {A B w : OD } → ((z : OD ) → (A ∋ z) ⇔ (B ∋ z)) → (w ∋ A) ⇔ (w ∋ B) proj1 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) ( ==→o≡ (extensionality0 {A} {B} eq) ) d proj2 (extensionality {A} {B} {w} eq ) d = subst (λ k → w ∋ k) (sym ( ==→o≡ (extensionality0 {A} {B} eq) )) d - infinity∅ : infinite ∋ od∅ {suc n} - infinity∅ = def-subst {suc n} {_} {_} {infinite} {od→ord (od∅ {suc n})} iφ refl lemma where + infinity∅ : infinite ∋ od∅ + infinity∅ = def-subst {_} {_} {infinite} {od→ord (od∅ )} iφ refl lemma where lemma : o∅ ≡ od→ord od∅ lemma = let open ≡-Reasoning in begin o∅ @@ -491,134 +465,22 @@ od→ord od∅ ∎ infinity : (x : OD) → infinite ∋ x → infinite ∋ Union (x , (x , x )) - infinity x lt = def-subst {suc n} {_} {_} {infinite} {od→ord (Union (x , (x , x )))} ( isuc {od→ord x} lt ) refl lemma where + infinity x lt = def-subst {_} {_} {infinite} {od→ord (Union (x , (x , x )))} ( isuc {od→ord x} lt ) refl lemma where lemma : od→ord (Union (ord→od (od→ord x) , (ord→od (od→ord x) , ord→od (od→ord x)))) ≡ od→ord (Union (x , (x , x))) lemma = cong (λ k → od→ord (Union ( k , ( k , k ) ))) oiso -- Axiom of choice ( is equivalent to the existence of minimul in our case ) -- ∀ X [ ∅ ∉ X → (∃ f : X → ⋃ X ) → ∀ A ∈ X ( f ( A ) ∈ A ) ] - choice-func : (X : OD {suc n} ) → {x : OD } → ¬ ( x == od∅ ) → ( X ∋ x ) → OD + choice-func : (X : OD ) → {x : OD } → ¬ ( x == od∅ ) → ( X ∋ x ) → OD choice-func X {x} not X∋x = minimul x not - choice : (X : OD {suc n} ) → {A : OD } → ( X∋A : X ∋ A ) → (not : ¬ ( A == od∅ )) → A ∋ choice-func X not X∋A + choice : (X : OD ) → {A : OD } → ( X∋A : X ∋ A ) → (not : ¬ ( A == od∅ )) → A ∋ choice-func X not X∋A choice X {A} X∋A not = x∋minimul A not - -- - -- another form of regularity - -- - ε-induction : {n m : Level} { ψ : OD {suc n} → Set m} - → ( {x : OD {suc n} } → ({ y : OD {suc n} } → x ∋ y → ψ y ) → ψ x ) - → (x : OD {suc n} ) → ψ x - ε-induction {n} {m} {ψ} ind x = subst (λ k → ψ k ) oiso (ε-induction-ord (lv (osuc (od→ord x))) (ord (osuc (od→ord x))) <-osuc) where - ε-induction-ord : (lx : Nat) ( ox : OrdinalD {suc n} lx ) {ly : Nat} {oy : OrdinalD {suc n} ly } - → (ly < lx) ∨ (oy d< ox ) → ψ (ord→od (record { lv = ly ; ord = oy } ) ) - ε-induction-ord lx (OSuc lx ox) {ly} {oy} y<x = - ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → subst (λ k → ψ k ) oiso (ε-induction-ord lx ox (lemma y lt ))) where - lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → od→ord z o< record { lv = lx ; ord = ox } - lemma z lt with osuc-≡< y<x - lemma z lt | case1 refl = o<-subst (c<→o< lt) refl diso - lemma z lt | case2 lt1 = ordtrans (o<-subst (c<→o< lt) refl diso) lt1 - ε-induction-ord (Suc lx) (Φ (Suc lx)) {ly} {oy} (case1 y<sox ) = - ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → lemma y lt ) where - -- - -- if lv of z if less than x Ok - -- else lv z = lv x. We can create OSuc of z which is larger than z and less than x in lemma - -- - -- lx Suc lx (1) lz(a) <lx by case1 - -- ly(1) ly(2) (2) lz(b) <lx by case1 - -- lz(a) lz(b) lz(c) lz(c) <lx by case2 ( ly==lz==lx) - -- - lemma0 : { lx ly : Nat } → ly < Suc lx → lx < ly → ⊥ - lemma0 {Suc lx} {Suc ly} (s≤s lt1) (s≤s lt2) = lemma0 lt1 lt2 - lemma1 : {n : Level } {ly : Nat} {oy : OrdinalD {suc n} ly} → lv (od→ord (ord→od (record { lv = ly ; ord = oy }))) ≡ ly - lemma1 {n} {ly} {oy} = let open ≡-Reasoning in begin - lv (od→ord (ord→od (record { lv = ly ; ord = oy }))) - ≡⟨ cong ( λ k → lv k ) diso ⟩ - lv (record { lv = ly ; ord = oy }) - ≡⟨⟩ - ly - ∎ - lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → ψ z - lemma z lt with c<→o< {suc n} {z} {ord→od (record { lv = ly ; ord = oy })} lt - lemma z lt | case1 lz<ly with <-cmp lx ly - lemma z lt | case1 lz<ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen - lemma z lt | case1 lz<ly | tri≈ ¬a refl ¬c = -- ly(1) - subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → lv (od→ord z) < k ) lemma1 lz<ly ) )) - lemma z lt | case1 lz<ly | tri> ¬a ¬b c = -- lz(a) - subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (<-trans lz<ly (subst (λ k → k < lx ) (sym lemma1) c)))) - lemma z lt | case2 lz=ly with <-cmp lx ly - lemma z lt | case2 lz=ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen - lemma z lt | case2 lz=ly | tri> ¬a ¬b c with d<→lv lz=ly -- lz(b) - ... | eq = subst (λ k → ψ k ) oiso - (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → k < lx ) (trans (sym lemma1)(sym eq) ) c ))) - lemma z lt | case2 lz=ly | tri≈ ¬a lx=ly ¬c with d<→lv lz=ly -- lz(c) - ... | eq = lemma6 {ly} {Φ lx} {oy} lx=ly (sym (subst (λ k → lv (od→ord z) ≡ k) lemma1 eq)) where - lemma5 : (ox : OrdinalD lx) → (lv (od→ord z) < lx) ∨ (ord (od→ord z) d< ox) → ψ z - lemma5 ox lt = subst (λ k → ψ k ) oiso (ε-induction-ord lx ox lt ) - lemma6 : { ly : Nat } { ox : OrdinalD {suc n} lx } { oy : OrdinalD {suc n} ly } → - lx ≡ ly → ly ≡ lv (od→ord z) → ψ z - lemma6 {ly} {ox} {oy} refl refl = lemma5 (OSuc lx (ord (od→ord z)) ) (case2 s<refl) - - --- - --- With assuption of OD is ordered, p ∨ ( ¬ p ) <=> axiom of choice - --- - record choiced {n : Level} ( X : OD {suc n}) : Set (suc (suc n)) where - field - a-choice : OD {suc n} - is-in : X ∋ a-choice - choice-func' : (X : OD {suc n} ) → (p∨¬p : { n : Level } → ( p : Set (suc n) ) → p ∨ ( ¬ p )) → ¬ ( X == od∅ ) → choiced X - choice-func' X p∨¬p not = have_to_find - where - ψ : ( ox : Ordinal {suc n}) → Set (suc (suc n)) - ψ ox = (( x : Ordinal {suc n}) → x o< ox → ( ¬ def X x )) ∨ choiced X - lemma-ord : ( ox : Ordinal {suc n} ) → ψ ox - lemma-ord ox = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc ox where - ∋-p' : (A x : OD {suc n} ) → 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 - ∀-imply-or : {n : Level} {A : Ordinal {suc n} → Set (suc n) } {B : Set (suc (suc n)) } - → ((x : Ordinal {suc n}) → A x ∨ B) → ((x : Ordinal {suc n}) → A x) ∨ B - ∀-imply-or {n} {A} {B} ∀AB with p∨¬p ((x : Ordinal {suc n}) → A x) - ∀-imply-or {n} {A} {B} ∀AB | case1 t = case1 t - ∀-imply-or {n} {A} {B} ∀AB | case2 x = case2 (lemma x) where - lemma : ¬ ((x : Ordinal {suc n}) → A x) → B - lemma not with p∨¬p B - lemma not | case1 b = b - lemma not | case2 ¬b = ⊥-elim (not (λ x → dont-orb (∀AB x) ¬b )) - caseΦ : (lx : Nat) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x) → ψ (ordinal lx (Φ lx) ) - caseΦ lx prev with ∋-p' X ( ord→od (ordinal lx (Φ lx) )) - caseΦ lx prev | yes p = case2 ( record { a-choice = ord→od (ordinal lx (Φ lx)) ; is-in = p } ) - caseΦ lx prev | no ¬p = lemma where - lemma1 : (x : Ordinal) → (((Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X) - lemma1 x with trio< x (ordinal lx (Φ lx)) - lemma1 x | tri< a ¬b ¬c with prev (osuc x) (lemma2 a) where - lemma2 : x o< (ordinal lx (Φ lx)) → osuc x o< ordinal lx (Φ lx) - lemma2 (case1 lt) = case1 lt - lemma1 x | tri< a ¬b ¬c | case2 found = case2 found - lemma1 x | tri< a ¬b ¬c | case1 not_found = case1 ( λ lt df → not_found x <-osuc df ) - lemma1 x | tri≈ ¬a refl ¬c = case1 ( λ lt → ⊥-elim (o<¬≡ refl lt )) - lemma1 x | tri> ¬a ¬b c = case1 ( λ lt → ⊥-elim (o<> lt c )) - lemma : ((x : Ordinal) → (Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X - lemma = ∀-imply-or lemma1 - caseOSuc : (lx : Nat) (x : OrdinalD lx) → ψ ( ordinal lx x ) → ψ ( ordinal lx (OSuc lx x) ) - caseOSuc lx x prev with ∋-p' X (ord→od record { lv = lx ; ord = x } ) - caseOSuc lx x prev | yes p = case2 (record { a-choice = ord→od record { lv = lx ; ord = x } ; is-in = p }) - caseOSuc lx x (case1 not_found) | no ¬p = case1 lemma where - lemma : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx x) → def X y → ⊥ - lemma y lt with trio< y (ordinal lx x ) - lemma y lt | tri< a ¬b ¬c = not_found y a - lemma y lt | tri≈ ¬a refl ¬c = subst (λ k → def X k → ⊥ ) diso ¬p - lemma y lt | tri> ¬a ¬b c with osuc-≡< lt - lemma y lt | tri> ¬a ¬b c | case1 refl = ⊥-elim ( ¬b refl ) - lemma y lt | tri> ¬a ¬b c | case2 lt1 = ⊥-elim (o<> c lt1 ) - caseOSuc lx x (case2 found) | no ¬p = case2 found - have_to_find : choiced X - have_to_find with lemma-ord (od→ord X ) - have_to_find | t = dont-or t ¬¬X∋x where - ¬¬X∋x : ¬ ((x : Ordinal) → (Suc (lv x) ≤ lv (od→ord X)) ∨ (ord x d< ord (od→ord X)) → def X x → ⊥) - ¬¬X∋x nn = not record { - eq→ = λ {x} lt → ⊥-elim (nn x (def→o< lt) lt) - ; eq← = λ {x} lt → ⊥-elim ( ¬x<0 lt ) - } - +_,_ = ZF._,_ OD→ZF +Union = ZF.Union OD→ZF +Power = ZF.Power OD→ZF +Select = ZF.Select OD→ZF +Replace = ZF.Replace OD→ZF +isZF = ZF.isZF OD→ZF +TransFinite = IsOrdinals.TransFinite (Ordinals.isOrdinal O)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Ordinals.agda Mon Aug 12 09:04:16 2019 +0900 @@ -0,0 +1,200 @@ +open import Level +module Ordinals where + +open import zf + +open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) +open import Data.Empty +open import Relation.Binary.PropositionalEquality +open import logic +open import nat +open import Data.Unit using ( ⊤ ) +open import Relation.Nullary +open import Relation.Binary +open import Relation.Binary.Core + +record IsOrdinals {n : Level} (ord : Set n) (o∅ : ord ) (osuc : ord → ord ) (_o<_ : ord → ord → Set n) : Set (suc (suc n)) where + field + Otrans : {x y z : ord } → x o< y → y o< z → x o< z + OTri : Trichotomous {n} _≡_ _o<_ + ¬x<0 : { x : ord } → ¬ ( x o< o∅ ) + <-osuc : { x : ord } → x o< osuc x + osuc-≡< : { a x : ord } → x o< osuc a → (x ≡ a ) ∨ (x o< a) + TransFinite : { ψ : ord → Set (suc n) } + → ( (x : ord) → ( (y : ord ) → y o< x → ψ y ) → ψ x ) + → ∀ (x : ord) → ψ x + + +record Ordinals {n : Level} : Set (suc (suc n)) where + field + ord : Set n + o∅ : ord + osuc : ord → ord + _o<_ : ord → ord → Set n + isOrdinal : IsOrdinals ord o∅ osuc _o<_ + +module inOrdinal {n : Level} (O : Ordinals {n} ) where + + Ordinal : Set n + Ordinal = Ordinals.ord O + + _o<_ : Ordinal → Ordinal → Set n + _o<_ = Ordinals._o<_ O + + osuc : Ordinal → Ordinal + osuc = Ordinals.osuc O + + o∅ : Ordinal + o∅ = Ordinals.o∅ O + + ¬x<0 = IsOrdinals.¬x<0 (Ordinals.isOrdinal O) + osuc-≡< = IsOrdinals.osuc-≡< (Ordinals.isOrdinal O) + <-osuc = IsOrdinals.<-osuc (Ordinals.isOrdinal O) + + o<-dom : { x y : Ordinal } → x o< y → Ordinal + o<-dom {x} _ = x + + o<-cod : { x y : Ordinal } → x o< y → Ordinal + o<-cod {_} {y} _ = y + + o<-subst : {Z X z x : Ordinal } → Z o< X → Z ≡ z → X ≡ x → z o< x + o<-subst df refl refl = df + + ordtrans : {x y z : Ordinal } → x o< y → y o< z → x o< z + ordtrans = IsOrdinals.Otrans (Ordinals.isOrdinal O) + + trio< : Trichotomous _≡_ _o<_ + trio< = IsOrdinals.OTri (Ordinals.isOrdinal O) + + o<¬≡ : { ox oy : Ordinal } → ox ≡ oy → ox o< oy → ⊥ + o<¬≡ {ox} {oy} eq lt with trio< ox oy + o<¬≡ {ox} {oy} eq lt | tri< a ¬b ¬c = ¬b eq + o<¬≡ {ox} {oy} eq lt | tri≈ ¬a b ¬c = ¬a lt + o<¬≡ {ox} {oy} eq lt | tri> ¬a ¬b c = ¬b eq + + o<> : {x y : Ordinal } → y o< x → x o< y → ⊥ + o<> {ox} {oy} lt tl with trio< ox oy + o<> {ox} {oy} lt tl | tri< a ¬b ¬c = ¬c lt + o<> {ox} {oy} lt tl | tri≈ ¬a b ¬c = ¬a tl + o<> {ox} {oy} lt tl | tri> ¬a ¬b c = ¬a tl + + osuc-< : { x y : Ordinal } → y o< osuc x → x o< y → ⊥ + osuc-< {x} {y} y<ox x<y with osuc-≡< y<ox + osuc-< {x} {y} y<ox x<y | case1 refl = o<¬≡ refl x<y + osuc-< {x} {y} y<ox x<y | case2 y<x = o<> x<y y<x + + osucc : {ox oy : Ordinal } → oy o< ox → osuc oy o< osuc ox + ---- y < osuc y < x < osuc x + ---- y < osuc y = x < osuc x + ---- y < osuc y > x < osuc x -> y = x ∨ x < y → ⊥ + osucc {ox} {oy} oy<ox with trio< (osuc oy) ox + osucc {ox} {oy} oy<ox | tri< a ¬b ¬c = ordtrans a <-osuc + osucc {ox} {oy} oy<ox | tri≈ ¬a refl ¬c = <-osuc + osucc {ox} {oy} oy<ox | tri> ¬a ¬b c with osuc-≡< c + osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case1 eq = ⊥-elim (o<¬≡ (sym eq) oy<ox) + osucc {ox} {oy} oy<ox | tri> ¬a ¬b c | case2 lt = ⊥-elim (o<> lt oy<ox) + + open _∧_ + + osuc2 : ( x y : Ordinal ) → ( osuc x o< osuc (osuc y )) ⇔ (x o< osuc y) + proj2 (osuc2 x y) lt = osucc lt + proj1 (osuc2 x y) ox<ooy with osuc-≡< ox<ooy + proj1 (osuc2 x y) ox<ooy | case1 ox=oy = o<-subst <-osuc refl ox=oy + proj1 (osuc2 x y) ox<ooy | case2 ox<oy = ordtrans <-osuc ox<oy + + _o≤_ : Ordinal → Ordinal → Set n + a o≤ b = (a ≡ b) ∨ ( a o< b ) + + + xo<ab : {oa ob : Ordinal } → ( {ox : Ordinal } → ox o< oa → ox o< ob ) → oa o< osuc ob + xo<ab {oa} {ob} a→b with trio< oa ob + xo<ab {oa} {ob} a→b | tri< a ¬b ¬c = ordtrans a <-osuc + xo<ab {oa} {ob} a→b | tri≈ ¬a refl ¬c = <-osuc + xo<ab {oa} {ob} a→b | tri> ¬a ¬b c = ⊥-elim ( o<¬≡ refl (a→b c ) ) + + maxα : Ordinal → Ordinal → Ordinal + maxα x y with trio< x y + maxα x y | tri< a ¬b ¬c = y + maxα x y | tri> ¬a ¬b c = x + maxα x y | tri≈ ¬a refl ¬c = x + + minα : Ordinal → Ordinal → Ordinal + minα x y with trio< x y + minα x y | tri< a ¬b ¬c = x + minα x y | tri> ¬a ¬b c = y + minα x y | tri≈ ¬a refl ¬c = x + + min1 : {x y z : Ordinal } → z o< x → z o< y → z o< minα x y + min1 {x} {y} {z} z<x z<y with trio< x y + min1 {x} {y} {z} z<x z<y | tri< a ¬b ¬c = z<x + min1 {x} {y} {z} z<x z<y | tri≈ ¬a refl ¬c = z<x + min1 {x} {y} {z} z<x z<y | tri> ¬a ¬b c = z<y + + -- + -- max ( osuc x , osuc y ) + -- + + omax : ( x y : Ordinal ) → Ordinal + omax x y with trio< x y + omax x y | tri< a ¬b ¬c = osuc y + omax x y | tri> ¬a ¬b c = osuc x + omax x y | tri≈ ¬a refl ¬c = osuc x + + omax< : ( x y : Ordinal ) → x o< y → osuc y ≡ omax x y + omax< x y lt with trio< x y + omax< x y lt | tri< a ¬b ¬c = refl + omax< x y lt | tri≈ ¬a b ¬c = ⊥-elim (¬a lt ) + omax< x y lt | tri> ¬a ¬b c = ⊥-elim (¬a lt ) + + omax≡ : ( x y : Ordinal ) → x ≡ y → osuc y ≡ omax x y + omax≡ x y eq with trio< x y + omax≡ x y eq | tri< a ¬b ¬c = ⊥-elim (¬b eq ) + omax≡ x y eq | tri≈ ¬a refl ¬c = refl + omax≡ x y eq | tri> ¬a ¬b c = ⊥-elim (¬b eq ) + + omax-x : ( x y : Ordinal ) → x o< omax x y + omax-x x y with trio< x y + omax-x x y | tri< a ¬b ¬c = ordtrans a <-osuc + omax-x x y | tri> ¬a ¬b c = <-osuc + omax-x x y | tri≈ ¬a refl ¬c = <-osuc + + omax-y : ( x y : Ordinal ) → y o< omax x y + omax-y x y with trio< x y + omax-y x y | tri< a ¬b ¬c = <-osuc + omax-y x y | tri> ¬a ¬b c = ordtrans c <-osuc + omax-y x y | tri≈ ¬a refl ¬c = <-osuc + + omxx : ( x : Ordinal ) → omax x x ≡ osuc x + omxx x with trio< x x + omxx x | tri< a ¬b ¬c = ⊥-elim (¬b refl ) + omxx x | tri> ¬a ¬b c = ⊥-elim (¬b refl ) + omxx x | tri≈ ¬a refl ¬c = refl + + omxxx : ( x : Ordinal ) → omax x (omax x x ) ≡ osuc (osuc x) + omxxx x = trans ( cong ( λ k → omax x k ) (omxx x )) (sym ( omax< x (osuc x) <-osuc )) + + open _∧_ + + OrdTrans : Transitive _o≤_ + OrdTrans (case1 refl) (case1 refl) = case1 refl + OrdTrans (case1 refl) (case2 lt2) = case2 lt2 + OrdTrans (case2 lt1) (case1 refl) = case2 lt1 + OrdTrans (case2 x) (case2 y) = case2 (ordtrans x y) + + OrdPreorder : Preorder n n n + OrdPreorder = record { Carrier = Ordinal + ; _≈_ = _≡_ + ; _∼_ = _o≤_ + ; isPreorder = record { + isEquivalence = record { refl = refl ; sym = sym ; trans = trans } + ; reflexive = case1 + ; trans = OrdTrans + } + } + + TransFiniteExists : {m l : Level} → ( ψ : Ordinal → Set m ) + → {p : Set l} ( P : { y : Ordinal } → ψ y → ¬ p ) + → (exists : ¬ (∀ y → ¬ ( ψ y ) )) + → ¬ p + TransFiniteExists {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p ) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cardinal.agda Mon Aug 12 09:04:16 2019 +0900 @@ -0,0 +1,140 @@ +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 + +func→od : (f : Ordinal → Ordinal ) → ( dom : OD ) → OD +func→od f dom = Replace dom ( λ x → x , (ord→od (f (od→ord x) ))) + +record _⊗_ (A B : Ordinal) : Set n where + field + π1 : Ordinal + π2 : Ordinal + A∋π1 : def (ord→od A) π1 + B∋π2 : def (ord→od B) π2 + +-- Clearly wrong. We need ordered pair +Func : ( A B : OD ) → OD +Func A B = record { def = λ x → (od→ord A) ⊗ (od→ord B) } + +open _⊗_ + +func←od : { dom cod : OD } → (f : OD ) → Func dom cod ∋ f → (Ordinal → Ordinal ) +func←od {dom} {cod} f lt x = sup-o ( λ y → lemma y ) where + lemma : Ordinal → Ordinal + lemma y with p∨¬p ( _⊗_.π1 lt ≡ x ) + lemma y | case1 refl = _⊗_.π2 lt + lemma y | case2 not = o∅ + +-- 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←od (ord→od xmap) xfunc ( func←od (ord→od ymap) 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←od (ord→od xmap1) xfunc1 ( func←od (ord→od zmap) 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. + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/logic.agda Mon Aug 12 09:04:16 2019 +0900 @@ -0,0 +1,50 @@ +module logic where + +open import Level +open import Relation.Nullary +open import Relation.Binary +open import Data.Empty + + +data Bool : Set where + true : Bool + false : Bool + +record _∧_ {n m : Level} (A : Set n) ( B : Set m ) : Set (n ⊔ m) where + field + proj1 : A + proj2 : B + +data _∨_ {n m : Level} (A : Set n) ( B : Set m ) : Set (n ⊔ m) where + case1 : A → A ∨ B + case2 : B → A ∨ B + +_⇔_ : {n m : Level } → ( A : Set n ) ( B : Set m ) → Set (n ⊔ m) +_⇔_ A B = ( A → B ) ∧ ( B → A ) + +contra-position : {n m : Level } {A : Set n} {B : Set m} → (A → B) → ¬ B → ¬ A +contra-position {n} {m} {A} {B} f ¬b a = ¬b ( f a ) + +double-neg : {n : Level } {A : Set n} → A → ¬ ¬ A +double-neg A notnot = notnot A + +double-neg2 : {n : Level } {A : Set n} → ¬ ¬ ¬ A → ¬ A +double-neg2 notnot A = notnot ( double-neg A ) + +de-morgan : {n : Level } {A B : Set n} → A ∧ B → ¬ ( (¬ A ) ∨ (¬ B ) ) +de-morgan {n} {A} {B} and (case1 ¬A) = ⊥-elim ( ¬A ( _∧_.proj1 and )) +de-morgan {n} {A} {B} and (case2 ¬B) = ⊥-elim ( ¬B ( _∧_.proj2 and )) + +dont-or : {n m : Level} {A : Set n} { B : Set m } → A ∨ B → ¬ A → B +dont-or {A} {B} (case1 a) ¬A = ⊥-elim ( ¬A a ) +dont-or {A} {B} (case2 b) ¬A = b + +dont-orb : {n m : Level} {A : Set n} { B : Set m } → A ∨ B → ¬ B → A +dont-orb {A} {B} (case2 b) ¬B = ⊥-elim ( ¬B b ) +dont-orb {A} {B} (case1 a) ¬B = a + + +infixr 130 _∧_ +infixr 140 _∨_ +infixr 150 _⇔_ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nat.agda Mon Aug 12 09:04:16 2019 +0900 @@ -0,0 +1,46 @@ +module nat where + +open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) +open import Data.Empty +open import Relation.Nullary +open import Relation.Binary.PropositionalEquality +open import logic + + +nat-<> : { x y : Nat } → x < y → y < x → ⊥ +nat-<> (s≤s x<y) (s≤s y<x) = nat-<> x<y y<x + +nat-<≡ : { x : Nat } → x < x → ⊥ +nat-<≡ (s≤s lt) = nat-<≡ lt + +nat-≡< : { x y : Nat } → x ≡ y → x < y → ⊥ +nat-≡< refl lt = nat-<≡ lt + +¬a≤a : {la : Nat} → Suc la ≤ la → ⊥ +¬a≤a (s≤s lt) = ¬a≤a lt + +a<sa : {la : Nat} → la < Suc la +a<sa {Zero} = s≤s z≤n +a<sa {Suc la} = s≤s a<sa + +=→¬< : {x : Nat } → ¬ ( x < x ) +=→¬< {Zero} () +=→¬< {Suc x} (s≤s lt) = =→¬< lt + +>→¬< : {x y : Nat } → (x < y ) → ¬ ( y < x ) +>→¬< (s≤s x<y) (s≤s y<x) = >→¬< x<y y<x + +<-∨ : { x y : Nat } → x < Suc y → ( (x ≡ y ) ∨ (x < y) ) +<-∨ {Zero} {Zero} (s≤s z≤n) = case1 refl +<-∨ {Zero} {Suc y} (s≤s lt) = case2 (s≤s z≤n) +<-∨ {Suc x} {Zero} (s≤s ()) +<-∨ {Suc x} {Suc y} (s≤s lt) with <-∨ {x} {y} lt +<-∨ {Suc x} {Suc y} (s≤s lt) | case1 eq = case1 (cong (λ k → Suc k ) eq) +<-∨ {Suc x} {Suc y} (s≤s lt) | case2 lt1 = case2 (s≤s lt1) + +max : (x y : Nat) → Nat +max Zero Zero = Zero +max Zero (Suc x) = (Suc x) +max (Suc x) Zero = (Suc x) +max (Suc x) (Suc y) = Suc ( max x y ) +
--- a/ordinal.agda Thu Aug 01 12:24:26 2019 +0900 +++ b/ordinal.agda Mon Aug 12 09:04:16 2019 +0900 @@ -7,6 +7,8 @@ open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) open import Data.Empty open import Relation.Binary.PropositionalEquality +open import logic +open import nat data OrdinalD {n : Level} : (lv : Nat) → Set n where Φ : (lv : Nat) → OrdinalD lv @@ -58,12 +60,6 @@ lv x ≡ lv y → ord x ≅ ord y → x ≡ y ordinal-cong refl refl = refl -ordinal-lv : {n : Level} {x y : Ordinal {n}} → x ≡ y → lv x ≡ lv y -ordinal-lv refl = refl - -ordinal-d : {n : Level} {x y : Ordinal {n}} → x ≡ y → ord x ≅ ord y -ordinal-d refl = refl - ≡→¬d< : {n : Level} → {lv : Nat} → {x : OrdinalD {n} lv } → x d< x → ⊥ ≡→¬d< {n} {lx} {OSuc lx y} (s< t) = ≡→¬d< t @@ -73,9 +69,6 @@ trio>≡ : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → y d< x → ⊥ trio>≡ refl = ≡→¬d< -triO : {n : Level} → {lx ly : Nat} → OrdinalD {n} lx → OrdinalD {n} ly → Tri (lx < ly) ( lx ≡ ly ) ( lx > ly ) -triO {n} {lx} {ly} x y = <-cmp lx ly - triOrdd : {n : Level} → {lx : Nat} → Trichotomous _≡_ ( _d<_ {n} {lx} {lx} ) triOrdd {_} {lv} (Φ lv) (Φ lv) = tri≈ ≡→¬d< refl ≡→¬d< triOrdd {_} {lv} (Φ lv) (OSuc lv y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< ) @@ -92,50 +85,6 @@ <-osuc {n} {record { lv = lx ; ord = Φ .lx }} = case2 Φ< <-osuc {n} {record { lv = lx ; ord = OSuc .lx ox }} = case2 ( s< s<refl ) -osuc-lveq : {n : Level} { x : Ordinal {n} } → lv x ≡ lv ( osuc x ) -osuc-lveq {n} = refl - -osucc : {n : Level} {ox oy : Ordinal {n}} → oy o< ox → osuc oy o< osuc ox -osucc {n} {ox} {oy} (case1 x) = case1 x -osucc {n} {ox} {oy} (case2 x) with d<→lv x -... | refl = case2 (s< x) - -nat-<> : { x y : Nat } → x < y → y < x → ⊥ -nat-<> (s≤s x<y) (s≤s y<x) = nat-<> x<y y<x - -nat-<≡ : { x : Nat } → x < x → ⊥ -nat-<≡ (s≤s lt) = nat-<≡ lt - -nat-≡< : { x y : Nat } → x ≡ y → x < y → ⊥ -nat-≡< refl lt = nat-<≡ lt - -¬a≤a : {la : Nat} → Suc la ≤ la → ⊥ -¬a≤a (s≤s lt) = ¬a≤a lt - -a<sa : {la : Nat} → la < Suc la -a<sa {Zero} = s≤s z≤n -a<sa {Suc la} = s≤s a<sa - -=→¬< : {x : Nat } → ¬ ( x < x ) -=→¬< {Zero} () -=→¬< {Suc x} (s≤s lt) = =→¬< lt - -<-∨ : { x y : Nat } → x < Suc y → ( (x ≡ y ) ∨ (x < y) ) -<-∨ {Zero} {Zero} (s≤s z≤n) = case1 refl -<-∨ {Zero} {Suc y} (s≤s lt) = case2 (s≤s z≤n) -<-∨ {Suc x} {Zero} (s≤s ()) -<-∨ {Suc x} {Suc y} (s≤s lt) with <-∨ {x} {y} lt -<-∨ {Suc x} {Suc y} (s≤s lt) | case1 eq = case1 (cong (λ k → Suc k ) eq) -<-∨ {Suc x} {Suc y} (s≤s lt) | case2 lt1 = case2 (s≤s lt1) - -case12-⊥ : {n : Level} {x y : Ordinal {suc n}} → lv x < lv y → ord x d< ord y → ⊥ -case12-⊥ {x} {y} lt1 lt2 with d<→lv lt2 -... | refl = nat-≡< refl lt1 - -case21-⊥ : {n : Level} {x y : Ordinal {suc n}} → lv x < lv y → ord y d< ord x → ⊥ -case21-⊥ {x} {y} lt1 lt2 with d<→lv lt2 -... | refl = nat-≡< refl lt1 - o<¬≡ : {n : Level } { ox oy : Ordinal {suc n}} → ox ≡ oy → ox o< oy → ⊥ o<¬≡ {_} {ox} {ox} refl (case1 lt) = =→¬< lt o<¬≡ {_} {ox} {ox} refl (case2 (s< lt)) = trio<≡ refl lt @@ -176,26 +125,6 @@ osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case2 x₁) = nat-≡< (sym (d<→lv x₁)) x₂ osuc-< {n} {x} {y} y<ox (case2 x<y) | case2 y<x = o<> (case2 x<y) y<x -max : (x y : Nat) → Nat -max Zero Zero = Zero -max Zero (Suc x) = (Suc x) -max (Suc x) Zero = (Suc x) -max (Suc x) (Suc y) = Suc ( max x y ) - -maxαd : {n : Level} → { lx : Nat } → OrdinalD {n} lx → OrdinalD lx → OrdinalD lx -maxαd x y with triOrdd x y -maxαd x y | tri< a ¬b ¬c = y -maxαd x y | tri≈ ¬a b ¬c = x -maxαd x y | tri> ¬a ¬b c = x - -minαd : {n : Level} → { lx : Nat } → OrdinalD {n} lx → OrdinalD lx → OrdinalD lx -minαd x y with triOrdd x y -minαd x y | tri< a ¬b ¬c = x -minαd x y | tri≈ ¬a b ¬c = y -minαd x y | tri> ¬a ¬b c = x - -_o≤_ : {n : Level} → Ordinal → Ordinal → Set (suc n) -a o≤ b = (a ≡ b) ∨ ( a o< b ) ordtrans : {n : Level} {x y z : Ordinal {n} } → x o< y → y o< z → x o< z ordtrans {n} {x} {y} {z} (case1 x₁) (case1 x₂) = case1 ( <-trans x₁ x₂ ) @@ -234,105 +163,15 @@ lemma1 (case1 x) = ¬a x lemma1 (case2 x) = ≡→¬d< x -xo<ab : {n : Level} {oa ob : Ordinal {suc n}} → ( {ox : Ordinal {suc n}} → ox o< oa → ox o< ob ) → oa o< osuc ob -xo<ab {n} {oa} {ob} a→b with trio< oa ob -xo<ab {n} {oa} {ob} a→b | tri< a ¬b ¬c = ordtrans a <-osuc -xo<ab {n} {oa} {ob} a→b | tri≈ ¬a refl ¬c = <-osuc -xo<ab {n} {oa} {ob} a→b | tri> ¬a ¬b c = ⊥-elim ( o<¬≡ refl (a→b c ) ) - -maxα : {n : Level} → Ordinal {suc n} → Ordinal → Ordinal -maxα x y with trio< x y -maxα x y | tri< a ¬b ¬c = y -maxα x y | tri> ¬a ¬b c = x -maxα x y | tri≈ ¬a refl ¬c = x - -minα : {n : Level} → Ordinal {suc n} → Ordinal → Ordinal -minα {n} x y with trio< {n} x y -minα x y | tri< a ¬b ¬c = x -minα x y | tri> ¬a ¬b c = y -minα x y | tri≈ ¬a refl ¬c = x - -min1 : {n : Level} → {x y z : Ordinal {suc n} } → z o< x → z o< y → z o< minα x y -min1 {n} {x} {y} {z} z<x z<y with trio< {n} x y -min1 {n} {x} {y} {z} z<x z<y | tri< a ¬b ¬c = z<x -min1 {n} {x} {y} {z} z<x z<y | tri≈ ¬a refl ¬c = z<x -min1 {n} {x} {y} {z} z<x z<y | tri> ¬a ¬b c = z<y - --- --- max ( osuc x , osuc y ) --- - -omax : {n : Level} ( x y : Ordinal {suc n} ) → Ordinal {suc n} -omax {n} x y with trio< x y -omax {n} x y | tri< a ¬b ¬c = osuc y -omax {n} x y | tri> ¬a ¬b c = osuc x -omax {n} x y | tri≈ ¬a refl ¬c = osuc x - -omax< : {n : Level} ( x y : Ordinal {suc n} ) → x o< y → osuc y ≡ omax x y -omax< {n} x y lt with trio< x y -omax< {n} x y lt | tri< a ¬b ¬c = refl -omax< {n} x y lt | tri≈ ¬a b ¬c = ⊥-elim (¬a lt ) -omax< {n} x y lt | tri> ¬a ¬b c = ⊥-elim (¬a lt ) - -omax≡ : {n : Level} ( x y : Ordinal {suc n} ) → x ≡ y → osuc y ≡ omax x y -omax≡ {n} x y eq with trio< x y -omax≡ {n} x y eq | tri< a ¬b ¬c = ⊥-elim (¬b eq ) -omax≡ {n} x y eq | tri≈ ¬a refl ¬c = refl -omax≡ {n} x y eq | tri> ¬a ¬b c = ⊥-elim (¬b eq ) - -omax-x : {n : Level} ( x y : Ordinal {suc n} ) → x o< omax x y -omax-x {n} x y with trio< x y -omax-x {n} x y | tri< a ¬b ¬c = ordtrans a <-osuc -omax-x {n} x y | tri> ¬a ¬b c = <-osuc -omax-x {n} x y | tri≈ ¬a refl ¬c = <-osuc - -omax-y : {n : Level} ( x y : Ordinal {suc n} ) → y o< omax x y -omax-y {n} x y with trio< x y -omax-y {n} x y | tri< a ¬b ¬c = <-osuc -omax-y {n} x y | tri> ¬a ¬b c = ordtrans c <-osuc -omax-y {n} x y | tri≈ ¬a refl ¬c = <-osuc - -omxx : {n : Level} ( x : Ordinal {suc n} ) → omax x x ≡ osuc x -omxx {n} x with trio< x x -omxx {n} x | tri< a ¬b ¬c = ⊥-elim (¬b refl ) -omxx {n} x | tri> ¬a ¬b c = ⊥-elim (¬b refl ) -omxx {n} x | tri≈ ¬a refl ¬c = refl - -omxxx : {n : Level} ( x : Ordinal {suc n} ) → omax x (omax x x ) ≡ osuc (osuc x) -omxxx {n} x = trans ( cong ( λ k → omax x k ) (omxx x )) (sym ( omax< x (osuc x) <-osuc )) open _∧_ -osuc2 : {n : Level} ( x y : Ordinal {suc n} ) → ( osuc x o< osuc (osuc y )) ⇔ (x o< osuc y) -proj1 (osuc2 {n} x y) (case1 lt) = case1 lt -proj1 (osuc2 {n} x y) (case2 (s< lt)) = case2 lt -proj2 (osuc2 {n} x y) (case1 lt) = case1 lt -proj2 (osuc2 {n} x y) (case2 lt) with d<→lv lt -... | refl = case2 (s< lt) - -OrdTrans : {n : Level} → Transitive {suc n} _o≤_ -OrdTrans (case1 refl) (case1 refl) = case1 refl -OrdTrans (case1 refl) (case2 lt2) = case2 lt2 -OrdTrans (case2 lt1) (case1 refl) = case2 lt1 -OrdTrans (case2 x) (case2 y) = case2 (ordtrans x y) - -OrdPreorder : {n : Level} → Preorder (suc n) (suc n) (suc n) -OrdPreorder {n} = record { Carrier = Ordinal - ; _≈_ = _≡_ - ; _∼_ = _o≤_ - ; isPreorder = record { - isEquivalence = record { refl = refl ; sym = sym ; trans = trans } - ; reflexive = case1 - ; trans = OrdTrans - } - } - TransFinite : {n m : Level} → { ψ : Ordinal {suc n} → Set m } → ( ∀ (lx : Nat ) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x ) → ψ ( record { lv = lx ; ord = Φ lx } ) ) - → ( ∀ (lx : Nat ) → (x : OrdinalD lx ) → ψ ( record { lv = lx ; ord = x } ) → ψ ( record { lv = lx ; ord = OSuc lx x } ) ) + → ( ∀ (lx : Nat ) → (x : OrdinalD lx ) → ( (y : Ordinal {suc n} ) → y o< ordinal lx (OSuc lx x) → ψ y ) → ψ ( record { lv = lx ; ord = OSuc lx x } ) ) → ∀ (x : Ordinal) → ψ x TransFinite {n} {m} {ψ} caseΦ caseOSuc x = proj1 (TransFinite1 (lv x) (ord x) ) where - TransFinite1 : (lx : Nat) (ox : OrdinalD lx ) → ψ (ordinal lx ox) ∧ ( ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x ) ) + TransFinite1 : (lx : Nat) (ox : OrdinalD lx ) → ψ (ordinal lx ox) ∧ ( ( (x : Ordinal {suc n} ) → x o< ordinal lx ox → ψ x ) ) TransFinite1 Zero (Φ 0) = record { proj1 = caseΦ Zero lemma ; proj2 = lemma1 } where lemma : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x lemma x (case1 ()) @@ -344,12 +183,26 @@ lemma0 : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal lx (Φ lx) → ψ (ordinal ly oy) lemma0 ly oy lt = proj2 ( TransFinite1 lx (Φ lx) ) (ordinal ly oy) lt lemma : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal (Suc lx) (Φ (Suc lx)) → ψ (ordinal ly oy) - lemma lx1 ox1 (case1 lt) with <-∨ lt - lemma lx (Φ lx) (case1 lt) | case1 refl = proj1 ( TransFinite1 lx (Φ lx) ) - lemma lx (OSuc lx ox1) (case1 lt) | case1 refl = caseOSuc lx ox1 ( lemma lx ox1 (case1 a<sa)) - lemma lx (Φ lx) (case1 lt) | case2 (s≤s lt1) = lemma0 lx (Φ lx) (case1 (s≤s lt1)) - lemma lx1 (OSuc lx1 ox1) (case1 lt) | case2 lt1 = caseOSuc lx1 ox1 ( lemma lx1 ox1 (case1 (<-trans lt1 a<sa ))) - TransFinite1 lx (OSuc lx ox) = record { proj1 = caseOSuc lx ox (proj1 (TransFinite1 lx ox )) ; proj2 = proj2 (TransFinite1 lx ox )} + lemma lx1 ox1 (case1 lt) with <-∨ lt + lemma lx (Φ lx) (case1 lt) | case1 refl = proj1 ( TransFinite1 lx (Φ lx) ) + lemma lx (Φ lx) (case1 lt) | case2 lt1 = lemma0 lx (Φ lx) (case1 lt1) + lemma lx (OSuc lx ox1) (case1 lt) | case1 refl = caseOSuc lx ox1 lemma2 where + lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx ox1) → ψ y + lemma2 y lt1 with osuc-≡< lt1 + lemma2 y lt1 | case1 refl = lemma lx ox1 (case1 a<sa) + lemma2 y lt1 | case2 t = proj2 (TransFinite1 lx ox1) y t + lemma lx1 (OSuc lx1 ox1) (case1 lt) | case2 lt1 = caseOSuc lx1 ox1 lemma2 where + lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx1) ∨ (ord y d< OSuc lx1 ox1) → ψ y + lemma2 y lt2 with osuc-≡< lt2 + lemma2 y lt2 | case1 refl = lemma lx1 ox1 (ordtrans lt2 (case1 lt)) + lemma2 y lt2 | case2 (case1 lt3) = proj2 (TransFinite1 lx (Φ lx)) y (case1 (<-trans lt3 lt1 )) + lemma2 y lt2 | case2 (case2 lt3) with d<→lv lt3 + ... | refl = proj2 (TransFinite1 lx (Φ lx)) y (case1 lt1) + TransFinite1 lx (OSuc lx ox) = record { proj1 = caseOSuc lx ox lemma ; proj2 = lemma } where + lemma : (y : Ordinal) → y o< ordinal lx (OSuc lx ox) → ψ y + lemma y lt with osuc-≡< lt + lemma y lt | case1 refl = proj1 ( TransFinite1 lx ox ) + lemma y lt | case2 lt1 = proj2 ( TransFinite1 lx ox ) y lt1 -- we cannot prove this in intutionistic logic -- (¬ (∀ y → ¬ ( ψ y ))) → (ψ y → p ) → p @@ -367,3 +220,171 @@ → ¬ p TransFiniteExists {n} {m} {l} ψ {p} P = contra-position ( λ p y ψy → P {y} ψy p ) +open import Ordinals + +C-Ordinal : {n : Level} → Ordinals {suc n} +C-Ordinal {n} = record { + ord = Ordinal {suc n} + ; o∅ = o∅ + ; osuc = osuc + ; _o<_ = _o<_ + ; isOrdinal = record { + Otrans = ordtrans + ; OTri = trio< + ; ¬x<0 = ¬x<0 + ; <-osuc = <-osuc + ; osuc-≡< = osuc-≡< + ; TransFinite = TransFinite1 + } + } where + ord1 : Set (suc n) + ord1 = Ordinal {suc n} + TransFinite1 : { ψ : ord1 → Set (suc (suc n)) } + → ( (x : ord1) → ( (y : ord1 ) → y o< x → ψ y ) → ψ x ) + → ∀ (x : ord1) → ψ x + TransFinite1 {ψ} lt x = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc x where + caseΦ : (lx : Nat) → ((x₁ : Ordinal) → x₁ o< ordinal lx (Φ lx) → ψ x₁) → + ψ (record { lv = lx ; ord = Φ lx }) + caseΦ lx prev = lt (ordinal lx (Φ lx) ) prev + caseOSuc : (lx : Nat) (x₁ : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x₁) → ψ y) → + ψ (record { lv = lx ; ord = OSuc lx x₁ }) + caseOSuc lx ox prev = lt (ordinal lx (OSuc lx ox)) prev + +module C-Ordinal-with-choice {n : Level} where + + import OD + -- open inOrdinal C-Ordinal + open OD (C-Ordinal {n}) + open OD.OD + + -- + -- another form of regularity + -- + ε-induction : {m : Level} { ψ : OD → Set m} + → ( {x : OD } → ({ y : OD } → x ∋ y → ψ y ) → ψ x ) + → (x : OD ) → ψ x + ε-induction {m} {ψ} ind x = subst (λ k → ψ k ) oiso (ε-induction-ord (lv (osuc (od→ord x))) (ord (osuc (od→ord x))) <-osuc) where + ε-induction-ord : (lx : Nat) ( ox : OrdinalD {suc n} lx ) {ly : Nat} {oy : OrdinalD {suc n} ly } + → (ly < lx) ∨ (oy d< ox ) → ψ (ord→od (record { lv = ly ; ord = oy } ) ) + ε-induction-ord lx (OSuc lx ox) {ly} {oy} y<x = + ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → subst (λ k → ψ k ) oiso (ε-induction-ord lx ox (lemma y lt ))) where + lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → od→ord z o< record { lv = lx ; ord = ox } + lemma z lt with osuc-≡< y<x + lemma z lt | case1 refl = o<-subst (c<→o< lt) refl diso + lemma z lt | case2 lt1 = ordtrans (o<-subst (c<→o< lt) refl diso) lt1 + ε-induction-ord (Suc lx) (Φ (Suc lx)) {ly} {oy} (case1 y<sox ) = + ind {ord→od (record { lv = ly ; ord = oy })} ( λ {y} lt → lemma y lt ) where + -- + -- if lv of z if less than x Ok + -- else lv z = lv x. We can create OSuc of z which is larger than z and less than x in lemma + -- + -- lx Suc lx (1) lz(a) <lx by case1 + -- ly(1) ly(2) (2) lz(b) <lx by case1 + -- lz(a) lz(b) lz(c) lz(c) <lx by case2 ( ly==lz==lx) + -- + lemma0 : { lx ly : Nat } → ly < Suc lx → lx < ly → ⊥ + lemma0 {Suc lx} {Suc ly} (s≤s lt1) (s≤s lt2) = lemma0 lt1 lt2 + lemma1 : {ly : Nat} {oy : OrdinalD {suc n} ly} → lv (od→ord (ord→od (record { lv = ly ; ord = oy }))) ≡ ly + lemma1 {ly} {oy} = let open ≡-Reasoning in begin + lv (od→ord (ord→od (record { lv = ly ; ord = oy }))) + ≡⟨ cong ( λ k → lv k ) diso ⟩ + lv (record { lv = ly ; ord = oy }) + ≡⟨⟩ + ly + ∎ + lemma : (z : OD) → ord→od record { lv = ly ; ord = oy } ∋ z → ψ z + lemma z lt with c<→o< {z} {ord→od (record { lv = ly ; ord = oy })} lt + lemma z lt | case1 lz<ly with <-cmp lx ly + lemma z lt | case1 lz<ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen + lemma z lt | case1 lz<ly | tri≈ ¬a refl ¬c = -- ly(1) + subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → lv (od→ord z) < k ) lemma1 lz<ly ) )) + lemma z lt | case1 lz<ly | tri> ¬a ¬b c = -- lz(a) + subst (λ k → ψ k ) oiso (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (<-trans lz<ly (subst (λ k → k < lx ) (sym lemma1) c)))) + lemma z lt | case2 lz=ly with <-cmp lx ly + lemma z lt | case2 lz=ly | tri< a ¬b ¬c = ⊥-elim ( lemma0 y<sox a) -- can't happen + lemma z lt | case2 lz=ly | tri> ¬a ¬b c with d<→lv lz=ly -- lz(b) + ... | eq = subst (λ k → ψ k ) oiso + (ε-induction-ord lx (Φ lx) {_} {ord (od→ord z)} (case1 (subst (λ k → k < lx ) (trans (sym lemma1)(sym eq) ) c ))) + lemma z lt | case2 lz=ly | tri≈ ¬a lx=ly ¬c with d<→lv lz=ly -- lz(c) + ... | eq = subst (λ k → ψ k ) oiso ( ε-induction-ord lx (dz oz=lx) {lv (od→ord z)} {ord (od→ord z)} (case2 (dz<dz oz=lx) )) where + oz=lx : lv (od→ord z) ≡ lx + oz=lx = let open ≡-Reasoning in begin + lv (od→ord z) + ≡⟨ eq ⟩ + lv (od→ord (ord→od (ordinal ly oy))) + ≡⟨ cong ( λ k → lv k ) diso ⟩ + lv (ordinal ly oy) + ≡⟨ sym lx=ly ⟩ + lx + ∎ + dz : lv (od→ord z) ≡ lx → OrdinalD lx + dz refl = OSuc lx (ord (od→ord z)) + dz<dz : (z=x : lv (od→ord z) ≡ lx ) → ord (od→ord z) d< dz z=x + dz<dz refl = s<refl + + --- + --- With assuption of OD is ordered, p ∨ ( ¬ p ) <=> axiom of choice + --- + record choiced ( X : OD) : Set (suc (suc n)) where + field + a-choice : OD + is-in : X ∋ a-choice + + choice-func' : (X : OD ) → (p∨¬p : { n : Level } → ( p : Set (suc n) ) → p ∨ ( ¬ p )) → ¬ ( X == od∅ ) → choiced X + choice-func' X p∨¬p not = have_to_find where + ψ : ( ox : Ordinal {suc n}) → Set (suc (suc n)) + ψ ox = (( x : Ordinal {suc n}) → x o< ox → ( ¬ def X x )) ∨ choiced X + lemma-ord : ( ox : Ordinal {suc n} ) → ψ ox + lemma-ord ox = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc1 ox where + ∋-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 + ∀-imply-or : {n : Level} {A : Ordinal {suc n} → Set (suc n) } {B : Set (suc (suc n)) } + → ((x : Ordinal {suc n}) → A x ∨ B) → ((x : Ordinal {suc n}) → A x) ∨ B + ∀-imply-or {n} {A} {B} ∀AB with p∨¬p ((x : Ordinal {suc n}) → A x) + ∀-imply-or {n} {A} {B} ∀AB | case1 t = case1 t + ∀-imply-or {n} {A} {B} ∀AB | case2 x = case2 (lemma x) where + lemma : ¬ ((x : Ordinal {suc n}) → A x) → B + lemma not with p∨¬p B + lemma not | case1 b = b + lemma not | case2 ¬b = ⊥-elim (not (λ x → dont-orb (∀AB x) ¬b )) + caseΦ : (lx : Nat) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x) → ψ (ordinal lx (Φ lx) ) + caseΦ lx prev with ∋-p' X ( ord→od (ordinal lx (Φ lx) )) + caseΦ lx prev | yes p = case2 ( record { a-choice = ord→od (ordinal lx (Φ lx)) ; is-in = p } ) + caseΦ lx prev | no ¬p = lemma where + lemma1 : (x : Ordinal) → (((Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X) + lemma1 x with trio< x (ordinal lx (Φ lx)) + lemma1 x | tri< a ¬b ¬c with prev (osuc x) (lemma2 a) where + lemma2 : x o< (ordinal lx (Φ lx)) → osuc x o< ordinal lx (Φ lx) + lemma2 (case1 lt) = case1 lt + lemma1 x | tri< a ¬b ¬c | case2 found = case2 found + lemma1 x | tri< a ¬b ¬c | case1 not_found = case1 ( λ lt df → not_found x <-osuc df ) + lemma1 x | tri≈ ¬a refl ¬c = case1 ( λ lt → ⊥-elim (o<¬≡ refl lt )) + lemma1 x | tri> ¬a ¬b c = case1 ( λ lt → ⊥-elim (o<> lt c )) + lemma : ((x : Ordinal) → (Suc (lv x) ≤ lx) ∨ (ord x d< Φ lx) → def X x → ⊥) ∨ choiced X + lemma = ∀-imply-or lemma1 + caseOSuc : (lx : Nat) (x : OrdinalD lx) → ψ ( ordinal lx x ) → ψ ( ordinal lx (OSuc lx x) ) + caseOSuc lx x prev with ∋-p' X (ord→od record { lv = lx ; ord = x } ) + caseOSuc lx x prev | yes p = case2 (record { a-choice = ord→od record { lv = lx ; ord = x } ; is-in = p }) + caseOSuc lx x (case1 not_found) | no ¬p = case1 lemma where + lemma : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx x) → def X y → ⊥ + lemma y lt with trio< y (ordinal lx x ) + lemma y lt | tri< a ¬b ¬c = not_found y a + lemma y lt | tri≈ ¬a refl ¬c = subst (λ k → def X k → ⊥ ) diso ¬p + lemma y lt | tri> ¬a ¬b c with osuc-≡< lt + lemma y lt | tri> ¬a ¬b c | case1 refl = ⊥-elim ( ¬b refl ) + lemma y lt | tri> ¬a ¬b c | case2 lt1 = ⊥-elim (o<> c lt1 ) + caseOSuc lx x (case2 found) | no ¬p = case2 found + caseOSuc1 : (lx : Nat) (x : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x) → ψ y) → + ψ (record { lv = lx ; ord = OSuc lx x }) + caseOSuc1 lx x lt = caseOSuc lx x (lt ( ordinal lx x ) (case2 s<refl)) + have_to_find : choiced X + have_to_find with lemma-ord (od→ord X ) + have_to_find | t = dont-or t ¬¬X∋x where + ¬¬X∋x : ¬ ((x : Ordinal) → (Suc (lv x) ≤ lv (od→ord X)) ∨ (ord x d< ord (od→ord X)) → def X x → ⊥) + ¬¬X∋x nn = not record { + eq→ = λ {x} lt → ⊥-elim (nn x (def→o< lt) lt) + ; eq← = λ {x} lt → ⊥-elim ( ¬x<0 lt ) + } +
--- a/zf.agda Thu Aug 01 12:24:26 2019 +0900 +++ b/zf.agda Mon Aug 12 09:04:16 2019 +0900 @@ -2,56 +2,12 @@ open import Level -data Bool : Set where - true : Bool - false : Bool - -record _∧_ {n m : Level} (A : Set n) ( B : Set m ) : Set (n ⊔ m) where - field - proj1 : A - proj2 : B - -data _∨_ {n m : Level} (A : Set n) ( B : Set m ) : Set (n ⊔ m) where - case1 : A → A ∨ B - case2 : B → A ∨ B - -_⇔_ : {n m : Level } → ( A : Set n ) ( B : Set m ) → Set (n ⊔ m) -_⇔_ A B = ( A → B ) ∧ ( B → A ) - +open import logic open import Relation.Nullary open import Relation.Binary open import Data.Empty - -contra-position : {n m : Level } {A : Set n} {B : Set m} → (A → B) → ¬ B → ¬ A -contra-position {n} {m} {A} {B} f ¬b a = ¬b ( f a ) - -double-neg : {n : Level } {A : Set n} → A → ¬ ¬ A -double-neg A notnot = notnot A - -double-neg2 : {n : Level } {A : Set n} → ¬ ¬ ¬ A → ¬ A -double-neg2 notnot A = notnot ( double-neg A ) - -de-morgan : {n : Level } {A B : Set n} → A ∧ B → ¬ ( (¬ A ) ∨ (¬ B ) ) -de-morgan {n} {A} {B} and (case1 ¬A) = ⊥-elim ( ¬A ( _∧_.proj1 and )) -de-morgan {n} {A} {B} and (case2 ¬B) = ⊥-elim ( ¬B ( _∧_.proj2 and )) - -dont-or : {n m : Level} {A : Set n} { B : Set m } → A ∨ B → ¬ A → B -dont-or {A} {B} (case1 a) ¬A = ⊥-elim ( ¬A a ) -dont-or {A} {B} (case2 b) ¬A = b - -dont-orb : {n m : Level} {A : Set n} { B : Set m } → A ∨ B → ¬ B → A -dont-orb {A} {B} (case2 b) ¬B = ⊥-elim ( ¬B b ) -dont-orb {A} {B} (case1 a) ¬B = a - --- mid-ex-neg : {n : Level } {A : Set n} → ( ¬ ¬ A ) ∨ (¬ A) --- mid-ex-neg {n} {A} = {!!} - -infixr 130 _∧_ -infixr 140 _∨_ -infixr 150 _⇔_ - record IsZF {n m : Level } (ZFSet : Set n) (_∋_ : ( A x : ZFSet ) → Set m) @@ -96,9 +52,9 @@ -- minimul : (x : ZFSet ) → ¬ (x ≈ ∅) → ZFSet -- regularity : ∀( x : ZFSet ) → (not : ¬ (x ≈ ∅)) → ( minimul x not ∈ x ∧ ( minimul x not ∩ x ≈ ∅ ) ) -- another form of regularity - ε-induction : { ψ : ZFSet → Set m} - → ( {x : ZFSet } → ({ y : ZFSet } → x ∋ y → ψ y ) → ψ x ) - → (x : ZFSet ) → ψ x + -- ε-induction : { ψ : ZFSet → Set m} + -- → ( {x : ZFSet } → ({ y : ZFSet } → x ∋ y → ψ y ) → ψ x ) + -- → (x : ZFSet ) → ψ x -- infinity : ∃ A ( ∅ ∈ A ∧ ∀ x ∈ A ( x ∪ { x } ∈ A ) ) infinity∅ : ∅ ∈ infinite infinity : ∀( x : ZFSet ) → x ∈ infinite → ( x ∪ { x }) ∈ infinite