Mercurial > hg > Members > kono > Proof > ZF-in-agda
diff constructible-set.agda @ 17:6a668c6086a5
clean up
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 14 May 2019 13:52:19 +0900 |
parents | ac362cc8b10f |
children | 627a79e61116 |
line wrap: on
line diff
--- a/constructible-set.agda Tue May 14 12:53:52 2019 +0900 +++ b/constructible-set.agda Tue May 14 13:52:19 2019 +0900 @@ -7,22 +7,26 @@ open import Relation.Binary.PropositionalEquality -data OridinalD : (lv : Nat) → Set n where - Φ : {lv : Nat} → OridinalD lv - OSuc : {lv : Nat} → OridinalD lv → OridinalD lv - ℵ_ : (lv : Nat) → OridinalD (Suc lv) +data OrdinalD : (lv : Nat) → Set n where + Φ : {lv : Nat} → OrdinalD lv + OSuc : {lv : Nat} → OrdinalD lv → OrdinalD lv + ℵ_ : (lv : Nat) → OrdinalD (Suc lv) record Ordinal : Set n where field lv : Nat - ord : OridinalD lv + ord : OrdinalD lv -data _o<_ : {lx ly : Nat} → OridinalD lx → OridinalD ly → Set n where - l< : {lx ly : Nat } → {x : OridinalD lx } → {y : OridinalD ly } → lx < ly → x o< y - Φ< : {lx : Nat} → {x : OridinalD lx} → Φ {lx} o< OSuc {lx} x - s< : {lx : Nat} → {x y : OridinalD lx} → x o< y → OSuc {lx} x o< OSuc {lx} y - ℵΦ< : {lx : Nat} → {x : OridinalD (Suc lx) } → Φ {Suc lx} o< (ℵ lx) - ℵ< : {lx : Nat} → {x : OridinalD (Suc lx) } → OSuc {Suc lx} x o< (ℵ lx) +data _d<_ : {lx ly : Nat} → OrdinalD lx → OrdinalD ly → Set n where + Φ< : {lx : Nat} → {x : OrdinalD lx} → Φ {lx} d< OSuc {lx} x + s< : {lx : Nat} → {x y : OrdinalD lx} → x d< y → OSuc {lx} x d< OSuc {lx} y + ℵΦ< : {lx : Nat} → {x : OrdinalD (Suc lx) } → Φ {Suc lx} d< (ℵ lx) + ℵ< : {lx : Nat} → {x : OrdinalD (Suc lx) } → OSuc {Suc lx} x d< (ℵ lx) + +open Ordinal + +_o<_ : ( x y : Ordinal ) → Set n +_o<_ x y = (lv x < lv y ) ∨ ( ord x d< ord y ) open import Data.Nat.Properties open import Data.Empty @@ -31,81 +35,49 @@ open import Relation.Binary open import Relation.Binary.Core - -≡→¬< : { x y : Nat } → x ≡ y → x < y → ⊥ -≡→¬< {Zero} {Zero} refl () -≡→¬< {Suc x} {.(Suc x)} refl (s≤s t) = ≡→¬< {x} {x} refl t - -x≤x : { x : Nat } → x ≤ x -x≤x {Zero} = z≤n -x≤x {Suc x} = s≤s ( x≤x ) - -x<>y : { x y : Nat } → x > y → x < y → ⊥ -x<>y {.(Suc _)} {.(Suc _)} (s≤s lt) (s≤s lt1) = x<>y lt lt1 +≡→¬d< : {lv : Nat} → {x : OrdinalD lv } → x d< x → ⊥ +≡→¬d< {lx} {OSuc y} (s< t) = ≡→¬d< t -triO> : {lx ly : Nat} {x : OridinalD lx } { y : OridinalD ly } → ly < lx → x o< y → ⊥ -triO> {lx} {ly} {x} {y} y<x xo<y with <-cmp lx ly -triO> {lx} {ly} {x} {y} y<x xo<y | tri< a ¬b ¬c = ¬c y<x -triO> {lx} {ly} {x} {y} y<x xo<y | tri≈ ¬a b ¬c = ¬c y<x -triO> {lx} {ly} {x} {y} y<x (l< x₁) | tri> ¬a ¬b c = ¬a x₁ -triO> {lx} {ly} {Φ} {OSuc _} y<x Φ< | tri> ¬a ¬b c = ¬b refl -triO> {lx} {ly} {OSuc px} {OSuc py} y<x (s< w) | tri> ¬a ¬b c = triO> y<x w -triO> {lx} {ly} {Φ {u}} {ℵ w} y<x ℵΦ< | tri> ¬a ¬b c = ¬b refl -triO> {lx} {ly} {(OSuc _)} {ℵ u} y<x ℵ< | tri> ¬a ¬b c = ¬b refl - -≡→¬o< : {lv : Nat} → {x : OridinalD lv } → x o< x → ⊥ -≡→¬o< {lx} {x} (l< y) = ≡→¬< refl y -≡→¬o< {lx} {OSuc y} (s< t) = ≡→¬o< t - -trio<> : {lx : Nat} {x : OridinalD lx } { y : OridinalD lx } → y o< x → x o< y → ⊥ -trio<> {lx} {x} {y} (l< lt) _ = ≡→¬< refl lt -trio<> {lx} {x} {y} _ (l< lt) = ≡→¬< refl lt +trio<> : {lx : Nat} {x : OrdinalD lx } { y : OrdinalD lx } → y d< x → x d< y → ⊥ trio<> {lx} {.(OSuc _)} {.(OSuc _)} (s< s) (s< t) = trio<> s t -trio<≡ : {lx : Nat} {x : OridinalD lx } { y : OridinalD lx } → x ≡ y → x o< y → ⊥ -trio<≡ refl = ≡→¬o< +trio<≡ : {lx : Nat} {x : OrdinalD lx } { y : OrdinalD lx } → x ≡ y → x d< y → ⊥ +trio<≡ refl = ≡→¬d< -trio>≡ : {lx : Nat} {x : OridinalD lx } { y : OridinalD lx } → x ≡ y → y o< x → ⊥ -trio>≡ refl = ≡→¬o< +trio>≡ : {lx : Nat} {x : OrdinalD lx } { y : OrdinalD lx } → x ≡ y → y d< x → ⊥ +trio>≡ refl = ≡→¬d< -triO : {lx ly : Nat} → OridinalD lx → OridinalD ly → Tri (lx < ly) ( lx ≡ ly ) ( lx > ly ) +triO : {lx ly : Nat} → OrdinalD lx → OrdinalD ly → Tri (lx < ly) ( lx ≡ ly ) ( lx > ly ) triO {lx} {ly} x y = <-cmp lx ly -triOonSameLevel : {lx : Nat} → Trichotomous _≡_ ( _o<_ {lx} {lx} ) -triOonSameLevel {lv} Φ Φ = tri≈ ≡→¬o< refl ≡→¬o< -triOonSameLevel {Suc lv} (ℵ lv) (ℵ lv) = tri≈ ≡→¬o< refl ≡→¬o< -triOonSameLevel {lv} Φ (OSuc y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< ) -triOonSameLevel {.(Suc lv)} Φ (ℵ lv) = tri< (ℵΦ< {lv} {Φ} ) (λ ()) ( λ lt → trio<> lt ((ℵΦ< {lv} {Φ} )) ) -triOonSameLevel {Suc lv} (ℵ lv) Φ = tri> ( λ lt → trio<> lt (ℵΦ< {lv} {Φ} ) ) (λ ()) (ℵΦ< {lv} {Φ} ) -triOonSameLevel {Suc lv} (ℵ lv) (OSuc y) = tri> ( λ lt → trio<> lt (ℵ< {lv} {y} ) ) (λ ()) (ℵ< {lv} {y} ) -triOonSameLevel {lv} (OSuc x) Φ = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ< -triOonSameLevel {.(Suc lv)} (OSuc x) (ℵ lv) = tri< ℵ< (λ ()) (λ lt → trio<> lt ℵ< ) -triOonSameLevel {lv} (OSuc x) (OSuc y) with triOonSameLevel x y -triOonSameLevel {lv} (OSuc x) (OSuc y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) ) ( λ lt → trio<> lt (s< a) ) -triOonSameLevel {lv} (OSuc x) (OSuc x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬o< refl ≡→¬o< -triOonSameLevel {lv} (OSuc x) (OSuc y) | tri> ¬a ¬b c = tri> ( λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c) +triOrdd : {lx : Nat} → Trichotomous _≡_ ( _d<_ {lx} {lx} ) +triOrdd {lv} Φ Φ = tri≈ ≡→¬d< refl ≡→¬d< +triOrdd {Suc lv} (ℵ lv) (ℵ lv) = tri≈ ≡→¬d< refl ≡→¬d< +triOrdd {lv} Φ (OSuc y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< ) +triOrdd {.(Suc lv)} Φ (ℵ lv) = tri< (ℵΦ< {lv} {Φ} ) (λ ()) ( λ lt → trio<> lt ((ℵΦ< {lv} {Φ} )) ) +triOrdd {Suc lv} (ℵ lv) Φ = tri> ( λ lt → trio<> lt (ℵΦ< {lv} {Φ} ) ) (λ ()) (ℵΦ< {lv} {Φ} ) +triOrdd {Suc lv} (ℵ lv) (OSuc y) = tri> ( λ lt → trio<> lt (ℵ< {lv} {y} ) ) (λ ()) (ℵ< {lv} {y} ) +triOrdd {lv} (OSuc x) Φ = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ< +triOrdd {.(Suc lv)} (OSuc x) (ℵ lv) = tri< ℵ< (λ ()) (λ lt → trio<> lt ℵ< ) +triOrdd {lv} (OSuc x) (OSuc y) with triOrdd x y +triOrdd {lv} (OSuc x) (OSuc y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) ) ( λ lt → trio<> lt (s< a) ) +triOrdd {lv} (OSuc x) (OSuc x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬d< refl ≡→¬d< +triOrdd {lv} (OSuc x) (OSuc y) | tri> ¬a ¬b c = tri> ( λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c) -<→≤ : {lx ly : Nat} → lx < ly → (Suc lx ≤ ly) -<→≤ {Zero} {Suc ly} (s≤s lt) = s≤s z≤n -<→≤ {Suc lx} {Zero} () -<→≤ {Suc lx} {Suc ly} (s≤s lt) = s≤s (<→≤ lt) +d<→lv : {x y : Ordinal } → ord x d< ord y → lv x ≡ lv y +d<→lv Φ< = refl +d<→lv (s< lt) = refl +d<→lv ℵΦ< = refl +d<→lv ℵ< = refl -orddtrans : {lx ly lz : Nat} {x : OridinalD lx } { y : OridinalD ly } { z : OridinalD lz } → x o< y → y o< z → x o< z -orddtrans {lx} {ly} {lz} x<y y<z with <-cmp lx ly | <-cmp ly lz -orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri< a₁ ¬b₁ ¬c₁ = l< ( <-trans a a₁ ) -orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri≈ ¬a refl ¬c₁ = l< a -orddtrans {lx} {ly} {lz} x<y y<z | tri< a ¬b ¬c | tri> ¬a ¬b₁ c = l< {!!} -- ⊥-elim ( ¬a c ) -orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri< a ¬b₁ ¬c = l< {!!} -orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri≈ ¬a₁ refl ¬c = l< {!!} -orddtrans {lx} {ly} {lz} x<y y<z | tri> ¬a ¬b c | tri> ¬a₁ ¬b₁ c₁ = {!!} -orddtrans {lx} {ly} {lz} x<y y<z | tri≈ ¬a refl ¬c | tri< a ¬b ¬c₁ = l< a -orddtrans {lx} {ly} {lz} x<y y<z | tri≈ ¬a refl ¬c | tri> ¬a₁ ¬b c = l< {!!} -orddtrans {lx} {lx} {lx} x<y y<z | tri≈ ¬a refl ¬c | tri≈ ¬a₁ refl ¬c₁ = orddtrans1 x<y y<z where - orddtrans1 : {lx : Nat} {x y z : OridinalD lx } → x o< y → y o< z → x o< z - orddtrans1 = {!!} - - +orddtrans : {lx : Nat} {x y z : OrdinalD lx } → x d< y → y d< z → x d< z +orddtrans {lx} {.Φ} {.(OSuc _)} {.(OSuc _)} Φ< (s< y<z) = Φ< +orddtrans {Suc lx} {Φ {Suc lx}} {OSuc y} {ℵ lx} Φ< ℵ< = ℵΦ< {lx} {y} +orddtrans {lx} {.(OSuc _)} {.(OSuc _)} {.(OSuc _)} (s< x<y) (s< y<z) = s< ( orddtrans x<y y<z ) +orddtrans {.(Suc _)} {.(OSuc _)} {.(OSuc _)} {.(ℵ _)} (s< x<y) ℵ< = ℵ< +orddtrans {.(Suc _)} {.Φ} {.(ℵ _)} {z} ℵΦ< () +orddtrans {.(Suc _)} {.(OSuc _)} {.(ℵ _)} {z} ℵ< () max : (x y : Nat) → Nat max Zero Zero = Zero @@ -113,30 +85,34 @@ max (Suc x) Zero = (Suc x) max (Suc x) (Suc y) = Suc ( max x y ) --- use cannot use OridinalD (Data.Nat_⊔_ lx ly), I don't know why - -maxα> : { lx ly : Nat } → OridinalD lx → OridinalD ly → lx > ly → OridinalD lx -maxα> x y _ = x +maxαd : { lx : Nat } → OrdinalD 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 -maxα= : { lx : Nat } → OridinalD lx → OridinalD lx → OridinalD lx -maxα= x y with triOonSameLevel x y -maxα= x y | tri< a ¬b ¬c = y -maxα= x y | tri≈ ¬a b ¬c = x -maxα= x y | tri> ¬a ¬b c = x +maxα : Ordinal → Ordinal → Ordinal +maxα x y with <-cmp (lv x) (lv y) +maxα x y | tri< a ¬b ¬c = x +maxα x y | tri> ¬a ¬b c = y +maxα x y | tri≈ ¬a refl ¬c = record { lv = lv x ; ord = maxαd (ord x) (ord y) } -OrdTrans : Transitive (λ ( a b : Ordinal ) → (a ≡ b) ∨ (Ordinal.lv a < Ordinal.lv b) ∨ (Ordinal.ord a o< Ordinal.ord b) ) +OrdTrans : Transitive (λ ( a b : Ordinal ) → (a ≡ b) ∨ (Ordinal.lv a < Ordinal.lv b) ∨ (Ordinal.ord a d< Ordinal.ord b) ) OrdTrans (case1 refl) (case1 refl) = case1 refl OrdTrans (case1 refl) (case2 lt2) = case2 lt2 OrdTrans (case2 lt1) (case1 refl) = case2 lt1 -OrdTrans (case2 (case1 x)) (case2 (case1 y)) = case2 ( case1 ( <-trans x y ) ) -OrdTrans (case2 (case1 x)) (case2 (case2 y)) = case2 {!!} -OrdTrans (case2 (case2 x)) (case2 (case1 y)) = case2 {!!} -OrdTrans (case2 (case2 x)) (case2 (case2 y)) = case2 {!!} +OrdTrans (case2 (case1 x)) (case2 (case1 y)) = case2 (case1 ( <-trans x y ) ) +OrdTrans (case2 (case1 x)) (case2 (case2 y)) with d<→lv y +OrdTrans (case2 (case1 x)) (case2 (case2 y)) | refl = case2 (case1 x ) +OrdTrans (case2 (case2 x)) (case2 (case1 y)) with d<→lv x +OrdTrans (case2 (case2 x)) (case2 (case1 y)) | refl = case2 (case1 y) +OrdTrans (case2 (case2 x)) (case2 (case2 y)) with d<→lv x | d<→lv y +OrdTrans (case2 (case2 x)) (case2 (case2 y)) | refl | refl = case2 (case2 (orddtrans x y )) OrdPreorder : Preorder n n n OrdPreorder = record { Carrier = Ordinal ; _≈_ = _≡_ - ; _∼_ = λ a b → (a ≡ b) ∨ (Ordinal.lv a < Ordinal.lv b) ∨ (Ordinal.ord a o< Ordinal.ord b ) + ; _∼_ = λ a b → (a ≡ b) ∨ ( a o< b ) ; isPreorder = record { isEquivalence = record { refl = refl ; sym = sym ; trans = trans } ; reflexive = case1 @@ -146,41 +122,40 @@ -- X' = { x ∈ X | ψ x } ∪ X , Mα = ( ∪ (β < α) Mβ ) ' -data Constructible {lv : Nat} ( α : OridinalD lv ) : Set (suc n) where - fsub : ( ψ : OridinalD lv → Set n ) → Constructible α - xself : OridinalD lv → Constructible α +data Constructible ( α : Ordinal ) : Set (suc n) where + fsub : ( ψ : Ordinal → Set n ) → Constructible α + xself : Ordinal → Constructible α record ConstructibleSet : Set (suc n) where field - level : Nat - α : OridinalD level + α : Ordinal constructible : Constructible α open ConstructibleSet -data _c∋_ : {lv lv' : Nat} {α : OridinalD lv } {α' : OridinalD lv' } → - Constructible {lv} α → Constructible {lv'} α' → Set n where - c> : {lv lv' : Nat} {α : OridinalD lv } {α' : OridinalD lv' } - (ta : Constructible {lv} α ) ( tx : Constructible {lv'} α' ) → α' o< α → ta c∋ tx - xself-fsub : {lv : Nat} {α : OridinalD lv } - (ta : OridinalD lv ) ( ψ : OridinalD lv → Set n ) → _c∋_ {_} {_} {α} {α} (xself ta ) ( fsub ψ) - fsub-fsub : {lv lv' : Nat} {α : OridinalD lv } - ( ψ : OridinalD lv → Set n ) ( ψ₁ : OridinalD lv → Set n ) → - ( ∀ ( x : OridinalD lv ) → ψ x → ψ₁ x ) → _c∋_ {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁) +data _c∋_ : {α α' : Ordinal } → + Constructible α → Constructible α' → Set n where + c> : {α α' : Ordinal } + (ta : Constructible α ) ( tx : Constructible α' ) → α' o< α → ta c∋ tx + xself-fsub : {α : Ordinal } + (ta : Ordinal ) ( ψ : Ordinal → Set n ) → _c∋_ {α} {α} (xself ta ) ( fsub ψ) + fsub-fsub : {α : Ordinal } + ( ψ : Ordinal → Set n ) ( ψ₁ : Ordinal → Set n ) → + ( ∀ ( x : Ordinal ) → ψ x → ψ₁ x ) → _c∋_ {α} {α} ( fsub ψ ) ( fsub ψ₁) _∋_ : (ConstructibleSet ) → (ConstructibleSet ) → Set n a ∋ x = constructible a c∋ constructible x -transitiveness : (a b c : ConstructibleSet ) → a ∋ b → b ∋ c → a ∋ c -transitiveness a b c a∋b b∋c with constructible a c∋ constructible b | constructible b c∋ constructible c -... | t1 | t2 = {!!} +-- transitiveness : (a b c : ConstructibleSet ) → a ∋ b → b ∋ c → a ∋ c +-- transitiveness a b c a∋b b∋c with constructible a c∋ constructible b | constructible b c∋ constructible c +-- ... | t1 | t2 = {!!} -data _c≈_ : {lv lv' : Nat} {α : OridinalD lv } {α' : OridinalD lv' } → - Constructible {lv} α → Constructible {lv'} α' → Set n where - crefl : {lv : Nat} {α : OridinalD lv } → _c≈_ {_} {_} {α} {α} (xself α ) (xself α ) - feq : {lv : Nat} {α : OridinalD lv } - → ( ψ : OridinalD lv → Set n ) ( ψ₁ : OridinalD lv → Set n ) - → (∀ ( x : OridinalD lv ) → ψ x ⇔ ψ₁ x ) → _c≈_ {_} {_} {α} {α} ( fsub ψ ) ( fsub ψ₁) +data _c≈_ : {α α' : Ordinal} → + Constructible α → Constructible α' → Set n where + crefl : {α : Ordinal } → _c≈_ {α} {α} (xself α ) (xself α ) + feq : {lv : Nat} {α : Ordinal } + → ( ψ : Ordinal → Set n ) ( ψ₁ : Ordinal → Set n ) + → (∀ ( x : Ordinal ) → ψ x ⇔ ψ₁ x ) → _c≈_ {α} {α} ( fsub ψ ) ( fsub ψ₁) _≈_ : (ConstructibleSet ) → (ConstructibleSet ) → Set n a ≈ x = constructible a c≈ constructible x @@ -190,7 +165,7 @@ ZFSet = ConstructibleSet ; _∋_ = _∋_ ; _≈_ = _≈_ - ; ∅ = record { level = Zero ; α = Φ ; constructible = xself Φ } + ; ∅ = record { α = record {lv = Zero ; ord = Φ } ; constructible = xself ( record {lv = Zero ; ord = Φ }) } ; _×_ = {!!} ; Union = {!!} ; Power = {!!}